MercuryDPM
Beta
|
Defines a pair of periodic walls. Inherits from BaseBoundary. More...
#include <PeriodicBoundary.h>
Public Member Functions | |
PeriodicBoundary () | |
default constructor More... | |
~PeriodicBoundary () | |
destructor More... | |
PeriodicBoundary * | copy () const |
copy method More... | |
void | set (Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight) |
Defines a periodic wall. More... | |
void | set (Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight, Vec3D shiftDirection) |
For general parallelogramic domains, the direction of the shift vector can to be set manually. More... | |
void | moveLeft (Mdouble distanceLeft) |
Sets the distance from the origin of the 'left' periodic wall. More... | |
void | moveRight (Mdouble distanceRight) |
Sets the distance from the origin of the 'right' periodic wall. More... | |
Mdouble | getDistance (BaseParticle &p) |
Returns the distance of the wall to the particle. More... | |
Mdouble | getDistance (const Vec3D &position) |
Returns the distance of the wall to the position. More... | |
void | shiftPosition (BaseParticle *p) |
shifts the particle More... | |
void | shiftPositions (Vec3D &postition1, Vec3D &postion2) |
shifts two positions More... | |
bool | isClosestToLeftBoundary () const |
Returns TRUE if last particle/position checked is closest to the 'left' wall, and FALSE if it is closest to the 'right' wall. More... | |
void | read (std::istream &is) |
reads boundary properties from istream More... | |
MERCURY_DEPRECATED void | oldRead (std::istream &is) |
deprecated version of CubeInsertionBoundary::read(). More... | |
void | write (std::ostream &os) const |
writes boundary properties to ostream More... | |
virtual std::string | getName () const |
Returns the name of the object. More... | |
void | createPeriodicParticles (BaseParticle *p, ParticleHandler &pH) |
Checks distance of particle to closest wall and creates periodic copy if necessary. More... | |
bool | checkBoundaryAfterParticleMoved (BaseParticle *p, ParticleHandler &pH UNUSED) |
Checks if particle has crossed either boundary wall, and applies a shift if that is the case. NB: ALWAYS returns FALSE. More... | |
Public Member Functions inherited from BaseBoundary | |
BaseBoundary () | |
default constructor. More... | |
BaseBoundary (const BaseBoundary &b) | |
copy constructor More... | |
virtual | ~BaseBoundary () |
destructor 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 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... | |
Private Attributes | |
bool | closestToLeftBoundary_ |
true if closest wall is the left wall More... | |
Vec3D | normal_ |
outward unit normal vector for right wall More... | |
Mdouble | distanceLeft_ |
position of left wall, s.t. normal*x=position_left More... | |
Mdouble | distanceRight_ |
position of right wall, s.t. normal*x=position_right More... | |
Mdouble | scaleFactor_ |
This is the normal to rescale the normal vector to a unit vectors. More... | |
Vec3D | shift_ |
shift from left to right boundary More... | |
Defines a pair of periodic walls. Inherits from BaseBoundary.
The particles are in {x: position_left<=normal*x <position_right}, with normal being the outward unit normal vector of the right wall. If a particle moves outside these boundaries, it will be shifted.
Definition at line 41 of file PeriodicBoundary.h.
PeriodicBoundary::PeriodicBoundary | ( | ) |
default constructor
constructor
Definition at line 33 of file PeriodicBoundary.cc.
References closestToLeftBoundary_, distanceLeft_, distanceRight_, and scaleFactor_.
Referenced by copy().
PeriodicBoundary::~PeriodicBoundary | ( | ) |
bool PeriodicBoundary::checkBoundaryAfterParticleMoved | ( | BaseParticle * | p, |
ParticleHandler &pH | UNUSED | ||
) |
Checks if particle has crossed either boundary wall, and applies a shift if that is the case. NB: ALWAYS returns FALSE.
Checks whether given particle has crossed the closest wall, and if so, shifts its position so as to have it appear at the other wall
[in] | p | The particle to be checked and possibly shifted |
pH | The ParticleHandler, which is unused in this implementation |
Definition at line 358 of file PeriodicBoundary.cc.
References getDistance(), and shiftPosition().
|
virtual |
copy method
Copy method; creates a copy on the heap and returns its pointer.
Implements BaseBoundary.
Definition at line 59 of file PeriodicBoundary.cc.
References PeriodicBoundary().
void PeriodicBoundary::createPeriodicParticles | ( | BaseParticle * | p, |
ParticleHandler & | pH | ||
) |
Checks distance of particle to closest wall and creates periodic copy if necessary.
Checks the distance of given particle to the closest of both periodic walls, and creates a periodic copy of the particle if needed (i.e. if the particle is closer to the periodic wall than the radius of the largest particle in the system).
[in] | p | Particle to be checked and possibly periodically copied |
[in,out] | pH | System's ParticleHandler, (1) from which the interaction radius of its largest particle is retrieved to determine the maximum distance from the wall at which a particle should still have a periodic copy created, and (2) to which a possible periodic copy of the particle will be added |
Definition at line 326 of file PeriodicBoundary.cc.
References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), getDistance(), BaseParticle::getInteractionRadius(), ParticleHandler::getLargestParticle(), BaseParticle::getPeriodicFromParticle(), BaseParticle::setPeriodicFromParticle(), and shiftPosition().
Mdouble PeriodicBoundary::getDistance | ( | BaseParticle & | p | ) |
Returns the distance of the wall to the particle.
Returns the distance to the closest wall of the boundary to the particle, , and sets closestToLeftBoundary_ = true if the left wall is the wall closest to the particle. Since this function should be called before calculating any Particle-Wall interactions, it can also be used to set the shift vector in case of curved walls.
[in] | p | A reference to the particle which distance to the periodic boundary is calculated |
Definition at line 134 of file PeriodicBoundary.cc.
References BaseInteractable::getPosition().
Referenced by checkBoundaryAfterParticleMoved(), and createPeriodicParticles().
Returns the distance of the wall to the position.
Returns the distance to the wall closest to the position, and sets closestToLeftBoundary_ = true if the left wall is the wall closest to the position.
[in] | position | A reference to the position which distance to the periodic boundary is to be calculated |
Definition at line 145 of file PeriodicBoundary.cc.
References closestToLeftBoundary_, distanceLeft_, distanceRight_, Vec3D::dot(), and normal_.
|
virtual |
Returns the name of the object.
Returns the name of the object class
Implements BaseObject.
Definition at line 302 of file PeriodicBoundary.cc.
bool PeriodicBoundary::isClosestToLeftBoundary | ( | ) | const |
Returns TRUE if last particle/position checked is closest to the 'left' wall, and FALSE if it is closest to the 'right' wall.
Definition at line 233 of file PeriodicBoundary.cc.
References closestToLeftBoundary_.
void PeriodicBoundary::moveLeft | ( | Mdouble | distanceLeft | ) |
Sets the distance from the origin of the 'left' periodic wall.
Allows the left periodic boundary to be moved to a new position and automatically changes its shift value
[in] | distanceLeft | The distance (from the origin) to which the left boundary is moved |
Definition at line 108 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
void PeriodicBoundary::moveRight | ( | Mdouble | distanceRight | ) |
Sets the distance from the origin of the 'right' periodic wall.
Allows the right periodic wall to be moved to a new position and automatically changes its shift value
[in] | distanceRight | The distance (from the origin) to which the right boundary is moved |
Definition at line 120 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
void PeriodicBoundary::oldRead | ( | std::istream & | is | ) |
deprecated version of CubeInsertionBoundary::read().
Deprecated version of read().
Definition at line 274 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
|
virtual |
reads boundary properties from istream
Reads the boundary properties from an istream
[in] | is | the istream |
Implements BaseBoundary.
Definition at line 259 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, BaseBoundary::read(), scaleFactor_, and shift_.
Defines a periodic wall.
Defines the boundary, given a normal vector such that all particles are within {x: position_left<=normal*x<position_right}. The shift vector is set assuming that the domain is rectangular (shift parallel to normal).
[in] | normal | The normal vector pointing from the left wall into the domain |
[in] | distanceLeft | The (signed) distance between the left wall and the origin |
[in] | distanceRight | The (signed) distance between the right wall and the origin |
Definition at line 72 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, Vec3D::dot(), normal_, scaleFactor_, and shift_.
Referenced by BoundaryHandler::readOldObject(), DPMBase::readParAndIniFiles(), ChuteBottom::setupInitialConditions(), and Chute::setupSideWalls().
void PeriodicBoundary::set | ( | Vec3D | normal, |
Mdouble | distanceLeft, | ||
Mdouble | distanceRight, | ||
Vec3D | shiftDirection | ||
) |
For general parallelogramic domains, the direction of the shift vector can to be set manually.
like PeriodicBoundary::set(normal, distanceLeft, distanceRight), but including the possibility of setting the shift direction vector.
[in] | normal | The normal vector pointing from the left wall into the domain |
[in] | distanceLeft | The (signed) distance between the left wall and the origin |
[in] | distanceRight | The (signed) distance between the right wall and the origin |
[in] | shiftDirection | The vector over which particles will be shifted when moving through the PeriodicBoundary |
Definition at line 91 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, Vec3D::dot(), normal_, scaleFactor_, and shift_.
void PeriodicBoundary::shiftPosition | ( | BaseParticle * | p | ) |
shifts the particle
Shifts the particle (using the closestToLeftBoundary_ value)
[in] | p | A pointer to the particle which will be shifted. |
Definition at line 178 of file PeriodicBoundary.cc.
References closestToLeftBoundary_, BaseInteractable::move(), and shift_.
Referenced by checkBoundaryAfterParticleMoved(), and createPeriodicParticles().
shifts two positions
Shifts two given positions by the shift_ vector.
[in] | position1 | The first position to be shifted |
[in] | position2 | The second position to be shifted |
Definition at line 212 of file PeriodicBoundary.cc.
References closestToLeftBoundary_, and shift_.
|
virtual |
writes boundary properties to ostream
Writes boundary's properties to an ostream
[in] | os | the ostream |
Implements BaseBoundary.
Definition at line 288 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, shift_, and BaseBoundary::write().
|
private |
true if closest wall is the left wall
Definition at line 156 of file PeriodicBoundary.h.
Referenced by getDistance(), isClosestToLeftBoundary(), PeriodicBoundary(), shiftPosition(), and shiftPositions().
|
private |
position of left wall, s.t. normal*x=position_left
Definition at line 164 of file PeriodicBoundary.h.
Referenced by getDistance(), moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), and write().
|
private |
position of right wall, s.t. normal*x=position_right
Definition at line 168 of file PeriodicBoundary.h.
Referenced by getDistance(), moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), and write().
|
private |
outward unit normal vector for right wall
Definition at line 160 of file PeriodicBoundary.h.
Referenced by getDistance(), moveLeft(), moveRight(), oldRead(), read(), set(), and write().
|
private |
This is the normal to rescale the normal vector to a unit vectors.
Definition at line 172 of file PeriodicBoundary.h.
Referenced by moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), and write().
|
private |
shift from left to right boundary
Definition at line 176 of file PeriodicBoundary.h.
Referenced by moveLeft(), moveRight(), oldRead(), read(), set(), shiftPosition(), shiftPositions(), and write().