#include <fei_EqnCommMgr.hpp>
Public Member Functions | |
EqnCommMgr (MPI_Comm comm, bool accumulate=true) | |
EqnCommMgr (const EqnCommMgr &src) | |
EqnCommMgr & | operator= (const EqnCommMgr &src) |
virtual | ~EqnCommMgr () |
EqnCommMgr * | deepCopy () |
size_t | getNumSharingProcs () |
std::vector< int > & | sharingProcsPtr () |
size_t | getNumOwnerProcs () |
std::vector< int > & | ownerProcsPtr () |
void | addLocalEqn (int eqnNumber, int srcProc) |
void | addSolnValues (int *eqnNumbers, double *values, int num) |
void | exchangeSoln () |
int | mirrorProcEqns (ProcEqns &inProcEqns, ProcEqns &outProcEqns) |
int | mirrorProcEqnLengths (ProcEqns &inProcEqns, ProcEqns &outProcEqns) |
int | getNumLocalEqns () |
std::vector< int > & | localEqnNumbers () |
std::vector< fei::CSVec * > & | localEqns () |
std::vector< std::vector< double > * > * | localRHSsPtr () |
int | addRemoteEqn (int eqnNumber, int destProc, const double *coefs, const int *indices, int num) |
int | addRemoteEqn (int eqnNumber, const double *coefs, const int *indices, int num) |
int | addRemoteEqns (fei::CSRMat &mat, bool onlyIndices) |
int | addRemoteRHS (fei::CSVec &vec, int rhsIndex) |
void | setNumRHSs (int numRHSs) |
int | addRemoteRHS (int eqnNumber, int destProc, int rhsIndex, double value) |
int | addRemoteRHS (int eqnNumber, int rhsIndex, double value) |
void | addRemoteIndices (int eqnNumber, int destProc, int *indices, int num) |
int | getNumRemoteEqns () |
std::vector< int > & | sendEqnNumbersPtr () |
double * | sendEqnSolnPtr () |
void | resetCoefs () |
int | gatherSharedBCs (EqnBuffer &bcEqns) |
int | getNumRemEssBCEqns () |
std::vector< int > & | remEssBCEqnNumbersPtr () |
std::vector< fei::CSVec * > & | remEssBCEqns () |
int | exchangePtToBlkInfo (snl_fei::PointBlockMap &blkEqnMapper) |
bool | newCoefData () |
bool | newRHSData () |
EqnBuffer * | getRecvEqns () |
EqnBuffer * | getSendEqns () |
ProcEqns * | getRecvProcEqns () |
ProcEqns * | getSendProcEqns () |
Static Public Member Functions | |
static int | exchangeEqnBuffers (MPI_Comm comm, ProcEqns *sendProcEqns, EqnBuffer *sendEqns, ProcEqns *recvProcEqns, EqnBuffer *recvEqns, bool accumulate) |
Public Attributes | |
bool | accumulate_ |
1. Local equations which remote processors contribute to (e.g., because they share some local active nodes).
2. Remote equations that the local processor contributes to (the mirror of case 1.).
Usage Notes:
1. You can't call exchangeEqns until after exchangeIndices has been called. 2. You can't call addSolnValues until after exchangeIndices has been called.
In general, usage will proceed like this:
in snl_fei::Structure::initComplete: addLocalEqn (a bunch of times, probably) addRemoteIndices (also a bunch of times)
exchangeIndices
getNumLocalEqns localEqnNumbers localIndicesPtr
in Filter::sumInElem/sumInElemMatrix/sumInElemRHS addRemoteEqn and/or addRemoteRHS
in Filter::exchangeRemoteEquations exchangeEqns getNumLocalEqns recvEqnNumbersPtr localIndicesPtr localCoefsPtr localRHSsPtr
in Filter::unpackSolution getNumLocalEqns localEqnNumbers addSolnValues exchangeSoln
in Filter various getSoln functions getNumSendEqns sendEqnNumbersPtr sendEqnSolnPtr
This class also provides general support functions for exchanging equations among processors. At the start of an all-to-all exchange, all processors usually know which equations they need to receive, and which processors they'll be receiving from, OR they know which equations they need to send, and which processors they'll be sending to. Usually they don't know both the sending and receiving information though. This eqn-processor pairing information (for either the "recv-equations" or the "send-equations") is held in a ProcEqns object. Thus, an all-to-all exchange of equation data requires two ProcEqns objects -- one holding the recv info, the other holding the send info.
An EqnCommMgr function (mirrorProcEqns) is provided which does the communications necessary to populate the 'send' ProcEqns object given a populated 'recv' ProcEqns object, or vice-versa. Note that at this point, the equation-lengths need not be known by either the sending or the receiving processors.
Once the ProcEqns objects have been correctly mirrored, another EqnCommMgr function (mirrorProcEqnLengths) is available for mirroring the eqn-length data from one ProcEqns object to the other.
The next step is: given equations (with all associated data) that we need to send, along with previously known equation-numbers that we need to receive, an EqnCommMgr function (exchangeEqnBuffers) is provided to first send the equation-lengths to the receiving processors, followed by the actual equation data. At this point the exchange is complete. The equation data is supplied/returned in EqnBuffer objects.
Definition at line 104 of file fei_EqnCommMgr.hpp.
EqnCommMgr::EqnCommMgr | ( | MPI_Comm | comm, | |
bool | accumulate = true | |||
) |
Constructor.
localProc | The MPI rank of 'this' processor. |
Definition at line 28 of file fei_EqnCommMgr.cpp.
EqnCommMgr::EqnCommMgr | ( | const EqnCommMgr & | src | ) |
copy constructor
Definition at line 51 of file fei_EqnCommMgr.cpp.
EqnCommMgr::~EqnCommMgr | ( | ) | [virtual] |
Destructor.
Definition at line 68 of file fei_EqnCommMgr.cpp.
EqnCommMgr & EqnCommMgr::operator= | ( | const EqnCommMgr & | src | ) |
assignment operator
Definition at line 79 of file fei_EqnCommMgr.cpp.
EqnCommMgr * EqnCommMgr::deepCopy | ( | ) |
Produce a clone of 'this' object, including all of its internal data.
Definition at line 118 of file fei_EqnCommMgr.cpp.
size_t EqnCommMgr::getNumSharingProcs | ( | ) | [inline] |
return the number of processors that share (contribute to) equations that are locally owned.
Definition at line 126 of file fei_EqnCommMgr.hpp.
size_t EqnCommMgr::getNumOwnerProcs | ( | ) | [inline] |
return the number of processors that own equations that we share (equations that we contribute to).
Definition at line 132 of file fei_EqnCommMgr.hpp.
void EqnCommMgr::addLocalEqn | ( | int | eqnNumber, | |
int | srcProc | |||
) |
add a local equation to which a remote processor will be contributing.
Definition at line 131 of file fei_EqnCommMgr.cpp.
Support function to set up information needed for exchanging equation info among processors. Beginning assumption: we (the local processor) have a populated ProcEqns object (inProcEqns) which contains information pairing certain equations with certain remote processors. These can be equations that we will be receiving in an all-to-all exchange, or equations that we will be sending in an all-to-all exchange. In either case, the "mirror" of that information is needed before the exchange can be performed. i.e., if we know which eqns we'll be sending, then the mirror info concerns the eqns we'll be recv'ing, and vice-versa if we already know which eqns we'll be recv'ing.
This function is to obtain that mirror info, and return it in outProcEqns. Given a populated ProcEqns object, we want to populate the mirror ProcEqns object. Note that this function IGNORES any equation- lengths, if they are present. i.e., the eqn-length info in 'inProcEqns' is not referenced, and on completion the eqn-length info in 'outProcEqns' is not populated.
inProcEqns | Contains the input equation-numbers and associated processors. | |
outProcEqns | Output. |
Definition at line 744 of file fei_EqnCommMgr.cpp.
Support function to set up information needed for exchanging equation info among processors. This function plays a similar role to that of the above 'mirrorProcEqns' function, but exchanges the length information rather than the equation-number information. THIS FUNCTION ASSUMES that both inProcEqns and outProcEqns are already populated with eqn-number information.
inProcEqns | Contains equation-numbers, and their associated lengths. | |
outProcEqns | Input/Output. On entry, contains the equation-numbers (but not their lengths. |
Definition at line 854 of file fei_EqnCommMgr.cpp.