MercuryDPM
Alpha
|
Boundary structure for boundaries used for insertion of particles. More...
#include <InsertionBoundary.h>
Public Member Functions | |
InsertionBoundary () | |
Default constructor: set everything to 0/nullptr. More... | |
InsertionBoundary (const InsertionBoundary &other) | |
Copy constructor (with deep copy) More... | |
virtual | ~InsertionBoundary () |
Destructor: delete the particle that has to be copied at every insertion. More... | |
void | set (BaseParticle *particleToCopy, unsigned int maxFailed) |
Sets the particle that will be inserted and the maximum number of times for which insertion may fail. More... | |
virtual BaseParticle * | generateParticle (RNG &random)=0 |
Purely virtual function that generates one particle. More... | |
virtual void | checkBoundaryBeforeTimeStep (DPMBase *md) |
Fills the boundary with particles. More... | |
unsigned int | getNumberOfParticlesInserted () const |
Gets the number of particles inserted by the boundary. More... | |
void | setMaxFailed (unsigned int maxFailed) |
Sets the number of times that the wall may fail to insert a particle. More... | |
unsigned int | getMaxFailed () const |
Gets the number of times that the boundary may fail to insert a particle. More... | |
void | setParticleToCopy (BaseParticle *particleToCopy) |
Sets the particle that will be inserted through the insertion boundary. More... | |
BaseParticle * | getParticleToCopy () const |
Gets the particle that will be inserted through the insertion boundary. More... | |
void | read (std::istream &is) |
Reads the boundary's id_ and maxFailed_. More... | |
void | write (std::ostream &os) const |
Writes the boundary's id_ and maxFailed_. More... | |
Public Member Functions inherited from BaseBoundary | |
BaseBoundary () | |
default constructor. More... | |
BaseBoundary (const BaseBoundary &b) | |
copy constructor More... | |
virtual | ~BaseBoundary () |
destructor More... | |
virtual BaseBoundary * | copy () const =0 |
Used to create a copy of the object NB: purely virtual function. More... | |
virtual void | createPeriodicParticles (BaseParticle *P UNUSED, ParticleHandler &pH UNUSED) |
Creates periodic copies of given particle in case of periodic boundaries. More... | |
virtual bool | checkBoundaryAfterParticleMoved (BaseParticle *P UNUSED, ParticleHandler &pH UNUSED) |
Checks if given particle passed the boundary. More... | |
virtual void | checkBoundaryBeforeTimeStep (DPMBase *md UNUSED) |
Fills a (3D) boundary with particles. More... | |
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 constructor. More... | |
BaseObject (const BaseObject &p) | |
Copy constructor, copies all the objects BaseObject contains. More... | |
virtual | ~BaseObject () |
virtual destructor More... | |
virtual std::string | getName () const =0 |
A purely virtual function. More... | |
virtual void | moveInHandler (const unsigned int index) |
Except that it is virtual, it does the same thing as setIndex() does. More... | |
void | setIndex (const unsigned int index) |
Allows one to assign an index to an object in the handler/container. More... | |
void | setId (const unsigned int 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... | |
Protected Attributes | |
BaseParticle * | particleToCopy_ |
Particle that will be inserted through the insertion boundary. More... | |
unsigned int | maxFailed_ |
Number of times that the wall may fail to insert a particle. More... | |
unsigned int | numberOfParticlesInserted_ |
Number of particles that are already inserted. More... | |
Boundary structure for boundaries used for insertion of particles.
Definition at line 39 of file InsertionBoundary.h.
InsertionBoundary::InsertionBoundary | ( | ) |
Default constructor: set everything to 0/nullptr.
Default constructor, sets all data members to 0 or nullptr.
Definition at line 33 of file InsertionBoundary.cc.
References maxFailed_, numberOfParticlesInserted_, and particleToCopy_.
InsertionBoundary::InsertionBoundary | ( | const InsertionBoundary & | other | ) |
Copy constructor (with deep copy)
Copy constructor
Definition at line 43 of file InsertionBoundary.cc.
References BaseParticle::copy(), maxFailed_, numberOfParticlesInserted_, and particleToCopy_.
|
virtual |
Destructor: delete the particle that has to be copied at every insertion.
Destructor that deletes the BaseParticle that is copied and inserted at every insertion.
Definition at line 60 of file InsertionBoundary.cc.
References particleToCopy_.
|
virtual |
Fills the boundary with particles.
Is used to fill the insides of the boundary with particles until it is filled up.
[in,out] | md | the problem's DPMBase object |
Definition at line 85 of file InsertionBoundary.cc.
References DPMBase::checkParticleForInteraction(), BaseHandler< T >::copyAndAddObject(), generateParticle(), maxFailed_, numberOfParticlesInserted_, DPMBase::particleHandler, and DPMBase::random.
|
pure virtual |
Purely virtual function that generates one particle.
[in] | random | Random number generator that can be used for initial positions and velocities |
Implemented in HopperInsertionBoundary, CubeInsertionBoundary, and ChuteInsertionBoundary.
Referenced by checkBoundaryBeforeTimeStep().
unsigned int InsertionBoundary::getMaxFailed | ( | ) | const |
Gets the number of times that the boundary may fail to insert a particle.
Return maxFailed_ (see InsertionBoundary::setMaxFailed).
Definition at line 135 of file InsertionBoundary.cc.
References maxFailed_.
unsigned int InsertionBoundary::getNumberOfParticlesInserted | ( | ) | const |
Gets the number of particles inserted by the boundary.
Returns the number of particles inserted in the boundary
Definition at line 116 of file InsertionBoundary.cc.
References numberOfParticlesInserted_.
Referenced by Chute::write().
BaseParticle * InsertionBoundary::getParticleToCopy | ( | ) | const |
Gets the particle that will be inserted through the insertion boundary.
returns pointer to the particle copies of which are to be inserted
Definition at line 153 of file InsertionBoundary.cc.
References particleToCopy_.
Referenced by ChuteInsertionBoundary::generateParticle(), CubeInsertionBoundary::generateParticle(), and HopperInsertionBoundary::generateParticle().
|
virtual |
Reads the boundary's id_ and maxFailed_.
reads the boundary's id_ and maxFailed_ from the given istream
[in,out] | is | stream the data members are read from |
Implements BaseBoundary.
Definition at line 165 of file InsertionBoundary.cc.
References ParticleHandler::getNewObject(), maxFailed_, numberOfParticlesInserted_, particleToCopy_, and BaseBoundary::read().
Referenced by ChuteInsertionBoundary::read(), CubeInsertionBoundary::read(), and HopperInsertionBoundary::read().
void InsertionBoundary::set | ( | BaseParticle * | particleToCopy, |
unsigned int | maxFailed | ||
) |
Sets the particle that will be inserted and the maximum number of times for which insertion may fail.
Sets the particle that will be inserted and the maximum number of times for which insertion may fail.
[in] | particleToCopy | Particle that will be copied and inserted in the domain |
[in] | maxFailed | Number of times that the wall may fail to insert a particle |
Definition at line 72 of file InsertionBoundary.cc.
References BaseParticle::copy(), maxFailed_, and particleToCopy_.
void InsertionBoundary::setMaxFailed | ( | unsigned int | maxFailed | ) |
Sets the number of times that the wall may fail to insert a particle.
Sets the maximum number of times InsertionBoundary::checkBoundaryBeforeTimeStep() may try to insert a particle and fail, before the insertion of particles stops.
[in] | maxFailed | the maximum number of particle insertion trials |
Definition at line 126 of file InsertionBoundary.cc.
References maxFailed_.
Referenced by ChuteInsertionBoundary::oldRead(), CubeInsertionBoundary::oldRead(), HopperInsertionBoundary::oldRead(), ChuteInsertionBoundary::set(), CubeInsertionBoundary::set(), and HopperInsertionBoundary::set().
void InsertionBoundary::setParticleToCopy | ( | BaseParticle * | particleToCopy | ) |
Sets the particle that will be inserted through the insertion boundary.
Sets the pointer to the particle, copies of which are inserted
[in] | particleToCopy | pointer to the particle to be inserted |
Definition at line 144 of file InsertionBoundary.cc.
References BaseParticle::copy(), and particleToCopy_.
Referenced by ChuteInsertionBoundary::set(), CubeInsertionBoundary::set(), and HopperInsertionBoundary::set().
|
virtual |
Writes the boundary's id_ and maxFailed_.
adds the boundary's id_ and maxFailed_ to the given ostream
[in,out] | is | stream the data members are to be added to |
Implements BaseBoundary.
Definition at line 181 of file InsertionBoundary.cc.
References BaseParticle::getName(), maxFailed_, numberOfParticlesInserted_, particleToCopy_, and BaseBoundary::write().
Referenced by ChuteInsertionBoundary::write(), CubeInsertionBoundary::write(), and HopperInsertionBoundary::write().
|
protected |
Number of times that the wall may fail to insert a particle.
Definition at line 122 of file InsertionBoundary.h.
Referenced by checkBoundaryBeforeTimeStep(), getMaxFailed(), InsertionBoundary(), read(), set(), setMaxFailed(), and write().
|
protected |
Number of particles that are already inserted.
Definition at line 127 of file InsertionBoundary.h.
Referenced by checkBoundaryBeforeTimeStep(), getNumberOfParticlesInserted(), InsertionBoundary(), read(), and write().
|
protected |
Particle that will be inserted through the insertion boundary.
Definition at line 117 of file InsertionBoundary.h.
Referenced by getParticleToCopy(), InsertionBoundary(), read(), set(), setParticleToCopy(), write(), and ~InsertionBoundary().