MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseParticle Class Reference

#include <BaseParticle.h>

+ Inheritance diagram for BaseParticle:

Public Member Functions

 BaseParticle ()
 Basic Particle contructors, creates an Particle at (0,0,0) with radius, mass and inertia equal to 1. More...
 
 BaseParticle (const BaseParticle &p)
 Particle copy contstructor, which accepts as input a reference to a Particle. It creates a copy of this Particle and all it's information. Usually it is better to use the copy() function for polymorfism. More...
 
virtual ~BaseParticle ()
 Particle destructor, needs to be implemented and checked if it removes tangential spring information. More...
 
virtual BaseParticlecopy () const
 Particle copy method. It calls to copy contrustor of this Particle, usefull for polymorfism. More...
 
Mdouble get_Volume (std::vector< CSpecies > &Species) const
 Get Particle volume function, which required a reference to the Species vector. It returns the volume of the Particle. More...
 
void fixParticle ()
 Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to zero. More...
 
bool isFixed ()
 Is fixed Particle function. It returns wether a Particle is fixed or not, by cheking its inverse Mass. More...
 
void unfix (std::vector< CSpecies > &Species)
 Unfix Particle function, which required a reference to the Species vector. It un fixes a Particle by compyting the Particles mass and inertia. More...
 
void compute_particle_mass (std::vector< CSpecies > &Species)
 Compute Particle mass function, which required a reference to the Species vector. It copmuters the Particles mass, Inertia and the inverses. More...
 
virtual void read (std::istream &is)
 Particle read function, which accepts an os std::stringstream as input. More...
 
virtual void print (std::ostream &os) const
 Particle print function, which accepts an os std::stringstream as input. More...
 
virtual void moveInHandler (int newPos)
 
void print_HGRID (std::ostream &os)
 
int get_HGRID_Level () const
 
BaseParticleget_HGRID_NextObject () const
 
BaseParticleget_HGRID_PrevObject () const
 
int get_HGRID_x () const
 
int get_HGRID_y () const
 
int get_HGRID_z () const
 
int get_Index () const
 
Mdouble get_Inertia () const
 
Mdouble get_InvInertia () const
 
Mdouble get_InvMass () const
 
Mdouble get_KineticEnergy () const
 
Mdouble get_Mass () const
 
BaseParticleget_PeriodicFromParticle () const
 
const Vec3Dget_Position () const
 
Mdouble get_Radius () const
 
Mdouble get_InteractionRadius () const
 
Mdouble get_WallInteractionRadius () const
 
int get_Species () const
 
int get_IndSpecies () const
 
int get_Id () const
 
const Vec3Dget_Velocity () const
 
const Vec3Dget_Angle () const
 
const Vec3Dget_AngularVelocity () const
 
const Vec3Dget_Force () const
 
const Vec3Dget_Torque () const
 
const Vec3Dget_Displacement () const
 
const Vec3Dget_PreviousPosition () const
 
ParticleHandlergetHandler () const
 
const Vec3D get_Displacement2 (Mdouble xmin, Mdouble xmax, Mdouble ymin, Mdouble ymax, Mdouble zmin, Mdouble zmax, Mdouble t) const
 
void set_inertia (const Mdouble _new)
 
void set_infiniteInertia ()
 
void set_periodicFromParticle (BaseParticle *_new)
 
void set_species (const int _new)
 
void set_Index (const int _new)
 
void set_HGRID_x (const int _new)
 
void set_HGRID_y (const int _new)
 
void set_HGRID_z (const int _new)
 
void set_HGRID_Level (const int _new)
 
void set_HGRID_NextObject (BaseParticle *_new)
 
void set_HGRID_PrevObject (BaseParticle *_new)
 
void set_Radius (const Mdouble _new)
 
void set_IndSpecies (const int _new)
 
void set_Id (const int _new)
 
void set_Mass (const Mdouble _new)
 
void set_Velocity (const Vec3D &_new)
 
void set_Position (const Vec3D &_new)
 
void set_Displacement (const Vec3D &_new)
 
void set_PreviousPosition (const Vec3D &_new)
 
void set_Angle (const Vec3D &_new)
 
void set_AngularVelocity (const Vec3D &_new)
 
void set_Force (const Vec3D &_new)
 
void set_Torque (const Vec3D &_new)
 
void setHandler (ParticleHandler *handler)
 
void move (const Vec3D &_new)
 
void movePrevious (const Vec3D &_new)
 
void accelerate (const Vec3D &_new)
 
void rotate (const Vec3D &_new)
 
void angularAccelerate (const Vec3D &_new)
 
void add_Displacement (const Vec3D &_new)
 
void add_Force (const Vec3D &_new)
 
void add_Torque (const Vec3D &_new)
 

Private Attributes

ParticleHandlerhandler
 
int HGRID_x
 Hgrid attributes. More...
 
int HGRID_y
 
int HGRID_z
 
int HGRID_Level
 Cell position in the grid. More...
 
BaseParticleHGRID_NextObject
 Grid level for the object. More...
 
BaseParticleHGRID_PrevObject
 Pointer to the next Particle in the same HGrid cell. More...
 
int _index
 Pointer to the previous Particle in the same HGrid cell. More...
 
Mdouble mass
 Index of the Particle in the ParticleHandler, used for outputting fstat data. More...
 
Mdouble invMass
 Particle mass. More...
 
Mdouble inertia
 Inverse Particle mass (for computation optimization) More...
 
Mdouble invInertia
 Particle inertia. More...
 
Mdouble radius
 Inverse Particle inverse inertia (for computation optimization) More...
 
BaseParticleperiodicFromParticle
 Particle radius. More...
 
int indSpecies
 Pointer to originating Particle. More...
 
int _id
 Index of the Species of this Particle. More...
 
Vec3D angle
 non changing identifier of particle More...
 
Vec3D angularVelocity
 Current angular position. More...
 
Vec3D position
 Current angular velocity. More...
 
Vec3D velocity
 Current particle position. More...
 
Vec3D force
 Current particle velocity. More...
 
Vec3D torque
 Interaction force. More...
 
Vec3D displacement
 Torque. More...
 
Vec3D previousPosition
 Displacement (only used in StatisticsVector, StatisticsPoint) More...
 

Friends

std::ostream & operator<< (std::ostream &os, const BaseParticle &b)
 writes wall More...
 
std::istream & operator>> (std::istream &is, BaseParticle &b)
 reads wall More...
 

Detailed Description

Definition at line 42 of file BaseParticle.h.

Constructor & Destructor Documentation

BaseParticle::BaseParticle ( )

Basic Particle contructors, creates an Particle at (0,0,0) with radius, mass and inertia equal to 1.

Definition at line 37 of file BaseParticle.cc.

References angle, angularVelocity, displacement, force, handler, HGRID_NextObject, HGRID_PrevObject, HGRID_x, HGRID_y, HGRID_z, indSpecies, inertia, invInertia, invMass, mass, periodicFromParticle, position, radius, Vec3D::set_zero(), torque, and velocity.

Referenced by copy().

38 {
42  force.set_zero();
43  radius = 1.0;
44  angle.set_zero();
46  torque.set_zero();
47  mass = invMass = 1.0;
48  inertia = invInertia = 1.0;
49  HGRID_NextObject=NULL;
50 
51  indSpecies = 0;
53 #ifdef ContactListHgrid
54  firstPossibleContact=0;
55 #endif
56  HGRID_NextObject = 0;
57  HGRID_PrevObject = 0;
58  HGRID_x = 99999;
59  HGRID_y = 99999;
60  HGRID_z = 99999;
61  handler=0;
62 
63  #ifdef CONSTUCTOR_OUTPUT
64  std::cerr << "BaseParticle() finished"<<std::endl;
65  #endif
66 }
Vec3D velocity
Current particle position.
Definition: BaseParticle.h:193
int HGRID_x
Hgrid attributes.
Definition: BaseParticle.h:174
BaseParticle * periodicFromParticle
Particle radius.
Definition: BaseParticle.h:186
ParticleHandler * handler
Definition: BaseParticle.h:170
Mdouble inertia
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:183
Mdouble mass
Index of the Particle in the ParticleHandler, used for outputting fstat data.
Definition: BaseParticle.h:181
Mdouble radius
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:185
BaseParticle * HGRID_PrevObject
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:177
Vec3D angularVelocity
Current angular position.
Definition: BaseParticle.h:191
Vec3D angle
non changing identifier of particle
Definition: BaseParticle.h:190
Mdouble invInertia
Particle inertia.
Definition: BaseParticle.h:184
Vec3D torque
Interaction force.
Definition: BaseParticle.h:196
Vec3D displacement
Torque.
Definition: BaseParticle.h:198
void set_zero()
Definition: Vector.h:55
BaseParticle * HGRID_NextObject
Grid level for the object.
Definition: BaseParticle.h:176
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182
Vec3D position
Current angular velocity.
Definition: BaseParticle.h:192
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
Vec3D force
Current particle velocity.
Definition: BaseParticle.h:195
BaseParticle::BaseParticle ( const BaseParticle p)

Particle copy contstructor, which accepts as input a reference to a Particle. It creates a copy of this Particle and all it's information. Usually it is better to use the copy() function for polymorfism.

BaseParticle copy contstructor, which accepts as input a reference to a BaseParticle. It creates a copy of this BaseParticle and all it's information. Usually it is better to use the copy() function for polymorfism.

Definition at line 69 of file BaseParticle.cc.

References angle, angularVelocity, displacement, force, get_Inertia(), get_InvInertia(), get_InvMass(), get_Mass(), handler, HGRID_Level, HGRID_NextObject, HGRID_PrevObject, HGRID_x, HGRID_y, HGRID_z, indSpecies, inertia, invInertia, invMass, mass, periodicFromParticle, position, radius, torque, and velocity.

70 {
71  position = p.position;
72  velocity = p.velocity;
74  force = p.force;
75  radius = p.radius;
76  angle = p.angle;
78  torque = p.torque;
79  mass = p.get_Mass();
80  invMass = p.get_InvMass();
81  inertia = p.get_Inertia();
83 
84  HGRID_NextObject = 0;
85  HGRID_PrevObject = 0;
86  HGRID_x = 99999;
87  HGRID_y = 99999;
88  HGRID_z = 99999;
90 
91  handler=0;
92 
95 #ifdef ContactListHgrid
96  firstPossibleContact=0;
97 #endif
98 
99  #ifdef CONSTUCTOR_OUTPUT
100  std::cerr << "BaseParticle(BaseParticle &p) finished"<<std::endl;
101  #endif
102 }
Vec3D velocity
Current particle position.
Definition: BaseParticle.h:193
int HGRID_x
Hgrid attributes.
Definition: BaseParticle.h:174
BaseParticle * periodicFromParticle
Particle radius.
Definition: BaseParticle.h:186
ParticleHandler * handler
Definition: BaseParticle.h:170
Mdouble inertia
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:183
Mdouble mass
Index of the Particle in the ParticleHandler, used for outputting fstat data.
Definition: BaseParticle.h:181
Mdouble radius
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:185
BaseParticle * HGRID_PrevObject
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:177
Vec3D angularVelocity
Current angular position.
Definition: BaseParticle.h:191
Mdouble get_InvInertia() const
Vec3D angle
non changing identifier of particle
Definition: BaseParticle.h:190
Mdouble invInertia
Particle inertia.
Definition: BaseParticle.h:184
Mdouble get_Mass() const
Mdouble get_InvMass() const
Vec3D torque
Interaction force.
Definition: BaseParticle.h:196
int HGRID_Level
Cell position in the grid.
Definition: BaseParticle.h:175
Vec3D displacement
Torque.
Definition: BaseParticle.h:198
BaseParticle * HGRID_NextObject
Grid level for the object.
Definition: BaseParticle.h:176
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182
Vec3D position
Current angular velocity.
Definition: BaseParticle.h:192
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
Mdouble get_Inertia() const
Vec3D force
Current particle velocity.
Definition: BaseParticle.h:195
BaseParticle::~BaseParticle ( )
virtual

Particle destructor, needs to be implemented and checked if it removes tangential spring information.

BaseParticle destructor, needs to be implemented and checked if it removes tangential spring information.

Definition at line 105 of file BaseParticle.cc.

References ParticleHandler::checkExtremaOnDelete(), and handler.

106 {
107  if(handler)
108  {
110  }
111  #ifdef CONSTUCTOR_OUTPUT
112  std::cerr << "virtual ~BaseParticle finished"<<std::endl;
113  #endif
114 }
void checkExtremaOnDelete(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.
ParticleHandler * handler
Definition: BaseParticle.h:170

Member Function Documentation

void BaseParticle::accelerate ( const Vec3D _new)

Definition at line 305 of file BaseParticle.cc.

References velocity.

Referenced by MD::do_integration_after_force_computation(), MD::do_integration_before_force_computation(), and AngledPeriodicBoundary::shift_position().

305 {velocity+=_new;}
Vec3D velocity
Current particle position.
Definition: BaseParticle.h:193
void BaseParticle::add_Displacement ( const Vec3D _new)

Definition at line 308 of file BaseParticle.cc.

References displacement.

308 {displacement+=_new;}
Vec3D displacement
Torque.
Definition: BaseParticle.h:198
void BaseParticle::add_Force ( const Vec3D _new)

Definition at line 309 of file BaseParticle.cc.

References force.

Referenced by MD::compute_external_forces(), MD::compute_internal_forces(), MD::compute_plastic_internal_forces(), and MD::compute_walls().

309 {force+=_new;}
Vec3D force
Current particle velocity.
Definition: BaseParticle.h:195
void BaseParticle::add_Torque ( const Vec3D _new)

Definition at line 310 of file BaseParticle.cc.

References torque.

Referenced by MD::compute_internal_forces(), MD::compute_plastic_internal_forces(), and MD::compute_walls().

310 {torque+=_new;}
Vec3D torque
Interaction force.
Definition: BaseParticle.h:196
void BaseParticle::angularAccelerate ( const Vec3D _new)

Definition at line 307 of file BaseParticle.cc.

References angularVelocity.

Referenced by MD::do_integration_after_force_computation(), and MD::do_integration_before_force_computation().

307 {angularVelocity+=_new;}
Vec3D angularVelocity
Current angular position.
Definition: BaseParticle.h:191
void BaseParticle::compute_particle_mass ( std::vector< CSpecies > &  Species)

Compute Particle mass function, which required a reference to the Species vector. It copmuters the Particles mass, Inertia and the inverses.

Compute BaseParticle mass function, which required a reference to the Species vector. It copmuters the BaseParticles mass, Inertia and the inverses.

Definition at line 159 of file BaseParticle.cc.

References get_Mass(), indSpecies, isFixed(), constants::pi, radius, set_inertia(), set_Mass(), and sqr.

Referenced by MD::compute_particle_masses(), Chute::create_inflow_particle(), ChuteWithHopper::create_inflow_particle(), ChuteWithHopperAndInset::create_inflow_particle(), Chute::get_collision_time(), Chute::get_LightestParticleMass(), MD::get_Mass_from_Radius(), Chute::get_restitution_coefficient(), Chute::getLargestParticle(), Chute::getSmallestParticle(), Chute::initialize_inflow_particle(), MD::read(), MD::read_v1(), MD::read_v2(), Chute::set_collision_time_and_restitution_coefficient(), MD::set_dt(), ChuteBottom::setup_particles_initial_conditions(), and unfix().

159  {
160  if (!isFixed()) {
161  switch(Species[indSpecies].dim_particle)
162  {
163  case 3 :
164  {
165  set_Mass(4.0/3.0 * constants::pi * radius * radius * radius * Species[indSpecies].rho);
166  set_inertia(.4 * get_Mass() * sqr(radius));
167  break;
168  }
169  case 2 :
170  {
171  set_Mass(constants::pi * radius * radius * Species[indSpecies].rho);
172  set_inertia(.5 * get_Mass() * sqr(radius));
173  break;
174  }
175  case 1 :
176  {
177  set_Mass(2.0 * radius * Species[indSpecies].rho);
178  set_inertia(0.0);
179  break;
180  }
181  default :
182  {
183  std::cerr<<"In compute_particle_mass(vector<CSpecies>& Species) the dimension of the particle is not set"<<std::endl;
184  exit(-1);
185  }
186  }
187  }
188 }
void set_inertia(const Mdouble _new)
Mdouble radius
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:185
#define sqr(a)
Definition: ExtendedMath.h:36
bool isFixed()
Is fixed Particle function. It returns wether a Particle is fixed or not, by cheking its inverse Mass...
Mdouble get_Mass() const
const Mdouble pi
Definition: ExtendedMath.h:54
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
void set_Mass(const Mdouble _new)
BaseParticle * BaseParticle::copy ( ) const
virtual

Particle copy method. It calls to copy contrustor of this Particle, usefull for polymorfism.

BaseParticle copy method. It calls to copy contrustor of this BaseParticle, usefull for polymorfism.

Reimplemented in DeltaMaxsParticle, and TangentialSpringParticle.

Definition at line 117 of file BaseParticle.cc.

References BaseParticle().

Referenced by CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), CircularPeriodicBoundary::createPeriodicParticles(), PeriodicBoundary::createPeriodicParticles(), and AngledPeriodicBoundary::createPeriodicParticles().

118 {
119  return new BaseParticle(*this);
120 }
BaseParticle()
Basic Particle contructors, creates an Particle at (0,0,0) with radius, mass and inertia equal to 1...
Definition: BaseParticle.cc:37
void BaseParticle::fixParticle ( )

Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to zero.

Fix BaseParticle function. It fixes a BaseParticle by setting its inverse mass and inertia and velocities to zero.

Definition at line 142 of file BaseParticle.cc.

References angularVelocity, inertia, invInertia, invMass, mass, position, Vec3D::set_zero(), and velocity.

Referenced by MD::read_next_from_data_file(), and MD::set_FixedParticles().

142  {
144 #ifdef USE_SIMPLE_VERLET_INTEGRATION
145  position = PrevPosition;
146 #endif
147 }
Vec3D velocity
Current particle position.
Definition: BaseParticle.h:193
Mdouble inertia
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:183
Mdouble mass
Index of the Particle in the ParticleHandler, used for outputting fstat data.
Definition: BaseParticle.h:181
Vec3D angularVelocity
Current angular position.
Definition: BaseParticle.h:191
Mdouble invInertia
Particle inertia.
Definition: BaseParticle.h:184
void set_zero()
Definition: Vector.h:55
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182
Vec3D position
Current angular velocity.
Definition: BaseParticle.h:192
const Vec3D & BaseParticle::get_Angle ( ) const

Definition at line 244 of file BaseParticle.cc.

References angle.

Referenced by MD::output_xballs_data_particle(), and AngledPeriodicBoundary::shift_position().

244 {return angle;}
Vec3D angle
non changing identifier of particle
Definition: BaseParticle.h:190
const Vec3D & BaseParticle::get_Displacement ( ) const
const Vec3D BaseParticle::get_Displacement2 ( Mdouble  xmin,
Mdouble  xmax,
Mdouble  ymin,
Mdouble  ymax,
Mdouble  zmin,
Mdouble  zmax,
Mdouble  t 
) const

Definition at line 251 of file BaseParticle.cc.

References get_Position(), get_PreviousPosition(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

252 {
254  if (xmax>xmin && fabs(disp.X)>.5*(xmax-xmin)) {
255  if (disp.X>0) disp.X -= xmax-xmin;
256  else disp.X += xmax-xmin;
257  }
258  if (ymax>ymin && fabs(disp.Y)>.5*(ymax-ymin)) {
259  if (disp.Y>0) disp.Y -= ymax-ymin;
260  else disp.Y += ymax-ymin;
261  }
262  if (zmax>zmin && fabs(disp.Z)>.5*(zmax-zmin)) {
263  if (disp.Z>0) disp.Z -= zmax-zmin;
264  else disp.Z += zmax-zmin;
265  }
266  disp /= t;
267  return disp;
268 }
Mdouble X
Definition: Vector.h:44
const Vec3D & get_PreviousPosition() const
const Vec3D & get_Position() const
Mdouble Y
Definition: Vector.h:44
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble Z
Definition: Vector.h:44
const Vec3D & BaseParticle::get_Force ( ) const

Definition at line 246 of file BaseParticle.cc.

References force.

Referenced by MD::do_integration_after_force_computation(), and MD::do_integration_before_force_computation().

246 {return force;}
Vec3D force
Current particle velocity.
Definition: BaseParticle.h:195
BaseParticle * BaseParticle::get_HGRID_PrevObject ( ) const

Definition at line 218 of file BaseParticle.cc.

References HGRID_PrevObject.

Referenced by HGRID_2D::HGRID_RemoveParticleFromHgrid(), and HGRID_3D::HGRID_RemoveParticleFromHgrid().

218 {return HGRID_PrevObject;}
BaseParticle * HGRID_PrevObject
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:177
int BaseParticle::get_Id ( ) const

Definition at line 242 of file BaseParticle.cc.

References _id.

242 {return _id;}
int _id
Index of the Species of this Particle.
Definition: BaseParticle.h:188
int BaseParticle::get_IndSpecies ( ) const
Mdouble BaseParticle::get_Inertia ( ) const

Definition at line 226 of file BaseParticle.cc.

References inertia.

Referenced by BaseParticle().

226 {return inertia;}
Mdouble inertia
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:183
Mdouble BaseParticle::get_InvInertia ( ) const

Definition at line 227 of file BaseParticle.cc.

References invInertia.

Referenced by BaseParticle(), MD::do_integration_after_force_computation(), and MD::do_integration_before_force_computation().

227 {return invInertia;}
Mdouble invInertia
Particle inertia.
Definition: BaseParticle.h:184
Mdouble BaseParticle::get_InvMass ( ) const

Definition at line 228 of file BaseParticle.cc.

References invMass.

Referenced by BaseParticle(), MD::do_integration_after_force_computation(), and MD::do_integration_before_force_computation().

228 {return invMass;}
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182
Mdouble BaseParticle::get_KineticEnergy ( ) const

Definition at line 229 of file BaseParticle.cc.

References Vec3D::GetLength2, mass, and velocity.

229 {return 0.5 * mass * velocity.GetLength2();}
Vec3D velocity
Current particle position.
Definition: BaseParticle.h:193
Mdouble mass
Index of the Particle in the ParticleHandler, used for outputting fstat data.
Definition: BaseParticle.h:181
friend Mdouble GetLength2(const Vec3D &A)
Definition: Vector.h:183
const Vec3D & BaseParticle::get_Position ( ) const

Definition at line 232 of file BaseParticle.cc.

References position.

Referenced by InsertionBoundary::checkBoundaryActionsBeforeTimeStep(), DeletionBoundary::checkBoundaryAfterParticleMoved(), CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), HGRID_2D::CheckObjAgainstGrid(), HGRID_3D::CheckObjAgainstGrid(), Chute::clean_chute(), MD::compute_internal_forces(), MD::compute_plastic_internal_forces(), MD::compute_walls(), CircularPeriodicBoundary::createPeriodicParticles(), AngledPeriodicBoundary::distance(), PeriodicBoundary::distance(), MD::do_integration_after_force_computation(), StatisticsVector< T >::gather_force_statistics_from_p3c(), StatisticsVector< T >::gather_force_statistics_from_p3w(), get_Displacement2(), FiniteAxisSymmetricWall::get_distance_and_normal(), CylindricalWall::get_distance_and_normal(), Coil::get_distance_and_normal(), Screw::get_distance_and_normal(), InfiniteWall::get_distance_and_normal(), InfiniteWallWithHole::get_distance_and_normal(), FiniteWall::get_distance_and_normal(), HGRID_2D::HGRID_UpdateParticleInHgrid(), HGRID_3D::HGRID_UpdateParticleInHgrid(), MD::output_xballs_data_particle(), CircularPeriodicBoundary::rotateParticle(), StatisticsVector< T >::satisfiesInclusionCriteria(), AngledPeriodicBoundary::shift_position(), MD::solve(), HGRID_2D::TestObjAgainstGrid(), HGRID_3D::TestObjAgainstGrid(), and HGRID_base::TestObject().

232 {return position;}
Vec3D position
Current angular velocity.
Definition: BaseParticle.h:192
const Vec3D & BaseParticle::get_PreviousPosition ( ) const

Definition at line 249 of file BaseParticle.cc.

References previousPosition.

Referenced by get_Displacement2().

249 {return previousPosition;}
Vec3D previousPosition
Displacement (only used in StatisticsVector, StatisticsPoint)
Definition: BaseParticle.h:199
int BaseParticle::get_Species ( void  ) const

Definition at line 240 of file BaseParticle.cc.

References indSpecies.

Referenced by MD::getInfo().

240 {return indSpecies;}
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
const Vec3D & BaseParticle::get_Torque ( ) const

Definition at line 247 of file BaseParticle.cc.

References torque.

Referenced by MD::compute_walls(), MD::do_integration_after_force_computation(), and MD::do_integration_before_force_computation().

247 {return torque;}
Vec3D torque
Interaction force.
Definition: BaseParticle.h:196
Mdouble BaseParticle::get_Volume ( std::vector< CSpecies > &  Species) const

Get Particle volume function, which required a reference to the Species vector. It returns the volume of the Particle.

Get BaseParticle volume function, which required a reference to the Species vector. It returns the volume of the BaseParticle.

Definition at line 123 of file BaseParticle.cc.

References indSpecies, constants::pi, and radius.

124 {
125  switch(Species[indSpecies].dim_particle)
126  {
127  case 3 :
128  return (4.0/3.0 * constants::pi * radius * radius * radius);
129  case 2 :
130  return (constants::pi * radius * radius);
131  case 1 :
132  return (2.0 * radius);
133  default :
134  {
135  std::cerr<<"In get_Volume(vector<CSpecies>& Species) the dimension of the particle is not set"<<std::endl;
136  exit(-1);
137  }
138  }
139 }
Mdouble radius
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:185
const Mdouble pi
Definition: ExtendedMath.h:54
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
Mdouble BaseParticle::get_WallInteractionRadius ( ) const

Definition at line 237 of file BaseParticle.cc.

References CSpecies::get_InteractionDistance(), ParticleHandler::getSpecies(), handler, indSpecies, and radius.

Referenced by Coil::get_distance_and_normal(), Screw::get_distance_and_normal(), InfiniteWall::get_distance_and_normal(), and FiniteWall::get_distance_and_normal().

237  {
239 }
ParticleHandler * handler
Definition: BaseParticle.h:170
Mdouble radius
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:185
CSpecies & getSpecies(const int i)
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
Mdouble get_InteractionDistance()
Definition: CSpecies.h:97
ParticleHandler * BaseParticle::getHandler ( ) const

Definition at line 250 of file BaseParticle.cc.

References handler.

Referenced by TangentialSpringParticle::moveInHandler().

250 {return handler;}
ParticleHandler * handler
Definition: BaseParticle.h:170
bool BaseParticle::isFixed ( )

Is fixed Particle function. It returns wether a Particle is fixed or not, by cheking its inverse Mass.

Is fixed BaseParticle function. It returns wether a BaseParticle is fixed or not, by cheking its inverse Mass.

Definition at line 150 of file BaseParticle.cc.

References invMass.

Referenced by MD::compute_external_forces(), MD::compute_internal_forces(), compute_particle_mass(), MD::compute_plastic_internal_forces(), and MD::compute_walls().

150 {return (invMass==0.0);}
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182
void BaseParticle::move ( const Vec3D _new)
void BaseParticle::moveInHandler ( int  newPos)
virtual

Reimplemented in TangentialSpringParticle.

Definition at line 211 of file BaseParticle.cc.

References _index.

Referenced by TangentialSpringParticle::moveInHandler().

212 {
213  _index=newPos;
214 }
int _index
Pointer to the previous Particle in the same HGrid cell.
Definition: BaseParticle.h:180
void BaseParticle::movePrevious ( const Vec3D _new)

Definition at line 304 of file BaseParticle.cc.

References previousPosition.

304 {previousPosition+=_new;}
Vec3D previousPosition
Displacement (only used in StatisticsVector, StatisticsPoint)
Definition: BaseParticle.h:199
void BaseParticle::print ( std::ostream &  os) const
virtual

Particle print function, which accepts an os std::stringstream as input.

BaseParticle print function, which accepts an os std::stringstream as input. It prints human readable BaseParticle information to the std::stringstream.

Reimplemented in TangentialSpringParticle, and DeltaMaxsParticle.

Definition at line 191 of file BaseParticle.cc.

References angle, angularVelocity, indSpecies, invInertia, invMass, position, radius, and velocity.

Referenced by operator<<(), TangentialSpringParticle::print(), and MD::print().

192 {
193  os << "BP "<< position << " " << velocity << " " << radius << " " << angle << " " << angularVelocity << " " << invMass << " " << invInertia << " " <<indSpecies;
194 }
Vec3D velocity
Current particle position.
Definition: BaseParticle.h:193
Mdouble radius
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:185
Vec3D angularVelocity
Current angular position.
Definition: BaseParticle.h:191
Vec3D angle
non changing identifier of particle
Definition: BaseParticle.h:190
Mdouble invInertia
Particle inertia.
Definition: BaseParticle.h:184
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182
Vec3D position
Current angular velocity.
Definition: BaseParticle.h:192
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
void BaseParticle::print_HGRID ( std::ostream &  os)

Definition at line 203 of file BaseParticle.cc.

References HGRID_Level, HGRID_x, HGRID_y, and HGRID_z.

203  {
204  os << "Particle( HGRID_Level:" << HGRID_Level
205  << ", HGRID_x:" << HGRID_x
206  << ", HGRID_y:" << HGRID_y
207  << ", HGRID_z:" << HGRID_z
208  << ")";
209 }
int HGRID_x
Hgrid attributes.
Definition: BaseParticle.h:174
int HGRID_Level
Cell position in the grid.
Definition: BaseParticle.h:175
void BaseParticle::read ( std::istream &  is)
virtual

Particle read function, which accepts an os std::stringstream as input.

Reimplemented in TangentialSpringParticle, and DeltaMaxsParticle.

Definition at line 196 of file BaseParticle.cc.

References angle, angularVelocity, indSpecies, inertia, invInertia, invMass, mass, position, radius, and velocity.

Referenced by operator>>(), and TangentialSpringParticle::read().

197 {
199  if (invMass) mass = 1.0/invMass; else mass = 1e20;
200  if (invInertia) inertia = 1.0/invInertia; else inertia = 1e20;
201 }
Vec3D velocity
Current particle position.
Definition: BaseParticle.h:193
Mdouble inertia
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:183
Mdouble mass
Index of the Particle in the ParticleHandler, used for outputting fstat data.
Definition: BaseParticle.h:181
Mdouble radius
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:185
Vec3D angularVelocity
Current angular position.
Definition: BaseParticle.h:191
Vec3D angle
non changing identifier of particle
Definition: BaseParticle.h:190
Mdouble invInertia
Particle inertia.
Definition: BaseParticle.h:184
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182
Vec3D position
Current angular velocity.
Definition: BaseParticle.h:192
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
void BaseParticle::rotate ( const Vec3D _new)

Definition at line 306 of file BaseParticle.cc.

References angle.

Referenced by MD::do_integration_after_force_computation(), MD::do_integration_before_force_computation(), and AngledPeriodicBoundary::shift_position().

306 {angle+=_new;}
Vec3D angle
non changing identifier of particle
Definition: BaseParticle.h:190
void BaseParticle::set_Angle ( const Vec3D _new)

Definition at line 297 of file BaseParticle.cc.

References angle.

Referenced by Chute::initialize_inflow_particle(), and TangentialSpringParticle::oldRead().

297 {angle=_new;}
Vec3D angle
non changing identifier of particle
Definition: BaseParticle.h:190
void BaseParticle::set_AngularVelocity ( const Vec3D _new)

Definition at line 298 of file BaseParticle.cc.

References angularVelocity.

Referenced by Chute::initialize_inflow_particle(), and TangentialSpringParticle::oldRead().

298 {angularVelocity=_new;}
Vec3D angularVelocity
Current angular position.
Definition: BaseParticle.h:191
void BaseParticle::set_Displacement ( const Vec3D _new)
void BaseParticle::set_Force ( const Vec3D _new)

Definition at line 299 of file BaseParticle.cc.

References force.

299 {force=_new;}
Vec3D force
Current particle velocity.
Definition: BaseParticle.h:195
void BaseParticle::set_HGRID_Level ( const int  _new)

Definition at line 278 of file BaseParticle.cc.

References HGRID_Level.

Referenced by HGrid::InsertParticleToHgrid().

278 {HGRID_Level=_new;}
int HGRID_Level
Cell position in the grid.
Definition: BaseParticle.h:175
void BaseParticle::set_HGRID_NextObject ( BaseParticle _new)
void BaseParticle::set_HGRID_PrevObject ( BaseParticle _new)

Definition at line 280 of file BaseParticle.cc.

References HGRID_PrevObject.

Referenced by HGRID_2D::HGRID_RemoveParticleFromHgrid(), HGRID_3D::HGRID_RemoveParticleFromHgrid(), HGRID_2D::HGRID_UpdateParticleInHgrid(), and HGRID_3D::HGRID_UpdateParticleInHgrid().

280 {HGRID_PrevObject=_new;}
BaseParticle * HGRID_PrevObject
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:177
void BaseParticle::set_HGRID_x ( const int  _new)

Definition at line 275 of file BaseParticle.cc.

References HGRID_x.

Referenced by HGRID_2D::HGRID_UpdateParticleInHgrid(), and HGRID_3D::HGRID_UpdateParticleInHgrid().

275 {HGRID_x=_new;}
int HGRID_x
Hgrid attributes.
Definition: BaseParticle.h:174
void BaseParticle::set_HGRID_y ( const int  _new)

Definition at line 276 of file BaseParticle.cc.

References HGRID_y.

Referenced by HGRID_2D::HGRID_UpdateParticleInHgrid(), and HGRID_3D::HGRID_UpdateParticleInHgrid().

276 {HGRID_y=_new;}
void BaseParticle::set_HGRID_z ( const int  _new)

Definition at line 277 of file BaseParticle.cc.

References HGRID_z.

Referenced by HGRID_3D::HGRID_UpdateParticleInHgrid().

277 {HGRID_z=_new;}
void BaseParticle::set_Id ( const int  _new)

Definition at line 291 of file BaseParticle.cc.

References _id.

291 {_id=_new;}
int _id
Index of the Species of this Particle.
Definition: BaseParticle.h:188
void BaseParticle::set_Index ( const int  _new)

Definition at line 274 of file BaseParticle.cc.

References _index.

274 {_index=_new;}
int _index
Pointer to the previous Particle in the same HGrid cell.
Definition: BaseParticle.h:180
void BaseParticle::set_IndSpecies ( const int  _new)

Definition at line 290 of file BaseParticle.cc.

References indSpecies.

Referenced by MD::get_Mass_from_Radius().

290 {indSpecies=_new;}
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
void BaseParticle::set_inertia ( const Mdouble  _new)

Definition at line 270 of file BaseParticle.cc.

References inertia, and invInertia.

Referenced by InsertionBoundary::checkBoundaryActionsBeforeTimeStep(), compute_particle_mass(), and TangentialSpringParticle::oldRead().

270 {if (_new>=0){inertia=_new; invInertia=1.0/_new;} else { std::cerr << "Error in set_inertia ("<<_new<<")"<< std::endl; exit(-1); }}
Mdouble inertia
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:183
Mdouble invInertia
Particle inertia.
Definition: BaseParticle.h:184
void BaseParticle::set_infiniteInertia ( )

Definition at line 271 of file BaseParticle.cc.

References inertia, and invInertia.

271 {inertia=1e20; invInertia=0;} //> i.e. no rotations
Mdouble inertia
Inverse Particle mass (for computation optimization)
Definition: BaseParticle.h:183
Mdouble invInertia
Particle inertia.
Definition: BaseParticle.h:184
void BaseParticle::set_Mass ( const Mdouble  _new)

Definition at line 292 of file BaseParticle.cc.

References invMass, and mass.

Referenced by InsertionBoundary::checkBoundaryActionsBeforeTimeStep(), compute_particle_mass(), and TangentialSpringParticle::oldRead().

292 {if(_new>=0.0) {if(invMass){mass=_new;invMass=1.0/_new;}} else { std::cerr << "Error in set_Mass(" << _new << ")" << std::endl; exit(-1); }} //InvMass=0 is a flag for a fixed particle
Mdouble mass
Index of the Particle in the ParticleHandler, used for outputting fstat data.
Definition: BaseParticle.h:181
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182
void BaseParticle::set_periodicFromParticle ( BaseParticle _new)
void BaseParticle::set_PreviousPosition ( const Vec3D _new)

Definition at line 296 of file BaseParticle.cc.

References previousPosition.

296 {previousPosition=_new;}
Vec3D previousPosition
Displacement (only used in StatisticsVector, StatisticsPoint)
Definition: BaseParticle.h:199
void BaseParticle::set_species ( const int  _new)

Definition at line 273 of file BaseParticle.cc.

References indSpecies.

273 {indSpecies=_new;}
int indSpecies
Pointer to originating Particle.
Definition: BaseParticle.h:187
void BaseParticle::set_Torque ( const Vec3D _new)

Definition at line 300 of file BaseParticle.cc.

References torque.

Referenced by MD::compute_walls().

300 {torque=_new;}
Vec3D torque
Interaction force.
Definition: BaseParticle.h:196
void BaseParticle::setHandler ( ParticleHandler handler)

Definition at line 301 of file BaseParticle.cc.

References handler.

Referenced by ParticleHandler::addObject().

301 {handler=_new;}
void BaseParticle::unfix ( std::vector< CSpecies > &  Species)

Unfix Particle function, which required a reference to the Species vector. It un fixes a Particle by compyting the Particles mass and inertia.

Unfix BaseParticle function, which required a reference to the Species vector. It un fixes a BaseParticle by compyting the BaseParticles mass and inertia.

Definition at line 153 of file BaseParticle.cc.

References compute_particle_mass(), and invMass.

153  {
154  invMass=1.0;
155  compute_particle_mass(Species);
156 }
void compute_particle_mass(std::vector< CSpecies > &Species)
Compute Particle mass function, which required a reference to the Species vector. It copmuters the Pa...
Mdouble invMass
Particle mass.
Definition: BaseParticle.h:182

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const BaseParticle b 
)
friend

writes wall

Definition at line 205 of file BaseParticle.h.

206 {
207  p.print(os);
208  return os;
209 }
std::istream& operator>> ( std::istream &  is,
BaseParticle b 
)
friend

reads wall

Definition at line 211 of file BaseParticle.h.

212 {
213  p.read(is);
214  return(is);
215 }

Member Data Documentation

int BaseParticle::_id
private

Index of the Species of this Particle.

Definition at line 188 of file BaseParticle.h.

Referenced by get_Id(), and set_Id().

int BaseParticle::_index
private

Pointer to the previous Particle in the same HGrid cell.

Particle attributes

Definition at line 180 of file BaseParticle.h.

Referenced by get_Index(), moveInHandler(), and set_Index().

Vec3D BaseParticle::angle
private

non changing identifier of particle

Definition at line 190 of file BaseParticle.h.

Referenced by BaseParticle(), get_Angle(), TangentialSpringParticle::oldRead(), print(), read(), rotate(), and set_Angle().

Vec3D BaseParticle::angularVelocity
private
Vec3D BaseParticle::displacement
private

Torque.

Definition at line 198 of file BaseParticle.h.

Referenced by add_Displacement(), BaseParticle(), get_Displacement(), and set_Displacement().

Vec3D BaseParticle::force
private

Current particle velocity.

Definition at line 195 of file BaseParticle.h.

Referenced by add_Force(), BaseParticle(), get_Force(), and set_Force().

int BaseParticle::HGRID_Level
private

Cell position in the grid.

Definition at line 175 of file BaseParticle.h.

Referenced by BaseParticle(), get_HGRID_Level(), print_HGRID(), and set_HGRID_Level().

BaseParticle* BaseParticle::HGRID_NextObject
private

Grid level for the object.

Definition at line 176 of file BaseParticle.h.

Referenced by BaseParticle(), get_HGRID_NextObject(), and set_HGRID_NextObject().

BaseParticle* BaseParticle::HGRID_PrevObject
private

Pointer to the next Particle in the same HGrid cell.

Definition at line 177 of file BaseParticle.h.

Referenced by BaseParticle(), get_HGRID_PrevObject(), and set_HGRID_PrevObject().

int BaseParticle::HGRID_x
private

Hgrid attributes.

Definition at line 174 of file BaseParticle.h.

Referenced by BaseParticle(), get_HGRID_x(), print_HGRID(), and set_HGRID_x().

int BaseParticle::HGRID_y
private

Definition at line 174 of file BaseParticle.h.

Referenced by BaseParticle(), get_HGRID_y(), print_HGRID(), and set_HGRID_y().

int BaseParticle::HGRID_z
private

Definition at line 174 of file BaseParticle.h.

Referenced by BaseParticle(), get_HGRID_z(), print_HGRID(), and set_HGRID_z().

int BaseParticle::indSpecies
private
Mdouble BaseParticle::inertia
private

Inverse Particle mass (for computation optimization)

Definition at line 183 of file BaseParticle.h.

Referenced by BaseParticle(), fixParticle(), get_Inertia(), read(), set_inertia(), and set_infiniteInertia().

Mdouble BaseParticle::invInertia
private
Mdouble BaseParticle::invMass
private
Mdouble BaseParticle::mass
private

Index of the Particle in the ParticleHandler, used for outputting fstat data.

Definition at line 181 of file BaseParticle.h.

Referenced by BaseParticle(), fixParticle(), get_KineticEnergy(), get_Mass(), read(), and set_Mass().

BaseParticle* BaseParticle::periodicFromParticle
private

Particle radius.

Definition at line 186 of file BaseParticle.h.

Referenced by BaseParticle(), get_PeriodicFromParticle(), and set_periodicFromParticle().

Vec3D BaseParticle::position
private

Current angular velocity.

Definition at line 192 of file BaseParticle.h.

Referenced by BaseParticle(), fixParticle(), get_Position(), move(), TangentialSpringParticle::oldRead(), print(), read(), and set_Position().

Vec3D BaseParticle::previousPosition
private

Displacement (only used in StatisticsVector, StatisticsPoint)

Definition at line 199 of file BaseParticle.h.

Referenced by get_PreviousPosition(), movePrevious(), and set_PreviousPosition().

Mdouble BaseParticle::radius
private

Inverse Particle inverse inertia (for computation optimization)

Definition at line 185 of file BaseParticle.h.

Referenced by BaseParticle(), compute_particle_mass(), get_InteractionRadius(), get_Radius(), get_Volume(), get_WallInteractionRadius(), TangentialSpringParticle::oldRead(), print(), read(), and set_Radius().

Vec3D BaseParticle::torque
private

Interaction force.

Definition at line 196 of file BaseParticle.h.

Referenced by add_Torque(), BaseParticle(), get_Torque(), and set_Torque().

Vec3D BaseParticle::velocity
private

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