revision: v0.14
BaseInteraction Class Referenceabstract

Stores information about interactions between two interactable objects; often particles but could be walls etc. By info about interactions one means the overlaps, contact point, forces, torques, relative velocities etc. More...

#include <BaseInteraction.h>

Inheritance diagram for BaseInteraction:

## Public Member Functions

BaseInteraction (BaseInteractable *P, BaseInteractable *I, unsigned timeStamp)
A constructor takes the BaseInteractable objects which are interacting (come into contact) and time the interaction starts. More...

BaseInteraction ()

BaseInteraction (const BaseInteraction &p)
Copy constructor. More...

~BaseInteraction () override
The destructor. It removes this interactions from the objects that were interacting, and writes the time to a file when needed. More...

virtual void actionsOnErase ()
If an interaction needs to do something before it gets erased, add it here. E.g. Liquid bridges rupture at the end of their lifetime, and the liquid bridge volume has to be redistributed. The reason this action is not done in the destructor is that this action should not be taken when erasing ghost interactions. More...

virtual void computeForce ()
Virtual function that contains the force law between the two objects interacting. More...

Interaction read function, which accepts an std::istream as input. More...

void write (std::ostream &os) const override
Interaction print function, which accepts an std::ostream as input. More...

void writeToFStat (std::ostream &os, Mdouble time) const
Writes forces data to the FStat file. More...

std::string getName () const override
Virtual function which allows interactions to be named. More...

virtual Mdouble getElasticEnergy () const
Returns a Mdouble which is the current about of Elastic energy in the interaction. More...

void setDistance (Mdouble distance)
Sets the interaction distance between the two interacting objects. More...

void setNormal (Vec3D normal)
Sets the normal vector between the two interacting objects. More...

void setOverlap (Mdouble overlap)
Set the overlap between the two interacting object. More...

void setContactPoint (Vec3D contactPoint)
Set the location of the contact point between the two interacting objects. More...

void setTimeStamp (unsigned timeStamp)
Updates the time step of the interacting. Note, time steps used to find completed interactions. More...

void setSpecies (const BaseSpecies *species)
Set the Species of the interaction; note this can either be a Species or MixedSpecies. More...

void setP (BaseInteractable *P)
Sets the first object involved in the interaction (normally a particle). More...

void setI (BaseInteractable *I)
Sets the second object involved in the interaction (often particle or wall). More...

void importP (BaseInteractable *P)
Sets the first object involved in the interaction (normally a particle). More...

void importI (BaseInteractable *I)
Sets the second object involved in the interaction (often particle or wall). More...

Vec3D getIP () const

Vec3D getIC () const

Vec3D getCP () const

void setLagrangeMultiplier (Mdouble multiplier)

Mdouble getLagrangeMultiplier ()

void setHandler (InteractionHandler *handler)
Sets the pointer to the interaction hander which is storing this interaction. More...

InteractionHandlergetHandler () const
Gets a point to the interaction handlers to which this interaction belongs. More...

const Vec3DgetForce () const
Gets the current force (vector) between the two interacting objects. More...

const Vec3DgetTorque () const
Gets the current torque (vector) between the two interacting objects. More...

const Vec3DgetNormal () const
Gets the normal vector between the two interacting objects. More...

const Vec3DgetContactPoint () const
Gets constant reference to contact point (vector). More...

Mdouble getOverlap () const
Returns a Mdouble with the current overlap between the two interacting objects. More...

Returns a Mdouble with the current contact between the two interacting objects. More...

void removeFromHandler ()
Removes this interaction from its interaction hander. More...

void copySwitchPointer (const BaseInteractable *original, BaseInteractable *ghost) const
This copies the interactions of the original particle and replaces the original with the ghost copy. More...

void gatherContactStatistics ()

BaseInteractablegetP ()
Returns a pointer to first object involved in the interaction (normally a particle). More...

BaseInteractablegetI ()
Returns a pointer to the second object involved in the interaction (often a wall or a particle). More...

const BaseInteractablegetP () const
Returns a constant pointer to the first object involved in the interaction. More...

const BaseInteractablegetI () const
Returns a constant pointer to the second object involved in the interaction. More...

Mdouble getTimeStamp () const
Returns an Mdouble which is the time stamp of the interaction. More...

virtual void integrate (Mdouble timeStep)
integrates variables of the interaction which need to be integrate e.g. the tangential overlap. More...

virtual Mdouble getTangentialOverlap () const
get the length of the current tangential overlap More...

Mdouble getDistance () const
Returns an Mdouble which is the norm (length) of distance vector. More...

const Vec3DgetRelativeVelocity () const
Returns a constant reference to a vector of relative velocity. More...

Mdouble getNormalRelativeVelocity () const
Returns a double which is the norm (length) of the relative velocity vector. More...

Mdouble getAbsoluteNormalForce () const
Returns the absolute value of the norm (length) of the Normal force vector. More...

virtual BaseInteractioncopy () const =0
Makes a copy of the interaction and returns a pointer to the copy. More...

void setFStatData (std::fstream &fstat, BaseParticle *P, BaseWall *I)

void setFStatData (std::fstream &fstat, BaseParticle *P, BaseParticle *I)

unsigned int getMultiContactIdentifier () const

void setMultiContactIdentifier (unsigned int multiContactIdentifier_)

virtual void rotateHistory (Matrix3D &rotationMatrix)
When periodic particles are used, some interactions need certain history properties rotated (e.g. tangential springs). This is the function for that. More...

virtual void actionsAfterTimeStep ()

virtual unsigned getNumberOfFieldsVTK () const

virtual std::string getTypeVTK (unsigned i) const

virtual std::string getNameVTK (unsigned i) const

virtual std::vector< MdoublegetFieldVTK (unsigned i) const

void setForce (Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce) More...

const BaseSpeciesgetBaseSpecies () const
Return a constant point to BaseSpecies of the interaction. More...

virtual void createMPIType ()

virtual void * createMPIInteractionDataArray (unsigned int numberOfInteractions) const

virtual void deleteMPIInteractionDataArray (void *dataArray)

virtual void getMPIInteraction (void *historyDataArray, unsigned int index) const
copies the history interactions into the data array More...

virtual void getInteractionDetails (void *interactionDataArray, unsigned int index, unsigned int &identificationP, unsigned int &identificationI, bool &isWallInteraction, unsigned &timeStamp)

virtual void setMPIInteraction (void *interactionDataArray, unsigned int index, bool resetPointers)

void setBasicMPIInteractionValues (int P, int I, unsigned timeStamp, Vec3D force, Vec3D torque, bool isWallInteraction, bool resetPointers)

void setIdentificationP (unsigned int identification)

void setIdentificationI (int identification)

void setWallInteraction (bool flag)

unsigned int getIdentificationP ()

int getIdentificationI ()

bool isWallInteraction ()

virtual bool isBonded () const

Public Member Functions inherited from BaseObject
BaseObject ()=default
Default constructor. More...

BaseObject (const BaseObject &p)=default
Copy constructor, copies all the objects BaseObject contains. More...

virtual ~BaseObject ()=default
virtual destructor More...

virtual void moveInHandler (unsigned int index)
Except that it is virtual, it does the same thing as setIndex() does. More...

void setIndex (unsigned int index)
Allows one to assign an index to an object in the handler/container. More...

void setId (unsigned long id)
Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...

unsigned int getIndex () const
Returns the index of the object in the handler. More...

unsigned int getId () const
Returns the unique identifier of any particular object. More...

void setGroupId (unsigned groupId)

unsigned getGroupId () const

## Protected Member Functions

virtual const Vec3D getTangentialForce () const

Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) More...

Mdouble getEffectiveMass () const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) More...

add an force increment to the total force. More...

void setTorque (Vec3D torque)
set the total force (this is used by the normal force, tangential torques are added use addTorque) More...

void setRelativeVelocity (Vec3D relativeVelocity)
set the relative velocity of the current of the interactions. More...

void setNormalRelativeVelocity (Mdouble normalRelativeVelocit)
set the normal component of the relative velocity. More...

void setAbsoluteNormalForce (Mdouble absoluteNormalForce)
the absolute values of the norm (length) of the normal force More...

virtual Mdouble getElasticEnergyAtEquilibrium (Mdouble adhesiveForce) const

virtual void reverseHistory ()
When periodic particles some interaction need certain history properties reversing. This is the function for that. More...

void writeInteraction (std::ostream &os, bool created) const
Writes information about a interaction to the interaction file. More...

## Private Attributes

InteractionHandlerhandler_

BaseInteractableP_

BaseInteractableI_

unsigned int identificationP_

int identificationI_

bool isWallInteraction_

Vec3D contactPoint_

Vec3D relativeVelocity_

Mdouble normalRelativeVelocity_

Mdouble absoluteNormalForce_

Mdouble distance_

Vec3D force_

Vec3D torque_

unsigned timeStamp_

Vec3D normal_

Mdouble overlap_

const BaseSpeciesspecies_

Mdouble lagrangeMultiplier_

unsigned multiContactIdentifier_

## Detailed Description

Stores information about interactions between two interactable objects; often particles but could be walls etc. By info about interactions one means the overlaps, contact point, forces, torques, relative velocities etc.

This class is completely a MercuryDPM internal and should not be visible to users. It is also an abstract base class. All possible Mercury interactions are derived from this class. It is basically a policy class that defines what an interaction must have in Mercury. Advanced uses that need to add a new interaction must derive it from here and implement the black functions.

## ◆ BaseInteraction() [1/3]

 BaseInteraction::BaseInteraction ( BaseInteractable * P, BaseInteractable * I, unsigned timeStamp )

A constructor takes the BaseInteractable objects which are interacting (come into contact) and time the interaction starts.

This is the constructor which creates a new interactions between two BaseInteractable objects. The timeStamp is time the interactions is created and is used to check if the interations is current or has ended. It adds

Parameters
 [in] P BaseInteractable pointer which is the first object involved in the interaction normally a particle. [in] I BaseInteractable pointer which is the second object involved in the interaction often a wall or particle. [in] timeStamp Mdouble which is the time the interaction starts.
Bug:
Why is the species set to zero here and not the correct mixed type.
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();
53  if (P->getSpecies()->getHandler()->getDPMBase()->getInteractionFile().getFileType() == FileType::ONE_FILE)
54  {
56  }
58
59 #ifdef DEBUG_CONSTRUCTOR
60  std::cout<<"BaseInteraction::BaseInteraction() finished"<<std::endl;
61 #endif
62 }

## ◆ BaseInteraction() [2/3]

 BaseInteraction::BaseInteraction ( )
Todo:
: empty baseInteraction, used in mpi code probably
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 }

## ◆ BaseInteraction() [3/3]

 BaseInteraction::BaseInteraction ( const BaseInteraction & p )

Copy constructor.

This an copy constructor for a BaseInteraction.

Parameters
 [in] p BaseInteraction
Todo:
why are not all of the member variables copied?
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 }

References contactPoint_, force_, I_, lagrangeMultiplier_, normal_, overlap_, P_, species_, timeStamp_, and torque_.

## ◆ ~BaseInteraction()

 BaseInteraction::~BaseInteraction ( )
override

The destructor. It removes this interactions from the objects that were interacting, and writes the time to a file when needed.

Destructor for BaseInteraction. Also removes the interaction from the list of interactions for both objects involved in the interaction.

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_debug(P_ != nullptr, "Trying to destroy an interaction with P_ = nullptr");
136  logger.assert_debug(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 }

## ◆ actionsAfterTimeStep()

 void BaseInteraction::actionsAfterTimeStep ( )
virtual
771 {
772 }

## ◆ actionsOnErase()

 virtual void BaseInteraction::actionsOnErase ( )
inlinevirtual

If an interaction needs to do something before it gets erased, add it here. E.g. Liquid bridges rupture at the end of their lifetime, and the liquid bridge volume has to be redistributed. The reason this action is not done in the destructor is that this action should not be taken when erasing ghost interactions.

Reimplemented in LiquidMigrationWilletInteraction.

85  {};

Referenced by InteractionHandler::eraseOldInteractions().

 void BaseInteraction::addForce ( Vec3D force )
protected

add an force increment to the total force.

add an increment to total force in the interaction. This is used by tangential and non-contact forces (e.g. adhesive forces) as this are 'added' after the normal forces have been computed.

559 {
560  force_ += force;
561 }

References force_.

 void BaseInteraction::addTorque ( Vec3D torque )
protected

add an increment to total torque in the interaction. This is used by tangential and non-contact forces (e.g. adhesive forces) as this are 'added' after the normal forces have been computed.

569 {
570  torque_ += torque;
571 }

References torque_.

## ◆ computeForce()

 void BaseInteraction::computeForce ( )
virtual

Virtual function that contains the force law between the two objects interacting.

The children of this class will implement this function; however, it is blank. This function will do the actually force calculation for this interaction. Note, it is not virtual as it is not called from within this class.

647 {}

## ◆ copy()

 virtual BaseInteraction* BaseInteraction::copy ( ) const
pure virtual

Makes a copy of the interaction and returns a pointer to the copy.

Referenced by copySwitchPointer().

## ◆ copySwitchPointer()

 void BaseInteraction::copySwitchPointer ( const BaseInteractable * original, BaseInteractable * ghost ) const

This copies the interactions of the original particle and replaces the original with the ghost copy.

This functions copies the interactions of a real original particle. It first works out which of P and I is not the original particle. Then it create a new interactions between the new ghost copy and which every object is not the original particle from the P and I of the interaction. Note, at the end the ghost will be I in the new interaction and original item being interacted with will be P.

Todo:
Can this be simpler if we replace the particle with the ghost.
Parameters
 [in] original BaseInteractable* to the original particles who periodic image is being created from. [in] ghost BaseInteractble* to the new ghost (periodic partcles) that has just been created.
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
315 }

References InteractionHandler::addObject(), copy(), getI(), getP(), handler_, I_, P_, and reverseHistory().

Referenced by BaseInteractable::copyInteractionsForPeriodicParticles().

## ◆ createMPIInteractionDataArray()

 void * BaseInteraction::createMPIInteractionDataArray ( unsigned int numberOfInteractions ) const
virtual
864 {
865  logger(ERROR, "BaseInteraction::createMPIInteractionDataArray should never be called");
866  void* historyArray;
867  return historyArray;
868 }

References ERROR, and logger.

Referenced by InteractionHandler::createMPIInteractionDataArray().

## ◆ createMPIType()

 void BaseInteraction::createMPIType ( )
virtual
852 {
853 }

Referenced by MPIContainer::initialiseMercuryMPITypes().

## ◆ deleteMPIInteractionDataArray()

 void BaseInteraction::deleteMPIInteractionDataArray ( void * dataArray )
virtual
871 {
872  logger(WARN, "Why on earth is this function called?");
873 }

References logger, and WARN.

Referenced by InteractionHandler::deleteMPIInteractionDataArray().

## ◆ gatherContactStatistics()

 void BaseInteraction::gatherContactStatistics ( )
Todo:
Thomas please document this; as this is the area you are currently rewriting.
Todo:
Todo:
TW centre is used just for backward compatibility; replace centre by contact law; we also have to correct it in StatisticsVector::gatherContactStatistics. There also seems to be an issue with the normal being defined differently for walls
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 }

## ◆ getAbsoluteNormalForce()

 Mdouble BaseInteraction::getAbsoluteNormalForce ( ) const

Returns the absolute value of the norm (length) of the Normal force vector.

Returns the absolute normal force. This is the magnitude of the normal force.

Todo:
Ant: Check this comment.
Returns
Mdouble that contains the absolute norm (length) of the normal force.
549 {
550  return absoluteNormalForce_;
551 }

References absoluteNormalForce_.

## ◆ getBaseSpecies()

 const BaseSpecies * BaseInteraction::getBaseSpecies ( ) const

Return a constant point to BaseSpecies of the interaction.

Returns a BaseSpecies pointer to the current species. Note, this will be either a Species or a MixedSpecies done of which are derived from BaseSpecies.

Returns
A BaseSpecies pointer to the species associated with this interaction.
635 {
636  return species_;
637 }

References species_.

## ◆ getContactPoint()

 const Vec3D& BaseInteraction::getContactPoint ( ) const
inline

Gets constant reference to contact point (vector).

Returns a reference to a Vec3D which contains the current value of the contact point for the particles in interaction. Normally, does not change about the interaction is created.

Returns
A reference to a Vec3D containing the contact point.
235  { return contactPoint_; }

References contactPoint_.

Returns a Mdouble with the current contact between the two interacting objects.

Returns a Mdouble to the current overlap for the objects involved in the interaction.

Returns
Mdouble which is the value of the overlap.
323 {
324  return getOverlap()<0.0?0.0:sqrt(2.0 * getEffectiveRadius() * getOverlap());
325 }

Referenced by SinterLinInteraction::computeNormalForce().

## ◆ getCP()

 Vec3D BaseInteraction::getCP ( ) const

returns the vector from C to P. Note, this cannot simply computed as P-I because I is possibly a ghost particle and might be shifted.

426 {
427  return getP()->getPosition() - getContactPoint();
428 }

References getContactPoint(), getP(), and BaseInteractable::getPosition().

Referenced by CGFields::StandardFields::setFields().

## ◆ getDistance()

 Mdouble BaseInteraction::getDistance ( ) const

Returns an Mdouble which is the norm (length) of distance vector.

492 {
493  return distance_;
494 }

References distance_.

## ◆ getEffectiveMass()

 Mdouble BaseInteraction::getEffectiveMass ( ) const
protected

Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap)

Computes the effective mass of the particles in the interaction. This is used by many of the later interaction models. This functions assumes P is the particle and I is either a particle or a wall. Effective Radius = $$R_I*R_P/(R_I+R_P)$$ See also BaseInteraction::getEffectiveCorrectedRadius()

Returns
A Mdouble which is the effective radius of the particles.
763 {
764  Mdouble invEffectiveMass = getP()->getInvMass() + getI()->getInvMass();
765  logger.assert_debug(invEffectiveMass>0,
766  "getEffectiveMass(): interaction % at % has infinite effective mass",getId(), getContactPoint());
767  return 1.0 / invEffectiveMass;
768 }

protected

Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap)

Computes the effective radius of the two particles in the interaction. This is used by many of the later interaction models. This functions assumes P is the particle and I is either a particle or a wall. Effective Radius = $$R_I*R_P/(R_I+R_P)$$ See also BaseInteraction::getEffectiveCorrectedRadius()

Returns
A Mdouble which is the effective radius of the particles.
746 {
747  Mdouble invEffectiveRadius = getP()->getCurvature(contactPoint_) + getI()->getCurvature(contactPoint_);
751 }

## ◆ getElasticEnergy()

 Mdouble BaseInteraction::getElasticEnergy ( ) const
virtual

Returns a Mdouble which is the current about of Elastic energy in the interaction.

The children of this class will implement this function; however, it is blank. This function will contain the calculation for th elastic energy. Note, it is not virtual as it is not called from within this class.

656 {
657  return 0.0;
658 }

## ◆ getElasticEnergyAtEquilibrium()

 virtual Mdouble BaseInteraction::getElasticEnergyAtEquilibrium ( Mdouble adhesiveForce ) const
inlineprotectedvirtual
433  { return 0; }

Referenced by ChargedBondedInteraction::getElasticEnergy().

## ◆ getFieldVTK()

 std::vector< Mdouble > BaseInteraction::getFieldVTK ( unsigned i ) const
virtual

Reimplemented in SinterInteraction, and LiquidMigrationWilletInteraction.

846 {
847  return std::vector<Mdouble>();
848 }

## ◆ getForce()

 const Vec3D& BaseInteraction::getForce ( ) const
inline

Gets the current force (vector) between the two interacting objects.

Return a reference to a Vec3D which contains the current value of the force associated with this interaction.

Returns
A reference to a Vec3D containing the total force.
211  { return force_; }

References force_.

## ◆ getHandler()

 InteractionHandler * BaseInteraction::getHandler ( ) const

Gets a point to the interaction handlers to which this interaction belongs.

Returns a pointer to the InteractionHandler that this interaction belongs.

Returns
Constant pointer to the InteractionHandler.
270 {
271  return handler_;
272 }

References handler_.

## ◆ getI() [1/2]

 BaseInteractable* BaseInteraction::getI ( )
inline

Returns a pointer to the second object involved in the interaction (often a wall or a particle).

Returns a pointer to the second object in the interaction; often a particle or a wall i.e. a general interactale hence I.

Returns
Pointer to BaseInteraction often a particle or a wall.
281  {
282  logger.assert_debug(I_ != nullptr, "Second particle in interaction % is nullptr", getId());
283  return I_;
284  }

References BaseObject::getId(), I_, and logger.

## ◆ getI() [2/2]

 const BaseInteractable* BaseInteraction::getI ( ) const
inline

Returns a constant pointer to the second object involved in the interaction.

Returns a constant pointer to the second object in the interaction; often a particle or a wall i.e. a general interactale hence I.

Returns
Constant pointer to BaseInteraction often a particle or a wall.
304  {
305  logger.assert_debug(I_ != nullptr, "Second particle in interaction % is nullptr", getId());
306  return I_;
307  }

References BaseObject::getId(), I_, and logger.

## ◆ getIC()

 Vec3D BaseInteraction::getIC ( ) const

returns the vector from I to C. Note, this cannot simply computed as P-I because I is possibly a ghost particle and might be shifted.

421 {
422  return getNormal() * getDistance() + getContactPoint() - getP()->getPosition();
423 }

Referenced by CGFields::StandardFields::setFields().

## ◆ getIdentificationI()

 int BaseInteraction::getIdentificationI ( )
899 {
900  return identificationI_;
901 }

References identificationI_.

## ◆ getIdentificationP()

 unsigned int BaseInteraction::getIdentificationP ( )
894 {
895  return identificationP_;
896 }

References identificationP_.

## ◆ getInteractionDetails()

 void BaseInteraction::getInteractionDetails ( void * interactionDataArray, unsigned int index, unsigned int & identificationP, unsigned int & identificationI, bool & isWallInteraction, unsigned & timeStamp )
virtual
878 {
879  logger(ERROR, "Something went wrong, this function should not be called");
880 }

References ERROR, and logger.

Referenced by InteractionHandler::getInteractionDetails().

## ◆ getIP()

 Vec3D BaseInteraction::getIP ( ) const

returns the vector from I to P. Note, this cannot simply computed as P-I because I is possibly a ghost particle and might be shifted.

416 {
417  return getNormal() * getDistance();
418 }

References getDistance(), and getNormal().

Referenced by CGFields::StandardFields::setFields().

## ◆ getLagrangeMultiplier()

 Mdouble BaseInteraction::getLagrangeMultiplier ( )
inline
191  {
192  return lagrangeMultiplier_;
193  }

References lagrangeMultiplier_.

## ◆ getMPIInteraction()

 void BaseInteraction::getMPIInteraction ( void * historyDataArray, unsigned int index ) const
virtual

copies the history interactions into the data array

856 {
857 }

## ◆ getMultiContactIdentifier()

 unsigned int BaseInteraction::getMultiContactIdentifier ( ) const
716 {
718 }

References multiContactIdentifier_.

## ◆ getName()

 std::string BaseInteraction::getName ( ) const
overridevirtual

Virtual function which allows interactions to be named.

Functions which returns the name of the Interaction here is called BaseInteraction; but, it should be later overridden by the actual interaction classes.

Implements BaseObject.

201 {
202  return "BaseInteraction";
203 }

Referenced by write().

## ◆ getNameVTK()

 std::string BaseInteraction::getNameVTK ( unsigned i ) const
virtual

Reimplemented in SinterInteraction, and LiquidMigrationWilletInteraction.

841 {
842  return "";
843 }

Referenced by InteractionVTKWriter::writeVTKPointData().

## ◆ getNormal()

 const Vec3D& BaseInteraction::getNormal ( ) const
inline

Gets the normal vector between the two interacting objects.

Returns a reference to a Vec3D which contains the current value of the normal associated with the interactions.

Returns
A reference to a Vec3D containing the current normal.
227  { return normal_; }

References normal_.

## ◆ getNormalRelativeVelocity()

 Mdouble BaseInteraction::getNormalRelativeVelocity ( ) const

Returns a double which is the norm (length) of the relative velocity vector.

Returns the norm (length) of the relative normal velocity. Note, this can be negative or positive it is not a speed.

Todo:
Ant: Check this comment.
Returns
Mdouble that contains the norm (length) of the relative velocity.
537 {
539 }

References normalRelativeVelocity_.

## ◆ getNumberOfFieldsVTK()

 unsigned BaseInteraction::getNumberOfFieldsVTK ( ) const
virtual

Reimplemented in SinterInteraction, and LiquidMigrationWilletInteraction.

831 {
832  return 0;
833 }

## ◆ getP() [1/2]

 BaseInteractable* BaseInteraction::getP ( )
inline

Returns a pointer to first object involved in the interaction (normally a particle).

Returns a pointer to the first object in the interactions; normally the particle.

Returns
Pointer to BaseInteraction but normally will be a BaseParticle.
270  {
271  logger.assert_debug(P_ != nullptr, "First particle in interaction % is nullptr", getId());
272  return P_;
273  }

References BaseObject::getId(), logger, and P_.

## ◆ getP() [2/2]

 const BaseInteractable* BaseInteraction::getP ( ) const
inline

Returns a constant pointer to the first object involved in the interaction.

Returns a constant pointer to the first object in the interactions; normally the particle. Why implement const and non-const setters and getters? See https://www.gamedev.net/forums/topic/550112-c-non-const-getter-in-terms-of-const-getter/

Returns
Constant pointer to BaseInteraction but normally will be a BaseParticle.
293  {
294  logger.assert_debug(P_ != nullptr, "First particle in interaction % is nullptr", getId());
295  return P_;
296  }

References BaseObject::getId(), logger, and P_.

## ◆ getRelativeVelocity()

 const Vec3D & BaseInteraction::getRelativeVelocity ( ) const

Returns a constant reference to a vector of relative velocity.

Returns the relative velocity between the two interactable objects involved in the interaction.

Returns
A reference to Vec3D that contains the relative velocity.
526 {
527  return relativeVelocity_;
528 }

References relativeVelocity_.

## ◆ getTangentialForce()

 const Vec3D BaseInteraction::getTangentialForce ( ) const
protectedvirtual

Returns a constant vector to the Tangential Force

Returns the vector that is the tangential force Note, at this level there cannot be a tangential force therefore by default it return the zero vector. This function will be overridden by interactions that have tangential components.

Returns
Vec3D that contains the current tangential force of the interaction.

Reimplemented in SlidingFrictionInteraction, MindlinInteraction, and EmptyFrictionInteraction.

516 {
517  return Vec3D(0.0, 0.0, 0.0);
518 }

Referenced by gatherContactStatistics(), and writeToFStat().

## ◆ getTangentialOverlap()

 Mdouble BaseInteraction::getTangentialOverlap ( ) const
virtual

get the length of the current tangential overlap

Returns tangential overlap. Note, at this level there cannot be a tangential overlap hence by default it returns 0. This function will be overridden by interactions that have tangential components.

Returns
Positive Mdouble that is the tangential overlap.

Reimplemented in SlidingFrictionInteraction, MindlinInteraction, and EmptyFrictionInteraction.

504 {
505  return 0;
506 }

Referenced by gatherContactStatistics(), and writeToFStat().

## ◆ getTimeStamp()

 Mdouble BaseInteraction::getTimeStamp ( ) const
inline

Returns an Mdouble which is the time stamp of the interaction.

Returns the current time stamp of interaction. This should be the last time the interaction was active and used to find the end of the interaction.

Returns
Mdouble which is the last time the interaction was active.
315  { return timeStamp_; }

References timeStamp_.

## ◆ getTorque()

 const Vec3D& BaseInteraction::getTorque ( ) const
inline

Gets the current torque (vector) between the two interacting objects.

Return a reference to a Vec3D which contains the current value of the torque associated with the interaction.

Returns
A reference to a Vec3D containing the total torque.

References torque_.

## ◆ getTypeVTK()

 std::string BaseInteraction::getTypeVTK ( unsigned i ) const
virtual

Reimplemented in SinterInteraction, and LiquidMigrationWilletInteraction.

836 {
837  return "";
838 }

Referenced by InteractionVTKWriter::writeVTKPointData().

## ◆ importI()

 void BaseInteraction::importI ( BaseInteractable * I )

Sets the second object involved in the interaction (often particle or wall).

Changes the second object involved in the interaction. This function differs from BaseInteraction::setI(BaseInteractable* I) because no interactable is removed: this is needed in DPMBase::importParticlesAs as in it there's no iteractable to remove and using BaseInteraction::setI(BaseInteractable* I) would led to an output printing overloaded with warnings.

Parameters
 [in] I BaseInteractable* The particle involved in the interaction.
408 {
409  I_->removeInteraction(this);
410  I_ = I;
413 }

## ◆ importP()

 void BaseInteraction::importP ( BaseInteractable * P )

Sets the first object involved in the interaction (normally a particle).

Set the first object involved in the interaction. This function differs from BaseInteraction::setP(BaseInteractable* P) because no interactable is removed: this is needed in DPMBase::importParticlesAs as in it there's no iteractable to remove and using BaseInteraction::setP(BaseInteractable* P) would led to an output printing overloaded with warnings.

Parameters
 [in] P BaseInteractable* The particle involved in the interaction.
376 {
377  P_->removeInteraction(this);
378  P_ = P;
381 }

## ◆ integrate()

 void BaseInteraction::integrate ( Mdouble timeStep UNUSED )
virtual

integrates variables of the interaction which need to be integrate e.g. the tangential overlap.

Various variables in the force law need to be integrated. This is the place where this code goes. Note, it is empty at this point; it can be overriden in subclasses. For usage, see e.g. MindlinInteraction.cc.

Parameters
 [in] timeStep The time-step dt.
335 {
336
337 }

## ◆ isBonded()

 virtual bool BaseInteraction::isBonded ( ) const
inlinevirtual

Reimplemented in ChargedBondedInteraction.

491 {return false;}

Referenced by writeToFStat().

## ◆ isWallInteraction()

 bool BaseInteraction::isWallInteraction ( )
909 {
910  return isWallInteraction_;
911 }

References isWallInteraction_.

 void BaseInteraction::read ( std::istream & is )
overridevirtual

Interaction read function, which accepts an std::istream as input.

Parameters
 [in] is std::istream to which the information is read from.

Implements BaseObject.

187 {
188  //the rest gets read by the interaction handler
189  std::string dummy;
191  is >> dummy >> force_;
192  is >> dummy >> torque_;
193 }

References contactPoint_, force_, helpers::readOptionalVariable(), and torque_.

## ◆ removeFromHandler()

 void BaseInteraction::removeFromHandler ( )

Removes this interaction from its interaction hander.

Removes the interaction from its InteractionHandler. Does no other cleaning up as it does not remove it from the particles.

279 {
281 }

References BaseObject::getIndex(), handler_, and BaseHandler< T >::removeObject().

## ◆ reverseHistory()

 void BaseInteraction::reverseHistory ( )
protectedvirtual

When periodic particles some interaction need certain history properties reversing. This is the function for that.

The children of this class will implement this function; however, it is blank. This function will contain code that changes some history information if a copy changes the P <-> I order; as can happen in creating a periodic particle. See also PeriodicBoundary::createPeriodicParticles and BaseInteraction::copySwitchPointer Note, it is not virtual as it is not called from within this class.

671 {
672 }

Referenced by copySwitchPointer().

## ◆ rotateHistory()

 void BaseInteraction::rotateHistory ( Matrix3D & rotationMatrix )
virtual

When periodic particles are used, some interactions need certain history properties rotated (e.g. tangential springs). This is the function for that.

Todo:
some of these might be unneccesary
727 {
728  contactPoint_ = rotationMatrix * contactPoint_;
729  relativeVelocity_ = rotationMatrix * relativeVelocity_;
730  force_ = rotationMatrix * force_;
731  torque_ = rotationMatrix * torque_;
732  normal_ = rotationMatrix * normal_;
734 }

References contactPoint_, force_, normal_, relativeVelocity_, and torque_.

## ◆ setAbsoluteNormalForce()

 void BaseInteraction::setAbsoluteNormalForce ( Mdouble absoluteNormalForce )
protected

the absolute values of the norm (length) of the normal force

set absolute normal force.

Parameters
 [in] absoluteNormalForce Mdouble contain the value of the absolute normal force.
623 {
624  absoluteNormalForce_ = absoluteNormalForce;
625 }

References absoluteNormalForce_.

## ◆ setBasicMPIInteractionValues()

 void BaseInteraction::setBasicMPIInteractionValues ( int P, int I, unsigned timeStamp, Vec3D force, Vec3D torque, bool isWallInteraction, bool resetPointers )
Todo:
TW should P, I be of type unsigned?
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 }

## ◆ setContactPoint()

 void BaseInteraction::setContactPoint ( Vec3D contactPoint )

Set the location of the contact point between the two interacting objects.

239 {
240  contactPoint_ = contactPoint;
241 }

References contactPoint_.

## ◆ setDistance()

 void BaseInteraction::setDistance ( Mdouble distance )

Sets the interaction distance between the two interacting objects.

set the distance of the interaction.

Parameters
 [in] distance Mdouble which is the distance to set.
220 {
221  distance_ = distance;
222 }

References distance_.

## ◆ setForce()

 void BaseInteraction::setForce ( Vec3D force )

set total force (this is used by the normal force, tangential forces are added use addForce)

set the absolute values of the force. This is used by the normal forces as these are always called first and then the tangential and non-contact (e.g. adhesive forces) forces are added. See also BaseInteraction::addForce.

580 {
581  force_ = force;
582 }

References force_.

## ◆ setFStatData() [1/2]

 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);
942  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
943  setContactPoint(P->getPosition() - branch);
945 }

## ◆ setFStatData() [2/2]

 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);
959  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
960  setContactPoint(P->getPosition() - branch);
962 }

## ◆ setHandler()

 void BaseInteraction::setHandler ( InteractionHandler * handler )

Sets the pointer to the interaction hander which is storing this interaction.

set the handler which this interactions belongs to.

Parameters
 [in] handler InteractionHandler* pointer to the interaction handler, this interaction will belong.
260 {
261  handler_ = handler;
262 }

References handler_.

## ◆ setI()

 void BaseInteraction::setI ( BaseInteractable * I )

Sets the second object involved in the interaction (often particle or wall).

Changes the second object involved in the interaction; often a general interactable not always a particle. Note, set is slightly misleading as it removed the interaction from old interactable and adds it to the new interactable.

Parameters
 [in] I BaseInteractable* An interactable object that is involved in the interaction.
392 {
393  I_->removeInteraction(this);
394  I_ = I;
397 }

Referenced by InteractionHandler::removeObjectKeepingPeriodics().

## ◆ setIdentificationI()

 void BaseInteraction::setIdentificationI ( int identification )
889 {
890  identificationI_ = identification;
891 }

References identificationI_.

Referenced by setBasicMPIInteractionValues().

## ◆ setIdentificationP()

 void BaseInteraction::setIdentificationP ( unsigned int identification )
884 {
885  identificationP_ = identification;
886 }

References identificationP_.

Referenced by setBasicMPIInteractionValues().

## ◆ setLagrangeMultiplier()

 void BaseInteraction::setLagrangeMultiplier ( Mdouble multiplier )
inline
186  {
187  lagrangeMultiplier_ = multiplier;
188  }

References lagrangeMultiplier_.

## ◆ setMPIInteraction()

 void BaseInteraction::setMPIInteraction ( void * interactionDataArray, unsigned int index, bool resetPointers )
virtual
860 {
861 }

## ◆ setMultiContactIdentifier()

 void BaseInteraction::setMultiContactIdentifier ( unsigned int multiContactIdentifier_ )
721 {
722  multiContactIdentifier_ = multiContactIdentifier;
723 }

References multiContactIdentifier_.

Referenced by MeshTriangle::getInteractionWith().

## ◆ setNormal()

 void BaseInteraction::setNormal ( Vec3D normal )

Sets the normal vector between the two interacting objects.

sets the normal of the interaction, in direction from I to P.
Must be a unit normal vector. This is not checked by the class.

Parameters
 [in] normal Vec3D which is the normal of the interaction.
211 {
212  normal_ = normal;
213 }

References normal_.

## ◆ setNormalRelativeVelocity()

 void BaseInteraction::setNormalRelativeVelocity ( Mdouble normalRelativeVelocity )
protected

set the normal component of the relative velocity.

set the norm (length) of the normal relative velocity.

Parameters
 [in] normalRelativeVelocity Mdouble containing the normal (length) of the normal velocity between the interactable objects.
613 {
614  normalRelativeVelocity_ = normalRelativeVelocity;
615 }

References normalRelativeVelocity_.

## ◆ setOverlap()

 void BaseInteraction::setOverlap ( Mdouble overlap )

Set the overlap between the two interacting object.

set the overlap between the two interactable object involved in the interactions.

Parameters
 [in] overlap Mdouble which is the overlap to set.
230 {
231  overlap_ = overlap;
232 }

References overlap_.

## ◆ setP()

 void BaseInteraction::setP ( BaseInteractable * P )

Sets the first object involved in the interaction (normally a particle).

Changes the first object involved in the interaction; normally a particle. Note, set is slightly misleading as it removed the interaction from old particle and adds it to the new particle.

Parameters
 [in] P BaseInteractable* An interactable object that is involved in the interaction.
360 {
361  P_->removeInteraction(this);
362  P_ = P;
365 }

## ◆ setRelativeVelocity()

 void BaseInteraction::setRelativeVelocity ( Vec3D relativeVelocity )
protected

set the relative velocity of the current of the interactions.

set the relative velocity between the two particles involved in the interaction.

Parameters
 [in] relativeVelocity This is Vec3D that contains the relative velocity between the two interactable objects.
602 {
603  relativeVelocity_ = relativeVelocity;
604 }

References relativeVelocity_.

## ◆ setSpecies()

 void BaseInteraction::setSpecies ( const BaseSpecies * species )

Set the Species of the interaction; note this can either be a Species or MixedSpecies.

Sets the species for the interactions. Note, this can be either a normal Species or a MixedSpecies; depending on if this interaction is between interactables of the same or different types.

Parameters
 [in] BaseSpecies* pointer to the actually species of the interaction.
347 {
348  species_ = species;
349 }

References species_.

Referenced by InteractionHandler::getInteraction().

## ◆ setTimeStamp()

 void BaseInteraction::setTimeStamp ( unsigned timeStamp )

Updates the time step of the interacting. Note, time steps used to find completed interactions.

Updated the time stamp of the interaction. The time stamp being old is how ended interactions are detected.

Parameters
 [in] timeStamp The new timeStamp for the interactions should be the current time step.
250 {
251  timeStamp_ = timeStamp;
252 }

References timeStamp_.

Referenced by InteractionHandler::getInteraction(), and setBasicMPIInteractionValues().

## ◆ setTorque()

 void BaseInteraction::setTorque ( Vec3D torque )
protected

set the total force (this is used by the normal force, tangential torques are added use addTorque)

set the absolute values of the torque. This is used by the normal forces as these are always called first and then the tangential and non-contact (e.g. adhesive forces) forces/torques are added. See also BaseInteraction::addTorque.

591 {
592  torque_ = torque;
593 }

References torque_.

## ◆ setWallInteraction()

 void BaseInteraction::setWallInteraction ( bool flag )

## ◆ write()

 void BaseInteraction::write ( std::ostream & os ) const
overridevirtual

Interaction print function, which accepts an std::ostream as input.

BaseInteaction write function. Writes out all the information required to recreate this interaction. To write this interaction to the screen call write(std::cout). See also BaseInteraction::read

Parameters
 [in] os std::ostream to which the information is written. Note, is any ostram is can be file or screen.
Todo:
should we output id's here? os << " id " << getId() << " particleIds " << P_->getId() << " " << I_->getId();

Implements BaseObject.

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 }

References contactPoint_, force_, BaseObject::getId(), getName(), I_, P_, timeStamp_, and torque_.

## ◆ writeInteraction()

 void BaseInteraction::writeInteraction ( std::ostream & os, bool created ) const
protected

Writes information about a interaction to the interaction file.

Method to write the interaction data to a stream, usually an interaction file. It saves the IDs of the particles (in case there are two particles) or particle and wall. Furthermore, the time when the interaction starts and ends is written to the stream.

Parameters
 [in/out] os The outputstream to which the interaction information should be written, usually a file [in] created Whether or not this is the beginning of the interaction.
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 }

Referenced by BaseInteraction(), and ~BaseInteraction().

## ◆ writeToFStat()

 void BaseInteraction::writeToFStat ( std::ostream & os, Mdouble time ) const

Writes forces data to the FStat file.

Writes the FStat information that is required for the coarse- graining package MercuryCG if you want stress and force information. Note, it takes a general ostream but is normally a file i.e. ofstream

Parameters
 [in] os This is the ostream that the FStat information will be written to. Normally, a file but could be a gerneral ostream.
Todo:
MX The documentation mentions that the first variable is the time - this is incorrect, is is the timeStamp the interaction started
Todo:
the flip in normal/tangential direction for walls should not be done; this is an old bug
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 }

## ◆ absoluteNormalForce_

 Mdouble BaseInteraction::absoluteNormalForce_
private

Variables calculated by NormalForceInteraction, used by FrictionForceInteraction and AdhesiveForceInteraction (but not changed by them)

Referenced by getAbsoluteNormalForce(), and setAbsoluteNormalForce().

## ◆ contactPoint_

 Vec3D BaseInteraction::contactPoint_
private

This is Vec3D which stores the contact point of the interaction.

## ◆ distance_

 Mdouble BaseInteraction::distance_
private

Variables calculated by NormalForceInteraction, used by FrictionForceInteraction and AdhesiveForceInteraction (but not changed by them)

Referenced by getDistance(), and setDistance().

## ◆ force_

 Vec3D BaseInteraction::force_
private

## ◆ handler_

 InteractionHandler* BaseInteraction::handler_
private

Pointer to the InteractionHander for this interaction.

Referenced by copySwitchPointer(), getHandler(), removeFromHandler(), and setHandler().

## ◆ I_

 BaseInteractable* BaseInteraction::I_
private

This is the second of the two interactable object involved in the interaction; often a particle or a wall, hence I because it is general interactable.

## ◆ identificationI_

 int BaseInteraction::identificationI_
private

## ◆ identificationP_

 unsigned int BaseInteraction::identificationP_
private

## ◆ isWallInteraction_

 bool BaseInteraction::isWallInteraction_
private

## ◆ lagrangeMultiplier_

 Mdouble BaseInteraction::lagrangeMultiplier_
private

Lagrange multiplier used by contact detection of superquadrics.

Referenced by BaseInteraction(), getLagrangeMultiplier(), and setLagrangeMultiplier().

## ◆ multiContactIdentifier_

 unsigned BaseInteraction::multiContactIdentifier_
private

Identifies individual contact such that it can be distinguished. E.g. the face number of a triangulated wall.

Referenced by getMultiContactIdentifier(), and setMultiContactIdentifier().

## ◆ normal_

 Vec3D BaseInteraction::normal_
private

Vec3D which stores the normal vector (unit vector from I to P) of the interaction.

## ◆ normalRelativeVelocity_

 Mdouble BaseInteraction::normalRelativeVelocity_
private

Variables calculated by NormalForceInteraction, used in other force routines (but not changed by them)

Referenced by getNormalRelativeVelocity(), and setNormalRelativeVelocity().

## ◆ overlap_

 Mdouble BaseInteraction::overlap_
private

Mdouble which stores the current overlap.

Referenced by BaseInteraction(), gatherContactStatistics(), getOverlap(), and setOverlap().

## ◆ P_

 BaseInteractable* BaseInteraction::P_
private

This first of two interactable objects involved in the interaction; normally a particle hence P.

## ◆ relativeVelocity_

 Vec3D BaseInteraction::relativeVelocity_
private

Variables calculated by the normal force routines used in other force routines (but not changed by them).

Referenced by getRelativeVelocity(), rotateHistory(), and setRelativeVelocity().

## ◆ species_

 const BaseSpecies* BaseInteraction::species_
private

Pointer to the species of the interaction could be a mixed species or a species.

Referenced by BaseInteraction(), getBaseSpecies(), and setSpecies().

## ◆ timeStamp_

 unsigned BaseInteraction::timeStamp_
private

Mdouble which store the last timeStamp the interaction was active.

Todo:
TW it would be safer to use the integer time step here, instead of the double

Referenced by BaseInteraction(), getTimeStamp(), setTimeStamp(), write(), and writeInteraction().

## ◆ torque_

 Vec3D BaseInteraction::torque_
private

The documentation for this class was generated from the following files:
DPMBase::getInteractionFile
File & getInteractionFile()
Return a reference to the file InteractionsFile.
Definition: DPMBase.cc:343
BaseInteractable::getSpecies
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Definition: BaseInteractable.h:108
BaseInteraction::isBonded
virtual bool isBonded() const
Definition: BaseInteraction.h:491
BaseObject::BaseObject
BaseObject()=default
Default constructor.
BaseInteraction::getHandler
InteractionHandler * getHandler() const
Gets a point to the interaction handlers to which this interaction belongs.
Definition: BaseInteraction.cc:269
BaseInteraction::getTangentialOverlap
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap
Definition: BaseInteraction.cc:503
BaseInteraction::isWallInteraction_
bool isWallInteraction_
Definition: BaseInteraction.h:515
BaseInteraction::identificationI_
int identificationI_
Definition: BaseInteraction.h:514
Vec3D::setZero
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
BaseInteraction::distance_
Mdouble distance_
Definition: BaseInteraction.h:540
BaseSpecies::getHandler
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
BaseInteraction::timeStamp_
unsigned timeStamp_
Definition: BaseInteraction.h:556
BaseInteraction::contactPoint_
Vec3D contactPoint_
Definition: BaseInteraction.h:520
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
BaseInteraction::relativeVelocity_
Vec3D relativeVelocity_
Definition: BaseInteraction.h:525
BaseInteraction::setTorque
void setTorque(Vec3D torque)
set the total force (this is used by the normal force, tangential torques are added use addTorque)
Definition: BaseInteraction.cc:590
BaseInteraction::getI
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle).
Definition: BaseInteraction.h:280
Vec3D::dot
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76
BaseInteraction::setWallInteraction
void setWallInteraction(bool flag)
Definition: BaseInteraction.cc:903
BaseInteraction::multiContactIdentifier_
unsigned multiContactIdentifier_
Definition: BaseInteraction.h:581
BaseInteraction::setForce
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce)
Definition: BaseInteraction.cc:579
Vec3D
Definition: Vector.h:50
BaseInteraction::setDistance
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
Definition: BaseInteraction.cc:219
BaseInteraction::getContactPoint
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
Definition: BaseInteraction.h:234
BaseInteraction
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
File
Definition: File.h:81
Mdouble
double Mdouble
Definition: GeneralDefine.h:34
Definition: BaseParticle.h:348
BaseInteraction::force_
Vec3D force_
Definition: BaseInteraction.h:545
ERROR
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
BaseHandler::removeObject
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:472
BaseInteraction::getOverlap
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: BaseInteraction.h:240
Vec3D::getLength
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:331
DPMBase::getTime
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:805
BaseInteraction::getNormal
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
Definition: BaseInteraction.h:226
BaseInteraction::setOverlap
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
Definition: BaseInteraction.cc:229
WARN
LL< Log::WARN > WARN
Warning log level.
Definition: Logger.cc:54
BaseInteraction::species_
const BaseSpecies * species_
Definition: BaseInteraction.h:571
Log::FATAL
@ FATAL
BaseObject::getIndex
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
BaseInteractable::removeInteraction
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
Definition: BaseInteractable.cc:308
BaseInteraction::lagrangeMultiplier_
Mdouble lagrangeMultiplier_
Definition: BaseInteraction.h:576
Adds an interaction to this BaseInteractable.
Definition: BaseInteractable.cc:292
BaseInteraction::reverseHistory
virtual void reverseHistory()
When periodic particles some interaction need certain history properties reversing....
Definition: BaseInteraction.cc:670
BaseInteraction::setContactPoint
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
Definition: BaseInteraction.cc:238
BaseInteractable::getCurvature
virtual Mdouble getCurvature(const Vec3D &labFixedCoordinates) const
Definition: BaseInteractable.h:414
BaseInteraction::setNormal
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
Definition: BaseInteraction.cc:210
BaseObject::getId
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
BaseHandler::getDPMBase
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
BaseInteraction::normalRelativeVelocity_
Mdouble normalRelativeVelocity_
Definition: BaseInteraction.h:530
BaseParticle
Definition: BaseParticle.h:54
BaseInteraction::getTangentialForce
virtual const Vec3D getTangentialForce() const
Definition: BaseInteraction.cc:515
BaseInteraction::copy
virtual BaseInteraction * copy() const =0
Makes a copy of the interaction and returns a pointer to the copy.
BaseInteraction::normal_
Vec3D normal_
Definition: BaseInteraction.h:561
BaseInteraction::overlap_
Mdouble overlap_
Definition: BaseInteraction.h:566
Adds an Interaction to the InteractionHandler.
Definition: InteractionHandler.cc:87
BaseInteraction::P_
BaseInteractable * P_
Definition: BaseInteraction.h:504
BaseInteraction::setTimeStamp
void setTimeStamp(unsigned timeStamp)
Updates the time step of the interacting. Note, time steps used to find completed interactions.
Definition: BaseInteraction.cc:249
BaseInteraction::absoluteNormalForce_
Mdouble absoluteNormalForce_
Definition: BaseInteraction.h:535
BaseInteraction::getDistance
Mdouble getDistance() const
Returns an Mdouble which is the norm (length) of distance vector.
Definition: BaseInteraction.cc:491
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: Helpers.h:247
DPMBase::gatherContactStatistics
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:1900
BaseInteraction::setIdentificationI
void setIdentificationI(int identification)
Definition: BaseInteraction.cc:888
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap)
Definition: BaseInteraction.cc:745
BaseInteraction::identificationP_
unsigned int identificationP_
Definition: BaseInteraction.h:513
File::getFstream
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:153
BaseInteractable::getInvMass
virtual Mdouble getInvMass() const
Definition: BaseInteractable.h:408
Vec3D::setNaN
void setNaN()
Sets all elements to NaN.
Definition: Vector.cc:53
BaseInteraction::handler_
InteractionHandler * handler_
Definition: BaseInteraction.h:499
BaseInteraction::torque_
Vec3D torque_
Definition: BaseInteraction.h:550
File::getFileType
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:207
BaseInteraction::writeInteraction
void writeInteraction(std::ostream &os, bool created) const
Writes information about a interaction to the interaction file.
Definition: BaseInteraction.cc:681
BaseInteractable::getPosition
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
BaseInteraction::setIdentificationP
void setIdentificationP(unsigned int identification)
Definition: BaseInteraction.cc:883
BaseInteraction::getName
std::string getName() const override
Virtual function which allows interactions to be named.
Definition: BaseInteraction.cc:200
BaseInteraction::I_
BaseInteractable * I_
Definition: BaseInteraction.h:509
BaseInteraction::getP
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Definition: BaseInteraction.h:269