44 #ifdef MERCURY_USE_MPI
45 MPIContainer& communicator = MPIContainer::Instance();
46 if (communicator.getNumberOfProcessors() > 1)
48 logger(
WARN,
"PeriodicBoundaries are currently not implemented in parallel MercuryDPM");
51 logger(
DEBUG,
"PeriodicBoundary::PeriodicBoundary() finished");
52 logger(
DEBUG,
"PeriodicBoundary::PeriodicBoundary() finished");
60 logger(
DEBUG,
"PeriodicBoundary::~PeriodicBoundary() finished");
87 "PeriodicBoundary::set: left distance needs to be smaller than right distance");
336 return "PeriodicBoundary";
Mdouble getDistanceLeft() const
Returns the distance of the left wall to the origin, in normal direction.
BaseParticle * getLargestParticle() const
Gets a pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
void set(Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight)
Defines a periodic wall.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
virtual std::string getName() const override
Returns the name of the object.
MERCURY_DEPRECATED void oldRead(std::istream &is)
deprecated version of CubeInsertionBoundary::read().
void write(std::ostream &os) const =0
Adds object's id_ to given ostream NB: purely virtual function, overriding the version of BaseObject...
Mdouble scaleFactor_
This is the normal to rescale the normal vector to a unit vectors.
void createPeriodicParticles(BaseParticle *p, ParticleHandler &pH)
Checks distance of particle to closest wall and creates periodic copy if necessary.
void setPeriodicFromParticle(BaseParticle *p)
Assigns the pointer to the 'original' particle this one's a periodic copy of.
void moveRight(Mdouble distanceRight)
Sets the distance from the origin of the 'right' periodic wall.
Mdouble getDistanceRight() const
Returns the distance of the right wall to the origin, in normal direction.
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Mdouble distanceRight_
position of right wall, s.t. normal*x=position_right
Vec3D getNormal() const
returns the vector normal to the periodic boundary
PeriodicBoundary * copy() const override
copy method
PeriodicBoundary()
default constructor
Vec3D getShift() const
Returns the vector going from the left to the right side of the periodic boundary.
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Vec3D normal_
outward unit normal vector for right wall
~PeriodicBoundary()
destructor
Defines a pair of periodic walls. Inherits from BaseBoundary.
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
bool checkBoundaryAfterParticleMoved(BaseParticle *p, ParticleHandler &pH UNUSED)
Checks if particle has crossed either boundary wall, and applies a shift if that is the case...
Mdouble getDistance(const BaseParticle &p) const
Returns the distance of the wall to the particle.
void moveLeft(Mdouble distanceLeft)
Sets the distance from the origin of the 'left' periodic wall.
bool isClosestToLeftBoundary(const BaseParticle &p) const
Returns TRUE if last particle/position checked is closest to the 'left' wall, and FALSE if it is clos...
virtual void addObject(BaseParticle *P)
Adds a BaseParticle to the ParticleHandler.
void shiftPosition(BaseParticle *p) const
shifts the particle
Mdouble distanceLeft_
position of left wall, s.t. normal*x=position_left
void copyInteractionsForPeriodicParticles(const BaseInteractable &p)
Copies interactions to this BaseInteractable whenever a periodic copy made.
Container to store all BaseParticle.
Vec3D shift_
shift from left to right boundary
Implementation of a 3D vector (by Vitaliy).
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
void write(std::ostream &os) const override
writes boundary properties to ostream
Mdouble getInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
void read(std::istream &is) override
reads boundary properties from istream
virtual BaseParticle * copy() const
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
void read(std::istream &is)=0
Reads the object's id_ from given istream NB: purely virtual function, overriding the version of Base...
void shiftPositions(Vec3D &postition1, Vec3D &postion2) const
shifts two positions