26 #ifndef BASEINTERACTION_H
27 #define BASEINTERACTION_H
95 void read(std::istream& is)
override;
100 void write(std::ostream& os)
const override;
110 std::string
getName()
const override;
271 logger.assert_debug(
P_ !=
nullptr,
"First particle in interaction % is nullptr",
getId());
282 logger.assert_debug(
I_ !=
nullptr,
"Second particle in interaction % is nullptr",
getId());
294 logger.assert_debug(
P_ !=
nullptr,
"First particle in interaction % is nullptr",
getId());
305 logger.assert_debug(
I_ !=
nullptr,
"Second particle in interaction % is nullptr",
getId());
375 virtual std::vector<Mdouble>
getFieldVTK(
unsigned i)
const;
462 virtual void getMPIInteraction(
void* historyDataArray,
unsigned int index)
const;
465 virtual void getInteractionDetails(
void* interactionDataArray,
unsigned int index,
unsigned int& identificationP,
470 virtual void setMPIInteraction(
void* interactionDataArray,
unsigned int index,
bool resetPointers);
unsigned int getId() const
Returns the unique identifier of any particular object.
const Vec3D & getTorque() const
Gets the current torque (vector) between the two interacting objects.
virtual void actionsOnErase()
If an interaction needs to do something before it gets erased, add it here. E.g. Liquid bridges ruptu...
Mdouble getEffectiveRadius() const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) ...
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.
virtual void getInteractionDetails(void *interactionDataArray, unsigned int index, unsigned int &identificationP, unsigned int &identificationI, bool &isWallInteraction, unsigned &timeStamp)
virtual void * createMPIInteractionDataArray(unsigned int numberOfInteractions) const
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here...
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.
const BaseSpecies * species_
virtual BaseInteraction * copy() const =0
Makes a copy of the interaction and returns a pointer to the copy.
virtual void actionsAfterTimeStep()
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...
const Vec3D & getRelativeVelocity() const
Returns a constant reference to a vector of relative velocity.
const BaseInteractable * getI() const
Returns a constant pointer to the second object involved in the interaction.
const std::complex< Mdouble > i
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 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()
void setLagrangeMultiplier(Mdouble multiplier)
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)...
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...
Mdouble getTimeStamp() const
Returns an Mdouble which is the time stamp of the interaction.
void gatherContactStatistics()
Stores information about interactions between two interactable objects; often particles but could be ...
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
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...
const BaseSpecies * getBaseSpecies() const
Return a constant point to BaseSpecies of the interaction.
void setIdentificationP(unsigned int identification)
~BaseInteraction() override
The destructor.
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_
Mdouble getLagrangeMultiplier()
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 writeInteraction(std::ostream &os, bool created) const
Writes information about a interaction to the interaction file.
const Vec3D & getForce() const
Gets the current force (vector) between the two interacting objects.
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.
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).
virtual bool isBonded() const
unsigned multiContactIdentifier_
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.
virtual Mdouble getElasticEnergyAtEquilibrium(Mdouble adhesiveForce) const
Mdouble getContactRadius() const
Returns a Mdouble with the current contact between the two interacting objects.
const BaseInteractable * getP() const
Returns a constant pointer to the first object involved in the interaction.
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. ...
Implementation of a 3D matrix.
void setBasicMPIInteractionValues(int P, int I, unsigned timeStamp, Vec3D force, Vec3D torque, bool isWallInteraction, bool resetPointers)
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
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)
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.