30 #include "../ParticleHandler.h"
32 #include "../CSpecies.h"
53 #ifdef ContactListHgrid
54 firstPossibleContact=0;
63 #ifdef CONSTUCTOR_OUTPUT
64 std::cerr <<
"BaseParticle() finished"<<std::endl;
95 #ifdef ContactListHgrid
96 firstPossibleContact=0;
99 #ifdef CONSTUCTOR_OUTPUT
100 std::cerr <<
"BaseParticle(BaseParticle &p) finished"<<std::endl;
111 #ifdef CONSTUCTOR_OUTPUT
112 std::cerr <<
"virtual ~BaseParticle finished"<<std::endl;
132 return (2.0 * radius);
135 std::cerr<<
"In get_Volume(vector<CSpecies>& Species) the dimension of the particle is not set"<<std::endl;
144 #ifdef USE_SIMPLE_VERLET_INTEGRATION
183 std::cerr<<
"In compute_particle_mass(vector<CSpecies>& Species) the dimension of the particle is not set"<<std::endl;
219 #ifdef ContactListHgrid
220 PossibleContact* BaseParticle::get_FirstPossibleContact()
const {
return firstPossibleContact;}
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;
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;
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;
281 #ifdef ContactListHgrid
282 void BaseParticle::set_FirstPossibleContact (
const PossibleContact* PC) {firstPossibleContact=PC;}
312 #ifdef USE_SIMPLE_VERLET_INTEGRATION
313 void BaseParticle::set_PrevPosition (
const Vec3D& _new) {prevPosition=_new;}
314 void BaseParticle::prevMove (
const Vec3D& _new) {prevPosition+=_new;}
315 const Vec3D& BaseParticle::get_PrevPosition() {
return prevPosition;}
Vec3D velocity
Current particle position.
void set_inertia(const Mdouble _new)
int HGRID_x
Hgrid attributes.
BaseParticle * periodicFromParticle
Particle radius.
void set_HGRID_x(const int _new)
Mdouble get_KineticEnergy() const
void add_Torque(const Vec3D &_new)
void set_Force(const Vec3D &_new)
void checkExtremaOnDelete(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.
void set_species(const int _new)
void set_HGRID_PrevObject(BaseParticle *_new)
BaseParticle * get_HGRID_PrevObject() const
const Vec3D & get_Velocity() const
ParticleHandler * handler
Mdouble get_InteractionRadius() const
void rotate(const Vec3D &_new)
void set_PreviousPosition(const Vec3D &_new)
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 inertia
Inverse Particle mass (for computation optimization)
void checkExtrema(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating.
int get_IndSpecies() const
Mdouble mass
Index of the Particle in the ParticleHandler, used for outputting fstat data.
Mdouble radius
Inverse Particle inverse inertia (for computation optimization)
int _id
Index of the Species of this Particle.
void angularAccelerate(const Vec3D &_new)
BaseParticle * get_PeriodicFromParticle() const
void setHandler(ParticleHandler *handler)
BaseParticle * HGRID_PrevObject
Pointer to the next Particle in the same HGrid cell.
virtual void print(std::ostream &os) const
Particle print function, which accepts an os std::stringstream as input.
void set_HGRID_z(const int _new)
Vec3D angularVelocity
Current angular position.
Mdouble get_InvInertia() const
BaseParticle * get_HGRID_NextObject() const
Vec3D angle
non changing identifier of particle
ParticleHandler * getHandler() const
void set_Index(const int _new)
const Vec3D & get_Force() const
Mdouble invInertia
Particle inertia.
friend Mdouble GetLength2(const Vec3D &A)
bool isFixed()
Is fixed Particle function. It returns wether a Particle is fixed or not, by cheking its inverse Mass...
Mdouble get_Radius() const
void set_periodicFromParticle(BaseParticle *_new)
Mdouble get_InvMass() const
const Vec3D get_Displacement2(Mdouble xmin, Mdouble xmax, Mdouble ymin, Mdouble ymax, Mdouble zmin, Mdouble zmax, Mdouble t) const
virtual void read(std::istream &is)
Particle read function, which accepts an os std::stringstream as input.
Vec3D previousPosition
Displacement (only used in StatisticsVector, StatisticsPoint)
virtual ~BaseParticle()
Particle destructor, needs to be implemented and checked if it removes tangential spring information...
void set_IndSpecies(const int _new)
void set_HGRID_y(const int _new)
Mdouble get_WallInteractionRadius() const
int _index
Pointer to the previous Particle in the same HGrid cell.
void add_Force(const Vec3D &_new)
void set_infiniteInertia()
Vec3D torque
Interaction force.
int HGRID_Level
Cell position in the grid.
const Vec3D & get_PreviousPosition() const
void set_HGRID_Level(const int _new)
const Vec3D & get_Displacement() const
void move(const Vec3D &_new)
Vec3D displacement
Torque.
const Vec3D & get_Position() const
Container to store all BaseParticle.
void set_Radius(const Mdouble _new)
BaseParticle * HGRID_NextObject
Grid level for the object.
CSpecies & getSpecies(const int i)
void set_Velocity(const Vec3D &_new)
Mdouble invMass
Particle mass.
BaseParticle()
Basic Particle contructors, creates an Particle at (0,0,0) with radius, mass and inertia equal to 1...
const Vec3D & get_Torque() const
Vec3D position
Current angular velocity.
void movePrevious(const Vec3D &_new)
void unfix(std::vector< CSpecies > &Species)
Unfix Particle function, which required a reference to the Species vector. It un fixes a Particle by ...
Mdouble get_Volume(std::vector< CSpecies > &Species) const
Get Particle volume function, which required a reference to the Species vector. It returns the volume...
void set_AngularVelocity(const Vec3D &_new)
void print_HGRID(std::ostream &os)
void set_Angle(const Vec3D &_new)
void set_Displacement(const Vec3D &_new)
virtual void moveInHandler(int newPos)
int indSpecies
Pointer to originating Particle.
void set_Torque(const Vec3D &_new)
Mdouble get_Inertia() const
const Vec3D & get_Angle() const
Vec3D force
Current particle velocity.
void set_HGRID_NextObject(BaseParticle *_new)
Implementation of a 3D vector (by Vitaliy).
void set_Position(const Vec3D &_new)
void accelerate(const Vec3D &_new)
void set_Id(const int _new)
int get_HGRID_Level() const
Mdouble get_InteractionDistance()
virtual BaseParticle * copy() const
Particle copy method. It calls to copy contrustor of this Particle, usefull for polymorfism.
void add_Displacement(const Vec3D &_new)
void fixParticle()
Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to ...
void set_Mass(const Mdouble _new)
const Vec3D & get_AngularVelocity() const