OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::ProcessCommunicator Class Reference

Class representing process communicator for engineering model. More...

#include <processcomm.h>

+ Collaboration diagram for oofem::ProcessCommunicator:

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...
 
ProcessCommunicatorBuffgiveProcessCommunicatorBuff ()
 Returns communication buffer. More...
 
const IntArraygiveToSendMap ()
 Returns receiver to send map. More...
 
const IntArraygiveToRecvMap ()
 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...
 
ProcessCommunicatorBuffpcBuffer
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

oofem::ProcessCommunicator::ProcessCommunicator ( ProcessCommunicatorBuff b,
int  irank,
CommunicatorMode  m = CommMode_Static 
)

Constructor.

Creates new problem (partition) communicator associated to partition with number (rank) irank.

Parameters
bProcessCommunicatorBuff to use.
irankRank of associated partition.
mMode of communicator.

Definition at line 57 of file processcomm.C.

References mode, pcBuffer, and rank.

oofem::ProcessCommunicator::~ProcessCommunicator ( )
inline

Destructor.

Definition at line 202 of file processcomm.h.

Member Function Documentation

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

ProcessCommunicatorBuff* oofem::ProcessCommunicator::giveProcessCommunicatorBuff ( )
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().

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.

Parameters
tagMessage tag.
Returns
Nonzero if success.

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.

Parameters
tagMessage tag.
Returns
Nonzero if success.

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.

Parameters
tagMessage tag.
Returns
Nonzero if success.

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

template<class T >
int oofem::ProcessCommunicator::packData ( T *  emodel,
int(T::*)(ProcessCommunicator &)  packFunc 
)
inline

Pack nodal data to send buff.

Parameters
emodelEngineering model to pack.
packFuncFunction used to pack nodal data in to buffer. It uses toSend array to loop over required nodes.
See also
NlDEIDynamic_Unpack_func

Definition at line 259 of file processcomm.h.

References oofem::CommMode_Dynamic, and oofem::IntArray::isEmpty().

Referenced by oofem::FETISolver::solve().

template<class T , class P >
int oofem::ProcessCommunicator::packData ( T *  emodel,
P *  src,
int(T::*)(P *, ProcessCommunicator &)  packFunc 
)
inline

Pack nodal data to send buff.

Parameters
emodelEngineering model to pack.
srcSource to pack from.
packFuncFunction used to pack nodal data in to buffer. It uses toSend array to loop over required nodes.
See also
NlDEIDynamic_Unpack_func

Definition at line 276 of file processcomm.h.

References oofem::CommMode_Dynamic, and oofem::IntArray::isEmpty().

int oofem::ProcessCommunicator::receiveCompleted ( )
template<class T >
int oofem::ProcessCommunicator::resizeRecvBuff ( T *  emodel,
int  packUnpackType 
)
private

Resizes receive buffer to needs according to toRecv array.

Current implementation uses EngngModel::estimateMaxPackSize function, sending toSend map as parameter.

Parameters
emodelCurrent engngModel.
packUnpackTypeDetermines the type of packed quantity, used by emodel estimateMaxPackSize service to estimate the size of pack/unpack buffer accordingly.
Returns
Nonzero if success.

Definition at line 410 of file processcomm.h.

template<class T >
int oofem::ProcessCommunicator::resizeSendBuff ( T *  emodel,
int  packUnpackType 
)
private

Resizes send buffer to needs according to toSend array.

Current implementation uses EngngModel::estimateMaxPackSize function, sending toSend map as parameter.

Parameters
emodelCurrent engngModel.
packUnpackTypeDetermines the type of packed quantity, used by emodel estimateMaxPackSize service to estimate the size of pack/unpack buffer accordingly.
Returns
Nonzero if success.

Definition at line 398 of file processcomm.h.

int oofem::ProcessCommunicator::sendCompleted ( )
template<class T >
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.

Parameters
emodelEngng model.
srcSource of toRecv array.
packUnpackTypeDetermines 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().

template<class T >
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.

Parameters
emodelEngng model.
srcSource of toSend array.
packUnpackTypeDetermines 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().

template<class T >
int oofem::ProcessCommunicator::unpackData ( T *  emodel,
int(T::*)(ProcessCommunicator &)  unpackFunc 
)
inline

Unpack nodal data from recv buff.

Parameters
emodelEngineering model to unpack from.
unpackFuncFunction used to unpack nodal data from buffer. It uses toRecv array to loop over required nodes.
See also
NlDEIDynamic_Unpack_func

Definition at line 292 of file processcomm.h.

References oofem::CommMode_Dynamic, and oofem::IntArray::isEmpty().

Referenced by oofem::FETISolver::solve().

template<class T , class P >
int oofem::ProcessCommunicator::unpackData ( T *  emodel,
P *  dest,
int(T::*)(P *, ProcessCommunicator &)  unpackFunc 
)
inline

Unpack nodal data from recv buff.

Parameters
emodelEngineering model to unpack from.
destDestination.
unpackFuncFunction used to unpack nodal data from buffer. It uses toRecv array to loop over required nodes.
See also
NlDEIDynamic_Unpack_func

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

Member Data Documentation

CommunicatorMode oofem::ProcessCommunicator::mode
protected

Mode.

Definition at line 190 of file processcomm.h.

Referenced by initReceive(), initSend(), ProcessCommunicator(), receiveCompleted(), and sendCompleted().

ProcessCommunicatorBuff* oofem::ProcessCommunicator::pcBuffer
protected

Communicator buffers representation.

Definition at line 183 of file processcomm.h.

Referenced by ProcessCommunicator().

int oofem::ProcessCommunicator::rank
protected

Associated partition (problem) number (rank)

Definition at line 180 of file processcomm.h.

Referenced by initReceive(), initSend(), and ProcessCommunicator().

IntArray oofem::ProcessCommunicator::toReceive
protected

Nodes to receive.

Definition at line 188 of file processcomm.h.

Referenced by initReceive(), and receiveCompleted().

IntArray oofem::ProcessCommunicator::toSend
protected

Nodes to send.

Definition at line 186 of file processcomm.h.

Referenced by initSend(), and sendCompleted().


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

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:39 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011