MercuryDPM
Beta
|
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 () | |
Destructor, it destructs the BoundaryHandler and all BaseBoundary it contains. More... | |
void | addObject (BaseBoundary *P) |
Adds a BaseBoundary to the BoundaryHandler. More... | |
void | readObject (std::istream &is) |
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 |
Returns the name of the handler, namely the string "BoundaryHandler". More... | |
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... | |
U * | copyAndAddObject (const U &O) |
Creates a copy of a Object and adds it to the BaseHandler. More... | |
U * | copyAndAddObject (U *O) |
Creates a copy of a Object and adds it 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... | |
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... | |
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... | |
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 < 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... | |
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... | |
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.
Definition at line 38 of file BoundaryHandler.h.
BoundaryHandler::BoundaryHandler | ( | ) |
Default constructor, it creates an empty BoundaryHandler.
Constructor of the ParticleHandler class. It creates and empty ParticleHandler.
Definition at line 45 of file BoundaryHandler.cc.
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.
Definition at line 55 of file BoundaryHandler.cc.
References BaseHandler< BaseBoundary >::copyContentsFromOtherHandler(), DEBUG, and logger.
BoundaryHandler::~BoundaryHandler | ( | ) |
Destructor, it destructs the BoundaryHandler and all BaseBoundary it contains.
Default destructor. Note that the delete for all boundaries is done in the BaseHandler.
Definition at line 79 of file BoundaryHandler.cc.
|
virtual |
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. |
Reimplemented from BaseHandler< BaseBoundary >.
Definition at line 86 of file BoundaryHandler.cc.
References BaseHandler< T >::addObject(), and BaseBoundary::setHandler().
|
virtual |
Returns the name of the handler, namely the string "BoundaryHandler".
Implements BaseHandler< BaseBoundary >.
Definition at line 182 of file BoundaryHandler.cc.
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.
Definition at line 67 of file BoundaryHandler.cc.
References BaseHandler< BaseBoundary >::clear(), BaseHandler< BaseBoundary >::copyContentsFromOtherHandler(), DEBUG, and logger.
|
virtual |
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 >.
Definition at line 97 of file BoundaryHandler.cc.
References BaseHandler< BaseBoundary >::copyAndAddObject(), ERROR, logger, and readOldObject().
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. |
Definition at line 165 of file BoundaryHandler.cc.
References BaseHandler< BaseBoundary >::copyAndAddObject(), helpers::getLineFromStringStream(), and PeriodicBoundary::set().
Referenced by readObject().