MercuryDPM
Alpha
|
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... | |
virtual void | addObject (T *object) |
Adds a new Object to the BaseHandler. More... | |
virtual void | removeObject (unsigned const int id) |
Removes an Object from 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... | |
virtual void | readObject (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... | |
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... | |
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< 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) |
This function sets the id and ensures that nextId is a bigger value than id. More... | |
DPMBase * | getDPMBase () |
Gets the problem that is solved using this handler. More... | |
DPMBase * | getDPMBase () const |
Gets the problem that is solved using this handler and does not change the class. More... | |
virtual std::string | getName () const =0 |
Gets the name of this handler. More... | |
virtual void | writeVTK () |
Over written in WallHandler and ParticleHandler. 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... | |
DPMBase * | DPMBase_ |
A pointer back to the DPMBase class. More... | |
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.
Definition at line 51 of file BaseHandler.h.
BaseHandler< T >::BaseHandler | ( | ) |
Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer.
Definition at line 251 of file BaseHandler.h.
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.
[in] | BH | A 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.
Definition at line 266 of file BaseHandler.h.
|
virtual |
Destructor, it destructs the BaseHandler and all Object it contains.
Definition at line 275 of file BaseHandler.h.
|
virtual |
Adds a new Object to the BaseHandler.
[in] | object | A pointer to the object that must be added. |
Reimplemented in WallHandler, ParticleHandler, BoundaryHandler, InteractionHandler, and SpeciesHandler.
Definition at line 313 of file BaseHandler.h.
Referenced by SpeciesHandler::addObject(), InteractionHandler::addObject(), BoundaryHandler::addObject(), ParticleHandler::addObject(), and WallHandler::addObject().
const std::vector< T * >::const_iterator BaseHandler< T >::begin | ( | ) | const |
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition at line 508 of file BaseHandler.h.
Referenced by DPMBase::broadPhase(), DPMBase::checkInteractionWithBoundaries(), HGridOptimiser::initialise(), DPMBase::integrateAfterForceComputation(), and DPMBase::integrateBeforeForceComputation().
const std::vector< T * >::iterator BaseHandler< T >::begin | ( | ) |
Gets the begin of the iterator over all BaseBoundary in this BaseHandler.
Definition at line 515 of file BaseHandler.h.
void BaseHandler< T >::clear | ( | ) |
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.
Definition at line 392 of file BaseHandler.h.
Referenced by ParticleHandler::clear(), main(), FileReader::read(), DPMBase::read(), DPMBase::readParAndIniFiles(), and ChuteBottom::setupInitialConditions().
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.
[in] | object | A reference to the BaseHandler of which the objects have to be copied. |
Definition at line 295 of file BaseHandler.h.
Referenced by ChuteWithHopper::addHopper(), MaserBoundary::addParticleToMaser(), MaserBoundary::checkBoundaryAfterParticleMoved(), InsertionBoundary::checkBoundaryBeforeTimeStep(), Chute::createBottom(), FileReader::read(), DPMBase::readNextDataFile(), DPMBase::readParAndIniFiles(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), and Chute::setupSideWalls().
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.
[in] | object | A reference to the Object that has to be copied. |
Definition at line 306 of file BaseHandler.h.
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.
[in] | BH | A reference to the BaseHandler of which the objects have to be copied. |
Definition at line 283 of file BaseHandler.h.
References BaseHandler< T >::objects_.
const std::vector< T * >::const_iterator BaseHandler< T >::end | ( | ) | const |
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition at line 522 of file BaseHandler.h.
Referenced by DPMBase::checkInteractionWithBoundaries(), HGridOptimiser::initialise(), DPMBase::integrateAfterForceComputation(), and DPMBase::integrateBeforeForceComputation().
const std::vector< T * >::iterator BaseHandler< T >::end | ( | ) |
Gets the end of the iterator over all BaseBoundary in this BaseHandler.
Definition at line 529 of file BaseHandler.h.
DPMBase * BaseHandler< T >::getDPMBase | ( | ) |
Gets the problem that is solved using this handler.
Definition at line 543 of file BaseHandler.h.
References logger.
Referenced by MaserBoundary::addParticleToMaser(), SlidingFrictionInteraction::computeFrictionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), SinterInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), InfiniteWall::createVTK(), BaseInteraction::gatherContactStatistics(), LeesEdwardsBoundary::getCurrentShift(), LeesEdwardsBoundary::getCurrentVelocity(), BaseParticle::getParticleDimensions(), ParticleSpecies::getVolumeFromRadius(), BaseParticle::integrateBeforeForceComputation(), WallHandler::operator=(), ParticleHandler::ParticleHandler(), LiquidMigrationWilletInteraction::rupture(), ParticleSpecies::setDensity(), BaseParticle::setIndSpecies(), BaseWall::setSpecies(), BaseParticle::setSpecies(), ShearBoxBoundary::shiftHorizontalPosition(), LeesEdwardsBoundary::shiftVerticalPosition(), SpeciesHandler::SpeciesHandler(), WallHandler::WallHandler(), LeesEdwardsBoundary::write(), and AxisymmetricIntersectionOfWalls::writeVTK().
DPMBase * BaseHandler< T >::getDPMBase | ( | ) | const |
Gets the problem that is solved using this handler and does not change the class.
Definition at line 551 of file BaseHandler.h.
References logger.
T * BaseHandler< T >::getLastObject | ( | ) |
Gets a pointer to the last Object in this BaseHandler.
Definition at line 473 of file BaseHandler.h.
Referenced by LeesEdwardsBoundary::createVerticalPeriodicParticles(), ShearBoxBoundary::createVerticalPeriodicParticles(), DPMBase::readNextDataFile(), and ChuteWithHopper::setupInitialConditions().
const T * BaseHandler< T >::getLastObject | ( | ) | const |
Gets a constant pointer to the last Object in this BaseHandler.
Definition at line 480 of file BaseHandler.h.
|
pure virtual |
Gets the name of this handler.
Implemented in ParticleHandler, InteractionHandler, SpeciesHandler, WallHandler, and BoundaryHandler.
unsigned int BaseHandler< T >::getNumberOfObjects | ( | ) | const |
Gets the number of Object in this BaseHandler.
Definition at line 487 of file BaseHandler.h.
Referenced by DPMBase::checkAndDuplicatePeriodicParticles(), MaserBoundary::checkBoundaryAfterParticleMoved(), DPMBase::checkParticleForInteractionLocalPeriodic(), DPMBase::checkSettings(), Chute::cleanChute(), MercuryBase::getHGridTargetMaxInteractionRadius(), MercuryBase::getHGridTargetMinInteractionRadius(), MercuryBase::getHGridTargetNumberOfBuckets(), MercuryBase::hGridNeedsRebuilding(), HGridOptimiser::initialise(), main(), DPMBase::outputXBallsData(), Chute::printTime(), FileReader::read(), DPMBase::readNextDataFile(), DPMBase::removeDuplicatePeriodicParticles(), DPMBase::setFixedParticles(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), and DPMBase::write().
T * BaseHandler< T >::getObject | ( | const unsigned int | index | ) |
Gets a pointer to the Object at the specified index in the BaseHandler.
[in] | index | the index of the requested Object. |
Definition at line 451 of file BaseHandler.h.
References logger.
Referenced by ChuteWithHopper::addHopper(), DPMBase::checkAndDuplicatePeriodicParticles(), Chute::cleanChute(), Chute::createBottom(), ChuteBottom::makeRoughBottom(), FileReader::read(), DPMBase::readNextDataFile(), WallHandler::readObject(), DPMBase::readParAndIniFiles(), DPMBase::removeDuplicatePeriodicParticles(), DPMBase::setFixedParticles(), BaseWall::setHandler(), BaseParticle::setHandler(), BaseWall::setIndSpecies(), BaseParticle::setIndSpecies(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), Chute::setupSideWalls(), and DPMBase::write().
const T * BaseHandler< T >::getObject | ( | const unsigned int | index | ) | const |
Gets a constant pointer to the Object at the specified index in the BaseHandler.
[in] | index | the index of the requested Object. |
Definition at line 463 of file BaseHandler.h.
References logger.
T * BaseHandler< T >::getObjectById | ( | const unsigned int | id | ) |
Gets a pointer to the Object at the specified index in the BaseHandler.
[in] | id | The id of the requested Object. |
Definition at line 429 of file BaseHandler.h.
Referenced by FileReader::read(), and InteractionHandler::readObject().
unsigned int BaseHandler< T >::getStorageCapacity | ( | ) | const |
Gets the storage capacity of this BaseHandler.
Definition at line 494 of file BaseHandler.h.
void BaseHandler< T >::read | ( | std::istream & | is | ) |
Reads all objects from restart data.
[in] | is | The input stream from which the information is read. |
Definition at line 407 of file BaseHandler.h.
References helpers::getLineFromStringStream(), logger, and VERBOSE.
Referenced by DPMBase::read(), and DPMBase::readOld().
|
pure virtual |
Reads Object into the BaseHandler from restart data.
[in] | is | The input stream from which the information is read. |
Implemented in ParticleHandler, WallHandler, BoundaryHandler, InteractionHandler, and SpeciesHandler.
void BaseHandler< T >::removeLastObject | ( | ) |
Removes the last Object from the BaseHandler.
Definition at line 375 of file BaseHandler.h.
Referenced by ParticleHandler::removeLastObject().
|
virtual |
Removes an Object from the BaseHandler.
This methods removes a particle. This methods invalidates ANY iterators to particles in this container. This method may shuffle the order of objects in this container.
[in] | index | An unsigned integer that gives the id of the Object that has to be removed. |
Reimplemented in ParticleHandler, and SpeciesHandler.
Definition at line 333 of file BaseHandler.h.
References logger.
Referenced by BaseInteraction::removeFromHandler(), SpeciesHandler::removeObject(), ParticleHandler::removeObject(), and InteractionHandler::removeObjectKeepingPeriodics().
void BaseHandler< T >::setDPMBase | ( | DPMBase * | DPMBase | ) |
Sets the problem that is solved using this handler.
Definition at line 536 of file BaseHandler.h.
Referenced by DPMBase::constructor(), and DPMBase::DPMBase().
|
inline |
This function sets the id and ensures that nextId is a bigger value than id.
Definition at line 189 of file BaseHandler.h.
void BaseHandler< T >::setStorageCapacity | ( | const unsigned int | N | ) |
Sets the storage capacity of this BaseHandler.
[in] | N | The storage capacity the BaseHandler will have |
Definition at line 501 of file BaseHandler.h.
Referenced by DPMBase::constructor(), ChuteBottom::makeRoughBottom(), FileReader::read(), DPMBase::read(), and ChuteBottom::setupInitialConditions().
|
inlinevirtual |
Over written in WallHandler and ParticleHandler.
Definition at line 216 of file BaseHandler.h.
|
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.
Definition at line 244 of file BaseHandler.h.
|
private |
An integer to keep track of the largest number of objects ever stored in this BaseHandler.
Definition at line 231 of file BaseHandler.h.
|
private |
identifier for next object created
Definition at line 236 of file BaseHandler.h.
Referenced by BaseHandler< BaseBoundary >::setId().
|
protected |
The actual list of Object pointers.
The list of Object pointers. This handler is responsible for the memory-deallocation of these objects.
Definition at line 216 of file BaseHandler.h.
Referenced by BaseHandler< T >::copyContentsFromOtherHandler().