|
Container to store all BaseWall. More...
#include <WallHandler.h>
Public Types | |
enum class | DetailsVTKOptions { BOUNDINGBOX = 0 , NURBSWALL = 1 , WEARABLENURBSWALL = 2 } |
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 () final | |
Destructor, it destructs the WallHandler and all BaseWall it contains. More... | |
void | addObject (BaseWall *W) final |
Adds a BaseWall to the WallHandler. More... | |
BaseWall * | readAndCreateObject (std::istream &is) |
Create a new wall, based on the information provided in a restart file. More... | |
void | readAndAddObject (std::istream &is) final |
Create a new wall in the WallHandler, based on the information provided in a restart file. More... | |
std::string | getName () const final |
Returns the name of the handler, namely the string "WallHandler". More... | |
unsigned | readTriangleWall (std::string filename, ParticleSpecies *species, Mdouble scaleFactor=1, Vec3D centerOfRotation={0, 0, 0}, Vec3D velocity={0, 0, 0}, Vec3D angularVelocity={0, 0, 0}) |
Reads triangulated walls from vtk or stl files, and converts them into a set of TriangleWalls. More... | |
void | actionsAfterParticleGhostUpdate () |
Calls the method actionsAfterParticleGhostUpdate of every wall in the handler. More... | |
void | setWriteVTK (FileType) |
Sets whether walls are written into a VTK file. More... | |
void | setWriteVTK (bool) |
Sets whether walls are written into a VTK file. More... | |
FileType | getWriteVTK () const |
Returns whether walls are written in a VTK file. More... | |
void | setWriteDetailsVTK (DetailsVTKOptions, FileType) |
void | setWriteDetailsVTK (DetailsVTKOptions, bool) |
FileType | getWriteDetailsVTK (DetailsVTKOptions) const |
bool | getWriteDetailsVTKAny () const |
std::unordered_map< DetailsVTKOptions, FileType > | getWriteWallDetailsVTKAll () const |
void | writeWallDetailsVTKBoundingBox (VTKData &data) const |
void | setWriteWallSurfaceAreaVTK (bool writeWallSurfaceAreaVTK) |
Enables/disables the calculation and writing of the surface area of the cells. More... | |
bool | getWriteWallSurfaceAreaVTK () const |
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... | |
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 (BaseWall *O) |
Adds an existing object to the BaseHandler without changing the id of the object. More... | |
virtual void | addObject (BaseWall *object) |
Adds a new Object to the BaseHandler. More... | |
virtual void | addGhostObject (BaseWall *O) |
Adds a new Object to the BaseHandler. called by the to avoid increasing the id. More... | |
void | removeIf (const std::function< bool(BaseWall *)> 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... | |
BaseWall * | getObjectById (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
std::vector< BaseWall * > | getObjectsById (const unsigned int id) |
Gets a vector of pointers to the objects with the specific id. 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... | |
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 BaseWall &obj) |
Resizes the container to contain N elements. 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) |
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 BaseWall * | createObject (const std::string &type) |
Create a new wall, with the type given as a string (required for restarting). More... | |
Private Member Functions | |
BaseWall * | readAndCreateOldObject (std::istream &is) |
Create a new wall, based on the information from old-style restart data. More... | |
Private Attributes | |
FileType | writeVTK_ |
std::unordered_map< DetailsVTKOptions, FileType > | writeDetailsVTK_ |
unordered_map storing the file types corresponding to each of the enum DetailsVTKOptions 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.
|
strong |
Enumerator | |
---|---|
BOUNDINGBOX | Writes a bounding box around the domain. |
NURBSWALL | Writes the NURBS control points. |
WEARABLENURBSWALL | Writes the debris. |
WallHandler::WallHandler | ( | ) |
Default constructor, it creates an empty WallHandler.
Constructor of the WallHandler class. It creates an empty WallHandler.
References BaseHandler< BaseWall >::clear(), NO_FILE, and writeVTK_.
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.
References BaseHandler< BaseWall >::clear(), BaseHandler< BaseWall >::copyContentsFromOtherHandler(), BaseHandler< T >::getDPMBase(), BaseHandler< BaseWall >::setDPMBase(), and writeVTK_.
|
final |
void WallHandler::actionsAfterParticleGhostUpdate | ( | ) |
Calls the method actionsAfterParticleGhostUpdate of every wall in the handler.
This function is called by DPMBase::computeOneTimeStep directly after the ghost particle update. It may be used to adjust wall properties based on the changed wall positions (for an example, look e.g. at MeshTriangle).
Referenced by DPMBase::computeOneTimeStep().
|
final |
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.
References BaseHandler< T >::addObject(), BaseObject::getId(), BaseInteractable::getSpecies(), logger, BaseWall::setHandler(), and WARN.
Referenced by readAndAddObject(), and Chutebelt::setupInitialConditions().
|
static |
Create a new wall, with the type given as a string (required for restarting).
Referenced by BaseWall::read(), BasicIntersectionOfWalls::read(), BasicUnionOfWalls::read(), and readAndCreateObject().
|
finalvirtual |
Returns the name of the handler, namely the string "WallHandler".
Implements BaseHandler< BaseWall >.
FileType WallHandler::getWriteDetailsVTK | ( | DetailsVTKOptions | option | ) | const |
References NO_FILE, and writeDetailsVTK_.
Referenced by WallDetailsVTKWriter::shouldWrite(), and DPMBase::writePythonFileForVTKVisualisation().
bool WallHandler::getWriteDetailsVTKAny | ( | ) | const |
FileType WallHandler::getWriteVTK | ( | ) | const |
Returns whether walls are written in a VTK file.
References writeVTK_.
Referenced by DPMBase::getWallsWriteVTK(), DPMBase::write(), DPMBase::writePythonFileForVTKVisualisation(), and DPMBase::writeVTKFiles().
std::unordered_map< WallHandler::DetailsVTKOptions, FileType > WallHandler::getWriteWallDetailsVTKAll | ( | ) | const |
References writeDetailsVTK_.
Referenced by DPMBase::write().
bool WallHandler::getWriteWallSurfaceAreaVTK | ( | ) | const |
References BaseHandler< BaseWall >::getDPMBase(), DPMBase::getWallVTKWriter(), and WallVTKWriter::getWriteWallSurfaceAreaVTK().
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.
References BaseHandler< BaseWall >::clear(), BaseHandler< BaseWall >::copyContentsFromOtherHandler(), BaseHandler< T >::getDPMBase(), BaseHandler< BaseWall >::setDPMBase(), and writeVTK_.
|
finalvirtual |
Create a new wall in the WallHandler, based on the information provided in a restart file.
As we add the object into the handler, we need to make sure that the object keeps its existing ID. This is not always the same as the index, e.g. if walls have been removed during the simulation.
[in] | is | The input stream from which the information is read. |
Implements BaseHandler< BaseWall >.
References addObject(), BaseObject::getId(), BaseHandler< BaseWall >::getLastObject(), readAndCreateObject(), and BaseObject::setId().
Referenced by DPMBase::read().
BaseWall * WallHandler::readAndCreateObject | ( | std::istream & | is | ) |
Create a new wall, based on the information provided in a restart file.
References createObject(), DEBUG, BaseHandler< BaseWall >::getDPMBase(), BaseInteractable::getIndSpecies(), logger, readAndCreateOldObject(), DPMBase::readUserDefinedWall(), BaseWall::setHandler(), BaseWall::setSpecies(), and WARN.
Referenced by readAndAddObject().
|
private |
Create a new wall, based on the information 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. |
References IntersectionOfWalls::addObject(), BaseHandler< BaseWall >::getDPMBase(), helpers::getLineFromStringStream(), constants::i, logger, InfiniteWall::set(), BaseWall::setSpecies(), IntersectionOfWalls::setSpecies(), and VERBOSE.
Referenced by readAndCreateObject().
unsigned WallHandler::readTriangleWall | ( | std::string | filename, |
ParticleSpecies * | species, | ||
Mdouble | scaleFactor = 1 , |
||
Vec3D | centerOfRotation = {0,0,0} , |
||
Vec3D | velocity = {0,0,0} , |
||
Vec3D | angularVelocity = {0,0,0} |
||
) |
Reads triangulated walls from vtk or stl files, and converts them into a set of TriangleWalls.
The stl files have to be binary STL files. If you have ascii files, you need to convert them (use e.g. https://www.meshconvert.com/)
The vtk files need to be of type POLYDATA and contain triangle strips (see see www.cacr.caltech.edu/~slombey)
[in] | filename | name of vtk input file, e.g. TriangulatedWallSelfTest.vtk |
[in] | species | pointer to a species in the species handler that will be assigned to the walls |
[in] | scaleFactor | allows the vertex positions to be scaled (necessary if the vtk file is written in different units than the Mercury implementation, e.g. if the stl file is given in mm, but the Mercury implementation uses meters) |
References BaseHandler< BaseWall >::copyAndAddObject(), ERROR, BaseHandler< BaseWall >::getNextGroupId(), BaseHandler< BaseWall >::getSize(), constants::i, BinaryReader::ignoreChar(), INFO, logger, helpers::lower(), n, STLTriangle::normal, BinaryReader::readFloat(), BinaryReader::readString(), BinaryReader::readUnsignedInt(), BaseInteractable::setAngularVelocity(), BaseObject::setGroupId(), BaseWall::setSpecies(), BaseInteractable::setVelocity(), TriangleWall::setVertices(), STLTriangle::vertex1, STLTriangle::vertex2, STLTriangle::vertex3, Vec3D::X, Vec3D::x(), Vec3D::Y, Vec3D::y(), Vec3D::Z, and Vec3D::z().
Referenced by MarbleRun::loadBigSeesaw(), MarbleRun::loadSmallSeesaw(), MarbleRun::loadSTLFile(), main(), multiParticleT1::setupInitialConditions(), NozzleDemo::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), and AreaVTK::setupInitialConditions().
void WallHandler::setWriteDetailsVTK | ( | DetailsVTKOptions | option, |
bool | writeVTK | ||
) |
References MULTIPLE_FILES, NO_FILE, setWriteDetailsVTK(), and BaseHandler< BaseWall >::writeVTK().
void WallHandler::setWriteDetailsVTK | ( | DetailsVTKOptions | option, |
FileType | fileType | ||
) |
void WallHandler::setWriteVTK | ( | bool | writeVTK | ) |
Sets whether walls are written into a VTK file.
References MULTIPLE_FILES, NO_FILE, BaseHandler< BaseWall >::writeVTK(), and writeVTK_.
void WallHandler::setWriteVTK | ( | FileType | fileType | ) |
Sets whether walls are written into a VTK file.
References writeVTK_.
Referenced by AxisymmetricWallSelfTest::AxisymmetricWallSelfTest(), HorizontalMixer::HorizontalMixer(), main(), MaserRepeatedOutInMPI2Test::MaserRepeatedOutInMPI2Test(), protectiveWall::protectiveWall(), DPMBase::read(), Calibration::setOutput(), NautaMixer::setupInitialConditions(), NozzleDemo::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), VerticalMixer::setupInitialConditions(), MarbleRun::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), Drum::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), RollingOverTriangleWalls::setupInitialConditions(), MovingWalls::setupInitialConditions(), AreaVTK::setupInitialConditions(), MercuryProblem::setupMercuryProblem(), DPMBase::setWallsWriteVTK(), T_protectiveWall::T_protectiveWall(), TangentialSpringEnergyConservationUnitTest::TangentialSpringEnergyConservationUnitTest(), and Tutorial11::Tutorial11().
void WallHandler::setWriteWallSurfaceAreaVTK | ( | bool | writeWallSurfaceAreaVTK | ) |
Enables/disables the calculation and writing of the surface area of the cells.
References BaseHandler< BaseWall >::getDPMBase(), DPMBase::getWallVTKWriter(), and WallVTKWriter::setWriteWallSurfaceAreaVTK().
Referenced by AreaVTK::setupInitialConditions().
void WallHandler::writeWallDetailsVTKBoundingBox | ( | VTKData & | data | ) | const |
References VTKData::addToConnectivity(), VTKData::addToPoints(), VTKData::addToTypes(), BaseHandler< BaseWall >::getDPMBase(), DPMBase::getMax(), DPMBase::getMin(), constants::i, and Global_Physical_Variables::P.
Referenced by WallDetailsVTKWriter::writeVTK().
|
private |
unordered_map storing the file types corresponding to each of the enum DetailsVTKOptions
The filetypes are only actually added to the map when setting or getting it. The getter automatically adds the default filetype NO_FILE when the requested options had not yet been added.
Referenced by getWriteDetailsVTK(), getWriteDetailsVTKAny(), getWriteWallDetailsVTKAll(), and setWriteDetailsVTK().
|
private |
Referenced by getWriteVTK(), operator=(), setWriteVTK(), and WallHandler().