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 return-value of all functions in this class (except trivial query/accessor functions) is an error-code. If the function is successful, the error-code is 0. If a node-not-found 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.
|
virtual |
Destructor.
Definition at line 40 of file fei_NodeDatabase.cpp.
|
inline |
Obtain number-of-node-descriptors (in function's return-value). Note that this remains 0 until after allocateNodeDescriptors() is called.
Definition at line 78 of file fei_NodeDatabase.hpp.
|
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 node-descriptor. 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 node-descriptor.
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 equation-number, return the corresponding node-descriptor.
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 i-th node-descriptor.
i | Input. Offset of requested NodeDescriptor. |
node | Output. i-th NodeDescriptor. |
Definition at line 137 of file fei_NodeDatabase.cpp.
int NodeDatabase::countLocalNodalEqns | ( | int | localRank | ) |
Run through the locally-owned NodeDescriptors and count the number of nodal equations. (Returns 0 if the node-descriptors haven't been allocated or initialized yet.) The result is produced in the function's return-value.
Definition at line 161 of file fei_NodeDatabase.cpp.
int NodeDatabase::countLocalNodeDescriptors | ( | int | localRank | ) |
Return the number of internal node-descriptors that are locally-owned. This function runs through all currently allocated NodeDescriptors, counting the ones for which ownerProc()==localRank. The result is produced in the return-value. (Obviously returns 0 if the node-descriptors 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 return-value) 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 node-descriptor initialization is complete. In other words, that the calling code has set fieldIDs, equation-numbers and owner-proc information on each node-descriptor. At this point, this class will run through the array of node-descriptors and set the nodeNumber for each node, as well as setting the cross-referencing info required to look up nodes by equation-number.
firstLocalNodeNumber | Input. This will be the starting point for assigning node-numbers within this function. |
firstLocalEqn | Input. This will be the starting point for assigning equation-numbers 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 equation-number, 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 equation-number, 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.
|
inline |
Query whether synchronize() has been called.
Definition at line 193 of file fei_NodeDatabase.hpp.