revision: v0.14
ParticleHandler.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 
27 #ifndef PARTICLE_HANDLER_H
28 #define PARTICLE_HANDLER_H
29 
30 #include "BaseHandler.h"
31 #include "Particles/BaseParticle.h"
32 
33 class SpeciesHandler;
34 
35 class BaseSpecies;
36 
38 {
39  MIN = 0, MAX = 1
40 };
41 
47 class ParticleHandler : public BaseHandler<BaseParticle>
48 {
49 public:
54 
59 
64 
68  ~ParticleHandler() override;
69 
73  void addExistingObject(BaseParticle* P) override;
74 
78  void addObject(BaseParticle* P) override;
79 
83  void addObject(int fromProcessor, BaseParticle* P);
84 
88  void addGhostObject(int fromPrcessor, int toProcessor, BaseParticle* p);
89 
93  void addGhostObject(BaseParticle* P) override;
94 
98  void removeObject(unsigned int index) override;
99 
104  void removeGhostObject(unsigned int index);
105 
109  void removeLastObject();
110 
115 
119  void computeLargestParticle();
120 
125 
131 
136 
142 
147 
152 
157 
162 
167 
169 
170  Mdouble getKineticEnergy() const;
171 
173 
174  Mdouble getMass() const;
175 
176  Vec3D getMassTimesPosition() const;
177 
178  Vec3D getCentreOfMass() const;
179 
180  Vec3D getMomentum() const;
181 
182  Vec3D getAngularMomentum() const;
183 
184  Mdouble getVolume() const;
185 
186  Mdouble getMeanRadius() const;
187 
192 
197 
202 
207 
212 
217 
222 
227 
231  //Mdouble getParticleAttributeLocal(std::function<Mdouble (BaseParticle*)> attribute, AttributeType type) const;
232 
242  template<typename T>
243  typename std::enable_if<std::is_scalar<T>::value, T>::type
244  getParticleAttributeLocal(std::function<T(BaseParticle*)> attribute, AttributeType type) const
245  {
246  T attributeParticle;
247  T attributeFinal;
248 
249  if ((*this).getSize() == 0)
250  {
251  logger(WARN, "ParticleHandler is empty: returning 0.0");
252  attributeFinal = 0;
253  return 0.0;
254  }
255  else
256  {
257  //Initialise with the first particle found
258  attributeParticle = attribute(objects_[0]);
259  attributeFinal = attributeParticle;
260 
261  //Findn the final attribute
262  for (BaseParticle* particle : (*this))
263  {
264  //Obtain the attribute
265  if (!(particle->isMPIParticle() || particle->isPeriodicGhostParticle() || particle->isFixed()))
266  {
267  attributeParticle = attribute(particle);
268  }
269 
270  //Decide what to do with the magnitude of the attribute
271  switch (type)
272  {
273  case AttributeType::MIN :
274  if (attributeParticle < attributeFinal)
275  {
276  attributeFinal = attributeParticle;
277  }
278  break;
279  case AttributeType::MAX :
280  if (attributeParticle > attributeFinal)
281  {
282  attributeFinal = attributeParticle;
283  }
284  break;
285  default :
286  logger(ERROR, "Attribute type is not recognised");
287  break;
288  }
289  }
290  return attributeFinal;
291  }
292  }
293 
303  template<typename T>
304  typename std::enable_if<std::is_scalar<T>::value, T>::type
305  getParticleAttribute(std::function<T(BaseParticle*)> attribute, AttributeType type) const
306  {
307 #ifdef MERCURY_USE_MPI
308  T particleAttributeLocal = getParticleAttributeLocal(attribute, type);
309  T particleAttributeGlobal;
310 
311  //Communicate local to global using the approriate rule
312  MPIContainer& communicator = MPIContainer::Instance();
313  switch(type)
314  {
315  case AttributeType::MIN :
316  communicator.allReduce(particleAttributeLocal,particleAttributeGlobal,MPI_MIN);
317  break;
318  case AttributeType::MAX :
319  communicator.allReduce(particleAttributeLocal,particleAttributeGlobal,MPI_MAX);
320  break;
321  default :
322  logger(ERROR,"Attribute type is not recognised");
323  break;
324  }
325  return particleAttributeGlobal;
326 #else
327  return getParticleAttributeLocal(attribute, type);
328 #endif
329  }
330 
335 
339  void clear() override;
340 
345  unsigned int getNumberOfFixedParticles() const;
346 
350  unsigned int getNumberOfUnfixedParticles() const;
351 
355  static BaseParticle* createObject(const std::string& type);
356 
360  BaseParticle* readAndCreateObject(std::istream& is);
361 
362 // /*!
363 // * \brief Create a new particle, based on the information from old-style restart data.
364 // */
365 // void readAndCreateOldObject(std::istream &is, const std::string& type);
366 
370  void readAndAddObject(std::istream& is) override;
371 
372  void write(std::ostream& os) const;
373 
377  void checkExtrema(BaseParticle* P);
378 
383 
387  void computeAllMasses(unsigned int indSpecies);
388 
392  void computeAllMasses();
393 
398  void addedFixedParticle();
399 
404  void removedFixedParticle();
405 
409  std::string getName() const override;
410 
414  unsigned int getNumberOfRealObjects() const;
415 
420  unsigned int getNumberOfObjects() const override;
421 
425  unsigned int getNumberOfFixedObjectsLocal() const;
426 
430  unsigned int getNumberOfFixedObjects() const;
431 
435  unsigned int getNumberOfRealObjectsLocal() const;
436 
437  void actionsAfterTimeStep();
438 
439  double getLiquidFilmVolume() const;
440 
441 private:
442 
443 
445 
447 
448  Mdouble getMassLocal() const;
449 
450  Mdouble getVolumeLocal() const;
451 
453 
454  Mdouble getSumRadiusLocal() const;
455 
466 
471 
475  unsigned int NFixedParticles_;
476 };
477 
478 #endif
479 
BaseHandler< BaseParticle >::setDPMBase
void setDPMBase(DPMBase *DPMBase)
Sets the problem that is solved using this handler.
Definition: BaseHandler.h:718
DPMBase::setMax
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1073
ParticleHandler::getNumberOfRealObjects
unsigned int getNumberOfRealObjects() const
Returns the number of real objects (on all processors)
Definition: ParticleHandler.cc:1294
BaseHandler< BaseParticle >::getStorageCapacity
unsigned int getStorageCapacity() const
Gets the storage capacity of this BaseHandler.
Definition: BaseHandler.h:662
BaseParticle::getInteractionWith
BaseInteraction * getInteractionWith(BaseParticle *P, unsigned timeStamp, InteractionHandler *interactionHandler) override
Checks if particle is in interaction with given particle P, and if so, returns vector of pointer to t...
Definition: BaseParticle.cc:678
ParticleHandler::checkExtrema
void checkExtrema(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating.
Definition: ParticleHandler.cc:1163
DPMBase::setName
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:420
BaseHandler::increaseId
void increaseId()
Definition: BaseHandler.h:251
BaseInteractable::getSpecies
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Definition: BaseInteractable.h:108
ParticleHandler::getLargestInteractionRadiusLocal
Mdouble getLargestInteractionRadiusLocal() const
Returns the largest interaction radius of the current domain.
Definition: ParticleHandler.cc:753
ParticleHandler::createObject
static BaseParticle * createObject(const std::string &type)
Reads BaseParticle into the ParticleHandler from restart data.
Definition: ParticleHandler.cc:1021
BaseParticle::setHandler
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
Definition: BaseParticle.cc:651
DPMBase::setTimeStep
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
DPMBase::setMin
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1109
ParticleHandler::getLargestInteractionRadius
Mdouble getLargestInteractionRadius() const
Returns the largest interaction radius.
Definition: ParticleHandler.cc:768
DPMBase::getTimeStep
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1241
ParticleHandler::largestParticle_
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
Definition: ParticleHandler.h:465
ParticleCreation::sizeDistribution_
Mdouble sizeDistribution_
Definition: ParticleCreationSelfTest.cpp:149
PARTICLE_DATA
@ PARTICLE_DATA
Definition: MpiContainer.h:79
constants::pi
const Mdouble pi
Definition: ExtendedMath.h:45
PeriodicBoundary.h
MIN
@ MIN
Definition: ParticleHandler.h:39
DomainHandler.h
ParticleHandler::getMomentum
Vec3D getMomentum() const
Definition: ParticleHandler.cc:662
ParticleHandler::ParticleHandler
ParticleHandler()
Default constructor, it creates an empty ParticleHandler.
Definition: ParticleHandler.cc:49
Flusher::FLUSH
@ FLUSH
BaseHandler
Container to store the pointers to all objects that one creates in a simulation.
Definition: BaseHandler.h:51
ParticleHandler::actionsAfterTimeStep
void actionsAfterTimeStep()
Definition: ParticleHandler.cc:1362
ParticleHandler::~ParticleHandler
~ParticleHandler() override
Destructor, it destructs the ParticleHandler and all BaseParticle it contains.
Definition: ParticleHandler.cc:106
ParticleHandler::getSmallestInteractionRadius
Mdouble getSmallestInteractionRadius() const
Returns the smallest interaction radius.
Definition: ParticleHandler.cc:732
ParticleHandler::getVolumeLocal
Mdouble getVolumeLocal() const
Definition: ParticleHandler.cc:1242
LinearViscoelasticReversibleAdhesiveSpecies.h
ParticleHandler::getRotationalEnergy
Mdouble getRotationalEnergy() const
Definition: ParticleHandler.cc:582
FileReader::FileReader
FileReader(std::string name)
Default constuction, requires to users to prove the name of the file that will be opened.
Definition: ParticleAnalytics2Mercury.cpp:46
DPMBase::hGridUpdateParticle
virtual void hGridUpdateParticle(BaseParticle *obj UNUSED)
Definition: DPMBase.cc:1695
DPMBase::getXMax
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:607
BaseInteractable::setPosition
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
BaseHandler::addGhostObject
virtual void addGhostObject(T *O)
Adds a new Object to the BaseHandler. called by the to avoid increasing the id.
Definition: BaseHandler.h:444
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
LiquidFilmParticle.h
DPMBase::hGridRemoveParticle
virtual void hGridRemoveParticle(BaseParticle *obj UNUSED)
Definition: DPMBase.cc:1702
DPMBase::random
RNG random
This is a random generator, often used for setting up the initial conditions etc.....
Definition: DPMBase.h:1390
ParticleHandler::getNumberOfObjects
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:1315
Vec3D::X
Mdouble X
the vector components
Definition: Vector.h:65
MAX_PROC
#define MAX_PROC
Definition: GeneralDefine.h:51
ParticleHandler::getMassTimesPosition
Vec3D getMassTimesPosition() const
Definition: ParticleHandler.cc:632
ParticleHandler::getVolume
Mdouble getVolume() const
Definition: ParticleHandler.cc:1253
BaseHandler::getObjectById
T * getObjectById(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:565
DPMBase::periodicBoundaryHandler
PeriodicBoundaryHandler periodicBoundaryHandler
Internal handler that deals with periodic boundaries, especially in a parallel build.
Definition: DPMBase.h:1415
ParticleCreation::setupInitialConditions
void setupInitialConditions() override
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: ParticleCreationSelfTest.cpp:87
ParticleHandler::getHighestPositionX
Mdouble getHighestPositionX() const
Function returns the highest position in the x-direction.
Definition: ParticleHandler.cc:991
SpeciesHandler.h
main
int main(int argc, char **argv)
Definition: ParticleAnalytics2Mercury.cpp:250
MercuryBase::checkParticleForInteraction
bool checkParticleForInteraction(const BaseParticle &P) final
Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle.
Definition: MercuryBase.cc:594
DPMBase::setYMax
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1182
ParticleHandler::getKineticEnergyLocal
Mdouble getKineticEnergyLocal() const
Definition: ParticleHandler.cc:540
copyDataFromMPIParticleToParticle
void copyDataFromMPIParticleToParticle(MPIParticle *bP, BaseParticle *p, ParticleHandler *particleHandler)
Copies data from an MPIParticle class to a BaseParticle and sets the particleHandler and species.
Definition: MpiDataClass.cc:105
PeriodicBoundaryHandler::getNumberOfPeriodicGhostParticles
unsigned int getNumberOfPeriodicGhostParticles()
Returns the number of particles that are flagged is periodicGhostParticle.
Definition: PeriodicBoundaryHandler.cc:357
ParticleHandler::getLowestPositionComponentParticle
BaseParticle * getLowestPositionComponentParticle(int i) const
Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:851
BaseHandler< BaseParticle >::getSize
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
MPISphericalParticle::copyDataFromParticleToMPIParticle
void copyDataFromParticleToMPIParticle(BaseParticle *p)
Definition: MpiDataClass.cc:131
MPIContainer::receive
std::enable_if< std::is_scalar< T >::value, void >::type receive(T &t, int from, int tag)
asynchronously receive a scalar from some other processor.
Definition: MpiContainer.h:221
BaseHandler::removeLastObject
void removeLastObject()
Removes the last Object from the BaseHandler.
Definition: BaseHandler.h:511
Mercury3D
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:37
ParticleHandler.h
ParticleHandler::getLiquidFilmVolume
double getLiquidFilmVolume() const
Definition: ParticleHandler.cc:1370
FileReader::dpm
Mercury3D dpm
Definition: ParticleAnalytics2Mercury.cpp:247
ParticleHandler::getHighestVelocityComponentParticle
BaseParticle * getHighestVelocityComponentParticle(int i) const
Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:960
ParticleHandler::getParticleAttribute
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:305
PARTICLE
@ PARTICLE
Definition: MpiContainer.h:67
MPIContainer::getProcessorID
std::size_t getProcessorID()
Reduces a scalar on all processors to one scalar on a target processor.
Definition: MpiContainer.cc:113
DPMBase::handleParticleRemoval
virtual void handleParticleRemoval(unsigned int id)
Handles the removal of particles from the particleHandler.
Definition: DPMBase.cc:5298
BaseInteractable::getIndSpecies
unsigned int getIndSpecies() const
Returns the index of the species associated with the interactable object.
Definition: BaseInteractable.h:88
INFO
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
MpiContainer.h
BaseHandler::setStorageCapacity
void setStorageCapacity(const unsigned int N)
Sets the storage capacity of this BaseHandler.
Definition: BaseHandler.h:669
ParticleHandler::removeGhostObject
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:418
BaseInteraction::setForce
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce)
Definition: BaseInteraction.cc:579
ParticleHandler::getLowestVelocityComponentParticleLocal
BaseParticle * getLowestVelocityComponentParticleLocal(int i) const
Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:901
BaseParticle::setRadius
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:542
Vec3D
Definition: Vector.h:50
DPMBase::solve
void solve()
The work horse of the code.
Definition: DPMBase.cc:4003
BaseInteraction::setDistance
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
Definition: BaseInteraction.cc:219
ParticleHandler::getLowestPositionComponentParticleLocal
BaseParticle * getLowestPositionComponentParticleLocal(int i) const
Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:825
FileReader::wFile_
std::ifstream wFile_
Definition: ParticleAnalytics2Mercury.cpp:243
ParticleHandler::getParticleAttributeLocal
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:244
DPMBase::handleParticleAddition
virtual void handleParticleAddition(unsigned int id, BaseParticle *p)
Definition: DPMBase.cc:5313
FileReader
This gives functionality to read information from binary formats like STL etc. This class is complete...
Definition: ParticleAnalytics2Mercury.cpp:40
BaseInteraction
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
DPMBase::getYMin
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin.
Definition: DPMBase.h:613
Helpers.h
DPMBase::setZMax
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1208
ParticleHandler::getMassTimesPositionLocal
Vec3D getMassTimesPositionLocal() const
Definition: ParticleHandler.cc:623
BaseHandler::addExistingObject
virtual void addExistingObject(T *O)
Adds an existing object to the BaseHandler without changing the id of the object.
Definition: BaseHandler.h:417
Mdouble
double Mdouble
Definition: GeneralDefine.h:34
BaseSpecies
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:50
ParticleHandler::getHighestVelocityComponentParticleLocal
BaseParticle * getHighestVelocityComponentParticleLocal(int i) const
Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:937
ParticleHandler::getAngularMomentum
Vec3D getAngularMomentum() const
Definition: ParticleHandler.cc:671
FileReader::Version::P3
@ P3
FileReader::Version::P4
@ P4
NUMBER_OF_PROCESSORS
#define NUMBER_OF_PROCESSORS
For the MPI communication routines this quantity is often required. defining this macro makes the cod...
Definition: GeneralDefine.h:62
ParticleHandler::addedFixedParticle
void addedFixedParticle()
Increment of the number of fixed particles.
Definition: ParticleHandler.cc:1224
BaseParticle::getRadius
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:348
SuperQuadricParticle.h
ParticleHandler::getLargestParticle
BaseParticle * getLargestParticle() const
Returns the pointer of the largest particle in the particle handler. When mercury is running in paral...
Definition: ParticleHandler.cc:530
main
int main(int argc, char *argv[])
Definition: ParticleCreationSelfTest.cpp:152
ParticleSpecies.h
BaseInteractable::setVelocity
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
BaseHandler< BaseParticle >::objects_
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:302
BoundaryHandler.h
DPMBase::mpiInsertParticleCheck
bool mpiInsertParticleCheck(BaseParticle *P)
Function that checks if the mpi particle should really be inserted by the current domain.
Definition: DPMBase.cc:1723
SpeciesHandler
Container to store all ParticleSpecies.
Definition: SpeciesHandler.h:37
ParticleHandler::computeLargestParticle
void computeLargestParticle()
Computes the largest particle (by interaction radius) and sets it in largestParticle_.
Definition: ParticleHandler.cc:471
BaseParticle::isMPIParticle
bool isMPIParticle() const
Indicates if this particle is a ghost in the MPI domain.
Definition: BaseParticle.cc:175
double
DPMBase::getMax
Vec3D getMax() const
Definition: DPMBase.h:643
ParticleHandler::addExistingObject
void addExistingObject(BaseParticle *P) override
Adds a BaseParticle to the ParticleHandler.
Definition: ParticleHandler.cc:130
ParticleHandler::operator=
ParticleHandler & operator=(const ParticleHandler &rhs)
Assignment operator.
Definition: ParticleHandler.cc:84
ERROR
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
LiquidFilmParticle
Definition: LiquidFilmParticle.h:36
BaseHandler::removeObject
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:472
FileReader::read
bool read()
Definition: ParticleAnalytics2Mercury.cpp:68
ParticleHandler::NFixedParticles_
unsigned int NFixedParticles_
Number of fixed particles.
Definition: ParticleHandler.h:475
ParticleHandler::addGhostObject
void addGhostObject(int fromPrcessor, int toProcessor, BaseParticle *p)
Adds a ghost particle located at fromProcessor to toProcessor.
Definition: ParticleHandler.cc:283
FileReader::version_
enum FileReader::Version version_
Logger.h
BaseParticle::setSpecies
void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:804
LinearViscoelasticSpecies
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:33
BaseInteraction::getOverlap
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: BaseInteraction.h:240
DomainHandler::getCurrentDomain
Domain * getCurrentDomain()
Gets the domain assigned to the processor.
Definition: DomainHandler.cc:250
Vec3D::getLength
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:331
LinearViscoelasticSpecies.h
DPMBase::getTime
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:805
ParticleHandler::removeLastObject
void removeLastObject()
Removes the last BaseParticle from the ParticleHandler.
Definition: ParticleHandler.cc:437
BaseHandler.h
Species
Contains material and contact force properties.
Definition: Species.h:35
DPMBase::setTime
void setTime(Mdouble time)
Sets a new value for the current simulation time.
Definition: DPMBase.cc:833
ParticleHandler::getSmallestParticle
BaseParticle * getSmallestParticle() const
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler of the loc...
Definition: ParticleHandler.cc:507
BaseInteraction::setOverlap
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
Definition: BaseInteraction.cc:229
DPMBase::setXMax
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1156
ParticleHandler::computeAllMasses
void computeAllMasses()
Computes the mass for all BaseParticle in this ParticleHandler.
Definition: ParticleHandler.cc:1216
WARN
LL< Log::WARN > WARN
Warning log level.
Definition: Logger.cc:54
InfiniteWall.h
ParticleHandler::clear
void clear() override
Empties the whole ParticleHandler by removing all BaseParticle.
Definition: ParticleHandler.cc:973
MercuryBase::hGridRebuild
void hGridRebuild()
This sets up the parameters required for the contact model.
Definition: MercuryBase.cc:204
Log::FATAL
@ FATAL
DPMBase::speciesHandler
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1385
helpers::round
Mdouble round(const Mdouble value, unsigned precision)
Definition: Helpers.cc:598
DPMBase::domainHandler
DomainHandler domainHandler
An object of the class DomainHandler which deals with parallel code.
Definition: DPMBase.h:1420
Domain::getNumberOfTrueMPIParticles
unsigned int getNumberOfTrueMPIParticles()
Obtains the number of particles in the particleHandler that are MPIParticles, but NOT periodic partic...
Definition: Domain.cc:1679
ParticleHandler::getNumberOfRealObjectsLocal
unsigned int getNumberOfRealObjectsLocal() const
Returns the number of real objects on a local domain. MPI particles and periodic particles are neglec...
Definition: ParticleHandler.cc:1273
MPIContainer::getNumberOfProcessors
std::size_t getNumberOfProcessors() const
Get the total number of processors participating in this simulation.
Definition: MpiContainer.cc:104
DPMBase.h
ParticleHandler::readAndAddObject
void readAndAddObject(std::istream &is) override
Definition: ParticleHandler.cc:1084
FileReader::cFile_
std::ifstream cFile_
Definition: ParticleAnalytics2Mercury.cpp:243
SphericalParticle
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
DPMBase::wallHandler
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1405
BaseParticle::setPeriodicComplexity
void setPeriodicComplexity(std::vector< int > complexity)
Set the periodic communication complexity of the particle.
Definition: BaseParticle.cc:200
MAX
@ MAX
Definition: ParticleHandler.h:39
ParticleHandler::removedFixedParticle
void removedFixedParticle()
Decrement of the number of fixed particles.
Definition: ParticleHandler.cc:1229
BaseHandler::getNumberOfObjects
virtual unsigned int getNumberOfObjects() const
Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles)
Definition: BaseHandler.h:648
MPIContainer::sync
void sync()
Process all pending asynchronous communication requests before continuing.
Definition: MpiContainer.h:152
ParticleHandler::getNumberOfFixedParticles
unsigned int getNumberOfFixedParticles() const
Gets the number of particles that are fixed.
Definition: ParticleHandler.cc:1005
MPIContainer
This class contains all information and functions required for communication between processors.
Definition: MpiContainer.h:130
ParticleHandler::getSmallestParticleLocal
BaseParticle * getSmallestParticleLocal() const
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler of the loc...
Definition: ParticleHandler.cc:498
getMPISum
Vec3D getMPISum(Vec3D &val)
Definition: MpiDataClass.cc:199
DPMBase::setTimeMax
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:870
DPMBase::updateGhostGrid
void updateGhostGrid(BaseParticle *P)
Checks if the Domain/periodic interaction distance needs to be updated and updates it accordingly.
Definition: DPMBase.cc:1828
Vec3D::Y
Mdouble Y
Definition: Vector.h:65
DPMBase::setGravity
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
MPIParticle
Data class to send a particle over MPI.
Definition: MpiDataClass.h:81
ParticleHandler::getCentreOfMass
Vec3D getCentreOfMass() const
Definition: ParticleHandler.cc:650
InfiniteWall
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:48
FATAL
LL< Log::FATAL > FATAL
Definition of the different loglevels by its wrapper class LL. These are used as tags in template met...
Definition: Logger.cc:52
BaseInteraction::setContactPoint
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
Definition: BaseInteraction.cc:238
Vec3D::min
static Vec3D min(const Vec3D &a, const Vec3D &b)
Calculates the pointwise minimum of two Vec3D.
Definition: Vector.cc:102
FileReader::Version
Version
The version number of the particle analytics files.
Definition: ParticleAnalytics2Mercury.cpp:245
ThermalParticle
Definition: ThermalParticle.h:36
MPIContainer::send
std::enable_if< std::is_scalar< T >::value, void >::type send(T &t, int to, int tag)
Asynchronously send a scalar to some other processor.
Definition: MpiContainer.h:171
constants::i
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
DPMBase::setRotation
void setRotation(bool rotation)
Sets whether particle rotation is enabled or disabled.
Definition: DPMBase.h:552
Domain.h
DPMBase::getZMin
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:625
BaseWall::setSpecies
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:171
FileReader::pFile_
std::ifstream pFile_
Pointers for the input files.
Definition: ParticleAnalytics2Mercury.cpp:243
ParticleHandler::getHighestPositionComponentParticle
BaseParticle * getHighestPositionComponentParticle(int i) const
Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:888
BaseInteraction::setNormal
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
Definition: BaseInteraction.cc:210
DPMBase::setYMin
void setYMin(Mdouble newYMin)
Sets the value of YMin, the lower bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1025
ParticleHandler::getFastestParticleLocal
BaseParticle * getFastestParticleLocal() const
Gets a pointer to the fastest BaseParticle in this ParticleHandler.
Definition: ParticleHandler.cc:683
ParticleHandler::getNumberOfFixedObjects
unsigned int getNumberOfFixedObjects() const
Computes the number of fixed particles in the whole simulation.
Definition: ParticleHandler.cc:1348
BaseHandler< BaseParticle >::getLastObject
BaseParticle * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:634
BaseHandler::getObject
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
BaseObject::getId
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
ParticleHandler::computeSmallestParticle
void computeSmallestParticle()
Computes the smallest particle (by interaction radius) and sets it in smallestParticle_.
Definition: ParticleHandler.cc:447
ParticleHandler::getRotationalEnergyLocal
Mdouble getRotationalEnergyLocal() const
Definition: ParticleHandler.cc:569
ParticleHandler::smallestParticle_
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
Definition: ParticleHandler.h:470
ParticleHandler::getSmallestInteractionRadiusLocal
Mdouble getSmallestInteractionRadiusLocal() const
Returns the smallest interaction radius of the current domain.
Definition: ParticleHandler.cc:717
BaseHandler::getDPMBase
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
DPMBase::forceWriteOutputFiles
void forceWriteOutputFiles()
Writes output files immediately, even if the current time step was not meant to be written....
Definition: DPMBase.cc:3860
BaseParticle
Definition: BaseParticle.h:54
ParticleHandler::addObject
void addObject(BaseParticle *P) override
Adds a BaseParticle to the ParticleHandler.
Definition: ParticleHandler.cc:170
DPMBase::getMin
Vec3D getMin() const
Definition: DPMBase.h:637
BaseHandler::copyAndAddObject
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.
Definition: BaseHandler.h:379
BaseParticle::getMaxInteractionRadius
Mdouble getMaxInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e....
Definition: BaseParticle.h:362
ParticleHandler::getKineticEnergy
Mdouble getKineticEnergy() const
Definition: ParticleHandler.cc:553
AttributeType
AttributeType
Definition: ParticleHandler.h:38
n
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
ParticleCreation::species
LinearViscoelasticSpecies * species
Definition: ParticleCreationSelfTest.cpp:148
ParticleHandler::getLowestVelocityComponentParticle
BaseParticle * getLowestVelocityComponentParticle(int i) const
Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:924
AxisymmetricIntersectionOfWalls.h
MpiDataClass.h
RNG::getRandomNumber
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:142
SuperQuadricParticle
Definition: SuperQuadricParticle.h:56
SphericalParticle.h
helpers::writeToFile
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: Helpers.cc:445
DPMBase::getYMax
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:619
BaseHandler< BaseParticle >::copyContentsFromOtherHandler
void copyContentsFromOtherHandler(const BaseHandler< BaseParticle > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
Definition: BaseHandler.h:367
ParticleHandler::getNumberOfFixedObjectsLocal
unsigned int getNumberOfFixedObjectsLocal() const
Computes the number of Fixed particles on a local domain.
Definition: ParticleHandler.cc:1332
BaseHandler::clear
virtual void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.
Definition: BaseHandler.h:528
constants::NaN
const Mdouble NaN
Definition: GeneralDefine.h:43
HeatFluidCoupledParticle.h
BaseParticle::read
void read(std::istream &is) override
Particle read function, which accepts an std::istream as input.
Definition: BaseParticle.cc:368
DPMBase::getZMax
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.
Definition: DPMBase.h:631
DPMBase::setXMin
void setXMin(Mdouble newXMin)
Sets the value of XMin, the lower bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1001
ParticleHandler::getMass
Mdouble getMass() const
Definition: ParticleHandler.cc:607
MPIContainer::broadcast
std::enable_if< std::is_scalar< T >::value, void >::type broadcast(T &t, int fromProcessor=0)
Broadcasts a scalar from the root to all other processors.
Definition: MpiContainer.h:441
ParticleHandler
Container to store all BaseParticle.
Definition: ParticleHandler.h:48
ParticleCreation::ParticleCreation
ParticleCreation(Mdouble width, Mdouble length, Mdouble height, Mdouble sizeDistribution)
Definition: ParticleCreationSelfTest.cpp:41
ThermalParticle.h
Vec3D::max
static Vec3D max(const Vec3D &a, const Vec3D &b)
Calculates the pointwise maximum of two Vec3D.
Definition: Vector.cc:89
ParticleHandler::getLargestParticleLocal
BaseParticle * getLargestParticleLocal() const
Gets a pointer to the largest BaseParticle (by interactionRadius) in the ParticleHandler of the local...
Definition: ParticleHandler.cc:522
ParticleHandler::getMassLocal
Mdouble getMassLocal() const
Definition: ParticleHandler.cc:598
BaseParticle::isFixed
bool isFixed() const override
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...
Definition: BaseParticle.h:93
ParticleHandler::getName
std::string getName() const override
Returns the name of the handler, namely the string "ParticleHandler".
Definition: ParticleHandler.cc:1237
BaseParticle::isSphericalParticle
virtual bool isSphericalParticle() const
Definition: BaseParticle.h:645
ParticleHandler::removeObject
void removeObject(unsigned int index) override
Removes a BaseParticle from the ParticleHandler.
Definition: ParticleHandler.cc:390
ParticleHandler::getFastestParticle
BaseParticle * getFastestParticle() const
Definition: ParticleHandler.cc:706
DPMBase::particleHandler
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1395
Vec3D::Z
Mdouble Z
Definition: Vector.h:65
BaseParticle::isPeriodicGhostParticle
bool isPeriodicGhostParticle() const
Indicates if this particle is a ghost in the periodic boundary.
Definition: BaseParticle.cc:291
ParticleCreation
Definition: ParticleCreationSelfTest.cpp:38
ParticleHandler::getMeanRadius
Mdouble getMeanRadius() const
Definition: ParticleHandler.cc:800
ParticleHandler::checkExtremaOnDelete
void checkExtremaOnDelete(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.
Definition: ParticleHandler.cc:1189
DPMBase::insertGhostParticle
void insertGhostParticle(BaseParticle *P)
This function inserts a particle in the mpi communication boundaries.
Definition: DPMBase.cc:1802
BaseInteraction::getDistance
Mdouble getDistance() const
Returns an Mdouble which is the norm (length) of distance vector.
Definition: BaseInteraction.cc:491
HeatFluidCoupledParticle
Class that implements particles which store both temperature/heat capacity and liquid content which i...
Definition: HeatFluidCoupledParticle.h:42
InfiniteWall::set
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:118
MercuryBase::hGridNeedsRebuilding
bool hGridNeedsRebuilding()
Gets if the HGrid needs rebuilding before anything else happens.
Definition: MercuryBase.cc:496
Mercury3D.h
ParticleHandler::getHighestPositionComponentParticleLocal
BaseParticle * getHighestPositionComponentParticleLocal(int i) const
Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler.
Definition: ParticleHandler.cc:864
BaseParticle.h
ParticleHandler::write
void write(std::ostream &os) const
units::name
std::string name
Definition: MercuryProb.h:48
FileReader::~FileReader
~FileReader()
Destructor, simple closes the file.
Definition: ParticleAnalytics2Mercury.cpp:233
BaseHandler::addObject
virtual void addObject(T *object)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:431
ParticleHandler::getSumRadiusLocal
Mdouble getSumRadiusLocal() const
Definition: ParticleHandler.cc:787
ParticleHandler::readAndCreateObject
BaseParticle * readAndCreateObject(std::istream &is)
Create a new particle, based on the information provided in a restart file.
Definition: ParticleHandler.cc:1057
DPMBase::setZMin
void setZMin(Mdouble newZMin)
Sets the value of ZMin, the lower bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1049
DPMBase::getXMin
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:600
ParticleHandler::getNumberOfUnfixedParticles
unsigned int getNumberOfUnfixedParticles() const
Gets the number of particles that are not fixed.
Definition: ParticleHandler.cc:1013
DPMBase::hGridInsertParticle
virtual void hGridInsertParticle(BaseParticle *obj UNUSED)
Definition: DPMBase.cc:1688
DPMBase::interactionHandler
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1425
BaseInteractable::getPosition
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
ParticleSpecies::computeMass
void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
Definition: ParticleSpecies.cc:166
MPIContainer::Instance
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:134