MercuryDPM  Beta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CubeInsertionBoundary Class Reference

It's an insertion boundary which has cuboidal shape (yes, 'CuboidalInsertionBoundary' would have been the correct name). More...

#include <CubeInsertionBoundary.h>

+ Inheritance diagram for CubeInsertionBoundary:

Public Member Functions

 CubeInsertionBoundary ()
 Constructor; sets everything to 0. More...
 
 CubeInsertionBoundary (const CubeInsertionBoundary &other)
 Copy constructor with deep copy. More...
 
 ~CubeInsertionBoundary ()
 Destructor: default destructor. More...
 
virtual CubeInsertionBoundarycopy () const
 Creates a copy on the heap and returns a pointer. More...
 
void set (BaseParticle *particleToCopy, int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, double radMin, double radMax)
 Sets the properties of the cuboidal insertion boundary. More...
 
virtual BaseParticlegenerateParticle (RNG &random)
 Generates a particle with random position, radius and velocity. More...
 
void read (std::istream &is) override
 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 override
 writes boundary properties to ostream More...
 
virtual std::string getName () const
 Returns the name of the object. More...
 
- Public Member Functions inherited from InsertionBoundary
 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 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...
 
BaseParticlegetParticleToCopy () 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 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...
 
BoundaryHandlergetHandler () 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

Vec3D posMin_
 Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of the particles to be inserted. More...
 
Vec3D posMax_
 
Vec3D velMin_
 
Vec3D velMax_
 
double radMin_
 minimum and maximum radii of the particles to be inserted More...
 
double radMax_
 

Detailed Description

It's an insertion boundary which has cuboidal shape (yes, 'CuboidalInsertionBoundary' would have been the correct name).

Definition at line 41 of file CubeInsertionBoundary.h.

Constructor & Destructor Documentation

CubeInsertionBoundary::CubeInsertionBoundary ( )

Constructor; sets everything to 0.

Default constructor; sets every data member to 0.

Definition at line 33 of file CubeInsertionBoundary.cc.

References posMax_, posMin_, radMax_, radMin_, velMax_, and velMin_.

Referenced by copy().

34 {
35  posMin_ = Vec3D(0.0, 0.0, 0.0);
36  posMax_ = Vec3D(0.0, 0.0, 0.0);
37  velMin_ = Vec3D(0.0, 0.0, 0.0);
38  velMax_ = Vec3D(0.0, 0.0, 0.0);
39  radMin_ = 0;
40  radMax_ = 0;
41 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
InsertionBoundary()
Default constructor: set everything to 0/nullptr.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
double radMin_
minimum and maximum radii of the particles to be inserted
CubeInsertionBoundary::CubeInsertionBoundary ( const CubeInsertionBoundary other)

Copy constructor with deep copy.

Copy constructor

Definition at line 46 of file CubeInsertionBoundary.cc.

References posMax_, posMin_, radMax_, radMin_, velMax_, and velMin_.

47  : InsertionBoundary(other)
48 {
49  posMin_ = other.posMin_;
50  posMax_ = other.posMax_;
51  velMin_ = other.velMin_;
52  velMax_ = other.velMax_;
53  radMin_ = other.radMin_;
54  radMax_ = other.radMax_;
55 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
InsertionBoundary()
Default constructor: set everything to 0/nullptr.
double radMin_
minimum and maximum radii of the particles to be inserted
CubeInsertionBoundary::~CubeInsertionBoundary ( )

Destructor: default destructor.

Destructor. Since there are no pointers in this class, there is no need for any actions here.

Definition at line 61 of file CubeInsertionBoundary.cc.

62 {
63 }

Member Function Documentation

CubeInsertionBoundary * CubeInsertionBoundary::copy ( ) const
virtual

Creates a copy on the heap and returns a pointer.

Copy method; creates a copy on the heap and returns its pointer.

Returns
pointer to the copy on the heap

Implements BaseBoundary.

Definition at line 69 of file CubeInsertionBoundary.cc.

References CubeInsertionBoundary().

70 {
71 #ifdef DEBUG_CONSTRUCTOR
72  std::cout << "CubeInsertionBoundary::copy() const finished" << std::endl;
73 #endif
74  return new CubeInsertionBoundary(*this);
75 }
CubeInsertionBoundary()
Constructor; sets everything to 0.
BaseParticle * CubeInsertionBoundary::generateParticle ( RNG random)
virtual

Generates a particle with random position, radius and velocity.

Generates a particle with random position (although within the boundary, of course), velocity and radius and returns its pointer.

Parameters
[in]randomRandom number generator

Implements InsertionBoundary.

Definition at line 115 of file CubeInsertionBoundary.cc.

References BaseParticle::copy(), InsertionBoundary::getParticleToCopy(), RNG::getRandomNumber(), posMax_, posMin_, radMax_, radMin_, BaseInteractable::setPosition(), BaseParticle::setRadius(), BaseInteractable::setVelocity(), velMax_, velMin_, Vec3D::X, Vec3D::Y, and Vec3D::Z.

116 {
118  Vec3D pos, vel;
119  double radius;
120  pos.X = random.getRandomNumber(posMin_.X, posMax_.X);
121  pos.Y = random.getRandomNumber(posMin_.Y, posMax_.Y);
122  pos.Z = random.getRandomNumber(posMin_.Z, posMax_.Z);
123  vel.X = random.getRandomNumber(velMin_.X, velMax_.X);
124  vel.Y = random.getRandomNumber(velMin_.Y, velMax_.Y);
125  vel.Z = random.getRandomNumber(velMin_.Z, velMax_.Z);
126  radius = random.getRandomNumber(radMin_, radMax_);
127  P->setPosition(pos);
128  P->setVelocity(vel);
129  P->setRadius(radius);
130  return P;
131 }
Mdouble X
the vector components
Definition: Vector.h:52
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
BaseParticle * getParticleToCopy() const
Gets the particle that will be inserted through the insertion boundary.
Mdouble Y
Definition: Vector.h:52
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
double radMin_
minimum and maximum radii of the particles to be inserted
Mdouble Z
Definition: Vector.h:52
Mdouble getRandomNumber(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:69
virtual BaseParticle * copy() const
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
std::string CubeInsertionBoundary::getName ( ) const
virtual

Returns the name of the object.

Returns the name of the object class

Returns
the object's class' name, i.e. 'CubeInsertionBoundary'

Implements BaseObject.

Definition at line 186 of file CubeInsertionBoundary.cc.

187 {
188  return "CubeInsertionBoundary";
189 }
void CubeInsertionBoundary::oldRead ( std::istream &  is)

deprecated version of CubeInsertionBoundary::read().

Deprecated version of read().

Deprecated:
Should be gone by Mercury 2.0. Instead, use CubeInsertionBoundary::read().

Definition at line 153 of file CubeInsertionBoundary.cc.

References posMax_, posMin_, radMax_, radMin_, InsertionBoundary::setMaxFailed(), velMax_, and velMin_.

154 {
155  int maxFailed;
156  std::string dummy;
157  is >> dummy >> maxFailed
158  >> dummy >> posMin_
159  >> dummy >> posMax_
160  >> dummy >> velMin_
161  >> dummy >> velMax_
162  >> dummy >> radMin_
163  >> dummy >> radMax_;
164  setMaxFailed(maxFailed);
165 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
void setMaxFailed(unsigned int maxFailed)
Sets the number of times that the wall may fail to insert a particle.
double radMin_
minimum and maximum radii of the particles to be inserted
void CubeInsertionBoundary::read ( std::istream &  is)
overridevirtual

reads boundary properties from istream

Reads the boundary properties from an istream

Parameters
[in,out]isthe istream

Implements BaseBoundary.

Definition at line 137 of file CubeInsertionBoundary.cc.

References posMax_, posMin_, radMax_, radMin_, InsertionBoundary::read(), velMax_, and velMin_.

138 {
140  std::string dummy;
141  is >> dummy >> posMin_
142  >> dummy >> posMax_
143  >> dummy >> velMin_
144  >> dummy >> velMax_
145  >> dummy >> radMin_
146  >> dummy >> radMax_;
147 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
void read(std::istream &is)
Reads the boundary's id_ and maxFailed_.
double radMin_
minimum and maximum radii of the particles to be inserted
void CubeInsertionBoundary::set ( BaseParticle particleToCopy,
int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax,
double  radMin,
double  radMax 
)

Sets the properties of the cuboidal insertion boundary.

Sets all the properties of the cuboidal insertion boundary.

Parameters
[in]particleToCopyPointer to the BaseParticle which is used as a basis for the particles to be inserted
[in]maxFailedThe maximum number of times the insertion of a particle may be tried and failed before the insertion of particles is considered done NB: this property is used in the parent's InsertionBoundary::checkBoundaryBeforeTimeStep().
[in]posMinFirst defining corner of cuboidal insertion boundary
[in]posMaxSecond defining corner of cuboidal insertion boundary
[in]velMinMinimum velocity of inserted particles
[in]velMaxMaximum velocity of inserted particles
[in]radMinMinimum radius of inserted particles
[in]radMaxMaximum radius of inserted particles

Definition at line 93 of file CubeInsertionBoundary.cc.

References posMax_, posMin_, radMax_, radMin_, InsertionBoundary::setMaxFailed(), InsertionBoundary::setParticleToCopy(), velMax_, and velMin_.

94 {
95  setParticleToCopy(particleToCopy);
96  setMaxFailed(maxFailed);
97  posMin_ = posMin;
98  posMax_ = posMax;
99  velMin_ = velMin;
100  velMax_ = velMax;
101  radMin_ = radMin;
102  radMax_ = radMax;
103 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
void setMaxFailed(unsigned int maxFailed)
Sets the number of times that the wall may fail to insert a particle.
void setParticleToCopy(BaseParticle *particleToCopy)
Sets the particle that will be inserted through the insertion boundary.
double radMin_
minimum and maximum radii of the particles to be inserted
void CubeInsertionBoundary::write ( std::ostream &  os) const
overridevirtual

writes boundary properties to ostream

Writes boundary's properties to an ostream

Parameters
[in]osthe ostream

Implements BaseBoundary.

Definition at line 171 of file CubeInsertionBoundary.cc.

References posMax_, posMin_, radMax_, radMin_, velMax_, velMin_, and InsertionBoundary::write().

172 {
174  os << " posMin " << posMin_
175  << " posMax " << posMax_
176  << " velMin " << velMin_
177  << " velMax " << velMax_
178  << " radMin " << radMin_
179  << " radMax " << radMax_;
180 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
double radMin_
minimum and maximum radii of the particles to be inserted
void write(std::ostream &os) const
Writes the boundary's id_ and maxFailed_.

Member Data Documentation

Vec3D CubeInsertionBoundary::posMax_
private
Vec3D CubeInsertionBoundary::posMin_
private

Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of the particles to be inserted.

Definition at line 100 of file CubeInsertionBoundary.h.

Referenced by CubeInsertionBoundary(), generateParticle(), oldRead(), read(), set(), and write().

double CubeInsertionBoundary::radMax_
private
double CubeInsertionBoundary::radMin_
private

minimum and maximum radii of the particles to be inserted

Definition at line 104 of file CubeInsertionBoundary.h.

Referenced by CubeInsertionBoundary(), generateParticle(), oldRead(), read(), set(), and write().

Vec3D CubeInsertionBoundary::velMax_
private
Vec3D CubeInsertionBoundary::velMin_
private

The documentation for this class was generated from the following files: