FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
snl_fei_RecordCollection.hpp
Go to the documentation of this file.
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef _snl_fei_RecordCollection_hpp_
10 #define _snl_fei_RecordCollection_hpp_
11 
12 #include <fei_iosfwd.hpp>
13 #include <fei_Pool_alloc.hpp>
14 #include <fei_FieldMask.hpp>
15 #include <fei_Record.hpp>
16 
17 #include <map>
18 #include <vector>
19 
20 #undef fei_file
21 #define fei_file "snl_fei_RecordCollection.hpp"
22 
23 #include <fei_ErrMacros.hpp>
24 
25 namespace fei {
26  template<typename T> class SharedIDs;
27 }
28 
29 namespace snl_fei {
30 
33  public:
36 
39 
41  virtual ~RecordCollection();
42 
43  void setIDMap(const int* localIDs_begin, const int* localIDs_end,
44  const int* globalIDs_begin, const int* globalIDs_end);
45 
47  void initRecords(int numIDs,
48  const int* IDs,
49  std::vector<fei::FieldMask*>& fieldMasks,
50  int* recordLocalIDs=NULL);
51 
53  void initRecords(int fieldID,
54  int fieldSize,
55  int numIDs,
56  const int* IDs,
57  std::vector<fei::FieldMask*>& fieldMasks,
58  int* recordLocalIDs=NULL);
59 
63  void setOwners_local();
64 
66  size_t getNumRecords() const
67  {
68  return( m_records.size() );
69  }
70 
72  std::map<int,int>& getGlobalToLocalMap()
73  { return m_global_to_local; }
74 
75  const std::map<int,int>& getGlobalToLocalMap() const
76  { return m_global_to_local; }
77 
79  std::vector<fei::Record<int> >& getRecords()
80  {
81  return( m_records );
82  }
83 
85  const std::vector<fei::Record<int> >& getRecords() const
86  {
87  return( m_records );
88  }
89 
92 
94  const fei::Record<int>* getRecordWithID(int ID) const;
95 
97  { return &m_records[lid]; }
98 
99  const fei::Record<int>* getRecordWithLocalID(int lid) const
100  { return &m_records[lid]; }
101 
102  int getLocalID(int global_id) const
103  {
104  std::map<int,int>::const_iterator iter = m_global_to_local.find(global_id);
105  if (iter == m_global_to_local.end()) {
106  return -1;
107  }
108  return iter->second;
109  }
110 
112  int getGlobalIndex(int ID,
113  int fieldID,
114  int fieldSize,
115  int fieldOffset,
116  int whichComponentOfField,
117  const int* eqnNumbers);
118 
120  int getGlobalIndexLocalID(int localID,
121  int fieldID,
122  int fieldSize,
123  int fieldOffset,
124  int whichComponentOfField,
125  const int* eqnNumbers);
126 
128  int getGlobalBlkIndex(int ID, int& globalBlkIndex);
129 
132  {
133  dbgOut_ = dbgOut;
134  debugOutput_ = true;
135  }
136 
137  int getMinID() const { return m_minID; }
138  int getMaxID() const { return m_maxID; }
139 
140  private:
141 
142  std::vector<fei::Record<int> > m_records;
143  std::map<int,int> m_global_to_local;
144 
146 
148 
151  };
152 
153 } //namespace snl_fei
154 
155 #undef fei_file
156 
157 #endif // _snl_fei_RecordCollection_hpp_
const fei::Record< int > * getRecordWithLocalID(int lid) const
const std::vector< fei::Record< int > > & getRecords() const
void setDebugOutput(FEI_OSTREAM *dbgOut)
void setOwners_lowestSharing(fei::SharedIDs< int > &sharedIDs)
std::vector< fei::Record< int > > m_records
std::vector< fei::Record< int > > & getRecords()
int getLocalID(int global_id) const
#define FEI_OSTREAM
Definition: fei_iosfwd.hpp:24
#define dbgOut()
Definition: FEData.hpp:17
int getGlobalIndex(int ID, int fieldID, int fieldSize, int fieldOffset, int whichComponentOfField, const int *eqnNumbers)
fei::Record< int > * getRecordWithLocalID(int lid)
std::map< int, int > & getGlobalToLocalMap()
int localProc(MPI_Comm comm)
void setIDMap(const int *localIDs_begin, const int *localIDs_end, const int *globalIDs_begin, const int *globalIDs_end)
const std::map< int, int > & getGlobalToLocalMap() const
void initRecords(int numIDs, const int *IDs, std::vector< fei::FieldMask * > &fieldMasks, int *recordLocalIDs=NULL)
int getGlobalBlkIndex(int ID, int &globalBlkIndex)
fei::Record< int > * getRecordWithID(int ID)
int getGlobalIndexLocalID(int localID, int fieldID, int fieldSize, int fieldOffset, int whichComponentOfField, const int *eqnNumbers)