MercuryDPM
Alpha
|
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... | |
void | writeVTKFile (const VTKContainer vtk) const |
Writes the data collected in writeVTK into vtk files, one per timestep. More... | |
void | writeVTKBoundingBox () const |
Writes a bounding box around the domain into a vtk file. More... | |
void | writeVTK () const |
Writes all walls into a vtk format, consisting of points (edges) and cells (faces). 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... | |
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... | |
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... | |
void | setId (BaseWall *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 void | writeVTK () |
Over written in WallHandler and ParticleHandler. 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 an empty WallHandler.
Definition at line 42 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 55 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 82 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 92 of file WallHandler.cc.
References BaseHandler< T >::addObject(), BaseObject::getId(), BaseInteractable::getSpecies(), logger, BaseWall::setHandler(), and WARN.
|
virtual |
Returns the name of the handler, namely the string "WallHandler".
Implements BaseHandler< BaseWall >.
Definition at line 227 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 70 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 109 of file WallHandler.cc.
References BaseHandler< BaseWall >::copyAndAddObject(), DEBUG, ERROR, BaseHandler< BaseWall >::getDPMBase(), BaseHandler< T >::getObject(), logger, readOldObject(), IntersectionOfWalls::setSpecies(), BaseWall::setSpecies(), DPMBase::speciesHandler, and WARN.
Referenced by DPMBase::read().
void WallHandler::readOldObject | ( | std::istream & | is | ) |
Reads a BaseWall into the WallHandler from old-style restart data.
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.
[in,out] | is | The input stream from which the information is read. |
Definition at line 190 of file WallHandler.cc.
References IntersectionOfWalls::addObject(), BaseHandler< BaseWall >::copyAndAddObject(), BaseHandler< BaseWall >::getDPMBase(), helpers::getLineFromStringStream(), logger, InfiniteWall::set(), IntersectionOfWalls::setSpecies(), BaseWall::setSpecies(), and VERBOSE.
Referenced by readObject().
void WallHandler::writeVTK | ( | ) | const |
Writes all walls into a vtk format, consisting of points (edges) and cells (faces).
Writes the VTK file for all walls: it asks every wall for its points and cells, which they will append in their output parameters. Cells are lists of point indices that will be visualised in form of triangle strips (vtk type 6).
Definition at line 239 of file WallHandler.cc.
References DEBUG, logger, VTKContainer::points, VTKContainer::triangleStrips, and writeVTKFile().
Referenced by main(), and DPMBase::writeVTK().
void WallHandler::writeVTKBoundingBox | ( | ) | const |
Writes a bounding box around the domain into a vtk file.
Writes a box around all the data to a vtk file. The filename is hard-coded and depends on the DPMBase. Note that there is no static counter that makes sure new files don't have the same name as the old ones.
000 001 010 011 ...
Definition at line 341 of file WallHandler.cc.
References BaseHandler< BaseWall >::getDPMBase(), DPMBase::getMax(), DPMBase::getMin(), Files::getName(), INFO, logger, WARN, X, Y, and Z.
void WallHandler::writeVTKFile | ( | const VTKContainer | vtk | ) | const |
Writes the data collected in writeVTK into vtk files, one per timestep.
Writes all points ans cells to a file in the VTK format. The filename is hard-coded in this method, and is based on the name of the DPMBase and has a unique counter in it to ensure there are no two files with the same name.
Definition at line 267 of file WallHandler.cc.
References BaseHandler< BaseWall >::getDPMBase(), Files::getName(), BaseHandler< BaseWall >::getNumberOfObjects(), INFO, logger, VTKContainer::points, helpers::to_string(), VTKContainer::triangleStrips, and WARN.
Referenced by writeVTK().