MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MpiDataClass.h File Reference

Go to the source code of this file.

Classes

class  MPISphericalParticle
 
class  MPISuperQuadric
 
class  MPILiquidFilmParticle
 
class  MPIParticle
 Data class to send a particle over MPI. More...
 
class  MPIParticlePosition
 Data class to send a particle position over MPI. More...
 
class  MPIParticleVelocity
 Data class to send a particle velocity over MPI. More...
 
class  MPIParticleForce
 Data class to send a particle force over MPI. More...
 
class  Empty
 Data class to send an empty class over MPI. More...
 
class  MpiPeriodicParticleIDBase
 

Typedefs

typedef MpiPeriodicParticleIDBase MpiPeriodicParticleID
 
typedef MpiPeriodicParticleIDBase MpiPeriodicGhostParticleID
 

Functions

MPIParticle copyDataFromParticleToMPIParticle (BaseParticle *p)
 Copies data from a BaseParticle to an MPIParticle class and returns this. More...
 
void copyDataFromMPIParticleToParticle (MPIParticle *bP, BaseParticle *p, ParticleHandler *particleHandler)
 Copies data from an MPIParticle class to a BaseParticle. More...
 
MPIParticlePosition copyPositionFrom (BaseParticle *particle)
 Copies the position from a particle to an MPIParticlePosition class. More...
 
MPIParticleVelocity copyVelocityFrom (BaseParticle *particles)
 Copies the velocity from a particle to an MPIParticleVelocity class. More...
 
Vec3D getMPISum (Vec3D &val)
 Sums the values over all processors using MPI_reduce. More...
 
double getMPISum (double val)
 Sums the values over all processors using MPI_reduce. More...
 

Typedef Documentation

Function Documentation

void copyDataFromMPIParticleToParticle ( MPIParticle bP,
BaseParticle p,
ParticleHandler particleHandler 
)

Copies data from an MPIParticle class to a BaseParticle.

Copies data from an MPIParticle class to a BaseParticle.

Parameters
[in]bPPointer to an MPIParticle which contains data for a ghost particle
[in,out]pPointer to BaseParticle, a ghost particle that will be added to the domain
[in]particleHandlerPointer to the ParticleHandler required for creating a new particle
Todo:
MX: Maybe renamet his function to setParticleSpecies() or something

Definition at line 105 of file MpiDataClass.cc.

References MPISphericalParticle::copyDataFromMPIParticleToParticle(), BaseHandler< T >::getDPMBase(), BaseParticle::getHandler(), BaseHandler< T >::getObject(), MPISphericalParticle::indSpecies, BaseParticle::setHandler(), BaseParticle::setSpecies(), and DPMBase::speciesHandler.

Referenced by ParticleHandler::addGhostObject(), ParticleHandler::addObject(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), InsertionBoundary::checkBoundaryBeforeTimeStep(), Domain::processReceivedBoundaryParticleData(), PeriodicBoundaryHandler::processReceivedGhostParticleData(), and DPMBase::synchroniseParticle().

106 {
107  //Set the species of the particle, but before we can do that we have to set the handler
108  p->setHandler(particleHandler);
109  //p->setIndSpecies(bP->indSpecies);
111  p->setSpecies(species);
113 }
void copyDataFromMPIParticleToParticle(BaseParticle *p)
Copies data from a BaseParticle to an MPIParticle class and returns this.
Definition: MpiDataClass.cc:51
unsigned int indSpecies
Definition: MpiDataClass.h:43
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
void setSpecies(const ParticleSpecies *species)
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1319
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
MPIParticle copyDataFromParticleToMPIParticle ( BaseParticle p)

Copies data from a BaseParticle to an MPIParticle class and returns this.

Copies data from a BaseParticle to an MPIParticle class and returns this.

In order to create ghost particles on other processors, data of particles have to be transmitted to other processors. Only the required data is sent. The data is sent in an MPIParticle data class and this function copies the data from a particle into that class.

Parameters
[in]pPointer to a SuperQuadricParticle particle from which data is copied
Returns
MPIParticle class is returned filled with data from BaseParticle p

Definition at line 124 of file MpiDataClass.cc.

References MPISphericalParticle::copyDataFromParticleToMPIParticle().

Referenced by RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), Domain::collectBoundaryParticleData(), and PeriodicBoundaryHandler::collectGhostParticleData().

125 {
126  MPIParticle bP;
128  return bP;
129 }
void copyDataFromParticleToMPIParticle(BaseParticle *p)
Data class to send a particle over MPI.
Definition: MpiDataClass.h:81
MPIParticlePosition copyPositionFrom ( BaseParticle particle)

Copies the position from a particle to an MPIParticlePosition class.

Parameters
[in]particleBaseParticle which position is copied
Returns
MPIParticlePosition object containing the position of the particle

Definition at line 174 of file MpiDataClass.cc.

References BaseObject::getId(), BaseInteractable::getOrientation(), BaseInteractable::getPosition(), MPIParticlePosition::id, MPIParticlePosition::liquidVolume, MPIParticlePosition::orientation, and MPIParticlePosition::position.

Referenced by PeriodicBoundaryHandler::preparePositionAndVelocityUpdate(), and Domain::preparePositionAndVelocityUpdate().

175 {
176  MPIParticlePosition particlePosition;
177  particlePosition.id = particle->getId();
178  particlePosition.position = particle->getPosition();
179  particlePosition.orientation = particle->getOrientation();
180  if (std::is_base_of<MPILiquidFilmParticle,MPIParticle>())
181  particlePosition.liquidVolume = static_cast<LiquidFilmParticle*>(particle)->getLiquidVolume();
182  return particlePosition;
183 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
unsigned int id
Definition: MpiDataClass.h:92
Quaternion orientation
Definition: MpiDataClass.h:94
Data class to send a particle position over MPI.
Definition: MpiDataClass.h:89
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
MPIParticleVelocity copyVelocityFrom ( BaseParticle particle)

Copies the velocity from a particle to an MPIParticleVelocity class.

Parameters
[in]particleBaseParticle which velocity is copied
Returns
MPIParticleVelocityn object containing the velocity of the particle

Definition at line 190 of file MpiDataClass.cc.

References MPIParticleVelocity::angularVelocity, BaseInteractable::getAngularVelocity(), BaseInteractable::getVelocity(), and MPIParticleVelocity::velocity.

Referenced by PeriodicBoundaryHandler::preparePositionAndVelocityUpdate(), Domain::preparePositionAndVelocityUpdate(), and Domain::prepareVelocityUpdate().

191 {
192  MPIParticleVelocity particleVelocity;
193  particleVelocity.velocity = particle->getVelocity();
194  particleVelocity.angularVelocity = particle->getAngularVelocity();
195 
196  return particleVelocity;
197 }
Data class to send a particle velocity over MPI.
Definition: MpiDataClass.h:102
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Vec3D getMPISum ( Vec3D val)

Sums the values over all processors using MPI_reduce.

Definition at line 199 of file MpiDataClass.cc.

References MPIContainer::Instance(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by ParticleHandler::getAngularMomentum(), InteractionHandler::getLiquidBridgeVolume(), ParticleHandler::getLiquidFilmVolume(), and ParticleHandler::getMomentum().

200 {
201 #ifdef MERCURY_USE_MPI
202  //Sum up over all domains
203  Vec3D valGlobal = {0.0,0.0,0.0};
204  MPIContainer& communicator = MPIContainer::Instance();
205  communicator.allReduce(val.X, valGlobal.X, MPI_SUM);
206  communicator.allReduce(val.Y, valGlobal.Y, MPI_SUM);
207  communicator.allReduce(val.Z, valGlobal.Z, MPI_SUM);
208  return valGlobal;
209 #else
210  return val;
211 #endif
212 }
This class contains all information and functions required for communication between processors...
Definition: MpiContainer.h:125
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:130
Mdouble X
the vector components
Definition: Vector.h:65
Mdouble Y
Definition: Vector.h:65
Definition: Vector.h:49
Mdouble Z
Definition: Vector.h:65
double getMPISum ( double  val)

Sums the values over all processors using MPI_reduce.

Definition at line 214 of file MpiDataClass.cc.

References MPIContainer::Instance().

215 {
216 #ifdef MERCURY_USE_MPI
217  //Sum up over all domains
218  double valGlobal = 0.0;
219  MPIContainer& communicator = MPIContainer::Instance();
220  communicator.allReduce(val, valGlobal, MPI_SUM);
221  return valGlobal;
222 #else
223  return val;
224 #endif
225 }
This class contains all information and functions required for communication between processors...
Definition: MpiContainer.h:125
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:130