MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseInteractable Class Referenceabstract

Defines the basic properties that a interactable object can have. More...

#include <BaseInteractable.h>

+ Inheritance diagram for BaseInteractable:

Public Member Functions

 BaseInteractable ()
 Default BaseInteractable constructor. More...
 
 BaseInteractable (const BaseInteractable &p)
 Copy constructor. More...
 
 ~BaseInteractable () override
 Destructor, it simply destructs the BaseInteractable and all the objects it contains. More...
 
void read (std::istream &is) override
 Reads a BaseInteractable from an input stream. More...
 
void write (std::ostream &os) const override
 Write a BaseInteractable to an output stream. More...
 
unsigned int getIndSpecies () const
 Returns the index of the species associated with the interactable object. More...
 
virtual void setIndSpecies (unsigned int indSpecies)
 Sets the index of the Species of this BaseInteractable. More...
 
const ParticleSpeciesgetSpecies () const
 Returns a pointer to the species of this BaseInteractable. More...
 
void setSpecies (const ParticleSpecies *species)
 Sets the species of this BaseInteractable. More...
 
const Vec3DgetForce () const
 Returns the force on this BaseInteractable. More...
 
const Vec3DgetTorque () const
 Returns the torque on this BaseInteractable. More...
 
void setForce (const Vec3D &force)
 Sets the force on this BaseInteractable. More...
 
void setTorque (const Vec3D &torque)
 Sets the torque on this BaseInteractable. More...
 
void addForce (const Vec3D &addForce)
 Adds an amount to the force on this BaseInteractable. More...
 
void addTorque (const Vec3D &addTorque)
 Adds an amount to the torque on this BaseInteractable. More...
 
void resetForceTorque (int numberOfOMPthreads)
 
void sumForceTorqueOMP ()
 
const Vec3DgetPosition () const
 Returns the position of this BaseInteractable. More...
 
const QuaterniongetOrientation () const
 Returns the orientation of this BaseInteractable. More...
 
void setPosition (const Vec3D &position)
 Sets the position of this BaseInteractable. More...
 
void setOrientationViaNormal (Vec3D normal)
 Sets the orientation of this BaseInteractable by defining the vector that results from the rotation of the (1,0,0) vector. More...
 
void setOrientationViaEuler (Vec3D eulerAngle)
 Sets the orientation of this BaseInteractable by defining the euler angles. More...
 
void setOrientation (const Quaternion &orientation)
 Sets the orientation of this BaseInteractable. More...
 
virtual void move (const Vec3D &move)
 Moves this BaseInteractable by adding an amount to the position. More...
 
virtual void rotate (const Vec3D &angularVelocityDt)
 Rotates this BaseInteractable. More...
 
const std::vector
< BaseInteraction * > & 
getInteractions () const
 Returns a list of interactions which belong to this interactable. More...
 
void addInteraction (BaseInteraction *I)
 Adds an interaction to this BaseInteractable. More...
 
bool removeInteraction (BaseInteraction *I)
 Removes an interaction from this BaseInteractable. More...
 
void copyInteractionsForPeriodicParticles (const BaseInteractable &p)
 Copies interactions to this BaseInteractable whenever a periodic copy made. More...
 
void setVelocity (const Vec3D &velocity)
 set the velocity of the BaseInteractable. More...
 
void setAngularVelocity (const Vec3D &angularVelocity)
 set the angular velocity of the BaseInteractble. More...
 
void addVelocity (const Vec3D &velocity)
 adds an increment to the velocity. More...
 
void addAngularVelocity (const Vec3D &angularVelocity)
 add an increment to the angular velocity. More...
 
virtual const Vec3DgetVelocity () const
 Returns the velocity of this interactable. More...
 
virtual const Vec3DgetAngularVelocity () const
 Returns the angular velocity of this interactable. More...
 
void setPrescribedPosition (const std::function< Vec3D(double)> &prescribedPosition)
 Allows the position of an infinite mass interactable to be prescribed. More...
 
void applyPrescribedPosition (double time)
 Computes the position from the user defined prescribed position function. More...
 
void setPrescribedVelocity (const std::function< Vec3D(double)> &prescribedVelocity)
 Allows the velocity of an infinite mass interactable to be prescribed. More...
 
void applyPrescribedVelocity (double time)
 Computes the velocity from the user defined prescribed velocity function. More...
 
void setPrescribedOrientation (const std::function< Quaternion(double)> &prescribedOrientation)
 Allows the orientation of the infinite mass interactbale to be prescribed. More...
 
void applyPrescribedOrientation (double time)
 Computes the orientation from the user defined prescribed orientation function. More...
 
void setPrescribedAngularVelocity (const std::function< Vec3D(double)> &prescribedAngularVelocity)
 Allows the angular velocity of the infinite mass interactable to be prescribed. More...
 
void applyPrescribedAngularVelocity (double time)
 Computes the angular velocity from the user defined prescribed angular velocity. More...
 
virtual BaseInteractiongetInteractionWith (BaseParticle *P, unsigned timeStamp, InteractionHandler *interactionHandler)=0
 Returns the interaction between this object and a given BaseParticle. More...
 
virtual const Vec3D getVelocityAtContact (const Vec3D &contact) const
 Returns the velocity at the contact point, use by many force laws. More...
 
void integrateBeforeForceComputation (double time, double timeStep)
 This is part of integrate routine for objects with infinite mass. More...
 
void integrateAfterForceComputation (double time, double timeStep)
 This is part of the integration routine for objects with infinite mass. More...
 
virtual bool isFixed () const =0
 
virtual Mdouble getInvMass () const
 
virtual Mdouble getCurvature (const Vec3D &labFixedCoordinates) 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 std::string getName () const =0
 A purely virtual function. 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
 

Private Attributes

std::function< Vec3D(double)> prescribedPosition_
 
std::function< Vec3D(double)> prescribedVelocity_
 
std::function< Quaternion(double)> prescribedOrientation_
 
std::function< Vec3D(double)> prescribedAngularVelocity_
 
Vec3D position_
 
Quaternion orientation_
 
Vec3D angularVelocity_
 
Vec3D force_
 
Vec3D torque_
 
std::vector< Vec3DforceOMP_
 
std::vector< Vec3DtorqueOMP_
 
const ParticleSpeciesspecies_
 
unsigned int indSpecies_
 
Vec3D velocity_
 
std::vector< BaseInteraction * > interactions_
 

Detailed Description

Defines the basic properties that a interactable object can have.

Inherits from class BaseObject (public) Also it includes a lot of code to deal with interactable objects that have a prescibed motion. Most of the code in here is MercuryDPM internal. The only place an user will interface with this code is for setting the lambda functions that prescribe the motion of infinite mass particles.

Todo:
Check prescribed objects have infinite mass.

Definition at line 54 of file BaseInteractable.h.

Constructor & Destructor Documentation

BaseInteractable::BaseInteractable ( )

Default BaseInteractable constructor.

Simply creates an empty BaseInteractable, with all vectors relating to the positions and motions of the current object initialised to zero and all pointers to null.

Note that the function also sets the species index (indSpecies_) to zero by default, so any objects created will, by default, possess the properties associated with species 0.

Definition at line 42 of file BaseInteractable.cc.

References angularVelocity_, DEBUG, force_, indSpecies_, logger, orientation_, position_, prescribedAngularVelocity_, prescribedOrientation_, prescribedPosition_, prescribedVelocity_, Quaternion::setUnity(), Vec3D::setZero(), species_, torque_, and velocity_.

42  :
43  BaseObject()
44 {
45  //setting all vectors to zero
50  force_.setZero();
51  torque_.setZero();
52  //setting the default species to species 0
53  indSpecies_ = 0;
54  //setting all relevant pointers to nullptr
55  species_ = nullptr;
56  prescribedPosition_ = nullptr;
57  prescribedVelocity_ = nullptr;
58  prescribedOrientation_ = nullptr;
60  logger(DEBUG, "BaseInteractable::BaseInteractable() finished");
61 }
std::function< Vec3D(double)> prescribedAngularVelocity_
unsigned int indSpecies_
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseObject()=default
Default constructor.
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
std::function< Quaternion(double)> prescribedOrientation_
std::function< Vec3D(double)> prescribedPosition_
const ParticleSpecies * species_
std::function< Vec3D(double)> prescribedVelocity_
Quaternion orientation_
void setUnity()
Sets quaternion value to (1,0,0,0)
Definition: Quaternion.cc:53
BaseInteractable::BaseInteractable ( const BaseInteractable p)

Copy constructor.

Copies an existing BaseInteractable, p, and (almost) all objects it contains.

Note, that the interactions are not copied as these often require extra work. Rather, the interactions list is simply emptied using the standard C++ clear function, destroying all contents and leaving the interactions_ vector with a size of zero.

All the other properties are copied normally.

Please use this copy with care.

Definition at line 75 of file BaseInteractable.cc.

References angularVelocity_, DEBUG, force_, indSpecies_, interactions_, logger, orientation_, position_, prescribedAngularVelocity_, prescribedOrientation_, prescribedPosition_, prescribedVelocity_, species_, torque_, and velocity_.

76  : BaseObject(p)
77 {
78  interactions_.clear();
79  position_ = p.position_;
81  velocity_ = p.velocity_;
83  force_ = p.force_;
84  torque_ = p.torque_;
85  species_ = p.species_;
91  logger(DEBUG, "BaseInteractable::BaseInteractable(const BaseInteractable &p finished");
92 }
std::function< Vec3D(double)> prescribedAngularVelocity_
unsigned int indSpecies_
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseObject()=default
Default constructor.
std::function< Quaternion(double)> prescribedOrientation_
std::function< Vec3D(double)> prescribedPosition_
const ParticleSpecies * species_
std::function< Vec3D(double)> prescribedVelocity_
Quaternion orientation_
std::vector< BaseInteraction * > interactions_
BaseInteractable::~BaseInteractable ( )
override

Destructor, it simply destructs the BaseInteractable and all the objects it contains.

Removes all the interactions from the interactable.

Definition at line 97 of file BaseInteractable.cc.

References DEBUG, BaseObject::getId(), BaseObject::getIndex(), interactions_, logger, and VERBOSE.

98 {
99  logger(VERBOSE, "Deleting BaseInteractable with index= % and id = %, size = %", getIndex(), getId(),
100  interactions_.size());
101  while (!interactions_.empty())
102  {
103  interactions_.front()->removeFromHandler();
104  }
105  logger(DEBUG, "BaseInteractable::~BaseInteractable() finished");
106 }
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
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
std::vector< BaseInteraction * > interactions_

Member Function Documentation

void BaseInteractable::addAngularVelocity ( const Vec3D angularVelocity)

add an increment to the angular velocity.

See also BaseInteractable::setAngularVelocity

Parameters
[in]angularVelocityincrement which to increase the angularVelocity by.

Definition at line 370 of file BaseInteractable.cc.

References angularVelocity_.

Referenced by BaseParticle::angularAccelerate().

371 {
372  angularVelocity_ += angularVelocity;
373 }
void BaseInteractable::addForce ( const Vec3D addForce)

Adds an amount to the force on this BaseInteractable.

Incremental version of BaseInteractable::setForce. Also see BaseInteraction::setForce for were this is used.

Parameters
[in]addForceVec3D incremental force which is added to the total force of the interactable.

Definition at line 116 of file BaseInteractable.cc.

References force_, forceOMP_, and OMP_THREAD_NUM.

Referenced by DPMBase::computeExternalForces(), DPMBase::computeForcesDueToWalls(), DPMBase::computeInternalForce(), and BaseWall::getInteractionWith().

117 {
118  if (OMP_THREAD_NUM==0) {
119  force_ += addForce;
120  } else {
122  }
123 }
void addForce(const Vec3D &addForce)
Adds an amount to the force on this BaseInteractable.
#define OMP_THREAD_NUM
Definition: GeneralDefine.h:69
std::vector< Vec3D > forceOMP_
void BaseInteractable::addInteraction ( BaseInteraction I)

Adds an interaction to this BaseInteractable.

Added a new interactions to the current interactable.

Parameters
[in]IPointer to the new interaction which is to be added to the list of interactions of this interactable.

Definition at line 292 of file BaseInteractable.cc.

References interactions_.

Referenced by InteractionHandler::addObject(), BaseInteraction::importI(), BaseInteraction::importP(), BaseInteraction::setI(), and BaseInteraction::setP().

293 {
294  interactions_.push_back(I);
295 }
std::vector< BaseInteraction * > interactions_
void BaseInteractable::addTorque ( const Vec3D addTorque)

Adds an amount to the torque on this BaseInteractable.

Incremental version of BaseInteractable::setTorque. Also see BaseInteraction::setTorque for were this is used.

Parameters
[in]addTorqueVec3D incremental force which is added to the total torque of the interactable.

Definition at line 132 of file BaseInteractable.cc.

References OMP_THREAD_NUM, torque_, and torqueOMP_.

Referenced by DPMBase::computeForcesDueToWalls(), DPMBase::computeInternalForce(), and BaseWall::getInteractionWith().

133 {
134  if (OMP_THREAD_NUM==0) {
135  torque_ += addTorque;
136  } else {
138  }
139 }
std::vector< Vec3D > torqueOMP_
#define OMP_THREAD_NUM
Definition: GeneralDefine.h:69
void addTorque(const Vec3D &addTorque)
Adds an amount to the torque on this BaseInteractable.
void BaseInteractable::addVelocity ( const Vec3D velocity)
inline

adds an increment to the velocity.

See also BaseInteractable::setVelocity

Parameters
[in]velocityVec3D containing the velocity increment which to increase the velocity by.

Definition at line 312 of file BaseInteractable.h.

References velocity_.

Referenced by BaseParticle::accelerate(), ShearBoxBoundary::shiftHorizontalPosition(), and LeesEdwardsBoundary::shiftVerticalPosition().

313  { velocity_ += velocity; }
void BaseInteractable::applyPrescribedAngularVelocity ( double  time)

Computes the angular velocity from the user defined prescribed angular velocity.

This calls the prescribedAngularVelocity function if one has been defined. See also BaseInteractable::setPrescribedAngularVelocity

Parameters
[in]timedouble which is the current time of the simulation.

Definition at line 512 of file BaseInteractable.cc.

References prescribedAngularVelocity_, and setAngularVelocity().

Referenced by integrateAfterForceComputation(), and integrateBeforeForceComputation().

513 {
515  {
517  }
518 }
std::function< Vec3D(double)> prescribedAngularVelocity_
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
void BaseInteractable::applyPrescribedOrientation ( double  time)

Computes the orientation from the user defined prescribed orientation function.

This calls the prescribedOrientation function if one has been defined. See also BaseInteractable::setPrescribedOrientation

Parameters
[in]timedouble which is the current time of the simulation.

Definition at line 485 of file BaseInteractable.cc.

References prescribedOrientation_, and setOrientation().

Referenced by integrateBeforeForceComputation().

486 {
488  {
490  }
491 }
std::function< Quaternion(double)> prescribedOrientation_
void setOrientation(const Quaternion &orientation)
Sets the orientation of this BaseInteractable.
void BaseInteractable::applyPrescribedPosition ( double  time)

Computes the position from the user defined prescribed position function.

This calls the prescribedPosition function if one has been defined. See also BaseInteractable::setPrescribedPosition

Parameters
[in]timedouble which is the current time of the simulation.

Definition at line 423 of file BaseInteractable.cc.

References prescribedPosition_, and setPosition().

Referenced by integrateBeforeForceComputation().

424 {
426  {
428  }
429 }
std::function< Vec3D(double)> prescribedPosition_
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
void BaseInteractable::applyPrescribedVelocity ( double  time)

Computes the velocity from the user defined prescribed velocity function.

This calls the prescribedVeclocity function if one has been defined. See also BaseInteractable::setPrescribedVelocity

Parameters
[in]timedouble which is the current time of the simulation.

Definition at line 454 of file BaseInteractable.cc.

References prescribedVelocity_, and setVelocity().

Referenced by integrateAfterForceComputation(), and integrateBeforeForceComputation().

455 {
457  {
459  }
460 }
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
std::function< Vec3D(double)> prescribedVelocity_
void BaseInteractable::copyInteractionsForPeriodicParticles ( const BaseInteractable pOriginal)

Copies interactions to this BaseInteractable whenever a periodic copy made.

This loops over all interactions of periodic (particle) and calls copySwitchPointer, which copies the interactions.

Parameters
[in]pOriginalReference to the BaseInteractable which is to be copied to create the ghost particles.

Definition at line 386 of file BaseInteractable.cc.

References BaseInteraction::copySwitchPointer(), and interactions_.

Referenced by SubcriticalMaserBoundary::createGhostCopy(), ConstantMassFlowMaserBoundary::createGhostCopy(), PeriodicBoundary::createGhostParticle(), ShearBoxBoundary::createHorizontalPeriodicParticles(), LeesEdwardsBoundary::createHorizontalPeriodicParticles(), AngledPeriodicBoundary::createPeriodicParticle(), ShearBoxBoundary::createVerticalPeriodicParticles(), and LeesEdwardsBoundary::createVerticalPeriodicParticles().

387 {
388  for (BaseInteraction* interaction : pOriginal.interactions_)
389  {
390  //So here this is the ghost and it is the interaction of the ghost/
391  interaction->copySwitchPointer(&pOriginal, this);
392  }
393 }
void copySwitchPointer(const BaseInteractable *original, BaseInteractable *ghost) const
This copies the interactions of the original particle and replaces the original with the ghost copy...
Stores information about interactions between two interactable objects; often particles but could be ...
std::vector< BaseInteraction * > interactions_
const Vec3D & BaseInteractable::getAngularVelocity ( ) const
virtual
virtual Mdouble BaseInteractable::getCurvature ( const Vec3D labFixedCoordinates) const
inlinevirtual

returns the inverse radius, or curvature, of the surface. This value is zero for walls and gets overridden for particles that have finite radius

Todo:
should be wall-type dependent

Reimplemented in BaseParticle, and SuperQuadricParticle.

Definition at line 414 of file BaseInteractable.h.

Referenced by BaseInteraction::getEffectiveRadius().

415  { return 0.0; }
const Vec3D& BaseInteractable::getForce ( ) const
inline

Returns the force on this BaseInteractable.

Return the current force being to the BaseInteractable. Note, the code works by first computing the forces of each interaction and then it loops over all BaseInteracables applying forces to them from the interactions they are involved in.

Returns
const Vec3D reference that is the total force applied to this interactable.

Definition at line 126 of file BaseInteractable.h.

References force_.

Referenced by BaseParticle::integrateAfterForceComputation(), BaseParticle::integrateBeforeForceComputation(), BaseWall::setForceControl(), and BaseWall::setVelocityControl().

127  { return force_; }
unsigned int BaseInteractable::getIndSpecies ( ) const
inline
const std::vector<BaseInteraction*>& BaseInteractable::getInteractions ( ) const
inline

Returns a list of interactions which belong to this interactable.

Returns
An list of pointers to all the interactions which this interacable is involved in.

Definition at line 277 of file BaseInteractable.h.

References interactions_.

Referenced by PeriodicBoundaryHandler::findNewInteractions(), InteractionHandler::getExistingInteraction(), LiquidFilmParticle::getFieldVTK(), InteractionHandler::getInteraction(), BaseWall::getInteractionWith(), LiquidMigrationWilletInteraction::getNumberOfContacts(), DPMBase::removeDuplicatePeriodicParticles(), LiquidMigrationWilletInteraction::rupture(), and AngledPeriodicBoundary::shiftPosition().

278  { return interactions_; }
std::vector< BaseInteraction * > interactions_
virtual BaseInteraction* BaseInteractable::getInteractionWith ( BaseParticle P,
unsigned  timeStamp,
InteractionHandler interactionHandler 
)
pure virtual

Returns the interaction between this object and a given BaseParticle.

Todo:

TW make sure this function sets normal, distance, overlap, contact point

AT why is this a BaseParticle and not a BaseInteratable.

Implemented in BaseParticle, SuperQuadricParticle, BaseWall, TriangulatedWall, RestrictedWall, ArcWall, SineWall, Combtooth, ParabolaChute, and VChute.

Referenced by PeriodicBoundaryHandler::processReceivedInteractionData(), and Domain::processReceivedInteractionData().

virtual Mdouble BaseInteractable::getInvMass ( ) const
inlinevirtual

returns the inverse mass. This value is zero for walls and gets overridden for particles that have finite mass

Reimplemented in BaseParticle.

Definition at line 408 of file BaseInteractable.h.

Referenced by BaseInteraction::getEffectiveMass().

409  { return 0.0; }
const Quaternion& BaseInteractable::getOrientation ( ) const
inline

Returns the orientation of this BaseInteractable.

Returns the reference to a Vec3D which contains the orientation of the interactionable. Please note the interpretation of this depends on which interactable. Please see derived objects for details.

Returns
Returns a reference to a Vec3D returns the position of the interactable.

Definition at line 230 of file BaseInteractable.h.

References orientation_.

Referenced by ScrewsymmetricIntersectionOfWalls::computeDeltaZ(), SuperQuadricParticle::computeHessianLabFixed(), SuperQuadricParticle::computeShape(), SuperQuadricParticle::computeShapeGradientLabFixed(), HorizontalBaseScrew::convertLimits(), AxisymmetricIntersectionOfWalls::convertLimits(), ScrewsymmetricIntersectionOfWalls::convertLimits(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), copyPositionFrom(), InfiniteWall::createVTK(), BaseWall::getAxis(), SuperQuadricParticle::getContactPointPlanB(), InfiniteWall::getDistance(), NurbsWall::getDistanceAndNormal(), Screw::getDistanceAndNormal(), HorizontalBaseScrew::getDistanceAndNormal(), BasicIntersectionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getDistanceAndNormal(), LevelSetWall::getDistanceAndNormal(), InfiniteWall::getDistanceAndNormal(), AxisymmetricIntersectionOfWalls::getDistanceAndNormal(), IntersectionOfWalls::getDistanceAndNormal(), InfiniteWall::getDistanceNormalOverlapSuperquadric(), BaseWall::getInteractionWith(), InfiniteWall::getNormal(), BasicIntersectionOfWalls::getVTK(), BasicUnionOfWalls::getVTK(), integrateAfterForceComputation(), BaseParticle::integrateAfterForceComputation(), integrateBeforeForceComputation(), BaseParticle::integrateBeforeForceComputation(), helpers::objectivenessTest(), CGFields::OrientationField::setFields(), AngledPeriodicBoundary::shiftPosition(), PeriodicBoundaryHandler::updateParticles(), TriangleWall::updateVertexAndNormal(), SuperQuadricParticle::writeDebugMessageMiddleOfLoop(), SuperQuadricParticle::writeDebugMessageStep1(), NurbsWall::writeVTK(), HorizontalBaseScrew::writeVTK(), LevelSetWall::writeVTK(), Screw::writeVTK(), AxisymmetricIntersectionOfWalls::writeVTK(), ScrewsymmetricIntersectionOfWalls::writeVTK(), and IntersectionOfWalls::writeVTK().

231  { return orientation_; }
Quaternion orientation_
const Vec3D& BaseInteractable::getPosition ( ) const
inline

Returns the position of this BaseInteractable.

Returns the reference to a Vec3D which contains the position of the interactionable. Please note the interpretation of this depends on which interactable. For particles this is the centre of the particle; where for walls it is one point of the wall given \(r.n=p\)

Returns
Returns a reference to a Vec3D returns the position of the interactable.

Definition at line 218 of file BaseInteractable.h.

References position_.

Referenced by CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), SubcriticalMaserBoundaryTEST::checkBoundaryAfterParticleMoved(), FluxBoundary::checkBoundaryAfterParticleMoved(), DeletionBoundary::checkBoundaryAfterParticleMoved(), HeaterBoundary::checkBoundaryAfterParticleMoved(), ConstantMassFlowMaserBoundary::checkBoundaryAfterParticleMoved(), DPMBase::checkParticleForInteractionLocal(), DPMBase::checkParticleForInteractionLocalPeriodic(), Chute::cleanChute(), DPMBase::computeForcesDueToWalls(), SuperQuadricParticle::computeHessianLabFixed(), DPMBase::computeInternalForce(), Mercury2D::computeInternalForces(), Mercury3D::computeInternalForces(), SuperQuadricParticle::computeShape(), SuperQuadricParticle::computeShapeGradientLabFixed(), Domain::containsParticle(), HorizontalBaseScrew::convertLimits(), AxisymmetricIntersectionOfWalls::convertLimits(), ScrewsymmetricIntersectionOfWalls::convertLimits(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), copyPositionFrom(), CircularPeriodicBoundary::createPeriodicParticle(), SubcriticalMaserBoundaryTEST::createPeriodicParticle(), InfiniteWall::createVTK(), AngledPeriodicBoundary::distance(), Domain::findNearbyBoundaries(), Domain::findNewMPIInteractions(), PeriodicBoundaryHandler::findNewParticle(), Domain::flushParticlesFromList(), BaseInteraction::gatherContactStatistics(), BaseParticle::getAngularMomentum(), SuperQuadricParticle::getContactPointPlanB(), BaseInteraction::getCP(), BaseParticle::getDisplacement2(), SphericalWall::getDistance(), InfiniteWall::getDistance(), PeriodicBoundary::getDistance(), SubcriticalMaserBoundary::getDistance(), ConstantMassFlowMaserBoundary::getDistance(), VChute::getDistanceAndNormal(), ParabolaChute::getDistanceAndNormal(), Combtooth::getDistanceAndNormal(), SineWall::getDistanceAndNormal(), CylindricalWall::getDistanceAndNormal(), HorizontalScrew::getDistanceAndNormal(), ArcWall::getDistanceAndNormal(), NurbsWall::getDistanceAndNormal(), TriangulatedWall::Face::getDistanceAndNormal(), Screw::getDistanceAndNormal(), HorizontalBaseScrew::getDistanceAndNormal(), Coil::getDistanceAndNormal(), SimpleDrumSuperquadrics::getDistanceAndNormal(), BasicIntersectionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getDistanceAndNormal(), RestrictedWall::getDistanceAndNormal(), LevelSetWall::getDistanceAndNormal(), InfiniteWallWithHole::getDistanceAndNormal(), SphericalWall::getDistanceAndNormal(), InfiniteWall::getDistanceAndNormal(), TriangleWall::getDistanceAndNormal(), ScrewsymmetricIntersectionOfWalls::getDistanceAndNormal(), AxisymmetricIntersectionOfWalls::getDistanceAndNormal(), IntersectionOfWalls::getDistanceAndNormal(), SimpleDrumSuperquadrics::getDistanceNormalOverlapSuperquadric(), InfiniteWall::getDistanceNormalOverlapSuperquadric(), ShearBoxBoundary::getHorizontalDistance(), LeesEdwardsBoundary::getHorizontalDistance(), BaseInteraction::getIC(), SuperQuadricParticle::getInitialGuessForContact(), CGCoordinates::XY::getINormal(), CGCoordinates::RZ::getINormal(), CGCoordinates::XZ::getINormal(), CGCoordinates::Y::getINormal(), CGCoordinates::YZ::getINormal(), CGCoordinates::X::getINormal(), CGCoordinates::Z::getINormal(), CGCoordinates::R::getINormal(), CGCoordinates::XYZ::getINormal(), VChute::getInteractionWith(), Combtooth::getInteractionWith(), SineWall::getInteractionWith(), ArcWall::getInteractionWith(), RestrictedWall::getInteractionWith(), TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), SuperQuadricParticle::getInteractionWith(), BaseParticle::getInteractionWith(), SuperQuadricParticle::getInteractionWithSuperQuad(), DomainHandler::getParticleDomainGlobalIndex(), CGCoordinates::XZ::getPNormal(), CGCoordinates::YZ::getPNormal(), CGCoordinates::XY::getPNormal(), CGCoordinates::Y::getPNormal(), CGCoordinates::RZ::getPNormal(), CGCoordinates::X::getPNormal(), CGCoordinates::Z::getPNormal(), CGCoordinates::R::getPNormal(), CGCoordinates::XZ::getTangentialSquared(), CGCoordinates::RZ::getTangentialSquared(), CGCoordinates::YZ::getTangentialSquared(), CGCoordinates::XY::getTangentialSquared(), CGCoordinates::XYZ::getTangentialSquared(), getVelocityAtContact(), ShearBoxBoundary::getVerticalDistance(), LeesEdwardsBoundary::getVerticalDistance(), Mercury3D::hGridFindContactsWithTargetCell(), Mercury2D::hGridFindParticleContacts(), Mercury3D::hGridFindParticleContacts(), Mercury2D::hGridGetInteractingParticleList(), Mercury3D::hGridGetInteractingParticleList(), Mercury2D::hGridHasParticleContacts(), Mercury2D::hGridUpdateParticle(), Mercury3D::hGridUpdateParticle(), BaseParticle::integrateBeforeForceComputation(), PeriodicBoundary::isClosestToLeftBoundary(), SubcriticalMaserBoundary::isClosestToRightBoundary(), ConstantMassFlowMaserBoundary::isClosestToRightBoundary(), BaseParticle::isInContactWith(), SubcriticalMaserBoundaryTEST::modifyPeriodicComplexity(), helpers::objectivenessTest(), PeriodicBoundaryHandler::processLocalGhostParticles(), Domain::processReceivedBoundaryParticleData(), PeriodicBoundaryHandler::processReceivedGhostParticleData(), FileReader::read(), CircularPeriodicBoundary::rotateParticle(), CGFields::GradVelocityField::setCylindricalFields(), CGFields::StandardFields::setCylindricalFields(), BaseInteraction::setFStatData(), IntersectionOfWalls::setPointsAndLines(), TriangleWall::setVertices(), ShearBoxBoundary::shiftHorizontalPosition(), AngledPeriodicBoundary::shiftPosition(), PeriodicBoundaryHandler::updateMaserParticle(), PeriodicBoundaryHandler::updateParticles(), PeriodicBoundaryHandler::updateParticleStatus(), TriangleWall::updateVertexAndNormal(), SuperQuadricParticle::writeDebugMessageMiddleOfLoop(), SuperQuadricParticle::writeDebugMessageStep1(), NurbsWall::writeVTK(), HorizontalBaseScrew::writeVTK(), LevelSetWall::writeVTK(), Screw::writeVTK(), AxisymmetricIntersectionOfWalls::writeVTK(), ScrewsymmetricIntersectionOfWalls::writeVTK(), and IntersectionOfWalls::writeVTK().

219  { return position_; }
const ParticleSpecies* BaseInteractable::getSpecies ( ) const
inline

Returns a pointer to the species of this BaseInteractable.

This function return a ParticleSpecies* for the current interacable. Please note, this is a ParticleSpecies; not, a BaseSpecies as interactables must have physically properties as well.

Returns
constant ParticleSpecies* pointer to the species storing the physical properties of this interactable.

Definition at line 108 of file BaseInteractable.h.

References species_.

Referenced by ThermalParticle::actionsAfterTimeStep(), ParticleHandler::addExistingObject(), ParticleHandler::addGhostObject(), WallHandler::addObject(), ParticleHandler::addObject(), IntersectionOfWalls::addObject(), SubcriticalMaserBoundary::addParticleToMaser(), ConstantMassFlowMaserBoundary::addParticleToMaser(), BaseInteraction::BaseInteraction(), SubcriticalMaserBoundary::checkBoundaryAfterParticleMoved(), ConstantMassFlowMaserBoundary::checkBoundaryAfterParticleMoved(), ChargedBondedInteraction::computeAdhesionForce(), NurbsWall::getDistanceAndNormal(), Screw::getDistanceAndNormal(), BasicIntersectionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getDistanceAndNormal(), IntersectionOfWalls::getDistanceAndNormal(), ChargedBondedInteraction::getElasticEnergy(), BaseParticle::getInfo(), BaseParticle::getInteractionDistance(), SuperQuadricParticle::getInteractionRadius(), SuperQuadricParticle::getInteractionWith(), BaseParticle::getMaxInteractionRadius(), BasicIntersectionOfWalls::getVTK(), BasicUnionOfWalls::getVTK(), SubcriticalMaserBoundary::isMaserParticle(), ConstantMassFlowMaserBoundary::isMaserParticle(), SubcriticalMaserBoundary::isNormalParticle(), ConstantMassFlowMaserBoundary::isNormalParticle(), DPMBase::readNextDataFile(), SubcriticalMaserBoundary::removeParticleFromMaser(), ConstantMassFlowMaserBoundary::removeParticleFromMaser(), RestrictedWall::set(), SuperQuadricParticle::setAxes(), LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), SuperQuadricParticle::setExponents(), SuperQuadricParticle::setInertia(), BaseParticle::setRadius(), BaseParticle::unfix(), and BaseInteraction::writeInteraction().

109  {
110  return species_;
111  }
const ParticleSpecies * species_
const Vec3D& BaseInteractable::getTorque ( ) const
inline

Returns the torque on this BaseInteractable.

Return the current torque being to the BaseInteractable. Note, the code works by first computing the forces of each interaction and then it loops over all BaseInteracables applying forces to them from the interactions they are involved in.

Returns
const Vec3D reference that is the total force applied to this interactable.

Definition at line 138 of file BaseInteractable.h.

References torque_.

Referenced by BaseParticle::integrateAfterForceComputation(), and BaseParticle::integrateBeforeForceComputation().

139  { return torque_; }
const Vec3D BaseInteractable::getVelocityAtContact ( const Vec3D contact) const
virtual

Returns the velocity at the contact point, use by many force laws.

Definition at line 375 of file BaseInteractable.cc.

References Vec3D::cross(), getAngularVelocity(), getPosition(), and getVelocity().

376 {
377  return getVelocity() - Vec3D::cross(contact - getPosition(), getAngularVelocity());
378 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:163
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
void BaseInteractable::integrateAfterForceComputation ( double  time,
double  timeStep 
)

This is part of the integration routine for objects with infinite mass.

This is the last part of time integration for interactable objects which have an infinite mass.

Parameters
[in]timedouble which is the current simulation time
[in]timeStepdouble which is the current delta time of the simulation i.e. the size of each time step.

Definition at line 611 of file BaseInteractable.cc.

References applyPrescribedAngularVelocity(), applyPrescribedVelocity(), getOrientation(), prescribedAngularVelocity_, prescribedOrientation_, prescribedPosition_, prescribedVelocity_, setAngularVelocity(), and setVelocity().

Referenced by BaseParticle::integrateAfterForceComputation(), and DPMBase::integrateAfterForceComputation().

612 {
614  {
616  {
617  applyPrescribedVelocity(time + timeStep);
618  }
619  else
620  {
621  setVelocity((prescribedPosition_(time + 1.1 * timeStep) - prescribedPosition_(time + 0.9 * timeStep)) /
622  (0.2 * timeStep));
623  }
624  }
625  else
626  {
628  {
629  applyPrescribedVelocity(time + 0.5 * timeStep);
630  }
631  }
633  {
635  {
636  applyPrescribedAngularVelocity(time + timeStep);
637  }
638  else
639  {
640  setAngularVelocity(getOrientation().applyCInverse(
641  (prescribedOrientation_(time + 1.1 * timeStep) - prescribedOrientation_(time + 0.9 * timeStep)) /
642  (0.2 * timeStep)
643  ));
644  }
645  }
646  else
647  {
649  {
650  applyPrescribedAngularVelocity(time + 0.5 * timeStep);
651  }
652  }
653 }
std::function< Vec3D(double)> prescribedAngularVelocity_
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
void applyPrescribedAngularVelocity(double time)
Computes the angular velocity from the user defined prescribed angular velocity.
std::function< Quaternion(double)> prescribedOrientation_
std::function< Vec3D(double)> prescribedPosition_
std::function< Vec3D(double)> prescribedVelocity_
void applyPrescribedVelocity(double time)
Computes the velocity from the user defined prescribed velocity function.
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
void BaseInteractable::integrateBeforeForceComputation ( double  time,
double  timeStep 
)

This is part of integrate routine for objects with infinite mass.

This does not first part of verlet integration but for objects with an infinite mass i.e. there motion is prescribed and not calculated from the applied forces. First it deals with the translation degrees of freedom and then secondly if deals with the angular degrees of freedom. Note, in both cases if the user has prescribed both positions and velocity these are used. If only only position is prescribed the velocity is computed from a finite difference. If only the velocity is prescribed the position is computed from integrating the velocity.

In the weird case they neither is set. The objects computed velocity is used to update its position.

Parameters
[in]timedouble which is the current simulation time
[in]timeStepdouble which is the current delta time of the simulation i.e. the size of each time step.

Definition at line 538 of file BaseInteractable.cc.

References applyPrescribedAngularVelocity(), applyPrescribedOrientation(), applyPrescribedPosition(), applyPrescribedVelocity(), getAngularVelocity(), getOrientation(), getVelocity(), move(), prescribedAngularVelocity_, prescribedOrientation_, prescribedPosition_, prescribedVelocity_, rotate(), setAngularVelocity(), and setVelocity().

Referenced by BaseParticle::integrateBeforeForceComputation(), and DPMBase::integrateBeforeForceComputation().

539 {
541  {
543  {
544  //Both the velocity and position are defined; as we are using leap
545  //frog method so the velocity is evaluated half a time later.
546  applyPrescribedPosition(time + timeStep);
547  applyPrescribedVelocity(time + 0.5 * timeStep);
548  }
549  else
550  {
551  //Only the position is defined.
552  //Velocity is evaluated from a finite different of the Position
553  //Note, we use 0.5 +- 0.1 timeStep for the velocity eval.
554  applyPrescribedPosition(time + timeStep);
555  setVelocity((prescribedPosition_(time + 0.6 * timeStep) - prescribedPosition_(time + 0.4 * timeStep)) /
556  (0.2 * timeStep));
557  }
558  }
559  else
560  {
562  {
563  //Only the velocity is set. The position is calculated from the
564  //the integral of velocity.
565  applyPrescribedVelocity(time + 0.5 * timeStep);
566  move(getVelocity() * timeStep);
567  }
568  else
569  {
570  //Neither is set move based on the computed velocity of the object.
571  move(getVelocity() * timeStep);
572  }
573  }
575  {
577  {
578  applyPrescribedOrientation(time + timeStep);
579  applyPrescribedAngularVelocity(time + 0.5 * timeStep);
580  }
581  else
582  {
583  applyPrescribedOrientation(time + timeStep);
584  setAngularVelocity(getOrientation().applyCInverse(
585  (prescribedOrientation_(time + 0.6 * timeStep) - prescribedOrientation_(time + 0.4 * timeStep)) /
586  (0.2 * timeStep)
587  ));
588  }
589  }
590  else
591  {
593  {
594  applyPrescribedAngularVelocity(time + 0.5 * timeStep);
595  rotate(getAngularVelocity() * timeStep);
596  }
597  else
598  {
599  rotate(getAngularVelocity() * timeStep);
600  }
601  }
602 }
std::function< Vec3D(double)> prescribedAngularVelocity_
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
void applyPrescribedPosition(double time)
Computes the position from the user defined prescribed position function.
void applyPrescribedAngularVelocity(double time)
Computes the angular velocity from the user defined prescribed angular velocity.
void applyPrescribedOrientation(double time)
Computes the orientation from the user defined prescribed orientation function.
std::function< Quaternion(double)> prescribedOrientation_
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
std::function< Vec3D(double)> prescribedPosition_
std::function< Vec3D(double)> prescribedVelocity_
virtual void rotate(const Vec3D &angularVelocityDt)
Rotates this BaseInteractable.
void applyPrescribedVelocity(double time)
Computes the velocity from the user defined prescribed velocity function.
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
virtual bool BaseInteractable::isFixed ( ) const
pure virtual

used to distinguish particles which belong to the flow and fixed particles/walls

Implemented in BaseWall, and BaseParticle.

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

Reads a BaseInteractable from an input stream.

BaseInteacatable read functions. Reads in all the information about an interacatable. Note, this can be from any istream but would normally be a file See also BaseInteractable::write

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

Implements BaseObject.

Reimplemented in BaseParticle, IntersectionOfWalls, ScrewsymmetricIntersectionOfWalls, AxisymmetricIntersectionOfWalls, InfiniteWall, TriangulatedWall, SphericalWall, InfiniteWallWithHole, SuperQuadricParticle, Screw, HorizontalScrew, TriangleWall, LevelSetWall, Coil, SimpleDrumSuperquadrics, RestrictedWall, BasicIntersectionOfWalls, BasicUnionOfWalls, HorizontalBaseScrew, ArcWall, NurbsWall, BaseWall, CylindricalWall, SineWall, Combtooth, LiquidFilmParticle, ThermalParticle, ParabolaChute, and VChute.

Definition at line 244 of file BaseInteractable.cc.

References angularVelocity_, force_, indSpecies_, orientation_, position_, BaseObject::read(), torque_, and velocity_.

Referenced by BaseWall::read(), and BaseParticle::read().

245 {
246  BaseObject::read(is);
247  std::string dummy;
248  is >> dummy >> indSpecies_;
249  is >> dummy >> position_;
250  is >> dummy;
251  //this if-statement is added to read Kasper van der Vaart's data files, which contain an additional variable named positionAbsolute
252  if (dummy == "positionAbsolute")
253  {
254  is >> dummy >> dummy >> dummy >> dummy;
255  }
256  is >> orientation_;
257  is >> dummy >> velocity_;
258  is >> dummy >> angularVelocity_;
259  is >> dummy;
260  if (dummy == "0")
261  is >> dummy;
262  is >> force_;
263  is >> dummy >> torque_;
264 }
unsigned int indSpecies_
Quaternion orientation_
virtual void read(std::istream &is)=0
Definition: BaseObject.cc:81
bool BaseInteractable::removeInteraction ( BaseInteraction I)

Removes an interaction from this BaseInteractable.

Removes a given interaction form the list of interactions belonging to the current interacable. This functions returns true to the interaction was found and returns false if the given interaction did not exist and the interaction was not removed. Note that this cannot be done with a range-based for, since we need the iterator to erase the interaction.

Parameters
[in]IBaseInteraction pointer which is the interaction to be removed.
Returns
bool True if the interaction was found and removed; false if the interaction did not exist for that interactable.

Definition at line 308 of file BaseInteractable.cc.

References interactions_, logger, and WARN.

Referenced by BaseInteraction::importI(), BaseInteraction::importP(), BaseInteraction::setI(), BaseInteraction::setP(), and BaseInteraction::~BaseInteraction().

309 {
310  for (std::vector<BaseInteraction*>::iterator it = interactions_.begin(); it != interactions_.end(); ++it)
311  {
312  if (I == (*it))
313  {
314  interactions_.erase(it);
315  return true;
316  }
317  }
318  logger(WARN, "Error in BaseInteractable::removeInteraction: Interaction could not be removed");
319  return false;
320 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
std::vector< BaseInteraction * > interactions_
void BaseInteractable::resetForceTorque ( int  numberOfOMPthreads)

Definition at line 141 of file BaseInteractable.cc.

References force_, forceOMP_, Vec3D::setZero(), torque_, and torqueOMP_.

Referenced by DPMBase::computeAllForces().

142 {
143  #ifdef MERCURY_USE_OMP
144  forceOMP_.resize(numberOfOMPthreads-1);
145  torqueOMP_.resize(numberOfOMPthreads-1);
146  for (auto& force : forceOMP_)
147  {
148  force.setZero();
149  }
150 
151  for (auto& torque : torqueOMP_)
152  {
153  torque.setZero();
154  }
155  #endif
156 
157  force_.setZero();
158  torque_.setZero();
159 }
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
std::vector< Vec3D > torqueOMP_
std::vector< Vec3D > forceOMP_
void BaseInteractable::rotate ( const Vec3D angularVelocityDt)
virtual

Rotates this BaseInteractable.

Rotates the interacable a given solid angle. Note, this just updates the orientation by the angle.

This function has been declared virtual, so it can be overridden for IntersectionOfWalls.

Parameters
[in]angularVelocityDtReference to Vec3D which is the solid angle through which the interactable is rotated.
Todo:
TW the move and rotate functions should only pass the time step, as teh velocity can be accessed directly by the object; this would simplify functions like Screw::rotate

Reimplemented in TriangleWall, and Screw.

Definition at line 230 of file BaseInteractable.cc.

References orientation_, and Quaternion::updateAngularDisplacement().

Referenced by integrateBeforeForceComputation(), BaseParticle::integrateBeforeForceComputation(), Screw::rotate(), TriangleWall::rotate(), and AngledPeriodicBoundary::shiftPosition().

231 {
232  //if (!angularVelocityDt.isZero()) {
233  orientation_.updateAngularDisplacement(angularVelocityDt);
234  //}
235 }
Quaternion orientation_
void updateAngularDisplacement(Vec3D angularVelocityDt)
Definition: Quaternion.cc:431
void BaseInteractable::setForce ( const Vec3D force)
inline

Sets the force on this BaseInteractable.

This sets the force being applied to this interactable. Note, first the code computes all forces in the interactions and then loops over all interactable objects applying the forces from the interactions to the interactables involved in the interaction.

Parameters
[in]forceVec3D which is the force to be applied.

Definition at line 149 of file BaseInteractable.h.

References force_.

150  { force_ = force; }
virtual void BaseInteractable::setIndSpecies ( unsigned int  indSpecies)
inlinevirtual

Sets the index of the Species of this BaseInteractable.

This set the species associated with this interactable. This function should not be used and BaseInteractable::setSpecies should be used instead. See also BaseInteractable::setSpecies

Reimplemented in BaseParticle, and BaseWall.

Definition at line 98 of file BaseInteractable.h.

References indSpecies_.

Referenced by BaseParticle::oldRead(), BaseWall::setIndSpecies(), and BaseParticle::setIndSpecies().

99  { indSpecies_ = indSpecies; }
unsigned int indSpecies_
void BaseInteractable::setOrientation ( const Quaternion orientation)
inline
void BaseInteractable::setOrientationViaEuler ( Vec3D  eulerAngle)

Sets the orientation of this BaseInteractable by defining the euler angles.

Definition at line 204 of file BaseInteractable.cc.

References orientation_, and Quaternion::setEuler().

Referenced by DPMBase::readNextDataFile().

205 {
206  orientation_.setEuler(eulerAngle);
207 }
void setEuler(const Vec3D &e)
Convert Euler angles to a quaternion. See Wikipedia for details.
Definition: Quaternion.cc:473
Quaternion orientation_
void BaseInteractable::setOrientationViaNormal ( Vec3D  normal)

Sets the orientation of this BaseInteractable by defining the vector that results from the rotation of the (1,0,0) vector.

Sets the orientation of the interactable. interpretation depends on which interactable is being considered See also BaseInteractable::getOrientation.

Parameters
[in]orientationReference to Vec3D storing the orientation of the particle.

Definition at line 199 of file BaseInteractable.cc.

References orientation_, and Quaternion::setOrientationViaNormal().

Referenced by AxisymmetricIntersectionOfWalls::AxisymmetricIntersectionOfWalls(), HorizontalBaseScrew::HorizontalBaseScrew(), Screw::Screw(), ScrewsymmetricIntersectionOfWalls::ScrewsymmetricIntersectionOfWalls(), HorizontalBaseScrew::setAxis(), SimpleDrumSuperquadrics::setAxis(), AxisymmetricIntersectionOfWalls::setAxis(), ScrewsymmetricIntersectionOfWalls::setAxis(), and InfiniteWall::setNormal().

200 {
202 }
Quaternion orientation_
void setOrientationViaNormal(Vec3D normal)
Used to the the normal of an InfiniteWall that has a normal into the x-direction by default...
Definition: Quaternion.cc:536
void BaseInteractable::setPosition ( const Vec3D position)
inline

Sets the position of this BaseInteractable.

Interpretation depends on which interactable is being considered See also BaseInteractable::getPosistion.

Parameters
[in]positionReference to Vec3D storing the position of the particle.

Definition at line 239 of file BaseInteractable.h.

References position_.

Referenced by IntersectionOfWalls::addObject(), BaseWall::addParticlesAtWall(), applyPrescribedPosition(), AxisymmetricIntersectionOfWalls::AxisymmetricIntersectionOfWalls(), DropletBoundary::checkBoundaryAfterParticlesMove(), DPMBase::checkParticleForInteractionLocalPeriodic(), BaseCluster::computeInternalStructure(), MPISphericalParticle::copyDataFromMPIParticleToParticle(), Chute::createBottom(), Chute::createFlowParticle(), PeriodicBoundaryHandler::findTargetProcessor(), BidisperseCubeInsertionBoundary::generateParticle(), SuperQuadricParticle::getContactPointPlanB(), BasicIntersectionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getDistanceAndNormal(), BasicUnionOfWalls::getVTK(), BasicIntersectionOfWalls::getVTK(), HorizontalBaseScrew::HorizontalBaseScrew(), InfiniteWall::InfiniteWall(), helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), InfiniteWall::oldRead(), BaseParticle::oldRead(), BaseCluster::particleInsertionSuccessful(), ChuteInsertionBoundary::placeParticle(), FixedClusterInsertionBoundary::placeParticle(), HopperInsertionBoundary::placeParticle(), RandomClusterInsertionBoundary::placeParticle(), CubeInsertionBoundary::placeParticle(), PolydisperseInsertionBoundary::placeParticle(), FileReader::read(), DPMBase::readNextDataFile(), CircularPeriodicBoundary::rotateParticle(), ScrewsymmetricIntersectionOfWalls::ScrewsymmetricIntersectionOfWalls(), InfiniteWall::set(), ChuteBottom::setupInitialConditions(), TriangleWall::setVertices(), and PeriodicBoundaryHandler::updateParticles().

240  { position_ = position; }
void BaseInteractable::setPrescribedAngularVelocity ( const std::function< Vec3D(double)> &  prescribedAngularVelocity)

Allows the angular velocity of the infinite mass interactable to be prescribed.

Definition at line 501 of file BaseInteractable.cc.

References prescribedAngularVelocity_.

502 {
503  prescribedAngularVelocity_ = prescribedAngularVelocity;
504 }
std::function< Vec3D(double)> prescribedAngularVelocity_
void BaseInteractable::setPrescribedOrientation ( const std::function< Quaternion(double)> &  prescribedOrientation)

Allows the orientation of the infinite mass interactbale to be prescribed.

This is similar to the BaseInteractable::setPrescribedPosition and works the same way. See BaseInteractable::setPrescibedPosition and BaseInteractable::setPrescribedVelocity for more details how it works. Note, the rate of change of the orientation can also be set using the function BaseInteractable::setPrescribedAngularVelocity.

Parameters
[in]prescribedOrientationstd::function which is the lambda function and takes a double the time and returns a Vec 3D which is the orientation of the interactable for that time.

Definition at line 474 of file BaseInteractable.cc.

References prescribedOrientation_.

475 {
476  prescribedOrientation_ = prescribedOrientation;
477 }
std::function< Quaternion(double)> prescribedOrientation_
void BaseInteractable::setPrescribedPosition ( const std::function< Vec3D(double)> &  prescribedPosition)

Allows the position of an infinite mass interactable to be prescribed.

This functions is used to give an interactable a prescribed motion, which is defined by a std::function. This is the new moving walls interface. A demo of the use would be: setPrescribedPosition([this] (double time) { return Vec3D(getXMin(),0.0,shaker_amp * std::sin(t * 2.0 * shaker_freq * constants::pi)); } ); This example moves the wall sinusoidally with time.

Parameters
[in]prescribedPositionstd::function which is the lambda function and takes a double the time and returns a Vec 3D which is the position of the interactable for that time. See also BaseInteractable::setPrescribedVelocity for more information.

Definition at line 413 of file BaseInteractable.cc.

References prescribedPosition_.

414 {
415  prescribedPosition_ = prescribedPosition;
416 }
std::function< Vec3D(double)> prescribedPosition_
void BaseInteractable::setPrescribedVelocity ( const std::function< Vec3D(double)> &  prescribedVelocity)

Allows the velocity of an infinite mass interactable to be prescribed.

In a similar manner to BaseInteractable::setPrescribedPosition this sets the velocity of the BaseInteactable. See also BaseInteractable::setPrescribedPosition Note, it is valid to set both the velocity and the position. No checking if these are consist is done at all. If you only set one of these function the other is automatically calculated using a by numerically differentiating or integrating the functions will is prescribed.

Parameters
[in]prescribedVelocitystd::function which is the lambda function and takes a double the time and returns a Vec 3D which is the velocity of the intertable for that time.

Definition at line 444 of file BaseInteractable.cc.

References prescribedVelocity_.

Referenced by BaseWall::setForceControl(), and BaseWall::setVelocityControl().

445 {
446  prescribedVelocity_ = prescribedVelocity;
447 }
std::function< Vec3D(double)> prescribedVelocity_
void BaseInteractable::setSpecies ( const ParticleSpecies species)

Sets the species of this BaseInteractable.

This function sets the species associated with this interactable object. Again this must be a ParticleSpecies. Note, it also automatically sets the index on the indSpecies_ by working up the correct index. However, index should be carefully used

Parameters
[in]speciesParticleSpcies pointer which is species holding the physical properties.

Definition at line 185 of file BaseInteractable.cc.

References BaseSpecies::getHandler(), BaseObject::getIndex(), BaseHandler< T >::getObject(), indSpecies_, logger, and species_.

Referenced by BaseWall::setSpecies(), and BaseParticle::setSpecies().

186 {
187  logger.assert(species->getHandler() != nullptr && species->getHandler()->getObject(species->getIndex())==species, "Error: Species is not part of any handler yet");
188  species_ = species;
189  indSpecies_ = species->getIndex();
190 }
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
unsigned int indSpecies_
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
const ParticleSpecies * species_
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
void BaseInteractable::setTorque ( const Vec3D torque)
inline

Sets the torque on this BaseInteractable.

This sets the torque being applied to this interactable. Note, first the code computes all force/torques in the interactions and then loops over all interactable objects applying the torques from the interactions to the interactables involved in the interaction.

Parameters
[in]torqueVec3D which is the force to be applied.

Definition at line 161 of file BaseInteractable.h.

References torque_.

162  { torque_ = torque; }
void BaseInteractable::setVelocity ( const Vec3D velocity)
void BaseInteractable::sumForceTorqueOMP ( )

Definition at line 162 of file BaseInteractable.cc.

References force_, forceOMP_, torque_, and torqueOMP_.

Referenced by DPMBase::computeAllForces().

163 {
164  #ifdef MERCURY_USE_OMP
165  for (const auto force : forceOMP_)
166  {
167  force_ += force;
168  }
169 
170  for (const auto torque : torqueOMP_)
171  {
172  torque_ += torque;
173  }
174  #endif
175 }
std::vector< Vec3D > torqueOMP_
std::vector< Vec3D > forceOMP_
void BaseInteractable::write ( std::ostream &  os) const
overridevirtual

Write a BaseInteractable to an output stream.

Parameters
[in]osThe output stream to which the BaseInteractable is written.

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

Parameters
[in]osstd::ostream to which the information is written. Note, is any ostream is can be file or screen.
Todo:
take the zero out

Implements BaseObject.

Reimplemented in BaseParticle, IntersectionOfWalls, ScrewsymmetricIntersectionOfWalls, AxisymmetricIntersectionOfWalls, TriangulatedWall, InfiniteWallWithHole, SphericalWall, Screw, Coil, HorizontalScrew, RestrictedWall, TriangleWall, BasicIntersectionOfWalls, BasicUnionOfWalls, SimpleDrumSuperquadrics, SuperQuadricParticle, HorizontalBaseScrew, CylindricalWall, NurbsWall, ArcWall, BaseWall, SineWall, Combtooth, ParabolaChute, LiquidFilmParticle, ThermalParticle, and VChute.

Definition at line 274 of file BaseInteractable.cc.

References angularVelocity_, force_, indSpecies_, orientation_, position_, torque_, velocity_, and BaseObject::write().

Referenced by BaseWall::write(), and BaseParticle::write().

275 {
276  BaseObject::write(os);
277  os << " indSpecies " << indSpecies_
278  << " position " << position_
279  << " orientation " << orientation_
280  //<< " axis " << orientation_.getAxis()
281  << " velocity " << velocity_
282  << " angularVelocity " << angularVelocity_
283  << " force " << force_
284  << " torque " << torque_;
285 }
unsigned int indSpecies_
Quaternion orientation_
virtual void write(std::ostream &os) const =0
A purely virtual function which has an implementation which writes the name and the object id_ to the...
Definition: BaseObject.cc:91

Member Data Documentation

Vec3D BaseInteractable::angularVelocity_
private

Store the angular velocity of the interactable.

Definition at line 457 of file BaseInteractable.h.

Referenced by addAngularVelocity(), BaseInteractable(), getAngularVelocity(), read(), setAngularVelocity(), and write().

Vec3D BaseInteractable::force_
private

Stores the force applied to the interactable.

Definition at line 462 of file BaseInteractable.h.

Referenced by addForce(), BaseInteractable(), getForce(), read(), resetForceTorque(), setForce(), sumForceTorqueOMP(), and write().

std::vector<Vec3D> BaseInteractable::forceOMP_
private

Definition at line 479 of file BaseInteractable.h.

Referenced by addForce(), resetForceTorque(), and sumForceTorqueOMP().

unsigned int BaseInteractable::indSpecies_
private

Stores the index on the species associated with this interactable.

Definition at line 495 of file BaseInteractable.h.

Referenced by BaseInteractable(), getIndSpecies(), read(), setIndSpecies(), setSpecies(), and write().

std::vector<BaseInteraction*> BaseInteractable::interactions_
private

List of interactions this interactable is involved with.

Definition at line 505 of file BaseInteractable.h.

Referenced by addInteraction(), BaseInteractable(), copyInteractionsForPeriodicParticles(), getInteractions(), removeInteraction(), and ~BaseInteractable().

Quaternion BaseInteractable::orientation_
private

Stores the orientation of the interactable. Exactly what is stored depends on the type of interatable

Definition at line 452 of file BaseInteractable.h.

Referenced by BaseInteractable(), getOrientation(), read(), rotate(), setOrientation(), setOrientationViaEuler(), setOrientationViaNormal(), and write().

Vec3D BaseInteractable::position_
private

Stores the position of the interactable. Exactly what is stored depends on the type of interactable.

Definition at line 446 of file BaseInteractable.h.

Referenced by BaseInteractable(), getPosition(), move(), read(), setPosition(), and write().

std::function<Vec3D(double)> BaseInteractable::prescribedAngularVelocity_
private

User defined functions which if set describes the angular velocity of the interactable.

Definition at line 440 of file BaseInteractable.h.

Referenced by applyPrescribedAngularVelocity(), BaseInteractable(), integrateAfterForceComputation(), integrateBeforeForceComputation(), and setPrescribedAngularVelocity().

std::function<Quaternion(double)> BaseInteractable::prescribedOrientation_
private

User defined function which if set describes the orientation of the interactable

Definition at line 434 of file BaseInteractable.h.

Referenced by applyPrescribedOrientation(), BaseInteractable(), integrateAfterForceComputation(), integrateBeforeForceComputation(), and setPrescribedOrientation().

std::function<Vec3D(double)> BaseInteractable::prescribedPosition_
private

User defined function which if set describes the position of the interactable

Definition at line 422 of file BaseInteractable.h.

Referenced by applyPrescribedPosition(), BaseInteractable(), integrateAfterForceComputation(), integrateBeforeForceComputation(), and setPrescribedPosition().

std::function<Vec3D(double)> BaseInteractable::prescribedVelocity_
private

User defined function which if set describes the velocity of the interactable.

Definition at line 428 of file BaseInteractable.h.

Referenced by applyPrescribedVelocity(), BaseInteractable(), integrateAfterForceComputation(), integrateBeforeForceComputation(), and setPrescribedVelocity().

const ParticleSpecies* BaseInteractable::species_
private

Point to the ParticlesSpecies which stores density and other material properties of the interactable.

Definition at line 490 of file BaseInteractable.h.

Referenced by BaseInteractable(), getSpecies(), and setSpecies().

Vec3D BaseInteractable::torque_
private

Stores the torque applied to the interactable.

Definition at line 467 of file BaseInteractable.h.

Referenced by addTorque(), BaseInteractable(), getTorque(), read(), resetForceTorque(), setTorque(), sumForceTorqueOMP(), and write().

std::vector<Vec3D> BaseInteractable::torqueOMP_
private
Vec3D BaseInteractable::velocity_
private

Stores the velocity of this interactable.

Definition at line 500 of file BaseInteractable.h.

Referenced by addVelocity(), BaseInteractable(), getVelocity(), read(), setVelocity(), and write().


The documentation for this class was generated from the following files: