MercuryDPM
Trunk
|
Container to store all BaseParticle. More...
#include <ParticleHandler.h>
Public Member Functions | |
ParticleHandler () | |
Default constructor, it creates an empty ParticleHandler. More... | |
ParticleHandler (const ParticleHandler &PH) | |
Constructor that copies all BaseParticle it contains and then sets the smallest and largest particle. More... | |
ParticleHandler & | operator= (const ParticleHandler &rhs) |
Assignment operator. More... | |
~ParticleHandler () override | |
Destructor, it destructs the ParticleHandler and all BaseParticle it contains. More... | |
void | addExistingObject (BaseParticle *P) override |
Adds a BaseParticle to the ParticleHandler. More... | |
void | addObject (BaseParticle *P) override |
Adds a BaseParticle to the ParticleHandler. More... | |
void | addObject (int fromProcessor, BaseParticle *P) |
Adds a BaseParticle located at processor fromProcessor to toProcessor. More... | |
void | addGhostObject (int fromPrcessor, int toProcessor, BaseParticle *p) |
Adds a ghost particle located at fromProcessor to toProcessor. More... | |
void | addGhostObject (BaseParticle *P) override |
Adds a BaseParticle to the ParticleHandler. More... | |
void | removeObject (unsigned int index) override |
Removes a BaseParticle from the ParticleHandler. More... | |
void | removeGhostObject (unsigned int index) |
Removes a BaseParticle from the ParticleHandler without a global check, this is only to be done for mpi routines. More... | |
void | removeLastObject () |
Removes the last BaseParticle from the ParticleHandler. More... | |
void | computeSmallestParticle () |
Computes the smallest particle (by interaction radius) and sets it in smallestParticle_. More... | |
void | computeLargestParticle () |
Computes the largest particle (by interaction radius) and sets it in largestParticle_. More... | |
BaseParticle * | getSmallestParticleLocal () const |
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler of the local domain. More... | |
BaseParticle * | getSmallestParticle () const |
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler of the local domain. When mercury is running in parallel this function throws an error since a pointer to another domain is useless. More... | |
BaseParticle * | getLargestParticleLocal () const |
Gets a pointer to the largest BaseParticle (by interactionRadius) in the ParticleHandler of the local domain. More... | |
BaseParticle * | getLargestParticle () const |
Returns the pointer of the largest particle in the particle handler. When mercury is running in parallel this function throws an error since a pointer to another domain is useless. More... | |
Mdouble | getSmallestInteractionRadiusLocal () const |
Returns the smallest interaction radius of the current domain. More... | |
Mdouble | getSmallestInteractionRadius () const |
Returns the smallest interaction radius. More... | |
Mdouble | getLargestInteractionRadiusLocal () const |
Returns the largest interaction radius of the current domain. More... | |
Mdouble | getLargestInteractionRadius () const |
Returns the largest interaction radius. More... | |
BaseParticle * | getFastestParticleLocal () const |
Gets a pointer to the fastest BaseParticle in this ParticleHandler. More... | |
BaseParticle * | getFastestParticle () const |
Mdouble | getKineticEnergy () const |
Mdouble | getRotationalEnergy () const |
Mdouble | getMass () const |
Vec3D | getMassTimesPosition () const |
Vec3D | getCentreOfMass () const |
Vec3D | getMomentum () const |
Vec3D | getAngularMomentum () const |
Mdouble | getVolume () const |
Mdouble | getMeanRadius () const |
BaseParticle * | getLowestPositionComponentParticleLocal (int i) const |
Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler. More... | |
BaseParticle * | getLowestPositionComponentParticle (int i) const |
Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler. More... | |
BaseParticle * | getHighestPositionComponentParticleLocal (int i) const |
Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler. More... | |
BaseParticle * | getHighestPositionComponentParticle (int i) const |
Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler. More... | |
BaseParticle * | getLowestVelocityComponentParticleLocal (int i) const |
Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler. More... | |
BaseParticle * | getLowestVelocityComponentParticle (int i) const |
Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler. More... | |
BaseParticle * | getHighestVelocityComponentParticleLocal (int i) const |
Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler. More... | |
BaseParticle * | getHighestVelocityComponentParticle (int i) const |
Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler. More... | |
template<typename T > | |
std::enable_if< std::is_scalar < T >::value, T >::type | getParticleAttributeLocal (std::function< T(BaseParticle *)> attribute, AttributeType type) const |
Computes an attribute type (min/max/..) of a particle attribute (position/velocity) in a local domain. More... | |
template<typename T > | |
std::enable_if< std::is_scalar < T >::value, T >::type | getParticleAttribute (std::function< T(BaseParticle *)> attribute, AttributeType type) const |
Computes an attribute type (min/max/..) of a particle attribute(position/velocity) in the global domain. More... | |
Mdouble | getHighestPositionX () const |
Function returns the highest position in the x-direction. More... | |
void | clear () override |
Empties the whole ParticleHandler by removing all BaseParticle. More... | |
unsigned int | getNumberOfFixedParticles () const |
Gets the number of particles that are fixed. More... | |
unsigned int | getNumberOfUnfixedParticles () const |
Gets the number of particles that are not fixed. More... | |
BaseParticle * | readAndCreateObject (std::istream &is) |
Create a new particle, based on the information provided in a restart file. More... | |
void | readAndAddObject (std::istream &is) override |
Create a new particle, based on the information from old-style restart data. More... | |
void | write (std::ostream &os) const |
void | checkExtrema (BaseParticle *P) |
Checks if the extrema of this ParticleHandler needs updating. More... | |
void | checkExtremaOnDelete (BaseParticle *P) |
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted. More... | |
void | computeAllMasses (unsigned int indSpecies) |
Computes the mass for all BaseParticle of the given species in this ParticleHandler. More... | |
void | computeAllMasses () |
Computes the mass for all BaseParticle in this ParticleHandler. More... | |
void | addedFixedParticle () |
Increment of the number of fixed particles. More... | |
void | removedFixedParticle () |
Decrement of the number of fixed particles. More... | |
std::string | getName () const override |
Returns the name of the handler, namely the string "ParticleHandler". More... | |
unsigned int | getNumberOfRealObjects () const |
Returns the number of real objects (on all processors) More... | |
unsigned int | getNumberOfObjects () const override |
Returns the number of objects in the container. In parallel code this practice is forbidden to avoid confusion with real and fake particles. If the size of the container is wished, call size() More... | |
unsigned int | getNumberOfFixedObjectsLocal () const |
Computes the number of Fixed particles on a local domain. More... | |
unsigned int | getNumberOfFixedObjects () const |
Computes the number of fixed particles in the whole simulation. More... | |
unsigned int | getNumberOfRealObjectsLocal () const |
Returns the number of real objects on a local domain. MPI particles and periodic particles are neglected. More... | |
void | actionsAfterTimeStep () |
double | getLiquidFilmVolume () const |
![]() | |
BaseHandler () | |
Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer. More... | |
BaseHandler (const BaseHandler< BaseParticle > &BH) | |
Constructor that copies the objects of the given handler into itself and sets other variables to 0/nullptr. More... | |
virtual | ~BaseHandler () |
Destructor, it destructs the BaseHandler and all Object it contains. More... | |
void | copyContentsFromOtherHandler (const BaseHandler< BaseParticle > &BH) |
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handler (container) to the other. More... | |
std::enable_if <!std::is_pointer< U >::value, U * >::type | copyAndAddObject (const U &object) |
Creates a copy of a Object and adds it to the BaseHandler. More... | |
std::enable_if < std::is_pointer< U >::value, U >::type | copyAndAddObject (const U object) |
Creates a copy of a Object and adds it to the BaseHandler. More... | |
std::enable_if <!std::is_pointer< U >::value, U * >::type | copyAndAddGhostObject (const U &object) |
Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case. More... | |
std::enable_if < std::is_pointer< U >::value, U >::type | copyAndAddGhostObject (const U object) |
Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case. More... | |
void | removeIf (const std::function< bool(BaseParticle *)> cond) |
virtual void | removeObject (unsigned const int index) |
Removes an Object from the BaseHandler. More... | |
void | removeLastObject () |
Removes the last Object from the BaseHandler. More... | |
void | read (std::istream &is) |
Reads all objects from restart data. More... | |
BaseParticle * | getObjectById (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
std::vector< BaseParticle * > | getObjectsById (const unsigned int id) |
Gets a vector of pointers to the objects with the specific id. More... | |
BaseParticle * | getObject (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
const BaseParticle * | getObject (const unsigned int id) const |
Gets a constant pointer to the Object at the specified index in the BaseHandler. More... | |
BaseParticle * | getLastObject () |
Gets a pointer to the last Object in this BaseHandler. More... | |
const BaseParticle * | getLastObject () const |
Gets a constant pointer to the last Object in this BaseHandler. More... | |
unsigned int | getSize () const |
Gets the size of the particleHandler (including mpi and periodic particles) More... | |
unsigned int | getStorageCapacity () const |
Gets the storage capacity of this BaseHandler. More... | |
void | setStorageCapacity (const unsigned int N) |
Sets the storage capacity of this BaseHandler. More... | |
void | resize (const unsigned int N, const BaseParticle &obj) |
Resizes the container to contain N elements. More... | |
const std::vector < BaseParticle * > ::const_iterator | begin () const |
Gets the begin of the const_iterator over all Object in this BaseHandler. More... | |
const std::vector < BaseParticle * >::iterator | begin () |
Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector < BaseParticle * > ::const_iterator | end () const |
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector < BaseParticle * >::iterator | end () |
Gets the end of the iterator over all BaseBoundary in this BaseHandler. More... | |
void | setDPMBase (DPMBase *DPMBase) |
Sets the problem that is solved using this handler. More... | |
void | setId (BaseParticle *object, unsigned int id) |
This function sets the id and ensures that nextId is a bigger value than id. More... | |
void | increaseId () |
unsigned int | getNextId () |
void | setNextId (unsigned int id) |
DPMBase * | getDPMBase () |
Gets the problem that is solved using this handler. More... | |
DPMBase * | getDPMBase () const |
Gets the problem that is solved using this handler and does not change the class. More... | |
virtual void | writeVTK () const |
now empty function for writing VTK files. More... | |
unsigned | getNextGroupId () |
Should be called each time you assign a groupId. Returns the value of nextGroupId_ and increases nextGroupId_ by one. More... | |
Static Public Member Functions | |
static BaseParticle * | createObject (const std::string &type) |
Reads BaseParticle into the ParticleHandler from restart data. More... | |
Private Member Functions | |
Mdouble | getKineticEnergyLocal () const |
Mdouble | getRotationalEnergyLocal () const |
Mdouble | getMassLocal () const |
Mdouble | getVolumeLocal () const |
Vec3D | getMassTimesPositionLocal () const |
Mdouble | getSumRadiusLocal () const |
Private Attributes | |
BaseParticle * | largestParticle_ |
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler. More... | |
BaseParticle * | smallestParticle_ |
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler. More... | |
unsigned int | NFixedParticles_ |
Number of fixed particles. More... | |
Additional Inherited Members | |
![]() | |
std::vector< BaseParticle * > | objects_ |
The actual list of Object pointers. More... | |
Container to store all BaseParticle.
The ParticleHandler is a container to store all BaseParticle. It is implemented by a vector of pointers to BaseParticle.
Definition at line 47 of file ParticleHandler.h.
ParticleHandler::ParticleHandler | ( | ) |
Default constructor, it creates an empty ParticleHandler.
Constructor of the ParticleHandler class. It creates and empty ParticleHandler.
Definition at line 49 of file ParticleHandler.cc.
References DEBUG, largestParticle_, logger, and smallestParticle_.
ParticleHandler::ParticleHandler | ( | const ParticleHandler & | PH | ) |
Constructor that copies all BaseParticle it contains and then sets the smallest and largest particle.
[in] | PH | The ParticleHandler that has to be copied. |
This is not a copy constructor! It copies the DPMBase and all BaseParticle, and sets the other variables to 0. After that, it computes the smallest and largest particle in this handler.
Definition at line 62 of file ParticleHandler.cc.
References clear(), computeLargestParticle(), computeSmallestParticle(), BaseHandler< BaseParticle >::copyContentsFromOtherHandler(), DEBUG, BaseHandler< T >::getDPMBase(), largestParticle_, logger, BaseHandler< BaseParticle >::objects_, BaseHandler< BaseParticle >::setDPMBase(), and smallestParticle_.
|
override |
Destructor, it destructs the ParticleHandler and all BaseParticle it contains.
Set the pointers to largestParticle_ and smallestParticle_ to nullptr, all BaseParticle are destroyed by the BaseHandler afterwards.
Definition at line 106 of file ParticleHandler.cc.
References DEBUG, largestParticle_, logger, and smallestParticle_.
void ParticleHandler::actionsAfterTimeStep | ( | ) |
Definition at line 1355 of file ParticleHandler.cc.
References constants::i.
Referenced by DPMBase::computeOneTimeStep().
void ParticleHandler::addedFixedParticle | ( | ) |
Increment of the number of fixed particles.
Definition at line 1217 of file ParticleHandler.cc.
References NFixedParticles_.
Referenced by BaseParticle::fixParticle().
|
overridevirtual |
Adds a BaseParticle to the ParticleHandler.
[in] | P | A pointer to the BaseParticle that has to be added. |
To add a BaseParticle to the ParticleHandler, first check if it has a species, since it is as common bug to use a BaseParticle without species, which leads to a segmentation fault. To help the user with debugging, a warning is given if a particle without species is added. After that, the actions for adding the particle to the BaseHandler are taken, which include adding it to the vector of pointers to all BaseParticle and assigning the correct id and index. Then the particle is added to the HGrid, the particle is told that this is its handler, its mass is computed and finally it is checked if this is the smallest or largest particle in this ParticleHandler. The particle exists, in other words: it has been made before. This implies it already got an id Attached to it and hence we don't want to assign a new ID to it.
Reimplemented from BaseHandler< BaseParticle >.
Definition at line 130 of file ParticleHandler.cc.
References BaseHandler< T >::addExistingObject(), checkExtrema(), ParticleSpecies::computeMass(), BaseHandler< BaseParticle >::getDPMBase(), BaseObject::getId(), BaseInteractable::getSpecies(), DPMBase::hGridInsertParticle(), DPMBase::hGridUpdateParticle(), logger, BaseParticle::setHandler(), and WARN.
Referenced by readAndAddObject().
void ParticleHandler::addGhostObject | ( | int | fromProcessor, |
int | toProcessor, | ||
BaseParticle * | p | ||
) |
Adds a ghost particle located at fromProcessor to toProcessor.
This function adds a ghost particle from one processor to another processor.
When a periodic ghost particle or a mpi ghost particle is created, the ID should not be updated and hence the addGhostObject needs to be called. Adding a ghost keeps the ID constant. Additionally this function copies the particle information given on processor fromProcessor to all other processors. The target processor then adds the particle.
[in] | fromProcessor | processor containing the particle data |
[in] | toProcessor | processor that needs to add the particle |
[in,out] | particle | that contains the data and receives the data |
Definition at line 283 of file ParticleHandler.cc.
References copyDataFromMPIParticleToParticle(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), MPIContainer::getProcessorID(), MPIContainer::Instance(), logger, MAX_PROC, PARTICLE, PARTICLE_DATA, MPIContainer::receive(), MPIContainer::send(), MPIContainer::sync(), and WARN.
Referenced by PeriodicBoundaryHandler::processLocalGhostParticles(), Domain::processReceivedBoundaryParticleData(), and PeriodicBoundaryHandler::processReceivedGhostParticleData().
|
overridevirtual |
Adds a BaseParticle to the ParticleHandler.
This is a special function that is used in the parallel code. The functions differs from the standard parallel implementation as this function does not check if the particle is an mpi particle and the mpi domain is not updated. When the domain adds mpi particles to the simulation these checks are not required. It also doesnt increase the id of the particle
[in] | A | pointer to the BaseParticle that has to be added. |
Reimplemented from BaseHandler< BaseParticle >.
Definition at line 344 of file ParticleHandler.cc.
References BaseHandler< T >::addGhostObject(), checkExtrema(), ParticleSpecies::computeMass(), BaseHandler< BaseParticle >::getDPMBase(), BaseObject::getId(), BaseInteractable::getSpecies(), DPMBase::handleParticleAddition(), DPMBase::hGridInsertParticle(), DPMBase::hGridUpdateParticle(), INFO, MPIContainer::Instance(), logger, BaseParticle::setHandler(), and WARN.
|
overridevirtual |
Adds a BaseParticle to the ParticleHandler.
[in] | P | A pointer to the BaseParticle that has to be added. |
To add a BaseParticle to the ParticleHandler, first check if it has a species, since it is as common bug to use a BaseParticle without species, which leads to a segmentation fault. To help the user with debugging, a warning is given if a particle without species is added. After that, the actions for adding the particle to the BaseHandler are taken, which include adding it to the vector of pointers to all BaseParticle and assigning the correct id and index. Then the particle is added to the HGrid, the particle is told that this is its handler, its mass is computed and finally it is checked if this is the smallest or largest particle in this ParticleHandler.
Reimplemented from BaseHandler< BaseParticle >.
Definition at line 170 of file ParticleHandler.cc.
References BaseHandler< T >::addObject(), checkExtrema(), ParticleSpecies::computeMass(), BaseHandler< BaseParticle >::getDPMBase(), BaseObject::getId(), BaseInteractable::getSpecies(), DPMBase::handleParticleAddition(), DPMBase::hGridInsertParticle(), DPMBase::hGridUpdateParticle(), BaseHandler< T >::increaseId(), DPMBase::insertGhostParticle(), BaseParticle::isMPIParticle(), BaseParticle::isPeriodicGhostParticle(), BaseParticle::isSphericalParticle(), logger, DPMBase::mpiInsertParticleCheck(), NUMBER_OF_PROCESSORS, BaseParticle::setHandler(), BaseParticle::setPeriodicComplexity(), DPMBase::setRotation(), DPMBase::updateGhostGrid(), and WARN.
Referenced by addObject(), CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), SubcriticalMaserBoundaryTEST::checkBoundaryAfterParticleMoved(), SubcriticalMaserBoundary::checkBoundaryAfterParticleMoved(), ConstantMassFlowMaserBoundary::checkBoundaryAfterParticleMoved(), SubcriticalMaserBoundaryTEST::copyExtraParticles(), CurvyChute::createBottom(), PeriodicBoundary::createGhostParticle(), TimeDependentPeriodicBoundary::createGhostParticle(), ShearBoxBoundary::createHorizontalPeriodicParticles(), LeesEdwardsBoundary::createHorizontalPeriodicParticles(), CircularPeriodicBoundary::createPeriodicParticle(), AngledPeriodicBoundary::createPeriodicParticle(), SubcriticalMaserBoundary::createPeriodicParticle(), ConstantMassFlowMaserBoundary::createPeriodicParticle(), ShearBoxBoundary::createVerticalPeriodicParticles(), LeesEdwardsBoundary::createVerticalPeriodicParticles(), and SubcriticalMaserBoundaryTEST::extendBottom().
void ParticleHandler::addObject | ( | int | fromProcessor, |
BaseParticle * | p | ||
) |
Adds a BaseParticle located at processor fromProcessor to toProcessor.
This function adds a particle to the simulation where the information of the particle is not available by the target processor.
When a certain processor generates a particle which needs to be inserted in a domain of another processor, this information needs to be transfered before the particle can be actually added
[in] | fromProcessor | processor containing the particle data |
[in,out] | particle | that contains the data and receives the data |
Definition at line 250 of file ParticleHandler.cc.
References addObject(), MPIContainer::broadcast(), copyDataFromMPIParticleToParticle(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), MPIContainer::getProcessorID(), MPIContainer::Instance(), logger, PARTICLE, and WARN.
void ParticleHandler::checkExtrema | ( | BaseParticle * | P | ) |
Checks if the extrema of this ParticleHandler needs updating.
[in] | P | A pointer to the particle, which properties have to be checked against the ParticleHandlers extrema. |
Definition at line 1156 of file ParticleHandler.cc.
References computeLargestParticle(), computeSmallestParticle(), BaseParticle::getMaxInteractionRadius(), largestParticle_, and smallestParticle_.
Referenced by addExistingObject(), addGhostObject(), addObject(), and BaseParticle::setRadius().
void ParticleHandler::checkExtremaOnDelete | ( | BaseParticle * | P | ) |
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.
[in] | P | A pointer to the particle, which is going to get deleted. |
Definition at line 1182 of file ParticleHandler.cc.
References computeLargestParticle(), computeSmallestParticle(), largestParticle_, and smallestParticle_.
Referenced by BaseParticle::~BaseParticle(), and SuperQuadricParticle::~SuperQuadricParticle().
|
overridevirtual |
Empties the whole ParticleHandler by removing all BaseParticle.
Note that the pointers to smallestParticle_ and largestParticle_ are set to nullptr since these particles don't exist anymore after calling this function.
Reimplemented from BaseHandler< BaseParticle >.
Definition at line 972 of file ParticleHandler.cc.
References BaseHandler< T >::clear(), largestParticle_, and smallestParticle_.
Referenced by CGHandler::evaluateRestartFiles(), operator=(), ParticleHandler(), FileReader::read(), DPMBase::read(), DPMBase::readNextDataFile(), and BaseCluster::setupInitialConditions().
void ParticleHandler::computeAllMasses | ( | unsigned int | indSpecies | ) |
Computes the mass for all BaseParticle of the given species in this ParticleHandler.
[in] | indSpecies | Unsigned integer with the index of the species for which the masses must be computed. |
Definition at line 1198 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::objects_.
Referenced by SpeciesHandler::addObject(), DPMBase::readNextDataFile(), ParticleSpecies::setDensity(), DPMBase::setParticleDimensions(), and DPMBase::solve().
void ParticleHandler::computeAllMasses | ( | ) |
Computes the mass for all BaseParticle in this ParticleHandler.
Definition at line 1209 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::objects_.
void ParticleHandler::computeLargestParticle | ( | ) |
Computes the largest particle (by interaction radius) and sets it in largestParticle_.
Definition at line 470 of file ParticleHandler.cc.
References DEBUG, BaseParticle::getMaxInteractionRadius(), BaseHandler< BaseParticle >::getSize(), largestParticle_, logger, and BaseHandler< BaseParticle >::objects_.
Referenced by DeletionBoundary::checkBoundaryAfterParticleMoved(), checkExtrema(), checkExtremaOnDelete(), operator=(), and ParticleHandler().
void ParticleHandler::computeSmallestParticle | ( | ) |
Computes the smallest particle (by interaction radius) and sets it in smallestParticle_.
Definition at line 446 of file ParticleHandler.cc.
References DEBUG, BaseParticle::getMaxInteractionRadius(), BaseHandler< BaseParticle >::getSize(), logger, BaseHandler< BaseParticle >::objects_, and smallestParticle_.
Referenced by DeletionBoundary::checkBoundaryAfterParticleMoved(), checkExtrema(), checkExtremaOnDelete(), operator=(), and ParticleHandler().
|
static |
Reads BaseParticle into the ParticleHandler from restart data.
[in] | is | The input stream from which the information is read. |
Definition at line 1014 of file ParticleHandler.cc.
Referenced by readAndCreateObject().
Vec3D ParticleHandler::getAngularMomentum | ( | ) | const |
Definition at line 670 of file ParticleHandler.cc.
References getMPISum().
Vec3D ParticleHandler::getCentreOfMass | ( | ) | const |
Definition at line 649 of file ParticleHandler.cc.
References getMass(), getMassTimesPosition(), and constants::NaN.
Referenced by DPMBase::getCentreOfMass().
BaseParticle * ParticleHandler::getFastestParticle | ( | ) | const |
Definition at line 705 of file ParticleHandler.cc.
References ERROR, getFastestParticleLocal(), and logger.
BaseParticle * ParticleHandler::getFastestParticleLocal | ( | ) | const |
Gets a pointer to the fastest BaseParticle in this ParticleHandler.
Definition at line 682 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::getSize(), logger, BaseHandler< BaseParticle >::objects_, and WARN.
Referenced by getFastestParticle().
BaseParticle * ParticleHandler::getHighestPositionComponentParticle | ( | int | i | ) | const |
Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler.
Definition at line 887 of file ParticleHandler.cc.
References ERROR, getHighestPositionComponentParticleLocal(), and logger.
BaseParticle * ParticleHandler::getHighestPositionComponentParticleLocal | ( | int | i | ) | const |
Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler.
[in] | i | Direction for which one wants the particle with highest coordinates. |
Definition at line 863 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::getSize(), logger, BaseHandler< BaseParticle >::objects_, and WARN.
Referenced by getHighestPositionComponentParticle().
Mdouble ParticleHandler::getHighestPositionX | ( | ) | const |
Function returns the highest position in the x-direction.
This is a prototype example of how to obtain global particle attributes in the parallel code
Definition at line 984 of file ParticleHandler.cc.
References MAX.
BaseParticle * ParticleHandler::getHighestVelocityComponentParticle | ( | int | i | ) | const |
Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler.
Definition at line 959 of file ParticleHandler.cc.
References ERROR, getHighestVelocityComponentParticleLocal(), and logger.
BaseParticle * ParticleHandler::getHighestVelocityComponentParticleLocal | ( | int | i | ) | const |
Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler.
[in] | i | Direction for which you want the particle with highest velocity. |
Definition at line 936 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::getSize(), logger, BaseHandler< BaseParticle >::objects_, and WARN.
Referenced by getHighestVelocityComponentParticle().
Mdouble ParticleHandler::getKineticEnergy | ( | ) | const |
Definition at line 552 of file ParticleHandler.cc.
References getKineticEnergyLocal(), and MPIContainer::Instance().
Referenced by DPMBase::writeEneTimeStep().
|
private |
Mdouble ParticleHandler::getLargestInteractionRadius | ( | ) | const |
Returns the largest interaction radius.
Definition at line 767 of file ParticleHandler.cc.
References getLargestInteractionRadiusLocal(), and MPIContainer::Instance().
Referenced by DPMBase::read().
Mdouble ParticleHandler::getLargestInteractionRadiusLocal | ( | ) | const |
Returns the largest interaction radius of the current domain.
Definition at line 752 of file ParticleHandler.cc.
References getLargestParticle(), getLargestParticleLocal(), and BaseParticle::getMaxInteractionRadius().
Referenced by MercuryBase::getHGridTargetMaxInteractionRadius(), and getLargestInteractionRadius().
BaseParticle * ParticleHandler::getLargestParticle | ( | ) | const |
Returns the pointer of the largest particle in the particle handler. When mercury is running in parallel this function throws an error since a pointer to another domain is useless.
Definition at line 529 of file ParticleHandler.cc.
References getLargestParticleLocal(), logger, and WARN.
Referenced by DPMBase::checkParticleForInteractionLocalPeriodic(), ShearBoxBoundary::createHorizontalPeriodicParticles(), LeesEdwardsBoundary::createHorizontalPeriodicParticles(), CircularPeriodicBoundary::createPeriodicParticle(), SubcriticalMaserBoundaryTEST::createPeriodicParticle(), AngledPeriodicBoundary::createPeriodicParticle(), SubcriticalMaserBoundary::createPeriodicParticle(), PeriodicBoundary::createPeriodicParticle(), TimeDependentPeriodicBoundary::createPeriodicParticle(), ShearBoxBoundary::createVerticalPeriodicParticles(), LeesEdwardsBoundary::createVerticalPeriodicParticles(), getLargestInteractionRadiusLocal(), MercuryBase::hGridNeedsRebuilding(), HGridOptimiser::initialise(), and BaseCluster::setupInitialConditions().
BaseParticle * ParticleHandler::getLargestParticleLocal | ( | ) | const |
Gets a pointer to the largest BaseParticle (by interactionRadius) in the ParticleHandler of the local domain.
Definition at line 521 of file ParticleHandler.cc.
References largestParticle_.
Referenced by ConstantMassFlowMaserBoundary::activateMaser(), ConstantMassFlowMaserBoundary::createPeriodicParticle(), getLargestInteractionRadiusLocal(), getLargestParticle(), and DPMBase::writeFstatHeader().
double ParticleHandler::getLiquidFilmVolume | ( | ) | const |
Definition at line 1363 of file ParticleHandler.cc.
References LiquidFilmParticle::getLiquidVolume(), getMPISum(), constants::i, and BaseHandler< BaseParticle >::objects_.
BaseParticle * ParticleHandler::getLowestPositionComponentParticle | ( | int | i | ) | const |
Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler.
Definition at line 850 of file ParticleHandler.cc.
References ERROR, getLowestPositionComponentParticleLocal(), and logger.
BaseParticle * ParticleHandler::getLowestPositionComponentParticleLocal | ( | int | i | ) | const |
Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler.
[in] | i | Direction for which you want the particle with lowest coordinates. |
Definition at line 824 of file ParticleHandler.cc.
References ERROR, BaseHandler< BaseParticle >::getSize(), logger, BaseHandler< BaseParticle >::objects_, and WARN.
Referenced by getLowestPositionComponentParticle().
BaseParticle * ParticleHandler::getLowestVelocityComponentParticle | ( | int | i | ) | const |
Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler.
Definition at line 923 of file ParticleHandler.cc.
References ERROR, getLowestVelocityComponentParticleLocal(), and logger.
BaseParticle * ParticleHandler::getLowestVelocityComponentParticleLocal | ( | int | i | ) | const |
Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler.
[in] | i | Direction for which you want the particle with lowest velocity. |
Definition at line 900 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::getSize(), logger, BaseHandler< BaseParticle >::objects_, and WARN.
Referenced by getLowestVelocityComponentParticle().
Mdouble ParticleHandler::getMass | ( | ) | const |
Definition at line 606 of file ParticleHandler.cc.
References getMassLocal(), and MPIContainer::Instance().
Referenced by FixedClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), getCentreOfMass(), DPMBase::getTotalMass(), and DPMBase::writeEneTimeStep().
|
private |
Vec3D ParticleHandler::getMassTimesPosition | ( | ) | const |
Definition at line 631 of file ParticleHandler.cc.
References getMassTimesPositionLocal(), MPIContainer::Instance(), Vec3D::X, Vec3D::Y, and Vec3D::Z.
Referenced by getCentreOfMass(), and DPMBase::writeEneTimeStep().
|
private |
Definition at line 622 of file ParticleHandler.cc.
Referenced by getMassTimesPosition().
Mdouble ParticleHandler::getMeanRadius | ( | ) | const |
Definition at line 799 of file ParticleHandler.cc.
References getNumberOfRealObjectsLocal(), BaseHandler< BaseParticle >::getSize(), getSumRadiusLocal(), and MPIContainer::Instance().
Vec3D ParticleHandler::getMomentum | ( | ) | const |
Definition at line 661 of file ParticleHandler.cc.
References getMPISum().
Referenced by DPMBase::getTotalMomentum().
|
overridevirtual |
Returns the name of the handler, namely the string "ParticleHandler".
Implements BaseHandler< BaseParticle >.
Definition at line 1230 of file ParticleHandler.cc.
unsigned int ParticleHandler::getNumberOfFixedObjects | ( | ) | const |
Computes the number of fixed particles in the whole simulation.
Definition at line 1341 of file ParticleHandler.cc.
References getNumberOfFixedObjectsLocal(), and MPIContainer::Instance().
unsigned int ParticleHandler::getNumberOfFixedObjectsLocal | ( | ) | const |
Computes the number of Fixed particles on a local domain.
Loops over all particles to check if the particle is fixed or not, in a local domain.
Definition at line 1325 of file ParticleHandler.cc.
References BaseParticle::isFixed().
Referenced by getNumberOfFixedObjects().
unsigned int ParticleHandler::getNumberOfFixedParticles | ( | ) | const |
Gets the number of particles that are fixed.
Definition at line 998 of file ParticleHandler.cc.
References NFixedParticles_.
|
overridevirtual |
Returns the number of objects in the container. In parallel code this practice is forbidden to avoid confusion with real and fake particles. If the size of the container is wished, call size()
Reimplemented from BaseHandler< BaseParticle >.
Definition at line 1308 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::getSize().
Referenced by Chute::addFlowParticlesCompactly(), DPMBase::checkParticleForInteractionLocalPeriodic(), Chute::cleanChute(), getNumberOfUnfixedParticles(), Chute::printTime(), MeshTriangle::setHandler(), and ChuteBottom::setupInitialConditions().
unsigned int ParticleHandler::getNumberOfRealObjects | ( | ) | const |
Returns the number of real objects (on all processors)
Definition at line 1287 of file ParticleHandler.cc.
References MPIContainer::broadcast(), getNumberOfRealObjectsLocal(), BaseHandler< BaseParticle >::getSize(), and MPIContainer::Instance().
Referenced by Membrane::createVertexParticles(), and DPMBase::decompose().
unsigned int ParticleHandler::getNumberOfRealObjectsLocal | ( | ) | const |
Returns the number of real objects on a local domain. MPI particles and periodic particles are neglected.
Definition at line 1266 of file ParticleHandler.cc.
References DPMBase::domainHandler, DomainHandler::getCurrentDomain(), BaseHandler< BaseParticle >::getDPMBase(), PeriodicBoundaryHandler::getNumberOfPeriodicGhostParticles(), MPIContainer::getNumberOfProcessors(), Domain::getNumberOfTrueMPIParticles(), BaseHandler< BaseParticle >::getSize(), MPIContainer::Instance(), logger, and DPMBase::periodicBoundaryHandler.
Referenced by getMeanRadius(), getNumberOfRealObjects(), DPMBase::outputXBallsData(), and write().
unsigned int ParticleHandler::getNumberOfUnfixedParticles | ( | ) | const |
Gets the number of particles that are not fixed.
Definition at line 1006 of file ParticleHandler.cc.
References getNumberOfObjects(), and NFixedParticles_.
|
inline |
Computes an attribute type (min/max/..) of a particle attribute(position/velocity) in the global domain.
Many functions the particleHandler return a pointer to a BaseParticle, i.e. the fastest particle, however in parallel this is not usefull as pointers can't be send across processes. This function gives the flexibility to find a global particle extremum such as the fastest particle Velocity or lowest particle position.
[in] | attribute | A function that obtains a scalar from a particle. i.e. position or radius |
[in] | type | An AttribyteType tells this function what to do with the attribute, take the maximum or the minimum |
Definition at line 305 of file ParticleHandler.h.
References ERROR, getParticleAttributeLocal(), MPIContainer::Instance(), logger, MAX, and MIN.
|
inline |
Computes an attribute type (min/max/..) of a particle attribute (position/velocity) in a local domain.
Computes an attribute type (min/max/..) of a particle attribute (position/velocity) in a local domain
Many functions the particleHandler return a pointer to a BaseParticle, i.e. the fastest particle, however in parallel this is not usefull as pointers can't be send across processes. This function gives the flexibility to find a global particle extremum such as the fastest particle Velocity or lowest particle position.
[in] | attribute | A function that obtains a scalar from a particle. i.e. position or radius |
[in] | type | An AttribyteType tells this function what to do with the attribute, take the maximum or the minimum |
Definition at line 244 of file ParticleHandler.h.
References ERROR, logger, MAX, MIN, BaseHandler< BaseParticle >::objects_, and WARN.
Referenced by getParticleAttribute().
Mdouble ParticleHandler::getRotationalEnergy | ( | ) | const |
Definition at line 581 of file ParticleHandler.cc.
References getRotationalEnergyLocal(), and MPIContainer::Instance().
Referenced by DPMBase::writeEneTimeStep().
|
private |
Mdouble ParticleHandler::getSmallestInteractionRadius | ( | ) | const |
Returns the smallest interaction radius.
Definition at line 731 of file ParticleHandler.cc.
References getSmallestInteractionRadiusLocal(), and MPIContainer::Instance().
Mdouble ParticleHandler::getSmallestInteractionRadiusLocal | ( | ) | const |
Returns the smallest interaction radius of the current domain.
Definition at line 716 of file ParticleHandler.cc.
References BaseParticle::getMaxInteractionRadius(), and getSmallestParticleLocal().
Referenced by MercuryBase::getHGridTargetMinInteractionRadius(), and getSmallestInteractionRadius().
BaseParticle * ParticleHandler::getSmallestParticle | ( | ) | const |
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler of the local domain. When mercury is running in parallel this function throws an error since a pointer to another domain is useless.
Definition at line 506 of file ParticleHandler.cc.
References getSmallestParticleLocal(), logger, and WARN.
Referenced by HGridOptimiser::initialise().
BaseParticle * ParticleHandler::getSmallestParticleLocal | ( | ) | const |
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler of the local domain.
Definition at line 497 of file ParticleHandler.cc.
References smallestParticle_.
Referenced by getSmallestInteractionRadiusLocal(), getSmallestParticle(), and DPMBase::writeFstatHeader().
|
private |
Definition at line 786 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::objects_.
Referenced by getMeanRadius().
Mdouble ParticleHandler::getVolume | ( | ) | const |
Definition at line 1246 of file ParticleHandler.cc.
References getVolumeLocal(), and MPIContainer::Instance().
Referenced by FixedClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), and RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep().
|
private |
ParticleHandler & ParticleHandler::operator= | ( | const ParticleHandler & | rhs | ) |
Assignment operator.
[in] | rhs | The ParticleHandler on the right hand side of the assignment. |
This is not a copy assignment operator! It copies the DPMBase and all BaseParticle, and sets the other variables to 0. After that, it computes the smallest and largest particle in this handler.
Definition at line 84 of file ParticleHandler.cc.
References clear(), computeLargestParticle(), computeSmallestParticle(), BaseHandler< BaseParticle >::copyContentsFromOtherHandler(), DEBUG, largestParticle_, logger, BaseHandler< BaseParticle >::objects_, and smallestParticle_.
|
overridevirtual |
Create a new particle, based on the information from old-style restart data.
Create a new particle in the WallHandler, based on the information provided in a restart file.
[in] | is | The input stream from which the information is read. |
Implements BaseHandler< BaseParticle >.
Definition at line 1077 of file ParticleHandler.cc.
References addExistingObject(), and readAndCreateObject().
Referenced by DPMBase::read().
BaseParticle * ParticleHandler::readAndCreateObject | ( | std::istream & | is | ) |
Create a new particle, based on the information provided in a restart file.
[in] | is | The input stream from which the information is read. |
Definition at line 1050 of file ParticleHandler.cc.
References createObject(), DEBUG, BaseHandler< BaseParticle >::getDPMBase(), BaseInteractable::getIndSpecies(), BaseHandler< BaseParticle >::getStorageCapacity(), logger, BaseParticle::read(), BaseParticle::setHandler(), and BaseParticle::setSpecies().
Referenced by InsertionBoundary::read(), and readAndAddObject().
void ParticleHandler::removedFixedParticle | ( | ) |
Decrement of the number of fixed particles.
Definition at line 1222 of file ParticleHandler.cc.
References NFixedParticles_.
Referenced by BaseParticle::unfix(), and BaseParticle::~BaseParticle().
void ParticleHandler::removeGhostObject | ( | unsigned int | index | ) |
Removes a BaseParticle from the ParticleHandler without a global check, this is only to be done for mpi routines.
[in] | index | The index of which BaseParticle has to be removed from this ParticleHandler. |
The BaseParticle with index is removed and the last BaseParticle in the vector is moved to its position. It also removes the BaseParticle from the HGrid. This function is only called by the parallel routines where we are sure the particles have been flushed out of the communication boundaries.
Definition at line 418 of file ParticleHandler.cc.
References ERROR, BaseHandler< BaseParticle >::getDPMBase(), BaseHandler< BaseParticle >::getObject(), DPMBase::handleParticleRemoval(), DPMBase::hGridRemoveParticle(), logger, and BaseHandler< T >::removeObject().
Referenced by DeletionBoundary::checkBoundaryAfterParticleMoved(), DPMBase::checkInteractionWithBoundaries(), and DPMBase::deleteGhostParticles().
void ParticleHandler::removeLastObject | ( | ) |
Removes the last BaseParticle from the ParticleHandler.
Function that removes the last object from this ParticleHandler. It also removes the particle from the HGrid.
Definition at line 437 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::getDPMBase(), BaseHandler< BaseParticle >::getLastObject(), DPMBase::hGridRemoveParticle(), and BaseHandler< T >::removeLastObject().
|
override |
Removes a BaseParticle from the ParticleHandler.
[in] | index | The index of which BaseParticle has to be removed from this ParticleHandler. |
The BaseParticle with index is removed and the last BaseParticle in the vector is moved to its position. It also removes the BaseParticle from the HGrid. When running this in parallel a warning is thrown that deleting particles might cause havoc in the communication between boundaries, as the deleted particle might still be in one of the boundary lists
Definition at line 390 of file ParticleHandler.cc.
References BaseHandler< BaseParticle >::getDPMBase(), MPIContainer::getNumberOfProcessors(), BaseHandler< BaseParticle >::getObject(), DPMBase::handleParticleRemoval(), DPMBase::hGridRemoveParticle(), MPIContainer::Instance(), logger, BaseHandler< T >::removeObject(), and WARN.
Referenced by CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), DeletionBoundary::checkBoundaryAfterParticleMoved(), ConstantMassFlowMaserBoundary::checkBoundaryAfterParticleMoved(), Chute::cleanChute(), CurvyChute::recreateBottom(), and DPMBase::removeDuplicatePeriodicParticles().
void ParticleHandler::write | ( | std::ostream & | os | ) | const |
[in] | type | The first value of the position. |
[in] | is | The input stream from which the information is read. |
The old objects did not have their type in the beginning of the line. Instead, the first string of the file was the position in x-direction. Since we already read the first string of the file, we need to give it to this function and convert it to the position in x-direction. The rest of the stream is then read in the usual way.
Definition at line 1131 of file ParticleHandler.cc.
References getNumberOfRealObjectsLocal(), BaseHandler< BaseParticle >::getSize(), BaseParticle::isMPIParticle(), and BaseParticle::isPeriodicGhostParticle().
Referenced by DPMBase::write().
|
private |
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
Definition at line 465 of file ParticleHandler.h.
Referenced by checkExtrema(), checkExtremaOnDelete(), clear(), computeLargestParticle(), getLargestParticleLocal(), operator=(), ParticleHandler(), and ~ParticleHandler().
|
private |
Number of fixed particles.
Definition at line 475 of file ParticleHandler.h.
Referenced by addedFixedParticle(), getNumberOfFixedParticles(), getNumberOfUnfixedParticles(), and removedFixedParticle().
|
private |
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
Definition at line 470 of file ParticleHandler.h.
Referenced by checkExtrema(), checkExtremaOnDelete(), clear(), computeSmallestParticle(), getSmallestParticleLocal(), operator=(), ParticleHandler(), and ~ParticleHandler().