OOFEM 3.0
Loading...
Searching...
No Matches
oofem::ProcessCommunicator Class Reference

#include <processcomm.h>

Collaboration diagram for oofem::ProcessCommunicator:

Public Member Functions

 ProcessCommunicator (ProcessCommunicatorBuff *b, int irank, CommunicatorMode m=CommMode_Static)
int giveRank ()
ProcessCommunicatorBuffgiveProcessCommunicatorBuff ()
 Returns communication buffer.
const IntArraygiveToSendMap ()
const IntArraygiveToRecvMap ()
template<class T>
void setToSendArry (T *emodel, const IntArray &src, int packUnpackType)
template<class T>
void setToRecvArry (T *emodel, const IntArray &src, int packUnpackType)
template<class T>
int packData (T *emodel, int(T ::*packFunc)(ProcessCommunicator &))
template<class T, class P>
int packData (T *emodel, P *src, int(T ::*packFunc)(P *, ProcessCommunicator &))
template<class T>
int unpackData (T *emodel, int(T ::*unpackFunc)(ProcessCommunicator &))
template<class T, class P>
int unpackData (T *emodel, P *dest, int(T ::*unpackFunc)(P *, ProcessCommunicator &))
int initExchange (int tag)
int initSend (int tag)
int initReceive (int tag)
int finishExchange ()
 Finishes the exchange. After this call all communication buffers can be reused.

Protected Attributes

int rank
 Associated partition (problem) number (rank).
ProcessCommunicatorBuffpcBuffer
 Communicator buffers representation.
IntArray toSend
 Nodes to send.
IntArray toReceive
 Nodes to receive.
CommunicatorMode mode
 Mode.

Methods for manipulating/testing receiver state

int sendCompleted ()
int receiveCompleted ()
int testCompletion ()
int waitCompletion ()
void clearBuffers ()
 Clears all buffer contents.
template<class T>
int resizeSendBuff (T *emodel, int packUnpackType)
template<class T>
int resizeRecvBuff (T *emodel, int packUnpackType)

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 179 of file processcomm.h.

Constructor & Destructor Documentation

◆ ProcessCommunicator()

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, rank, toReceive, and toSend.

Referenced by packData(), packData(), unpackData(), and unpackData().

Member Function Documentation

◆ clearBuffers()

void oofem::ProcessCommunicator::clearBuffers ( )

Clears all buffer contents.

Definition at line 113 of file processcomm.C.

References giveProcessCommunicatorBuff().

◆ finishExchange()

int oofem::ProcessCommunicator::finishExchange ( )

Finishes the exchange. After this call all communication buffers can be reused.

Definition at line 107 of file processcomm.C.

References waitCompletion().

◆ giveProcessCommunicatorBuff()

ProcessCommunicatorBuff * oofem::ProcessCommunicator::giveProcessCommunicatorBuff ( )
inline

Returns communication buffer.

Definition at line 211 of file processcomm.h.

References OOFEM_ERROR, and pcBuffer.

Referenced by clearBuffers(), initReceive(), initSend(), oofem::FETISolver::masterUnpackQQProduct(), oofem::FETISolver::masterUnpackRBM(), packData(), packData(), 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::SPRNodalRecoveryModel::packSharedDofManData(), oofem::ZZNodalRecoveryModel::packSharedDofManData(), oofem::DirectErrorIndicatorRC::packSharedDofManLocalDensities(), oofem::DirectErrorIndicatorRC::packSharedDofManLocalIndicatorVals(), oofem::Subdivision::packSharedEdges(), oofem::Subdivision::packSharedIrregulars(), oofem::FETISolver::packSolution(), receiveCompleted(), resizeRecvBuff(), resizeSendBuff(), sendCompleted(), unpackData(), unpackData(), 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::SPRNodalRecoveryModel::unpackSharedDofManData(), oofem::ZZNodalRecoveryModel::unpackSharedDofManData(), oofem::DirectErrorIndicatorRC::unpackSharedDofManLocalDensities(), oofem::DirectErrorIndicatorRC::unpackSharedDofManLocalIndicatorVals(), oofem::Subdivision::unpackSharedEdges(), oofem::Subdivision::unpackSharedIrregulars(), and oofem::FETISolver::unpackSolution().

◆ giveRank()

◆ giveToRecvMap()

◆ giveToSendMap()

◆ initExchange()

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 97 of file processcomm.C.

References initReceive(), and initSend().

◆ initReceive()

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 82 of file processcomm.C.

References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), rank, and toReceive.

Referenced by initExchange().

◆ initSend()

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 67 of file processcomm.C.

References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), rank, and toSend.

Referenced by initExchange().

◆ packData() [1/2]

template<class T>
int oofem::ProcessCommunicator::packData ( T * emodel,
int(T ::* packFunc )(ProcessCommunicator &) )
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 260 of file processcomm.h.

References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), ProcessCommunicator(), and toSend.

◆ packData() [2/2]

template<class T, class P>
int oofem::ProcessCommunicator::packData ( T * emodel,
P * src,
int(T ::* packFunc )(P *, ProcessCommunicator &) )
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 277 of file processcomm.h.

References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), ProcessCommunicator(), and toSend.

◆ receiveCompleted()

int oofem::ProcessCommunicator::receiveCompleted ( )

Definition at line 129 of file processcomm.C.

References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), and toReceive.

Referenced by testCompletion().

◆ resizeRecvBuff()

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 411 of file processcomm.h.

References giveProcessCommunicatorBuff(), and toReceive.

Referenced by setToRecvArry().

◆ resizeSendBuff()

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 399 of file processcomm.h.

References giveProcessCommunicatorBuff(), and toSend.

Referenced by setToSendArry().

◆ sendCompleted()

int oofem::ProcessCommunicator::sendCompleted ( )

Definition at line 119 of file processcomm.C.

References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), and toSend.

Referenced by testCompletion().

◆ setToRecvArry()

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 389 of file processcomm.h.

References resizeRecvBuff(), and toReceive.

Referenced by oofem::ElementCommunicator::setProcessCommunicatorToRecvArry(), and oofem::NodeCommunicator::setProcessCommunicatorToRecvArry().

◆ setToSendArry()

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 379 of file processcomm.h.

References resizeSendBuff(), and toSend.

Referenced by oofem::ElementCommunicator::setProcessCommunicatorToSendArry(), and oofem::NodeCommunicator::setProcessCommunicatorToSendArry().

◆ testCompletion()

int oofem::ProcessCommunicator::testCompletion ( )

Definition at line 139 of file processcomm.C.

References receiveCompleted(), and sendCompleted().

Referenced by waitCompletion().

◆ unpackData() [1/2]

template<class T>
int oofem::ProcessCommunicator::unpackData ( T * emodel,
int(T ::* unpackFunc )(ProcessCommunicator &) )
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 293 of file processcomm.h.

References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), ProcessCommunicator(), and toReceive.

◆ unpackData() [2/2]

template<class T, class P>
int oofem::ProcessCommunicator::unpackData ( T * emodel,
P * dest,
int(T ::* unpackFunc )(P *, ProcessCommunicator &) )
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 310 of file processcomm.h.

References oofem::CommMode_Dynamic, giveProcessCommunicatorBuff(), ProcessCommunicator(), and toReceive.

◆ waitCompletion()

int oofem::ProcessCommunicator::waitCompletion ( )

Definition at line 145 of file processcomm.C.

References testCompletion().

Referenced by finishExchange().

Member Data Documentation

◆ mode

CommunicatorMode oofem::ProcessCommunicator::mode
protected

Mode.

Definition at line 193 of file processcomm.h.

Referenced by ProcessCommunicator().

◆ pcBuffer

ProcessCommunicatorBuff* oofem::ProcessCommunicator::pcBuffer
protected

Communicator buffers representation.

Definition at line 186 of file processcomm.h.

Referenced by giveProcessCommunicatorBuff(), and ProcessCommunicator().

◆ rank

int oofem::ProcessCommunicator::rank
protected

Associated partition (problem) number (rank).

Definition at line 183 of file processcomm.h.

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

◆ toReceive

IntArray oofem::ProcessCommunicator::toReceive
protected

◆ toSend

IntArray oofem::ProcessCommunicator::toSend
protected

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

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011