|
Used for removing particles from the problem. Inherits from BaseBoundary. By default, a plane that deletes everything past it, but there are derived classes such as CubeDeletionBoundary. More...
#include <DeletionBoundary.h>
Public Member Functions | |
DeletionBoundary () | |
default constructor More... | |
DeletionBoundary (DeletionBoundary const &d) | |
default copy constructor More... | |
~DeletionBoundary () override | |
destructor More... | |
DeletionBoundary * | copy () const override |
Copy method; creates copy on the heap and returns a pointer to it. More... | |
void | set (const Vec3D &normal, Mdouble distance) |
Sets boundary position based on a normal and distance. More... | |
void | move (Mdouble position) |
Sets the boundary's distance property to the given one. More... | |
virtual Mdouble | getDistance (const Vec3D &position) const |
Returns a negative value if and only if the particle is inside the boundary (and therefore to be deleted). More... | |
bool | checkBoundaryAfterParticleMoved (BaseParticle *p, ParticleHandler &pH) |
Checks if particle is inside the boundary, and deletes the particle if so. More... | |
void | checkBoundaryAfterParticlesMove (ParticleHandler &pH) override |
unsigned int | getNumberOfParticlesDeleted () const |
Gets the number of particles deleted by the boundary. More... | |
double | getMassOfParticlesDeleted () const |
double | getVolumeOfParticlesDeleted () const |
void | reset () |
void | activate () |
Turns on the DeletionBoundary. More... | |
void | deactivate () |
Turns off the DeletionBoundary. More... | |
void | trackOutflow (bool trackOutflow=true) |
Turns on the outflow tracker. More... | |
void | read (std::istream &is) override |
Reads some boundary properties from an std::istream. More... | |
MERCURYDPM_DEPRECATED void | oldRead (std::istream &is) |
Deprecated read method. use DeletionBoundary::read() instead. More... | |
void | write (std::ostream &os) const override |
Writes the boundary properties to an std::ostream. More... | |
std::string | getName () const override |
Returns the name of the object. More... | |
Public Member Functions inherited from BaseBoundary | |
BaseBoundary () | |
default constructor. More... | |
BaseBoundary (const BaseBoundary &b) | |
copy constructor More... | |
~BaseBoundary () override | |
destructor More... | |
virtual void | createPeriodicParticle (BaseParticle *p UNUSED, ParticleHandler &pH UNUSED) |
Creates a periodic particle in case of periodic boundaries in serial build. More... | |
virtual void | createPeriodicParticles (ParticleHandler &pH UNUSED) |
Creates periodic copies of given particle in case of periodic boundaries. More... | |
virtual void | checkBoundaryBeforeTimeStep (DPMBase *md) |
Virtual function that does things before each time step. More... | |
virtual void | actionsBeforeTimeLoop () |
Virtual function that does something after DPMBase::setupInitialConditions but before the first time step. More... | |
virtual void | modifyGhostAfterCreation (BaseParticle *particle, int i) |
virtual void | writeVTK (std::fstream &file) |
void | setHandler (BoundaryHandler *handler) |
Sets the boundary's BoundaryHandler. More... | |
BoundaryHandler * | getHandler () const |
Returns the boundary's BoundaryHandler. More... | |
Public Member Functions inherited from BaseObject | |
BaseObject ()=default | |
Default constructor. More... | |
BaseObject (const BaseObject &p)=default | |
Copy constructor, copies all the objects BaseObject contains. More... | |
virtual | ~BaseObject ()=default |
virtual destructor More... | |
virtual void | moveInHandler (unsigned int index) |
Except that it is virtual, it does the same thing as setIndex() does. More... | |
void | setIndex (unsigned int index) |
Allows one to assign an index to an object in the handler/container. More... | |
void | setId (unsigned long id) |
Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More... | |
unsigned int | getIndex () const |
Returns the index of the object in the handler. More... | |
unsigned int | getId () const |
Returns the unique identifier of any particular object. More... | |
void | setGroupId (unsigned groupId) |
unsigned | getGroupId () const |
Private Attributes | |
Vec3D | normal_ |
outward unit normal vector More... | |
Mdouble | scaleFactor_ |
This is the factor to rescale the given normal vector to a unit vectors. More... | |
Mdouble | distance_ |
The boundary's distance from the origin. More... | |
unsigned int | numberOfParticlesDeleted_ |
Number of particles that have been deleted by this boundary. More... | |
double | massDeleted_ |
double | trackMassDeleted_ |
double | volumeDeleted_ |
bool | isActivated_ |
The DeletionBoundary is activated by default. If the DeletionBoundary is deactivated, then it deletes no particles. More... | |
bool | trackOutflow_ |
std::ofstream | tracker |
Used for removing particles from the problem. Inherits from BaseBoundary. By default, a plane that deletes everything past it, but there are derived classes such as CubeDeletionBoundary.
DeletionBoundary::DeletionBoundary | ( | ) |
default constructor
Default constructor (calls the parent-constructor of BaseBoundary as well)
References DEBUG, distance_, isActivated_, logger, massDeleted_, numberOfParticlesDeleted_, scaleFactor_, trackOutflow_, and volumeDeleted_.
Referenced by copy().
|
inline |
default copy constructor
|
override |
void DeletionBoundary::activate | ( | ) |
bool DeletionBoundary::checkBoundaryAfterParticleMoved | ( | BaseParticle * | p, |
ParticleHandler & | pH | ||
) |
Checks if particle is inside the boundary, and deletes the particle if so.
Checks if particle has passed the boundary, and if so, deletes the particle.
[in] | p | pointer to the particle which is to be checked |
[out] | pH | the particle's ParticleHandler, from which the particle is removed in case it has passed the boundary. |
References ParticleHandler::computeLargestParticle(), ParticleHandler::computeSmallestParticle(), BaseInteractable::getAngularVelocity(), getDistance(), BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), BaseObject::getId(), BaseObject::getIndex(), BaseInteractable::getIndSpecies(), BaseParticle::getMass(), BaseInteractable::getPosition(), BaseParticle::getRadius(), BaseInteractable::getVelocity(), BaseParticle::getVolume(), INFO, BaseParticle::isInMPIDomain(), logger, massDeleted_, units::name, NUMBER_OF_PROCESSORS, numberOfParticlesDeleted_, PROCESSOR_ID, ParticleHandler::removeGhostObject(), ParticleHandler::removeObject(), helpers::toString(), tracker, trackMassDeleted_, trackOutflow_, volumeDeleted_, Vec3D::X, Vec3D::Y, and Vec3D::Z.
Referenced by checkBoundaryAfterParticlesMove().
|
overridevirtual |
Reimplemented from BaseBoundary.
References checkBoundaryAfterParticleMoved(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), constants::i, and isActivated_.
|
overridevirtual |
Copy method; creates copy on the heap and returns a pointer to it.
Copy function, which creates a copy and returns a pointer to that copy (on the heap)
Implements BaseBoundary.
References DeletionBoundary().
void DeletionBoundary::deactivate | ( | ) |
Returns a negative value if and only if the particle is inside the boundary (and therefore to be deleted).
The default DeletionBoundary is a half-space (specified by a plane) but the geometry can be overridden (e.g. by CubeDeletionBoundary). Calculates the shortest distance between the wall and given position.
[in] | position | the position of which the distance should be calculated. |
Reimplemented in CubeDeletionBoundary.
References distance_, Vec3D::dot(), and normal_.
Referenced by checkBoundaryAfterParticleMoved().
double DeletionBoundary::getMassOfParticlesDeleted | ( | ) | const |
References massDeleted_.
Referenced by BoundariesSelfTest::actionsAfterTimeStep().
|
overridevirtual |
Returns the name of the object.
Returns the object's class name (i.e. 'DeletionBoundary').
Implements BaseObject.
unsigned int DeletionBoundary::getNumberOfParticlesDeleted | ( | ) | const |
Gets the number of particles deleted by the boundary.
Returns the number of particles deleted by this boundary. TODO For some reason, this causes a segfault — DO NOT USE. valgrind complains that 'numberOfParticlesDeleted_' is not initialised.
References numberOfParticlesDeleted_.
Referenced by T_protectiveWall::actionsAfterTimeStep(), BoundariesSelfTest::actionsAfterTimeStep(), and protectiveWall::actionsAfterTimeStep().
double DeletionBoundary::getVolumeOfParticlesDeleted | ( | ) | const |
References volumeDeleted_.
Referenced by BoundariesSelfTest::actionsAfterTimeStep().
void DeletionBoundary::move | ( | Mdouble | distance | ) |
Sets the boundary's distance property to the given one.
Resets the boundary's 'distance' from the origin to be the one given.
[in] | distance | the new 'distance' between boundary and origin. see also comments of DeletionBoundary::set(). |
References distance_, and scaleFactor_.
void DeletionBoundary::oldRead | ( | std::istream & | is | ) |
Deprecated read method. use DeletionBoundary::read() instead.
the deprecated version of the read-method. Should not be used by new users!
References distance_, normal_, and scaleFactor_.
|
overridevirtual |
Reads some boundary properties from an std::istream.
Reads a number of boundary properties from the given std::istream.
[in,out] | is | the istream |
Implements BaseBoundary.
References distance_, isActivated_, massDeleted_, normal_, numberOfParticlesDeleted_, BaseBoundary::read(), scaleFactor_, trackOutflow_, and volumeDeleted_.
Referenced by CubeDeletionBoundary::read().
void DeletionBoundary::reset | ( | ) |
References massDeleted_, numberOfParticlesDeleted_, and volumeDeleted_.
Sets boundary position based on a normal and distance.
Defines the placing of the (2D) boundary based on the given normal and distance.
[in] | normal | boundary normal vector |
[in] | distance | 'distance' between the origin and the boundary, such that the following relation is satisfied: \[ \mathbf{r} \cdot \mathbf{\hat{n}} = d \] in which \( \mathbf{\hat{n}} \) and \( d \) are the given normal vector and distance, respectively. NB: If the distance is the ACTUAL distance from the origin, the normal vector must be of UNIT LENGTH for the placing of the boundary to be done correctly. |
References distance_, Vec3D::dot(), normal_, and scaleFactor_.
Referenced by GranuHeap::actionsAfterTimeStep(), BoundariesSelfTest::BoundariesSelfTest(), FluxBoundarySelfTest::FluxBoundarySelfTest(), protectiveWall::protectiveWall(), Silo::setupInitialConditions(), DeletionBoundarySelfTest::setupInitialConditions(), FullRestartTest::setupInitialConditions(), and T_protectiveWall::T_protectiveWall().
|
inline |
Turns on the outflow tracker.
References trackOutflow(), and trackOutflow_.
Referenced by trackOutflow().
|
overridevirtual |
Writes the boundary properties to an std::ostream.
Writes the boundary properties to an std::ostream.
[out] | os | the ostream the properties are to be written to. |
Implements BaseBoundary.
References distance_, isActivated_, massDeleted_, normal_, numberOfParticlesDeleted_, scaleFactor_, trackOutflow_, volumeDeleted_, and BaseBoundary::write().
Referenced by CubeDeletionBoundary::write().
|
private |
The boundary's distance from the origin.
Referenced by DeletionBoundary(), getDistance(), move(), oldRead(), read(), set(), and write().
|
private |
The DeletionBoundary is activated by default. If the DeletionBoundary is deactivated, then it deletes no particles.
Referenced by activate(), checkBoundaryAfterParticlesMove(), deactivate(), DeletionBoundary(), read(), and write().
|
private |
Referenced by checkBoundaryAfterParticleMoved(), DeletionBoundary(), getMassOfParticlesDeleted(), read(), reset(), and write().
|
private |
outward unit normal vector
Referenced by getDistance(), oldRead(), read(), set(), and write().
|
private |
Number of particles that have been deleted by this boundary.
Referenced by checkBoundaryAfterParticleMoved(), DeletionBoundary(), getNumberOfParticlesDeleted(), read(), reset(), and write().
|
private |
This is the factor to rescale the given normal vector to a unit vectors.
NB: Not only the normal vector is rescaled by this factor, also the 'distance' from the origin of the boundary is scaled by this factor! Also, once the boundary position is set with DeletionBoundary::set(), the arguments of any reset of the distance_ property (i.e. usage of DeletionBoundary::move()) will be rescaled by the same factor!
Referenced by DeletionBoundary(), move(), oldRead(), read(), set(), and write().
|
private |
Referenced by checkBoundaryAfterParticleMoved().
|
private |
Referenced by checkBoundaryAfterParticleMoved().
|
private |
Referenced by checkBoundaryAfterParticleMoved(), DeletionBoundary(), read(), trackOutflow(), and write().
|
private |
Referenced by checkBoundaryAfterParticleMoved(), DeletionBoundary(), getVolumeOfParticlesDeleted(), read(), reset(), and write().