MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseParticle.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
27 #include "InteractionHandler.h"
28 #include "Particles/BaseParticle.h"
31 #include "ParticleHandler.h"
32 #include "DPMBase.h"
33 
39 {
40  handler_ = nullptr;
42  radius_ = 1.0;
43  mass_ = invMass_ = 1.0;
44  inertia_ = invInertia_ = 1.0;
45  HGridNextObject_ = nullptr;
46 
47  periodicFromParticle_ = nullptr;
48 #ifdef CONTACT_LIST_HGRID
49  firstPossibleContact = nullptr;
50 #endif
51  HGridNextObject_ = nullptr;
52  HGridPrevObject_ = nullptr;
53  HGridLevel_ = 99999;
54  HGridX_ = 99999;
55  HGridY_ = 99999;
56  HGridZ_ = 99999;
57 
58  logger(DEBUG, "BaseParticle::BaseParticle() finished");
59 }
60 
71 {
72  handler_ = nullptr;
74  radius_ = p.radius_;
75  mass_ = p.getMass();
76  invMass_ = p.getInvMass();
77  inertia_ = p.getInertia();
79 
80  HGridNextObject_ = nullptr;
81  HGridPrevObject_ = nullptr;
82  HGridX_ = 99999;
83  HGridY_ = 99999;
84  HGridZ_ = 99999;
86 
88 #ifdef CONTACT_LIST_HGRID
89  firstPossibleContact = nullptr;
90 #endif
91  logger(DEBUG, "BaseParticle::BaseParticle(BaseParticle &p) finished");
92 }
93 
99 {
100  if (getHandler() != nullptr)
101  {
103  }
104  logger(DEBUG, "BaseParticle::~BaseParticle() of particle % finished.", getId());
105 }
106 
113 {
114  return new BaseParticle(*this);
115 }
116 
123 {
124  if (handler_ == nullptr)
125  {
126  logger(ERROR, "[BaseParticle::getVolume] no particle handler specified");
127  return 0;
128  }
129  switch (getParticleDimensions())
130  {
131  case 3:
132  return (4.0 / 3.0 * constants::pi * radius_ * radius_ * radius_);
133  case 2:
134  return (constants::pi * radius_ * radius_);
135  case 1:
136  return (2.0 * radius_);
137  default:
138  logger(ERROR, "[BaseParticle::getVolume] dimension of the particle is not set");
139  return 0;
140  }
141 }
142 
147 {
148  mass_ = 1e20;
149  invMass_ = 0.0;
150  inertia_ = 1e20;
151  invInertia_ = 0.0;
152  setVelocity(Vec3D(0.0, 0.0, 0.0));
153  setAngularVelocity(Vec3D(0.0, 0.0, 0.0));
154 }
155 
161 {
162  return (invMass_ == 0.0);
163 }
164 
171 {
172  invMass_ = 1.0;
173  getSpecies()->computeMass(this);
174 }
175 
182 void BaseParticle::write(std::ostream& os) const
183 {
185  os << " radius " << radius_
186  << " invMass " << invMass_
187  << " invInertia " << invInertia_;
188 }
189 
194 std::string BaseParticle::getName() const
195 {
196  return "BaseParticle";
197 }
198 
207 void BaseParticle::read(std::istream& is)
208 {
210  std::string dummy;
211  is >> dummy >> radius_ >> dummy >> invMass_ >> dummy >> invInertia_;
212  if (invMass_ != 0.0)
213  mass_ = 1.0 / invMass_;
214  else
215  mass_ = 1e20;
216  if (invInertia_ != 0.0)
217  inertia_ = 1.0 / invInertia_;
218  else
219  inertia_ = 1e20;
220 }
221 
227 void BaseParticle::oldRead(std::istream& is)
228 {
230 
231  unsigned int indSpecies;
232  Vec3D orientation;
233  Vec3D position;
234  is >> invMass_ >> invInertia_ >> indSpecies;
235  setPosition(position);
236  setOrientation(orientation);
237  setIndSpecies(indSpecies);
238  if (invMass_ != 0.0)
239  mass_ = 1.0 / invMass_;
240  else
241  mass_ = 1e20;
242  if (invInertia_ != 0.0)
243  inertia_ = 1.0 / invInertia_;
244  else
245  inertia_ = 1e20;
246 }
247 
253 void BaseParticle::printHGrid(std::ostream& os) const
254 {
255  os << "Particle( HGRID_Level:" << HGridLevel_
256  << ", HGRID_x:" << HGridX_
257  << ", HGRID_y:" << HGridY_
258  << ", HGRID_z:" << HGridZ_
259  << ")";
260 }
261 
266 unsigned int BaseParticle::getHGridLevel() const
267 {
268  return HGridLevel_;
269 }
270 
276 {
277  return HGridNextObject_;
278 }
279 
286 {
287  return HGridPrevObject_;
288 }
289 
290 #ifdef CONTACT_LIST_HGRID
291 
295 PossibleContact* BaseParticle::getFirstPossibleContact() const
296 {
297  return firstPossibleContact;
298 }
299 #endif
300 
306 {
307  return HGridX_;
308 }
309 
315 {
316  return HGridY_;
317 }
318 
324 {
325  return HGridZ_;
326 }
327 
333 {
334  return inertia_;
335 }
336 
342 {
343  return invInertia_;
344 }
345 
351 {
352  return invMass_;
353 }
354 
360 {
361  return 0.5 * mass_ * getVelocity().getLengthSquared();
362 }
363 
369 {
370  return mass_;
371 }
372 
379 {
380  return periodicFromParticle_;
381 }
382 
388 {
389  return radius_;
390 }
391 
402 {
403  return radius_ + getSpecies()->getInteractionDistance() * 0.5;
404 }
405 
412 {
414 }
415 
422 {
423  return displacement_;
424 }
425 
431 {
432  return previousPosition_;
433 }
434 
439 const Vec3D BaseParticle::getDisplacement2(Mdouble xmin, Mdouble xmax, Mdouble ymin, Mdouble ymax, Mdouble zmin, Mdouble zmax, Mdouble t) const
440 {
442  if (xmax > xmin && fabs(disp.X) > .5 * (xmax - xmin))
443  {
444  if (disp.X > 0)
445  disp.X -= xmax - xmin;
446  else
447  disp.X += xmax - xmin;
448  }
449  if (ymax > ymin && fabs(disp.Y) > .5 * (ymax - ymin))
450  {
451  if (disp.Y > 0)
452  disp.Y -= ymax - ymin;
453  else
454  disp.Y += ymax - ymin;
455  }
456  if (zmax > zmin && fabs(disp.Z) > .5 * (zmax - zmin))
457  {
458  if (disp.Z > 0)
459  disp.Z -= zmax - zmin;
460  else
461  disp.Z += zmax - zmin;
462  }
463  disp /= t;
464  return disp;
465 }
466 
471 void BaseParticle::setInertia(const Mdouble newInertia)
472 {
473  if (newInertia >= 0)
474  {
475  inertia_ = newInertia;
476  invInertia_ = 1.0 / newInertia;
477  }
478  else
479  {
480  logger(ERROR, "Error in set_inertia (%)", newInertia);
481  }
482 }
483 
489 {
490  inertia_ = 1e20;
491  invInertia_ = 0;
492 } //> i.e. no rotations
493 
501 {
503 }
504 
509 void BaseParticle::setHGridX(const int x)
510 {
511  HGridX_ = x;
512 }
513 
518 void BaseParticle::setHGridY(const int y)
519 {
520  HGridY_ = y;
521 }
522 
527 void BaseParticle::setHGridZ(const int z)
528 {
529  HGridZ_ = z;
530 }
531 
536 void BaseParticle::setHGridLevel(const unsigned int level)
537 {
538  HGridLevel_ = level;
539 }
540 
546 {
547  HGridNextObject_ = p;
548 }
549 
555 {
556  HGridPrevObject_ = p;
557 }
558 
562 #ifdef CONTACT_LIST_HGRID
563 
564 void BaseParticle::setFirstPossibleContact(PossibleContact* PC)
565 {
566  firstPossibleContact = PC;
567 }
568 #endif
569 
577 {
578  radius_ = radius;
579  if (getHandler())
580  {
581  getSpecies()->computeMass(this);
582  getHandler()->checkExtrema(this);
583  }
584 }
585 
591 {
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!");
595  if (mass >= 0.0)
596  {
597  if (invMass_ != 0.0) //InvMass=0 is a flag for a fixed particle
598  {
599  mass_ = mass;
600  invMass_ = 1.0 / mass;
601  }
602  }
603  else
604  {
605  logger(ERROR, "Error in BaseParticle::setMass, the given mass to be set must be positive.");
606  }
607 }
608 
614 {
615  if(mass >= 0.0)
616  {
617  if(invMass_ != 0.0) //InvMass=0 is a flag for a fixed particle
618  {
619  mass_ = mass;
620  invMass_ = 1.0 / mass;
621  }
622  }
623  else
624  {
625  logger(ERROR, "Error in BaseParticle::setMass, the given mass to be set must be positive.");
626  }
627 }
628 
634 {
635  displacement_ = disp;
636 }
637 
643 {
644  previousPosition_ = pos;
645 }
646 
652 void BaseParticle::movePrevious(const Vec3D& posMove)
653 {
654  previousPosition_ += posMove;
655 }
656 
663 {
664  addVelocity(vel);
665 }
666 
673 {
674  addAngularVelocity(angVel);
675 }
676 
682 {
683  displacement_ += addDisp;
684 }
685 
692 {
693  handler_ = handler;
694  setSpecies(getHandler()->getDPMBase()->speciesHandler.getObject(getIndSpecies()));
695 }
696 
702 {
703  return handler_;
704 }
705 
717 std::vector<BaseInteraction*> BaseParticle::getInteractionWith(BaseParticle *P, Mdouble timeStamp, InteractionHandler* interactionHandler)
718 {
719  //get the normal (from P away from the contact)
720  Vec3D branchVector = P->getPosition() - getPosition();
721  //Get the square of the distance between particle i and particle j
722  Mdouble distanceSquared = Vec3D::getLengthSquared(branchVector);
723  Mdouble sumOfInteractionRadii = P->getInteractionRadius() + getInteractionRadius();
724  std::vector<BaseInteraction*> interactions;
725  if (distanceSquared < (sumOfInteractionRadii * sumOfInteractionRadii))
726  {
727  BaseInteraction* C = interactionHandler->getInteraction(P, this, timeStamp);
728  Mdouble distance = std::sqrt(distanceSquared);
729  C->setNormal(branchVector / distance);
730  C->setOverlap(P->getRadius() + getRadius() - distance);
731  C->setDistance(distance);
732  C->setContactPoint(P->getPosition() - (P->getRadius() - 0.5 * C->getOverlap()) * C->getNormal());
734  //Mdouble ratio=P->getRadius()/(getRadius()+P->getRadius());
735  //C->setContactPoint(P->getPosition() - (P->getRadius() - ratio * C->getOverlap()) * C->getNormal());
736  interactions.push_back(C);
737  }
738  return interactions;
739 }
740 
742 
743 
744 
751 void BaseParticle::integrateBeforeForceComputation(double time, double timeStep)
752 {
757  if (getInvMass() == 0.0)
758  {
760  }
761  else
762  {
763  accelerate(getForce() * getInvMass() * 0.5 * timeStep);
764  setDisplacement(getVelocity() * timeStep);
766  getHandler()->getDPMBase()->hGridUpdateMove(this, getDisplacement().getLength());
767  if (getHandler()->getDPMBase()->getRotation())
768  {
769  angularAccelerate(getTorque() * getInvInertia() * 0.5 * timeStep);
770  rotate(getAngularVelocity() * timeStep);
771  }
772  }
773 }
774 
781 void BaseParticle::integrateAfterForceComputation(double time, double timeStep)
782 {
783  if (getInvMass() == 0.0)
784  {
786  }
787  else
788  {
789  accelerate(getForce() * getInvMass() * 0.5 * timeStep);
790  if (getHandler()->getDPMBase()->getRotation())
791  {
792  angularAccelerate(getTorque() * getInvInertia() * 0.5 * timeStep);
793  }
794  }
795 }
796 
802 {
804 }
805 
811 void BaseParticle::setIndSpecies(unsigned int indSpecies)
812 {
813  if (handler_ != nullptr)
814  {
817  }
818  else
819  {
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());
824  }
825 }
826 
835 {
838  //set pointer to the ParticleHandler handler_, which is needed to retrieve
839  //species information
840  //\todo maybe these if statements should throw warnings
841  if (handler_ == nullptr)
842  {
843  SpeciesHandler* sH = species->getHandler();
844  DPMBase* dB = sH->getDPMBase();
845  if (dB != nullptr)
846  {
848  }
849  }
850 }
851 
853  return 0;
854 }
855 
856 std::string BaseParticle::getTypeVTK(unsigned i) const {
857  return "";
858 }
859 
860 std::string BaseParticle::getNameVTK(unsigned i) const {
861  return "";
862 }
863 
864 std::vector<Mdouble> BaseParticle::getFieldVTK(unsigned i) const {
865  return std::vector<Mdouble>();
866 }
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: .
Definition: Vector.cc:291
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.
Definition: BaseObject.cc:116
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...
Definition: DPMBase.h:65
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
Mdouble X
the vector components
Definition: Vector.h:52
void addVelocity(const Vec3D &velocity)
adds an increment to the velocity.
Mdouble invInertia_
Particle inertia_.
Definition: BaseParticle.h:409
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.
Definition: DPMBase.cc:599
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.
double Mdouble
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.
Definition: BaseParticle.h:406
ParticleHandler * handler_
Pointer to the particle's ParticleHandler container.
Definition: BaseParticle.h:390
Mdouble invMass_
Particle mass_.
Definition: BaseParticle.h:407
void integrateBeforeForceComputation(double time, double timeStep)
This is part of integrate routine for objects with infinite mass.
void setZero()
Sets all elements to zero.
Definition: Vector.cc:52
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: .
Definition: Vector.cc:300
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.
Definition: BaseParticle.h:400
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.
Definition: BaseSpecies.cc:74
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.
Definition: BaseParticle.h:402
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)
Definition: BaseParticle.h:408
virtual void read(std::istream &is)=0
Reads a BaseInteractable from an input stream.
Vec3D displacement_
Pointer to originating Particle.
Definition: BaseParticle.h:413
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...
Definition: BaseParticle.cc:98
const Mdouble pi
Definition: ExtendedMath.h:42
void setPreviousPosition(const Vec3D &pos)
Sets the particle's position in the previous time step.
unsigned int HGridLevel_
Cell position in the grid.
Definition: BaseParticle.h:401
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...
Definition: DPMBase.h:1001
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.
Definition: BaseHandler.h:451
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)
Definition: BaseParticle.h:414
BaseParticle * HGridPrevObject_
Pointer to the next Particle in the same HGrid cell.
Definition: BaseParticle.h:403
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...
Definition: DPMBase.h:991
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.
Mdouble Y
Definition: Vector.h:52
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...
Definition: BaseParticle.cc:38
virtual MERCURY_DEPRECATED void oldRead(std::istream &is)
deprecated version of the read function.
Mdouble radius_
Inverse Particle inverse inertia (for computation optimization)
Definition: BaseParticle.h:410
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.
Definition: DPMBase.cc:845
Class that describes a possible contact between two BaseParticle.
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).
Definition: Vector.h:45
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.
Definition: BaseHandler.h:543
BaseParticle * periodicFromParticle_
Particle radius_.
Definition: BaseParticle.h:411
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...
Mdouble Z
Definition: Vector.h:52
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...