MercuryDPM
Beta
|
Container to store all BaseWall. More...
#include <WallHandler.h>
Public Member Functions | |
WallHandler () | |
Default constructor, it creates an empty WallHandler. More... | |
WallHandler (const WallHandler &BH) | |
Constructor that copies a pointer to the DPMBase and all BaseWall in the given WallHandler. More... | |
WallHandler | operator= (const WallHandler &rhs) |
Assignment operator that copies the pointer to the DPMBase and all BaseWall in the given WallHandler. More... | |
~WallHandler () | |
Destructor, it destructs the WallHandler and all BaseWall it contains. More... | |
void | addObject (BaseWall *W) |
Adds a BaseWall to the WallHandler. More... | |
void | readObject (std::istream &is) |
Reads BaseWall into the WallHandler from restart data. More... | |
void | readOldObject (std::istream &is) |
Reads a BaseWall into the WallHandler from old-style restart data. More... | |
std::string | getName () const |
Returns the name of the handler, namely the string "WallHandler". More... | |
Public Member Functions inherited from BaseHandler< BaseWall > | |
BaseHandler () | |
Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer. More... | |
BaseHandler (const BaseHandler< BaseWall > &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< BaseWall > &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... | |
BaseWall * | getObjectById (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
BaseWall * | getObject (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
const BaseWall * | getObject (const unsigned int id) const |
Gets a constant pointer to the Object at the specified index in the BaseHandler. More... | |
BaseWall * | getLastObject () |
Gets a pointer to the last Object in this BaseHandler. More... | |
const BaseWall * | 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< BaseWall * > ::const_iterator | begin () const |
Gets the begin of the const_iterator over all Object in this BaseHandler. More... | |
const std::vector< BaseWall * > ::iterator | begin () |
Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector< BaseWall * > ::const_iterator | end () const |
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector< BaseWall * > ::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< BaseWall > | |
std::vector< BaseWall * > | objects_ |
The actual list of Object pointers. More... | |
Container to store all BaseWall.
The WallHandler is a container to store all BaseWall. It is implemented by a vector of pointers to BaseWall.
Definition at line 42 of file WallHandler.h.
WallHandler::WallHandler | ( | ) |
Default constructor, it creates an empty WallHandler.
Constructor of the WallHandler class. It creates and empty WallHandler.
Definition at line 41 of file WallHandler.cc.
References BaseHandler< BaseWall >::clear(), DEBUG, and logger.
WallHandler::WallHandler | ( | const WallHandler & | WH | ) |
Constructor that copies a pointer to the DPMBase and all BaseWall in the given WallHandler.
[in] | WH | The WallHandler that has to be copied. |
This is not a copy constructor! It only copies the pointer to the DPMBase and the BaseWall in objects_, it sets the other data members to 0 or nullptr.
Definition at line 53 of file WallHandler.cc.
References BaseHandler< BaseWall >::clear(), BaseHandler< BaseWall >::copyContentsFromOtherHandler(), DEBUG, BaseHandler< T >::getDPMBase(), logger, and BaseHandler< BaseWall >::setDPMBase().
WallHandler::~WallHandler | ( | ) |
Destructor, it destructs the WallHandler and all BaseWall it contains.
Definition at line 81 of file WallHandler.cc.
|
virtual |
Adds a BaseWall to the WallHandler.
[in] | W | A pointer to the BaseWall (or derived class) that has to be added. |
First the new BaseWall is added to the vector of BaseWall, then it is told that this is its handler.
Reimplemented from BaseHandler< BaseWall >.
Definition at line 93 of file WallHandler.cc.
References BaseHandler< T >::addObject(), and BaseWall::setHandler().
|
virtual |
Returns the name of the handler, namely the string "WallHandler".
Implements BaseHandler< BaseWall >.
Definition at line 210 of file WallHandler.cc.
WallHandler WallHandler::operator= | ( | const WallHandler & | rhs | ) |
Assignment operator that copies the pointer to the DPMBase and all BaseWall in the given WallHandler.
[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.
Definition at line 67 of file WallHandler.cc.
References BaseHandler< BaseWall >::clear(), BaseHandler< BaseWall >::copyContentsFromOtherHandler(), DEBUG, BaseHandler< T >::getDPMBase(), logger, and BaseHandler< BaseWall >::setDPMBase().
|
virtual |
Reads BaseWall into the WallHandler from restart data.
[in] | is | The input stream from which the information is read. |
Implements BaseHandler< BaseWall >.
Definition at line 111 of file WallHandler.cc.
References BaseHandler< BaseWall >::copyAndAddObject(), ERROR, logger, and readOldObject().
Referenced by DPMBase::read().
void WallHandler::readOldObject | ( | std::istream & | is | ) |
Reads a BaseWall into the WallHandler from old-style restart data.
[in] | is | The input stream from which the information is read. |
First determine whether or not the wall is an infinite wall. If it is an infinite wall, read the normal and position and add the wall to the handler. If it is a finite wall, read the normal and position of each part and construct an IntersectionOfWalls from it, which can then be added to the handler.
Definition at line 175 of file WallHandler.cc.
References IntersectionOfWalls::addObject(), BaseHandler< BaseWall >::copyAndAddObject(), helpers::getLineFromStringStream(), logger, InfiniteWall::set(), and VERBOSE.
Referenced by readObject().