5 #ifndef PARTICLE_HANDLER_H
6 #define PARTICLE_HANDLER_H
229 if ((*this).getSize() == 0)
231 logger(
WARN,
"ParticleHandler is empty: returning 0.0");
238 attributeParticle = attribute(
objects_[0]);
239 attributeFinal = attributeParticle;
245 if (!(particle->isMPIParticle() || particle->isPeriodicGhostParticle() || particle->isFixed()))
247 attributeParticle = attribute(particle);
254 if (attributeParticle < attributeFinal)
256 attributeFinal = attributeParticle;
260 if (attributeParticle > attributeFinal)
262 attributeFinal = attributeParticle;
270 return attributeFinal;
287 #ifdef MERCURYDPM_USE_MPI
289 T particleAttributeGlobal;
296 communicator.allReduce(particleAttributeLocal,particleAttributeGlobal,MPI_MIN);
299 communicator.allReduce(particleAttributeLocal,particleAttributeGlobal,MPI_MAX);
305 return particleAttributeGlobal;
319 void clear()
override;
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Eigen::Triplet< double > T
Definition: EigenUnitTest.cpp:11
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
AttributeType
Definition: ParticleHandler.h:17
@ MIN
Definition: ParticleHandler.h:18
@ MAX
Definition: ParticleHandler.h:18
float * p
Definition: Tutorial_Map_using.cpp:9
Container to store the pointers to all objects that one creates in a simulation.
Definition: BaseHandler.h:30
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:283
Definition: BaseParticle.h:33
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:29
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
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD)
Definition: PSD.h:47
Container to store pointers to all particles.
Definition: ParticleHandler.h:28
BaseParticle * getSmallestParticleLocal() const
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler of the loc...
Definition: ParticleHandler.cc:496
BaseParticle * getHighestPositionComponentParticle(int i) const
Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:886
~ParticleHandler() override
Destructor, it destructs the ParticleHandler and all BaseParticle it contains.
Definition: ParticleHandler.cc:86
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 doma...
Definition: ParticleHandler.h:285
Mdouble getLargestInteractionRadiusLocal() const
Returns the largest interaction radius of the current domain.
Definition: ParticleHandler.cc:751
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...
Definition: ParticleHandler.h:224
BaseParticle * getFastestParticle() const
Definition: ParticleHandler.cc:704
Mdouble getRotationalEnergy() const
Definition: ParticleHandler.cc:580
void clear() override
Empties the whole ParticleHandler by removing all BaseParticle.
Definition: ParticleHandler.cc:971
void removeGhostObject(unsigned int index)
Removes a BaseParticle from the ParticleHandler without a global check, this is only to be done for m...
Definition: ParticleHandler.cc:416
BaseParticle * getFastestParticleLocal() const
Gets a pointer to the fastest BaseParticle in this ParticleHandler.
Definition: ParticleHandler.cc:681
Vec3D getMomentum() const
Definition: ParticleHandler.cc:660
double getLiquidFilmVolume() const
Definition: ParticleHandler.cc:1386
BaseParticle * getHighestVelocityComponentParticle(int i) const
Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:958
void readAndAddObject(std::istream &is) override
Definition: ParticleHandler.cc:1092
Mdouble getHighestPositionX() const
Function returns the highest position in the x-direction.
Definition: ParticleHandler.cc:989
static BaseParticle * createObject(const std::string &type)
Reads BaseParticle into the ParticleHandler from restart data.
Definition: ParticleHandler.cc:1019
Mdouble getKineticEnergyLocal() const
Definition: ParticleHandler.cc:538
void computeSmallestParticle()
Computes the smallest particle (by interaction radius) and sets it in smallestParticle_.
Definition: ParticleHandler.cc:445
Mdouble getSmallestInteractionRadiusLocal() const
Returns the smallest interaction radius of the current domain.
Definition: ParticleHandler.cc:715
std::string getName() const override
Returns the name of the handler, namely the string "ParticleHandler".
Definition: ParticleHandler.cc:1245
Vec3D getMassTimesPositionLocal() const
Definition: ParticleHandler.cc:621
Vec3D getMassTimesPosition() const
Definition: ParticleHandler.cc:630
Mdouble getMassLocal() const
Definition: ParticleHandler.cc:596
Vec3D getCentreOfMass() const
Definition: ParticleHandler.cc:648
BaseParticle * getLowestVelocityComponentParticleLocal(int i) const
Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:899
Vec3D getAngularMomentum() const
Definition: ParticleHandler.cc:669
unsigned int getNumberOfRealObjectsLocal() const
Returns the number of real objects on a local domain. MPI particles and periodic particles are neglec...
Definition: ParticleHandler.cc:1281
BaseParticle * getLowestPositionComponentParticleLocal(int i) const
Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:823
void actionsAfterTimeStep()
Definition: ParticleHandler.cc:1378
BaseParticle * getLowestVelocityComponentParticle(int i) const
Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:922
void addExistingObject(BaseParticle *P) override
Adds a BaseParticle to the ParticleHandler.
Definition: ParticleHandler.cc:110
void addObject(BaseParticle *P) override
Adds a BaseParticle to the ParticleHandler.
Definition: ParticleHandler.cc:150
ParticleHandler & operator=(const ParticleHandler &rhs)
Assignment operator.
Definition: ParticleHandler.cc:64
Mdouble getLargestInteractionRadius() const
Returns the largest interaction radius.
Definition: ParticleHandler.cc:766
Mdouble getSmallestInteractionRadius() const
Returns the smallest interaction radius.
Definition: ParticleHandler.cc:730
unsigned int getNumberOfFixedObjects() const
Computes the number of fixed particles in the whole simulation.
Definition: ParticleHandler.cc:1356
void write(std::ostream &os) const
BaseParticle * readAndCreateObject(std::istream &is)
Create a new particle, based on the information provided in a restart file.
Definition: ParticleHandler.cc:1063
unsigned int getNumberOfRealObjects() const
Returns the number of real objects (on all processors)
Definition: ParticleHandler.cc:1302
void actionsBeforeTimeStep()
Definition: ParticleHandler.cc:1370
Mdouble getVolume() const
Definition: ParticleHandler.cc:1261
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
Definition: ParticleHandler.h:461
void checkExtrema(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating.
Definition: ParticleHandler.cc:1171
void removeObject(unsigned int index) override
Removes a BaseParticle from the ParticleHandler.
Definition: ParticleHandler.cc:388
unsigned int NFixedParticles_
Number of fixed particles.
Definition: ParticleHandler.h:466
BaseParticle * getLargestParticleLocal() const
Gets a pointer to the largest BaseParticle (by interactionRadius) in the ParticleHandler of the local...
Definition: ParticleHandler.cc:520
unsigned int getNumberOfObjects() const override
Returns the number of objects in the container. In parallel code this practice is forbidden to avoid ...
Definition: ParticleHandler.cc:1323
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
Definition: ParticleHandler.h:456
unsigned int getNumberOfFixedObjectsLocal() const
Computes the number of Fixed particles on a local domain.
Definition: ParticleHandler.cc:1340
BaseParticle * getHighestPositionComponentParticleLocal(int i) const
Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:862
Mdouble getVolumeLocal() const
Definition: ParticleHandler.cc:1250
void checkExtremaOnDelete(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.
Definition: ParticleHandler.cc:1197
Mdouble getKineticEnergy() const
Definition: ParticleHandler.cc:551
void addGhostObject(int fromProcessor, int toProcessor, BaseParticle *p)
Adds a ghost particle located at fromProcessor to toProcessor.
Definition: ParticleHandler.cc:275
Mdouble getSumRadiusLocal() const
Definition: ParticleHandler.cc:785
BaseParticle * getLowestPositionComponentParticle(int i) const
Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:849
void removeLastObject()
Removes the last BaseParticle from the ParticleHandler.
Definition: ParticleHandler.cc:435
BaseParticle * getHighestVelocityComponentParticleLocal(int i) const
Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:935
Mdouble getRotationalEnergyLocal() const
Definition: ParticleHandler.cc:567
unsigned int getNumberOfFixedParticles() const
Gets the number of particles that are fixed.
Definition: ParticleHandler.cc:1003
void computeAllMasses()
Computes the mass for all BaseParticle in this ParticleHandler.
Definition: ParticleHandler.cc:1224
BaseParticle * getLargestParticle() const
Returns the pointer of the largest particle in the particle handler. When mercury is running in paral...
Definition: ParticleHandler.cc:528
BaseParticle * getSmallestParticle() const
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler of the loc...
Definition: ParticleHandler.cc:505
PSD getPSD(std::vector< Mdouble > bins={}, Mdouble scaleFactor=1.0) const
Gets the PSD from the particles currently in the handler.
Definition: ParticleHandler.cc:1427
ParticleHandler()
Default constructor, it creates an empty ParticleHandler.
Definition: ParticleHandler.cc:29
unsigned int getNumberOfUnfixedParticles() const
Gets the number of particles that are not fixed.
Definition: ParticleHandler.cc:1011
void addedFixedParticle()
Increment of the number of fixed particles.
Definition: ParticleHandler.cc:1232
void computeLargestParticle()
Computes the largest particle (by interaction radius) and sets it in largestParticle_.
Definition: ParticleHandler.cc:469
void removedFixedParticle()
Decrement of the number of fixed particles.
Definition: ParticleHandler.cc:1237
Mdouble getMeanRadius() const
Definition: ParticleHandler.cc:798
Mdouble getMass() const
Definition: ParticleHandler.cc:605
void saveNumberPSDtoCSV(std::string csvFileName, std::vector< double > diameterBins={}) const
Writes the PSD of the particles currently in the handler to a CSV file, with type PROBABILITYDENSITY_...
Definition: ParticleHandler.cc:1400
Container to store all ParticleSpecies.
Definition: SpeciesHandler.h:15
Definition: Kernel/Math/Vector.h:30
squared absolute value
Definition: GlobalFunctions.h:87
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
default
Definition: calibrate.py:45
type
Definition: compute_granudrum_aor.py:141
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286