57 #ifdef DEBUG_CONSTRUCTOR
58 std::cout<<
"BaseInteraction::BaseInteraction() finished"<<std::endl;
100 if (dynamic_cast<BaseParticle*>(
I_) !=
nullptr)
129 return "BaseInteraction";
230 if (C->
getP() == original)
426 if (scalarTangentialForce!=0.0)
427 tangential = tangentialForce/scalarTangentialForce;
429 tangential =
Vec3D(0.0,0.0,0.0);
439 if (PParticle!=0 && !PParticle->
isFixed())
446 <<
" " << tangentialOverlap
447 <<
" " << scalarNormalForce
448 <<
" " << scalarTangentialForce
450 <<
" " << (IParticle==0?-tangential:tangential) << std::endl;
460 <<
" " << tangentialOverlap
461 <<
" " << scalarNormalForce
462 <<
" " << scalarTangentialForce
464 <<
" " << -tangential << std::endl;
500 return Vec3D(0.0,0.0,0.0);
680 if (PParticle==
nullptr)
682 std::cerr <<
"BaseInteraction::getEffectiveCorrectedRadius(): first interactable P is not a particle" << std::endl;
686 if (IParticle==
nullptr)
694 return radiusP * radiusI / (radiusP + radiusI);
711 if (PParticle==
nullptr)
713 std::cerr <<
"BaseInteraction::getEffectiveCorrectedRadius(): first interactable P is not a particle" << std::endl;
717 if (IParticle==
nullptr)
725 return radiusP * radiusI / (radiusP + radiusI);
743 if (scalarTangentialForce!=0.0)
744 tangential = tangentialForce/scalarTangentialForce;
746 tangential =
Vec3D(0.0,0.0,0.0);
756 if (PParticle!=0 && !PParticle->
isFixed())
765 scalarTangentialForce,
767 (IParticle==0?-tangential:tangential));
778 scalarTangentialForce,
const Vec3D & getForce() const
Gets the current force (vector) between the two interacting objects.
unsigned int getId() const
Returns the unique identifier of any particular object.
unsigned int getIndex() const
Returns the index of the object in the handler.
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...
virtual void gatherContactStatistics(unsigned int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
//Not unsigned index because of possible wall collisions.
BaseSpecies is the class from which all other species are derived.
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.
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.
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...
const Vec3D & getRelativeVelocity() const
Returns a constant reference to a vector of relative velocity.
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.
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
void addTorque(Vec3D torque)
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) ...
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
void setNormalRelativeVelocity(Mdouble normalRelativeVelocit)
set the normal component of the relative velocity.
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
Mdouble getTimeStamp() const
Returns an Mdouble which is the time stamp of the interaction.
void setSpecies(BaseSpecies *species)
Set the Species of the interaction; note this can either be a Species or MixedSpecies.
void gatherContactStatistics()
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
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: .
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
Mdouble getNormalRelativeVelocity() const
Returns a double which is the norm (length) of the relative velocity vector.
virtual ~BaseInteraction()
The default destructor.
BaseInteraction(BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
A constructor takes the BaseInteractable objects which are interacting (come into contact) and time t...
void setTimeStamp(Mdouble timeStamp)
Updates the time step of the interacting. Note, timesteps used to find completed interactions.
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.
virtual void removeObject(unsigned const int id)
Removes an Object from the BaseHandler.
Container to store Interaction objects.
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
void setHandler(InteractionHandler *handler)
Sets the pointer to the interaction hander which is storing this interaction.
void setP(BaseInteractable *P)
Sets the first object involved in the interaction (normally a particle).
void setTorque(Vec3D torque)
set the total force (this is used by the normal force, tangential torques are added use addTorque) ...
virtual const Vec3D getTangentialForce() const
Mdouble getRadius() const
Returns the particle's radius_.
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
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_
BaseInteractable * getI()
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...
virtual std::string getName() const
Virtual function which allows interactions to be named.
const Vec3D & getTorque() const
Gets the current torque (vector) between the two interacting objects.
virtual void read(std::istream &is)
Interaction read function, which accepts an std::istream as input.
Defines the basic properties that a interactable object can have.
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. ...
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Implementation of a 3D matrix.
Implementation of a 3D vector (by Vitaliy).
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
void addObject(BaseInteraction *I)
Adds an Interaction to the InteractionHandler.
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap
virtual void write(std::ostream &os) const
Interaction print function, which accepts an std::ostream as input.
bool isFixed() const
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...
Mdouble getEffectiveCorrectedRadius()
Returns a Mdouble to the effective radius corrected for the overlaps of the particles.
void writeToFStat(std::ostream &os) const
Writes forces data to the FStat file.
InteractionHandler * handler_
Mdouble getAbsoluteNormalForce() const
Returns the absolute value of the norm (length) of the Normal force vector.