OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
Class representing communicator. More...
#include <communicator.h>
Public Member Functions | |
Communicator (EngngModel *emodel, CommunicatorBuff *buff, int rank, int size, CommunicatorMode mode=CommMode_Static) | |
Constructor. More... | |
virtual | ~Communicator () |
Destructor. More... | |
ProcessCommunicator * | giveProcessCommunicator (int i) |
Returns i-th problem communicator. More... | |
template<class T > | |
int | packAllData (T *ptr, int(T::*packFunc)(ProcessCommunicator &)) |
Pack all problemCommunicators data to their send buffers. More... | |
template<class T , class P > | |
int | packAllData (T *ptr, P *src, int(T::*packFunc)(P *, ProcessCommunicator &)) |
Pack all problemCommuncators data to their send buffers. More... | |
template<class T > | |
int | unpackAllData (T *ptr, int(T::*unpackFunc)(ProcessCommunicator &)) |
Unpack all problemCommuncators data from recv buffers. More... | |
template<class T , class P > | |
int | unpackAllData (T *ptr, P *src, int(T::*unpackFunc)(P *, ProcessCommunicator &)) |
Unpack all problemCommuncators data from recv buffers. More... | |
int | initExchange (int tag) |
Initializes data exchange with all problems. More... | |
int | initSend (int tag) |
Initializes data send exchange with all problems. More... | |
int | initReceive (int tag) |
Initializes data receive exchange with all problems. More... | |
int | finishExchange () |
Finishes the exchange. More... | |
void | clearBuffers () |
Clears all buffer content. More... | |
virtual void | setUpCommunicationMaps (EngngModel *pm) |
Service for setting up the communication patterns with other remote processes. More... | |
std::string | errorInfo (const char *func) const |
Returns string for prepending output (used by error reporting macros). More... | |
Protected Attributes | |
int | rank |
Rank of process. More... | |
int | size |
Number of processes. More... | |
ProcessCommunicator ** | processComms |
Array of process communicators. More... | |
EngngModel * | engngModel |
Engineering model. More... | |
CommunicatorMode | mode |
Mode. More... | |
Class representing communicator.
It is usually attribute of an engineering model. Problem communicator provides all services for communication with associated remote problems. It manages several process (task) communicators.
The communicator mode determines the communication:
(Static) The mode can be static, meaning that each node can assemble its communication maps independently (or by independent communication). This implies that the size of communication buffers is known in advance. Also if no data are planned to send to remote node, there is no communication with this node (both sender and receiver know that there will be no data to send).
(Dynamic) In this case the communication pattern and the amount of data sent between nodes is not known in advance. This requires to use dynamic (packeted) buffering.
Definition at line 105 of file communicator.h.
oofem::Communicator::Communicator | ( | EngngModel * | emodel, |
CommunicatorBuff * | buff, | ||
int | rank, | ||
int | size, | ||
CommunicatorMode | mode = CommMode_Static |
||
) |
Constructor.
Creates new communicator associated to partition with number (rank) irank.
emodel | Associated engineering model. |
buff | Communicator buffer. |
rank | Rank of associated partition. |
size | Number of collaborating processes. |
mode | Communicator mode. |
Definition at line 72 of file communicator.C.
References oofem::CommunicatorBuff::giveProcessCommunicatorBuff(), and oofem::CommunicatorBuff::size.
|
virtual |
void oofem::Communicator::clearBuffers | ( | ) |
Clears all buffer content.
Definition at line 150 of file communicator.C.
References oofem::CommunicatorBuff::size.
std::string oofem::Communicator::errorInfo | ( | const char * | func | ) | const |
Returns string for prepending output (used by error reporting macros).
Definition at line 158 of file communicator.C.
int oofem::Communicator::finishExchange | ( | ) |
Finishes the exchange.
After this call all communication buffers can be reused.
Definition at line 115 of file communicator.C.
References oofem::CommunicatorBuff::size.
Referenced by oofem::DirectErrorIndicatorRC::exchangeDofManDensities(), oofem::DirectErrorIndicatorRC::exchangeDofManIndicatorVals(), oofem::NodalAveragingRecoveryModel::exchangeDofManValues(), oofem::ZZNodalRecoveryModel::exchangeDofManValues(), oofem::SPRNodalRecoveryModel::exchangeDofManValues(), oofem::EngngModel::exchangeRemoteElementData(), oofem::NonlocalMaterialWTP::init(), oofem::NonlocalMaterialWTP::migrate(), and oofem::EngngModel::updateSharedDofManagers().
|
inline |
Returns i-th problem communicator.
The problems are numbered from rank 0.
i | Problem communicator index [0..size-1]. |
Definition at line 139 of file communicator.h.
Referenced by oofem::Subdivision::packRemoteElements(), oofem::FETICommunicator::setUpCommunicationMaps(), oofem::NodeCommunicator::setUpCommunicationMaps(), and oofem::ElementCommunicator::setUpCommunicationMaps().
int oofem::Communicator::initExchange | ( | int | tag | ) |
Initializes data exchange with all problems.
if send or receive pool is empty, communication is not performed.
tag | message tag |
Definition at line 104 of file communicator.C.
References oofem::CommunicatorBuff::size.
Referenced by oofem::DirectErrorIndicatorRC::exchangeDofManDensities(), oofem::DirectErrorIndicatorRC::exchangeDofManIndicatorVals(), oofem::NodalAveragingRecoveryModel::exchangeDofManValues(), oofem::ZZNodalRecoveryModel::exchangeDofManValues(), oofem::SPRNodalRecoveryModel::exchangeDofManValues(), oofem::EngngModel::exchangeRemoteElementData(), oofem::NonlocalMaterialWTP::init(), oofem::NonlocalMaterialWTP::migrate(), and oofem::EngngModel::updateSharedDofManagers().
int oofem::Communicator::initReceive | ( | int | tag | ) |
Initializes data receive exchange with all problems.
if receive pool is empty, communication is not performed.
tag | Message tag. |
Definition at line 139 of file communicator.C.
References oofem::CommunicatorBuff::size.
Referenced by oofem::FETISolver::solve().
int oofem::Communicator::initSend | ( | int | tag | ) |
Initializes data send exchange with all problems.
if send pool is empty, communication is not performed.
tag | Message tag. |
Definition at line 128 of file communicator.C.
References oofem::CommunicatorBuff::size.
Referenced by oofem::FETISolver::solve().
int oofem::Communicator::packAllData | ( | T * | ptr, |
int(T::*)(ProcessCommunicator &) | packFunc | ||
) |
Pack all problemCommunicators data to their send buffers.
ptr | Pointer problem communicator. |
packFunc | Function used to pack nodal data in to buffer. |
Definition at line 223 of file communicator.h.
Referenced by oofem::Subdivision::assignGlobalNumbersToSharedIrregulars(), oofem::DirectErrorIndicatorRC::exchangeDofManDensities(), oofem::DirectErrorIndicatorRC::exchangeDofManIndicatorVals(), oofem::NodalAveragingRecoveryModel::exchangeDofManValues(), oofem::ZZNodalRecoveryModel::exchangeDofManValues(), oofem::SPRNodalRecoveryModel::exchangeDofManValues(), oofem::EngngModel::exchangeRemoteElementData(), oofem::Subdivision::exchangeSharedEdges(), oofem::Subdivision::exchangeSharedIrregulars(), oofem::NonlocalMaterialWTP::init(), oofem::ParmetisLoadBalancer::labelDofManagers(), oofem::NonlocalMaterialWTP::migrate(), oofem::LoadBalancer::migrateLoad(), oofem::FETISolver::solve(), and oofem::EngngModel::updateSharedDofManagers().
int oofem::Communicator::packAllData | ( | T * | ptr, |
P * | src, | ||
int(T::*)(P *, ProcessCommunicator &) | packFunc | ||
) |
Pack all problemCommuncators data to their send buffers.
ptr | Pointer problem communicator. |
src | Pointer to source. |
packFunc | Function used to pack nodal data in to buffer. |
Definition at line 248 of file communicator.h.
|
inlinevirtual |
Service for setting up the communication patterns with other remote processes.
Sets up the toSend and toRecv attributes in associated problem communicators.
pm | Engineering model to use for setup. |
Reimplemented in oofem::FETICommunicator.
Definition at line 216 of file communicator.h.
References oofem::errorInfo().
int oofem::Communicator::unpackAllData | ( | T * | ptr, |
int(T::*)(ProcessCommunicator &) | unpackFunc | ||
) |
Unpack all problemCommuncators data from recv buffers.
Waits until receive completion before unpacking buffer.
ptr | Pointer problem communicator. |
unpackFunc | Function used to unpack nodal data from buffer. |
Definition at line 262 of file communicator.h.
References oofem::IntArray::at(), oofem::CommMode_Dynamic, OOFEM_LOG_DEBUG, and VERBOSEPARALLEL_PRINT.
Referenced by oofem::DirectErrorIndicatorRC::exchangeDofManDensities(), oofem::DirectErrorIndicatorRC::exchangeDofManIndicatorVals(), oofem::NodalAveragingRecoveryModel::exchangeDofManValues(), oofem::ZZNodalRecoveryModel::exchangeDofManValues(), oofem::SPRNodalRecoveryModel::exchangeDofManValues(), oofem::EngngModel::exchangeRemoteElementData(), oofem::NonlocalMaterialWTP::init(), oofem::NonlocalMaterialWTP::migrate(), oofem::FETISolver::solve(), and oofem::EngngModel::updateSharedDofManagers().
int oofem::Communicator::unpackAllData | ( | T * | ptr, |
P * | src, | ||
int(T::*)(P *, ProcessCommunicator &) | unpackFunc | ||
) |
Unpack all problemCommuncators data from recv buffers.
Waits until receive completion before unpacking buffer.
ptr | Pointer problem communicator. |
src | Pointer to source. |
unpackFunc | Function used to unpack nodal data from buffer. |
Definition at line 377 of file communicator.h.
References oofem::IntArray::at(), oofem::CommMode_Dynamic, OOFEM_LOG_DEBUG, and VERBOSEPARALLEL_PRINT.
|
protected |
Engineering model.
Definition at line 115 of file communicator.h.
Referenced by oofem::ProblemCommunicator::DofManCmp(), oofem::ProblemCommunicator::ElemCmp(), oofem::NodeCommunicator::setProcessCommunicatorToRecvArry(), oofem::ElementCommunicator::setProcessCommunicatorToRecvArry(), oofem::NodeCommunicator::setProcessCommunicatorToSendArry(), oofem::ElementCommunicator::setProcessCommunicatorToSendArry(), and oofem::FETICommunicator::setUpCommunicationMaps().
|
protected |
Mode.
Definition at line 117 of file communicator.h.
|
protected |
Array of process communicators.
Definition at line 113 of file communicator.h.
|
protected |
Rank of process.
Definition at line 109 of file communicator.h.
Referenced by oofem::FETICommunicator::setUpCommunicationMaps(), oofem::NodeCommunicator::setUpCommunicationMaps(), and oofem::ElementCommunicator::setUpCommunicationMaps().
|
protected |
Number of processes.
Definition at line 111 of file communicator.h.
Referenced by oofem::FETICommunicator::setUpCommunicationMaps(), oofem::NodeCommunicator::setUpCommunicationMaps(), and oofem::ElementCommunicator::setUpCommunicationMaps().