ESyS-Particle
4.0.1
|
MPI send/recv buffer with automagically adjusted size. More...
#include <mpivbuf.h>
Public Member Functions | |
CVarMPIBuffer (MPI_Comm, int size=16) | |
virtual void | clear () |
virtual void | sendTo (int, int) |
virtual void | NBsendTo (int, int) |
virtual void | initSendTo (int, int) |
virtual void | wait () |
virtual void | receiveFrom (int src=MPI_ANY_SOURCE, int tag=MPI_ANY_TAG) |
virtual void | append (int) |
virtual void | append (double) |
virtual void | append (const char *) |
virtual void | append (const Vec3 &V) |
virtual int | pop_int () |
virtual double | pop_double () |
virtual void | pop_doubles (double *, int) |
virtual std::string | pop_string () |
virtual void | broadcast (int) |
virtual void | receiveBroadcast (int) |
![]() | |
AMPIBufferPP (MPI_Comm comm) | |
![]() | |
AMPIBuffer (MPI_Comm comm) | |
virtual Vec3 | pop_vector () |
const MPI_Status & | status () |
Protected Member Functions | |
void | grow () |
void | growTo (int) |
MPI send/recv buffer with automagically adjusted size.
CVarMPIBuffer implements a send/receive buffer with variable size. The buffer grows automatically if neccesary with each append operation and when the a message is received. It is never automatically shrunk. Both append and send/recv operations slower than a constant size buffer (CMPIBuffer)
implement checks for locking
use exeption handling for error checking
CVarMPIBuffer::CVarMPIBuffer | ( | MPI_Comm | comm, |
int | size = 16 |
||
) |
Constructor. Allocates the buffer and sets the MPI communicator to be used for send/receive operations. If the initial buffer size is not given a buffer of initial size 16 is allocated.
comm | the MPI communicator |
s | the initial size of the buffer, defaults to 16 |
References AMPIBuffer::m_comm.
|
virtual |
Append an integer to the buffer. If necessary, the buffer is enlarged.
Implements AMPIBuffer.
References grow(), and AMPIBuffer::m_comm.
Referenced by CLatticeMaster::addBondedIG(), CLatticeMaster::addCappedBondedIG(), CLatticeMaster::addExIG(), CLatticeMaster::addMesh2D(), CLatticeMaster::addShortBondedIG(), BroadcastCommand::append(), BroadcastCommand::appendTypeAndName(), CLatticeMaster::applyForceToWall(), CLatticeMaster::createTriMesh(), CLatticeMaster::do2dCalculations(), CLatticeMaster::findParticleNearestTo(), CLatticeMaster::moveParticleTo(), CLatticeMaster::moveSingleNodeBy(), CLatticeMaster::moveTaggedNodesBy(), CLatticeMaster::moveTaggedParticlesBy(), CLatticeMaster::moveWallBy(), ABCDampingIGP::packInto(), CLocalDampingIGP::packInto(), CDampingIGP::packInto(), CLatticeMaster::setParticleAngVel(), CLatticeMaster::setParticleDensity(), CLatticeMaster::setParticleNonDynamic(), CLatticeMaster::setParticleNonRot(), CLatticeMaster::setParticleNonTrans(), CLatticeMaster::setParticleVel(), CLatticeMaster::setTaggedParticleVel(), CLatticeMaster::setVelocityOfWall(), CLatticeMaster::setWallNormal(), and CLatticeMaster::tagParticleNearestTo().
|
virtual |
Append a double to the buffer. If necessary, the buffer is enlarged.
Implements AMPIBuffer.
References grow(), and AMPIBuffer::m_comm.
|
virtual |
Append a string to the buffer. If necessary, the buffer is enlarged.
Implements AMPIBuffer.
References grow(), and AMPIBuffer::m_comm.
|
virtual |
Broadcast a message to all members of the communicator.
root | the root of the broadcast |
References AMPIBuffer::m_comm.
Referenced by CLatticeMaster::addBondedIG(), CLatticeMaster::addCappedBondedIG(), CLatticeMaster::addExIG(), CLatticeMaster::addMesh2D(), CLatticeMaster::addShortBondedIG(), CLatticeMaster::applyForceToWall(), CLatticeMaster::createTriMesh(), CLatticeMaster::do2dCalculations(), CLatticeMaster::findParticleNearestTo(), CheckPointController::issueCheckPointCmd(), CheckPointController::issueCheckPointCmdWTM(), CheckPointController::issueCheckPointLoadingCmd(), CheckPointController::issueSnapShotCmd(), CLatticeMaster::makeLattice(), CLatticeMaster::moveParticleTo(), CLatticeMaster::moveSingleNodeBy(), CLatticeMaster::moveTaggedNodesBy(), CLatticeMaster::moveTaggedParticlesBy(), CLatticeMaster::moveWallBy(), CLatticeMaster::setParticleAngVel(), CLatticeMaster::setParticleDensity(), CLatticeMaster::setParticleNonDynamic(), CLatticeMaster::setParticleNonRot(), CLatticeMaster::setParticleNonTrans(), CLatticeMaster::setParticleVel(), CLatticeMaster::setTaggedParticleVel(), CLatticeMaster::setVelocityOfWall(), CLatticeMaster::setWallNormal(), and CLatticeMaster::tagParticleNearestTo().
|
protected |
|
protected |
Grows the buffer to a given size. If the buffer is already larger that the given size, nothing is done. Used by receiveFrom.
size | size to which the buffer is grown |
Referenced by grow(), receiveBroadcast(), and receiveFrom().
|
virtual |
Initate send,lock buffer and immediately return (equivalent to MPI_Isend)
dest | the rank of the destination process in the current communicator |
tag | the message tag |
References BasicCon::Critical(), and AMPIBuffer::m_comm.
|
virtual |
Nonblocking version of CVarMPIBuffer::sendTo. Uses MPI_Isend and is (should be) thus deadlock-safe.
dest | the rank of the destination process in the current communicator |
tag | the message tag |
References AMPIBuffer::m_comm.
|
virtual |
Pops a double from the buffer.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
Referenced by TSubLattice< T >::addBondedIG(), TSubLattice< T >::addBondedMesh2DIG(), TSubLattice< T >::addBondedTriMeshIG(), TSubLattice< T >::addCappedBondedIG(), TSubLattice< T >::addMesh2DIG(), TRotSubLattice< T >::addRotBondedIG(), TRotSubLattice< T >::addRotThermBondedIG(), TSubLattice< T >::addShortBondedIG(), TSubLattice< T >::addTriMeshIG(), TSubLattice< T >::doAddPIG(), and TSubLattice< T >::setParticleDensity().
|
virtual |
|
virtual |
Pops an integer from the buffer, i.e. it pops the last sizeof(MPI_INT) bytes of the buffer, interpreting them ans an int.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
Referenced by TSubLattice< T >::addBondedIG(), TSubLattice< T >::addBondedMesh2DIG(), TSubLattice< T >::addBondedTriMeshIG(), TSubLattice< T >::addCappedBondedIG(), TRotSubLattice< T >::addRotBondedIG(), TRotSubLattice< T >::addRotThermBondedIG(), TSubLattice< T >::addShortBondedIG(), TSubLattice< T >::doAddPIG(), TSubLattice< T >::moveParticleTo(), TSubLattice< T >::moveSingleNode(), TSubLattice< T >::moveTaggedNodes(), TSubLattice< T >::moveTaggedParticlesBy(), TRotSubLattice< T >::setParticleAngularVelocity(), TSubLattice< T >::setParticleDensity(), TSubLattice< T >::setParticleNonDynamic(), TSubLattice< T >::setParticleNonRot(), TSubLattice< T >::setParticleNonTrans(), TSubLattice< T >::setParticleVelocity(), TSubLattice< T >::setTaggedParticleVel(), CSubLatticeControler::setVerbosity(), and TSubLattice< T >::tagParticleNearestTo().
|
virtual |
Pops a string from the buffer. The first for bytes are interpreted as int, giving the length of the string (without terminating '\0'), the rest as the characters.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
Referenced by TSubLattice< T >::addBondedIG(), TSubLattice< T >::addBondedMesh2DIG(), TSubLattice< T >::addBondedTriMeshIG(), TSubLattice< T >::addCappedBondedIG(), TSubLattice< T >::addDamping(), TSubLattice< T >::addMesh2D(), TSubLattice< T >::addMesh2DIG(), TSubLattice< T >::addPairIG(), TRotSubLattice< T >::addRotBondedIG(), TRotSubLattice< T >::addRotThermBondedIG(), TSubLattice< T >::addShortBondedIG(), TSubLattice< T >::addSingleIG(), TSubLattice< T >::addTaggedPairIG(), TSubLattice< T >::addTriMesh(), TSubLattice< T >::addTriMeshIG(), TSubLattice< T >::addWall(), TSubLattice< T >::applyForceToWall(), TSubLattice< T >::getMesh2DStress(), TSubLattice< T >::getMeshFaceRef(), TSubLattice< T >::getMeshNodeRef(), TSubLattice< T >::getTriMeshForce(), TSubLattice< T >::getWallForce(), TSubLattice< T >::getWallPos(), TSubLattice< T >::moveSingleNode(), TSubLattice< T >::moveTaggedNodes(), TSubLattice< T >::moveWallBy(), TSubLattice< T >::removeIG(), TSubLattice< T >::setExIG(), TSubLattice< T >::setVelocityOfWall(), TSubLattice< T >::setWallNormal(), and CSubLatticeControler::translateMeshBy().
|
virtual |
receive broadcast
root | the root of the broadcast |
References growTo(), and AMPIBuffer::m_comm.
Referenced by TSubLattice< T >::addBondedIG(), TSubLattice< T >::addBondedMesh2DIG(), TSubLattice< T >::addBondedTriMeshIG(), TSubLattice< T >::addBondedWIG(), TSubLattice< T >::addCappedBondedIG(), TSubLattice< T >::addDamping(), TSubLattice< T >::addDirBondedWIG(), TSubLattice< T >::addElasticWIG(), TSubLattice< T >::addMesh2D(), TSubLattice< T >::addMesh2DIG(), TSubLattice< T >::addPairIG(), TRotSubLattice< T >::addRotBondedIG(), TRotSubLattice< T >::addRotThermBondedIG(), TSubLattice< T >::addShortBondedIG(), TSubLattice< T >::addSingleIG(), TSubLattice< T >::addTaggedPairIG(), TSubLattice< T >::addTriMesh(), TSubLattice< T >::addTriMeshIG(), TSubLattice< T >::addViscWIG(), TSubLattice< T >::addWall(), TSubLattice< T >::applyForceToWall(), TSubLattice< T >::getMesh2DStress(), TSubLattice< T >::getMeshFaceRef(), TSubLattice< T >::getMeshNodeRef(), TSubLattice< T >::getTriMeshForce(), TSubLattice< T >::getWallForce(), TSubLattice< T >::getWallPos(), ASubLattice::initComplex(), CSubLatticeControler::makeLattice(), TSubLattice< T >::moveParticleTo(), TSubLattice< T >::moveSingleNode(), TSubLattice< T >::moveTaggedNodes(), TSubLattice< T >::moveTaggedParticlesBy(), TSubLattice< T >::moveWallBy(), TSubLattice< T >::removeIG(), CheckPointer::saveRestartable(), TSubLattice< T >::setExIG(), TRotSubLattice< T >::setParticleAngularVelocity(), TSubLattice< T >::setParticleDensity(), TSubLattice< T >::setParticleNonDynamic(), TSubLattice< T >::setParticleNonRot(), TSubLattice< T >::setParticleNonTrans(), TSubLattice< T >::setParticleVelocity(), TSubLattice< T >::setTaggedParticleVel(), TSubLattice< T >::setVelocityOfWall(), CSubLatticeControler::setVerbosity(), TSubLattice< T >::setWallNormal(), TSubLattice< T >::tagParticleNearestTo(), and CSubLatticeControler::translateMeshBy().
|
virtual |
Receives a message from a given source and stores it in the buffer.The size of the buffer is automatically adjusted so it will be big enough to fit the message. For this reason 2 messages are received, the first one for the size of the data, the second one for the data. If no source and no tag are given, any message from any source is accepted.
src | rank of the sender in the current communicator, defaults to MPI_ANY_SOURCE |
tag | the message tag, defaults to MPI_ANY_TAG |
Implements AMPIBufferPP.
References growTo(), and AMPIBuffer::m_comm.
|
virtual |
Sends the contents of the buffer to a given destination. There are actually two messages sent, the first one announces the size of the buffer so the buffer on the receiving end can be grown if necessary, the second one does the transfer of the data. It uses buffered sends (MPI_Bsend) and it thus deadlock-save
dest | the rank of the destination process in the current communicator |
tag | the message tag |
Implements AMPIBufferPP.
References AMPIBuffer::m_comm.
|
virtual |
Wait for completion of transaction on this buffer. If completed, unlock buffer and return