48 #ifdef CONTACT_LIST_HGRID
49 firstPossibleContact =
nullptr;
58 logger(
DEBUG,
"BaseParticle::BaseParticle() finished");
88 #ifdef CONTACT_LIST_HGRID
89 firstPossibleContact =
nullptr;
91 logger(
DEBUG,
"BaseParticle::BaseParticle(BaseParticle &p) finished");
104 logger(
DEBUG,
"BaseParticle::~BaseParticle() of particle % finished.",
getId());
126 logger(
ERROR,
"[BaseParticle::getVolume] no particle handler specified");
136 return (2.0 * radius_);
138 logger(
ERROR,
"[BaseParticle::getVolume] dimension of the particle is not set");
196 return "BaseParticle";
216 if (invInertia_ != 0.0)
231 unsigned int indSpecies;
290 #ifdef CONTACT_LIST_HGRID
297 return firstPossibleContact;
442 if (xmax > xmin && fabs(disp.
X) > .5 * (xmax - xmin))
445 disp.
X -= xmax - xmin;
447 disp.
X += xmax - xmin;
449 if (ymax > ymin && fabs(disp.
Y) > .5 * (ymax - ymin))
452 disp.
Y -= ymax - ymin;
454 disp.
Y += ymax - ymin;
456 if (zmax > zmin && fabs(disp.
Z) > .5 * (zmax - zmin))
459 disp.
Z -= zmax - zmin;
461 disp.
Z += zmax - zmin;
480 logger(
ERROR,
"Error in set_inertia (%)", newInertia);
562 #ifdef CONTACT_LIST_HGRID
566 firstPossibleContact = PC;
592 logger(
WARN,
"WARNING: Do not use particle->setMass, instead use "
593 "particleSpecies->computeMass, since this function can cause "
594 "inconsistencies between the mass, density and radius of this particle!");
605 logger(
ERROR,
"Error in BaseParticle::setMass, the given mass to be set must be positive.");
625 logger(
ERROR,
"Error in BaseParticle::setMass, the given mass to be set must be positive.");
724 std::vector<BaseInteraction*> interactions;
725 if (distanceSquared < (sumOfInteractionRadii * sumOfInteractionRadii))
728 Mdouble distance = std::sqrt(distanceSquared);
736 interactions.push_back(C);
767 if (
getHandler()->getDPMBase()->getRotation())
790 if (
getHandler()->getDPMBase()->getRotation())
821 logger(
ERROR,
"setIndSpecies called on a particle with no particle handler.\n"
822 "Therefore I can't request the given species from the species handler.\n"
823 " PartID = %",
getId());
865 return std::vector<Mdouble>();
Mdouble getKineticEnergy() const
Calculates the particle's kinetic energy.
Container to store all ParticleSpecies.
void setMassForP3Statistics(const Mdouble mass)
Sets the particle's mass This function should not be used, but is necessary to extend the CG toolbox ...
static Mdouble getLengthSquared(const Vec3D &a)
Calculates the squared length of a Vec3D: .
virtual Mdouble getInteractionDistance() const =0
returns the largest separation distance at which adhesive short-range forces can occur.
unsigned int getId() const
Returns the unique identifier of any particular object.
void rotate(const Vec3D &rotate)
Rotates this BaseInteractable.
void addDisplacement(const Vec3D &addDisp)
Adds a vector to the particle's displacement_.
void checkExtremaOnDelete(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
Mdouble X
the vector components
void addVelocity(const Vec3D &velocity)
adds an increment to the velocity.
Mdouble invInertia_
Particle inertia_.
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Mdouble getVolume() const
Get Particle volume function, which required a reference to the Species vector. It returns the volume...
void setInfiniteInertia()
Sets the particle's inertia_ to 'infinite' (1e20) and its invInertia_ to 0.
void setHGridLevel(const unsigned int level)
Sets the particle's HGrid level.
void setInertia(const Mdouble newInertia)
Sets the particle's inertia_ (and adjusts invInertia_ accordingly)
const Vec3D & getForce() const
Returns the force on this BaseInteractable.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
void setDisplacement(const Vec3D &disp)
Sets the particle's displacement (= difference between current position and that of the previous time...
const Vec3D & getPreviousPosition() const
Returns the particle's position in the previous time step.
void checkExtrema(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating.
MERCURY_DEPRECATED void setMass(const Mdouble mass)
Sets the particle's mass.
void setOrientation(const Vec3D &orientation)
Sets the orientation of this BaseInteractable.
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
unsigned int getParticleDimensions() const
Returns the particle dimensions.
BaseInteraction * getInteraction(BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
Returns the Interaction between the BaseInteractable's P and I.
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
void setHGridY(const int y)
Sets the particle's HGrid cell Y-coordinate.
Mdouble mass_
Pointer to the previous Particle in the same HGrid cell.
ParticleHandler * handler_
Pointer to the particle's ParticleHandler container.
Mdouble invMass_
Particle mass_.
void integrateBeforeForceComputation(double time, double timeStep)
This is part of integrate routine for objects with infinite mass.
void setZero()
Sets all elements to zero.
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
void setHGridNextObject(BaseParticle *p)
Sets the pointer to the next object in the particle's HGrid cell & level.
void setPeriodicFromParticle(BaseParticle *p)
Assigns the pointer to the 'original' particle this one's a periodic copy of.
void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
void unfix()
Unfix Particle function, which required a reference to the Species vector. It unfixes a Particle by c...
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
void setSpecies(const ParticleSpecies *species)
int getHGridY() const
Returns particle's HGrid cell Y-coordinate.
void setHGridX(const int x)
Sets the particle's HGrid cell X-coordinate.
ParticleHandler * getHandler() const
Returns pointer to the particle's ParticleHandler.
Mdouble getInvMass() const
Returns the particle's invMass_.
void accelerate(const Vec3D &vel)
Increases the particle's velocity_ by the given vector.
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
Mdouble getLengthSquared() const
Calculates the squared length of this Vec3D: .
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Stores information about interactions between two interactable objects; often particles but could be ...
Mdouble getWallInteractionRadius() const
Returns the interaction radius for interaction with walls. See also BaseParticle::getInteractionRadiu...
void addAngularVelocity(const Vec3D &angularVelocity)
add an increment to the angular velocity.
int HGridX_
Hgrid attributes.
virtual std::string getName() const
Returns the name of the object.
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
void setSpecies(const ParticleSpecies *species)
Sets the species of this BaseInteractable.
BaseParticle * HGridNextObject_
Grid level for the object.
void printHGrid(std::ostream &os) const
Adds particle's HGrid level and cell coordinates to an ostream.
const Vec3D & getDisplacement() const
Returns the particle's displacement relative to the previous time step.
void integrateBeforeForceComputation(double time, double timeStep)
First step of Velocity Verlet integration.
Mdouble inertia_
Inverse Particle mass (for computation optimization)
virtual void read(std::istream &is)=0
Reads a BaseInteractable from an input stream.
Vec3D displacement_
Pointer to originating Particle.
virtual void read(std::istream &is)
Particle read function, which accepts an std::istream as input.
Mdouble getMass() const
Returns the particle's mass_.
virtual ~BaseParticle()
Particle destructor, needs to be implemented and checked if it removes tangential spring information...
void setPreviousPosition(const Vec3D &pos)
Sets the particle's position in the previous time step.
unsigned int HGridLevel_
Cell position in the grid.
int getHGridZ() const
Returns particle's HGrid cell Z-coordinate.
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Container to store Interaction objects.
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
void setHGridZ(const int z)
Sets the particle's HGrid cell Z-coordinate.
const Vec3D & getTorque() const
Returns the torque on this BaseInteractable.
Vec3D previousPosition_
Displacement (only used in StatisticsVector, StatisticsPoint)
BaseParticle * HGridPrevObject_
Pointer to the next Particle in the same HGrid cell.
Mdouble getInertia() const
Returns the particle's inertia_.
MERCURY_DEPRECATED void setIndSpecies(unsigned int indSpecies)
Mdouble getRadius() const
Returns the particle's radius_.
virtual std::vector< Mdouble > getFieldVTK(unsigned i) const
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
const Vec3D getDisplacement2(Mdouble xmin, Mdouble xmax, Mdouble ymin, Mdouble ymax, Mdouble zmin, Mdouble zmax, Mdouble t) const
virtual void setIndSpecies(unsigned int indSpecies)
Sets the index of the Species of this BaseInteractable.
Container to store all BaseParticle.
virtual void write(std::ostream &os) const
Particle print function, which accepts an std::ostream as input.
Mdouble getInvInertia() const
Returns the particle's invInertia_.
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
virtual std::string getTypeVTK(unsigned i) const
BaseParticle()
Basic Particle constructor, creates an Particle at (0,0,0) with radius, mass and inertia equal to 1...
virtual MERCURY_DEPRECATED void oldRead(std::istream &is)
deprecated version of the read function.
Mdouble radius_
Inverse Particle inverse inertia (for computation optimization)
void setHGridPrevObject(BaseParticle *p)
Sets the pointer to the previous object in the particle's HGrid cell & level.
Defines the basic properties that a interactable object can have.
virtual std::string getNameVTK(unsigned i) const
void angularAccelerate(const Vec3D &angVel)
Increases the particle's angularVelocity_ by the given vector.
BaseParticle * getHGridPrevObject() const
Returns pointer to previous object in particle's HGrid level & cell.
virtual void hGridUpdateMove(BaseParticle *, Mdouble)
no implementation but can be overidden in its derived classes.
void integrateAfterForceComputation(double time, double timeStep)
Second step of Velocity Verlet integration.
unsigned int getIndSpecies() const
Returns the index of the Species of this BaseInteractable.
virtual void write(std::ostream &os) const =0
Write a BaseInteractable to an output stream.
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Implementation of a 3D vector (by Vitaliy).
BaseParticle * getHGridNextObject() const
Returns pointer to next object in particle's HGrid level & cell.
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
BaseParticle * periodicFromParticle_
Particle radius_.
unsigned int getHGridLevel() const
Returns particle's HGrid level.
virtual unsigned getNumberOfFieldsVTK() const
unsigned int getParticleDimensions() const
Returns the particle's dimensions (either 2 or 3).
bool isFixed() const
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Mdouble getInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
void integrateAfterForceComputation(double time, double timeStep)
This is part of the integration routine for objects with infinite mass.
virtual BaseParticle * copy() const
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
void movePrevious(const Vec3D &posMove)
Adds a vector to the particle's previousPosition_.
void fixParticle()
Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to ...
int getHGridX() const
Returns particle's HGrid cell X-coordinate.
std::vector< BaseInteraction * > getInteractionWith(BaseParticle *P, Mdouble timeStamp, InteractionHandler *interactionHandler)
Checks if particle is in interaction with given particle P, and if so, returns pointer to the associa...