OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
Class representing process communicator for engineering model. More...
#include <processcomm.h>
Public Member Functions | |
ProcessCommunicator (ProcessCommunicatorBuff *b, int irank, CommunicatorMode m=CommMode_Static) | |
Constructor. More... | |
~ProcessCommunicator () | |
Destructor. More... | |
int | giveRank () |
Returns corresponding rank of associated partition. More... | |
ProcessCommunicatorBuff * | giveProcessCommunicatorBuff () |
Returns communication buffer. More... | |
const IntArray * | giveToSendMap () |
Returns receiver to send map. More... | |
const IntArray * | giveToRecvMap () |
Returns receiver to receive map. More... | |
template<class T > | |
void | setToSendArry (T *emodel, const IntArray &src, int packUnpackType) |
Sets receiver toSend array to src. More... | |
template<class T > | |
void | setToRecvArry (T *emodel, const IntArray &src, int packUnpackType) |
Sets receiver toRecv array to src. More... | |
template<class T > | |
int | packData (T *emodel, int(T::*packFunc)(ProcessCommunicator &)) |
Pack nodal data to send buff. More... | |
template<class T , class P > | |
int | packData (T *emodel, P *src, int(T::*packFunc)(P *, ProcessCommunicator &)) |
Pack nodal data to send buff. More... | |
template<class T > | |
int | unpackData (T *emodel, int(T::*unpackFunc)(ProcessCommunicator &)) |
Unpack nodal data from recv buff. More... | |
template<class T , class P > | |
int | unpackData (T *emodel, P *dest, int(T::*unpackFunc)(P *, ProcessCommunicator &)) |
Unpack nodal data from recv buff. More... | |
int | initExchange (int tag) |
Initializes data exchange with associated problem. More... | |
int | initSend (int tag) |
Initialize the send data exchange with associate problem. More... | |
int | initReceive (int tag) |
Initialize the receive data exchange with associate problem. More... | |
int | finishExchange () |
Finishes the exchange. After this call all communication buffers can be reused. More... | |
void | clearBuffers () |
Clears all buffer contents. More... | |
Methods for manipulating/testing receiver state | |
int | sendCompleted () |
int | receiveCompleted () |
int | testCompletion () |
int | waitCompletion () |
Protected Attributes | |
int | rank |
Associated partition (problem) number (rank) More... | |
ProcessCommunicatorBuff * | pcBuffer |
Communicator buffers representation. More... | |
IntArray | toSend |
Nodes to send. More... | |
IntArray | toReceive |
Nodes to receive. More... | |
CommunicatorMode | mode |
Mode. More... | |
Private Member Functions | |
template<class T > | |
int | resizeSendBuff (T *emodel, int packUnpackType) |
Resizes send buffer to needs according to toSend array. More... | |
template<class T > | |
int | resizeRecvBuff (T *emodel, int packUnpackType) |
Resizes receive buffer to needs according to toRecv array. More... | |
Class representing process communicator for engineering model.
Process communicator provides all services for communication with associated remote process (problem or task).
Definition at line 176 of file processcomm.h.
oofem::ProcessCommunicator::ProcessCommunicator | ( | ProcessCommunicatorBuff * | b, |
int | irank, | ||
CommunicatorMode | m = CommMode_Static |
||
) |
Constructor.
Creates new problem (partition) communicator associated to partition with number (rank) irank.
b | ProcessCommunicatorBuff to use. |
irank | Rank of associated partition. |
m | Mode of communicator. |
Definition at line 57 of file processcomm.C.
|
inline |
Destructor.
Definition at line 202 of file processcomm.h.
void oofem::ProcessCommunicator::clearBuffers | ( | ) |
Clears all buffer contents.
Definition at line 120 of file processcomm.C.
References giveProcessCommunicatorBuff(), and oofem::ProcessCommunicatorBuff::init().
int oofem::ProcessCommunicator::finishExchange | ( | ) |
Finishes the exchange. After this call all communication buffers can be reused.
Definition at line 114 of file processcomm.C.
References waitCompletion().
|
inline |
Returns communication buffer.
Definition at line 210 of file processcomm.h.
References OOFEM_ERROR.
Referenced by clearBuffers(), initReceive(), initSend(), oofem::FETISolver::masterUnpackQQProduct(), oofem::FETISolver::masterUnpackRBM(), oofem::FETISolver::packDirectionVector(), oofem::EngngModel::packDofManagers(), oofem::FETISolver::packGammas(), oofem::Subdivision::packIrregularSharedGlobnums(), oofem::LoadBalancer::packMigratingData(), oofem::NonlocalMaterialWTP::packMigratingElementDependencies(), oofem::FETISolver::packPPVector(), oofem::FETISolver::packQQProducts(), oofem::FETISolver::packRBM(), oofem::EngngModel::packRemoteElementData(), oofem::NonlocalMaterialWTP::packRemoteElements(), oofem::Subdivision::packRemoteElements(), oofem::FETISolver::packResiduals(), oofem::ParmetisLoadBalancer::packSharedDmanPartitions(), oofem::NodalAveragingRecoveryModel::packSharedDofManData(), oofem::ZZNodalRecoveryModel::packSharedDofManData(), oofem::SPRNodalRecoveryModel::packSharedDofManData(), oofem::DirectErrorIndicatorRC::packSharedDofManLocalDensities(), oofem::DirectErrorIndicatorRC::packSharedDofManLocalIndicatorVals(), oofem::Subdivision::packSharedEdges(), oofem::Subdivision::packSharedIrregulars(), oofem::FETISolver::packSolution(), receiveCompleted(), sendCompleted(), oofem::FETISolver::unpackDirectionVector(), oofem::EngngModel::unpackDofManagers(), oofem::FETISolver::unpackGammas(), oofem::Subdivision::unpackIrregularSharedGlobnums(), oofem::LoadBalancer::unpackMigratingData(), oofem::NonlocalMaterialWTP::unpackMigratingElementDependencies(), oofem::FETISolver::unpackPPVector(), oofem::EngngModel::unpackRemoteElementData(), oofem::NonlocalMaterialWTP::unpackRemoteElements(), oofem::Subdivision::unpackRemoteElements(), oofem::FETISolver::unpackResiduals(), oofem::ParmetisLoadBalancer::unpackSharedDmanPartitions(), oofem::NodalAveragingRecoveryModel::unpackSharedDofManData(), oofem::ZZNodalRecoveryModel::unpackSharedDofManData(), oofem::SPRNodalRecoveryModel::unpackSharedDofManData(), oofem::DirectErrorIndicatorRC::unpackSharedDofManLocalDensities(), oofem::DirectErrorIndicatorRC::unpackSharedDofManLocalIndicatorVals(), oofem::Subdivision::unpackSharedEdges(), oofem::Subdivision::unpackSharedIrregulars(), and oofem::FETISolver::unpackSolution().
|
inline |
Returns corresponding rank of associated partition.
Definition at line 207 of file processcomm.h.
Referenced by oofem::FETISolver::masterUnpackQQProduct(), oofem::FETISolver::masterUnpackRBM(), oofem::FETISolver::packDirectionVector(), oofem::FETISolver::packGammas(), oofem::Subdivision::packIrregularSharedGlobnums(), oofem::LoadBalancer::packMigratingData(), oofem::NonlocalMaterialWTP::packMigratingElementDependencies(), oofem::NonlocalMaterialWTP::packRemoteElements(), oofem::Subdivision::packRemoteElements(), oofem::ParmetisLoadBalancer::packSharedDmanPartitions(), oofem::Subdivision::packSharedEdges(), oofem::Subdivision::packSharedIrregulars(), oofem::FETISolver::packSolution(), oofem::Subdivision::unpackIrregularSharedGlobnums(), oofem::LoadBalancer::unpackMigratingData(), oofem::NonlocalMaterialWTP::unpackMigratingElementDependencies(), oofem::FETISolver::unpackPPVector(), oofem::NonlocalMaterialWTP::unpackRemoteElements(), oofem::Subdivision::unpackRemoteElements(), oofem::FETISolver::unpackResiduals(), oofem::ParmetisLoadBalancer::unpackSharedDmanPartitions(), oofem::Subdivision::unpackSharedEdges(), and oofem::Subdivision::unpackSharedIrregulars().
|
inline |
Returns receiver to receive map.
Definition at line 227 of file processcomm.h.
Referenced by oofem::FETISolver::masterUnpackRBM(), oofem::ElementCommunicator::setUpCommunicationMaps(), oofem::FETISolver::unpackDirectionVector(), oofem::EngngModel::unpackDofManagers(), oofem::FETISolver::unpackPPVector(), oofem::EngngModel::unpackRemoteElementData(), oofem::FETISolver::unpackResiduals(), oofem::NodalAveragingRecoveryModel::unpackSharedDofManData(), oofem::ZZNodalRecoveryModel::unpackSharedDofManData(), oofem::SPRNodalRecoveryModel::unpackSharedDofManData(), oofem::DirectErrorIndicatorRC::unpackSharedDofManLocalDensities(), oofem::DirectErrorIndicatorRC::unpackSharedDofManLocalIndicatorVals(), and oofem::FETISolver::unpackSolution().
|
inline |
Returns receiver to send map.
Definition at line 223 of file processcomm.h.
Referenced by oofem::FETISolver::packDirectionVector(), oofem::EngngModel::packDofManagers(), oofem::FETISolver::packPPVector(), oofem::FETISolver::packRBM(), oofem::EngngModel::packRemoteElementData(), oofem::Subdivision::packRemoteElements(), oofem::FETISolver::packResiduals(), oofem::NodalAveragingRecoveryModel::packSharedDofManData(), oofem::ZZNodalRecoveryModel::packSharedDofManData(), oofem::SPRNodalRecoveryModel::packSharedDofManData(), oofem::DirectErrorIndicatorRC::packSharedDofManLocalDensities(), oofem::DirectErrorIndicatorRC::packSharedDofManLocalIndicatorVals(), oofem::FETISolver::packSolution(), and oofem::ElementCommunicator::setUpCommunicationMaps().
int oofem::ProcessCommunicator::initExchange | ( | int | tag | ) |
Initializes data exchange with associated problem.
if send or receive pool is empty, the send or receive communication is not performed.
tag | Message tag. |
Definition at line 104 of file processcomm.C.
References initReceive(), and initSend().
int oofem::ProcessCommunicator::initReceive | ( | int | tag | ) |
Initialize the receive data exchange with associate problem.
if receive pool is empty, the receive communication is not performed.
tag | Message tag. |
Definition at line 89 of file processcomm.C.
References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), oofem::ProcessCommunicatorBuff::initReceive(), oofem::ProcessCommunicatorBuff::initRecvBuff(), oofem::IntArray::isEmpty(), mode, rank, and toReceive.
Referenced by initExchange(), and oofem::FETISolver::solve().
int oofem::ProcessCommunicator::initSend | ( | int | tag | ) |
Initialize the send data exchange with associate problem.
if send pool is empty, the send communication is not performed.
tag | Message tag. |
Definition at line 74 of file processcomm.C.
References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), oofem::ProcessCommunicatorBuff::initSend(), oofem::ProcessCommunicatorBuff::initSendBuff(), oofem::IntArray::isEmpty(), mode, rank, and toSend.
Referenced by initExchange(), and oofem::FETISolver::solve().
|
inline |
Pack nodal data to send buff.
emodel | Engineering model to pack. |
packFunc | Function used to pack nodal data in to buffer. It uses toSend array to loop over required nodes. |
Definition at line 259 of file processcomm.h.
References oofem::CommMode_Dynamic, and oofem::IntArray::isEmpty().
Referenced by oofem::FETISolver::solve().
|
inline |
Pack nodal data to send buff.
emodel | Engineering model to pack. |
src | Source to pack from. |
packFunc | Function used to pack nodal data in to buffer. It uses toSend array to loop over required nodes. |
Definition at line 276 of file processcomm.h.
References oofem::CommMode_Dynamic, and oofem::IntArray::isEmpty().
int oofem::ProcessCommunicator::receiveCompleted | ( | ) |
Definition at line 136 of file processcomm.C.
References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), oofem::IntArray::isEmpty(), mode, oofem::ProcessCommunicatorBuff::receiveCompleted(), and toReceive.
Referenced by oofem::FETISolver::solve(), and testCompletion().
|
private |
Resizes receive buffer to needs according to toRecv array.
Current implementation uses EngngModel::estimateMaxPackSize function, sending toSend map as parameter.
emodel | Current engngModel. |
packUnpackType | Determines the type of packed quantity, used by emodel estimateMaxPackSize service to estimate the size of pack/unpack buffer accordingly. |
Definition at line 410 of file processcomm.h.
|
private |
Resizes send buffer to needs according to toSend array.
Current implementation uses EngngModel::estimateMaxPackSize function, sending toSend map as parameter.
emodel | Current engngModel. |
packUnpackType | Determines the type of packed quantity, used by emodel estimateMaxPackSize service to estimate the size of pack/unpack buffer accordingly. |
Definition at line 398 of file processcomm.h.
int oofem::ProcessCommunicator::sendCompleted | ( | ) |
Definition at line 126 of file processcomm.C.
References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), oofem::IntArray::isEmpty(), mode, oofem::ProcessCommunicatorBuff::sendCompleted(), and toSend.
Referenced by testCompletion().
void oofem::ProcessCommunicator::setToRecvArry | ( | T * | emodel, |
const IntArray & | src, | ||
int | packUnpackType | ||
) |
Sets receiver toRecv array to src.
The method assumes that toRecv array is sorted according to global number associated to corresponding components given in src array. THis is necessary to ensure proper pack/unpack order on local and remote problem. Recv buff is resized to hold all necessary data.
emodel | Engng model. |
src | Source of toRecv array. |
packUnpackType | Determines the type of packed quantity, used by emodel estimateMaxPackSize service to estimate the size of pack/unpack buffer accordingly. |
Definition at line 388 of file processcomm.h.
Referenced by oofem::NodeCommunicator::setProcessCommunicatorToRecvArry(), oofem::ElementCommunicator::setProcessCommunicatorToRecvArry(), oofem::FETICommunicator::setUpCommunicationMaps(), and oofem::FETISolver::setUpCommunicationMaps().
void oofem::ProcessCommunicator::setToSendArry | ( | T * | emodel, |
const IntArray & | src, | ||
int | packUnpackType | ||
) |
Sets receiver toSend array to src.
The method assumes that toSend array is sorted according to global number associated to corresponding components given in src array. THis is necessary to ensure proper pack/unpack order on local and remote problem. Send buff is resized to hold all necessary data.
emodel | Engng model. |
src | Source of toSend array. |
packUnpackType | Determines the type of packed quantity, used by emodel estimateMaxPackSize service to estimate the size of pack/unpack buffer accordingly. |
Definition at line 378 of file processcomm.h.
Referenced by oofem::NodeCommunicator::setProcessCommunicatorToSendArry(), oofem::ElementCommunicator::setProcessCommunicatorToSendArry(), oofem::FETICommunicator::setUpCommunicationMaps(), and oofem::FETISolver::setUpCommunicationMaps().
int oofem::ProcessCommunicator::testCompletion | ( | ) |
Definition at line 146 of file processcomm.C.
References receiveCompleted(), and sendCompleted().
Referenced by waitCompletion().
|
inline |
Unpack nodal data from recv buff.
emodel | Engineering model to unpack from. |
unpackFunc | Function used to unpack nodal data from buffer. It uses toRecv array to loop over required nodes. |
Definition at line 292 of file processcomm.h.
References oofem::CommMode_Dynamic, and oofem::IntArray::isEmpty().
Referenced by oofem::FETISolver::solve().
|
inline |
Unpack nodal data from recv buff.
emodel | Engineering model to unpack from. |
dest | Destination. |
unpackFunc | Function used to unpack nodal data from buffer. It uses toRecv array to loop over required nodes. |
Definition at line 309 of file processcomm.h.
References oofem::CommMode_Dynamic, and oofem::IntArray::isEmpty().
int oofem::ProcessCommunicator::waitCompletion | ( | ) |
Definition at line 152 of file processcomm.C.
References testCompletion().
Referenced by finishExchange().
|
protected |
Mode.
Definition at line 190 of file processcomm.h.
Referenced by initReceive(), initSend(), ProcessCommunicator(), receiveCompleted(), and sendCompleted().
|
protected |
Communicator buffers representation.
Definition at line 183 of file processcomm.h.
Referenced by ProcessCommunicator().
|
protected |
Associated partition (problem) number (rank)
Definition at line 180 of file processcomm.h.
Referenced by initReceive(), initSend(), and ProcessCommunicator().
|
protected |
Nodes to receive.
Definition at line 188 of file processcomm.h.
Referenced by initReceive(), and receiveCompleted().
|
protected |
Nodes to send.
Definition at line 186 of file processcomm.h.
Referenced by initSend(), and sendCompleted().