snl_fei_RecordCollection.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 _snl_fei_RecordCollection_hpp_
00010 #define _snl_fei_RecordCollection_hpp_
00011 
00012 #include <fei_iosfwd.hpp>
00013 #include <fei_Pool_alloc.hpp>
00014 #include <fei_FieldMask.hpp>
00015 #include <fei_Record.hpp>
00016 
00017 #include <map>
00018 
00019 #undef fei_file
00020 #define fei_file "snl_fei_RecordCollection.hpp"
00021 
00022 #include <fei_ErrMacros.hpp>
00023 
00024 namespace fei {
00025   template<typename T> class SharedIDs;
00026 }
00027 
00028 namespace snl_fei {
00029 
00031   class RecordCollection {
00032   public:
00034     RecordCollection(int localProc);
00035 
00037     RecordCollection(const RecordCollection& src);
00038 
00040     virtual ~RecordCollection();
00041 
00043     typedef std::map<int,fei::Record<int>*> map_type;
00044 
00046     void initRecords(int numIDs,
00047          const int* IDs,
00048          std::vector<fei::FieldMask*>& fieldMasks,
00049          fei::Record<int>** records=NULL);
00050 
00052     void initRecords(int fieldID,
00053         int fieldSize,
00054         int numInstances,
00055         int numIDs,
00056         const int* IDs,
00057         std::vector<fei::FieldMask*>& fieldMasks,
00058         bool skipIDsWithThisField=true);
00059 
00061     void initRecords(int fieldID,
00062         int fieldSize,
00063         int numInstances,
00064         int numIDs,
00065         const int* IDs,
00066         std::vector<fei::FieldMask*>& fieldMasks,
00067         fei::Record<int>** records,
00068         bool skipIDsWithThisField=true);
00069 
00072     void setOwners_lowestSharing(fei::SharedIDs<int>& sharedIDs);
00073 
00075     size_t getNumRecords()
00076     {
00077       return( records_.size() );
00078     }
00079 
00081     map_type& getRecords()
00082     {
00083       return( records_ );
00084     }
00085 
00087     const map_type& getRecords() const
00088     {
00089       return( records_ );
00090     }
00091 
00093     fei::Record<int>* getRecordWithID(int ID);
00094 
00096     const fei::Record<int>* getRecordWithID(int ID) const;
00097 
00099     int getGlobalIndex(int ID,
00100         int fieldID,
00101         int fieldSize,
00102         int fieldOffset,
00103         int whichComponentOfField,
00104         const int* eqnNumbers);
00105 
00107     int getGlobalBlkIndex(int ID, int& globalBlkIndex);
00108 
00110     void setDebugOutput(FEI_OSTREAM* dbgOut)
00111       {
00112   dbgOut_ = dbgOut;
00113   debugOutput_ = true;
00114       }
00115 
00116   private:
00117 
00118     map_type records_;
00119 
00120     int localProc_;
00121 
00122     fei_Pool_alloc<fei::Record<int> > recordPool_;
00123 
00124     bool debugOutput_;
00125     FEI_OSTREAM* dbgOut_;
00126   };
00127 
00128 } //namespace snl_fei
00129 
00130 #undef fei_file
00131 
00132 #endif // _snl_fei_RecordCollection_hpp_

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