FEI Package Browser (Single Doxygen Collection)
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 | getNodeWithID (GlobalID nodeID, NodeDescriptor *&node) |
int | getNodeWithNumber (int nodeNumber, const NodeDescriptor *&node) const |
int | getNodeWithEqn (int eqnNumber, const NodeDescriptor *&node) const |
void | getNodeAtIndex (int i, const NodeDescriptor *&node) const |
void | getNodeAtIndex (int i, NodeDescriptor *&node) |
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 () |
Private Member Functions | |
NodeDatabase (const NodeDatabase &src) | |
NodeDatabase & | operator= (const NodeDatabase &src) |
void | deleteMemory () |
Private Attributes | |
std::vector< NodeDescriptor * > | nodePtrs_ |
std::vector< int > | eqnNumbers_ |
std::vector< int > | eqnNodeIndices_ |
std::map< GlobalID, int > | nodeIDs_ |
std::map< int, int > | nodeNumbers_ |
bool | synchronized_ |
bool | need_to_alloc_and_sync_ |
std::map< int, int > * | fieldDB_ |
NodeCommMgr * | nodeCommMgr_ |
int | numLocalNodes_ |
int | firstLocalNodeNumber_ |
int | lastLocalNodeNumber_ |
fei_Pool_alloc< NodeDescriptor > | nodePool_ |
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 |
|
private |
|
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.
References nodePtrs_.
Referenced by Filter::calculateResidualNorms(), FEDataFilter::initLinSysCore(), LinSysCoreFilter::initLinSysCore(), and SNL_FEI_Structure::setNumNodesAndEqnsPerBlock().
|
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.
References nodeIDs_.
Referenced by SNL_FEI_Structure::getActiveNodeIDList(), FEI_Implementation::getLocalNodeIDList(), SNL_FEI_Structure::getNumActiveNodes(), FEI_Implementation::getNumLocalNodes(), SNL_FEI_Structure::initializeBlkEqnMapper(), SNL_FEI_Structure::setNodalEqnInfo(), and SNL_FEI_Structure::writeEqn2NodeMap().
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.
References getIndexOfID(), and nodePtrs_.
Referenced by NodeCommMgr::allocateNodeDescriptorPtrs(), convert_field_and_nodes_to_eqns(), SNL_FEI_Structure::finalizeActiveNodes(), Filter::findNode(), SNL_FEI_Structure::findNode(), Filter::findNodeDescriptor(), SNL_FEI_Structure::findNodeDescriptor(), FEDataFilter::getBlockFieldNodeSolution(), LinSysCoreFilter::getBlockFieldNodeSolution(), FEDataFilter::getBlockNodeSolution(), LinSysCoreFilter::getBlockNodeSolution(), SNL_FEI_Structure::getElemNodeDescriptors(), fei::DirichletBCManager::getEqnNumber(), SNL_FEI_Structure::getEqnNumbers(), FEDataFilter::getNodalFieldSolution(), LinSysCoreFilter::getNodalFieldSolution(), FEDataFilter::getNodalSolution(), LinSysCoreFilter::getNodalSolution(), FEI_Implementation::getNumSolnParams(), FEDataFilter::loadFEDataMultCR(), FEDataFilter::loadFEDataPenCR(), FEDataFilter::loadNodeBCs(), FEDataFilter::putBlockFieldNodeSolution(), LinSysCoreFilter::putBlockFieldNodeSolution(), FEDataFilter::putNodalFieldData(), LinSysCoreFilter::putNodalFieldData(), FEDataFilter::putNodalFieldSolution(), LinSysCoreFilter::putNodalFieldSolution(), and LinSysCoreFilter::resolveConflictingCRs().
int NodeDatabase::getNodeWithID | ( | GlobalID | nodeID, |
NodeDescriptor *& | node | ||
) |
Definition at line 68 of file fei_NodeDatabase.cpp.
References getIndexOfID(), and nodePtrs_.
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.
References ERReturn, nodeNumbers_, nodePtrs_, and synchronized_.
Referenced by SNL_FEI_Structure::getEqnNumber(), SNL_FEI_Structure::getNumSubdomains(), FEDataFilter::getReducedSolnEntry(), SNL_FEI_Structure::getSubdomainList(), FEDataFilter::giveToLocalReducedMatrix(), FEDataFilter::giveToLocalReducedRHS(), FEDataFilter::giveToMatrix(), and SNL_FEI_Structure::isInLocalElement().
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.
References fei::binarySearch(), eqnNodeIndices_, eqnNumbers_, NodeDescriptor::getFieldEqnNumbers(), NodeDescriptor::getFieldIDList(), NodeDescriptor::getNumFields(), and nodePtrs_.
Referenced by SNL_FEI_Structure::calculateSlaveEqns(), convert_eqns_to_nodenumbers_and_dof_ids(), and FEDataFilter::giveToRHS().
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.
References nodePtrs_.
Referenced by Filter::calculateResidualNorms(), FEDataFilter::getBlockFieldNodeSolution(), LinSysCoreFilter::getBlockFieldNodeSolution(), FEI_Implementation::getBlockNodeIDList(), FEDataFilter::getBlockNodeSolution(), LinSysCoreFilter::getBlockNodeSolution(), FEDataFilter::getNodalFieldSolution(), LinSysCoreFilter::getNodalFieldSolution(), FEDataFilter::getNodalSolution(), LinSysCoreFilter::getNodalSolution(), SNL_FEI_Structure::initializeBlkEqnMapper(), SNL_FEI_Structure::setNodalEqnInfo(), SNL_FEI_Structure::setNumNodesAndEqnsPerBlock(), synchronize(), and SNL_FEI_Structure::writeEqn2NodeMap().
void NodeDatabase::getNodeAtIndex | ( | int | i, |
NodeDescriptor *& | node | ||
) |
Definition at line 149 of file fei_NodeDatabase.cpp.
References nodePtrs_.
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.
References NodeDescriptor::getFieldIDList(), NodeDescriptor::getNumFields(), NodeDescriptor::getOwnerProc(), and nodePtrs_.
Referenced by SNL_FEI_Structure::initComplete().
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.
References nodePtrs_.
Referenced by SNL_FEI_Structure::initComplete().
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.
References nodeIDs_.
Referenced by getNodeWithID(), and synchronize().
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.
References fei_Pool_alloc< T >::allocate(), fei_Pool_alloc< T >::construct(), need_to_alloc_and_sync_, nodeIDs_, nodePool_, nodePtrs_, and NodeDescriptor::setGlobalNodeID().
Referenced by SNL_FEI_Structure::finalizeActiveNodes(), and initNodeIDs().
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.
References initNodeID().
Referenced by SNL_FEI_Structure::initElem().
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.
References CHK_ERR, eqnNodeIndices_, eqnNumbers_, ERReturn, NodeCommMgr::exchangeEqnInfo(), firstLocalNodeNumber_, NodeDescriptor::getFieldEqnNumbers(), NodeDescriptor::getFieldIDList(), NodeDescriptor::getGlobalNodeID(), getIndexOfID(), getNodeAtIndex(), NodeDescriptor::getNodeNumber(), NodeDescriptor::getNumFields(), NodeDescriptor::getNumNodalDOF(), NodeCommMgr::getNumSharedNodes(), NodeDescriptor::getOwnerProc(), NodeCommMgr::getSharedNodeAtIndex(), lastLocalNodeNumber_, need_to_alloc_and_sync_, nodeCommMgr_, nodeIDs_, nodeNumbers_, nodePtrs_, numLocalNodes_, NodeDescriptor::setFieldEqnNumber(), NodeDescriptor::setNodeNumber(), NodeDescriptor::setNumNodalDOF(), fei::sortedListInsert(), and synchronized_.
Referenced by SNL_FEI_Structure::initComplete().
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.
References fei::binarySearch(), eqnNodeIndices_, eqnNumbers_, ERReturn, fieldDB_, NodeDescriptor::getFieldEqnNumbers(), NodeDescriptor::getFieldIDList(), NodeDescriptor::getNodeNumber(), NodeDescriptor::getNumFields(), and nodePtrs_.
Referenced by SNL_FEI_Structure::getAssociatedNodeNumber().
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.
References fei::binarySearch(), eqnNodeIndices_, eqnNumbers_, ERReturn, fieldDB_, NodeDescriptor::getFieldEqnNumbers(), NodeDescriptor::getFieldIDList(), NodeDescriptor::getNumFields(), and nodePtrs_.
Referenced by SNL_FEI_Structure::getAssociatedFieldID().
|
inline |
Query whether synchronize() has been called.
Definition at line 193 of file fei_NodeDatabase.hpp.
References synchronized_.
|
private |
|
private |
Definition at line 46 of file fei_NodeDatabase.cpp.
References fei_Pool_alloc< T >::deallocate(), fei_Pool_alloc< T >::destroy(), nodePool_, and nodePtrs_.
Referenced by ~NodeDatabase().
|
private |
Definition at line 201 of file fei_NodeDatabase.hpp.
Referenced by countLocalNodalEqns(), countLocalNodeDescriptors(), deleteMemory(), getAssociatedFieldID(), getAssociatedNodeNumber(), getNodeAtIndex(), getNodeWithEqn(), getNodeWithID(), getNodeWithNumber(), getNumNodeDescriptors(), initNodeID(), and synchronize().
|
private |
Definition at line 203 of file fei_NodeDatabase.hpp.
Referenced by getAssociatedFieldID(), getAssociatedNodeNumber(), getNodeWithEqn(), and synchronize().
|
private |
Definition at line 207 of file fei_NodeDatabase.hpp.
Referenced by getAssociatedFieldID(), getAssociatedNodeNumber(), getNodeWithEqn(), and synchronize().
|
private |
Definition at line 212 of file fei_NodeDatabase.hpp.
Referenced by getIndexOfID(), getNodeIDs(), initNodeID(), and synchronize().
|
private |
Definition at line 215 of file fei_NodeDatabase.hpp.
Referenced by getNodeWithNumber(), and synchronize().
|
private |
Definition at line 217 of file fei_NodeDatabase.hpp.
Referenced by getNodeWithNumber(), isSynchronized(), and synchronize().
|
private |
Definition at line 218 of file fei_NodeDatabase.hpp.
Referenced by initNodeID(), and synchronize().
|
private |
Definition at line 220 of file fei_NodeDatabase.hpp.
Referenced by getAssociatedFieldID(), and getAssociatedNodeNumber().
|
private |
Definition at line 221 of file fei_NodeDatabase.hpp.
Referenced by synchronize().
|
private |
Definition at line 223 of file fei_NodeDatabase.hpp.
Referenced by synchronize().
|
private |
Definition at line 224 of file fei_NodeDatabase.hpp.
Referenced by synchronize().
|
private |
Definition at line 224 of file fei_NodeDatabase.hpp.
Referenced by synchronize().
|
private |
Definition at line 226 of file fei_NodeDatabase.hpp.
Referenced by deleteMemory(), and initNodeID().