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     : isInLocalSubdomain_(src.isInLocalSubdomain_),
00028       ID_(src.ID_),
00029       number_(src.number_),
00030       fieldMask_(src.fieldMask_),
00031       offsetIntoEqnNumbers_(src.offsetIntoEqnNumbers_),
00032       ownerProc_(src.ownerProc_),
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 
00138   bool isInLocalSubdomain_;
00139 
00140   Record<GlobalIDType>& operator=(const Record<GlobalIDType>& src)
00141   {
00142     ID_ = src.ID_;
00143     number_ = src.number_;
00144     fieldMask_ = src.fieldMask_;
00145     offsetIntoEqnNumbers_ = src.offsetIntoEqnNumbers_;
00146     ownerProc_ = src.ownerProc_;
00147     hasSlaveDof_ = src.hasSlaveDof_;
00148     return *this;
00149   }
00150 
00151 private:
00152 
00153   GlobalIDType ID_;
00154   GlobalIDType number_;
00155 
00156   fei::FieldMask* fieldMask_;
00157 
00158   int offsetIntoEqnNumbers_;
00159 
00160   int ownerProc_;
00161 
00162   bool hasSlaveDof_;
00163 };
00164 
00166 template<class GlobalIDType>
00167 class Record_Operator {
00168   public:
00170     virtual ~Record_Operator(){}
00171 
00173     virtual void operator()(Record<GlobalIDType>& record) = 0;
00174 
00175 };//class Record_Operator
00176 
00177 template<class GlobalIDType>
00178 fei::Record<GlobalIDType>::Record()
00179   : isInLocalSubdomain_(false),
00180     ID_(-1),
00181     number_(-1),
00182     fieldMask_(NULL),
00183     offsetIntoEqnNumbers_(0),
00184     ownerProc_(-1),
00185     hasSlaveDof_(false)
00186 {
00187 }
00188 
00189 template<class GlobalIDType>
00190 fei::Record<GlobalIDType>::~Record()
00191 {
00192 }
00193 
00194 
00195 } //namespace fei
00196 
00197 #endif // _fei_Record_hpp_
00198 

Generated on Tue Jul 13 09:27:45 2010 for FEI by  doxygen 1.4.7