MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BidisperseCubeInsertionBoundary Class Reference

Like a CubeInsertionBoundary but the particles generated are one of two types. More...

#include <BidisperseCubeInsertionBoundary.h>

+ Inheritance diagram for BidisperseCubeInsertionBoundary:

Public Member Functions

 BidisperseCubeInsertionBoundary ()
 Constructor; sets everything to 0. More...
 
 BidisperseCubeInsertionBoundary (const BidisperseCubeInsertionBoundary &other)
 Copy constructor with deep copy. More...
 
 ~BidisperseCubeInsertionBoundary () override
 Destructor: default destructor. More...
 
BidisperseCubeInsertionBoundarycopy () const override
 Creates a copy on the heap and returns a pointer. More...
 
void set (BaseParticle *particleToCopyA, BaseParticle *particleToCopyB, double probA, int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax)
 Sets the properties of this bidisperse cuboidal insertion boundary. More...
 
BaseParticlegetParticleToCopyA () const
 Get the particles that need to be copied. More...
 
BaseParticlegetParticleToCopyB () const
 
BaseParticlegenerateParticle (RNG &random) override
 Generates a particle with random position, radius and velocity. More...
 
void read (std::istream &is) override
 reads boundary properties from istream More...
 
void write (std::ostream &os) const override
 writes boundary properties to ostream More...
 
std::string getName () const override
 Returns the name of the object. More...
 
- Public Member Functions inherited from CubeInsertionBoundary
 CubeInsertionBoundary ()
 Constructor; sets everything to 0. More...
 
 CubeInsertionBoundary (const CubeInsertionBoundary &other)
 Copy constructor with deep copy. More...
 
 ~CubeInsertionBoundary () override
 Destructor: default destructor. More...
 
CubeInsertionBoundarycopy () const override
 Creates a copy on the heap and returns a pointer. More...
 
void set (BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, double radMin, double radMax)
 Sets the properties of the CubeInsertionBoundary. More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, double radMin, double radMax)
 
void setRadiusRange (Mdouble radMin, Mdouble radMax)
 Sets the range of particle radii that may be generated. More...
 
void setGeometry (Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax)
 Sets the geometry (position and velocity distribution) of the CubeInsertionBoundary. More...
 
void placeParticle (BaseParticle *p, RNG &random) override
 Generates a random position, velocity for the particle p. 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...
 
- 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...
 
 ~InsertionBoundary () override
 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...
 
void checkBoundaryBeforeTimeStep (DPMBase *md) override
 Fills the boundary with particles. More...
 
void insertParticles (DPMBase *md)
 
unsigned int getNumberOfParticlesInserted () const
 Gets the number of particles inserted by the boundary. More...
 
double getMassOfParticlesInserted () const
 
double getVolumeOfParticlesInserted () const
 
void reset ()
 
void activate ()
 Turns on the InsertionBoundary. More...
 
void deactivate ()
 Turns off the InsertionBoundary. More...
 
bool isActivated ()
 Returns whether the InsertionBoundary is activated. 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) override
 Reads the boundary's id_ and maxFailed_. More...
 
void write (std::ostream &os) const override
 Writes the boundary's id_ and maxFailed_. More...
 
Mdouble getVolumeFlowRate () const
 
void setVolumeFlowRate (Mdouble volumeFlowRate_)
 
Mdouble getInitialVolume () const
 
void setInitialVolume (Mdouble initialVolume)
 
void setPSD (PSD psd)
 Sets the range of particle radii that may be generated from a user defined PSD. More...
 
PSD getPSD ()
 
void setDistribution (Distribution distribution)
 Sets the range of particle radii that may be generated to custom distributions. More...
 
Distribution getDistribution ()
 Gets the range of particle radii that may be generated. More...
 
void setVariableVolumeFlowRate (const std::vector< Mdouble > &variableCumulativeVolumeFlowRate, Mdouble samplingInterval)
 
bool insertParticle (Mdouble time)
 
bool getCheckParticleForInteraction () const
 
void setCheckParticleForInteraction (bool checkParticleForInteraction)
 
void setManualInsertion (bool manualInsertion)
 Set the flag for a manual PSD insertion routine. 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 checkBoundaryAfterParticlesMove (ParticleHandler &pH)
 Virtual function that does things to particles, each time step after particles have moved. 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...
 
BoundaryHandlergetHandler () 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

BaseParticleparticleToCopyA_
 
BaseParticleparticleToCopyB_
 
double probA_
 

Additional Inherited Members

- Public Types inherited from InsertionBoundary
enum  Distribution { Distribution::Uniform, Distribution::Normal_1_5 }
 Defines a custom particle size distribution; distribution_ will always be used, unless particleSizeDistribution_ is non-empty. More...
 
- Protected Attributes inherited from CubeInsertionBoundary
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_
 
- Protected Attributes inherited from InsertionBoundary
BaseParticleparticleToCopy_
 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...
 
Mdouble massInserted_
 Total mass of particles inserted. More...
 
Mdouble volumeInserted_
 Total volume of particles inserted. More...
 
bool isActivated_
 The InsertionBoundary is activated by default. If the InsertionBoundary is deactivated, then it introduces no particles (useful for trying to maintain a certain insertion rate). More...
 
Mdouble volumeFlowRate_
 
Mdouble initialVolume_
 
std::vector< MdoublevariableCumulativeVolumeFlowRate_
 
Mdouble samplingInterval_
 
bool checkParticleForInteraction_
 
PSD particleSizeDistribution_
 Defines a particle size distribution as an object of the PSD class; if particleSizeDistribution_ is empty, distribution_ is used instead. More...
 
Mdouble radMin_
 Minimum and maximum radii of the generated particles. More...
 
Mdouble radMax_
 
Distribution distribution_ = Distribution::Uniform
 defines a custom particle size distribution, which by default is uniform More...
 
bool isManuallyInserting_
 A flag to enable a top-down class-by-class manual insertion of a PSD; default is FALSE. More...
 

Detailed Description

Like a CubeInsertionBoundary but the particles generated are one of two types.

Definition at line 40 of file BidisperseCubeInsertionBoundary.h.

Constructor & Destructor Documentation

BidisperseCubeInsertionBoundary::BidisperseCubeInsertionBoundary ( )

Constructor; sets everything to 0.

Definition at line 28 of file BidisperseCubeInsertionBoundary.cc.

References particleToCopyA_, particleToCopyB_, and probA_.

Referenced by copy().

BidisperseCubeInsertionBoundary::BidisperseCubeInsertionBoundary ( const BidisperseCubeInsertionBoundary other)
BidisperseCubeInsertionBoundary::~BidisperseCubeInsertionBoundary ( )
override

Destructor: default destructor.

Destructor. This class introduces two new pointers (beyond those introduced by its ancestors) so we need to free them.

Definition at line 46 of file BidisperseCubeInsertionBoundary.cc.

References particleToCopyA_, and particleToCopyB_.

Member Function Documentation

BidisperseCubeInsertionBoundary * BidisperseCubeInsertionBoundary::copy ( ) const
overridevirtual

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 56 of file BidisperseCubeInsertionBoundary.cc.

References BidisperseCubeInsertionBoundary().

57 {
58 #ifdef DEBUG_CONSTRUCTOR
59  std::cout << "BidisperseCubeInsertionBoundary::copy() const finished" << std::endl;
60 #endif
61  return new BidisperseCubeInsertionBoundary(*this);
62 }
BidisperseCubeInsertionBoundary()
Constructor; sets everything to 0.
BaseParticle * BidisperseCubeInsertionBoundary::generateParticle ( RNG random)
overridevirtual

Generates a particle with random position, radius and velocity.

Generates a particle with random position and velocity.

Reimplemented from InsertionBoundary.

Definition at line 88 of file BidisperseCubeInsertionBoundary.cc.

References helpers::check(), BaseParticle::copy(), RNG::getRandomNumber(), particleToCopyA_, particleToCopyB_, CubeInsertionBoundary::posMax_, CubeInsertionBoundary::posMin_, probA_, BaseInteractable::setPosition(), BaseInteractable::setVelocity(), CubeInsertionBoundary::velMax_, CubeInsertionBoundary::velMin_, Vec3D::X, Vec3D::Y, and Vec3D::Z.

89 {
90  double check = random.getRandomNumber(0, 1);
91  BaseParticle* P = (check < probA_) ? particleToCopyA_->copy()
93  Vec3D pos, vel;
94  pos.X = random.getRandomNumber(posMin_.X, posMax_.X);
95  pos.Y = random.getRandomNumber(posMin_.Y, posMax_.Y);
96  pos.Z = random.getRandomNumber(posMin_.Z, posMax_.Z);
97  vel.X = random.getRandomNumber(velMin_.X, velMax_.X);
98  vel.Y = random.getRandomNumber(velMin_.Y, velMax_.Y);
99  vel.Z = random.getRandomNumber(velMin_.Z, velMax_.Z);
100  P->setPosition(pos);
101  P->setVelocity(vel);
102  return P;
103 }
Mdouble X
the vector components
Definition: Vector.h:65
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 check(double real, double ideal, double error, std::string errorMessage)
Definition: Helpers.cc:898
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:143
virtual BaseParticle * copy() const =0
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
Mdouble Y
Definition: Vector.h:65
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: Vector.h:49
Mdouble Z
Definition: Vector.h:65
std::string BidisperseCubeInsertionBoundary::getName ( ) const
overridevirtual

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 130 of file BidisperseCubeInsertionBoundary.cc.

131 {
132  return "BidisperseCubeInsertionBoundary";
133 }
BaseParticle * BidisperseCubeInsertionBoundary::getParticleToCopyA ( ) const

Get the particles that need to be copied.

Definition at line 75 of file BidisperseCubeInsertionBoundary.cc.

References particleToCopyA_.

76 {
77  return particleToCopyA_;
78 }
BaseParticle * BidisperseCubeInsertionBoundary::getParticleToCopyB ( ) const

Definition at line 80 of file BidisperseCubeInsertionBoundary.cc.

References particleToCopyB_.

81 {
82  return particleToCopyB_;
83 }
void BidisperseCubeInsertionBoundary::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 109 of file BidisperseCubeInsertionBoundary.cc.

References probA_, and CubeInsertionBoundary::read().

110 {
112  std::string dummy;
113  is >> dummy >> probA_;
114 }
void read(std::istream &is) override
reads boundary properties from istream
void BidisperseCubeInsertionBoundary::set ( BaseParticle particleToCopyA,
BaseParticle particleToCopyB,
double  probA,
int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax 
)

Sets the properties of this bidisperse cuboidal insertion boundary.

Definition at line 65 of file BidisperseCubeInsertionBoundary.cc.

References particleToCopyA_, particleToCopyB_, probA_, and CubeInsertionBoundary::set().

67 {
68  particleToCopyA_ = particleToCopyA;
69  particleToCopyB_ = particleToCopyB;
70  probA_ = probA;
71  CubeInsertionBoundary::set(particleToCopyA, maxFailed,
72  posMin, posMax, velMin, velMax, 0, 0);
73 }
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, double radMin, double radMax)
Sets the properties of the CubeInsertionBoundary.
void BidisperseCubeInsertionBoundary::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 120 of file BidisperseCubeInsertionBoundary.cc.

References probA_, and CubeInsertionBoundary::write().

121 {
123  os << " probA " << probA_;
124 }
void write(std::ostream &os) const override
writes boundary properties to ostream

Member Data Documentation

BaseParticle* BidisperseCubeInsertionBoundary::particleToCopyA_
private
BaseParticle* BidisperseCubeInsertionBoundary::particleToCopyB_
private
double BidisperseCubeInsertionBoundary::probA_
private

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