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)
 
double getMPISum (double val)
 

Typedef Documentation

◆ MpiPeriodicGhostParticleID

◆ MpiPeriodicParticleID

Function Documentation

◆ copyDataFromMPIParticleToParticle()

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
85 {
86  //Set the species of the particle, but before we can do that we have to set the handler
87  p->setHandler(particleHandler);
88  //p->setIndSpecies(bP->indSpecies);
89  const ParticleSpecies* species = p->getHandler()->getDPMBase()->speciesHandler.getObject(bP->indSpecies);
90  p->setSpecies(species);
92 }
float * p
Definition: Tutorial_Map_using.cpp:9
void copyDataFromMPIParticleToParticle(BaseParticle *p)
Copies data from a BaseParticle to an MPIParticle class and returns this.
Definition: MpiDataClass.cc:30
unsigned int indSpecies
Definition: MpiDataClass.h:22
Definition: ParticleSpecies.h:16

References MPISphericalParticle::copyDataFromMPIParticleToParticle(), MPISphericalParticle::indSpecies, and p.

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

◆ copyDataFromParticleToMPIParticle()

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 NonSphericalParticle particle from which data is copied
Returns
MPIParticle class is returned filled with data from BaseParticle p
104 {
105  MPIParticle bP;
107  return bP;
108 }
Data class to send a particle over MPI.
Definition: MpiDataClass.h:60
void copyDataFromParticleToMPIParticle(BaseParticle *p)
Definition: MpiDataClass.cc:110

References MPISphericalParticle::copyDataFromParticleToMPIParticle(), and p.

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

◆ copyPositionFrom()

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
154 {
155  MPIParticlePosition particlePosition;
156  particlePosition.id = particle->getId();
157  particlePosition.position = particle->getPosition();
158  particlePosition.orientation = particle->getOrientation();
159  if (std::is_base_of<MPILiquidFilmParticle,MPIParticle>())
160  particlePosition.liquidVolume = static_cast<LiquidFilmParticle*>(particle)->getLiquidVolume();
161  return particlePosition;
162 }
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
Definition: BaseInteractable.h:209
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:197
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:104
Definition: LiquidFilmParticle.h:15
Data class to send a particle position over MPI.
Definition: MpiDataClass.h:69
Vec3D position
Definition: MpiDataClass.h:72
Quaternion orientation
Definition: MpiDataClass.h:73
Mdouble liquidVolume
Definition: MpiDataClass.h:74
unsigned int id
Definition: MpiDataClass.h:71

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

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

◆ copyVelocityFrom()

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
170 {
171  MPIParticleVelocity particleVelocity;
172  particleVelocity.velocity = particle->getVelocity();
173  particleVelocity.angularVelocity = particle->getAngularVelocity();
174 
175  return particleVelocity;
176 }
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
Definition: BaseInteractable.cc:319
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:307
Data class to send a particle velocity over MPI.
Definition: MpiDataClass.h:82
Vec3D velocity
Definition: MpiDataClass.h:84
Vec3D angularVelocity
Definition: MpiDataClass.h:85

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

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

◆ getMPISum() [1/2]

double getMPISum ( double  val)

Sums the values over all processors using MPI_reduce

194 {
195 #ifdef MERCURYDPM_USE_MPI
196  //Sum up over all domains
197  double valGlobal = 0.0;
198  MPIContainer& communicator = MPIContainer::Instance();
199  communicator.allReduce(val, valGlobal, MPI_SUM);
200  return valGlobal;
201 #else
202  return val;
203 #endif
204 }
This class contains all information and functions required for communication between processors.
Definition: MpiContainer.h:109
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:113
val
Definition: calibrate.py:119

References MPIContainer::Instance(), and calibrate::val.

◆ getMPISum() [2/2]

Vec3D getMPISum ( Vec3D val)

Sums the values over all processors using MPI_reduce

179 {
180 #ifdef MERCURYDPM_USE_MPI
181  //Sum up over all domains
182  Vec3D valGlobal = {0.0,0.0,0.0};
183  MPIContainer& communicator = MPIContainer::Instance();
184  communicator.allReduce(val.X, valGlobal.X, MPI_SUM);
185  communicator.allReduce(val.Y, valGlobal.Y, MPI_SUM);
186  communicator.allReduce(val.Z, valGlobal.Z, MPI_SUM);
187  return valGlobal;
188 #else
189  return val;
190 #endif
191 }
Definition: Kernel/Math/Vector.h:30
Mdouble Y
Definition: Kernel/Math/Vector.h:45
Mdouble Z
Definition: Kernel/Math/Vector.h:45
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45

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

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