FEI Version of the Day
fei_Record.hpp
00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #ifndef _fei_Record_hpp_
00010 #define _fei_Record_hpp_
00011 
00012 #include <fei_macros.hpp>
00013 
00014 namespace fei {
00015 class FieldMask;
00016 
00019 template<typename GlobalIDType>
00020 class Record {
00021 public:
00023   Record();
00024 
00026   Record(const Record<GlobalIDType>& src)
00027     : ID_(src.ID_),
00028       number_(src.number_),
00029       fieldMask_(src.fieldMask_),
00030       offsetIntoEqnNumbers_(src.offsetIntoEqnNumbers_),
00031       ownerProc_(src.ownerProc_),
00032       isInLocalSubdomain_(src.isInLocalSubdomain_),
00033       hasSlaveDof_(src.hasSlaveDof_)
00034     {}
00035 
00037   virtual ~Record();
00038 
00040   void setID(const GlobalIDType& ID)
00041   {
00042     ID_ = ID;
00043   }
00044 
00046   GlobalIDType getID() const
00047   {
00048     return(ID_);
00049   }
00050 
00052   void setNumber(const GlobalIDType& num)
00053   {
00054     number_ = num;
00055   }
00056 
00058   GlobalIDType getNumber() const
00059   {
00060     return(number_);
00061   }
00062 
00064   bool operator==(const Record<GlobalIDType>& rcd) const
00065   {
00066     return( ID_ == rcd.ID_ );
00067   }
00068 
00070   bool operator!=(const Record<GlobalIDType>& rcd) const
00071   {
00072     return( ID_ != rcd.ID_ );
00073   }
00074 
00076   bool operator<(const Record<GlobalIDType>& rcd) const
00077   {
00078     return( ID_ < rcd.ID_ );
00079   }
00080 
00082   bool operator>(const Record<GlobalIDType>& rcd) const
00083   {
00084     return( ID_ > rcd.ID_ );
00085   }
00086 
00088   void setOwnerProc(int owner)
00089   {
00090     ownerProc_ = owner;
00091   }
00092 
00094   int getOwnerProc() const
00095   {
00096     return(ownerProc_);
00097   }
00098 
00100   void setFieldMask(fei::FieldMask* fm)
00101   {
00102     fieldMask_ = fm;
00103   }
00104 
00106   fei::FieldMask* getFieldMask()
00107   {
00108     return( fieldMask_ );
00109   }
00110 
00112   const fei::FieldMask* getFieldMask() const
00113   {
00114     return( fieldMask_ );
00115   }
00116 
00119   void setOffsetIntoEqnNumbers(int offset)
00120   {
00121     offsetIntoEqnNumbers_ = offset;
00122   }
00123 
00126   int getOffsetIntoEqnNumbers() const
00127   {
00128     return(offsetIntoEqnNumbers_);
00129   }
00130 
00131   bool hasSlaveDof() const
00132   { return( hasSlaveDof_ ); }
00133 
00134   void hasSlaveDof(bool flag)
00135   { hasSlaveDof_ = flag; }
00136 
00137   Record<GlobalIDType>& operator=(const Record<GlobalIDType>& src)
00138   {
00139     ID_ = src.ID_;
00140     number_ = src.number_;
00141     fieldMask_ = src.fieldMask_;
00142     offsetIntoEqnNumbers_ = src.offsetIntoEqnNumbers_;
00143     ownerProc_ = src.ownerProc_;
00144     isInLocalSubdomain_ = src.isInLocalSubdomain_;
00145     hasSlaveDof_ = src.hasSlaveDof_;
00146     return *this;
00147   }
00148 
00149 private:
00150 
00151   GlobalIDType ID_;
00152   GlobalIDType number_;
00153 
00154   fei::FieldMask* fieldMask_;
00155 
00156   int offsetIntoEqnNumbers_;
00157 
00158   int ownerProc_;
00159 
00160 public:
00162   bool isInLocalSubdomain_;
00163 
00164 private:
00165   bool hasSlaveDof_;
00166 };
00167 
00169 template<class GlobalIDType>
00170 class Record_Operator {
00171   public:
00173     virtual ~Record_Operator(){}
00174 
00176     virtual void operator()(Record<GlobalIDType>& record) = 0;
00177 
00178 };//class Record_Operator
00179 
00180 template<class GlobalIDType>
00181 fei::Record<GlobalIDType>::Record()
00182   : ID_(-1),
00183     number_(-1),
00184     fieldMask_(NULL),
00185     offsetIntoEqnNumbers_(0),
00186     ownerProc_(-1),
00187     isInLocalSubdomain_(false),
00188     hasSlaveDof_(false)
00189 {
00190 }
00191 
00192 template<class GlobalIDType>
00193 fei::Record<GlobalIDType>::~Record()
00194 {
00195 }
00196 
00197 
00198 } //namespace fei
00199 
00200 #endif // _fei_Record_hpp_
00201 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends