9 #ifndef _fei_Lookup_Impl_hpp_
10 #define _fei_Lookup_Impl_hpp_
12 #include <fei_macros.hpp>
13 #include <fei_MatrixGraph.hpp>
14 #include <fei_Pattern.hpp>
15 #include <fei_ConnectivityBlock.hpp>
16 #include <fei_SharedIDs.hpp>
17 #include <snl_fei_RecordCollection.hpp>
18 #include <snl_fei_PointBlockMap.hpp>
19 #include <fei_TemplateUtils.hpp>
20 #include <fei_Lookup.hpp>
52 if (len < 1)
return(NULL);
55 return(&fieldIDs_[0]);
62 if (fieldIDs == NULL)
return(NULL);
64 unsigned numFields = fieldIDs_.size();
65 fieldSizes_.resize(numFields);
66 int* fsPtr = &fieldSizes_[0];
67 for(
unsigned i=0; i<numFields; ++i) {
81 return(err==0 ? &elemBlockIDs_[0] : NULL);
86 int& interleaveStrategy,
int& lumpingStrategy,
87 int& numElemDOF,
int& numElements,
88 int& numNodesPerElem,
int& numEqnsPerElem)
90 interleaveStrategy = 0; lumpingStrategy = 0;
103 if (cblock==NULL)
return(NULL);
111 if (cblock==NULL)
return(NULL);
115 fieldIDs_2D_.resize(numNodes);
116 const int** f2dPtr = &fieldIDs_2D_[0];
118 for(
int i=0; i<numNodes; ++i) {
119 f2dPtr[i] = fieldIDs + offset;
120 offset += numFieldsPerNode[i];
131 int getAssociatedNodeID(
int eqnNumber);
142 std::vector<int>* subdomains = NULL;
143 std::map<int,std::vector<int>* >::iterator
144 nns_iter = nodenumSubdomainDB_.find(nodeNumber);
145 if (nns_iter != nodenumSubdomainDB_.end()) subdomains = (*nns_iter).second;
146 return( subdomains==0 ? 0 : subdomains->size() );
152 std::vector<int>* subdomains = NULL;
153 std::map<int,std::vector<int>* >::iterator
154 nns_iter = nodenumSubdomainDB_.find(nodeNumber);
155 if (nns_iter != nodenumSubdomainDB_.end()) subdomains = (*nns_iter).second;
157 return( subdomains==0 ? NULL : &(*subdomains)[0] );
165 return(err==0 ? numShared : -1);
174 workspace_.resize(numShared*2);
175 int* wkPtr = &workspace_[0];
181 for(
int i=0; i<numShared; ++i) {
183 if (node == NULL)
return NULL;
187 return(wkPtr+numShared);
193 std::map<int,fei::Record<int>*>::iterator
194 nnp_iter = nodenumPairs_.find(nodeNumber);
196 if (nnp_iter == nodenumPairs_.end())
return(0);
202 int shID = node->
getID();
206 if (iter == sharedIDs.
getSharedIDs().end())
return(NULL);
208 const std::set<int>& shprocs = iter->second;
211 return(&workspace_[0]);
217 std::map<int,fei::Record<int>*>::iterator
218 nnp_iter = nodenumPairs_.find(nodeNumber);
220 if (nnp_iter == nodenumPairs_.end())
return(0);
226 int shID = node->
getID();
232 const std::set<int>& shprocs = iter->second;
233 return(shprocs.size());
254 int buildDatabases();
261 std::map<int, fei::Record<int>*> nodenumPairs_;
262 std::map<int,fei::Record<int>*> eqnnumPairs_;
264 std::map<int,std::vector<int>*> nodenumSubdomainDB_;
266 bool databasesBuilt_;
268 std::vector<int> fieldIDs_;
269 std::vector<int> fieldSizes_;
270 std::vector<GlobalID> elemBlockIDs_;
271 std::vector<const int*> fieldIDs_2D_;
272 std::vector<int> workspace_;
276 #endif // _fei_Lookup_Impl_hpp_
GlobalIDType getNumber() const
int getBlkEqnSize(int blkEqn)
const std::map< int, int > & getConnectivityIDs() const
const int * getSharedNodeProcs(int nodeNumber)
int getNumIndices() const
map_type & getSharedIDs()
const int * getNumFieldsPerID() const
void copySetToVector(const std::set< T > &set_obj, std::vector< T > &vec)
Lookup_Impl(fei::SharedPtr< fei::MatrixGraph > matGraph, int nodeIDType)
int getAssociatedFieldID(int eqnNumber)
int * getSubdomainList(int nodeNumber)
int getNumSubdomains(int nodeNumber)
virtual const fei::ConnectivityBlock * getConnectivityBlock(int blockID) const =0
const int * getFieldIDs() const
bool isExactlyBlkEqn(int ptEqn)
int getAssociatedNodeNumber(int eqnNumber)
const int *const * getFieldIDsTable(GlobalID blockID)
virtual std::map< int, fei::ConnectivityBlock * > & getConnectivityBlocks()=0
void copyKeysToArray(const MAP_TYPE &map_obj, unsigned lenList, int *list)
bool isExactlyBlkEqn(int ptEqn)
const GlobalID * getElemBlockIDs()
int ptEqnToBlkEqn(int ptEqn)
int getNumSharingProcs(int nodeNumber)
int eqnToBlkEqn(int eqn) const
int getNumSharedIDs(int idType, int &numShared)
void getFields(std::vector< int > &fieldIDs)
const int * getNumFieldsPerNode(GlobalID blockID)
int getFieldSize(int fieldID)
const int * getFieldSizesPtr()
const int * getSharedNodeNumbers()
int getBlkEqnSize(int blkEqn)
void getElemBlockInfo(GlobalID blockID, int &interleaveStrategy, int &lumpingStrategy, int &numElemDOF, int &numElements, int &numNodesPerElem, int &numEqnsPerElem)
int getEqnNumber(int nodeNumber, int fieldID)
const int * getFieldIDsPtr()
GlobalIDType getID() const
unsigned getFieldSize(int fieldID)
bool isInLocalElement(int nodeNumber)
virtual int getConnectivityBlockIDs(std::vector< int > &blockIDs) const =0
int getRecordCollection(int idType, snl_fei::RecordCollection *&records)
int getOffsetIntoBlkEqn(int blkEqn, int ptEqn)
const fei::Pattern * getRowPattern() const