|
Container that stores all CG objects. More...
#include <CGHandler.h>
Public Member Functions | |
CGHandler ()=default | |
Default constructor, creates an empty CGHandler. More... | |
CGHandler (const CGHandler &BH) | |
Copy constructor, copies the CGHandler and all BaseCGPoint's it contains. More... | |
CGHandler & | operator= (const CGHandler &rhs) |
Assignment operator that copies the pointer to the DPMBase and all objects. More... | |
~CGHandler () final=default | |
Destructor, destructs the CGHandler and all BaseCGPoint's it contains. More... | |
void | addObject (BaseCG *cg) final |
std::string | getName () const final |
void | readAndAddObject (std::istream &is) final |
Reads objects into the CGHandler from an istream (currently not implemented). More... | |
void | write (std::ostream &os) const |
Writes objects into the CGHandler to an ostream (currently not implemented). More... | |
void | initialise () |
Contains the code executed before the first time step. More... | |
void | evaluate () |
Contains the code executed at each time step. More... | |
void | finish () |
Contains the code executed after the last time step. More... | |
void | restart (std::string name) |
loads restart file, before evaluateDataFiles is run More... | |
void | restartAndEvaluateRestartFiles (const std::string &name) |
void | restartAndEvaluateDataFiles (const std::string &name, bool evaluateFStatFiles=true) |
bool | evaluateDataFiles (bool evaluateFStatFiles=true) |
does the same as StatisticsVector::statistics_from_fstat_and_data: loads a restart file (if existing), then several data files, and fstat files (if existing) More... | |
bool | evaluateRestartFiles () |
void | computeContactPoints () |
Mdouble | getTimeMin () |
Mdouble | getTimeMax () |
void | setInitialFileCounter (unsigned initialFileCounter) |
unsigned | getInitialFileCounter () const |
Public Member Functions inherited from BaseHandler< BaseCG > | |
BaseHandler () | |
Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer. More... | |
BaseHandler (const BaseHandler< BaseCG > &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< BaseCG > &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... | |
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... | |
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 (BaseCG *O) |
Adds an existing object to the BaseHandler without changing the id of the object. More... | |
virtual void | addObject (BaseCG *object) |
Adds a new Object to the BaseHandler. More... | |
virtual void | addGhostObject (BaseCG *O) |
Adds a new Object to the BaseHandler. called by the to avoid increasing the id. More... | |
void | removeIf (const std::function< bool(BaseCG *)> 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... | |
void | read (std::istream &is) |
Reads all objects from restart data. More... | |
BaseCG * | getObjectById (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
std::vector< BaseCG * > | getObjectsById (const unsigned int id) |
Gets a vector of pointers to the objects with the specific id. More... | |
BaseCG * | getObject (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
const BaseCG * | getObject (const unsigned int id) const |
Gets a constant pointer to the Object at the specified index in the BaseHandler. More... | |
BaseCG * | getLastObject () |
Gets a pointer to the last Object in this BaseHandler. More... | |
const BaseCG * | 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 BaseCG &obj) |
Resizes the container to contain N elements. More... | |
const std::vector< BaseCG * >::const_iterator | begin () const |
Gets the begin of the const_iterator over all Object in this BaseHandler. More... | |
const std::vector< BaseCG * >::iterator | begin () |
Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector< BaseCG * >::const_iterator | end () const |
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector< BaseCG * >::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 (BaseCG *object, unsigned int id) |
void | increaseId () |
unsigned int | getNextId () |
void | setNextId (unsigned int id) |
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 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... | |
Public Attributes | |
unsigned | initialFileCounter = 0 |
Additional Inherited Members | |
Protected Attributes inherited from BaseHandler< BaseCG > | |
std::vector< BaseCG * > | objects_ |
The actual list of Object pointers. More... | |
Container that stores all CG objects.
get function that by default can distinguish species, but also density
make tests
change output format
command line arguments
make more readable definitions
read (a) restart, (b) data/fstat files
add speed by using the mesh
introduce standardDev
add 2D support
do we need to store the BaseObject::index_ anymore?
Can Interaction inherit directly from BaseInteraction?
make Files::statFile_, ... public, like the handlers; remove get functions for File's and handlers.
take out dependence on DPMBase::statFile (i.e. the savecount)
TW note, to keep the code working on Windows:
The CGHandler stores all CG objects. Its member functions initialise, evaluate, and finish are called by the DPMBase before, during and after the time loop, respectively, and call the member functions initialise, evaluate, and finish of each CG object.
|
default |
Default constructor, creates an empty CGHandler.
CGHandler::CGHandler | ( | const CGHandler & | ch | ) |
Copy constructor, copies the CGHandler and all BaseCGPoint's it contains.
[in] | ch | The CGHandler that has to be copied. |
References BaseHandler< T >::getDPMBase(), and BaseHandler< BaseCG >::setDPMBase().
|
finaldefault |
Destructor, destructs the CGHandler and all BaseCGPoint's it contains.
|
final |
[in] | cg | A pointer to the CG object that has to be added to the handler. |
References BaseHandler< T >::addObject(), and BaseCG::setHandler().
void CGHandler::computeContactPoints | ( | ) |
References cgLogger, Vec3D::dot(), BaseHandler< BaseCG >::getDPMBase(), Vec3D::getLength(), InfiniteWall::getNormal(), BaseParticle::getRadius(), constants::i, and WARN.
Referenced by evaluateRestartFiles(), and main().
void CGHandler::evaluate | ( | ) |
Contains the code executed at each time step.
References BaseCG::evaluate(), BaseHandler< BaseCG >::getDPMBase(), BaseCG::getTimeMax(), BaseCG::getTimeMin(), File::saveCurrentTimeStep(), File::setLastSavedTimeStep(), and BaseCG::statFile.
Referenced by evaluateDataFiles(), evaluateRestartFiles(), and DPMBase::writeOutputFiles().
does the same as StatisticsVector::statistics_from_fstat_and_data: loads a restart file (if existing), then several data files, and fstat files (if existing)
References cgLogger, File::close(), DPMBase::dataFile, ERROR, evaluate(), finish(), DPMBase::fStatFile, BaseHandler< BaseCG >::getDPMBase(), File::getFullName(), DPMBase::getNumberOfDomains(), BaseHandler< T >::getNumberOfObjects(), MPIContainer::getNumberOfProcessors(), MPIContainer::getProcessorID(), BaseHandler< T >::getSize(), DPMBase::getTime(), getTimeMax(), getTimeMin(), INFO, initialFileCounter, initialise(), MPIContainer::Instance(), DPMBase::interactionHandler, logger, DPMBase::particleHandler, DPMBase::readNextDataFile(), DPMBase::readNextFStatFile(), and File::setCounter().
Referenced by commandLineCG(), and restartAndEvaluateDataFiles().
bool CGHandler::evaluateRestartFiles | ( | ) |
References cgLogger, BaseHandler< T >::clear(), ParticleHandler::clear(), File::close(), computeContactPoints(), DPMBase::dataFile, ERROR, evaluate(), finish(), BaseHandler< BaseCG >::getDPMBase(), File::getFullName(), DPMBase::getNumberOfDomains(), BaseHandler< T >::getNumberOfObjects(), MPIContainer::getNumberOfProcessors(), MPIContainer::getProcessorID(), BaseHandler< T >::getSize(), DPMBase::getTime(), getTimeMax(), getTimeMin(), INFO, initialise(), MPIContainer::Instance(), DPMBase::interactionHandler, logger, DPMBase::particleHandler, DPMBase::readRestartFile(), DPMBase::restartFile, and DPMBase::wallHandler.
Referenced by commandLineCG(), and restartAndEvaluateRestartFiles().
void CGHandler::finish | ( | ) |
Contains the code executed after the last time step.
References BaseCG::finish(), NEVER, File::setLastSavedTimeStep(), and BaseCG::statFile.
Referenced by evaluateDataFiles(), evaluateRestartFiles(), and DPMBase::finishStatistics().
|
inline |
References initialFileCounter.
|
finalvirtual |
Implements BaseHandler< BaseCG >.
Mdouble CGHandler::getTimeMax | ( | ) |
References BaseCG::getTimeMax(), and constants::inf.
Referenced by evaluateDataFiles(), and evaluateRestartFiles().
Mdouble CGHandler::getTimeMin | ( | ) |
References BaseCG::getTimeMin(), and constants::inf.
Referenced by evaluateDataFiles(), and evaluateRestartFiles().
void CGHandler::initialise | ( | ) |
Contains the code executed before the first time step.
References BaseCG::initialise().
Referenced by evaluateDataFiles(), evaluateRestartFiles(), and DPMBase::initialiseStatistics().
Assignment operator that copies the pointer to the DPMBase and all objects.
[in] | rhs | The WallHandler on the right hand side of the assignment. |
This is not a copy assignment operator! It only copies the pointer to the DPMBase and the BaseWall in objects_, it sets the other data members to 0 or nullptr.
References BaseHandler< BaseCG >::clear(), BaseHandler< BaseCG >::copyContentsFromOtherHandler(), BaseHandler< T >::getDPMBase(), and BaseHandler< BaseCG >::setDPMBase().
|
finalvirtual |
Reads objects into the CGHandler from an istream (currently not implemented).
Implements BaseHandler< BaseCG >.
void CGHandler::restart | ( | std::string | name | ) |
loads restart file, before evaluateDataFiles is run
References cgLogger, BaseHandler< T >::copyAndAddObject(), DPMBase::dataFile, File::decreaseCounter(), ERROR, BaseHandler< BaseCG >::getDPMBase(), File::getFullName(), File::getName(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getSize(), DPMBase::getTime(), INFO, DPMBase::interactionHandler, logger, units::name, DPMBase::particleHandler, DPMBase::ReadNoInteractions, DPMBase::readRestartFile(), DPMBase::restartFile, DPMBase::setDomain(), DPMBase::setName(), File::setName(), DPMBase::speciesHandler, and WARN.
Referenced by commandLineCG(), restartAndEvaluateDataFiles(), and restartAndEvaluateRestartFiles().
void CGHandler::restartAndEvaluateDataFiles | ( | const std::string & | name, |
bool | evaluateFStatFiles = true |
||
) |
References evaluateDataFiles(), units::name, and restart().
Referenced by main().
void CGHandler::restartAndEvaluateRestartFiles | ( | const std::string & | name | ) |
References evaluateRestartFiles(), units::name, and restart().
|
inline |
References initialFileCounter.
Referenced by commandLineCG().
void CGHandler::write | ( | std::ostream & | os | ) | const |
unsigned CGHandler::initialFileCounter = 0 |
Referenced by evaluateDataFiles(), getInitialFileCounter(), and setInitialFileCounter().