FEI Version of the Day

#include <fei_NodeDatabase.hpp>
Public Member Functions  
NodeDatabase (std::map< int, int > *fieldDatabase, NodeCommMgr *nodeCommMgr)  
virtual  ~NodeDatabase () 
int  getNumNodeDescriptors () const 
std::map< GlobalID, int > &  getNodeIDs () 
int  getNodeWithID (GlobalID nodeID, const NodeDescriptor *&node) const 
int  getNodeWithNumber (int nodeNumber, const NodeDescriptor *&node) const 
int  getNodeWithEqn (int eqnNumber, const NodeDescriptor *&node) const 
void  getNodeAtIndex (int i, const NodeDescriptor *&node) const 
int  countLocalNodalEqns (int localRank) 
int  countLocalNodeDescriptors (int localRank) 
int  getIndexOfID (GlobalID nodeID) const 
int  initNodeID (GlobalID nodeID) 
int  initNodeIDs (GlobalID *nodeIDs, int numNodes) 
int  synchronize (int firstLocalNodeNumber, int firstLocalEqn, int localRank, MPI_Comm comm) 
int  getAssociatedNodeNumber (int eqnNumber) 
int  getAssociatedFieldID (int eqnNumber) 
bool  isSynchronized () 
Container that holds NodeDescriptors, and is able to reference them by global identifiers, or by nodeNumbers or eqnNumbers.
These are the 3 fundamental ways to refer to a node:
The goal of this class is to be able to provide a node's descriptor as fast as possible, given a nodeID, nodeNumber, or eqnNumber. Binary searches are used wherever possible.
The returnvalue of all functions in this class (except trivial query/accessor functions) is an errorcode. If the function is successful, the errorcode is 0. If a nodenotfound error occurs, 1 is returned. If an allocation fails, 2 is returned.
This class is intended to be used by an FEI implementation, with usage proceeding in 3 distinct 'phases':
Definition at line 66 of file fei_NodeDatabase.hpp.
NodeDatabase::NodeDatabase  (  std::map< int, int > *  fieldDatabase, 
NodeCommMgr *  nodeCommMgr  
) 
Constructor.
Definition at line 23 of file fei_NodeDatabase.cpp.
NodeDatabase::~NodeDatabase  (  )  [virtual] 
Destructor.
Definition at line 40 of file fei_NodeDatabase.cpp.
int NodeDatabase::getNumNodeDescriptors  (  )  const [inline] 
Obtain numberofnodedescriptors (in function's returnvalue). Note that this remains 0 until after allocateNodeDescriptors() is called.
Definition at line 78 of file fei_NodeDatabase.hpp.
std::map<GlobalID,int>& NodeDatabase::getNodeIDs  (  )  [inline] 
Obtain the set of nodeIDs. This is available anytime, and doesn't necessarily imply that there is a corresponding array of NodeDescriptors.
Definition at line 83 of file fei_NodeDatabase.hpp.
int NodeDatabase::getNodeWithID  (  GlobalID  nodeID, 
const NodeDescriptor *&  node  
)  const 
Given a nodeID, return the corresponding nodedescriptor. This function is only available after allocateNodeDescriptors() has been called (returns 1 if allocateNodeDescriptors() hasn't been called).
nodeID  Input. nodeID for which a NodeDescriptor is required. 
node  Output. NodeDescriptor corresponding to node 'nodeID'. If no corresponding node is found, or if allocatedNodeDescriptors() hasn't been called yet, node is not referenced. 
Definition at line 55 of file fei_NodeDatabase.cpp.
int NodeDatabase::getNodeWithNumber  (  int  nodeNumber, 
const NodeDescriptor *&  node  
)  const 
Given a nodeNumber, return the corresponding nodedescriptor.
nodeNumber  Input. nodeNumber for which a NodeDescriptor is required. This function returns 1 (and doesn't reference 'node') if synchronize() hasn't been called yet. 
node  Output. NodeDescriptor corresponding to node 'nodeNumber'. If no corresponding node is found, node is not referenced. 
Definition at line 81 of file fei_NodeDatabase.cpp.
int NodeDatabase::getNodeWithEqn  (  int  eqnNumber, 
const NodeDescriptor *&  node  
)  const 
Given an equationnumber, return the corresponding nodedescriptor.
eqnNumber  Input. eqnNumber for which a NodeDescriptor is required. 
node  Output. NodeDescriptor corresponding to eqnNumber. If no corresponding node is found, node is not referenced. 
Definition at line 100 of file fei_NodeDatabase.cpp.
void NodeDatabase::getNodeAtIndex  (  int  i, 
const NodeDescriptor *&  node  
)  const 
Given an index i, return the ith nodedescriptor.
i  Input. Offset of requested NodeDescriptor. 
node  Output. ith NodeDescriptor. 
Definition at line 137 of file fei_NodeDatabase.cpp.
int NodeDatabase::countLocalNodalEqns  (  int  localRank  ) 
Run through the locallyowned NodeDescriptors and count the number of nodal equations. (Returns 0 if the nodedescriptors haven't been allocated or initialized yet.) The result is produced in the function's returnvalue.
Definition at line 161 of file fei_NodeDatabase.cpp.
int NodeDatabase::countLocalNodeDescriptors  (  int  localRank  ) 
Return the number of internal nodedescriptors that are locallyowned. This function runs through all currently allocated NodeDescriptors, counting the ones for which ownerProc()==localRank. The result is produced in the returnvalue. (Obviously returns 0 if the nodedescriptors haven't been allocated or initialized yet.)
Definition at line 184 of file fei_NodeDatabase.cpp.
int NodeDatabase::getIndexOfID  (  GlobalID  nodeID  )  const 
Given a nodeID, return (in function's returnvalue) the index of that nodeID.
nodeID  Input 
Definition at line 195 of file fei_NodeDatabase.cpp.
int NodeDatabase::initNodeID  (  GlobalID  nodeID  ) 
Initialization, add node with global identifier 'nodeID'. Only available before 'allocatedNodeDescriptors' has been called. Note that nodeIDs can be initialized multiple times using this function, but nodeID is only stored once in the internal array.
nodeID  Input. 
Definition at line 206 of file fei_NodeDatabase.cpp.
int NodeDatabase::initNodeIDs  (  GlobalID *  nodeIDs, 
int  numNodes  
) 
Initialization, add nodes with global identifiers 'nodeIDs'. Only available before 'allocatedNodeDescriptors' has been called. Note that nodeIDs can be initialized multiple times using this function, but each nodeID is only stored once in the internal array.
nodeIDs  Input. 
Definition at line 231 of file fei_NodeDatabase.cpp.
int NodeDatabase::synchronize  (  int  firstLocalNodeNumber, 
int  firstLocalEqn,  
int  localRank,  
MPI_Comm  comm  
) 
Signal that nodedescriptor initialization is complete. In other words, that the calling code has set fieldIDs, equationnumbers and ownerproc information on each nodedescriptor. At this point, this class will run through the array of nodedescriptors and set the nodeNumber for each node, as well as setting the crossreferencing info required to look up nodes by equationnumber.
firstLocalNodeNumber  Input. This will be the starting point for assigning nodenumbers within this function. 
firstLocalEqn  Input. This will be the starting point for assigning equationnumbers within this function. 
localRank  Input. MPI rank of the local processor. 
Definition at line 243 of file fei_NodeDatabase.cpp.
int NodeDatabase::getAssociatedNodeNumber  (  int  eqnNumber  ) 
Given an equationnumber, return the associated nodeNumber. i.e., return the nodeNumber of the node that contains eqnNumber.
Definition at line 344 of file fei_NodeDatabase.cpp.
int NodeDatabase::getAssociatedFieldID  (  int  eqnNumber  ) 
Given an equationnumber, return the associated fieldID. i.e., return the fieldID of the nodal solution field that contains eqnNumber.
Definition at line 380 of file fei_NodeDatabase.cpp.
bool NodeDatabase::isSynchronized  (  )  [inline] 
Query whether synchronize() has been called.
Definition at line 193 of file fei_NodeDatabase.hpp.