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

Class representing communicator. More...

#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)
 Constructor. More...
 
virtual ~Communicator ()
 Destructor. More...
 
ProcessCommunicatorgiveProcessCommunicator (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...
 
EngngModelengngModel
 Engineering model. More...
 
CommunicatorMode mode
 Mode. More...
 

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

Constructor & Destructor Documentation

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 72 of file communicator.C.

References oofem::CommunicatorBuff::giveProcessCommunicatorBuff(), and oofem::CommunicatorBuff::size.

oofem::Communicator::~Communicator ( )
virtual

Destructor.

Definition at line 90 of file communicator.C.

References oofem::CommunicatorBuff::size.

Member Function Documentation

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.

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

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

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

Parameters
tagMessage tag.
Returns
Nonzero if successful.

Definition at line 128 of file communicator.C.

References oofem::CommunicatorBuff::size.

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

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

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

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

References oofem::errorInfo().

template<class T >
int oofem::Communicator::unpackAllData ( T *  ptr,
int(T::*)(ProcessCommunicator &)  unpackFunc 
)
template<class T , class P >
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.

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

Definition at line 377 of file communicator.h.

References oofem::IntArray::at(), oofem::CommMode_Dynamic, OOFEM_LOG_DEBUG, and VERBOSEPARALLEL_PRINT.

Member Data Documentation

CommunicatorMode oofem::Communicator::mode
protected

Mode.

Definition at line 117 of file communicator.h.

ProcessCommunicator** oofem::Communicator::processComms
protected

Array of process communicators.

Definition at line 113 of file communicator.h.

int oofem::Communicator::rank
protected
int oofem::Communicator::size
protected

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:34 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011