MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseInteraction.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, 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 
26 
27 #include "BaseInteraction.h"
28 #include "InteractionHandler.h"
29 #include "DPMBase.h"
30 
41  : BaseObject()
42 {
43  P_ = P;
44  I_ = I;
45  normal_.setZero();
47  overlap_ = 0;
48  timeStamp_ = timeStamp;
50  species_ = nullptr;
51  force_.setZero();
52  torque_.setZero();
54  {
56  }
58 
59 #ifdef DEBUG_CONSTRUCTOR
60  std::cout<<"BaseInteraction::BaseInteraction() finished"<<std::endl;
61 #endif
62 }
63 
64 
66  : BaseObject()
67 {
68  P_ = nullptr;
69  I_ = nullptr;
70  normal_.setZero();
71  overlap_ = 0;
72  timeStamp_ = 0;
73  species_ = nullptr;
74  force_.setZero();
75  torque_.setZero();
78 }
79 
85  : BaseObject(p)
86 {
87  P_ = p.P_;
88  I_ = p.I_;
89  normal_ = p.normal_;
90  overlap_ = p.overlap_;
91  force_ = p.force_;
92  torque_ = p.torque_;
93  species_ = p.species_;
97 
99 // InteractionHandler* handler_;
100 // BaseInteractable* P_;
101 // BaseInteractable* I_;
102 // unsigned int identificationP_;
103 // int identificationI_;
104 // bool isWallInteraction_;
105 // Vec3D contactPoint_;
106 // Vec3D relativeVelocity_;
107 // Mdouble normalRelativeVelocity_;
108 // Mdouble absoluteNormalForce_;
109 // Mdouble distance_;
110 // Vec3D force_;
111 // Vec3D torque_;
112 // unsigned timeStamp_;
113 // Vec3D normal_;
114 // Mdouble overlap_;
115 // const BaseSpecies* species_;
116 // Mdouble lagrangeMultiplier_;
117 // unsigned multiContactIdentifier_;
118 
119 }
120 
126 {
127 #if MERCURY_USE_MPI
128  if (P_ == nullptr)
129  {
130  logger(DEBUG,"Destroying a fictitious interaction used in MPI transmissions");
131  }
132  else
133  {
134 #endif
135  logger.assert(P_ != nullptr, "Trying to destroy an interaction with P_ = nullptr");
136  logger.assert(I_ != nullptr, "Trying to destroy an interaction with I_ = nullptr");
137  File& interactionFile = getHandler()->getDPMBase()->getInteractionFile();
138  if (interactionFile.getFileType() == FileType::ONE_FILE)
139  {
140  writeInteraction(interactionFile.getFstream(), false);
141  }
142 
143  P_->removeInteraction(this);
144  I_->removeInteraction(this);
145 #if MERCURY_USE_MPI
146  }
147 #endif
148 }
149 
150 
159 void BaseInteraction::write(std::ostream& os) const
160 {
161  os << getName();
162  if (dynamic_cast<BaseParticle*>(I_) != nullptr)
163  {
164  os << " particleIds " << P_->getId() << " " << I_->getId();
166  }
167  else
168  {
169  os << " particleWallIds " << P_->getId() << " " << I_->getId();
170  }
171  os << " timeStamp " << timeStamp_;
172  os << " contactPoint " << contactPoint_;
173  os << " force " << force_;
174  os << " torque " << torque_;
175  //\todo add information that can recreate the contact information (necessary for CG)
176  // os <<" timeStamp "<<timeStamp_<< " contactPoint " << contactPoint_ << " overlap " << overlap_ << " force " << force_ << " torque " << torque_;
177 }
178 
186 void BaseInteraction::read(std::istream& is)
187 {
188  //the rest gets read by the interaction handler
189  std::string dummy;
190  helpers::readOptionalVariable(is,"contactPoint",contactPoint_);
191  is >> dummy >> force_;
192  is >> dummy >> torque_;
193 }
194 
200 std::string BaseInteraction::getName() const
201 {
202  return "BaseInteraction";
203 }
204 
211 {
212  normal_ = normal;
213 }
214 
220 {
221  distance_ = distance;
222 }
223 
230 {
231  overlap_ = overlap;
232 }
233 
234 /*
235  * \details set the contact point between the two interactable objects involved
236  * \param[in] contactPoint Vec3D vector which will become the new contact point.
237  */
239 {
240  contactPoint_ = contactPoint;
241 }
242 
249 void BaseInteraction::setTimeStamp(unsigned timeStamp)
250 {
251  timeStamp_ = timeStamp;
252 }
253 
260 {
261  handler_ = handler;
262 }
263 
270 {
271  return handler_;
272 }
273 
279 {
281 }
282 
298 {
299  //Copy the interaction of ghost
300  BaseInteraction* C = copy();
301  //Finds out which of P and I is that the particle from whom the ghost is begin created.
302  //The object being interacted with is set to P
303  if (C->getP() == original)
304  {
305  //Reverse some force history
306  C->reverseHistory();
307  //Set the P to the original particle
308  C->P_ = C->getI();
309  }
310  //The new ghost particle is set to I in the interaction.
311  C->I_ = ghost;
312 
313  //Add the the interaction to both original and the ghost
314  handler_->addObject(C);
315 }
316 
323 {
324  return getOverlap()<0.0?0.0:sqrt(2.0 * getEffectiveRadius() * getOverlap());
325 }
326 
335 {
336 
337 }
338 
346 void BaseInteraction::setSpecies(const BaseSpecies* const species)
347 {
348  species_ = species;
349 }
350 
360 {
361  P_->removeInteraction(this);
362  P_ = P;
363  P_->addInteraction(this);
365 }
366 
376 {
377  P_->removeInteraction(this);
378  P_ = P;
379  P_->addInteraction(this);
381 }
382 
392 {
393  I_->removeInteraction(this);
394  I_ = I;
395  I_->addInteraction(this);
397 }
398 
408 {
409  I_->removeInteraction(this);
410  I_ = I;
411  I_->addInteraction(this);
413 }
414 
416 {
417  return getNormal() * getDistance();
418 }
419 
421 {
422  return getNormal() * getDistance() + getContactPoint() - getP()->getPosition();
423 }
424 
426 {
427  return getP()->getPosition() - getContactPoint();
428 }
429 
439 void BaseInteraction::writeToFStat(std::ostream& os, Mdouble time) const
440 {
442  auto* IParticle = dynamic_cast<BaseParticle*>(I_);
443  auto* PParticle = dynamic_cast<BaseParticle*>(P_);
444 
445  // do not write fstat output if the force is an internal bond
446  if (isBonded()) return;
447 
448  Vec3D tangentialForce = getTangentialForce();
449  Mdouble tangentialOverlap = getTangentialOverlap();
450 
451  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
452  Mdouble scalarTangentialForce = tangentialForce.getLength();
453  Vec3D tangential;
454  if (scalarTangentialForce != 0.0)
455  tangential = tangentialForce / scalarTangentialForce;
456  else
457  tangential = Vec3D(0.0, 0.0, 0.0);
458 
459  if (PParticle != nullptr && !PParticle->isFixed())
460  {
461  os << time << " " << P_->getIndex()
462  << " " << static_cast<int>((IParticle == nullptr ? (-I_->getIndex() - 1) : I_->getIndex()))
463  << " " << getContactPoint()
464  << " " << getOverlap()
465  << " " << tangentialOverlap
466  << " " << scalarNormalForce
467  << " " << scalarTangentialForce
468  << " " << (IParticle == nullptr ? -normal_ : normal_)
469  << " " << (IParticle == nullptr ? -tangential : tangential) << std::endl;
471  }
472  if (IParticle != nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle() == nullptr)
473  {
474  os << time << " " << I_->getIndex()
475  << " " << P_->getIndex()
476  << " " << getContactPoint()
477  << " " << getOverlap()
478  << " " << tangentialOverlap
479  << " " << scalarNormalForce
480  << " " << scalarTangentialForce
481  << " " << -normal_
482  << " " << -tangential << std::endl;
483  }
484 }
485 
486 /*
487  * \details Returns the distance between the two interactable objects involved
488  * in the interaction.
489  * \return Mdouble which is the distance between the two interacting objects.
490  */
492 {
493  return distance_;
494 }
495 
504 {
505  return 0;
506 }
507 
516 {
517  return Vec3D(0.0, 0.0, 0.0);
518 }
519 
526 {
527  return relativeVelocity_;
528 }
529 
537 {
539 }
540 
549 {
550  return absoluteNormalForce_;
551 }
552 
559 {
560  force_ += force;
561 }
562 
569 {
570  torque_ += torque;
571 }
572 
580 {
581  force_ = force;
582 }
583 
591 {
592  torque_ = torque;
593 }
594 
602 {
603  relativeVelocity_ = relativeVelocity;
604 }
605 
613 {
614  normalRelativeVelocity_ = normalRelativeVelocity;
615 }
616 
623 {
624  absoluteNormalForce_ = absoluteNormalForce;
625 }
626 
635 {
636  return species_;
637 }
638 
647 {}
648 
656 {
657  return 0.0;
658 }
659 
671 {
672 }
673 
681 void BaseInteraction::writeInteraction(std::ostream& os, bool created) const
682 {
683  if (created)
684  {
685  os << "started ";
686  }
687  else
688  {
689  os << "ended ";
690  }
691 
692  if (dynamic_cast<BaseParticle*>(I_) != nullptr)
693  {
694  os << " particleIds " << P_->getId() << " " << I_->getId() << " timeStamp ";
695  }
696  else
697  {
698  os << " particleWallIds " << P_->getId() << " " << I_->getId() << " timeStamp ";
699  }
700 
701  if (created)
702  {
703  os << timeStamp_;
704  }
705  else
706  {
707  os << P_->getSpecies()->getHandler()->getDPMBase()->getTime();
708  }
709 
710  os << std::endl;
711 
712 }
713 
714 
716 {
718 }
719 
720 void BaseInteraction::setMultiContactIdentifier(unsigned int multiContactIdentifier)
721 {
722  multiContactIdentifier_ = multiContactIdentifier;
723 }
724 
725 
727 {
728  contactPoint_ = rotationMatrix * contactPoint_;
729  relativeVelocity_ = rotationMatrix * relativeVelocity_;
730  force_ = rotationMatrix * force_;
731  torque_ = rotationMatrix * torque_;
732  normal_ = rotationMatrix * normal_;
734 }
735 
746 {
747  Mdouble invEffectiveRadius = getP()->getCurvature(contactPoint_) + getI()->getCurvature(contactPoint_);
748  logger.assert(invEffectiveRadius>0,
749  "getEffectiveRadius(): interaction % at % has infinite effective radius",getId(), getContactPoint());
750  return 1.0 / invEffectiveRadius;
751 }
752 
763 {
764  Mdouble invEffectiveMass = getP()->getInvMass() + getI()->getInvMass();
765  logger.assert(invEffectiveMass>0,
766  "getEffectiveMass(): interaction % at % has infinite effective mass",getId(), getContactPoint());
767  return 1.0 / invEffectiveMass;
768 }
769 
771 {
772 }
773 
778 {
779  auto* IParticle = dynamic_cast<BaseParticle*>(I_);
780  auto* PParticle = static_cast<BaseParticle*>(P_);
781 
782  Vec3D tangentialForce = getTangentialForce();
783  Mdouble tangentialOverlap = getTangentialOverlap();
784 
785  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
786  Mdouble scalarTangentialForce = tangentialForce.getLength();
787  Vec3D tangential;
788  if (scalarTangentialForce != 0.0)
789  tangential = tangentialForce / scalarTangentialForce;
790  else
791  tangential = Vec3D(0.0, 0.0, 0.0);
792 
795  Vec3D centre;
796  if (IParticle != nullptr)
797  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() + IParticle->getRadius() - overlap_) / 2.0;
798  else
799  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() - overlap_);
800 
801  if (!PParticle->isFixed())
802  {
804  P_->getIndex(),
805  static_cast<int>((IParticle == nullptr ? (-I_->getIndex() - 1) : I_->getIndex())),
806  centre,
807  getOverlap(),
808  tangentialOverlap,
809  scalarNormalForce,
810  scalarTangentialForce,
811  (IParticle == nullptr ? -normal_ : normal_),
812  (IParticle == nullptr ? -tangential : tangential));
813  }
814  if (IParticle != nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle() == nullptr)
815  {
817  I_->getIndex(),
818  static_cast<int>(P_->getIndex()),
819  centre,
820  getOverlap(),
821  tangentialOverlap,
822  scalarNormalForce,
823  scalarTangentialForce,
824  -normal_,
825  -tangential);
826 
827  }
828 }
829 
831 {
832  return 0;
833 }
834 
835 std::string BaseInteraction::getTypeVTK(unsigned i) const
836 {
837  return "";
838 }
839 
840 std::string BaseInteraction::getNameVTK(unsigned i) const
841 {
842  return "";
843 }
844 
845 std::vector<Mdouble> BaseInteraction::getFieldVTK(unsigned i) const
846 {
847  return std::vector<Mdouble>();
848 }
849 
850 
852 {
853 }
854 
855 void BaseInteraction::getMPIInteraction(void* historyDataArray, unsigned int index) const
856 {
857 }
858 
859 void BaseInteraction::setMPIInteraction(void* historyDataArray, unsigned int index, const bool resetPointers)
860 {
861 }
862 
863 void* BaseInteraction::createMPIInteractionDataArray(unsigned int numberOfInteractions) const
864 {
865  logger(ERROR, "BaseInteraction::createMPIInteractionDataArray should never be called");
866  void* historyArray;
867  return historyArray;
868 }
869 
871 {
872  logger(WARN, "Why on earth is this function called?");
873 }
874 
875 void
876 BaseInteraction::getInteractionDetails(void* interactionDataArray, unsigned int index, unsigned int& identificationP,
877  unsigned int& identificationI, bool& isWallInteraction, unsigned& timeStamp)
878 {
879  logger(ERROR, "Something went wrong, this function should not be called");
880 }
881 
882 
883 void BaseInteraction::setIdentificationP(unsigned int identification)
884 {
885  identificationP_ = identification;
886 }
887 
888 void BaseInteraction::setIdentificationI(int identification)
889 {
890  identificationI_ = identification;
891 }
892 
894 {
895  return identificationP_;
896 }
897 
899 {
900  return identificationI_;
901 }
902 
904 {
905  isWallInteraction_ = flag;
906 }
907 
909 {
910  return isWallInteraction_;
911 }
912 
914 void BaseInteraction::setBasicMPIInteractionValues(int P, int I, unsigned timeStamp, Vec3D force, Vec3D torque,
915  bool isWallInteraction, const bool resetPointers)
916 {
917  this->setIdentificationP(P);
918  this->setIdentificationI(I);
919  this->setTimeStamp(timeStamp);
920  this->setForce(force);
921  this->setTorque(torque);
922  this->setWallInteraction(isWallInteraction);
923  if (resetPointers)
924  {
925  this->I_ = nullptr;
926  this->P_ = nullptr;
927  }
928 }
929 
930 //note centre is unused
931 void BaseInteraction::setFStatData(std::fstream& fstat, BaseParticle* P, BaseParticle* I)
932 {
933  Mdouble overlap, tangentialOverlap, scalarNormalForce, scalarTangentialForce;
934  Vec3D centre, normal, tangential;
935  fstat >> centre >> overlap >> tangentialOverlap >> scalarNormalForce >> scalarTangentialForce >> normal
936  >> tangential;
937  const Vec3D force = scalarNormalForce * normal + scalarTangentialForce * tangential;
938  setForce(force);
939  setNormal(normal);
940  setOverlap(overlap);
941  const Mdouble radius = P->getRadius();
942  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
943  setContactPoint(P->getPosition() - branch);
944  setDistance(radius + I->getRadius() - getOverlap());
945 }
946 
947 void BaseInteraction::setFStatData(std::fstream& fstat, BaseParticle* P, BaseWall* I)
948 {
949  Mdouble overlap, tangentialOverlap, scalarNormalForce, scalarTangentialForce;
950  Vec3D centre, normal, tangential;
951  fstat >> centre >> overlap >> tangentialOverlap >> scalarNormalForce >> scalarTangentialForce >> normal
952  >> tangential;
953  const Vec3D force = scalarNormalForce * normal + scalarTangentialForce * tangential;
954  //note walls are defined different than particles (with an extra minus)
955  setForce(-force);
956  setNormal(-normal);
957  setOverlap(overlap);
958  const Mdouble radius = P->getRadius();
959  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
960  setContactPoint(P->getPosition() - branch);
961  setDistance(radius - getOverlap());
962 }
BaseInteractable * I_
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
Mdouble getEffectiveRadius() const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) ...
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
void copySwitchPointer(const BaseInteractable *original, BaseInteractable *ghost) const
This copies the interactions of the original particle and replaces the original with the ghost copy...
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:49
virtual void getInteractionDetails(void *interactionDataArray, unsigned int index, unsigned int &identificationP, unsigned int &identificationI, bool &isWallInteraction, unsigned &timeStamp)
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:208
File & getInteractionFile()
Return a reference to the file InteractionsFile.
Definition: DPMBase.cc:335
virtual void * createMPIInteractionDataArray(unsigned int numberOfInteractions) const
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
InteractionHandler * getHandler() const
Gets a point to the interaction handlers to which this interaction belongs.
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
double Mdouble
Definition: GeneralDefine.h:34
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
const BaseSpecies * species_
virtual BaseInteraction * copy() const =0
Makes a copy of the interaction and returns a pointer to the copy.
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
virtual void actionsAfterTimeStep()
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
void setI(BaseInteractable *I)
Sets the second object involved in the interaction (often particle or wall).
It is an abstract base class due to the purely virtual functions declared below. Even if the function...
Definition: BaseObject.h:50
const Vec3D & getRelativeVelocity() const
Returns a constant reference to a vector of relative velocity.
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
virtual void reverseHistory()
When periodic particles some interaction need certain history properties reversing. This is the function for that.
void setRelativeVelocity(Vec3D relativeVelocity)
set the relative velocity of the current of the interactions.
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
void addTorque(Vec3D torque)
void writeToFStat(std::ostream &os, Mdouble time) const
Writes forces data to the FStat file.
void removeFromHandler()
Removes this interaction from its interaction hander.
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce) ...
virtual std::vector< Mdouble > getFieldVTK(unsigned i) const
virtual void createMPIType()
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle)...
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76
void setNormalRelativeVelocity(Mdouble normalRelativeVelocit)
set the normal component of the relative velocity.
unsigned int identificationP_
void setFStatData(std::fstream &fstat, BaseParticle *P, BaseWall *I)
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
void setTimeStamp(unsigned timeStamp)
Updates the time step of the interacting. Note, time steps used to find completed interactions...
void gatherContactStatistics()
Stores information about interactions between two interactable objects; often particles but could be ...
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:331
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
virtual void gatherContactStatistics(unsigned int index1, int index2, Vec3D Contact, Mdouble delta, Mdouble ctheta, Mdouble fdotn, Mdouble fdott, Vec3D P1_P2_normal_, Vec3D P1_P2_tangential)
//Not unsigned index because of possible wall collisions.
Definition: DPMBase.cc:1869
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
BaseInteractable * P_
Mdouble getNormalRelativeVelocity() const
Returns a double which is the norm (length) of the relative velocity vector.
void setMultiContactIdentifier(unsigned int multiContactIdentifier_)
virtual void rotateHistory(Matrix3D &rotationMatrix)
When periodic particles are used, some interactions need certain history properties rotated (e...
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:154
const BaseSpecies * getBaseSpecies() const
Return a constant point to BaseSpecies of the interaction.
void setIdentificationP(unsigned int identification)
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:472
~BaseInteraction() override
The destructor.
all data will be written into/ read from a single file called name_
Container to store Interaction objects.
void setHandler(InteractionHandler *handler)
Sets the pointer to the interaction hander which is storing this interaction.
virtual std::string getTypeVTK(unsigned i) const
void setP(BaseInteractable *P)
Sets the first object involved in the interaction (normally a particle).
Mdouble lagrangeMultiplier_
#define UNUSED
Definition: GeneralDefine.h:39
void setTorque(Vec3D torque)
set the total force (this is used by the normal force, tangential torques are added use addTorque) ...
void setSpecies(const BaseSpecies *species)
Set the Species of the interaction; note this can either be a Species or MixedSpecies.
virtual const Vec3D getTangentialForce() const
void addObject(BaseInteraction *I) override
Adds an Interaction to the InteractionHandler.
void writeInteraction(std::ostream &os, bool created) const
Writes information about a interaction to the interaction file.
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
Basic class for walls.
Definition: BaseWall.h:47
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: Helpers.h:247
unsigned int getIdentificationP()
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
virtual std::string getNameVTK(unsigned i) const
void addForce(Vec3D force)
add an force increment to the total force.
Vec3D getIP() const
void setAbsoluteNormalForce(Mdouble absoluteNormalForce)
the absolute values of the norm (length) of the normal force
Mdouble normalRelativeVelocity_
void importP(BaseInteractable *P)
Sets the first object involved in the interaction (normally a particle).
Vec3D getIC() const
virtual bool isBonded() const
unsigned multiContactIdentifier_
Vec3D getCP() const
Mdouble getDistance() const
Returns an Mdouble which is the norm (length) of distance vector.
virtual void integrate(Mdouble timeStep)
integrates variables of the interaction which need to be integrate e.g. the tangential overlap...
void read(std::istream &is) override
Interaction read function, which accepts an std::istream as input.
Mdouble getContactRadius() const
Returns a Mdouble with the current contact between the two interacting objects.
void setWallInteraction(bool flag)
Defines the basic properties that a interactable object can have.
virtual void setMPIInteraction(void *interactionDataArray, unsigned int index, bool resetPointers)
virtual Mdouble getElasticEnergy() const
Returns a Mdouble which is the current about of Elastic energy in the interaction.
Mdouble absoluteNormalForce_
virtual void computeForce()
Virtual function that contains the force law between the two objects interacting. ...
virtual Mdouble getCurvature(const Vec3D &labFixedCoordinates) const
Implementation of a 3D matrix.
Definition: Matrix.h:37
Definition: Vector.h:49
void setBasicMPIInteractionValues(int P, int I, unsigned timeStamp, Vec3D force, Vec3D torque, bool isWallInteraction, bool resetPointers)
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
void write(std::ostream &os) const override
Interaction print function, which accepts an std::ostream as input.
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap
Definition: File.h:80
virtual Mdouble getInvMass() const
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:797
void setIdentificationI(int identification)
unsigned int getMultiContactIdentifier() const
std::string getName() const override
Virtual function which allows interactions to be named.
virtual void getMPIInteraction(void *historyDataArray, unsigned int index) const
copies the history interactions into the data array
void importI(BaseInteractable *I)
Sets the second object involved in the interaction (often particle or wall).
virtual void deleteMPIInteractionDataArray(void *dataArray)
void setNaN()
Sets all elements to NaN.
Definition: Vector.cc:53
Mdouble getEffectiveMass() const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) ...
InteractionHandler * handler_
virtual unsigned getNumberOfFieldsVTK() const
Mdouble getAbsoluteNormalForce() const
Returns the absolute value of the norm (length) of the Normal force vector.