MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ParticleHandler Class Reference

Container to store all BaseParticle. More...

#include <ParticleHandler.h>

+ Inheritance diagram for ParticleHandler:

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 ()
 Destructor, it destructs the ParticleHandler and all BaseParticle it contains. More...
 
virtual void addObject (BaseParticle *P)
 Adds a BaseParticle to the ParticleHandler. More...
 
virtual void removeObject (unsigned const int index)
 Removes a BaseParticle from the ParticleHandler. 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...
 
BaseParticlegetSmallestParticle () const
 Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler. More...
 
BaseParticlegetLargestParticle () const
 Gets a pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler. More...
 
BaseParticlegetFastestParticle () const
 Gets a pointer to the fastest BaseParticle in this ParticleHandler. More...
 
Mdouble getMeanRadius () const
 Gets a pointer to the fastest BaseParticle in this ParticleHandler. More...
 
BaseParticlegetLowestPositionComponentParticle (const int i) const
 Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler. More...
 
BaseParticlegetHighestPositionComponentParticle (const int i) const
 Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler. More...
 
BaseParticlegetLowestVelocityComponentParticle (const int i) const
 Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler. More...
 
BaseParticlegetHighestVelocityComponentParticle (const int i) const
 Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler. More...
 
BaseParticlegetLightestParticle () const
 Gets a pointer to the lightest BaseParticle (by mass) in this ParticleHandler. More...
 
void clear ()
 Empties the whole ParticleHandler by removing all BaseParticle. More...
 
void readObject (std::istream &is)
 Reads BaseParticle into the ParticleHandler from restart data. More...
 
void readOldObject (std::string type, std::istream &is)
 Reads BaseParticle into the ParticleHandler 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...
 
std::string getName () const
 Returns the name of the handler, namely the string "ParticleHandler". More...
 
void writeVTK () const
 Writes all particles into a vtk file format (unstructured grid), consisting of particle positions, velocities, radii and type of species (IndSpecies) More...
 
- Public Member Functions inherited from BaseHandler< BaseParticle >
 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...
 
void removeLastObject ()
 Removes the last Object from the BaseHandler. More...
 
void clear ()
 Empties the whole BaseHandler by removing all Objects and setting all other variables to 0. More...
 
void read (std::istream &is)
 Reads all objects from restart data. More...
 
BaseParticlegetObjectById (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler. More...
 
BaseParticlegetObject (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler. More...
 
const BaseParticlegetObject (const unsigned int id) const
 Gets a constant pointer to the Object at the specified index in the BaseHandler. More...
 
BaseParticlegetLastObject ()
 Gets a pointer to the last Object in this BaseHandler. More...
 
const BaseParticlegetLastObject () const
 Gets a constant pointer to the last Object in this BaseHandler. More...
 
unsigned int getNumberOfObjects () const
 Gets the number of Object in this BaseHandler. 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...
 
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...
 
DPMBasegetDPMBase ()
 Gets the problem that is solved using this handler. More...
 
DPMBasegetDPMBase () const
 Gets the problem that is solved using this handler and does not change the class. More...
 
virtual void writeVTK ()
 Over written in WallHandler and ParticleHandler. More...
 

Static Public Member Functions

static BaseParticlegetNewObject (const std::string &type)
 

Private Attributes

BaseParticlelargestParticle_
 A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler. More...
 
BaseParticlesmallestParticle_
 A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler. More...
 

Additional Inherited Members

- Protected Attributes inherited from BaseHandler< BaseParticle >
std::vector< BaseParticle * > objects_
 The actual list of Object pointers. More...
 

Detailed Description

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 40 of file ParticleHandler.h.

Constructor & Destructor Documentation

ParticleHandler::ParticleHandler ( )

Default constructor, it creates an empty ParticleHandler.

Constructor of the ParticleHandler class. It creates and empty ParticleHandler.

Definition at line 42 of file ParticleHandler.cc.

References DEBUG, largestParticle_, logger, and smallestParticle_.

43 {
44  largestParticle_ = nullptr;
45  smallestParticle_ = nullptr;
46  logger(DEBUG, "ParticleHandler::ParticleHandler() finished");
47 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
ParticleHandler::ParticleHandler ( const ParticleHandler PH)

Constructor that copies all BaseParticle it contains and then sets the smallest and largest particle.

Parameters
[in]PHThe 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 55 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_.

57 {
58  clear();
59  setDPMBase(PH.getDPMBase());
60  largestParticle_ = nullptr;
61  smallestParticle_ = nullptr;
63  if (objects_.size() != 0)
64  {
67  }
68  logger(DEBUG, "ParticleHandler::ParticleHandler(const ParticleHandler &PH) finished");
69 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setDPMBase(DPMBase *DPMBase)
Sets the problem that is solved using this handler.
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
void clear()
Empties the whole ParticleHandler by removing all BaseParticle.
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
void computeSmallestParticle()
Computes the smallest particle (by interaction radius) and sets it in smallestParticle_.
void computeLargestParticle()
Computes the largest particle (by interaction radius) and sets it in largestParticle_.
void copyContentsFromOtherHandler(const BaseHandler< BaseParticle > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:543
ParticleHandler::~ParticleHandler ( )

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 99 of file ParticleHandler.cc.

References DEBUG, largestParticle_, logger, and smallestParticle_.

100 {
101  //First reset the pointers, such that they are not checked twice when removing particles
102  largestParticle_ = nullptr;
103  smallestParticle_ = nullptr;
104  logger(DEBUG, "ParticleHandler::~ParticleHandler() finished");
105 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.

Member Function Documentation

void ParticleHandler::addObject ( BaseParticle P)
virtual

Adds a BaseParticle to the ParticleHandler.

Parameters
[in]PA 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 120 of file ParticleHandler.cc.

References BaseHandler< T >::addObject(), checkExtrema(), ParticleSpecies::computeMass(), BaseHandler< BaseParticle >::getDPMBase(), BaseObject::getId(), BaseInteractable::getSpecies(), DPMBase::hGridInsertParticle(), DPMBase::hGridUpdateParticle(), logger, BaseParticle::setHandler(), and WARN.

Referenced by CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), LeesEdwardsBoundary::createHorizontalPeriodicParticles(), ShearBoxBoundary::createHorizontalPeriodicParticles(), CircularPeriodicBoundary::createPeriodicParticles(), MaserBoundary::createPeriodicParticles(), AngledPeriodicBoundary::createPeriodicParticles(), PeriodicBoundary::createPeriodicParticles(), ShearBoxBoundary::createVerticalPeriodicParticles(), and LeesEdwardsBoundary::createVerticalPeriodicParticles().

121 {
122  if (P->getSpecies() == nullptr)
123  {
124  logger(WARN, "WARNING: The particle with ID % that is added in "
125  "ParticleHandler::addObject does not have a species yet."
126  "Please make sure that you have "
127  "set the species somewhere in the driver code.", P->getId());
128  }
129  //Puts the particle in the Particle list
131  if (getDPMBase() != nullptr)
132  {
133  //This places the particle in this grid
135  //This computes where the particle currently is in the grid
137  }
138  //set the particleHandler pointer
139  P->setHandler(this);
140  //compute mass of the particle
141  P->getSpecies()->computeMass(P) ;
142  //Check if this particle has new extrema
143  checkExtrema(P);
144 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.cc:116
virtual void hGridUpdateParticle(BaseParticle *obj UNUSED)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:757
virtual void hGridInsertParticle(BaseParticle *obj UNUSED)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:750
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void checkExtrema(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating.
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
virtual void addObject(T *object)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:313
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
void ParticleHandler::checkExtrema ( BaseParticle P)

Checks if the extrema of this ParticleHandler needs updating.

Parameters
[in]PA pointer to the particle, which properties have to be checked against the ParticleHandlers extrema.

Definition at line 548 of file ParticleHandler.cc.

References computeLargestParticle(), computeSmallestParticle(), BaseParticle::getInteractionRadius(), largestParticle_, and smallestParticle_.

Referenced by addObject(), and BaseParticle::setRadius().

549 {
550  if (P == largestParticle_)
551  {
552  //if the properties of the largest particle changes
554  }
556  {
557  largestParticle_ = P;
558  }
559 
560  if (P == smallestParticle_)
561  {
562  //if the properties of the smallest particle changes
564  }
566  {
567  smallestParticle_ = P;
568  }
569 }
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
void computeSmallestParticle()
Computes the smallest particle (by interaction radius) and sets it in smallestParticle_.
void computeLargestParticle()
Computes the largest particle (by interaction radius) and sets it in largestParticle_.
Mdouble getInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
void ParticleHandler::checkExtremaOnDelete ( BaseParticle P)

Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.

Parameters
[in]PA pointer to the particle, which is going to get deleted.

Definition at line 574 of file ParticleHandler.cc.

References computeLargestParticle(), computeSmallestParticle(), largestParticle_, and smallestParticle_.

Referenced by BaseParticle::~BaseParticle().

575 {
576  if (P == largestParticle_)
577  {
579  }
580  if (P == smallestParticle_)
581  {
583  }
584 }
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
void computeSmallestParticle()
Computes the smallest particle (by interaction radius) and sets it in smallestParticle_.
void computeLargestParticle()
Computes the largest particle (by interaction radius) and sets it in largestParticle_.
void ParticleHandler::clear ( )

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.

Definition at line 402 of file ParticleHandler.cc.

References BaseHandler< T >::clear(), largestParticle_, and smallestParticle_.

Referenced by operator=(), ParticleHandler(), FileReader::read(), and DPMBase::read().

403 {
404  smallestParticle_ = nullptr;
405  largestParticle_ = nullptr;
407 }
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
Definition: BaseHandler.h:392
void ParticleHandler::computeAllMasses ( unsigned int  indSpecies)

Computes the mass for all BaseParticle of the given species in this ParticleHandler.

Parameters
[in]indSpeciesUnsigned integer with the index of the species for which the masses must be computed.

Definition at line 590 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::objects_.

Referenced by SpeciesHandler::addObject(), DPMBase::readNextDataFile(), ParticleSpecies::setDensity(), DPMBase::setParticleDimensions(), and DPMBase::solve().

591 {
592  for (BaseParticle* particle : objects_)
593  {
594  if (particle->getIndSpecies() == indSpecies)
595  {
596  particle->getSpecies()->computeMass(particle);
597  }
598  }
599 }
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
void ParticleHandler::computeAllMasses ( )

Computes the mass for all BaseParticle in this ParticleHandler.

Definition at line 601 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::objects_.

602 {
603  for (BaseParticle* particle : objects_)
604  {
605  particle->getSpecies()->computeMass(particle);
606  }
607 }
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
void ParticleHandler::computeLargestParticle ( )

Computes the largest particle (by interaction radius) and sets it in largestParticle_.

Definition at line 194 of file ParticleHandler.cc.

References BaseParticle::getInteractionRadius(), BaseHandler< BaseParticle >::getNumberOfObjects(), largestParticle_, logger, BaseHandler< BaseParticle >::objects_, and WARN.

Referenced by checkExtrema(), checkExtremaOnDelete(), operator=(), and ParticleHandler().

195 {
196  if (getNumberOfObjects() == 0)
197  {
198  logger(WARN, "No particles, so cannot compute the largest particle.");
199  return;
200  }
201  Mdouble max = -std::numeric_limits<Mdouble>::max();
202  largestParticle_ = nullptr;
203  for (BaseParticle* const particle : objects_)
204  {
205  if (particle->getInteractionRadius() > max)
206  {
207  max = particle->getInteractionRadius();
208  largestParticle_ = particle;
209  }
210  }
211 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Mdouble getInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
void ParticleHandler::computeSmallestParticle ( )

Computes the smallest particle (by interaction radius) and sets it in smallestParticle_.

Definition at line 175 of file ParticleHandler.cc.

References BaseParticle::getInteractionRadius(), BaseHandler< BaseParticle >::getNumberOfObjects(), logger, BaseHandler< BaseParticle >::objects_, smallestParticle_, and WARN.

Referenced by checkExtrema(), checkExtremaOnDelete(), operator=(), and ParticleHandler().

176 {
177  if (getNumberOfObjects() == 0)
178  {
179  logger(WARN, "No particles, so cannot compute the smallest particle.");
180  return;
181  }
182  Mdouble min = std::numeric_limits<Mdouble>::max();
183  smallestParticle_ = nullptr;
184  for (BaseParticle* const particle : objects_)
185  {
186  if (particle->getInteractionRadius() < min)
187  {
188  min = particle->getInteractionRadius();
189  smallestParticle_ = particle;
190  }
191  }
192 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Mdouble getInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
BaseParticle * ParticleHandler::getFastestParticle ( ) const

Gets a pointer to the fastest BaseParticle in this ParticleHandler.

Returns
A pointer to the fastest BaseParticle in this ParticleHandler.

Definition at line 242 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getNumberOfObjects(), logger, BaseHandler< BaseParticle >::objects_, and WARN.

243 {
244  if (getNumberOfObjects() == 0)
245  {
246  logger(WARN, "No particles to set getFastestParticle()" );
247  return nullptr;
248  }
249  BaseParticle* p = nullptr;
250  Mdouble maxSpeed = -std::numeric_limits<Mdouble>::max();
251  for (BaseParticle* const pLoop : objects_)
252  {
253  if ((pLoop->getVelocity().getLength()) > maxSpeed)
254  {
255  maxSpeed = pLoop->getVelocity().getLength();
256  p = pLoop;
257  }
258  }
259  return p;
260 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
BaseParticle * ParticleHandler::getHighestPositionComponentParticle ( const int  i) const

Gets a pointer to the particle with the highest coordinates in direction i in this ParticleHandler.

Parameters
[in]iDirection for which one wants the particle with highest coordinates.
Returns
A pointer to the particle with the highest coordinates in direction i in this ParticleHandler.

Definition at line 303 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getNumberOfObjects(), logger, BaseHandler< BaseParticle >::objects_, and WARN.

304 {
305  if (getNumberOfObjects() == 0)
306  {
307  logger(WARN, "No getHighestPositionComponentParticle(const int i) since there are no particles.");
308  return nullptr;
309  }
310  BaseParticle* p = nullptr;
311  Mdouble max = -std::numeric_limits<Mdouble>::max();
312  for (BaseParticle* const pLoop : objects_)
313  {
314  if (pLoop->getPosition().getComponent(i) > max)
315  {
316  max = pLoop->getPosition().getComponent(i);
317  p = pLoop;
318  }
319  }
320 
321  return p;
322 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
BaseParticle * ParticleHandler::getHighestVelocityComponentParticle ( const int  i) const

Gets a pointer to the particle with the highest velocity in direction i in this ParticleHandler.

Parameters
[in]iDirection for which you want the particle with highest velocity.
Returns
A pointer to the particle with the highest velocity in direction i in this ParticleHandler.

Definition at line 354 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getNumberOfObjects(), logger, BaseHandler< BaseParticle >::objects_, and WARN.

355 {
356  if (!getNumberOfObjects())
357  {
358  logger(WARN, "No getHighestVelocityComponentParticle(const int i) since there are no particles");
359  return nullptr;
360  }
361  BaseParticle* p = nullptr;
362  Mdouble max = -std::numeric_limits<Mdouble>::max();
363  for (BaseParticle* const pLoop : objects_)
364  {
365  if (pLoop->getVelocity().getComponent(i) > max)
366  {
367  max = pLoop->getVelocity().getComponent(i);
368  p = pLoop;
369  }
370  }
371  return p;
372 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
BaseParticle * ParticleHandler::getLargestParticle ( ) const
BaseParticle * ParticleHandler::getLightestParticle ( ) const

Gets a pointer to the lightest BaseParticle (by mass) in this ParticleHandler.

Returns
A pointer to the to the lightest BaseParticle (by mass) in this ParticleHandler.

Definition at line 377 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getNumberOfObjects(), logger, BaseHandler< BaseParticle >::objects_, and WARN.

378 {
379  if (getNumberOfObjects() == 0)
380  {
381  logger(WARN, "No particles to set getLightestParticle()");
382  return nullptr;
383  }
384  BaseParticle* p = nullptr;
385  Mdouble minMass = std::numeric_limits<Mdouble>::max();
386  for (BaseParticle* const pLoop : objects_)
387  {
388  if (pLoop->getMass() < minMass)
389  {
390  minMass = pLoop->getMass();
391  p = pLoop;
392  }
393  }
394  return p;
395 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
BaseParticle * ParticleHandler::getLowestPositionComponentParticle ( const int  i) const

Gets a pointer to the particle with the lowest coordinates in direction i in this ParticleHandler.

Parameters
[in]iDirection for which you want the particle with lowest coordinates.
Returns
A pointer to the particle with the lowest coordinates in the given direction in this ParticleHandler.

Definition at line 278 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getNumberOfObjects(), logger, BaseHandler< BaseParticle >::objects_, and WARN.

279 {
280  if (getNumberOfObjects() == 0)
281  {
282  logger(WARN, "No getLowestPositionComponentParticle(const int i) since there are no particles.");
283  return nullptr;
284  }
285  BaseParticle* p = nullptr;
286  Mdouble min = std::numeric_limits<Mdouble>::max();
287  for (BaseParticle* const pLoop : objects_)
288  {
289  if (pLoop->getPosition().getComponent(i) < min)
290  {
291  min = pLoop->getPosition().getComponent(i);
292  p = pLoop;
293  }
294  }
295  return p;
296 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
BaseParticle * ParticleHandler::getLowestVelocityComponentParticle ( const int  i) const

Gets a pointer to the particle with the lowest velocity in direction i in this ParticleHandler.

Parameters
[in]iDirection for which you want the particle with lowest velocity.
Returns
A pointer to the particle with the lowest velocity in direction i in this ParticleHandler.

Definition at line 329 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getNumberOfObjects(), logger, BaseHandler< BaseParticle >::objects_, and WARN.

330 {
331  if (getNumberOfObjects() == 0)
332  {
333  logger(WARN, "No getLowestVelocityComponentParticle(const int i) since there are no particles");
334  return nullptr;
335  }
336  BaseParticle* p = nullptr;
337  Mdouble min = std::numeric_limits<Mdouble>::max();
338  for (BaseParticle* const pLoop : objects_)
339  {
340  if (pLoop->getVelocity().getComponent(i) < min)
341  {
342  min = pLoop->getVelocity().getComponent(i);
343  p = pLoop;
344  }
345  }
346  return p;
347 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Mdouble ParticleHandler::getMeanRadius ( ) const

Gets a pointer to the fastest BaseParticle in this ParticleHandler.

Returns
The mean radius of all particles

Definition at line 265 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getNumberOfObjects(), and BaseHandler< BaseParticle >::objects_.

265  {
266  Mdouble sumRadius = 0;
267  for (BaseParticle* const p : objects_) {
268  sumRadius += p->getRadius();
269  }
270  return sumRadius/getNumberOfObjects();
271 }
double Mdouble
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
std::string ParticleHandler::getName ( ) const
virtual

Returns the name of the handler, namely the string "ParticleHandler".

Returns
The string "ParticleHandler".

Implements BaseHandler< BaseParticle >.

Definition at line 612 of file ParticleHandler.cc.

613 {
614  return "ParticleHandler";
615 }
BaseParticle * ParticleHandler::getNewObject ( const std::string &  type)
static

Definition at line 409 of file ParticleHandler.cc.

References ERROR, and logger.

Referenced by InsertionBoundary::read().

410 {
411  if (type == "BaseParticle"||type == "BP"||isdigit(type[0]))
412  {
413  return new BaseParticle;
414  }
415  else if (type == "LiquidFilmParticle")
416  {
417  return new LiquidFilmParticle;
418  }
419  else
420  {
421  logger(ERROR, "Particle type % not understood in restart file. Particle has not been read.", type);
422  return nullptr;
423  }
424 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseParticle * ParticleHandler::getSmallestParticle ( ) const

Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.

Returns
A pointer to the to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.

Definition at line 217 of file ParticleHandler.cc.

References logger, smallestParticle_, and WARN.

Referenced by MercuryBase::getHGridTargetMinInteractionRadius(), HGridOptimiser::initialise(), and DPMBase::writeFstatHeader().

218 {
219  if (smallestParticle_ == nullptr)
220  {
221  logger(WARN, "No particles to return in getSmallestParticle()");
222  }
223  return smallestParticle_;
224 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
ParticleHandler ParticleHandler::operator= ( const ParticleHandler rhs)

Assignment operator.

Parameters
[in]rhsThe 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 77 of file ParticleHandler.cc.

References clear(), computeLargestParticle(), computeSmallestParticle(), BaseHandler< BaseParticle >::copyContentsFromOtherHandler(), DEBUG, largestParticle_, logger, BaseHandler< BaseParticle >::objects_, and smallestParticle_.

78 {
79  if (this != &rhs)
80  {
81  clear();
82  largestParticle_ = nullptr;
83  smallestParticle_ = nullptr;
85  if (objects_.size() != 0)
86  {
89  }
90  }
91  logger(DEBUG, "ParticleHandler::operator = (const ParticleHandler& rhs) finished");
92  return *this;
93 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
void clear()
Empties the whole ParticleHandler by removing all BaseParticle.
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
std::vector< BaseParticle * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:216
void computeSmallestParticle()
Computes the smallest particle (by interaction radius) and sets it in smallestParticle_.
void computeLargestParticle()
Computes the largest particle (by interaction radius) and sets it in largestParticle_.
void copyContentsFromOtherHandler(const BaseHandler< BaseParticle > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
void ParticleHandler::readObject ( std::istream &  is)
virtual

Reads BaseParticle into the ParticleHandler from restart data.

Parameters
[in]isThe input stream from which the information is read.
Todo:
make sure setting the id doesn't break the id setter :)
Todo:
make sure setting the id doesn't break the id setter :)
Todo:
make sure setting the id doesn't break the id setter :)
Todo:
{Remove for final version}

Implements BaseHandler< BaseParticle >.

Definition at line 429 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::copyAndAddObject(), DEBUG, ERROR, BaseHandler< BaseParticle >::getDPMBase(), BaseObject::getId(), BaseInteractable::getIndSpecies(), BaseHandler< BaseParticle >::getLastObject(), logger, BaseParticle::oldRead(), readOldObject(), BaseParticle::setHandler(), BaseHandler< BaseParticle >::setId(), and BaseParticle::setSpecies().

Referenced by DPMBase::read().

430 {
431  std::string type;
432  is >> type;
433  logger.log(Log::DEBUG, "ParticleHandler::readObject(is): reading type %.", type);
434  if (type == "BaseParticle")
435  {
436  BaseParticle baseParticle;
437  is >> baseParticle;
438  //set the species pointer correctly
439  baseParticle.setSpecies(getDPMBase()->speciesHandler.getObject(baseParticle.getIndSpecies()));
440  copyAndAddObject(baseParticle);
441  setId(getLastObject(),baseParticle.getId());
442  //getLastObject()->setId(baseParticle.getId()); //to ensure old id
444  }
445  else if (type == "LiquidFilmParticle")
446  {
447  LiquidFilmParticle particle;
448  is >> particle;
449  //set the species pointer correctly
450  particle.setSpecies(getDPMBase()->speciesHandler.getObject(particle.getIndSpecies()));
451  copyAndAddObject(particle);
452  setId(getLastObject(),particle.getId());
453  //getLastObject()->setId(particle.getId()); //to ensure old id
455  }
456  else if (type == "ThermalParticle")
457  {
458  ThermalParticle particle;
459  is >> particle;
460  //set the species pointer correctly
461  particle.setSpecies(getDPMBase()->speciesHandler.getObject(particle.getIndSpecies()));
462  copyAndAddObject(particle);
463  setId(getLastObject(),particle.getId());
464  //getLastObject()->setId(particle.getId()); //to ensure old id
466  }
468  else if (type == "BP")
469  {
470  BaseParticle baseParticle;
471  baseParticle.setHandler(this);//to be able to set the species
472  baseParticle.oldRead(is);
473  //set the species pointer correctly
474  baseParticle.setSpecies(getDPMBase()->speciesHandler.getObject(baseParticle.getIndSpecies()));
475  copyAndAddObject(baseParticle);
476  setId(getLastObject(),baseParticle.getId());
477  //getLastObject()->setId(baseParticle.getId()); //to ensure old id
478  }
479  else if (isdigit(type[0]))
480  {
481  readOldObject(type, is);
482  }
483  else
484  {
485  logger(ERROR, "Particle type % not understood in restart file: You need to add this particle to ParticleHandler::readObject.", type);
486  return;
487  }
488 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.cc:116
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
void setSpecies(const ParticleSpecies *species)
void readOldObject(std::string type, std::istream &is)
Reads BaseParticle into the ParticleHandler from old-style restart data.
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.
virtual MERCURY_DEPRECATED void oldRead(std::istream &is)
deprecated version of the read function.
void setId(BaseParticle *object, unsigned int id)
This function sets the id and ensures that nextId is a bigger value than id.
Definition: BaseHandler.h:189
unsigned int getIndSpecies() const
Returns the index of the Species of this BaseInteractable.
BaseParticle * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
void ParticleHandler::readOldObject ( std::string  type,
std::istream &  is 
)

Reads BaseParticle into the ParticleHandler from old-style restart data.

Parameters
[in]typeThe first value of the position.
[in]isThe 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 499 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::copyAndAddObject(), BaseHandler< BaseParticle >::getDPMBase(), helpers::getLineFromStringStream(), logger, VERBOSE, Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by readObject().

500 {
501  //read in next line
502  std::stringstream line(std::stringstream::in | std::stringstream::out);
504  logger(VERBOSE, line.str());
505  //std::cout << line.str() << std::endl;
506 
507  BaseParticle particle;
508 
509  //Declare all properties of the particle
510  unsigned int indSpecies;
511  Mdouble radius, inverseMass, inverseInertia;
512  Vec3D position, velocity, orientation, angularVelocity;
513 
514  //Read all values
515  position.X = atof(type.c_str());
516 
517  line >> position.Y >> position.Z >> velocity >> radius >> orientation >> angularVelocity >> inverseMass >> inverseInertia >> indSpecies;
518 
519  //Put the values in the particle
520  particle.setSpecies(getDPMBase()->speciesHandler.getObject(indSpecies));
521  particle.setPosition(position);
522  particle.setVelocity(velocity);
523  particle.setRadius(radius);
524  particle.setOrientation(orientation);
525  particle.setAngularVelocity(angularVelocity);
526  if (inverseMass == 0.0)
527  particle.fixParticle();
528  else
529  {
530  particle.setInertia(1./inverseInertia);
531  }
532 
533  //Put the particle in the handler
534  copyAndAddObject(particle);
535 }
Mdouble X
the vector components
Definition: Vector.h:52
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in...
Definition: Helpers.cc:396
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.
Mdouble Y
Definition: Vector.h:52
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Mdouble Z
Definition: Vector.h:52
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 166 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getDPMBase(), BaseHandler< BaseParticle >::getLastObject(), DPMBase::hGridRemoveParticle(), and BaseHandler< T >::removeLastObject().

Referenced by DPMBase::readNextDataFile().

167 {
168 #ifdef CONTACT_LIST_HGRID
169  getDPMBase()->getPossibleContactList().remove_ParticlePosibleContacts(getLastObject());
170 #endif
173 }
void removeLastObject()
Removes the last Object from the BaseHandler.
Definition: BaseHandler.h:375
virtual void hGridRemoveParticle(BaseParticle *obj UNUSED)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:764
BaseParticle * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
void ParticleHandler::removeObject ( unsigned const int  index)
virtual

Removes a BaseParticle from the ParticleHandler.

Parameters
[in]indexThe 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.

Reimplemented from BaseHandler< BaseParticle >.

Definition at line 153 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getDPMBase(), BaseHandler< BaseParticle >::getObject(), DPMBase::hGridRemoveParticle(), and BaseHandler< T >::removeObject().

Referenced by DeletionBoundary::checkBoundaryAfterParticleMoved(), CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), Chute::cleanChute(), and DPMBase::removeDuplicatePeriodicParticles().

154 {
155 #ifdef CONTACT_LIST_HGRID
156  getDPMBase()->getPossibleContactList().remove_ParticlePosibleContacts(getObject(id));
157 #endif
160 }
virtual void removeObject(unsigned const int id)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:333
BaseParticle * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
virtual void hGridRemoveParticle(BaseParticle *obj UNUSED)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:764
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
void ParticleHandler::write ( std::ostream &  os) const

Definition at line 537 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getNumberOfObjects().

Referenced by DPMBase::write().

538 {
539  os << "Particles " << getNumberOfObjects() << std::endl;
540  for (BaseParticle* it : *this)
541  os << (*it) << std::endl;
542 }
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
void ParticleHandler::writeVTK ( ) const

Writes all particles into a vtk file format (unstructured grid), consisting of particle positions, velocities, radii and type of species (IndSpecies)

Writes all points ans cells to a file in the VTK format. The filename is hard-coded in this method, and is based on the name of the DPMBase and has a unique counter in it to ensure there are no two files with the same name.

Todo:
Check if this should indeed be a WARN

Definition at line 623 of file ParticleHandler.cc.

References BaseHandler< BaseParticle >::getDPMBase(), DPMBase::getInfo(), BaseHandler< BaseParticle >::getLastObject(), Files::getName(), BaseParticle::getNameVTK(), BaseParticle::getNumberOfFieldsVTK(), BaseHandler< BaseParticle >::getNumberOfObjects(), BaseParticle::getTypeVTK(), INFO, logger, helpers::to_string(), and WARN.

Referenced by main(), and DPMBase::writeVTK().

624 {
625  static unsigned fileCounter = 0;
626  const std::string fileName = getDPMBase()->getName() + "Particle_" +
627  std::to_string(fileCounter++) + ".vtu";
628  logger(INFO, "writing % (t=%, N=%)", fileName, getDPMBase()->getTime(), this->getNumberOfObjects());
629 
630  std::fstream file;
631  file.open(fileName.c_str(), std::ios::out);
632  if (file.fail())
633  {
635  logger(WARN, "Error in writeToFile: file % could not be opened", fileName);
636  }
637  //
638  file << "<?xml version=\"1.0\"?>\n\n";
639  file << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
640  file << "<UnstructuredGrid>\n";
641  file << "<Piece NumberOfPoints=\"" << this->getNumberOfObjects() << "\" NumberOfCells=\"" << 0 << "\">\n";
642  file << "<Points>\n";
643  file << " <DataArray type=\"Float32\" Name=\"Position\" NumberOfComponents=\"3\" format=\"ascii\">\n";
644  for (const auto& p: *this)
645  {
646  file << '\t' << p->getPosition() << '\n';
647  }
648  file << " </DataArray>\n";
649  file << "</Points>\n";
650  file << "<PointData Vectors=\"vector\">\n";
651  file << " <DataArray type=\"Float32\" Name=\"Velocity\" NumberOfComponents=\"3\" format=\"ascii\">\n";
652  // Add velocity
653  for (const auto& p: *this)
654  {
655  file << '\t' << p->getVelocity() << '\n';
656  }
657  file << " </DataArray>\n";
658  file << " <DataArray type=\"Float32\" Name=\"Radius\" format=\"ascii\">\n";
659  // Add radius
660  for (const auto& p: *this)
661  {
662  file << '\t' << p->getRadius() << '\n';
663  }
664  file << " </DataArray>\n";
665  file << " <DataArray type=\"Float32\" Name=\"SpeciesType\" format=\"ascii\">\n";
666  // Add species type
667  for (const auto& p: *this)
668  {
669  file << '\t' << p->getIndSpecies() << '\n';
670  }
671  file << " </DataArray>\n";
672  file << " <DataArray type=\"Float32\" Name=\"Info\" format=\"ascii\">\n";
673  // Add species type
674  for (const auto& p: *this)
675  {
676  file << '\t' << getDPMBase()->getInfo(*p) << '\n';
677  }
678  file << " </DataArray>\n";
679  //check if this type of Interaction has extra fields
680  if (getLastObject()!= nullptr)
681  {
682  for (unsigned i = 0; i<getLastObject()->getNumberOfFieldsVTK(); i++)
683  {
684  file << " <DataArray type=\"" << getLastObject()->getTypeVTK(i) << "\" Name=\"" << getLastObject()->getNameVTK(i) << "\" format=\"ascii\">\n";
685  // Add species type
686  for (const auto &p: *this)
687  {
688  for (auto f : p->getFieldVTK(i))
689  file << '\t' << f << '\n';
690  }
691  file << " </DataArray>\n";
692  }
693  }
694  file << "</PointData>\n";
695  file << "<Cells>\n";
696  file << " <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
697  file << " </DataArray>\n";
698  file << " <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
699  file << " </DataArray>\n";
700  file << " <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
701  file << " </DataArray>\n";
702  file << "</Cells>\n";
703  file << "</Piece>\n";
704  file << "</UnstructuredGrid>\n";
705  file << "</VTKFile>\n";
706  file.close();
707 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
std::string to_string(const T &n)
Definition: Helpers.h:203
virtual std::string getTypeVTK(unsigned i) const
virtual double getInfo(const BaseParticle &P) const
A virtual method that allows the user to overrride and set what is written into the info column in th...
Definition: DPMBase.cc:703
virtual std::string getNameVTK(unsigned i) const
BaseParticle * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
virtual unsigned getNumberOfFieldsVTK() const
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: Files.cc:132

Member Data Documentation

BaseParticle* ParticleHandler::largestParticle_
private

A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.

Todo:
TW: note that checkExtrema gets called if a particle gets created and its Species and Radius gets set, even if it's not yet included in the particleHandler! This is necessary to check a not included particle for overlaps before inserting it into the handler. Not sure if this is a sensible structure; to be discussed.

Definition at line 192 of file ParticleHandler.h.

Referenced by checkExtrema(), checkExtremaOnDelete(), clear(), computeLargestParticle(), getLargestParticle(), operator=(), ParticleHandler(), and ~ParticleHandler().

BaseParticle* ParticleHandler::smallestParticle_
private

A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.

Definition at line 197 of file ParticleHandler.h.

Referenced by checkExtrema(), checkExtremaOnDelete(), clear(), computeSmallestParticle(), getSmallestParticle(), operator=(), ParticleHandler(), and ~ParticleHandler().


The documentation for this class was generated from the following files: