|
Container to store pointers to all BaseBoundary objects. More...
#include <BoundaryHandler.h>
Public Member Functions | |
BoundaryHandler () | |
Default constructor, it creates an empty BoundaryHandler. More... | |
BoundaryHandler (const BoundaryHandler &BH) | |
Constructor that copies all BaseBoundary it contains and sets the other variables to 0/nullptr. More... | |
BoundaryHandler & | operator= (const BoundaryHandler &rhs) |
Assignment operator, copies only the vector of BaseBoundary and sets the other variables to 0/nullptr. More... | |
~BoundaryHandler () final | |
Destructor, it destructs the BoundaryHandler and all BaseBoundary it contains. More... | |
void | addObject (BaseBoundary *P) final |
Adds a BaseBoundary to the BoundaryHandler. More... | |
void | readAndAddObject (std::istream &is) final |
Reads BaseBoundary into the BoundaryHandler from restart data. More... | |
void | readOldObject (std::istream &is) |
Reads a periodic boundary from old-style restart data. More... | |
std::string | getName () const final |
Returns the name of the handler, namely the string "BoundaryHandler". More... | |
void | boundaryActionsBeforeTimeLoop () |
void | setWriteVTK (bool writeVTK) |
bool | getWriteVTK () const |
Public Member Functions inherited from BaseHandler< BaseBoundary > | |
BaseHandler () | |
Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer. More... | |
BaseHandler (const BaseHandler< BaseBoundary > &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< BaseBoundary > &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 (BaseBoundary *O) |
Adds an existing object to the BaseHandler without changing the id of the object. More... | |
virtual void | addObject (BaseBoundary *object) |
Adds a new Object to the BaseHandler. More... | |
virtual void | addGhostObject (BaseBoundary *O) |
Adds a new Object to the BaseHandler. called by the to avoid increasing the id. More... | |
void | removeIf (const std::function< bool(BaseBoundary *)> 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... | |
BaseBoundary * | getObjectById (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
std::vector< BaseBoundary * > | getObjectsById (const unsigned int id) |
Gets a vector of pointers to the objects with the specific id. More... | |
BaseBoundary * | getObject (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
const BaseBoundary * | getObject (const unsigned int id) const |
Gets a constant pointer to the Object at the specified index in the BaseHandler. More... | |
BaseBoundary * | getLastObject () |
Gets a pointer to the last Object in this BaseHandler. More... | |
const BaseBoundary * | 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 BaseBoundary &obj) |
Resizes the container to contain N elements. More... | |
const std::vector< BaseBoundary * >::const_iterator | begin () const |
Gets the begin of the const_iterator over all Object in this BaseHandler. More... | |
const std::vector< BaseBoundary * >::iterator | begin () |
Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector< BaseBoundary * >::const_iterator | end () const |
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector< BaseBoundary * >::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 (BaseBoundary *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... | |
Static Public Member Functions | |
static BaseBoundary * | createObject (const std::string &type) |
Private Attributes | |
bool | writeVTK_ |
Additional Inherited Members | |
Protected Attributes inherited from BaseHandler< BaseBoundary > | |
std::vector< BaseBoundary * > | objects_ |
The actual list of Object pointers. More... | |
Container to store pointers to all BaseBoundary objects.
The BoundaryHandler is a container to store all BaseBoundary. It is implemented by a vector of pointers to BaseBoundary.
BoundaryHandler::BoundaryHandler | ( | ) |
Default constructor, it creates an empty BoundaryHandler.
Constructor of the BoundaryHandler class. It creates and empty BoundaryHandler.
BoundaryHandler::BoundaryHandler | ( | const BoundaryHandler & | BH | ) |
Constructor that copies all BaseBoundary it contains and sets the other variables to 0/nullptr.
[in] | BH | The BoundaryHandler that has to be copied. |
This is not a copy constructor! It just copies all BaseBoundary from the other handler into this handler, and clears all other variables.
References BaseHandler< BaseBoundary >::copyContentsFromOtherHandler(), DEBUG, logger, and writeVTK_.
|
final |
|
final |
Adds a BaseBoundary to the BoundaryHandler.
[in] | P | A pointer to the BaseBoundary (or derived class) that has to be added. Add the object and tell the object that this is his handler. |
References PeriodicBoundaryHandler::addObject(), BaseHandler< T >::addObject(), BaseHandler< BaseBoundary >::getDPMBase(), Global_Physical_Variables::P, and DPMBase::periodicBoundaryHandler.
Referenced by readAndAddObject(), Chutebelt::setupInitialConditions(), and InsertionBoundarySelfTest::setupInitialConditions().
void BoundaryHandler::boundaryActionsBeforeTimeLoop | ( | ) |
References BaseHandler< BaseBoundary >::objects_.
Referenced by DPMBase::initialiseSolve().
|
static |
Referenced by readAndAddObject().
|
finalvirtual |
Returns the name of the handler, namely the string "BoundaryHandler".
Implements BaseHandler< BaseBoundary >.
|
inline |
BoundaryHandler & BoundaryHandler::operator= | ( | const BoundaryHandler & | rhs | ) |
Assignment operator, copies only the vector of BaseBoundary and sets the other variables to 0/nullptr.
[in] | rhs | The BoundaryHandler on the right hand side of the assignment. |
This is not a copy assignment operator! It just copies all BaseBoundary from the other handler into this handler, and clears all other variables.
References BaseHandler< BaseBoundary >::clear(), BaseHandler< BaseBoundary >::copyContentsFromOtherHandler(), DEBUG, and logger.
|
finalvirtual |
Reads BaseBoundary into the BoundaryHandler from restart data.
[in] | is | The input stream from which the information is read. First read the type of boundary, then compare the type to all existing types. When the correct type is found, read it with the >> operator, copy it and add it to the handler. |
Implements BaseHandler< BaseBoundary >.
References addObject(), createObject(), logger, readOldObject(), BaseBoundary::setHandler(), VERBOSE, and WARN.
Referenced by DPMBase::read().
void BoundaryHandler::readOldObject | ( | std::istream & | is | ) |
Reads a periodic boundary from old-style restart data.
[in] | is | The input stream from which the information is read. Get the normal, position left and position right for a periodic boundary from the stream is, and construct a new periodic boundary from it. The boundaries that are written like that are outdated, this function is there for backward compatability. |
References BaseHandler< BaseBoundary >::copyAndAddObject(), helpers::getLineFromStringStream(), and PeriodicBoundary::set().
Referenced by readAndAddObject().
|
inline |
References BaseHandler< BaseBoundary >::writeVTK(), and writeVTK_.
Referenced by DPMBase::read(), NozzleDemo::setupInitialConditions(), and NozzleSelfTest::setupInitialConditions().
|
private |
Referenced by BoundaryHandler(), getWriteVTK(), and setWriteVTK().