FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
NodeDatabase Class Reference

#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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Member Function Documentation

int NodeDatabase::getNumNodeDescriptors ( ) const
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.

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 node-descriptor. This function is only available after allocateNodeDescriptors() has been called (returns -1 if allocateNodeDescriptors() hasn't been called).

Parameters
nodeIDInput. nodeID for which a NodeDescriptor is required.
nodeOutput. NodeDescriptor corresponding to node 'nodeID'. If no corresponding node is found, or if allocatedNodeDescriptors() hasn't been called yet, node is not referenced.
Returns
error-code 0 if successful, -1 if nodeID not found.

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.

Parameters
nodeNumberInput. nodeNumber for which a NodeDescriptor is required. This function returns -1 (and doesn't reference 'node') if synchronize() hasn't been called yet.
nodeOutput. NodeDescriptor corresponding to node 'nodeNumber'. If no corresponding node is found, node is not referenced.
Returns
error-code 0 if successful, -1 if node with nodeNumber not present.

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.

Parameters
eqnNumberInput. eqnNumber for which a NodeDescriptor is required.
nodeOutput. NodeDescriptor corresponding to eqnNumber. If no corresponding node is found, node is not referenced.
Returns
error-code 0 if successful, -1 if node with eqnNumber not present.

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.

Parameters
iInput. Offset of requested NodeDescriptor.
nodeOutput. i-th NodeDescriptor.
Returns
error-code. 0 if successful. -1 if i is out of bounds.

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.

Parameters
nodeIDInput
Returns
offset if nodeID is found, -1 if nodeID not present.

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.

Parameters
nodeIDInput.
Returns
error-code 0 if successful. -2 if allocation failed.

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.

Parameters
nodeIDsInput.
Returns
error-code 0 if successful. -2 if allocation failed.

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.

Parameters
firstLocalNodeNumberInput. This will be the starting point for assigning node-numbers within this function.
firstLocalEqnInput. This will be the starting point for assigning equation-numbers within this function.
localRankInput. MPI rank of the local processor.
Returns
error-code 0 if successful

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.

bool NodeDatabase::isSynchronized ( )
inline

Query whether synchronize() has been called.

Definition at line 193 of file fei_NodeDatabase.hpp.


The documentation for this class was generated from the following files: