AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects Version of the Day
AbstractLinAlgPack_SparsePtrElement.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef SPARSE_PTR_ELEMENT_H
00030 #define SPARSE_PTR_ELEMENT_H
00031 
00032 #include "AbstractLinAlgPack_Types.hpp"
00033 
00034 namespace AbstractLinAlgPack {
00035 
00045 template <class T_Indice, class T_Value>
00046 class SparsePtrElement {
00047 public:
00050 
00052   typedef T_Value             value_type;
00054   typedef T_Indice            indice_type;
00055 
00057 
00060 
00062   SparsePtrElement() : indice_(0), pvalue_(0)
00063   {}
00064 
00066   SparsePtrElement(indice_type indice, value_type* pvalue) : indice_(indice), pvalue_(pvalue)
00067   {}
00068   
00070 
00073 
00075   value_type& value()
00076   {
00077     return *pvalue_;
00078   }
00080   value_type value() const
00081   {
00082     return *pvalue_;
00083   }
00085   indice_type indice() const
00086   {
00087     return indice_;
00088   }
00090   void change_indice(indice_type indice)
00091   {
00092     indice_ = indice;
00093   }
00095   void change_value_ptr(value_type* pvalue)
00096   {
00097     pvalue_ = pvalue;
00098   }
00099 
00101 private:
00102   indice_type       indice_;
00103   value_type*       pvalue_;
00104 
00105 };  // end class SparsePtrElement
00106 
00107 } // end namespace AbstractLinAlgPack 
00108 
00109 #endif // SPARSE_PTR_ELEMENT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends