|
A TriangleWall is convex polygon defined as an intersection of InfiniteWall's. More...
#include <TriangleWall.h>
Public Member Functions | |
TriangleWall ()=default | |
Default constructor. More... | |
TriangleWall (const TriangleWall &other)=default | |
Copy constructor. More... | |
~TriangleWall () override=default | |
Destructor. More... | |
TriangleWall * | copy () const override |
Wall copy method. It calls the copy constructor of this Wall, useful for polymorphism. More... | |
std::string | getName () const override |
Returns the name of the object, here the string "TriangleWall". More... | |
void | read (std::istream &is) override |
Reads an TriangleWall from an input stream, for example a restart file. More... | |
void | write (std::ostream &os) const override |
Writes an TriangleWall to an output stream, for example a restart file. More... | |
void | setVertices (Vec3D A, Vec3D B, Vec3D C) |
Sets member variables such that the wall represents a triangle with vertices A, B, C. More... | |
std::array< Vec3D, 3 > | getVertices () const |
void | move (const Vec3D &move) override |
void | setPosition (const Vec3D &position) override |
Sets the position of this BaseInteractable. More... | |
void | setOrientation (const Quaternion &orientation) override |
Sets the orientation of this BaseInteractable. More... | |
void | setVertices (Vec3D A, Vec3D B, Vec3D C, Vec3D position) |
Same as setVertices(A,B,C), but sets the position explicitly. The position is important when you rotate the wall, as the wall will be rotated around this position. More... | |
void | writeVTK (VTKContainer &vtk) const override |
const Vec3D & | getVertex (unsigned i) const |
Returns the position of a vertex. More... | |
bool | getDistanceAndNormal (const BaseParticle &p, Mdouble &distance, Vec3D &normal_return) const override |
Compute the distance from the wall for a given BaseParticle and return if there is a collision. If there is a collision, also return the normal vector. More... | |
void | rotate (const Vec3D &angularVelocity) override |
Rotates this BaseInteractable. More... | |
bool | isLocal (Vec3D &min, Vec3D &max) const override |
bool | isInsideTriangle (const Vec3D &point) const |
void | moveVertex (unsigned index, const Vec3D &dP) |
Updates the indexed vertex by a given change in position. More... | |
void | moveVertices (const std::array< Vec3D, 3 > &dPs) |
Updates all vertices by the given changes in position. More... | |
bool | isFaceContact (const Vec3D &normal) const override |
Public Member Functions inherited from BaseWall | |
BaseWall () | |
Default constructor. More... | |
BaseWall (const BaseWall &w) | |
Copy constructor. More... | |
~BaseWall () override | |
Default destructor. 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... | |
WallHandler * | getHandler () 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... | |
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 BaseInteraction * | getInteractionWithSuperQuad (SuperQuadricParticle *p, unsigned timeStamp, InteractionHandler *interactionHandler) |
void | getVTK (std::vector< Vec3D > &points, std::vector< std::vector< double >> &triangleStrips) |
const Vec3D | getAxis () const |
BaseInteraction * | getInteractionWith (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) |
BaseWall * | getRenderedWall (size_t i) const |
std::vector< BaseWall * > | getRenderedWalls () const |
void | removeRenderedWalls () |
void | renderWall (VTKContainer &vtk) |
void | addParticlesAtWall (unsigned numElements=50) |
void | setVelocityControl (Vec3D forceGoal, Vec3D gainFactor, Vec3D baseVelocity) |
virtual void | writeWallDetailsVTK (VTKData &data) const |
virtual void | computeWear () |
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 ParticleSpecies * | getSpecies () const |
Returns a pointer to the species of this BaseInteractable. More... | |
void | setSpecies (const ParticleSpecies *species) |
Sets the species of this BaseInteractable. More... | |
const Vec3D & | getForce () const |
Returns the force on this BaseInteractable. More... | |
const Vec3D & | getTorque () 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... | |
virtual void | resetForceTorque (int numberOfOMPthreads) |
void | sumForceTorqueOMP () |
const Vec3D & | getPosition () const |
Returns the position of this BaseInteractable. More... | |
const Quaternion & | getOrientation () const |
Returns the orientation 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... | |
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 Vec3D & | getVelocity () const |
Returns the velocity of this interactable. More... | |
virtual const Vec3D & | getAngularVelocity () 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 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 Member Functions | |
void | updateVertexAndNormal () |
Private Attributes | |
std::array< Vec3D, 3 > | vertexInLabFrame_ |
std::array< Vec3D, 3 > | vertex_ |
Vec3D | vertexMin_ |
Vec3D | vertexMax_ |
std::array< Vec3D, 3 > | edgeNormal_ |
std::array< Vec3D, 3 > | edge_ |
std::array< double, 3 > | edgeLength_ |
Vec3D | faceNormal_ |
Additional Inherited Members | |
Static Public Member Functions inherited from BaseWall | |
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... | |
A TriangleWall is convex polygon defined as an intersection of InfiniteWall's.
It can be defined as the intersection of a set of InfiniteWall's, defined by the normal vector into the wall and a point on the wall:
A particle of radius r and position x touches an InfiniteWall with normal n and position p if \(p-n\cdot x\leq r\) (note 'touching particles' also includes particles that are completely enclosed inside the wall). A particle touches an TriangleWall if it touches all InfiniteWall objects (shown in the image below).
For a demonstration on how to use this class, see T8: Motion of a particle in a box with an obstacle and Flow through a 3D hourglass/silo (shown in the image below).
|
default |
Default constructor.
Referenced by copy().
|
default |
Copy constructor.
|
overridedefault |
Destructor.
|
inlineoverridevirtual |
Wall copy method. It calls the copy constructor of this Wall, useful for polymorphism.
Implements BaseWall.
References TriangleWall().
|
overridevirtual |
Compute the distance from the wall for a given BaseParticle and return if there is a collision. If there is a collision, also return the normal vector.
[in] | p | BaseParticle we want to calculate the distance and whether it collided of. |
[out] | distance | The distance of the BaseParticle to this wall. |
[out] | normal_return | If there was a collision, the normal vector to this wall will be placed here. |
This function computes whether or not there is a collision between a given BaseParticle and this TriangleWall. If there is a collision, this function also computes the distance between the BaseParticle and TriangleWall and the normal of the TriangleWall at the intersection point. It does this by calling TriangleWall::getDistanceAndNormal(const Vec3D& , Mdouble , Mdouble&, Vec3D&) const. Since this function should be called before calculating any Particle-Wall interactions, it can also be used to set the normal vector in case of curved walls.
Implements BaseWall.
References Vec3D::dot(), edge_, edgeLength_, edgeNormal_, faceNormal_, Vec3D::getLength(), BaseInteractable::getPosition(), BaseParticle::getWallInteractionRadius(), isInsideTriangle(), and vertex_.
|
inlineoverridevirtual |
Returns the name of the object, here the string "TriangleWall".
Implements BaseObject.
|
inline |
|
inline |
Reimplemented from BaseInteractable.
References faceNormal_.
References Vec3D::cross(), and vertex_.
Referenced by getDistanceAndNormal().
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 from BaseWall.
References vertexMax_, and vertexMin_.
|
overridevirtual |
Moves (displaces) the interacable a given distance. Note, this just updates the position by the move.
[in] | move | Reference to Vec3D which is the distance to move the interactable. |
Reimplemented from BaseInteractable.
References BaseInteractable::move(), and updateVertexAndNormal().
void TriangleWall::moveVertex | ( | unsigned | index, |
const Vec3D & | dP | ||
) |
Updates the indexed vertex by a given change in position.
index | Vertex index, i.e. 0, 1 or 2 |
dP | Change in position |
References updateVertexAndNormal(), and vertexInLabFrame_.
void TriangleWall::moveVertices | ( | const std::array< Vec3D, 3 > & | dPs | ) |
Updates all vertices by the given changes in position.
dPs | Change in position for each vertex |
References updateVertexAndNormal(), and vertexInLabFrame_.
|
overridevirtual |
Reads an TriangleWall from an input stream, for example a restart file.
[in] | is | The input stream from which the TriangleWall is read, usually a restart file. |
Reimplemented from BaseWall.
References constants::i, BaseWall::read(), updateVertexAndNormal(), and vertexInLabFrame_.
|
overridevirtual |
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.
[in] | angularVelocityDt | Reference to Vec3D which is the solid angle through which the interactable is rotated. |
Reimplemented from BaseInteractable.
References Vec3D::isZero(), BaseInteractable::rotate(), and updateVertexAndNormal().
|
overridevirtual |
Sets the orientation of this BaseInteractable.
Interpretation depends on which interactable is being considered See also BaseInteractable::getOrientation.
[in] | orientation | Reference to Vec3D storing the orientation of the particle. |
Reimplemented from BaseInteractable.
References BaseInteractable::setOrientation(), and updateVertexAndNormal().
|
overridevirtual |
Sets the position of this BaseInteractable.
Interpretation depends on which interactable is being considered See also BaseInteractable::getPosistion.
[in] | position | Reference to Vec3D storing the position of the particle. |
Reimplemented from BaseInteractable.
References BaseInteractable::setPosition(), and updateVertexAndNormal().
Sets member variables such that the wall represents a triangle with vertices A, B, C.
References A, BaseInteractable::getPosition(), BaseInteractable::setOrientation(), BaseInteractable::setPosition(), updateVertexAndNormal(), and vertexInLabFrame_.
Referenced by MercuryProblem::createTriangleWall(), SCoupling< M, O >::createTriangleWall(), main(), WallHandler::readTriangleWall(), TriangleMeshWall::refineTriangle(), TriangleMeshWall::set(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), Drum::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), RollingOverTriangleWalls::setupInitialConditions(), and SCoupling< M, O >::updateTriangleWall().
Same as setVertices(A,B,C), but sets the position explicitly. The position is important when you rotate the wall, as the wall will be rotated around this position.
References A, BaseInteractable::getPosition(), BaseInteractable::setOrientation(), BaseInteractable::setPosition(), updateVertexAndNormal(), and vertexInLabFrame_.
|
private |
This function should be called after setting either position_ or vertexInLabFrame_.
References Vec3D::cross(), edge_, edgeLength_, edgeNormal_, faceNormal_, BaseInteractable::getOrientation(), BaseInteractable::getPosition(), constants::i, Vec3D::max(), Vec3D::min(), Vec3D::normalise(), Quaternion::rotate(), vertex_, vertexInLabFrame_, vertexMax_, and vertexMin_.
Referenced by move(), moveVertex(), moveVertices(), read(), rotate(), setOrientation(), setPosition(), and setVertices().
|
overridevirtual |
Writes an TriangleWall to an output stream, for example a restart file.
[in] | os | The output stream where the TriangleWall must be written to, usually a restart file. |
Reimplemented from BaseWall.
References constants::i, vertexInLabFrame_, and BaseWall::write().
|
overridevirtual |
adds extra information to the points and triangleStrips vectors needed to plot the wall in vtk format
points | Coordinates of the vertices of the triangulated surfaces (in the VTK file this is called POINTS) |
triangleStrips | Indices of three vertices forming one triangulated surface (in the VTK file this is called CELL) |
Reimplemented from BaseWall.
References VTKContainer::points, VTKContainer::triangleStrips, and vertex_.
|
private |
Referenced by getDistanceAndNormal(), and updateVertexAndNormal().
|
private |
Referenced by getDistanceAndNormal(), and updateVertexAndNormal().
|
private |
stores the wall normal n in n.x=p
Referenced by getDistanceAndNormal(), and updateVertexAndNormal().
|
private |
stores the face normal, not rotated into the lab frame; thus, if the wall rotates, this normal has to be rotated as well
Referenced by getDistanceAndNormal(), isFaceContact(), and updateVertexAndNormal().
|
private |
stores the position of the vertices relative to the position of the wall but not rotated into the lab frame; thus, if the wall rotates, these vertices have to be rotated as well
Referenced by getDistanceAndNormal(), getVertex(), getVertices(), isInsideTriangle(), updateVertexAndNormal(), and writeVTK().
|
private |
stores the position of the vertices relative to the position of the wall and rotated into the lab frame;
Referenced by moveVertex(), moveVertices(), read(), setVertices(), updateVertexAndNormal(), and write().
|
private |
Referenced by isLocal(), and updateVertexAndNormal().
|
private |
stores the min and max coordinate values of the vertices (needed for hGrid)
Referenced by isLocal(), and updateVertexAndNormal().