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

#include <communicator.h>

Inheritance diagram for oofem::Communicator:
Collaboration diagram for oofem::Communicator:

Public Member Functions

 Communicator (EngngModel *emodel, CommunicatorBuff *buff, int rank, int size, CommunicatorMode mode=CommMode_Static)
virtual ~Communicator ()
 Destructor.
ProcessCommunicatorgiveProcessCommunicator (int i)
template<class T>
int packAllData (T *ptr, int(T ::*packFunc)(ProcessCommunicator &))
template<class T, class P>
int packAllData (T *ptr, P *src, int(T ::*packFunc)(P *, ProcessCommunicator &))
template<class T>
int unpackAllData (T *ptr, int(T ::*unpackFunc)(ProcessCommunicator &))
template<class T, class P>
int unpackAllData (T *ptr, P *src, int(T ::*unpackFunc)(P *, ProcessCommunicator &))
int initExchange (int tag)
int initSend (int tag)
int initReceive (int tag)
int finishExchange ()
void clearBuffers ()
virtual void setUpCommunicationMaps (EngngModel *pm)
std::string errorInfo (const char *func) const
 Returns string for prepending output (used by error reporting macros).

Protected Attributes

int rank
 Rank of process.
std::vector< ProcessCommunicatorprocessComms
 Array of process communicators.
EngngModelengngModel
 Engineering model.
CommunicatorMode mode
 Mode.

Detailed Description

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 99 of file communicator.h.

Constructor & Destructor Documentation

◆ Communicator()

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.

Parameters
emodelAssociated engineering model.
buffCommunicator buffer.
rankRank of associated partition.
sizeNumber of collaborating processes.
modeCommunicator mode.

Definition at line 55 of file communicator.C.

References engngModel, oofem::CommunicatorBuff::giveProcessCommunicatorBuff(), mode, processComms, and rank.

Referenced by oofem::FETICommunicator::FETICommunicator(), and oofem::ProblemCommunicator::ProblemCommunicator().

◆ ~Communicator()

virtual oofem::Communicator::~Communicator ( )
inlinevirtual

Destructor.

Definition at line 123 of file communicator.h.

Member Function Documentation

◆ clearBuffers()

void oofem::Communicator::clearBuffers ( )

Clears all buffer content.

Definition at line 114 of file communicator.C.

References processComms.

◆ errorInfo()

std::string oofem::Communicator::errorInfo ( const char * func) const

Returns string for prepending output (used by error reporting macros).

Definition at line 122 of file communicator.C.

References rank.

◆ finishExchange()

◆ giveProcessCommunicator()

ProcessCommunicator * oofem::Communicator::giveProcessCommunicator ( int i)
inline

Returns i-th problem communicator. The problems are numbered from rank 0.

Parameters
iProblem communicator index [0..size-1].
Returns
Pointer to corresponding communicator, NULL otherwise.

Definition at line 131 of file communicator.h.

Referenced by oofem::Subdivision::packRemoteElements(), oofem::ElementCommunicator::setUpCommunicationMaps(), oofem::FETICommunicator::setUpCommunicationMaps(), and oofem::NodeCommunicator::setUpCommunicationMaps().

◆ initExchange()

int oofem::Communicator::initExchange ( int tag)

◆ initReceive()

int oofem::Communicator::initReceive ( int tag)

Initializes data receive exchange with all problems. if receive pool is empty, communication is not performed.

Parameters
tagMessage tag.
Returns
Nonzero if successful.

Definition at line 103 of file communicator.C.

References processComms.

◆ initSend()

int oofem::Communicator::initSend ( int tag)

Initializes data send exchange with all problems. if send pool is empty, communication is not performed.

Parameters
tagMessage tag.
Returns
Nonzero if successful.

Definition at line 92 of file communicator.C.

References processComms.

◆ packAllData() [1/2]

template<class T>
int oofem::Communicator::packAllData ( T * ptr,
int(T ::* packFunc )(ProcessCommunicator &) )

Pack all problemCommunicators data to their send buffers.

Parameters
ptrPointer problem communicator.
packFuncFunction used to pack nodal data in to buffer.
See also
NlDEIDynamic_Unpack_func

Definition at line 211 of file communicator.h.

References processComms.

Referenced by oofem::Subdivision::assignGlobalNumbersToSharedIrregulars(), oofem::Subdivision::exchangeRemoteElements(), oofem::Subdivision::exchangeSharedEdges(), oofem::Subdivision::exchangeSharedIrregulars(), oofem::NonlocalMaterialWTP::init(), oofem::ParmetisLoadBalancer::labelDofManagers(), oofem::NonlocalMaterialWTP::migrate(), and oofem::LoadBalancer::migrateLoad().

◆ packAllData() [2/2]

template<class T, class P>
int oofem::Communicator::packAllData ( T * ptr,
P * src,
int(T ::* packFunc )(P *, ProcessCommunicator &) )

Pack all problemCommuncators data to their send buffers.

Parameters
ptrPointer problem communicator.
srcPointer to source.
packFuncFunction used to pack nodal data in to buffer.
See also
NlDEIDynamic_Unpack_func

Definition at line 234 of file communicator.h.

◆ setUpCommunicationMaps()

virtual void oofem::Communicator::setUpCommunicationMaps ( EngngModel * pm)
inlinevirtual

Service for setting up the communication patterns with other remote processes. Sets up the toSend and toRecv attributes in associated problem communicators.

Parameters
pmEngineering model to use for setup.

Reimplemented in oofem::FETICommunicator.

Definition at line 204 of file communicator.h.

◆ unpackAllData() [1/2]

template<class T>
int oofem::Communicator::unpackAllData ( T * ptr,
int(T ::* unpackFunc )(ProcessCommunicator &) )

Unpack all problemCommuncators data from recv buffers. Waits until receive completion before unpacking buffer.

Parameters
ptrPointer problem communicator.
unpackFuncFunction used to unpack nodal data from buffer.
See also
NlDEIDynamic_Unpack_func

Definition at line 246 of file communicator.h.

References oofem::CommMode_Dynamic, OOFEM_LOG_DEBUG, processComms, rank, and VERBOSEPARALLEL_PRINT.

Referenced by oofem::Subdivision::assignGlobalNumbersToSharedIrregulars(), oofem::Subdivision::exchangeRemoteElements(), oofem::Subdivision::exchangeSharedEdges(), oofem::Subdivision::exchangeSharedIrregulars(), oofem::NonlocalMaterialWTP::init(), oofem::ParmetisLoadBalancer::labelDofManagers(), oofem::NonlocalMaterialWTP::migrate(), and oofem::LoadBalancer::migrateLoad().

◆ unpackAllData() [2/2]

template<class T, class P>
int oofem::Communicator::unpackAllData ( T * ptr,
P * src,
int(T ::* unpackFunc )(P *, ProcessCommunicator &) )

Unpack all problemCommuncators data from recv buffers. Waits until receive completion before unpacking buffer.

Parameters
ptrPointer problem communicator.
srcPointer to source.
unpackFuncFunction used to unpack nodal data from buffer.
See also
NlDEIDynamic_Unpack_func

Definition at line 357 of file communicator.h.

References oofem::CommMode_Dynamic, OOFEM_LOG_DEBUG, processComms, rank, and VERBOSEPARALLEL_PRINT.

Member Data Documentation

◆ engngModel

◆ mode

CommunicatorMode oofem::Communicator::mode
protected

Mode.

Definition at line 109 of file communicator.h.

Referenced by Communicator().

◆ processComms

◆ rank


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