BaseHandler< T > Class Template Referenceabstract

Container to store the pointers to all objects that one creates in a simulation. More...

#include <BaseHandler.h>

Public Member Functions

 BaseHandler ()
 Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer. More...
 
 BaseHandler (const BaseHandler< T > &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< T > &BH)
 Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handler (container) to the other. More...
 
template<typename U >
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...
 
template<typename U >
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...
 
template<typename U >
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddGhostObject (const U &object)
 Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case. More...
 
template<typename U >
std::enable_if< std::is_pointer< U >::value, U >::type copyAndAddGhostObject (const U object)
 Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case. More...
 
virtual void addExistingObject (T *O)
 Adds an existing object to the BaseHandler without changing the id of the object. More...
 
virtual void addObject (T *object)
 Adds a new Object to the BaseHandler. More...
 
virtual void addGhostObject (T *O)
 Adds a new Object to the BaseHandler. called by the to avoid increasing the id. More...
 
void removeIf (const std::function< bool(T *)> cond)
 
virtual void removeObject (unsigned const int index)
 Removes an Object from the BaseHandler. More...
 
void removeLastObject ()
 Removes the last Object from the BaseHandler. More...
 
virtual void clear ()
 Empties the whole BaseHandler by removing all Objects and setting all other variables to 0. More...
 
virtual void readAndAddObject (std::istream &is)=0
 Reads Object into the BaseHandler from restart data. More...
 
void read (std::istream &is)
 Reads all objects from restart data. More...
 
T * getObjectById (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler. More...
 
std::vector< T * > getObjectsById (const unsigned int id)
 Gets a vector of pointers to the objects with the specific id. More...
 
T * getObject (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler.
More...
 
const T * getObject (const unsigned int id) const
 Gets a constant pointer to the Object at the specified index in the BaseHandler. More...
 
T * getLastObject ()
 Gets a pointer to the last Object in this BaseHandler. More...
 
const T * getLastObject () const
 Gets a constant pointer to the last Object in this BaseHandler. More...
 
virtual unsigned int getNumberOfObjects () const
 Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles) More...
 
unsigned int getSize () const
 Gets the size of the particleHandler (including mpi and periodic particles) More...
 
unsigned int getStorageCapacity () const
 Gets the storage capacity of this BaseHandler. More...
 
void setStorageCapacity (const unsigned int N)
 Sets the storage capacity of this BaseHandler. More...
 
void resize (const unsigned int N, const T &obj)
 Resizes the container to contain N elements. More...
 
const std::vector< T * >::const_iterator begin () const
 Gets the begin of the const_iterator over all Object in this BaseHandler. More...
 
const std::vector< T * >::iterator begin ()
 Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More...
 
const std::vector< T * >::const_iterator end () const
 Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More...
 
const std::vector< T * >::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 (T *object, unsigned int id)
 
void increaseId ()
 
unsigned int getNextId ()
 
void setNextId (unsigned int id)
 
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 std::string getName () const =0
 Gets the name of this handler. More...
 
virtual void writeVTK () const
 now empty function for writing VTK files. More...
 
unsigned getNextGroupId ()
 Should be called each time you assign a groupId. Returns the value of nextGroupId_ and increases nextGroupId_ by one. More...
 

Protected Attributes

std::vector< T * > objects_
 The actual list of Object pointers. More...
 

Private Attributes

unsigned int maxObjects_
 An integer to keep track of the largest number of objects ever stored in this BaseHandler. More...
 
unsigned int nextId_
 identifier for next object created More...
 
unsigned nextGroupId_ = 1
 value of the next BaseObject::groupId_. Value increased by one each time a groupId is assigned. Default group is 0 More...
 
DPMBaseDPMBase_
 A pointer back to the DPMBase class. More...
 

Detailed Description

template<typename T>
class BaseHandler< T >

Container to store the pointers to all objects that one creates in a simulation.

The BaseHandler allows one to create a container to store all pointer objects of a templated type T It is implemented by a (protected) vector of pointers to objects of type T. Once the container is created, the BaseHandler also provides the provision to manipulate the pointers i.e. by accessing, adding, deleting and few more operations by using its member methods.

Constructor & Destructor Documentation

◆ BaseHandler() [1/2]

template<typename T >
BaseHandler< T >::BaseHandler

Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer.

336 {
337  DPMBase_ = nullptr;
338  clear();
339  logger(DEBUG, "BaseHandler<T>::BaseHandler() finished");
340 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ DEBUG
DPMBase * DPMBase_
A pointer back to the DPMBase class.
Definition: BaseHandler.h:328
virtual void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.
Definition: BaseHandler.h:528

References DEBUG, and logger.

◆ BaseHandler() [2/2]

template<typename T >
BaseHandler< T >::BaseHandler ( const BaseHandler< T > &  BH)

Constructor that copies the objects of the given handler into itself and sets other variables to 0/nullptr.

Parameters
[in]BHA reference to the BaseHandler that has to be copied.

This is not a copy constructor! It only copies the vector objects_ from the given handler, and sets all other variables to 0/nullptr.

Todo:
Should max objects be set to the number of objects after this constructor? Maybe in copyContentsFromOtherHandler?
351 {
352  DPMBase_ = nullptr;
353  clear();
355  logger(DEBUG, "BaseHandler<T>::BaseHandler(const BaseHandler &BH) finished");
356 }
void copyContentsFromOtherHandler(const BaseHandler< T > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
Definition: BaseHandler.h:367

References DEBUG, and logger.

◆ ~BaseHandler()

template<typename T >
BaseHandler< T >::~BaseHandler
virtual

Destructor, it destructs the BaseHandler and all Object it contains.

360 {
361  clear();
362  logger(DEBUG, "BaseHandler<T>::~BaseHandler() finished");
363 }

References DEBUG, and logger.

Member Function Documentation

◆ addExistingObject()

template<class T >
void BaseHandler< T >::addExistingObject ( T *  O)
virtual

Adds an existing object to the BaseHandler without changing the id of the object.

Parameters
[in]objectA point to an existing object which already has an id given
418 {
419  objects_.push_back(O);
420  //Set the index of the particle
421  getLastObject()->setIndex(getSize() - 1);
422  //Adjust the nextId_ value
423  if (O->getId() + 1 > nextId_)
424  {
425  nextId_ = O->getId() + 1;
426  }
427 }
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:302
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
unsigned int nextId_
identifier for next object created
Definition: BaseHandler.h:313
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:634

Referenced by ParticleHandler::addExistingObject().

◆ addGhostObject()

template<class T >
void BaseHandler< T >::addGhostObject ( T *  O)
virtual

Adds a new Object to the BaseHandler. called by the to avoid increasing the id.

Todo:
mx: type the stuff here: keeps the id unique key
445 {
446  objects_.push_back(O);
447  //Set the index of the particle
448  getLastObject()->setIndex(getSize() - 1);
449 }

Referenced by ParticleHandler::addGhostObject().

◆ addObject()

template<class T >
void BaseHandler< T >::addObject ( T *  object)
virtual

Adds a new Object to the BaseHandler.

Parameters
[in]objectA pointer to the object that must be added.
432 {
433  objects_.push_back(object);
434  //Set the index of the particle
435  getLastObject()->setIndex(getSize() - 1);
436  //set the non changing particle identifier
437  getLastObject()->setId(nextId_);
438  //Update Id for next particle
439  nextId_++;
440 }

Referenced by BoundaryHandler::addObject(), CGHandler::addObject(), InteractionHandler::addObject(), ParticleHandler::addObject(), WallHandler::addObject(), DomainHandler::addObject(), and SpeciesHandler::addObject().

◆ begin() [1/2]

template<typename T >
const std::vector< T * >::iterator BaseHandler< T >::begin

Gets the begin of the iterator over all BaseBoundary in this BaseHandler.

Returns
A iterator pointing to the first Object.
698 {
699  return objects_.begin();
700 }

◆ begin() [2/2]

◆ clear()

template<typename T >
void BaseHandler< T >::clear
virtual

Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.

Delete all objects stored in objects_ and set the maximum number of objects that have been in this container to 0, and set the Id of the next object that will be added to 0.

Reimplemented in SpeciesHandler, and ParticleHandler.

529 {
530 
531  for (T* const obj : objects_)
532  {
533  delete obj;
534  }
535  objects_.clear();
536 
537  nextId_ = 0;
538  maxObjects_ = 0;
539 }
unsigned int maxObjects_
An integer to keep track of the largest number of objects ever stored in this BaseHandler.
Definition: BaseHandler.h:308

Referenced by MaserRepeatedOutInMPI2Test::actionsAfterTimeStep(), ShiftingConstantMassFlowMaserBoundarySelfTest::actionsAfterTimeStep(), ShiftingMaserBoundarySelfTest::actionsAfterTimeStep(), PolydisperseInsertionBoundarySelfTest::actionsAfterTimeStep(), ParticleHandler::clear(), SpeciesHandler::clear(), Slide::create_rough_wall(), Funnel::create_walls(), CGHandler::evaluateRestartFiles(), main(), FileReader::read(), DPMBase::read(), DPMBase::readNextFStatFile(), CSCWalls::saveWalls(), multiParticleT1::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), PeriodicBounaryEnteringMPIDomainTest::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), StressStrainControl::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), Chutebelt::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), HertzianBSHPInteractionTwoParticleElasticCollision::setupInitialConditions(), LiquidMigrationSelfTest::setupInitialConditions(), DPM::setupInitialConditions(), TwoBondedParticleElasticCollision::setupInitialConditions(), TwoParticleElasticCollisionInteraction::setupInitialConditions(), TwoParticleElasticCollision::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), ParticleWallInteraction::setupInitialConditions(), ArcWallUnitTest::setupInitialConditions(), MD_demo::setupInitialConditions(), MpiMaserChuteTest::setupInitialConditions(), MultiParticlesInsertion::setupInitialConditions(), and ChuteBottom::setupInitialConditions().

◆ copyAndAddGhostObject() [1/2]

template<class T >
template<class U >
std::enable_if<!std::is_pointer< U >::value, U * >::type BaseHandler< T >::copyAndAddGhostObject ( const U &  object)

Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case.

Parameters
[in]objectA reference to the BaseHandler of which the objects have to be copied.
400 {
401  U* oCopy = object.copy();
402  addGhostObject(oCopy);
403  return oCopy;
404 }
virtual void addGhostObject(T *O)
Adds a new Object to the BaseHandler. called by the to avoid increasing the id.
Definition: BaseHandler.h:444

◆ copyAndAddGhostObject() [2/2]

template<class T >
template<class U >
std::enable_if< std::is_pointer< U >::value, U >::type BaseHandler< T >::copyAndAddGhostObject ( const U  object)

Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case.

Parameters
[in]objectA reference to the Object that has to be copied.
411 {
412  return copyAndAddGhostObject(*object);
413 }
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddGhostObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi part...
Definition: BaseHandler.h:399

◆ copyAndAddObject() [1/2]

template<typename T >
template<typename U >
std::enable_if<!std::is_pointer< U >::value, U * >::type BaseHandler< T >::copyAndAddObject ( const U &  object)

Creates a copy of a Object and adds it to the BaseHandler.

Parameters
[in]objectA reference to the BaseHandler of which the objects have to be copied.
380 {
381  U* oCopy = object.copy();
382  addObject(oCopy);
383  return oCopy;
384 }
virtual void addObject(T *object)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:431

References addObject().

Referenced by GranuHeap::actionsAfterTimeStep(), ShiftingConstantMassFlowMaserBoundarySelfTest::actionsAfterTimeStep(), ShiftingMaserBoundarySelfTest::actionsAfterTimeStep(), Chutebelt::actionsAfterTimeStep(), SmoothChute::actionsBeforeTimeStep(), Chutebelt::actionsOnRestart(), ChutePeriodic::add_flow_particles(), SilbertPeriodic::add_flow_particles(), NautaMixer::addBaseWall(), VerticalMixerStraightBlades::addBlades(), VerticalMixerAngledBlades::addBlades(), NautaMixer::addConeWall(), Chute::addFlowParticlesCompactly(), ChuteWithHopper::addHopper(), NautaMixer::addParticles(), NautaMixer::addParticlesAtWall(), ConstantMassFlowMaserBoundary::addParticleToMaser(), SubcriticalMaserBoundary::addParticleToMaser(), VerticalMixerAngledBlades::addPrettyBlades(), NautaMixer::addScrew(), NautaMixer::addSpeciesAndSetTimeStepAndSaveCount(), NautaMixer::addTopWall(), AngledPeriodicBoundarySecondUnitTest::AngledPeriodicBoundarySecondUnitTest(), AngledPeriodicBoundaryUnitTest::AngledPeriodicBoundaryUnitTest(), AngleOfRepose::AngleOfRepose(), AreaVTK::AreaVTK(), BouncingSuperQuadric::BouncingSuperQuadric(), BoundariesSelfTest::BoundariesSelfTest(), CGBasicSelfTest::CGBasicSelfTest(), ChuteWithPeriodicInflow::Check_and_Duplicate_Periodic_Particle(), InsertionBoundary::checkBoundaryBeforeTimeStep(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), ChutePeriodicDemo::ChutePeriodicDemo(), ClosedCSCWalls::ClosedCSCWalls(), MercuryLogo::constructTextAsParticles(), Contact::Contact(), Funnel::create_funnel(), Slide::create_rough_wall(), Funnel::create_walls(), AngleOfRepose::createBaseSpecies(), SilbertPeriodic::createBaseSpecies(), Chute::createBottom(), CurvyChute::createBottom(), ParameterStudy1DDemo::createSpecies(), ParameterStudy2DDemo::createSpecies(), ParameterStudy3DDemo::createSpecies(), MercuryProblem::createTriangleWall(), Membrane::createVertexParticles(), CSCWalls::CSCWalls(), DPM::DPM(), FluxAndPeriodicBoundarySelfTest::FluxAndPeriodicBoundarySelfTest(), FluxBoundarySelfTest::FluxBoundarySelfTest(), ForceLawsMPI2Test::ForceLawsMPI2Test(), GranuDrum::GranuDrum(), GranuHeap::GranuHeap(), Hertzian2DUnitTest::Hertzian2DUnitTest(), HertzianSinterForceUnitTest::HertzianSinterForceUnitTest(), DPMBase::importParticlesAs(), inflowFromPeriodic::inflowFromPeriodic(), InitialConditions< SpeciesType >::InitialConditions(), MembraneDemo::initializeSpecies(), MembraneSelfTest::initializeSpecies(), InsertionBoundaryMPI2Test::InsertionBoundaryMPI2Test(), InsertionBoundarySelfTest::InsertionBoundarySelfTest(), HorizontalMixer::introduceParticlesAtWall(), ContactDetectionIntersectionOfWallsTest::introduceParticlesAtWall(), HorizontalMixer::introduceParticlesInDomain(), HorizontalMixer::introduceSingleParticle(), LawinenBox::LawinenBox(), LeesEdwardsDemo::LeesEdwardsDemo(), LiquidMigrationMPI2Test::LiquidMigrationMPI2Test(), load(), main(), MarbleRun::MarbleRun(), MaserRepeatedOutInMPI2Test::MaserRepeatedOutInMPI2Test(), MercuryCGSelfTest::MercuryCGSelfTest(), MinimalExampleDrum::MinimalExampleDrum(), MovingIntersectionOfWallsUnitTest_Basic::MovingIntersectionOfWallsUnitTest_Basic(), MovingWall::MovingWall(), MultiParticlesInsertion::MultiParticlesInsertion(), ParticleBeam::ParticleBeam(), ParticleCreation::ParticleCreation(), ParticleInclusion::ParticleInclusion(), BaseCluster::particleInsertionSuccessful(), ParticleParticleCollision::ParticleParticleCollision(), PlasticForceUnitTest::PlasticForceUnitTest(), protectiveWall::protectiveWall(), FileReader::read(), DPMBase::readNextDataFile(), DPMBase::readNextFStatFile(), DPMBase::readParAndIniFiles(), regimeForceUnitTest::regimeForceUnitTest(), CGHandler::restart(), runFreeFall(), Cstatic2d::set_particle_properties(), Cstatic3D::set_particle_properties(), ContractionWithPeriodicInflow::set_symmetric_contraction(), ChuteWithPeriodicInflowAndContraction::set_symmetric_contraction(), ChuteWithContraction::set_symmetric_contraction(), Slide::set_Walls(), setCGHandler(), AxisymmetricWallSelfTest::setGeometry(), MercuryOS::setMaterialProperties(), HorizontalMixer::setOuterWalls(), HorizontalMixerWalls::setOuterWalls(), HorizontalMixer::setScrewCore(), HorizontalMixerWalls::setScrewCore(), HorizontalMixer::setScrewWalls(), BaseCluster::setSpecies(), Calibration::setSpecies(), Material::setSpecies(), AxisymmetricWallSelfTest::setSpeciesAndTimeStep(), MercuryProblem::setSpeciesProperties(), ChutePeriodic::setup(), ExtremeOverlapUnitTest::setupInitialConditions(), ExtremeOverlapVolumeUnitTest::setupInitialConditions(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), multiParticleT1::setupInitialConditions(), NozzleDemo::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), VerticalMixer::setupInitialConditions(), MembraneDemo::setupInitialConditions(), Binary::setupInitialConditions(), my_problem::setupInitialConditions(), Chain::setupInitialConditions(), ForceLawsMPI2Test::setupInitialConditions(), InsertionBoundaryMPI2Test::setupInitialConditions(), LiquidMigrationMPI2Test::setupInitialConditions(), MaserRepeatedOutInMPI2Test::setupInitialConditions(), PeriodicBounaryEnteringMPIDomainTest::setupInitialConditions(), SubcriticalMaserBoundaryTESTMPI2Test::setupInitialConditions(), TwoByTwoMPIDomainMPI4Test::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), MinimalExampleDrum::setupInitialConditions(), ParameterStudy1DDemo::setupInitialConditions(), ParameterStudy2DDemo::setupInitialConditions(), ParameterStudy3DDemo::setupInitialConditions(), StressStrainControl::setupInitialConditions(), ShiftingConstantMassFlowMaserBoundarySelfTest::setupInitialConditions(), ShiftingMaserBoundarySelfTest::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), FiveParticles::setupInitialConditions(), Cstatic2d::setupInitialConditions(), Cstatic3D::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), MyCoil::setupInitialConditions(), Nurbs::setupInitialConditions(), Polygon::setupInitialConditions(), Drum::setupInitialConditions(), HertzSelfTest::setupInitialConditions(), MindlinSelfTest::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), Chutebelt::setupInitialConditions(), ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), CubeDeletionBoundarySelfTest::setupInitialConditions(), DeletionBoundarySelfTest::setupInitialConditions(), DistributionSelfTest::setupInitialConditions(), DistributionToPSDSelfTest::setupInitialConditions(), InsertionBoundarySelfTest::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), MultiplePSDSelfTest::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), clumpTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), PSDManualInsertionSelfTest::setupInitialConditions(), PSDSelfTest::setupInitialConditions(), SubcriticalMaserBoundarySelfTest::setupInitialConditions(), CGBasicSelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), CGStaticBalanceSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), NewtonsCradleSelfTest::setupInitialConditions(), SquarePacking::setupInitialConditions(), DPM::setupInitialConditions(), ParticleCreation::setupInitialConditions(), ChargedBondedInteractionSelfTest::setupInitialConditions(), ParticleParticleCollision::setupInitialConditions(), WallParticleCollision::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), FreeFallInteractionSelfTest::setupInitialConditions(), FreeFallSelfTest::setupInitialConditions(), HertzianBSHPInteractionTwoParticleElasticCollision::setupInitialConditions(), LiquidMigrationSelfTest::setupInitialConditions(), ObliqueImpactSelfTest::setupInitialConditions(), TwoBondedParticleElasticCollision::setupInitialConditions(), TwoParticleElasticCollisionInteraction::setupInitialConditions(), TwoParticleElasticCollision::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), ContactDetectionIntersectionOfWallsTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), MembraneSelfTest::setupInitialConditions(), RollingOverTriangleWalls::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), TriangulatedStepSelfTest::setupInitialConditions(), TriangulatedStepWallSelfTest::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), UnionOfWalls::setupInitialConditions(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), ScalingTestInitialConditionsRelax::setupInitialConditions(), ScalingTestRun::setupInitialConditions(), Contact::setupInitialConditions(), Wall::setupInitialConditions(), BouncingSuperQuadric::setupInitialConditions(), EllipsoidsBouncingOnWallDemo::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), GranularCollapse::setupInitialConditions(), SlidingSpheresUnitTest::setupInitialConditions(), SphericalSuperQuadricCollision::setupInitialConditions(), ContactDetectionNormalSpheresTest::setupInitialConditions(), ContactDetectionRotatedSpheresTest::setupInitialConditions(), ShapesDemo::setupInitialConditions(), VisualisationTest::setupInitialConditions(), MercuryProblem::setupInitialConditions(), protectiveWall::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial1::setupInitialConditions(), Tutorial2::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial5::setupInitialConditions(), Tutorial6::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), Tutorial9::setupInitialConditions(), ParticleParticleInteraction::setupInitialConditions(), ParticleParticleInteractionWithPlasticForces::setupInitialConditions(), ParticleWallInteraction::setupInitialConditions(), AngledPeriodicBoundarySecondUnitTest::setupInitialConditions(), AngledPeriodicBoundaryUnitTest::setupInitialConditions(), ArcWallUnitTest::setupInitialConditions(), Packing::setupInitialConditions(), CreateDataAndFStatFiles::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), DrivenParticleClass::setupInitialConditions(), EnergyUnitTest::setupInitialConditions(), EvaporationAndHeatTest::setupInitialConditions(), ExtremeOverlapWithWallsUnitTest::setupInitialConditions(), RandomClusterInsertionBoundarySelfTest::setupInitialConditions(), FreeFallHertzMindlinUnitTest::setupInitialConditions(), FreeFall::setupInitialConditions(), FullRestartTest::setupInitialConditions(), HertzContactRestitutionUnitTest::setupInitialConditions(), HertzianSinterForceUnitTest::setupInitialConditions(), MD_demo::setupInitialConditions(), InclinedPlane::setupInitialConditions(), MpiMaserChuteTest::setupInitialConditions(), MovingIntersectionOfWallsUnitTest_Basic::setupInitialConditions(), MovingWalls::setupInitialConditions(), MultiParticlesInsertion::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), PeriodicWalls::setupInitialConditions(), PeriodicWallsWithSlidingFrictionUnitTest::setupInitialConditions(), PlasticForceUnitTest::setupInitialConditions(), SaveCountUnitTest::setupInitialConditions(), SeparateFilesSelfTest::setupInitialConditions(), SinterForceUnitTest::setupInitialConditions(), SpeciesTest::setupInitialConditions(), TangentialSpringEnergyConservationUnitTest::setupInitialConditions(), TangentialSpringUnitTest::setupInitialConditions(), WallSpecies::setupInitialConditions(), AreaVTK::setupInitialConditions(), Chute::setupInitialConditions(), ChuteBottom::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), ContactDetectionWithWallTester::setupParticleAndWall(), ContactDetectionTester::setupParticles(), Chute::setupSideWalls(), Siegen::Siegen(), SilbertPeriodic::SilbertPeriodic(), SingleParticle< SpeciesType >::SingleParticle(), SinterPair::SinterPair(), Slide::Slide(), StressStrainControl::StressStrainControl(), FlowFrontChute::stretch(), SubcriticalMaserBoundaryTESTMPI2Test::SubcriticalMaserBoundaryTESTMPI2Test(), T_protectiveWall::T_protectiveWall(), TangentialSpringEnergyConservationUnitTest::TangentialSpringEnergyConservationUnitTest(), InertiaTensorTester::test(), VolumeTest::test(), Packing::test(), TimeDependentPeriodicBoundary3DSelfTest::TimeDependentPeriodicBoundary3DSelfTest(), TimeDependentPeriodicBoundaryTest::TimeDependentPeriodicBoundaryTest(), TriangulatedScrewSelfTest::TriangulatedScrewSelfTest(), TriangulatedStepSelfTest::TriangulatedStepSelfTest(), TriangulatedWallSelfTest::TriangulatedWallSelfTest(), TwoByTwoMPIDomainMPI4Test::TwoByTwoMPIDomainMPI4Test(), viscoElasticUnitTest::viscoElasticUnitTest(), and Wall::Wall().

◆ copyAndAddObject() [2/2]

template<typename T >
template<typename U >
std::enable_if< std::is_pointer< U >::value, U >::type BaseHandler< T >::copyAndAddObject ( const U  object)

Creates a copy of a Object and adds it to the BaseHandler.

Parameters
[in]objectA reference to the Object that has to be copied.
391 {
392  return copyAndAddObject(*object);
393 }
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

◆ copyContentsFromOtherHandler()

template<typename T >
void BaseHandler< T >::copyContentsFromOtherHandler ( const BaseHandler< T > &  BH)

Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handler (container) to the other.

Parameters
[in]BHA reference to the BaseHandler of which the objects have to be copied.
368 {
369  for (const T* const obj : BH.objects_)
370  {
371  addObject(obj->copy());
372  }
373 }

References addObject(), and BaseHandler< T >::objects_.

◆ end() [1/2]

template<typename T >
const std::vector< T * >::iterator BaseHandler< T >::end

Gets the end of the iterator over all BaseBoundary in this BaseHandler.

Returns
An iterator pointing to the last BaseBoundary.
712 {
713  return objects_.end();
714 }

◆ end() [2/2]

◆ getDPMBase() [1/2]

template<typename T >
DPMBase * BaseHandler< T >::getDPMBase

Gets the problem that is solved using this handler.

Returns
A pointer to the DPMBase (problem descriptor) that is using this handler.
726 {
727  return DPMBase_;
728 }

Referenced by HeatFluidCoupledSpecies< NormalForceSpecies >::actionsAfterTimeStep(), DropletBoundary::actionsBeforeTimeLoop(), ConstantMassFlowMaserBoundary::activateMaser(), SubcriticalMaserBoundary::activateMaser(), SubcriticalMaserBoundaryTEST::activateMaser(), StressStrainControlBoundary::activateStrainRateControl(), BaseWall::addParticlesAtWall(), ConstantMassFlowMaserBoundary::addParticleToMaser(), SubcriticalMaserBoundary::addParticleToMaser(), CGHandler::CGHandler(), DeletionBoundary::checkBoundaryAfterParticleMoved(), HeaterBoundary::checkBoundaryAfterParticleMoved(), DropletBoundary::checkBoundaryAfterParticlesMove(), PeriodicBoundary::checkBoundaryAfterParticlesMove(), TimeDependentPeriodicBoundary::checkBoundaryAfterParticlesMove(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), SlidingFrictionInteraction::computeSlidingSpring(), SlidingFrictionInteraction::computeSlidingSpringSuperQuadric(), StressStrainControlBoundary::computeStrainRate(), StressStrainControlBoundary::computeStressError(), WearableNurbsWall::computeWear(), WearableTriangleMeshWall::computeWear(), WearableTriangulatedWall::computeWear(), copyDataFromMPIParticleToParticle(), SubcriticalMaserBoundaryTEST::copyExtraParticles(), PeriodicBoundary::createGhostParticle(), TimeDependentPeriodicBoundary::createGhostParticle(), InfiniteWall::createVTK(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), SubcriticalMaserBoundaryTEST::extendBottom(), Domain::finaliseBoundaryDataTransmission(), BaseInteraction::gatherContactStatistics(), WallDetailsVTKWriter::generateFileName(), LeesEdwardsBoundary::getCurrentShift(), LeesEdwardsBoundary::getCurrentVelocity(), HorizontalBaseScrew::getDistanceAndNormal(), NurbsWall::getDistanceAndNormal(), Screw::getDistanceAndNormal(), IntersectionOfWalls::getDistanceAndNormal(), BaseParticle::getParticleDimensions(), BaseParticle::getPeriodicComplexity(), ParticleSpecies::getVolumeFromRadius(), BaseParticle::integrateBeforeForceComputation(), ClumpParticle::integrateBeforeForceComputation(), CGHandler::operator=(), WallHandler::operator=(), ParticleHandler::ParticleHandler(), Domain::performBoundaryDataTransmission(), Domain::processReceivedBoundaryParticleData(), Domain::processReceivedInteractionData(), ConstantMassFlowMaserBoundary::read(), InsertionBoundary::read(), SubcriticalMaserBoundary::read(), BaseWall::renderWall(), MeshTriangle::retrieveVertexParticles(), Screw::rotate(), StressStrainControlBoundary::set(), Domain::setBounds(), ParticleSpecies::setDensity(), MeshTriangle::setHandler(), BaseParticle::setIndSpecies(), BaseParticle::setPeriodicComplexity(), Domain::setRange(), BaseParticle::setSpecies(), BaseWall::setSpecies(), ShearBoxBoundary::shiftHorizontalPosition(), LeesEdwardsBoundary::shiftVerticalPosition(), SpeciesHandler::SpeciesHandler(), StressStrainControlBoundary::updateDomainSize(), Domain::updateParticlePosition(), Domain::updateParticles(), WallHandler::WallHandler(), LeesEdwardsBoundary::write(), BaseInteraction::writeInteraction(), AxisymmetricIntersectionOfWalls::writeVTK(), HorizontalBaseScrew::writeVTK(), IntersectionOfWalls::writeVTK(), ScrewsymmetricIntersectionOfWalls::writeVTK(), SphericalParticleVtkWriter::writeVTKAngularVelocity(), and BaseInteraction::~BaseInteraction().

◆ getDPMBase() [2/2]

template<typename T >
DPMBase * BaseHandler< T >::getDPMBase

Gets the problem that is solved using this handler and does not change the class.

Returns
A pointer to the DPMBase (problem descriptor) that is using this handler.
733 {
734  return DPMBase_;
735 }

◆ getLastObject() [1/2]

template<typename T >
T * BaseHandler< T >::getLastObject

Gets a pointer to the last Object in this BaseHandler.

Returns
A pointer to the last Object in the BaseHandler.
635 {
636  return objects_.back();
637 }

Referenced by DPM::actionsAfterSolve(), ForceLawsMPI2Test::actionsAfterSolve(), HourGlass2D::actionsAfterTimeStep(), HourGlass::actionsAfterTimeStep(), ShiftingConstantMassFlowMaserBoundarySelfTest::actionsAfterTimeStep(), ShiftingMaserBoundarySelfTest::actionsAfterTimeStep(), DPM::actionsAfterTimeStep(), GranularCollapse::actionsAfterTimeStep(), MercuryProblem::actionsAfterTimeStep(), Tutorial11::actionsAfterTimeStep(), DropletBoundary::actionsBeforeTimeLoop(), DPM::actionsBeforeTimeStep(), ForceLawsMPI2Test::actionsBeforeTimeStep(), ConstantRestitutionSelfTest::actionsBeforeTimeStep(), SilbertPeriodic::add_flow_particles(), NautaMixer::addBaseWall(), NautaMixer::addConeWall(), ChuteWithPeriodicInflow::AddContinuingBottom(), addObject(), NautaMixer::addScrew(), NautaMixer::addTopWall(), ChuteWithPeriodicInflow::Check_and_Duplicate_Periodic_Particle(), ChuteWithContraction::ChuteWithContraction(), ChuteWithPeriodicInflowAndContinuingBottom::ChuteWithPeriodicInflowAndContinuingBottom(), ChuteWithPeriodicInflowAndContraction::ChuteWithPeriodicInflowAndContraction(), ChuteWithPeriodicInflowAndVariableBottom::ChuteWithPeriodicInflowAndVariableBottom(), commandLineCG(), ScalingTestInitialConditionsRelax::continueSolve(), ContractionWithPeriodicInflow::ContractionWithPeriodicInflow(), LeesEdwardsBoundary::createVerticalPeriodicParticle(), ShearBoxBoundary::createVerticalPeriodicParticle(), ChuteWithPeriodicInflow::ExtendInWidth(), DPMBase::fillDomainWithParticles(), ChuteWithPeriodicInflow::integrateBeforeForceComputation(), MarbleRun::loadBigSeesaw(), MarbleRun::loadSmallSeesaw(), MarbleRun::loadSTLFile(), main(), MercuryCGSelfTest::MercuryCGSelfTest(), MovingWalls::MovingWalls(), ParticleBeam::ParticleBeam(), ShearStage::printTime(), ForceLawsMPI2Test::printTime(), ParticleInclusion::printTime(), CubeDeletionBoundarySelfTest::printTime(), DeletionBoundarySelfTest::printTime(), SinterPair::printTime(), EvaporationAndHeatTest::printTime(), Domain::processReceivedBoundaryParticleData(), PeriodicBoundaryHandler::processReceivedGhostParticleData(), DPMBase::readNextFStatFile(), AxisymmetricWallSelfTest::setGeometry(), LawinenBox::setupInitialConditions(), ForceLawsMPI2Test::setupInitialConditions(), InsertionBoundaryMPI2Test::setupInitialConditions(), LiquidMigrationMPI2Test::setupInitialConditions(), MaserRepeatedOutInMPI2Test::setupInitialConditions(), SubcriticalMaserBoundaryTESTMPI2Test::setupInitialConditions(), TwoByTwoMPIDomainMPI4Test::setupInitialConditions(), ShiftingConstantMassFlowMaserBoundarySelfTest::setupInitialConditions(), ShiftingMaserBoundarySelfTest::setupInitialConditions(), MyCoil::setupInitialConditions(), Nurbs::setupInitialConditions(), Polygon::setupInitialConditions(), Silo::setupInitialConditions(), SubcriticalMaserBoundarySelfTest::setupInitialConditions(), CGBasicSelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), CGStaticBalanceSelfTest::setupInitialConditions(), FreeFallInteractionSelfTest::setupInitialConditions(), AxisymmetricWallSelfTest::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), TriangulatedStepSelfTest::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), SphericalIndenter::setupInitialConditions(), ScalingTestRun::setupInitialConditions(), ShapesDemo::setupInitialConditions(), MercuryProblem::setupInitialConditions(), ShearStage::ShearStage(), StressStrainControl::StressStrainControl(), Penetration::writeEneTimeStep(), SingleParticle< SpeciesType >::writeEneTimeStep(), SlidingFrictionUnitTest::writeEneTimeStep(), ParticleVtkWriter::writeExtraFields(), and InteractionVTKWriter::writeVTKPointData().

◆ getLastObject() [2/2]

template<typename T >
const T * BaseHandler< T >::getLastObject

Gets a constant pointer to the last Object in this BaseHandler.

Returns
A constant pointer to the last Object in the BaseHandler.
642 {
643  return objects_.back();
644 }

◆ getName()

template<typename T >
virtual std::string BaseHandler< T >::getName ( ) const
pure virtual

Gets the name of this handler.

Returns
A string that contains the name of the handler.

Implemented in SpeciesHandler, PeriodicBoundaryHandler, ParticleHandler, InteractionHandler, WallHandler, DomainHandler, CGHandler, and BoundaryHandler.

◆ getNextGroupId()

template<typename T >
unsigned BaseHandler< T >::getNextGroupId ( )
inline

Should be called each time you assign a groupId. Returns the value of nextGroupId_ and increases nextGroupId_ by one.

293 { return nextGroupId_++; }
unsigned nextGroupId_
value of the next BaseObject::groupId_. Value increased by one each time a groupId is assigned....
Definition: BaseHandler.h:320

References BaseHandler< T >::nextGroupId_.

Referenced by FixedClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), and RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep().

◆ getNextId()

template<typename T >
unsigned int BaseHandler< T >::getNextId ( )
inline

◆ getNumberOfObjects()

◆ getObject() [1/2]

template<typename T >
T * BaseHandler< T >::getObject ( const unsigned int  index)

Gets a pointer to the Object at the specified index in the BaseHandler.

Parameters
[in]indexthe index of the requested Object.
Returns
A pointer to the requested Object.
614 {
615  logger.assert_debug(index < getSize(),
616  "[%::getObject()] Object couldn't be found because index (%) is higher than number of objects (%).",
617  getName(), index, getSize());
618  return objects_[index];
619 }
virtual std::string getName() const =0
Gets the name of this handler.

References getName(), and logger.

Referenced by SphericalSuperQuadricCollision::actionsAfterSolve(), SpeciesTest::actionsAfterSolve(), RotatingDrumWet::actionsAfterTimeStep(), T_protectiveWall::actionsAfterTimeStep(), BouncingSuperQuadric::actionsAfterTimeStep(), SlidingSpheresUnitTest::actionsAfterTimeStep(), SphericalSuperQuadricCollision::actionsAfterTimeStep(), ContactDetectionNormalSpheresTest::actionsAfterTimeStep(), ContactDetectionRotatedSpheresTest::actionsAfterTimeStep(), protectiveWall::actionsAfterTimeStep(), DrivenParticleClass::actionsAfterTimeStep(), Slide::actionsBeforeTimeLoop(), LawinenBox::actionsBeforeTimeStep(), SmoothChute::actionsBeforeTimeStep(), AngleOfRepose::actionsBeforeTimeStep(), Slide::actionsBeforeTimeStep(), Chutebelt::actionsBeforeTimeStep(), DrumRot::actionsBeforeTimeStep(), RotatingDrum::actionsBeforeTimeStep(), Chutebelt::actionsOnRestart(), DrumRot::actionsOnRestart(), SilbertPeriodic::add_flow_particles(), ChuteWithPeriodicInflow::AddContinuingBottom(), ChuteWithHopper::addHopper(), NautaMixer::addParticles(), NautaMixer::addParticlesAtWall(), statistics_while_running< T >::auto_set_domain(), statistics_while_running< T >::auto_set_z(), BaseCluster::calculateTimeStep(), ChuteWithPeriodicInflow::Check_and_Duplicate_Periodic_Particle(), DeletionBoundary::checkBoundaryAfterParticlesMove(), FixedClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), ChuteWithContraction::ChuteWithContraction(), ChuteWithPeriodicInflowAndContinuingBottom::ChuteWithPeriodicInflowAndContinuingBottom(), ChuteWithPeriodicInflowAndContraction::ChuteWithPeriodicInflowAndContraction(), ChuteWithPeriodicInflowAndVariableBottom::ChuteWithPeriodicInflowAndVariableBottom(), ChuteWithPeriodicInflow::cleanChute(), Funnel::cleanChute(), Chute::cleanChute(), ClosedCSCRestart::ClosedCSCRestart(), ClosedCSCRun::ClosedCSCRun(), DPMBase::computeAllForces(), Mercury3Dclump::computeAllForces(), BaseCluster::computeInternalStructure(), ContractionWithPeriodicInflow::ContractionWithPeriodicInflow(), copyDataFromMPIParticleToParticle(), ChutePeriodic::create_inflow_particle(), FlowRule::create_inflow_particle(), SilbertPeriodic::create_inflow_particle(), Slide::create_rough_wall(), AngleOfRepose::createBaseSpecies(), SilbertPeriodic::createBaseSpecies(), Chute::createBottom(), InteractionHandler::createEmptyInteraction(), Chute::createFlowParticle(), AngledPeriodicBoundary::createPeriodicParticles(), CircularPeriodicBoundary::createPeriodicParticles(), ConstantMassFlowMaserBoundary::createPeriodicParticles(), LeesEdwardsBoundary::createPeriodicParticles(), PeriodicBoundary::createPeriodicParticles(), SubcriticalMaserBoundary::createPeriodicParticles(), TimeDependentPeriodicBoundary::createPeriodicParticles(), MercuryProblem::createTriangleWall(), CSCInit::CSCInit(), InteractionHandler::deleteEmptyInteraction(), ChuteWithPeriodicInflow::ExtendInWidth(), FlowRule::getDensityVariation(), ParticleParticleCollision::getRelativeVelocity(), WallParticleCollision::getRelativeVelocity(), GranuDrum::GranuDrum(), GranuHeap::GranuHeap(), DPMBase::importParticlesAs(), Indenter::Indenter(), inflowFromPeriodic::inflowFromPeriodic(), MPIContainer::initialiseMercuryMPITypes(), DPMBase::integrateAfterForceComputation(), ChuteWithPeriodicInflow::integrateBeforeForceComputation(), DPMBase::integrateBeforeForceComputation(), inflowFromPeriodic::integrateBeforeForceComputation(), HorizontalMixer::introduceParticlesAtWall(), ContactDetectionIntersectionOfWallsTest::introduceParticlesAtWall(), HorizontalMixer::introduceParticlesInDomain(), HorizontalMixer::introduceSingleParticle(), LawinenBox::LawinenBox(), main(), BaseCluster::makeDataAnalysis(), ChuteBottom::makeRoughBottom(), MercuryCGSelfTest::MercuryCGSelfTest(), MovingWall::MovingWall(), DPMBase::outputXBallsData(), ChuteWithPeriodicInflow::outputXBallsDataParticlee(), ParticleCreation::ParticleCreation(), BaseCluster::particleInsertionSuccessful(), LawinenBox::printTime(), ChuteWithPeriodicInflow::printTime(), EvaporationAndHeatTest::printTime(), FileReader::read(), ConstantMassFlowMaserBoundary::read(), InsertionBoundary::read(), SubcriticalMaserBoundary::read(), DPMBase::readNextDataFile(), DPMBase::readNextFStatFile(), DPMBase::readParAndIniFiles(), DPMBase::removeDuplicatePeriodicParticles(), CSCWalls::saveWalls(), Slide::set_Walls(), FlowRule::setDensityVariation(), DPMBase::setFixedParticles(), BaseParticle::setHandler(), BaseWall::setHandler(), BaseParticle::setIndSpecies(), BaseWall::setIndSpecies(), BaseSpecies::setInteractionDistance(), BaseCluster::setSpecies(), BaseInteractable::setSpecies(), ExtremeOverlapUnitTest::setupInitialConditions(), ExtremeOverlapVolumeUnitTest::setupInitialConditions(), SmoothChute::setupInitialConditions(), multiParticleT1::setupInitialConditions(), free_cooling::setupInitialConditions(), restart::setupInitialConditions(), HorizontalMixer::setupInitialConditions(), NozzleDemo::setupInitialConditions(), my_problem::setupInitialConditions(), MaserRepeatedOutInMPI2Test::setupInitialConditions(), PeriodicBounaryEnteringMPIDomainTest::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), MinimalExampleDrum::setupInitialConditions(), ParameterStudy1DDemo::setupInitialConditions(), ParameterStudy2DDemo::setupInitialConditions(), ParameterStudy3DDemo::setupInitialConditions(), StressStrainControl::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), FiveParticles::setupInitialConditions(), Cstatic2d::setupInitialConditions(), Cstatic3D::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), Chutebelt::setupInitialConditions(), ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), DistributionSelfTest::setupInitialConditions(), DistributionToPSDSelfTest::setupInitialConditions(), InsertionBoundarySelfTest::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), MultiplePSDSelfTest::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), clumpTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), PSDManualInsertionSelfTest::setupInitialConditions(), PSDSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), NewtonsCradleSelfTest::setupInitialConditions(), SquarePacking::setupInitialConditions(), DPM::setupInitialConditions(), ChargedBondedInteractionSelfTest::setupInitialConditions(), ParticleParticleCollision::setupInitialConditions(), WallParticleCollision::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), FreeFallSelfTest::setupInitialConditions(), HertzianBSHPInteractionTwoParticleElasticCollision::setupInitialConditions(), LiquidMigrationSelfTest::setupInitialConditions(), ObliqueImpactSelfTest::setupInitialConditions(), TwoBondedParticleElasticCollision::setupInitialConditions(), TwoParticleElasticCollisionInteraction::setupInitialConditions(), TwoParticleElasticCollision::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), ContactDetectionIntersectionOfWallsTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), ScalingTestRun::setupInitialConditions(), Contact::setupInitialConditions(), Wall::setupInitialConditions(), BouncingSuperQuadric::setupInitialConditions(), EllipsoidsBouncingOnWallDemo::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), SlidingSpheresUnitTest::setupInitialConditions(), SphericalSuperQuadricCollision::setupInitialConditions(), ContactDetectionNormalSpheresTest::setupInitialConditions(), ContactDetectionRotatedSpheresTest::setupInitialConditions(), VisualisationTest::setupInitialConditions(), MercuryProblem::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial1::setupInitialConditions(), Tutorial2::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial5::setupInitialConditions(), Tutorial6::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), Tutorial9::setupInitialConditions(), ParticleParticleInteraction::setupInitialConditions(), ParticleParticleInteractionWithPlasticForces::setupInitialConditions(), ParticleWallInteraction::setupInitialConditions(), AngledPeriodicBoundarySecondUnitTest::setupInitialConditions(), AngledPeriodicBoundaryUnitTest::setupInitialConditions(), Packing::setupInitialConditions(), CreateDataAndFStatFiles::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), DrivenParticleClass::setupInitialConditions(), EnergyUnitTest::setupInitialConditions(), ExtremeOverlapWithWallsUnitTest::setupInitialConditions(), RandomClusterInsertionBoundarySelfTest::setupInitialConditions(), FreeFallHertzMindlinUnitTest::setupInitialConditions(), FreeFall::setupInitialConditions(), FullRestartTest::setupInitialConditions(), HertzContactRestitutionUnitTest::setupInitialConditions(), HertzianSinterForceUnitTest::setupInitialConditions(), MD_demo::setupInitialConditions(), InclinedPlane::setupInitialConditions(), MpiMaserChuteTest::setupInitialConditions(), MovingIntersectionOfWallsUnitTest_Basic::setupInitialConditions(), MovingWalls::setupInitialConditions(), MovingWallTangential::setupInitialConditions(), MultiParticlesInsertion::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), PeriodicWalls::setupInitialConditions(), PeriodicWallsWithSlidingFrictionUnitTest::setupInitialConditions(), PlasticForceUnitTest::setupInitialConditions(), SeparateFilesSelfTest::setupInitialConditions(), SinterForceUnitTest::setupInitialConditions(), SpeciesTest::setupInitialConditions(), TangentialSpringEnergyConservationUnitTest::setupInitialConditions(), TangentialSpringUnitTest::setupInitialConditions(), WallSpecies::setupInitialConditions(), Chute::setupInitialConditions(), ChuteBottom::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), ContactDetectionWithWallTester::setupParticleAndWall(), ContactDetectionTester::setupParticles(), Chute::setupSideWalls(), Sintering::Sintering(), Slide::Slide(), statistics_while_running< T >::statistics_while_running(), FlowFrontChute::stretch(), ContactDetectionNormalSpheresTest::test(), HertzContactRestitutionUnitTest::test(), testCGHandler(), Domain::updateParticles(), DPMBase::write(), LawinenBox::writeEneTimeStep(), Slide::writeEneTimeStep(), SingleParticle< SpeciesType >::writeEneTimeStep(), and BaseCluster::writeToOverlFile().

◆ getObject() [2/2]

template<typename T >
const T * BaseHandler< T >::getObject ( const unsigned int  index) const

Gets a constant pointer to the Object at the specified index in the BaseHandler.

Parameters
[in]indexthe index of the requested Object.
Returns
A constant pointer to the requested Object.
625 {
626  logger.assert_debug(index < getSize(),
627  "[%::getObject() const] Object couldn't be found because index (%) is higher than number of objects (%).",
628  getName(), index, getSize());
629  return objects_[index];
630 }

References getName(), and logger.

◆ getObjectById()

template<typename T >
T * BaseHandler< T >::getObjectById ( const unsigned int  id)

Gets a pointer to the Object at the specified index in the BaseHandler.

Parameters
[in]idThe id of the requested Object.
Returns
A pointer to the Object with the correct Id.
Gets an object with the identity id. Please note that the object with this identity does not have to be at place id in the vector of Object objects_.
566 {
567  // Usually, the id and the index into the backing storage matches
568  // So check this position first!
569  // dducks: Can't we guarantee more? That should speed up searches.
570  if (id < objects_.size() && objects_[id]->getId() == id)
571  {
572  return objects_[id]; //There is a hit, return early
573  }
574 
575  for (T* obj : objects_) //Search for the correct id, since it wasn't where
576  { // we expected it. Just use a linear search..
577  if (obj->getId() == id) //Found it, so return!
578  return obj;
579  }
580 #ifndef MERCURYDPM_USE_MPI
581  logger(ERROR, "[BaseHandler::getObjectById()] in Object* %: Object with ID % could not be found.", getName(), id);
582 #endif
583  return nullptr;
584 }
@ ERROR

References ERROR, getName(), and logger.

Referenced by HertzianBSHPInteractionTwoParticleElasticCollision::actionsAfterSolve(), Membrane::buildMesh(), MeshTriangle::checkInteractions(), Membrane::initializeEdgeBendingQuantities(), PeriodicBoundaryHandler::processLocalInteractionData(), PeriodicBoundaryHandler::processReceivedInteractionData(), Domain::processReceivedInteractionData(), FileReader::read(), Membrane::read(), MembraneDemo::read(), MembraneSelfTest::read(), MeshTriangle::retrieveVertexParticles(), and Membrane::saveVertexPositions().

◆ getObjectsById()

template<typename T >
std::vector< T * > BaseHandler< T >::getObjectsById ( const unsigned int  id)

Gets a vector of pointers to the objects with the specific id.

Gets all the objects with the id from the handler. This is especially useful in parallel where ghost particles of a real particle have the same id

Parameters
[in]idThe id of the requested objects.
Returns
A list of pointers towards objects with the specified id
594 {
595  std::vector<T*> list;
596  for (T* obj : objects_)
597  {
598  if (obj->getId() == id)
599  {
600  list.push_back(obj);
601  }
602  }
603 #ifndef MERCURYDPM_USE_MPI
604  logger(ERROR, "[BaseHandler::getObjectById()] in Object* %: Object with ID % could not be found.", getName(), id);
605 #endif
606  return list;
607 
608 }

References ERROR, getName(), and logger.

Referenced by InteractionHandler::readAndAddObject().

◆ getSize()

template<class T >
unsigned int BaseHandler< T >::getSize

Gets the size of the particleHandler (including mpi and periodic particles)

Returns
The number of items in this BaseHandler
656 {
657  return objects_.size();
658 }

Referenced by ForceLawsMPI2Test::actionsAfterSolve(), RotatingDrumWet::actionsAfterTimeStep(), PolydisperseInsertionBoundarySelfTest::actionsAfterTimeStep(), ForceLawsMPI2Test::actionsBeforeTimeStep(), ConstantRestitutionSelfTest::actionsBeforeTimeStep(), ChutePeriodic::add_flow_particles(), Chute::addFlowParticlesCompactly(), BaseWall::addParticlesAtWall(), DeletionBoundary::checkBoundaryAfterParticlesMove(), FixedClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), DPMBase::computeAllForces(), Mercury3Dclump::computeAllForces(), BaseCluster::createAdjacencyMatrix(), AngledPeriodicBoundary::createPeriodicParticles(), CircularPeriodicBoundary::createPeriodicParticles(), ConstantMassFlowMaserBoundary::createPeriodicParticles(), LeesEdwardsBoundary::createPeriodicParticles(), PeriodicBoundary::createPeriodicParticles(), SubcriticalMaserBoundary::createPeriodicParticles(), TimeDependentPeriodicBoundary::createPeriodicParticles(), DPMBase::decompose(), DPMBase::deleteGhostParticles(), CGHandler::evaluateDataFiles(), CGHandler::evaluateRestartFiles(), DPMBase::fillDomainWithParticles(), MercuryBase::getHGridTargetMaxInteractionRadius(), MercuryBase::getHGridTargetMinInteractionRadius(), MercuryBase::getHGridTargetNumberOfBuckets(), BaseParticle::getPeriodicComplexity(), WallVTKWriter::getVTKData(), GranuHeap::GranuHeap(), MercuryBase::hGridNeedsRebuilding(), DPMBase::importParticlesAs(), HGridOptimiser::initialise(), DPMBase::insertGhostParticle(), DPMBase::integrateAfterForceComputation(), DPMBase::integrateBeforeForceComputation(), main(), BaseCluster::makeDataAnalysis(), BaseCluster::makeGnuplotFile(), DPMBase::mpiInsertParticleCheck(), DPMBase::outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), NozzleDemo::printTime(), ForceLawsMPI2Test::printTime(), CubeDeletionBoundarySelfTest::printTime(), DeletionBoundarySelfTest::printTime(), DistributionSelfTest::printTime(), DistributionToPSDSelfTest::printTime(), InsertionBoundarySelfTest::printTime(), MultiplePSDSelfTest::printTime(), NozzleSelfTest::printTime(), PolydisperseInsertionBoundarySelfTest::printTime(), PSDManualInsertionSelfTest::printTime(), PSDSelfTest::printTime(), RandomClusterInsertionBoundarySelfTest::printTime(), MultiParticlesInsertion::printTime(), BaseCluster::printTime(), DPMBase::readNextDataFile(), DPMBase::removeDuplicatePeriodicParticles(), CGHandler::restart(), DPMBase::setFixedParticles(), AxisymmetricWallSelfTest::setGeometry(), ParticleSpecies::setMaxInteractionDistance(), BaseParticle::setPeriodicComplexity(), StressStrainControl::setupInitialConditions(), Drum::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), PSDSelfTest::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), my_problem::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), BaseCluster::setupInitialConditions(), FlowFrontChute::stretch(), DPMBase::write(), BaseCluster::writeAmatFile(), ParticleVtkWriter::writeExtraFields(), SuperQuadricParticleVtkWriter::writeVTK(), and InteractionVTKWriter::writeVTKPointData().

◆ getStorageCapacity()

template<typename T >
unsigned int BaseHandler< T >::getStorageCapacity

Gets the storage capacity of this BaseHandler.

Returns
The storage capacity of this BaseHandler.
663 {
664  return objects_.capacity();
665 }

Referenced by ChuteWithPeriodicInflow::integrateBeforeForceComputation(), and SilbertPeriodic::setupInitialConditions().

◆ increaseId()

template<typename T >
void BaseHandler< T >::increaseId ( )
inline

◆ read()

template<typename T >
void BaseHandler< T >::read ( std::istream &  is)

Reads all objects from restart data.

Parameters
[in]isThe input stream from which the information is read.
544 {
545  clear();
546  unsigned int N;
547  std::string dummy;
548  is >> dummy;
549  std::stringstream line;
551  line >> N;
552  logger(VERBOSE, "In %::read(is): reading in % objects.", getName(), N);
554  for (unsigned int i = 0; i < N; i++)
555  {
556  readAndAddObject(is);
557  }
558 }
@ VERBOSE
virtual void readAndAddObject(std::istream &is)=0
Reads Object into the BaseHandler from restart data.
void setStorageCapacity(const unsigned int N)
Sets the storage capacity of this BaseHandler.
Definition: BaseHandler.h:669
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in.
Definition: StringHelpers.cc:62

References helpers::getLineFromStringStream(), getName(), constants::i, logger, and VERBOSE.

Referenced by DPMBase::read(), and DPMBase::readOld().

◆ readAndAddObject()

template<typename T >
virtual void BaseHandler< T >::readAndAddObject ( std::istream &  is)
pure virtual

Reads Object into the BaseHandler from restart data.

Parameters
[in]isThe input stream from which the information is read.

Implemented in SpeciesHandler, PeriodicBoundaryHandler, ParticleHandler, InteractionHandler, WallHandler, DomainHandler, CGHandler, and BoundaryHandler.

◆ removeIf()

template<class T >
void BaseHandler< T >::removeIf ( const std::function< bool(T *)>  cond)
454 {
455  for (int i = 0; i < objects_.size(); ++i) {
456  if (cond(objects_[i]))
457  {
458  //objects_(i)->actionsOnErase();
459  removeObject(i);
460  --i;
461  }
462  }
463 }
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:472

References constants::i.

◆ removeLastObject()

template<typename T >
void BaseHandler< T >::removeLastObject

Removes the last Object from the BaseHandler.

512 {
513  if (getSize() == 0)
514  {
515  logger(WARN, "In: void %::removeLastObject, no Object exists in this BaseHandler.", getName());
516  return;
517  }
518  T* const object = objects_.back();
519  //Remove the (now double) reference to that last Object
520  objects_.pop_back();
521  //Physically removes Object
522  delete object;
523 }
@ WARN

References getName(), logger, and WARN.

Referenced by GranuHeap::actionsAfterTimeStep(), GranularCollapse::actionsAfterTimeStep(), and ParticleHandler::removeLastObject().

◆ removeObject()

template<typename T >
void BaseHandler< T >::removeObject ( unsigned const int  index)
virtual

Removes an Object from the BaseHandler.

This methods removes an object. This methods invalidates ANY iterators to objects in this container. This method may shuffle the order of objects in this container.

Parameters
[in]indexAn unsigned integer that gives the id of the Object that has to be removed.

Reimplemented in SpeciesHandler, and ParticleHandler.

473 {
474  logger.assert_debug(index < getSize(),
475  "In: void %::removeObject(const unsigned int index) const, "
476  "no object exists with index %, number of objects is %",
477  getName(), index, getSize());
478 
479  //Removing a particle within the list is not efficient.
480  //Swap with last element and then perform the deletion
481  const unsigned int lastIndex = objects_.size() - 1;
482 
483  T* const objectToDelete = objects_[index];
484 
485  //No swapping required if it is the last object
486  if (index != lastIndex)
487  {
488 
489  T* const objectToMove = objects_[lastIndex];
490 
491  objects_[index] = objectToMove; //place it back
492  objects_[lastIndex] = objectToDelete; //Just to make sure.
493 
494  //and notify it of the change.
495  objects_[index]->moveInHandler(index);
496  //Even though we are going to delete this particle,
497  //we still need to keep it consistent.
498  objects_[lastIndex]->moveInHandler(lastIndex);
499  }
500 
501 
502  //And clear it from the backing container.
503  objects_.pop_back();
504  //And _NOW_ we delete it.
505 
506  delete objectToDelete;
507 
508 }

References getName(), and logger.

Referenced by T_protectiveWall::actionsAfterTimeStep(), LeesEdwardsDemo::actionsAfterTimeStep(), TimeDependentPeriodicBoundary3DSelfTest::actionsAfterTimeStep(), TimeDependentPeriodicBoundaryTest::actionsAfterTimeStep(), Chutebelt::actionsAfterTimeStep(), BoundariesSelfTest::actionsAfterTimeStep(), protectiveWall::actionsAfterTimeStep(), TriangleMeshWall::getInteractionWith(), SuperQuadricParticle::getInteractionWithSuperQuad(), BaseInteraction::removeFromHandler(), ParticleHandler::removeGhostObject(), ParticleHandler::removeObject(), SpeciesHandler::removeObject(), and InteractionHandler::removeObjectKeepingPeriodics().

◆ resize()

template<class T >
void BaseHandler< T >::resize ( const unsigned int  N,
const T &  obj 
)

Resizes the container to contain N elements.

If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional elements are appended and initialized with copies of obj.

Parameters
[in]NContainer resized to contain N elements.
[in]objadditional elements are appended and initialized with copies of obj.
680 {
681  //objects_.resize(N,obj); //doesn't work because the handler stores pointers only (data needs to be allocated);
682  while (getSize() < N)
683  copyAndAddObject(obj);
684  while (getSize() > N)
686 }
void removeLastObject()
Removes the last Object from the BaseHandler.
Definition: BaseHandler.h:511

◆ setDPMBase()

template<typename T >
void BaseHandler< T >::setDPMBase ( DPMBase DPMBase)

Sets the problem that is solved using this handler.

Todo:
MX: Bad practice to have a function parameter with the exact name of the class
Parameters
[in]DPMBaseA pointer to a DPMBase, which is the superclass for all problem descriptions.
719 {
720  DPMBase_ = DPMBase;
721 }
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77

Referenced by DPMBase::constructor(), DPMBase::decompose(), and DPMBase::DPMBase().

◆ setId()

template<typename T >
void BaseHandler< T >::setId ( T *  object,
unsigned int  id 
)
inline

This function sets the id and ensures that nextId is a bigger value than id.

Todo:
we should use this function only to set the id of particles, not BaseObject::setId; however, to block BaseObject::setId, I need to make this function a friend of BaseObject, and I don't know how to do that.
239  {
240  object->setId(id);
241  if (nextId_ <= id)
242  {
243  nextId_ = id + 1;
244  }
245  }

References BaseHandler< T >::nextId_.

◆ setNextId()

template<typename T >
void BaseHandler< T >::setNextId ( unsigned int  id)
inline
262  {
263  nextId_ = id;
264  }

References BaseHandler< T >::nextId_.

Referenced by PeriodicBoundaryHandler::updateParticleStatus().

◆ setStorageCapacity()

◆ writeVTK()

template<typename T >
virtual void BaseHandler< T >::writeVTK ( ) const
inlinevirtual

now empty function for writing VTK files.

Deprecated:
Now the VTK-writers have their own classes, and are called from DPMBase.
287  {};

Member Data Documentation

◆ DPMBase_

template<typename T >
DPMBase* BaseHandler< T >::DPMBase_
private

A pointer back to the DPMBase class.

Please note that this pointer back to the DPMBase class is a "shared" pointer and should not be deallocated by this class.

◆ maxObjects_

template<typename T >
unsigned int BaseHandler< T >::maxObjects_
private

An integer to keep track of the largest number of objects ever stored in this BaseHandler.

◆ nextGroupId_

template<typename T >
unsigned BaseHandler< T >::nextGroupId_ = 1
private

value of the next BaseObject::groupId_. Value increased by one each time a groupId is assigned. Default group is 0

Referenced by BaseHandler< T >::getNextGroupId().

◆ nextId_

template<typename T >
unsigned int BaseHandler< T >::nextId_
private

◆ objects_

template<typename T >
std::vector<T*> BaseHandler< T >::objects_
protected

The actual list of Object pointers.

The list of Object pointers. This handler is responsible for the memory-deallocation of these objects.

Referenced by BaseHandler< T >::copyContentsFromOtherHandler().


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