revision: v0.14
BaseWall Class Referenceabstract

Basic class for walls. More...

#include <BaseWall.h>

+ Inheritance diagram for BaseWall:

Public Member Functions

 BaseWall ()
 Default constructor. More...
 
 BaseWall (const BaseWall &w)
 Copy constructor. More...
 
 ~BaseWall () override
 Default destructor. More...
 
virtual BaseWallcopy () const =0
 Pure virtual function that can be overwritten in inherited classes in order to copy a BaseWall. More...
 
void read (std::istream &is) override
 Function that reads a BaseWall from an input stream, usually a restart file. More...
 
void write (std::ostream &os) const override
 Function that writes a BaseWall to an output stream, usually a restart file. More...
 
virtual bool getDistanceAndNormal (const BaseParticle &P, Mdouble &distance, Vec3D &normal_return) const =0
 Pure virtual function that computes the distance of a BaseParticle to this wall and returns the normal of this wall if there is a collision. More...
 
virtual bool getDistanceNormalOverlap (const BaseParticle &P, Mdouble &distance, Vec3D &normal_return, Mdouble &overlap) const
 
virtual bool getDistanceNormalOverlapSuperquadric (const SuperQuadricParticle &p, Mdouble &distance, Vec3D &normal_return, Mdouble &overlap) const
 
virtual Vec3D getFurthestPointSuperQuadric (const Vec3D &normalBodyFixed, const Vec3D &axes, Mdouble eps1, Mdouble eps2) const
 
virtual void setHandler (WallHandler *handler)
 A function which sets the WallHandler for this BaseWall. More...
 
WallHandlergetHandler () const
 A function which returns the WallHandler that handles this BaseWall. More...
 
void setIndSpecies (unsigned int indSpecies) override
 Define the species of this wall using the index of the species in the SpeciesHandler in this DPMBase. More...
 
void setSpecies (const ParticleSpecies *species)
 Defines the species of the current wall. More...
 
bool isFixed () const override
 
void setForceControl (Vec3D forceGoal, Vec3D gainFactor, Vec3D baseVelocity={0, 0, 0})
 Slowly adjusts the force on a wall towards a specified goal, by adjusting (prescribing) the velocity of the wall. More...
 
virtual bool isLocal (Vec3D &min, Vec3D &max) const
 
bool getLinePlaneIntersect (Vec3D &intersect, const Vec3D &p0, const Vec3D &p1, const Vec3D &n, const Vec3D &p)
 
bool isInsideWallVTK (const Vec3D &point, const Vec3D &normal, const Vec3D &position) const
 
void projectOntoWallVTK (Vec3D &point0, const Vec3D &point1, const Vec3D &normal, const Vec3D &position) const
 
void intersectVTK (std::vector< Vec3D > &points, Vec3D normal, Vec3D position) const
 
virtual BaseInteractiongetInteractionWithSuperQuad (SuperQuadricParticle *p, unsigned timeStamp, InteractionHandler *interactionHandler)
 
virtual void writeVTK (VTKContainer &vtk) const
 
void getVTK (std::vector< Vec3D > &points, std::vector< std::vector< double >> &triangleStrips)
 
const Vec3D getAxis () const
 
BaseInteractiongetInteractionWith (BaseParticle *p, unsigned timeStamp, InteractionHandler *interactionHandler) override
 Returns the interaction between this wall and a given particle, nullptr if there is no interaction. More...
 
virtual void actionsOnRestart ()
 No implementation but can be overidden in its derived classes. More...
 
virtual void actionsAfterParticleGhostUpdate ()
 No implementation but can be overidden in its derived classes. More...
 
virtual void handleParticleAddition (unsigned int id, BaseParticle *p)
 Handles the addition of particles to the particleHandler. More...
 
virtual void handleParticleRemoval (unsigned int id)
 Handles the addition of particles to the particleHandler. More...
 
virtual void checkInteractions (InteractionHandler *interactionHandler, unsigned int timeStamp)
 Check if all interactions are valid. More...
 
bool getVTKVisibility () const
 
void setVTKVisibility (bool vtkVisibility)
 
void addRenderedWall (BaseWall *w)
 
BaseWallgetRenderedWall (size_t i) const
 
void removeRenderedWalls ()
 
void renderWall (VTKContainer &vtk)
 
void addParticlesAtWall (unsigned numElements=50)
 
void setVelocityControl (Vec3D forceGoal, Vec3D gainFactor, Vec3D baseVelocity)
 
- Public Member Functions inherited from BaseInteractable
 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...
 
unsigned int getIndSpecies () const
 Returns the index of the species associated with the interactable object. 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 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 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
 

Static Public Member Functions

static void addToVTK (const std::vector< Vec3D > &points, VTKContainer &vtk)
 Takes the points provided and adds a triangle strip connecting these points to the vtk container. More...
 

Private Attributes

WallHandlerhandler_
 
bool vtkVisibility_ = true
 
std::vector< BaseWall * > renderedWalls_
 

Detailed Description

Basic class for walls.

Class from which all walls inherit. Please note the getVelocity can for some walls be dependent on which point on the wall is meant.

Constructor & Destructor Documentation

◆ BaseWall() [1/2]

BaseWall::BaseWall ( )

Default constructor.

Default constructor for the BaseWall class. Simply creates an empty BaseWall. Note that it also, by default, sets the handler to a null pointer - i.e. does not automatically assign the current object a given WallHandler.

37 {
38  handler_ = nullptr;
39  logger(DEBUG, "BaseWall::BaseWall() finished");
40 }

References FATAL, handler_, and logger.

◆ BaseWall() [2/2]

BaseWall::BaseWall ( const BaseWall w)

Copy constructor.

An existing wall (i.e. a BaseWall type object), w, is passed as an argument. A copy of this object is then created. The BaseWall class is relatively low-level, and this copy constructor simply acts to provide a pointer to the WallHandler belonging to w, i.e. assigning the new wall to the same handler as the original. (A derived class' copy constructor calls this, but does all of the other work.)

Parameters
[in]w- The existing BaseWall object to be copied.
51  : BaseInteractable(w)
52 {
53  //sets the current handler to that belonging to the existing wall, w
54  handler_ = w.handler_;
55  renderedWalls_.reserve(w.renderedWalls_.capacity());
57  for (auto* const r : w.renderedWalls_)
58  renderedWalls_.push_back(r->copy());
59  logger(DEBUG, "BaseWall::BaseWall(const BaseWall &p) finished");
60 }

References FATAL, handler_, logger, renderedWalls_, and vtkVisibility_.

◆ ~BaseWall()

BaseWall::~BaseWall ( )
override

Default destructor.

Note that this is a virtual destructor, ensuring that derived classes can be deleted easily and safely.

67 {
68  logger(DEBUG, "BaseWall::~BaseWall() finished");
69  for (auto* const r : renderedWalls_)
70  delete r;
71  renderedWalls_.clear();
72 }

References FATAL, logger, and renderedWalls_.

Member Function Documentation

◆ actionsAfterParticleGhostUpdate()

virtual void BaseWall::actionsAfterParticleGhostUpdate ( )
inlinevirtual

No implementation but can be overidden in its derived classes.

This function is called by WallHandler::actionsAfterParticleGhostUpdate, which is called by DPMBase::computeOneTimeStep directly after the ghost particle update. It may be used to adjust wall properties based on the changed wall positions (for an example, look e.g. at MeshTriangle).

Reimplemented in MeshTriangle.

192 {}

◆ actionsOnRestart()

virtual void BaseWall::actionsOnRestart ( )
inlinevirtual

No implementation but can be overidden in its derived classes.

This function is called by DPMBase::solve, if the simulation is restarted.

Reimplemented in MeshTriangle.

183 {}

◆ addParticlesAtWall()

void BaseWall::addParticlesAtWall ( unsigned  numElements = 50)
599 {
600  auto& speciesHandler = getHandler()->getDPMBase()->speciesHandler;
601  logger.assert_always(speciesHandler.getSize()>0,"addParticlesAtWall: You need to define at least one species");
602 
603  Vec3D max = getHandler()->getDPMBase()->getMax();
604  Vec3D min = getHandler()->getDPMBase()->getMin();
605  double h = Vec3D::min(max-min)/numElements;
606  double r = 0.5*h;
607 
608  auto& particleHandler = getHandler()->getDPMBase()->particleHandler;
609  double numParticles0 = particleHandler.getSize();
611  p.setSpecies(speciesHandler.getObject(0));
612  Vec3D pos;
613  for (pos.X = min.X; pos.X <= max.X; pos.X += h)
614  for (pos.Y = min.Y; pos.Y <= max.Y; pos.Y += h)
615  for (pos.Z = min.Z; pos.Z <= max.Z; pos.Z += h)
616  {
617  Vec3D normal;
618  Mdouble distance;
619  p.setRadius(2.0*r);
620  p.setPosition(pos);
621  //if touching the wall
622  if (getDistanceAndNormal(p, distance, normal) && distance>=0)
623  {
624  p.setRadius(r);
625  p.setPosition(pos+(distance-r)*normal);
626  particleHandler.copyAndAddObject(p);
627  }
628  }
629  logger(INFO,"Inserted % particles that touch wall %", particleHandler.getNumberOfObjects()-numParticles0, getIndex());
630 }

References getDistanceAndNormal(), BaseHandler< T >::getDPMBase(), getHandler(), BaseObject::getIndex(), DPMBase::getMax(), DPMBase::getMin(), BaseHandler< T >::getSize(), INFO, logger, Vec3D::min(), DPMBase::particleHandler, BaseInteractable::setPosition(), BaseParticle::setRadius(), BaseParticle::setSpecies(), DPMBase::speciesHandler, Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by AxisymmetricWallSelfTest::setupInitialConditions().

◆ addRenderedWall()

void BaseWall::addRenderedWall ( BaseWall w)
555 {
556  renderedWalls_.push_back(w);
557 }

References renderedWalls_.

◆ addToVTK()

void BaseWall::addToVTK ( const std::vector< Vec3D > &  points,
VTKContainer vtk 
)
static

Takes the points provided and adds a triangle strip connecting these points to the vtk container.

472 {
473  if (!points.empty())
474  {
475  //all all values in myPoints to points
476  vtk.points.insert(vtk.points.end(), points.begin(), points.end());
477 
478  // create one cell object containing all indices of the added points (created a triangle strip connecting these points)
479  std::vector<double> cell;
480  cell.reserve(vtk.points.size() + 1);
481  cell.push_back(vtk.points.size() - 1);
482  for (unsigned i = vtk.points.size() - points.size(); i < vtk.points.size(); i++)
483  {
484  cell.push_back((double) i);
485  }
486 
487  //add this triangle strip to the vtk file
488  vtk.triangleStrips.push_back(cell);
489  }
490 }

References constants::i, VTKContainer::points, and VTKContainer::triangleStrips.

Referenced by LevelSetWall::createVTK(), and InfiniteWall::writeVTK().

◆ checkInteractions()

virtual void BaseWall::checkInteractions ( InteractionHandler interactionHandler,
unsigned int  timeStamp 
)
inlinevirtual

Check if all interactions are valid.

This function is called by DPMBase::computeAllForces. It may be used by a wall to check and modify interactions previously created during contact detection.

Reimplemented in MeshTriangle.

219 {}

Referenced by DPMBase::computeAllForces().

◆ copy()

◆ getAxis()

const Vec3D BaseWall::getAxis ( ) const

This functions returns a axis for a wall using it Quaternion descriptions. At the moment Quaternion are not implemented for a wall; so this is currently a workaround for the non-implementation Quaternion for the walls. In the future this functions will be replaced.

Returns
A Vec3D which is the axis of the wall
504 {
506  Vec3D axis;
507  axis.X = Q.q1;
508  axis.Y = Q.q2;
509  axis.Z = Q.q3;
510  return axis;
511 }

References BaseInteractable::getOrientation(), Quaternion::q1, Quaternion::q2, Quaternion::q3, Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by ScrewsymmetricIntersectionOfWalls::computeDeltaZ().

◆ getDistanceAndNormal()

virtual bool BaseWall::getDistanceAndNormal ( const BaseParticle P,
Mdouble distance,
Vec3D normal_return 
) const
pure virtual

Pure virtual function that computes the distance of a BaseParticle to this wall and returns the normal of this wall if there is a collision.

Beware, the distance and normal are output parameters, not return values!

Parameters
[in]PReference to the BaseParticle we want to compute the distance to the BaseWall of.
[out]distanceDistance of the BaseParticle to the BaseWall.
[out]normal_returnThe normal of the wall. Is only given if there is a collision.
Returns
A boolean which indicates if there is a collision between the BaseParticle and the wall.

Implemented in VChute, TriangulatedWall, TriangleWall, SphericalWall, SineWall, SimpleDrumSuperquadrics, RestrictedWall, ParabolaChute, MeshTriangle, LevelSetWall, IntersectionOfWalls, InfiniteWallWithHole, InfiniteWall, CylindricalWall, Combtooth, Coil, BasicUnionOfWalls, BasicIntersectionOfWalls, ScrewsymmetricIntersectionOfWalls, Screw, NurbsWall, HorizontalScrew, HorizontalBaseScrew, AxisymmetricIntersectionOfWalls, and ArcWall.

Referenced by addParticlesAtWall(), ChuteWithContraction::ChuteWithContraction(), ChuteWithPeriodicInflowAndContraction::ChuteWithPeriodicInflowAndContraction(), ContractionWithPeriodicInflow::ContractionWithPeriodicInflow(), Domain::findNewMPIInteractions(), RestrictedWall::getDistanceAndNormal(), and getDistanceNormalOverlap().

◆ getDistanceNormalOverlap()

bool BaseWall::getDistanceNormalOverlap ( const BaseParticle P,
Mdouble distance,
Vec3D normal_return,
Mdouble overlap 
) const
virtual
525 {
526  if (P.isSphericalParticle())
527  {
528  bool isInContact = getDistanceAndNormal(P, distance, normal_return);
529  overlap = P.getRadius() - distance;
530  return isInContact;
531  }
532  else
533  {
534  auto superQuadric = dynamic_cast<const SuperQuadricParticle*>(&P);
535  return getDistanceNormalOverlapSuperquadric(*superQuadric, distance, normal_return, overlap);
536  }
537 }

References getDistanceAndNormal(), getDistanceNormalOverlapSuperquadric(), BaseParticle::getRadius(), and BaseParticle::isSphericalParticle().

Referenced by DropletBoundary::checkBoundaryAfterParticlesMove(), and getInteractionWith().

◆ getDistanceNormalOverlapSuperquadric()

bool BaseWall::getDistanceNormalOverlapSuperquadric ( const SuperQuadricParticle p,
Mdouble distance,
Vec3D normal_return,
Mdouble overlap 
) const
virtual

Reimplemented in SimpleDrumSuperquadrics, and InfiniteWall.

542 {
543  logger(ERROR, "Generic wall-superquadric interactions not implemented yet.");
544  return false;
545 }

References ERROR, and logger.

Referenced by getDistanceNormalOverlap().

◆ getFurthestPointSuperQuadric()

Vec3D BaseWall::getFurthestPointSuperQuadric ( const Vec3D normalBodyFixed,
const Vec3D axes,
Mdouble  eps1,
Mdouble  eps2 
) const
virtual

Reimplemented in SimpleDrumSuperquadrics, and InfiniteWall.

548 {
549  logger(ERROR, "Generic wall-superquadric interactions not implemented yet.");
550  return {};
551 }

References ERROR, and logger.

Referenced by getInteractionWith().

◆ getHandler()

◆ getInteractionWith()

BaseInteraction * BaseWall::getInteractionWith ( BaseParticle p,
unsigned  timeStamp,
InteractionHandler interactionHandler 
)
overridevirtual

Returns the interaction between this wall and a given particle, nullptr if there is no interaction.

Parameters
[in]pPointer to the BaseParticle which we want to check the interaction for.
[in]timeStampThe time at which we want to look at the interaction.
[in]interactionHandlerA pointer to the InteractionHandler in which the interaction can be found.
Returns
A pointer to the BaseInteraction that happened between this BaseWall and the BaseParticle at the timeStamp.
Todo:

Implements BaseInteractable.

Reimplemented in VChute, TriangulatedWall, SineWall, RestrictedWall, ParabolaChute, MeshTriangle, and Combtooth.

370 {
371  Mdouble distance;
372  Vec3D normal;
373  Mdouble overlap;
374 
375  if (getDistanceNormalOverlap(*p, distance, normal, overlap))
376  {
377  // look for an existing interaction, or create a new one
378  BaseInteraction *c = nullptr;
379  // This if-statement deals with groups of walls. If a particle has multiple contacts with a group of walls, and if the contact areas of these contacts overlap, then we keep only the biggest of the overlapping contacts.
380  if (getGroupId() > 0 && p->getInteractions().size() > 0) {
381  // if there is a contact with a group of walls, and if p had at least one previously detected contact (in the last timestep or the current)
382  for (const auto i : p->getInteractions()) {
383  if (i->getI() == (BaseInteractable *) this) {
384  // if there is an existing interaction with this wall, keep it
385  i->setTimeStamp(timeStamp);
386  c = i;
387  break;
388  }
389  if (i->getI()->getGroupId() == getGroupId()) {
390  // update contact, otherwise the distance comparison iis not correct
391  // (note this is costly and we should replace this with a quicker algorithm if possible)
392  if (i->getTimeStamp() < timeStamp) {
393  double distance, overlap;
394  Vec3D normal;
395  static_cast<BaseWall*>(i->getI())->getDistanceNormalOverlap(*p, distance, normal, overlap);
396  i->setNormal(-normal);
397  i->setDistance(distance);
398  i->setOverlap(overlap);
399  }
400  // if another interaction with a wall of the same group is found
401  double proj = Vec3D::dot(-normal, i->getNormal());
402  // if the two contacts share a contact area, keep only the contact with the minimum distance
403  if (distance >= i->getDistance()) {
404  // if that other contact is closer to the particle than this one
405  if (proj * distance > (1.0-1e-12) * i->getDistance()) {
406  //if one contact point is in the contact area of the other point
407  //(I take the vector a=radius*n, project it onto the other normal ni: b=(a.ni)ni, and check that |a|>(r-delta_i), which is equivalent to checking whether position+a is a distance less than the contact radius from the normal vector ni )
408  //logger(INFO,"Ignoring contact with % because contact with % is closer",getId(),i->getI()->getId());
409  return nullptr;
410  }
411  //else, continue to compute this contact
412  } else {
413  // if this contact is closer to the particle than the other one
414  if (proj * i->getDistance() >= (1.0-1e-12) * distance) {
415  //if the other contact point is in the contact area of this point, replace the other contact with this one
416  i->setI(this);
417  c = i;
418  // if the contact force has already been computed (with the other wall), undo the force/torque computation
419  if (i->getTimeStamp() == timeStamp) {
420  p->addForce(-i->getForce());
421  this->addForce(i->getForce());
422  if (getHandler()->getDPMBase()->getRotation()) {
423  p->addTorque(-i->getTorque() + Vec3D::cross(p->getPosition() - i->getContactPoint(), i->getForce()));
424  this->addTorque(i->getTorque() - Vec3D::cross(this->getPosition() - i->getContactPoint(), i->getForce()));
425  }
426  }
427  i->setTimeStamp(timeStamp);
428  break;
429  }
430  }
431  }
432  }
433  }
434 
435  if (c == nullptr) {
436  // look for an existing interaction, or create a new one
437  c = interactionHandler->getInteraction(p, this, timeStamp);
438  }
439 
440  c->setNormal(-normal);
441  c->setDistance(distance);
442  c->setOverlap(overlap);
443  if (p->isSphericalParticle())
444  {
446  c->setContactPoint(p->getPosition() - (p->getRadius() - 0.5 * c->getOverlap()) * c->getNormal());
447  }
448  else
449  {
450  Vec3D normalBodyFixed = normal;
451  p->getOrientation().rotateBack(normalBodyFixed);
452  auto furthestPoint = getFurthestPointSuperQuadric(normalBodyFixed, p->getAxes(),
453  p->getExponentEps1(), p->getExponentEps2());
454  Vec3D overlapBody = overlap * normalBodyFixed;
455  Vec3D contactPoint = furthestPoint - overlapBody / 2;
456  p->getOrientation().rotate(contactPoint);
457  contactPoint += p->getPosition();
458  c->setContactPoint(contactPoint);
459  }
460  logger(DEBUG, "Particle contact with wall at %", c->getContactPoint());
461  return c;
462  }
463  return nullptr;
464 }

References BaseInteractable::addForce(), BaseInteractable::addTorque(), Vec3D::cross(), Vec3D::dot(), FATAL, BaseParticle::getAxes(), BaseInteraction::getContactPoint(), getDistanceNormalOverlap(), BaseParticle::getExponentEps1(), BaseParticle::getExponentEps2(), getFurthestPointSuperQuadric(), BaseObject::getGroupId(), getHandler(), InteractionHandler::getInteraction(), BaseInteractable::getInteractions(), BaseInteraction::getNormal(), BaseInteractable::getOrientation(), BaseInteraction::getOverlap(), BaseInteractable::getPosition(), BaseParticle::getRadius(), constants::i, BaseParticle::isSphericalParticle(), logger, Quaternion::rotate(), Quaternion::rotateBack(), BaseInteraction::setContactPoint(), BaseInteraction::setDistance(), BaseInteraction::setNormal(), and BaseInteraction::setOverlap().

Referenced by DPMBase::computeForcesDueToWalls(), MeshTriangle::getInteractionWith(), RestrictedWall::getInteractionWith(), PeriodicBoundaryHandler::processLocalInteractionData(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), ContactDetectionWithWallTester::testEllipsoidsContact(), and ContactDetectionWithWallTester::testSpheresContact().

◆ getInteractionWithSuperQuad()

BaseInteraction * BaseWall::getInteractionWithSuperQuad ( SuperQuadricParticle p,
unsigned  timeStamp,
InteractionHandler interactionHandler 
)
virtual
Todo:
make it work with screw, coil and other weird walls

Reimplemented in SimpleDrumSuperquadrics.

496 {
497  logger(ERROR, "Generic wall-superquad interactions not implemented yet.");
498  return nullptr;
499 }

References ERROR, and logger.

Referenced by SimpleDrumSuperquadrics::getInteractionWithSuperQuad().

◆ getLinePlaneIntersect()

bool BaseWall::getLinePlaneIntersect ( Vec3D intersect,
const Vec3D p0,
const Vec3D p1,
const Vec3D n,
const Vec3D p 
)
207 {
208  // t = (p-p0).n / (p1-p0).n
209  //first compute the denominator
210  Mdouble denominator = Vec3D::dot(p1 - p0, n);
211  if (fabs(denominator) >= 1e-10)
212  {
213  Mdouble t = Vec3D::dot(p - p0, n) / denominator;
214  if (t < 1 + 1e-12 && t > -1e-12)
215  intersect = p0 + t * (p1 - p0);
216  return true;
217  }
218  return false;
219 }

References Vec3D::dot(), and n.

◆ getRenderedWall()

BaseWall * BaseWall::getRenderedWall ( size_t  i) const
566 {
567  return renderedWalls_[i];
568 }

References constants::i, and renderedWalls_.

◆ getVTK()

void BaseWall::getVTK ( std::vector< Vec3D > &  points,
std::vector< std::vector< double >> &  triangleStrips 
)
inline
170  {}

◆ getVTKVisibility()

bool BaseWall::getVTKVisibility ( ) const
514 {
515  return vtkVisibility_;
516 }

References vtkVisibility_.

Referenced by renderWall().

◆ handleParticleAddition()

virtual void BaseWall::handleParticleAddition ( unsigned int  id,
BaseParticle p 
)
inlinevirtual

Handles the addition of particles to the particleHandler.

This function is called by DPMBase::handleParticleAddition, whenever a particle is added to the particleHandler. It may be used to update stored pointers to particles

Parameters
[in]idThe id of the removed particle.
[in]pA pointer to the particle.

Reimplemented in MeshTriangle.

202 {}

◆ handleParticleRemoval()

virtual void BaseWall::handleParticleRemoval ( unsigned int  id)
inlinevirtual

Handles the addition of particles to the particleHandler.

This function is called by DPMBase::handleParticleRemoval whenever a (ghost-)particle is removed from the particleHandler. It may be used to update stored pointers to particles

Parameters
[in]idThe id of the removed particle.

Reimplemented in MeshTriangle.

211 {}

◆ intersectVTK()

void BaseWall::intersectVTK ( std::vector< Vec3D > &  points,
Vec3D  normal,
Vec3D  position 
) const

Intersects a of set VTK points representing a wall with a half-space defined by position and normal; This is used in createVTK to restrict the VTK points representing a wall to the inside of the domain.

Checks if a set of VTK points is inside a half-space defined by position and normal; all points outside the half-space are projected onto the half-space boundary. Thus, if the old set of points represented a wall object, the new set of points is represents the intersection of the wall with the half-space.

244 {
245  // find first point in Wall
246  std::vector<Vec3D>::iterator firstIn = points.begin();
247  for (; firstIn != points.end(); firstIn++)
248  {
249  //stop if points[first] is in domain
250  if (isInsideWallVTK(*firstIn, normal, position))
251  {
252  break;
253  }
254  }
255 
256  //if all points are out of the wall
257  if (firstIn == points.end())
258  {
259  logger(DEBUG, "BaseWall::intersectVTK: all points out of wall");
260  return;
261  }
262 
263  // find first point out of the wall after firstIn
264  std::vector<Vec3D>::iterator firstOut = firstIn + 1;
265  for (; firstOut != points.end(); firstOut++)
266  {
267  if (!isInsideWallVTK(*firstOut, normal, position))
268  {
269  break;
270  }
271  }
272 
273  //if all points are in the wall
274  if (firstOut == points.end() && firstIn == points.begin())
275  {
276  logger(DEBUG, "BaseWall::intersectVTK: points completely in wall; removing points");
277  points.clear();
278  return;
279  }
280 
281  //if the sequence starts with a point out of the wall
282  //Several cases have to be distinguished, multiple points in the wall the last point in or out of the wall: ooiiioo, ooioo, ooiii, or ooi
283  //In addition, we add the case iiioo and ioo
284  if (firstIn != points.begin() || !isInsideWallVTK(points.back(), normal, position))
285  {
286  // remove unnessesary points in the wall
287  // ooiiioo -> ooiioo, ooiii -> ooii, iiioo -> iioo
288  if (firstOut - firstIn > 2)
289  {
290  logger(DEBUG, "BaseWall::intersectVTK: remove unnessesary points in the wall");
291  //necessary reset of firstOut, as erase invalidates iterators after erase point
292  points.erase(firstIn + 1, firstOut - 1); //note: erase does not delete the last point
293  firstOut = firstIn + 2;
294  }
295 
296  // if there is only one point in the wall, make it two
297  // ooioo -> ooiioo, ooi -> ooii
298  if (firstOut == firstIn + 1)
299  {
300  logger(DEBUG, "BaseWall::intersectVTK: there is only one point in the wall, make it two");
301  //necessary reset of firstIn, firstOut, as insert invalidates iterators
302  unsigned in = firstIn - points.begin();
303  points.insert(firstIn + 1, *firstIn);
304  firstIn = points.begin() + in;//necessary, unless capacity is set right
305  firstOut = firstIn + 2;
306  }
307 
308  // three cases remain: ooiioo, ooii, iioo
309 
310  //move both points onto the surface of the wall
311  if (firstIn != points.begin())
312  {
313  logger(DEBUG, "BaseWall::intersectVTK: move first point onto the surface of the wall");
314  projectOntoWallVTK(*firstIn, *(firstIn - 1), normal, position);
315  }
316  else
317  {
318  logger(DEBUG,
319  "BaseWall::intersectVTK: move first point (at the beginning of the list) onto the surface of the wall");
320  projectOntoWallVTK(points.front(), points.back(), normal, position);
321  }
322 
323  if (firstOut != points.end())
324  {
325  logger(DEBUG, "BaseWall::intersectVTK: move second point onto the surface of the wall");
326  projectOntoWallVTK(*(firstOut - 1), *firstOut, normal, position);
327  }
328  else
329  {
330  logger(DEBUG,
331  "BaseWall::intersectVTK: move second point (at the end of the list) onto the surface of the wall");
332  projectOntoWallVTK(points.back(), points.front(), normal, position);
333  }
334  //if sequence starts and ends with a point in the wall: iiiooiii
335  }
336  else
337  {
338  logger(DEBUG, "BaseWall::intersectVTK: sequence starts and ends with a point in the wall");
339 
340  // find first point in wall after firstOut
341  for (firstIn = firstOut + 1; firstIn != points.end(); firstIn++)
342  {
343  if (isInsideWallVTK(*firstIn, normal, position))
344  {
345  break;
346  }
347  }
348 
349  // remove unnessesary points in the wall
350  // iiiooiii -> iooi
351  points.erase(firstIn + 1, points.end());
352  points.erase(points.begin(),
353  firstOut - 1); //note: erase does not delete the last point //note iterators are invalid now
354 
355  //move both points onto the surface of the wall: iooi
356  projectOntoWallVTK(points.front(), *(points.begin() + 1), normal, position);
357  projectOntoWallVTK(points.back(), *(points.end() - 2), normal, position);
358  }
359 }

References FATAL, isInsideWallVTK(), logger, and projectOntoWallVTK().

Referenced by InfiniteWall::createVTK(), AxisymmetricIntersectionOfWalls::writeVTK(), HorizontalBaseScrew::writeVTK(), IntersectionOfWalls::writeVTK(), and ScrewsymmetricIntersectionOfWalls::writeVTK().

◆ isFixed()

bool BaseWall::isFixed ( ) const
overridevirtual

Sets all walls (unlike particles) to be inherently fixed - i.e. the bool "is fixed" will by definition return "true" when called for a wall (i.e. any BaseWall tyope object).

Implements BaseInteractable.

189 {
190  return true;
191 }

◆ isInsideWallVTK()

bool BaseWall::isInsideWallVTK ( const Vec3D point,
const Vec3D normal,
const Vec3D position 
) const

Checks if point is in wall (if close to the wall, the point is assumed out of the wall)

223 {
224  return Vec3D::dot(position - point, normal) < -1e-12;
225 }

References Vec3D::dot().

Referenced by intersectVTK().

◆ isLocal()

virtual bool BaseWall::isLocal ( Vec3D min,
Vec3D max 
) const
inlinevirtual

if isLocal returns true and the DPM class derived from MercuryBase, the hGrid will be used to find wall-particle contacts, using min/max.

Reimplemented in TriangleWall, and MeshTriangle.

138  { return false; }

Referenced by Mercury3D::computeWallForces().

◆ projectOntoWallVTK()

void BaseWall::projectOntoWallVTK ( Vec3D point0,
const Vec3D point1,
const Vec3D normal,
const Vec3D position 
) const

Moves point0 onto the surface of the wallsuch that the direction of the edge from point0 to point1 is preserved.

intersectVTK = point[i] + t*(point[i-1]-point[i]) and (intersectVTK - position) normal_=0. => (position-point[i]-t(point[i-1]-point[i]))*normal_=0 t=(position-point[i]))*normal_ / (point[i-1]-point[i]))*normal_

234 {
235  Vec3D dPoint = point1 - point0;
236  point0 += Vec3D::dot(position - point0, normal) / Vec3D::dot(dPoint, normal) * dPoint;
237 }

References Vec3D::dot().

Referenced by intersectVTK().

◆ read()

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

Function that reads a BaseWall from an input stream, usually a restart file.

The BaseWall takes no more information than for a BaseInteractable. (A derived class' read method does most of the work.)

Parameters
[in]is- The input stream from which the BaseWall is read.

Reimplemented from BaseInteractable.

Reimplemented in VChute, TriangulatedWall, TriangleWall, SphericalWall, SineWall, Screw, RestrictedWall, ParabolaChute, NurbsWall, MeshTriangle, LevelSetWall, IntersectionOfWalls, InfiniteWallWithHole, InfiniteWall, HorizontalScrew, CylindricalWall, Combtooth, Coil, BasicUnionOfWalls, BasicIntersectionOfWalls, SimpleDrumSuperquadrics, ScrewsymmetricIntersectionOfWalls, and HorizontalBaseScrew.

81 {
83  unsigned size;
84  std::string type;
85  if (helpers::isNext(is,"vtkVisibility")) {
86  is >> vtkVisibility_;
87  }
88  if (helpers::isNext(is,"renderedWalls")) {
89  is >> size;
90  for (unsigned i = 0; i < size; i++)
91  {
92  is >> type;
93  BaseWall* wall = getHandler()->createObject(type);
94  wall->setHandler(getHandler());
95  wall->read(is);
96  renderedWalls_.push_back(wall);
97  renderedWalls_.back()->setId(renderedWalls_.size());
98  }
99  }
100 }

References WallHandler::createObject(), getHandler(), constants::i, helpers::isNext(), BaseInteractable::read(), read(), renderedWalls_, setHandler(), and vtkVisibility_.

Referenced by SimpleDrumSuperquadrics::read(), ArcWall::read(), read(), BasicIntersectionOfWalls::read(), BasicUnionOfWalls::read(), Coil::read(), Combtooth::read(), CylindricalWall::read(), HorizontalScrew::read(), InfiniteWall::read(), InfiniteWallWithHole::read(), IntersectionOfWalls::read(), LevelSetWall::read(), MeshTriangle::read(), NurbsWall::read(), RestrictedWall::read(), Screw::read(), SineWall::read(), SphericalWall::read(), TriangleWall::read(), and VChute::read().

◆ removeRenderedWalls()

void BaseWall::removeRenderedWalls ( )
559  {
560  while (!renderedWalls_.empty()) {
561  renderedWalls_.pop_back();
562  }
563 }

References renderedWalls_.

◆ renderWall()

void BaseWall::renderWall ( VTKContainer vtk)
571 {
572  if (getVTKVisibility())
573  {
574  if (renderedWalls_.empty())
575  {
576  writeVTK(vtk);
577  }
578  else
579  {
580  const Mdouble time = getHandler()->getDPMBase()->getTime();
581  for (const auto& r: renderedWalls_)
582  {
583  r->applyPrescribedPosition(time);
584  r->applyPrescribedOrientation(time);
585  r->writeVTK(vtk);
586  }
587  }
588  }
589 }

References BaseHandler< T >::getDPMBase(), getHandler(), DPMBase::getTime(), getVTKVisibility(), renderedWalls_, and writeVTK().

◆ setForceControl()

void BaseWall::setForceControl ( Vec3D  forceGoal,
Vec3D  gainFactor,
Vec3D  baseVelocity = {0,0,0} 
)

Slowly adjusts the force on a wall towards a specified goal, by adjusting (prescribing) the velocity of the wall.

Parameters
[in]forceGoal- the desired force on the wall
[in]gainFactor- the rate at which the velocity of the wall should be adjusted
[in]baseVelocity- the velocity that the wall should travel at when the forceGoal is reached
198  {
199  setPrescribedVelocity([this, forceGoal, gainFactor, baseVelocity] (double time){
200  auto dForce = getForce()-forceGoal;
201  return baseVelocity + gainFactor.multiplyElementwise(dForce);
202  });
203 }

References BaseInteractable::getForce(), Vec3D::multiplyElementwise(), and BaseInteractable::setPrescribedVelocity().

◆ setHandler()

void BaseWall::setHandler ( WallHandler handler)
virtual

A function which sets the WallHandler for this BaseWall.

Setting the WallHandler also sets the DPMBase and therefore the SpeciesHandler for the species. This wall's species pointer is updated to the new SpeciesHandler.

Parameters
[in]handler- A pointer to the WallHandler that we want to handle this wall.

Reimplemented in IntersectionOfWalls, and MeshTriangle.

128 {
129  handler_ = handler;
130  setSpecies(getHandler()->getDPMBase()->speciesHandler.getObject(getIndSpecies()));
131 }

References getHandler(), BaseInteractable::getIndSpecies(), BaseHandler< T >::getObject(), handler_, and setSpecies().

Referenced by WallHandler::addObject(), read(), BasicIntersectionOfWalls::read(), BasicUnionOfWalls::read(), WallHandler::readAndCreateObject(), MeshTriangle::setHandler(), IntersectionOfWalls::setHandler(), and setSpecies().

◆ setIndSpecies()

void BaseWall::setIndSpecies ( unsigned int  indSpecies)
overridevirtual

Define the species of this wall using the index of the species in the SpeciesHandler in this DPMBase.

Deprecated:
TW: this function should be taken out and replaced by setSpecies
Parameters
[in]indSpeciesThe index of the species of this BaseWall in the SpeciesHandler.

Reimplemented from BaseInteractable.

145 {
146  if (handler_ != nullptr)
147  {
148  setSpecies(getHandler()->getDPMBase()->speciesHandler.getObject(getIndSpecies()));
149  }
150  else
151  {
153  logger(ERROR, "setIndSpecies called on a particle with no particle handler.\n"
154  "Therefore I can't request the given species from the species handler.\n"
155  " PartID = %", getId());
156  }
157 }

References ERROR, getHandler(), BaseObject::getId(), BaseInteractable::getIndSpecies(), BaseHandler< T >::getObject(), handler_, logger, BaseInteractable::setIndSpecies(), and setSpecies().

◆ setSpecies()

void BaseWall::setSpecies ( const ParticleSpecies species)

Defines the species of the current wall.

Firstly, calls the "BaseInteractable" version of the setSpecies function (BaseInteractable::setSpecies()) which actually sets the species_ of the particle (i.e. provides a pointer to the ParticleSpecies which stores the relevant material properties which we wish to assign to out wall) as well as assigning the relevant species index (indSpecies_) as well as performing relevant error checks.

Secondly, sets a pointer to the relevant handler, which is needed to retrieve species information.

Parameters
[in]species- The pointer to the species whose properties we want to assign to the current wall - i.e. the species we want to "give" the wall.
Todo:
TW: this function should also check if the particle is the correct particle for the species type.
172 {
174  //Checks if the current wall currently belongs to a defined wallHandler...
175  if (getHandler() == nullptr)
176  {
177  //and if not:
178  //Creates a pointer to the handler to which the chosen species belongs
179  SpeciesHandler* sH = species->getHandler();
180  //Creates a pointer back to the DPMBase class
181  DPMBase* dB = sH->getDPMBase();
182  //If this is not a null pointer, assigns the current wall to the relevant wallHandler.
183  if (dB != nullptr)
184  setHandler(&dB->wallHandler);
185  }
186 }

References BaseHandler< T >::getDPMBase(), BaseSpecies::getHandler(), getHandler(), setHandler(), BaseInteractable::setSpecies(), and DPMBase::wallHandler.

Referenced by ShiftingConstantMassFlowMaserBoundarySelfTest::actionsAfterTimeStep(), ShiftingMaserBoundarySelfTest::actionsAfterTimeStep(), IntersectionOfWalls::addObject(), NautaMixer::addTopWall(), Membrane::buildMesh(), Chute::createBottom(), MercuryProblem::createTriangleWall(), CSCWalls::CSCWalls(), HorizontalScrew::HorizontalScrew(), InfiniteWall::InfiniteWall(), InitialConditions< SpeciesType >::InitialConditions(), LevelSetWall::LevelSetWall(), helpers::loadingTest(), main(), MercuryCGSelfTest::MercuryCGSelfTest(), MovingWall::MovingWall(), helpers::normalAndTangentialLoadingTest(), ParticleCreation::ParticleCreation(), FileReader::read(), WallHandler::readAndCreateObject(), WallHandler::readAndCreateOldObject(), DPMBase::readParAndIniFiles(), WallHandler::readTriangleWall(), RestrictedWall::set(), setHandler(), setIndSpecies(), IntersectionOfWalls::setSpecies(), ShiftingConstantMassFlowMaserBoundarySelfTest::setupInitialConditions(), ShiftingMaserBoundarySelfTest::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), MyCoil::setupInitialConditions(), Nurbs::setupInitialConditions(), Chutebelt::setupInitialConditions(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), VerticalMixer::setupInitialConditions(), Binary::setupInitialConditions(), MaserRepeatedOutInMPI2Test::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), MinimalExampleDrum::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), Drum::setupInitialConditions(), HertzSelfTest::setupInitialConditions(), MindlinSelfTest::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), InsertionBoundarySelfTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), NewtonsCradleSelfTest::setupInitialConditions(), SquarePacking::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), WallParticleCollision::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), FreeFallInteractionSelfTest::setupInitialConditions(), FreeFallSelfTest::setupInitialConditions(), LiquidMigrationSelfTest::setupInitialConditions(), DPM::setupInitialConditions(), ObliqueImpactSelfTest::setupInitialConditions(), TwoBondedParticleElasticCollision::setupInitialConditions(), TwoParticleElasticCollisionInteraction::setupInitialConditions(), TwoParticleElasticCollision::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), RollingOverTriangleWalls::setupInitialConditions(), UnionOfWalls::setupInitialConditions(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), Wall::setupInitialConditions(), BouncingSuperQuadric::setupInitialConditions(), EllipsoidsBouncingOnWallDemo::setupInitialConditions(), GranularCollapse::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), protectiveWall::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), Tutorial9::setupInitialConditions(), ParticleWallInteraction::setupInitialConditions(), ExtremeOverlapWithWallsUnitTest::setupInitialConditions(), FreeFallHertzMindlinUnitTest::setupInitialConditions(), FreeFall::setupInitialConditions(), FullRestartTest::setupInitialConditions(), my_problem::setupInitialConditions(), InclinedPlane::setupInitialConditions(), MpiMaserChuteTest::setupInitialConditions(), MovingWalls::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), WallSpecies::setupInitialConditions(), ChuteBottom::setupInitialConditions(), ContactDetectionWithWallTester::setupParticleAndWall(), Chute::setupSideWalls(), and TriangulatedWall::TriangulatedWall().

◆ setVelocityControl()

void BaseWall::setVelocityControl ( Vec3D  forceGoal,
Vec3D  gainFactor,
Vec3D  baseVelocity 
)
591  {
592  setPrescribedVelocity([this, forceGoal, gainFactor, baseVelocity] (double time){
593  auto dForce = getForce()-forceGoal;
594  return baseVelocity + gainFactor.multiplyElementwise(dForce);
595  });
596 }

References BaseInteractable::getForce(), Vec3D::multiplyElementwise(), and BaseInteractable::setPrescribedVelocity().

◆ setVTKVisibility()

void BaseWall::setVTKVisibility ( bool  vtkVisibility)
519 {
520  vtkVisibility_ = vtkVisibility;
521 }

References vtkVisibility_.

Referenced by main().

◆ write()

◆ writeVTK()

void BaseWall::writeVTK ( VTKContainer vtk) const
virtual

adds extra information to the points and triangleStrips vectors needed to plot the wall in vtk format

Parameters
pointsCoordinates of the vertices of the triangulated surfaces (in the VTK file this is called POINTS)
triangleStripsIndices of three vertices forming one triangulated surface (in the VTK file this is called CELL)

Reimplemented in TriangulatedWall, TriangleWall, ScrewsymmetricIntersectionOfWalls, Screw, RestrictedWall, NurbsWall, MeshTriangle, LevelSetWall, IntersectionOfWalls, InfiniteWall, HorizontalScrew, HorizontalBaseScrew, and AxisymmetricIntersectionOfWalls.

467 {
468  logger(WARN, "Walls % of type % have no vtk writer defined", getIndex(), getName());
469 }

References BaseObject::getIndex(), BaseObject::getName(), logger, and WARN.

Referenced by renderWall(), and RestrictedWall::writeVTK().

Member Data Documentation

◆ handler_

WallHandler* BaseWall::handler_
private

A pointer to the WallHandler that handles this BaseWall.

Referenced by BaseWall(), getHandler(), setHandler(), and setIndSpecies().

◆ renderedWalls_

std::vector<BaseWall*> BaseWall::renderedWalls_
private

A vector of walls that gets rendered instead of the actual wall

Referenced by addRenderedWall(), BaseWall(), getRenderedWall(), read(), removeRenderedWalls(), renderWall(), write(), and ~BaseWall().

◆ vtkVisibility_

bool BaseWall::vtkVisibility_ = true
private

The documentation for this class was generated from the following files:
BaseObject::getGroupId
unsigned getGroupId() const
Definition: BaseObject.h:137
Vec3D::multiplyElementwise
Vec3D multiplyElementwise(const Vec3D &a) const
Definition: Vector.h:132
BaseSpecies::getHandler
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
BaseObject::getName
virtual std::string getName() const =0
A purely virtual function.
BaseInteractable::setPosition
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
BaseInteractable::addTorque
void addTorque(const Vec3D &addTorque)
Adds an amount to the torque on this BaseInteractable.
Definition: BaseInteractable.cc:132
BaseWall
Basic class for walls.
Definition: BaseWall.h:48
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
BaseWall::vtkVisibility_
bool vtkVisibility_
Definition: BaseWall.h:249
BaseInteractable::getForce
const Vec3D & getForce() const
Returns the force on this BaseInteractable.
Definition: BaseInteractable.h:126
Quaternion::q1
Mdouble q1
the first component of the quaternion q = (q0,q1,q2,q3)
Definition: Quaternion.h:73
BaseParticle::getExponentEps2
virtual Mdouble getExponentEps2() const
Only ustilised in case of superquadric particles. Had to create a virtual function to allow function ...
Definition: BaseParticle.cc:848
Vec3D::X
Mdouble X
the vector components
Definition: Vector.h:65
BaseWall::handler_
WallHandler * handler_
Definition: BaseWall.h:247
Vec3D::dot
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76
BaseWall::renderedWalls_
std::vector< BaseWall * > renderedWalls_
Definition: BaseWall.h:254
BaseWall::getFurthestPointSuperQuadric
virtual Vec3D getFurthestPointSuperQuadric(const Vec3D &normalBodyFixed, const Vec3D &axes, Mdouble eps1, Mdouble eps2) const
Definition: BaseWall.cc:547
BaseHandler::getSize
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
BaseInteractable::BaseInteractable
BaseInteractable()
Default BaseInteractable constructor.
Definition: BaseInteractable.cc:42
BaseInteractable::getOrientation
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
Definition: BaseInteractable.h:230
BaseInteractable::getIndSpecies
unsigned int getIndSpecies() const
Returns the index of the species associated with the interactable object.
Definition: BaseInteractable.h:88
INFO
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
BaseInteractable::setIndSpecies
virtual void setIndSpecies(unsigned int indSpecies)
Sets the index of the Species of this BaseInteractable.
Definition: BaseInteractable.h:98
BaseInteractable
Defines the basic properties that a interactable object can have.
Definition: BaseInteractable.h:55
VTKContainer::triangleStrips
std::vector< std::vector< double > > triangleStrips
Definition: BaseWall.h:39
BaseInteractable::setPrescribedVelocity
void setPrescribedVelocity(const std::function< Vec3D(double)> &prescribedVelocity)
Allows the velocity of an infinite mass interactable to be prescribed.
Definition: BaseInteractable.cc:444
BaseParticle::setRadius
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:542
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
Mdouble
double Mdouble
Definition: GeneralDefine.h:34
BaseParticle::getRadius
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:348
BaseParticle::getAxes
virtual Vec3D getAxes() const
Only ustilised in case of superquadric particles. Had to create a virtual function to allow function ...
Definition: BaseParticle.cc:842
SpeciesHandler
Container to store all ParticleSpecies.
Definition: SpeciesHandler.h:37
DPMBase::getMax
Vec3D getMax() const
Definition: DPMBase.h:643
ERROR
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
BaseWall::getVTKVisibility
bool getVTKVisibility() const
Definition: BaseWall.cc:513
BaseParticle::setSpecies
void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:804
BaseInteraction::getOverlap
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: BaseInteraction.h:240
DPMBase::getTime
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:805
BaseWall::projectOntoWallVTK
void projectOntoWallVTK(Vec3D &point0, const Vec3D &point1, const Vec3D &normal, const Vec3D &position) const
Definition: BaseWall.cc:233
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
Quaternion::q2
Mdouble q2
the second component of the quaternion q = (q0,q1,q2,q3)
Definition: Quaternion.h:77
WARN
LL< Log::WARN > WARN
Warning log level.
Definition: Logger.cc:54
Log::FATAL
@ FATAL
DPMBase::speciesHandler
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1385
BaseInteractable::read
void read(std::istream &is) override
Reads a BaseInteractable from an input stream.
Definition: BaseInteractable.cc:244
BaseObject::getIndex
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
BaseInteractable::addForce
void addForce(const Vec3D &addForce)
Adds an amount to the force on this BaseInteractable.
Definition: BaseInteractable.cc:116
SphericalParticle
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
DPMBase::wallHandler
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1405
BaseWall::setHandler
virtual void setHandler(WallHandler *handler)
A function which sets the WallHandler for this BaseWall.
Definition: BaseWall.cc:127
Vec3D::Y
Mdouble Y
Definition: Vector.h:65
InteractionHandler::getInteraction
BaseInteraction * getInteraction(BaseInteractable *P, BaseInteractable *I, unsigned timeStamp)
Returns the Interaction between the BaseInteractable's P and I.
Definition: InteractionHandler.cc:149
BaseInteraction::setContactPoint
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
Definition: BaseInteraction.cc:238
Vec3D::min
static Vec3D min(const Vec3D &a, const Vec3D &b)
Calculates the pointwise minimum of two Vec3D.
Definition: Vector.cc:102
BaseWall::isInsideWallVTK
bool isInsideWallVTK(const Vec3D &point, const Vec3D &normal, const Vec3D &position) const
Definition: BaseWall.cc:222
BaseWall::getDistanceNormalOverlapSuperquadric
virtual bool getDistanceNormalOverlapSuperquadric(const SuperQuadricParticle &p, Mdouble &distance, Vec3D &normal_return, Mdouble &overlap) const
Definition: BaseWall.cc:540
VTKContainer::points
std::vector< Vec3D > points
Definition: BaseWall.h:38
constants::i
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
BaseWall::setSpecies
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:171
BaseInteraction::setNormal
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
Definition: BaseInteraction.cc:210
Quaternion
This class contains the 4 components of a quaternion and the standard operators and functions needed ...
Definition: Quaternion.h:63
BaseParticle::getExponentEps1
virtual Mdouble getExponentEps1() const
Only ustilised in case of superquadric particles. Had to create a virtual function to allow function ...
Definition: BaseParticle.cc:845
BaseHandler::getObject
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
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
BaseInteractable::setSpecies
void setSpecies(const ParticleSpecies *species)
Sets the species of this BaseInteractable.
Definition: BaseInteractable.cc:185
BaseInteractable::getInteractions
const std::vector< BaseInteraction * > & getInteractions() const
Returns a list of interactions which belong to this interactable.
Definition: BaseInteractable.h:277
Quaternion::rotateBack
void rotateBack(Vec3D &position) const
Definition: Quaternion.cc:592
DPMBase::getMin
Vec3D getMin() const
Definition: DPMBase.h:637
n
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
BaseWall::writeVTK
virtual void writeVTK(VTKContainer &vtk) const
Definition: BaseWall.cc:466
Vec3D::cross
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:163
BaseWall::getHandler
WallHandler * getHandler() const
A function which returns the WallHandler that handles this BaseWall.
Definition: BaseWall.cc:136
SuperQuadricParticle
Definition: SuperQuadricParticle.h:56
Quaternion::rotate
void rotate(Vec3D &position) const
Definition: Quaternion.cc:563
Quaternion::q3
Mdouble q3
the third component of the quaternion q = (q0,q1,q2,q3)
Definition: Quaternion.h:81
WallHandler::createObject
static BaseWall * createObject(const std::string &type)
Create a new wall, with the type given as a string (required for restarting).
Definition: WallHandler.cc:123
BaseInteractable::write
void write(std::ostream &os) const override
Write a BaseInteractable to an output stream.
Definition: BaseInteractable.cc:274
BaseWall::read
void read(std::istream &is) override
Function that reads a BaseWall from an input stream, usually a restart file.
Definition: BaseWall.cc:80
BaseParticle::isSphericalParticle
virtual bool isSphericalParticle() const
Definition: BaseParticle.h:645
DPMBase::particleHandler
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1395
Vec3D::Z
Mdouble Z
Definition: Vector.h:65
BaseWall::getDistanceNormalOverlap
virtual bool getDistanceNormalOverlap(const BaseParticle &P, Mdouble &distance, Vec3D &normal_return, Mdouble &overlap) const
Definition: BaseWall.cc:523
helpers::isNext
bool isNext(std::istream &is, const std::string name)
Definition: Helpers.cc:957
BaseInteractable::getPosition
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
BaseWall::getDistanceAndNormal
virtual bool getDistanceAndNormal(const BaseParticle &P, Mdouble &distance, Vec3D &normal_return) const =0
Pure virtual function that computes the distance of a BaseParticle to this wall and returns the norma...
DPMBase
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:76