TriangleMeshWall Class Reference

#include <TriangleMeshWall.h>

+ Inheritance diagram for TriangleMeshWall:

Classes

struct  Triangle
 
struct  Vertex
 

Public Member Functions

 TriangleMeshWall ()=default
 Default constructor. More...
 
 TriangleMeshWall (const TriangleMeshWall &other)
 Copy constructor. More...
 
 TriangleMeshWall (const std::vector< Vec3D > &points, const std::vector< std::array< unsigned, 3 >> &cells, const ParticleSpecies *species=nullptr)
 Constructor creating triangles. More...
 
 TriangleMeshWall (const Vec3D &P0, const Vec3D &P1, const Vec3D &P, Mdouble resolutionU, Mdouble resolutionV, const ParticleSpecies *species=nullptr, bool periodicInU=false, bool periodicInV=false)
 Constructor creating parallelogram shaped mesh with a given resolution in u- and v-direction. More...
 
 ~TriangleMeshWall () override=default
 Destructor. More...
 
TriangleMeshWalloperator= (const TriangleMeshWall &other)
 Copy assignment operator. More...
 
TriangleMeshWallcopy () const override
 Wall copy method. More...
 
void read (std::istream &is) override
 Reads a TriangleMeshWall from an input stream, for example a restart file. More...
 
void write (std::ostream &os) const override
 Writes a TriangleMeshWall to an output stream, for example a restart file. More...
 
std::string getName () const override
 Returns the name of the object. More...
 
void set (const std::vector< Vec3D > &points, const std::vector< std::array< unsigned, 3 >> &cells)
 Set function creating triangles. More...
 
bool getDistanceAndNormal (const BaseParticle &p, Mdouble &distance, Vec3D &normal_return) const override
 Checks if a collision is happening with any of the TriangleWalls. NOTE: this does not handle actual interactions, but can only be used to know IF one (of possible many) interaction occurs. More...
 
BaseInteractiongetInteractionWith (BaseParticle *p, unsigned timeStamp, InteractionHandler *interactionHandler) override
 Gets the interaction between a given BaseParticle and all TriangleWalls in this mesh at a given time. In case of multiple contacts, chooses the one with greatest overlap. More...
 
void resetForceTorque (int numberOfOMPthreads) override
 
void writeVTK (VTKContainer &vtk) const override
 
void setSpecies (const ParticleSpecies *species)
 
void moveVertex (unsigned index, const Vec3D &dP)
 Updates a vertex by a given change in position. More...
 
void removeTriangle (unsigned index, bool removeFreeVertex=true)
 Removes a single triangle from the mesh. More...
 
void refineTriangle (unsigned index, unsigned numberOfTimes=1)
 Makes a really basic refinement by adding a vertex in the middle of the triangle to create 3 new ones. Note: Multiple refinements will definitely NOT create a nice mesh. More...
 
void setPeriodicCompanions (const std::vector< std::pair< unsigned, unsigned >> &periodicCompanions)
 Sets the vector with pairs of indices of vertices which lie on a periodic boundary and are each others 'companion'. E.g. when moving one vertex, the other is also moved the same amount. A vertex can have multiple companions (when lying on multiple periodic boundaries) and those should be in the vector as multiple pairs. More...
 
void moveVerticesToMatchVolume (std::vector< Vec3D > displacements, Mdouble targetVolume, int maxNumRecursiveCalls=15)
 Moves all vertices by given displacements and corrects to match the change in volume with the target volume. The final displacements will be proportional to the initial ones, but their actual values will have change. More...
 
Mdouble getVolumeTetrahedron (const Vec3D &a, const Vec3D &b, const Vec3D &c, const Vec3D &d)
 Calculates the volume of a tetrahedron formed by 4 vertices. More...
 
void addToMesh (TriangleMeshWall mesh)
 Adds a mesh to this mesh. When vertices share a position, only the one in the current mesh is kept and both meshes are then "connected" at that point. More...
 
void createParallelogramMesh (const Vec3D &P0, const Vec3D &P1, const Vec3D &P2, Mdouble resolutionU, Mdouble resolutionV, bool periodicInU=false, bool periodicInV=false)
 Creates a parallelogram shaped mesh with a given resolution in u- and v-direction. More...
 
void createFourPointMesh (const Vec3D &P0, const Vec3D &P1, const Vec3D &P2, const Vec3D &P3, int numSegmentsU, int numSegmentsV)
 Creates mesh consisting of four points, with linearly interpolated segments. The points therefore don't necessarily have to lie in plane. More...
 
bool isLocal (Vec3D &min, Vec3D &max) const 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 move (const Vec3D &move) override
 Moves this BaseInteractable by adding an amount to the position. More...
 
void rotate (const Vec3D &angularVelocity) override
 Rotates this BaseInteractable. More...
 
- 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...
 
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...
 
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)
 
void getVTK (std::vector< Vec3D > &points, std::vector< std::vector< double >> &triangleStrips)
 
const Vec3D getAxis () const
 
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
 
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 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 sumForceTorqueOMP ()
 
const Vec3DgetPosition () const
 Returns the position of this BaseInteractable. More...
 
const QuaterniongetOrientation () 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 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
 
virtual bool isFaceContact (const Vec3D &normal) 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
 

Protected Attributes

std::vector< Triangletriangles_
 
std::vector< Vertexvertices_
 

Private Member Functions

std::vector< unsignedgetPeriodicCompanions (unsigned index)
 Looks up the companions belonging to a vertex index, if it has any. More...
 
bool isWithinBoundingBox (const Vec3D &position, Mdouble radius) const
 Checks whether or not a part of the particle is within the bounding box. More...
 
void updateBoundingBox ()
 Sets the local and global bounding boxes. This method should be called any time a vertex is updated in lab frame. More...
 
void updateBoundingBoxGlobal ()
 Sets the global bounding box, using the bounding box in lab frame. This method should be called when there are changes in global frame, but not in lab frame. E.g. when calling setPosition(). More...
 
int getNumberOfSegmentsAndResolution (Mdouble length, Mdouble &resolution)
 Finds the number of segments and the resolution needed to perfectly fit a length. More...
 
void addZigZagDiagonalCells (std::vector< std::array< unsigned, 3 >> &cells, int numU, int numV, int i, int j)
 Helper function that adds two cells (triangles) to the provided cells vector. Used by createParallelogramMesh and createFourPointMesh. More...
 

Private Attributes

std::vector< std::pair< unsigned, unsigned > > periodicCompanions_
 
Vec3D boundingBoxMin_
 Bounding box corners in lab frame and global frame. Used to speed up contact detection. HGrid uses the global frame min max. More...
 
Vec3D boundingBoxMax_
 
Vec3D boundingBoxMinGlobal_
 
Vec3D boundingBoxMaxGlobal_
 

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...
 

Constructor & Destructor Documentation

◆ TriangleMeshWall() [1/4]

TriangleMeshWall::TriangleMeshWall ( )
default

Default constructor.

Referenced by copy().

◆ TriangleMeshWall() [2/4]

TriangleMeshWall::TriangleMeshWall ( const TriangleMeshWall other)

Copy constructor.

Parameters
otherThe TriangleMeshWall that must be copied.
9  : BaseWall(other)
10 {
11  triangles_ = other.triangles_;
12  vertices_ = other.vertices_;
14 
19 }
BaseWall()
Default constructor.
Definition: BaseWall.cc:15
Vec3D boundingBoxMax_
Definition: TriangleMeshWall.h:251
Vec3D boundingBoxMinGlobal_
Definition: TriangleMeshWall.h:252
Vec3D boundingBoxMaxGlobal_
Definition: TriangleMeshWall.h:252
std::vector< std::pair< unsigned, unsigned > > periodicCompanions_
Definition: TriangleMeshWall.h:241
Vec3D boundingBoxMin_
Bounding box corners in lab frame and global frame. Used to speed up contact detection....
Definition: TriangleMeshWall.h:251
std::vector< Triangle > triangles_
Definition: TriangleMeshWall.h:237
std::vector< Vertex > vertices_
Definition: TriangleMeshWall.h:238

References boundingBoxMax_, boundingBoxMaxGlobal_, boundingBoxMin_, boundingBoxMinGlobal_, periodicCompanions_, triangles_, and vertices_.

◆ TriangleMeshWall() [3/4]

TriangleMeshWall::TriangleMeshWall ( const std::vector< Vec3D > &  points,
const std::vector< std::array< unsigned, 3 >> &  cells,
const ParticleSpecies species = nullptr 
)

Constructor creating triangles.

Parameters
pointsVector of vertices
cellsVector of cells, each cell holds three indices to the points vector
species
23 {
24  // Set the species of the main wall first, as the set function will use it.
25  setSpecies(species);
26  set(points, cells);
27 }
void setSpecies(const ParticleSpecies *species)
Definition: TriangleMeshWall.cc:298
void set(const std::vector< Vec3D > &points, const std::vector< std::array< unsigned, 3 >> &cells)
Set function creating triangles.
Definition: TriangleMeshWall.cc:112

References set(), and setSpecies().

◆ TriangleMeshWall() [4/4]

TriangleMeshWall::TriangleMeshWall ( const Vec3D P0,
const Vec3D P1,
const Vec3D P,
Mdouble  resolutionU,
Mdouble  resolutionV,
const ParticleSpecies species = nullptr,
bool  periodicInU = false,
bool  periodicInV = false 
)

Constructor creating parallelogram shaped mesh with a given resolution in u- and v-direction.

Parameters
P0,P1,P2The three points, in clockwise order, forming the parallelogram (fourth point is implied).
resolutionUMaximum length of a segment in u-direction.
resolutionVMaximum length of a segment in v-direction.
species
periodicInUWhether or not the first and last column of vertices lie in a periodic boundary and should be set as periodic companions.
periodicInVWhether or not the first and last row of vertices lie in a periodic boundary and should be set as periodic companions.
32 {
33  // Set the species first, as it is used in other methods.
34  setSpecies(species);
35  createParallelogramMesh(P0, P1, P2, resolutionU, resolutionV, periodicInU, periodicInV);
36 }
void createParallelogramMesh(const Vec3D &P0, const Vec3D &P1, const Vec3D &P2, Mdouble resolutionU, Mdouble resolutionV, bool periodicInU=false, bool periodicInV=false)
Creates a parallelogram shaped mesh with a given resolution in u- and v-direction.
Definition: TriangleMeshWall.cc:710
double P0
Definition: two_dim.cc:101

References createParallelogramMesh(), Problem_Parameter::P0, and setSpecies().

◆ ~TriangleMeshWall()

TriangleMeshWall::~TriangleMeshWall ( )
overridedefault

Destructor.

Member Function Documentation

◆ addToMesh()

void TriangleMeshWall::addToMesh ( TriangleMeshWall  mesh)

Adds a mesh to this mesh. When vertices share a position, only the one in the current mesh is kept and both meshes are then "connected" at that point.

Parameters
meshMesh to be added.
646 {
647  // All triangles are simply added to the triangles_ vector. When adding vertices, any triangle index of the added
648  // mesh simply becomes: updated index = index + number of triangles originally in this mesh.
649  // Similar for the vertices, however vertices which share their position with a vertex already in the mesh are
650  // ignored. So when adding triangles, the vertex indices can sometimes reference to a vertex already in the mesh.
651  // The easiest way to implement is to temporarily store the updated vertex indices, and to later assign them.
652 
653  // Remember the number of vertices and triangles originally in this mesh.
654  const int numVertices = vertices_.size();
655  const int numTriangles = triangles_.size();
656  // For each of the added vertices, their updated vertex is temporarily stored in a vector.
657  // This is the cleanest/easiest way to later update the vertex indices of each added triangle.
658  std::vector<unsigned> updatedVertexIndices;
659  updatedVertexIndices.reserve(mesh.vertices_.size());
660 
661  // Loop through the vertices to be added.
662  for (Vertex& v : mesh.vertices_)
663  {
664  // The triangle indices can simply be updated.
665  for (auto& p : v.triangleIndices)
666  p.first += numTriangles;
667 
668  // Initialize updated vertex index as -1, to later check if it has been set or not.
669  int index = -1;
670  // Loop through original vertices and compare vertex positions.
671  for (int i = 0; i < numVertices; i++)
672  {
673  if (v.position.isEqualTo(vertices_[i].position, std::numeric_limits<Mdouble>::epsilon()))
674  {
675  // When vertices share position, update vertex index.
676  index = i;
677  break;
678  }
679  }
680 
681  // When the updated index is not set, the vertex is not in the mesh yet and should be added.
682  if (index == -1)
683  {
684  index = vertices_.size();
685  vertices_.push_back(v);
686  }
687  else
688  {
689  // The vertex is already in the mesh, add the triangle indices of the added mesh to it.
690  for (auto& p : v.triangleIndices)
691  vertices_[index].triangleIndices.push_back(p);
692  }
693 
694  // Store the updated index.
695  updatedVertexIndices.push_back(index);
696  }
697 
698  // Loop through the triangles to be added.
699  for (Triangle& t : mesh.triangles_)
700  {
701  // Update the vertex indices.
702  for (unsigned& idx : t.vertexIndices)
703  idx = updatedVertexIndices[idx];
704  triangles_.push_back(t);
705  }
706 
708 }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
float * p
Definition: Tutorial_Map_using.cpp:9
void updateBoundingBox()
Sets the local and global bounding boxes. This method should be called any time a vertex is updated i...
Definition: TriangleMeshWall.cc:848
double epsilon
Definition: osc_ring_sarah_asymptotics.h:43
t
Definition: plotPSD.py:36

References oomph::SarahBL::epsilon, i, p, plotPSD::t, triangles_, updateBoundingBox(), v, and vertices_.

◆ addZigZagDiagonalCells()

void TriangleMeshWall::addZigZagDiagonalCells ( std::vector< std::array< unsigned, 3 >> &  cells,
int  numU,
int  numV,
int  i,
int  j 
)
private

Helper function that adds two cells (triangles) to the provided cells vector. Used by createParallelogramMesh and createFourPointMesh.

Parameters
cellsThe vector to which the cells are added.
numUThe number of segments in u-direction.
numVThe number of segments in v-direction.
iThe cell index in u-direction.
jThe cell index in v-direction.
771 {
772  // Not in last row/column
773  if (i < numU - 1 && j < numV - 1)
774  {
775  // Bottom left
776  const unsigned baseIdx = i + j * numU;
777 
778  // Check moduli to create zigzag diagonals (both being odd or even)
779  if ((i % 2 == 0) != (j % 2 == 0))
780  {
781  // Diagonal from bottom left to top right
782  // Bottom left, top left, top right (clockwise)
783  cells.push_back({baseIdx, baseIdx + numU, baseIdx + numU + 1});
784  // Bottom left, top right, bottom right (clockwise)
785  cells.push_back({baseIdx, baseIdx + numU + 1, baseIdx + 1});
786  }
787  else
788  {
789  // Diagonal from top left to bottom right
790  // Bottom left, top left, bottom right (clockwise)
791  cells.push_back({baseIdx, baseIdx + numU, baseIdx + 1});
792  // Top left, top right, bottom right (clockwise)
793  cells.push_back({baseIdx + numU, baseIdx + numU + 1, baseIdx + 1});
794  }
795  }
796 }
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References i, and j.

Referenced by createFourPointMesh(), and createParallelogramMesh().

◆ copy()

TriangleMeshWall * TriangleMeshWall::copy ( ) const
overridevirtual

Wall copy method.

Returns
Pointer to the copy.

Implements BaseWall.

Reimplemented in WearableTriangleMeshWall.

48 {
49  return new TriangleMeshWall(*this);
50 }
TriangleMeshWall()=default
Default constructor.

References TriangleMeshWall().

Referenced by operator=().

◆ createFourPointMesh()

void TriangleMeshWall::createFourPointMesh ( const Vec3D P0,
const Vec3D P1,
const Vec3D P2,
const Vec3D P3,
int  numSegmentsU,
int  numSegmentsV 
)

Creates mesh consisting of four points, with linearly interpolated segments. The points therefore don't necessarily have to lie in plane.

Parameters
P0,P1,P2,P3The four points, in clock-wise order.
numSegmentsUNumber of segments in u-direction.
numSegmentsVNumber of segments in v-direction.
799 {
800  // To get to a point in the mesh, all we need to do is to walk along the bottom edge and then walk up along the
801  // linearly interpolated vector between the left and right edge. We step with a certain fraction of the length of
802  // the vectors, dependent on the number of segments in that direction.
803 
804  // Bottom direction vector (u-direction)
805  const Vec3D dirU = P3 - P0;
806  // Left and right direction vector (v-direction)
807  const Vec3D dirV0 = P1 - P0;
808  const Vec3D dirV1 = P2 - P3;
809  // Step size for linear interpolation between left and right direction vectors
810  Vec3D deltaDirV = (dirV1 - dirV0) / numSegmentsU;
811 
812  // Number of points is 1 more than number of segments
813  const int numU = numSegmentsU + 1;
814  const int numV = numSegmentsV + 1;
815 
816  std::vector<Vec3D> points;
817  std::vector<std::array<unsigned, 3>> cells;
818 
819  for (int j = 0; j < numV; j++)
820  {
821  for (int i = 0; i < numU; i++)
822  {
823  // Update direction vector in v-direction
824  Vec3D dirV = dirV0 + i * deltaDirV;
825  const Vec3D p = P0 + dirU * i / numSegmentsU + dirV * j / numSegmentsV;
826  points.push_back(p);
827  addZigZagDiagonalCells(cells, numU, numV, i, j);
828  }
829  }
830 
831  set(points, cells);
832 }
void addZigZagDiagonalCells(std::vector< std::array< unsigned, 3 >> &cells, int numU, int numV, int i, int j)
Helper function that adds two cells (triangles) to the provided cells vector. Used by createParallelo...
Definition: TriangleMeshWall.cc:770
Definition: Kernel/Math/Vector.h:30

References addZigZagDiagonalCells(), i, j, p, Problem_Parameter::P0, and set().

◆ createParallelogramMesh()

void TriangleMeshWall::createParallelogramMesh ( const Vec3D P0,
const Vec3D P1,
const Vec3D P2,
Mdouble  resolutionU,
Mdouble  resolutionV,
bool  periodicInU = false,
bool  periodicInV = false 
)

Creates a parallelogram shaped mesh with a given resolution in u- and v-direction.

Parameters
P0,P1,P2The three points, in clockwise order, forming the parallelogram (fourth point is implied).
resolutionUMaximum length of a segment in u-direction.
resolutionVMaximum length of a segment in v-direction.
periodicInUWhether or not the first and last column of vertices lie in a periodic boundary and should be set as periodic companions.
periodicInVWhether or not the first and last row of vertices lie in a periodic boundary and should be set as periodic companions.
712 {
713  // Length of the sides of the parallelogram
714  const Mdouble lengthU = (P2 - P0).getLength();
715  const Mdouble lengthV = (P1 - P0).getLength();
716  // Direction vectors of the parallelogram sides
717  const Vec3D dirU = (P2 - P0) / lengthU;
718  const Vec3D dirV = (P1 - P0) / lengthV;
719 
720  // Number of points is 1 more than number of segments
721  const int numU = getNumberOfSegmentsAndResolution(lengthU, resolutionU) + 1;
722  const int numV = getNumberOfSegmentsAndResolution(lengthV, resolutionV) + 1;
723 
724  std::vector<Vec3D> points;
725  std::vector<std::array<unsigned, 3>> cells;
726 
727  for (int j = 0; j < numV; j++)
728  {
729  for (int i = 0; i < numU; i++)
730  {
731  const Vec3D p = P0 + dirU * i * resolutionU + dirV * j * resolutionV;
732  points.push_back(p);
733  addZigZagDiagonalCells(cells, numU, numV, i, j);
734  }
735  }
736 
737  set(points, cells);
738 
739  // Set possible periodic companions for first/last row/column.
740  std::vector<std::pair<unsigned, unsigned>> periodic;
741  if (periodicInU)
742  {
743  // First/last column
744  for (int j = 0; j < numV; j++)
745  periodic.emplace_back(j * numU, (j+1) * numU - 1);
746  }
747  if (periodicInV)
748  {
749  // First/last row
750  for (int i = 0; i < numU; i++)
751  periodic.emplace_back(i, i + (numV-1) * numU);
752  }
753  if (periodicInU && periodicInV)
754  {
755  // Periodic in diagonals u/v
756  periodic.emplace_back(0, numU * numV - 1);
757  periodic.emplace_back(numU - 1, numU * (numV-1));
758  }
759  setPeriodicCompanions(periodic);
760 }
int getNumberOfSegmentsAndResolution(Mdouble length, Mdouble &resolution)
Finds the number of segments and the resolution needed to perfectly fit a length.
Definition: TriangleMeshWall.cc:762
void setPeriodicCompanions(const std::vector< std::pair< unsigned, unsigned >> &periodicCompanions)
Sets the vector with pairs of indices of vertices which lie on a periodic boundary and are each other...
Definition: TriangleMeshWall.cc:511

References addZigZagDiagonalCells(), getNumberOfSegmentsAndResolution(), i, j, p, Problem_Parameter::P0, set(), and setPeriodicCompanions().

Referenced by TriangleMeshWall().

◆ getDistanceAndNormal()

bool TriangleMeshWall::getDistanceAndNormal ( const BaseParticle p,
Mdouble distance,
Vec3D normal_return 
) const
overridevirtual

Checks if a collision is happening with any of the TriangleWalls. NOTE: this does not handle actual interactions, but can only be used to know IF one (of possible many) interaction occurs.

Parameters
p
distance
normal_return
Returns
Whether or not there is a collision.

Implements BaseWall.

153 {
154  // Input BaseParticle is constant, so copy the necessary properties and change to local coordinates.
155  SphericalParticle pLocal;
156  pLocal.setSpecies(p.getSpecies());
157  pLocal.setRadius(p.getRadius());
158  pLocal.setPosition(getOrientation().rotateBack(p.getPosition() - getPosition()));
159 
160  if (!isWithinBoundingBox(pLocal.getPosition(), pLocal.getWallInteractionRadius(this)))
161  return false;
162 
163  for (const Triangle& t : triangles_)
164  {
165  if (t.wall.getDistanceAndNormal(pLocal, distance, normal_return))
166  return true;
167  }
168  return false;
169 }
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
Definition: BaseInteractable.h:209
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:218
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:197
Mdouble getWallInteractionRadius(const BaseWall *wall) const
returns the radius plus the interactionDistance
Definition: BaseParticle.h:369
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:548
virtual void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:798
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
bool isWithinBoundingBox(const Vec3D &position, Mdouble radius) const
Checks whether or not a part of the particle is within the bounding box.
Definition: TriangleMeshWall.cc:841

References BaseInteractable::getOrientation(), BaseInteractable::getPosition(), BaseParticle::getWallInteractionRadius(), isWithinBoundingBox(), p, BaseInteractable::setPosition(), BaseParticle::setRadius(), BaseParticle::setSpecies(), plotPSD::t, and triangles_.

◆ getInteractionWith()

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

Gets the interaction between a given BaseParticle and all TriangleWalls in this mesh at a given time. In case of multiple contacts, chooses the one with greatest overlap.

Parameters
p
timeStamp
interactionHandler
Returns
Note
Particle positions are rotated to lab frame, however the particle orientation itself is not considered, so most likely doesn't work properly for non-spherical particles.
Todo:
TW: I think this torque has the wrong sign

Reimplemented from BaseWall.

173 {
174  // In case of multiple contacts, we store the one with the maximum overlap and only calculate the forces for that interaction.
175  // Since the BaseWall::getInteractionWith() automatically adds interactions to the handler, any interactions which
176  // are not the one with greatest overlap should be removed from the handler.
177  Mdouble maxOverlap = 0.0;
178  BaseWall* maxWall = nullptr;
179 
180  // Change particle to local coordinates.
181  //\todo How to handle orientation of non-spherical particles
182  const Vec3D posOriginal = p->getPosition();
183  p->setPosition(getOrientation().rotateBack(posOriginal - getPosition()));
184 
185  if (!isWithinBoundingBox(p->getPosition(), p->getWallInteractionRadius(this)))
186  {
187  p->setPosition(posOriginal);
188  return nullptr;
189  }
190 
191  // Loop through all triangles and find interactions and store the one with max overlap
192  // (the main idea and the force calculations are literally copied from DPMBase::computeForcesDueToWalls)
193  for (auto& t : triangles_)
194  {
195  // Checks if the particle is interacting with this triangle
196  BaseInteraction* i = t.wall.getInteractionWith(p, timeStamp, interactionHandler);
197 
198  // When an interaction exists
199  if (i != nullptr)
200  {
201  // When the overlap is greater than that of any previous interactions
202  if (i->getOverlap() > maxOverlap)
203  {
204  // Remove the previous maximum overlap interaction from the handler
205  if (maxWall != nullptr)
206  {
207  BaseInteraction* prevMaxI = interactionHandler->getInteraction(p, maxWall, timeStamp);
208  interactionHandler->removeObject(prevMaxI->getIndex());
209  }
210 
211  // Update the maximum overlap and store the interacting wall
212  maxOverlap = i->getOverlap();
213  maxWall = &t.wall;
214  }
215  else
216  {
217  // Remove the last added interaction, as it is not the one with maximum overlap and should be discarded.
218  interactionHandler->removeObject(i->getIndex());
219  }
220  }
221  }
222 
223  // Change particle back to its original coordinates, before doing any force calculations.
224  p->setPosition(posOriginal);
225 
226  // When an interaction exists
227  if (maxWall != nullptr)
228  {
229  // The interaction with maximum overlap
230  BaseInteraction* i = interactionHandler->getInteraction(p, maxWall, timeStamp);
231  // The TriangleWall which with the interaction occurred
232  BaseInteractable* w = maxWall;
233 
234  // Rotate normal and change contact point to global coordinates
235  i->setNormal(getOrientation().rotate(i->getNormal()));
236  i->setContactPoint(getOrientation().rotate(i->getContactPoint()) + getPosition());
237 
238  // Transform TriangleWall position from local to global coordinates. (Needed for torque calculations etc.)
239  const Vec3D wPosOriginal = w->getPosition();
240  w->setPosition(getOrientation().rotateBack(w->getPosition()) + getPosition());
241  // Add the mesh velocities to the TriangleWall velocities. Needed in the force calculations (relative velocity etc.).
242  w->addVelocity(getVelocity());
243  w->addAngularVelocity(getAngularVelocity());
244  // At the moment the TriangleWalls in the mesh always have position, velocity and angular velocities equal to zero.
245  // In case of future changes, however, they are treated as if they do have an actual value and therefore at the
246  // end are also reset to those original values.
247 
248  //...calculates the forces between the two objects...
249  i->computeForce();
250 
251  //...and applies them to each of the two objects (wall and particle).
252  p->addForce(i->getForce());
253  w->addForce(-i->getForce());
254 
255  //If the rotation flag is on, also applies the relevant torques (getRotation() returns a boolean).
256  if (getHandler()->getDPMBase()->getRotation())
257  {
258  p->addTorque(i->getTorque() - Vec3D::cross(p->getPosition() - i->getContactPoint(), i->getForce()));
260  w->addTorque(-i->getTorque() + Vec3D::cross(w->getPosition() - i->getContactPoint(), i->getForce()));
261  }
262 
263  // Set the TriangleWall position and velocities back to their original (local) values.
264  w->setPosition(wPosOriginal);
265  w->addVelocity(-getVelocity());
266  w->addAngularVelocity(-getAngularVelocity());
267  }
268 
269  // Return no interaction for the main wall itself.
270  return nullptr;
271 }
RowVector3d w
Definition: Matrix_resize_int.cpp:3
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:453
Defines the basic properties that a interactable object can have.
Definition: BaseInteractable.h:34
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
Definition: BaseInteractable.cc:319
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:307
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:39
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:97
Basic class for walls.
Definition: BaseWall.h:28
WallHandler * getHandler() const
A function which returns the WallHandler that handles this BaseWall.
Definition: BaseWall.cc:113
BaseInteraction * getInteraction(BaseInteractable *P, BaseInteractable *I, unsigned timeStamp)
Returns the Interaction between the BaseInteractable's P and I.
Definition: InteractionHandler.cc:126
void rotate(const Vec3D &angularVelocity) override
Rotates this BaseInteractable.
Definition: TriangleMeshWall.cc:921
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:143

References Vec3D::cross(), BaseInteractable::getAngularVelocity(), BaseWall::getHandler(), BaseObject::getIndex(), InteractionHandler::getInteraction(), BaseInteractable::getOrientation(), BaseInteractable::getPosition(), BaseInteractable::getVelocity(), i, isWithinBoundingBox(), p, BaseHandler< T >::removeObject(), rotate(), plotPSD::t, triangles_, and w.

◆ getName()

std::string TriangleMeshWall::getName ( ) const
overridevirtual

Returns the name of the object.

Returns
"TriangleMeshWall"

Implements BaseObject.

Reimplemented in WearableTriangleMeshWall.

108 {
109  return "TriangleMeshWall";
110 }

◆ getNumberOfSegmentsAndResolution()

int TriangleMeshWall::getNumberOfSegmentsAndResolution ( Mdouble  length,
Mdouble resolution 
)
private

Finds the number of segments and the resolution needed to perfectly fit a length.

Parameters
lengthTotal length
resolutionMaximum length of a segment, will be made smaller when needed.
Returns
Resulting number of segments.
763 {
764  // Round up to get a whole number of segments, then update the resolution (might remain unchanged).
765  double num = std::ceil(length / resolution);
766  resolution = length / num;
767  return static_cast<int>(num);
768 }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 ceil(const bfloat16 &a)
Definition: BFloat16.h:644

References Eigen::bfloat16_impl::ceil().

Referenced by createParallelogramMesh().

◆ getPeriodicCompanions()

std::vector< unsigned > TriangleMeshWall::getPeriodicCompanions ( unsigned  index)
private

Looks up the companions belonging to a vertex index, if it has any.

Parameters
indexIndex of the vertex to lookup the companions for.
Returns
Vector of vertex indices of the companions.
517 {
518  std::vector<unsigned> indices;
519 
520  // Loop through the companions, compare the index with both pair values and add the other to the return vector in case of a match.
521  for (auto& p : periodicCompanions_)
522  {
523  if (p.first == index)
524  indices.push_back(p.second);
525  else if (p.second == index)
526  indices.push_back(p.first);
527  }
528 
529  return indices;
530 }

References p, and periodicCompanions_.

Referenced by moveVertex().

◆ getVolumeTetrahedron()

Mdouble TriangleMeshWall::getVolumeTetrahedron ( const Vec3D a,
const Vec3D b,
const Vec3D c,
const Vec3D d 
)

Calculates the volume of a tetrahedron formed by 4 vertices.

Returns
Volume of tetrahedron
641 {
642  return std::fabs(Vec3D::dot((a-d), Vec3D::cross((b-d), (c-d)))) / 6.0;
643 }
Scalar * b
Definition: benchVecAdd.cpp:17
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:56
const Scalar * a
Definition: level2_cplx_impl.h:32
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
int c
Definition: calibrate.py:100

References a, b, calibrate::c, Vec3D::cross(), Vec3D::dot(), and boost::multiprecision::fabs().

Referenced by moveVerticesToMatchVolume().

◆ isLocal()

bool TriangleMeshWall::isLocal ( Vec3D min,
Vec3D max 
) const
overridevirtual

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.

835 {
838  return true;
839 }
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23

References boundingBoxMaxGlobal_, boundingBoxMinGlobal_, max, and min.

◆ isWithinBoundingBox()

bool TriangleMeshWall::isWithinBoundingBox ( const Vec3D position,
Mdouble  radius 
) const
private

Checks whether or not a part of the particle is within the bounding box.

Parameters
positionPosition of the particle
radiusInteraction radius of the particle
Returns
True when within the box
842 {
845  return position >= min && max >= position;
846 }
radius
Definition: UniformPSDSelfTest.py:15

References boundingBoxMax_, boundingBoxMin_, max, min, and UniformPSDSelfTest::radius.

Referenced by getDistanceAndNormal(), and getInteractionWith().

◆ move()

void TriangleMeshWall::move ( const Vec3D move)
overridevirtual

Moves this BaseInteractable by adding an amount to the position.

Moves (displaces) the interacable a given distance. Note, this just updates the position by the move.

Parameters
[in]moveReference to Vec3D which is the distance to move the interactable.

Reimplemented from BaseInteractable.

916 {
919 }
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
Definition: BaseInteractable.cc:193
void move(const Vec3D &move) override
Moves this BaseInteractable by adding an amount to the position.
Definition: TriangleMeshWall.cc:915
void updateBoundingBoxGlobal()
Sets the global bounding box, using the bounding box in lab frame. This method should be called when ...
Definition: TriangleMeshWall.cc:868

References BaseInteractable::move(), and updateBoundingBoxGlobal().

◆ moveVertex()

void TriangleMeshWall::moveVertex ( unsigned  index,
const Vec3D dP 
)

Updates a vertex by a given change in position.

Parameters
indexIndex of vertex to move.
dPChange in position.
308 {
309  // Update position of Vertex in vector.
310  vertices_[index].position += dP;
311 
312  // Update each Triangle wall of the triangles who share this Vertex.
313  for (auto& ti : vertices_[index].triangleIndices)
314  triangles_[ti.first].wall.moveVertex(ti.second, dP);
315 
316  // Do the same for each of the possible companions of this index.
317  for (unsigned idx : getPeriodicCompanions(index))
318  {
319  // Update position of Vertex in vector.
320  vertices_[idx].position += dP;
321 
322  // Update each Triangle wall of the triangles who share this Vertex.
323  for (auto& ti : vertices_[idx].triangleIndices)
324  triangles_[ti.first].wall.moveVertex(ti.second, dP);
325  }
326 
328 }
std::vector< unsigned > getPeriodicCompanions(unsigned index)
Looks up the companions belonging to a vertex index, if it has any.
Definition: TriangleMeshWall.cc:516

References getPeriodicCompanions(), triangles_, updateBoundingBox(), and vertices_.

◆ moveVerticesToMatchVolume()

void TriangleMeshWall::moveVerticesToMatchVolume ( std::vector< Vec3D displacements,
Mdouble  targetVolume,
int  maxNumRecursiveCalls = 15 
)

Moves all vertices by given displacements and corrects to match the change in volume with the target volume. The final displacements will be proportional to the initial ones, but their actual values will have change.

Warning
This calculates absolute volume and might cause unexpected results when volume is both 'added' and 'removed'.
Parameters
displacementsInitial change in position for each vertex.
targetVolumeVolume that the change in volume must match.
maxNumRecursiveCallsMaximum number of recursive calls allowed, in case certain tolerances are set too tight and infinite recursion occurs.
533 {
534  // Calculating the change in volume due to a moving triangle isn't analytically possible (not that I know of).
535  // This is because when two vertices are moved, they don't necessarily lie in a plane with the original positions.
536  // An approximation would be to split up the plane by picking one of the two diagonals, but which one to pick?
537  // Luckily we are in a mesh and therefore the choice doesn't matter, as the neighbour will correct for any errors.
538  // Only the edges of the mesh will then be an approximation, which is just something we have to live with.
539 
540  // The volume of the shape formed by the original and moved triangle can be calculated by splitting it up into 3
541  // tetrahedrons. Each of these tetrahedrons is automatically formed when moving and updating the vertices one by one.
542  // Therefore we simply loop through all the vertices in the mesh and for each of the triangles connected to it, we
543  // calculate the volume of the tetrahedron formed by the 3 original vertices and the current updated vertex. The
544  // latter is only actually updated after these volume calculations, so that they're not influenced by it. However
545  // when this vertex is referenced in the remainder of the loop, the updated version is used, since that then forms
546  // the second or third tetrahedron.
547 
548  // The total volume is kept track of and together with the target volume a ratio which is used to correct the vertex
549  // displacements. A recursive call is then made with the corrected displacements. The recursion is stopped when the
550  // ratio equals 1 and only then we actually know the displacements needed to get a change in volume matching the
551  // target volume, which is then used to actually update the real vertices, i.e. the privately stored ones.
552 
553  if (targetVolume == 0.0)
554  return;
555 
556  if (displacements.size() != vertices_.size())
557  {
558  logger(WARN, "Displacements vector must be equal in size as the number of vertices in the mesh.");
559  return;
560  }
561 
562  // In order to know if we are on the first run of this recursive method,
563  // we store a static boolean and reset it once the recursion ends.
564  static bool firstRecursiveCall = true;
565  if (firstRecursiveCall)
566  {
567  firstRecursiveCall = false;
568 
569  // The vertex periodic companions are handled by adding the displacements to each other (only done once, on first run).
570  // As one vertex can have multiple periodic companions, we first copy the displacements vector.
571  // To prevent unnecessarily copying, however, we first check if there are any periodic companions.
572  if (!periodicCompanions_.empty())
573  {
574  std::vector<Vec3D> disps = displacements;
575  for (auto& p : periodicCompanions_)
576  {
577  displacements[p.first] += disps[p.second];
578  displacements[p.second] += disps[p.first];
579  }
580  }
581  }
582 
583  // Every call a clean copy of the original real vertices is made, so that they can be updated without affecting anything.
584  std::vector<Vertex> vertices = vertices_;
585  Mdouble totalVolume = 0.0;
586 
587  // Loop through vertices to displace them and calculate the change in volume for each triangle connected to it.
588  for (int i = 0; i < vertices.size(); i++)
589  {
590  // Loop through each triangle connected to this vertex.
591  for (auto& p : vertices[i].triangleIndices)
592  {
593  Triangle& t = triangles_[p.first];
594  // Calculate the volume of the tetrahedron formed by each of the vertices of the triangle
595  // (one of which is the current vertex) and the updated position of the current vertex.
596  totalVolume += getVolumeTetrahedron(vertices[t.vertexIndices[0]].position,
597  vertices[t.vertexIndices[1]].position,
598  vertices[t.vertexIndices[2]].position,
599  vertices[i].position + displacements[i]);
600  }
601 
602  // Only now actually update the current vertex position.
603  vertices[i].position += displacements[i];
604  }
605 
606  // Ratio between the target volume and actual volume
607  Mdouble ratio = targetVolume / totalVolume;
608 
609  // Stop the recursive call when the ratio is equal to 1 (within certain tolerance).
610  // Or when the ratio does not have a finite value (totalVolume turned out to be 0).
611  Mdouble tol = 1.0e-6;
612  if (mathsFunc::isEqual(ratio, 1.0, tol) || !std::isfinite(ratio) || maxNumRecursiveCalls == 0)
613  {
614  if (maxNumRecursiveCalls == 0)
615  logger(WARN, "[TriangleMeshWall::moveVerticesToMatchVolume()] Maximum number of recursion calls reached for wall with id %.", getId());
616 
617  // Update the real vertices.
618  int num = vertices_.size();
619  for (int i = 0; i < num; i++)
620  vertices_[i].position += displacements[i];
621 
622  // Update the real triangles wall.
623  for (Triangle& t : triangles_)
624  t.wall.moveVertices({ displacements[t.vertexIndices[0]], displacements[t.vertexIndices[1]], displacements[t.vertexIndices[2]] });
625 
627 
628  // Reset static boolean for the next time this function is first called.
629  firstRecursiveCall = true;
630  return;
631  }
632 
633  // Multiply all displacements with the ratio.
634  for (Vec3D& d : displacements)
635  d *= ratio;
636  // Recursive call.
637  moveVerticesToMatchVolume(displacements, targetVolume, --maxNumRecursiveCalls);
638 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ WARN
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:104
void moveVerticesToMatchVolume(std::vector< Vec3D > displacements, Mdouble targetVolume, int maxNumRecursiveCalls=15)
Moves all vertices by given displacements and corrects to match the change in volume with the target ...
Definition: TriangleMeshWall.cc:532
Mdouble getVolumeTetrahedron(const Vec3D &a, const Vec3D &b, const Vec3D &c, const Vec3D &d)
Calculates the volume of a tetrahedron formed by 4 vertices.
Definition: TriangleMeshWall.cc:640
#define isfinite(X)
Definition: main.h:111
bool isEqual(Mdouble v1, Mdouble v2, Mdouble absError)
Compares the difference of two Mdouble with an absolute error, useful in UnitTests.
Definition: ExtendedMath.cc:230

References BaseObject::getId(), getVolumeTetrahedron(), i, mathsFunc::isEqual(), isfinite, logger, p, periodicCompanions_, plotPSD::t, triangles_, updateBoundingBox(), vertices_, and WARN.

Referenced by WearableTriangleMeshWall::computeWear().

◆ operator=()

TriangleMeshWall & TriangleMeshWall::operator= ( const TriangleMeshWall other)

Copy assignment operator.

Parameters
otherThe TriangleMeshWall that must be copied.
Returns
39 {
40  if (this == &other)
41  {
42  return *this;
43  }
44  return *(other.copy());
45 }
TriangleMeshWall * copy() const override
Wall copy method.
Definition: TriangleMeshWall.cc:47

References copy().

◆ read()

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

Reads a TriangleMeshWall from an input stream, for example a restart file.

Reimplemented from BaseWall.

Reimplemented in WearableTriangleMeshWall.

53 {
54  BaseWall::read(is);
55 
56  std::string dummy;
57  int num;
58  is >> dummy >> num;
59 
60  std::vector<Vec3D> points(num);
61  for (int i = 0; i < num; i++)
62  {
63  Vec3D p;
64  is >> p;
65  points[i] = p;
66  }
67 
68  is >> dummy >> num;
69  std::vector<std::array<unsigned, 3>> cells(num);
70  for (int i = 0; i < num; i++)
71  {
72  std::array<unsigned, 3> c{};
73  is >> c[0] >> c[1] >> c[2];
74  cells[i] = c;
75  }
76 
77  is >> dummy >> num;
78  std::vector<std::pair<unsigned, unsigned>> periodicCompanions(num);
79  for (int i = 0; i < num; i ++)
80  {
81  std::pair<unsigned, unsigned> p;
82  is >> p.first >> p.second;
83  periodicCompanions[i] = p;
84  }
85 
86  set(points, cells);
87  setPeriodicCompanions(periodicCompanions);
88 
90 }
void read(std::istream &is) override
Function that reads a BaseWall from an input stream, usually a restart file.
Definition: BaseWall.cc:57
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References calibrate::c, i, p, BaseWall::read(), set(), setPeriodicCompanions(), oomph::Global_string_for_annotation::string(), and updateBoundingBox().

Referenced by WearableTriangleMeshWall::read().

◆ refineTriangle()

void TriangleMeshWall::refineTriangle ( unsigned  index,
unsigned  numberOfTimes = 1 
)

Makes a really basic refinement by adding a vertex in the middle of the triangle to create 3 new ones. Note: Multiple refinements will definitely NOT create a nice mesh.

Warning
For now can only be used in initial setup, i.e. when there are no interactions yet. Interactions have to be projected onto newly formed triangles, which is not yet implemented.
Parameters
indexIndex of triangle to refine.
numberOfTimesHow many times to refine.
407 {
408  // A new vertex will be added in the middle of the triangle and 3 new triangles will be formed. The original triangle
409  // will not be deleted, as erasing items from a vector can be slow. Instead its vertices positions and indices will
410  // be updated to form one of the smaller triangles.
411  // The local vertex indices are 0, 1, 2 and the newly added 3. The original triangle will go from 0, 1, 2 to 0, 1, 3.
412  // The first new triangle will have indices 1, 2, 3, and the second 2, 0, 3.
413 
414  // (1) (2)
415  // _____________________________________
416  // \\ //
417  // \ \ / /
418  // \ \ / /
419  // \ \ / /
420  // \ \ / /
421  // \ \ / /
422  // \ \ / /
423  // \ |(3) /
424  // \ | /
425  // \ | /
426  // \ | /
427  // \ | /
428  // \ | /
429  // \ | /
430  // \ | /
431  // \ | /
432  // \ |/
433  // \/
434  // (0)
435 
436  // Reserve space for 2 new triangles and 1 new vertex, otherwise references will be broken when adding to vectors.
437  triangles_.reserve(triangles_.size() + 2);
438  vertices_.reserve(vertices_.size() + 1);
439 
440  // The triangle to refine.
441  Triangle& t = triangles_[index];
442 
443  // And its vertices.
444  Vertex& v0 = vertices_[t.vertexIndices[0]];
445  Vertex& v1 = vertices_[t.vertexIndices[1]];
446  Vertex& v2 = vertices_[t.vertexIndices[2]];
447 
448  // Center of triangle is position for new vertex.
449  const Vec3D p3 = (v0.position + v1.position + v2.position) / 3.0;
450  vertices_.emplace_back(p3);
451  const unsigned v3Index = vertices_.size() - 1;
452  Vertex& v3 = vertices_[v3Index];
453 
454  // First new triangle.
455  TriangleWall tw1;
456  tw1.setVertices(v1.position, v2.position, v3.position);
457  tw1.setSpecies(t.wall.getSpecies());
458  Triangle t1(tw1, { t.vertexIndices[1], t.vertexIndices[2], v3Index });
459  triangles_.push_back(t1);
460 
461  // Second new triangle.
462  TriangleWall tw2;
463  tw2.setVertices(v2.position, v0.position, v3.position);
464  tw2.setSpecies(t.wall.getSpecies());
465  Triangle t2(tw2, { t.vertexIndices[2], t.vertexIndices[0], v3Index });
466  triangles_.push_back(t2);
467 
468  // Their indices for access in the triangles vector.
469  const unsigned t2Index = triangles_.size() - 1;
470  const unsigned t1Index = t2Index - 1;
471 
472  // Store the new triangle index and its local vertex index in the vertices.
473  v0.triangleIndices.emplace_back(t2Index, 1);
474  v1.triangleIndices.emplace_back(t1Index, 0);
475  v2.triangleIndices.emplace_back(t1Index, 1);
476  // The original triangle does not share vertex 2 anymore, so overwrite its index with that of the second new triangle.
477  for (auto& p : v2.triangleIndices)
478  {
479  if (p.first == index)
480  {
481  p = std::pair<unsigned, unsigned>(t2Index, 0);
482  break;
483  }
484  }
485 
486  // Store the triangles indices and local vertex indices in the newly added vertex.
487  v3.triangleIndices.emplace_back(index, 2);
488  v3.triangleIndices.emplace_back(t1Index, 2);
489  v3.triangleIndices.emplace_back(t2Index, 2);
490 
491  // Overwrite the second vertex index of the original triangle with the newly added vertex.
492  t.vertexIndices[2] = v3Index;
493  // Update the original triangle vertex positions.
494  t.wall.setVertices(v0.position, v1.position, v3.position);
495 
496  // Recursion, for multiple refinements.
497  if (numberOfTimes > 1)
498  {
499  numberOfTimes--;
500  // The newly added vertex shares all three new triangles, so remember their indices.
501  const unsigned idx0 = v3.triangleIndices[0].first;
502  const unsigned idx1 = v3.triangleIndices[1].first;
503  const unsigned idx2 = v3.triangleIndices[2].first;
504  // Then refine each of the new triangles.
505  refineTriangle(idx0, numberOfTimes);
506  refineTriangle(idx1, numberOfTimes);
507  refineTriangle(idx2, numberOfTimes);
508  }
509 }
Map< RowVectorXf > v2(M2.data(), M2.size())
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:148
void refineTriangle(unsigned index, unsigned numberOfTimes=1)
Makes a really basic refinement by adding a vertex in the middle of the triangle to create 3 new ones...
Definition: TriangleMeshWall.cc:406
A TriangleWall is convex polygon defined as an intersection of InfiniteWall's.
Definition: TriangleWall.h:36
void setVertices(Vec3D A, Vec3D B, Vec3D C)
Sets member variables such that the wall represents a triangle with vertices A, B,...
Definition: TriangleWall.cc:144

References p, TriangleMeshWall::Vertex::position, BaseWall::setSpecies(), TriangleWall::setVertices(), plotPSD::t, TriangleMeshWall::Vertex::triangleIndices, triangles_, v1(), v2(), and vertices_.

◆ removeTriangle()

void TriangleMeshWall::removeTriangle ( unsigned  index,
bool  removeFreeVertex = true 
)

Removes a single triangle from the mesh.

Parameters
indexIndex of triangle to remove.
removeFreeVertexRemoves a vertex when it has no more triangles attached to it.
331 {
332  // Remove any interactions the TriangleWall might have.
333  // Otherwise later when in DPMBase interactionHandler.eraseOldInteractions(getNumberOfTimeSteps()) is called it
334  // might cause crashes, since it might be trying to delete pointers which are already used for something else.
335  for (BaseInteraction* i : triangles_[index].wall.getInteractions())
336  i->removeFromHandler();
337 
338  // Swap to Triangle with the last Triangle in the vector and then simply pop_back. This is faster, cleaner and
339  // simpler then using erase and having to update all other Triangle indices, since every index higher than the
340  // removed one would have shifted one down. Now only the swapped Triangle index references have to be updated.
341  const unsigned lastIndex = triangles_.size() - 1;
342  Triangle triangleToRemove = triangles_[index];
343 
344  // Don't swap right way, since the swapped Triangle index references need to be updated, but since it's possible
345  // that a free Vertex will be removed this might cause wrong index referencing.
346  // So first remove the index reference to this Triangle, for each of its Vertices.
347  for (unsigned vi : triangleToRemove.vertexIndices)
348  {
349  // Get the Triangle indices from this Vertex.
350  auto& tis = vertices_[vi].triangleIndices;
351  // Erase the index of the removed Triangle. This is only a short vector so erase is fine.
352  // This will only remove one item, as it should only contain it once.
353  tis.erase(std::remove_if(tis.begin(), tis.end(),[index](auto& p) { return p.first == index; }));
354 
355  // When no other Triangles are connected to this Vertex, it might be erased from the vector.
356  if (removeFreeVertex && tis.empty())
357  {
358  // Removing a Vertex is done in a similar manner, by swapping and popping back.
359  const unsigned lastIndexV = vertices_.size() - 1;
360  Vertex vertexToRemove = vertices_[vi];
361  vertices_[vi] = vertices_[lastIndexV];
362  vertices_[lastIndexV] = vertexToRemove;
363  vertices_.pop_back();
364 
365  // No Triangles with index references to the removed Vertex exist.
366  // However, for every Triangle which is referencing the swapped Vertex, update the index with the removed index.
367  for (auto& ti : vertices_[vi].triangleIndices)
368  for (unsigned& tvi : triangles_[ti.first].vertexIndices)
369  if (tvi == lastIndexV)
370  {
371  tvi = vi;
372  break;
373  }
374 
375  // If this vertex has any periodic companions, those should be removed from the vector.
376  periodicCompanions_.erase(std::remove_if(periodicCompanions_.begin(), periodicCompanions_.end(),
377  [vi](auto& p) { return p.first == vi || p.second == vi; }), periodicCompanions_.end());
378  // Also the swapped index should be updated with the removed index.
379  for (auto& p : periodicCompanions_)
380  {
381  if (p.first == lastIndexV)
382  p.first = vi;
383  else if (p.second == lastIndexV)
384  p.second = vi;
385  }
386  }
387  }
388 
389  // Now swap the Triangles and pop back.
390  triangles_[index] = triangles_[lastIndex];
391  triangles_[lastIndex] = triangleToRemove;
392  triangles_.pop_back();
393 
394  // For every Vertex which is referencing the swapped Triangle, update the index with the removed index.
395  for (unsigned& vi : triangles_[index].vertexIndices)
396  for (auto& ti : vertices_[vi].triangleIndices)
397  if (ti.first == lastIndex)
398  {
399  ti.first = index;
400  break;
401  }
402 
404 }

References i, p, periodicCompanions_, triangles_, updateBoundingBox(), TriangleMeshWall::Triangle::vertexIndices, and vertices_.

◆ resetForceTorque()

void TriangleMeshWall::resetForceTorque ( int  numberOfOMPthreads)
overridevirtual

Reimplemented from BaseInteractable.

274 {
275  BaseWall::resetForceTorque(numberOfOMPthreads);
276 
277  for (auto& t : triangles_)
278  t.wall.resetForceTorque(numberOfOMPthreads);
279 }
virtual void resetForceTorque(int numberOfOMPthreads)
Definition: BaseInteractable.cc:119

References BaseInteractable::resetForceTorque(), plotPSD::t, and triangles_.

◆ rotate()

void TriangleMeshWall::rotate ( const Vec3D angularVelocityDt)
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.

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 from BaseInteractable.

922 {
923  BaseWall::rotate(angularVelocity);
925 }
virtual void rotate(const Vec3D &angularVelocityDt)
Rotates this BaseInteractable.
Definition: BaseInteractable.cc:208

References BaseInteractable::rotate(), and updateBoundingBoxGlobal().

Referenced by getInteractionWith(), and writeVTK().

◆ set()

void TriangleMeshWall::set ( const std::vector< Vec3D > &  points,
const std::vector< std::array< unsigned, 3 >> &  cells 
)

Set function creating triangles.

Parameters
pointsVector of vertices
cellsVector of cells, each cell holds three indices to the points vector
113 {
114  // The species for the triangles are the same as the main wall.
115  // Note: when the species have not been set yet, this will be a nullptr,
116  // so a check is done before actually setting the species for the triangles.
117  auto species = getSpecies();
118 
119  // Clear mesh, as set function can be called multiple times to create different meshes. Useful when creating a
120  // complicated mesh with the addToMesh() function.
121  triangles_.clear();
122  vertices_.clear();
123  triangles_.reserve(cells.size());
124  vertices_.reserve(points.size());
125 
126  // Add all the points as Vertex to the vector.
127  for (auto& p : points)
128  vertices_.emplace_back(p);
129 
130  for (auto& c : cells)
131  {
132  TriangleWall tw;
133  // The position is the origin of the local coordinate system, which is always (0, 0, 0) (not getPosition()!).
134  // This is needed in case the mesh has an angular velocity.
135  tw.setVertices(points[c[0]], points[c[1]], points[c[2]], Vec3D(0.0, 0.0, 0.0));
136  if (species != nullptr)
137  tw.setSpecies(species);
138 
139  // Add as Triangle with TriangleWall and vertexIndices to the vector.
140  triangles_.emplace_back(tw, c);
141 
142  // Add the Triangle index and the local vertex index to each of the Vertices.
143  const unsigned tIndex = triangles_.size() - 1;
144  vertices_[c[0]].triangleIndices.emplace_back(tIndex, 0);
145  vertices_[c[1]].triangleIndices.emplace_back(tIndex, 1);
146  vertices_[c[2]].triangleIndices.emplace_back(tIndex, 2);
147  }
148 
150 }
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Definition: BaseInteractable.h:87

References calibrate::c, BaseInteractable::getSpecies(), p, BaseWall::setSpecies(), TriangleWall::setVertices(), triangles_, updateBoundingBox(), and vertices_.

Referenced by createFourPointMesh(), createParallelogramMesh(), read(), and TriangleMeshWall().

◆ setOrientation()

void TriangleMeshWall::setOrientation ( const Quaternion orientation)
overridevirtual

Sets the orientation of this BaseInteractable.

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

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

Reimplemented from BaseInteractable.

910 {
911  BaseWall::setOrientation(orientation);
913 }
virtual void setOrientation(const Quaternion &orientation)
Sets the orientation of this BaseInteractable.
Definition: BaseInteractable.h:239

References BaseInteractable::setOrientation(), and updateBoundingBoxGlobal().

◆ setPeriodicCompanions()

void TriangleMeshWall::setPeriodicCompanions ( const std::vector< std::pair< unsigned, unsigned >> &  periodicCompanions)

Sets the vector with pairs of indices of vertices which lie on a periodic boundary and are each others 'companion'. E.g. when moving one vertex, the other is also moved the same amount. A vertex can have multiple companions (when lying on multiple periodic boundaries) and those should be in the vector as multiple pairs.

Parameters
periodicCompanionsVector of pairs containing the companions.
512 {
513  periodicCompanions_ = periodicCompanions;
514 }

References periodicCompanions_.

Referenced by createParallelogramMesh(), and read().

◆ setPosition()

void TriangleMeshWall::setPosition ( const Vec3D position)
overridevirtual

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.

Reimplemented from BaseInteractable.

904 {
905  BaseWall::setPosition(position);
907 }

References BaseInteractable::setPosition(), and updateBoundingBoxGlobal().

◆ setSpecies()

void TriangleMeshWall::setSpecies ( const ParticleSpecies species)
299 {
300  if (species == nullptr)
301  return;
302  BaseWall::setSpecies(species);
303  for (auto& t : triangles_)
304  t.wall.setSpecies(species);
305 }

References BaseWall::setSpecies(), plotPSD::t, and triangles_.

Referenced by TriangleMeshWall().

◆ updateBoundingBox()

void TriangleMeshWall::updateBoundingBox ( )
private

Sets the local and global bounding boxes. This method should be called any time a vertex is updated in lab frame.

849 {
850  // Initialize min max.
853 
854  // Loop through vertices and store min max positions.
855  for (const Vertex& v : vertices_)
856  {
857  const Vec3D& pos = v.position;
858  min = Vec3D::min(min, pos);
859  max = Vec3D::max(max, pos);
860  }
861 
864 
866 }
static Vec3D max(const Vec3D &a, const Vec3D &b)
Calculates the pointwise maximum of two Vec3D.
Definition: Vector.cc:69
static Vec3D min(const Vec3D &a, const Vec3D &b)
Calculates the pointwise minimum of two Vec3D.
Definition: Vector.cc:82
const Mdouble inf
Definition: GeneralDefine.h:23

References boundingBoxMax_, boundingBoxMin_, constants::inf, max, Vec3D::max(), min, Vec3D::min(), updateBoundingBoxGlobal(), v, and vertices_.

Referenced by addToMesh(), moveVertex(), moveVerticesToMatchVolume(), read(), removeTriangle(), and set().

◆ updateBoundingBoxGlobal()

void TriangleMeshWall::updateBoundingBoxGlobal ( )
private

Sets the global bounding box, using the bounding box in lab frame. This method should be called when there are changes in global frame, but not in lab frame. E.g. when calling setPosition().

869 {
870  // This basically is putting a bounding box around the rotated and translated lab frame bounding box.
871 
872  // All corners of the lab frame bounding box. Using min max for clarity.
874  Vec3D v0 = Vec3D(min.X, min.Y, min.Z);
875  Vec3D v1 = Vec3D(min.X, min.Y, max.Z);
876  Vec3D v2 = Vec3D(max.X, min.Y, max.Z);
877  Vec3D v3 = Vec3D(max.X, min.Y, min.Z);
878  Vec3D v4 = Vec3D(min.X, max.Y, min.Z);
879  Vec3D v5 = Vec3D(min.X, max.Y, max.Z);
880  Vec3D v6 = Vec3D(max.X, max.Y, max.Z);
881  Vec3D v7 = Vec3D(max.X, max.Y, min.Z);
882 
883  // Store in array so we can do a auto loop by reference.
884  std::array<Vec3D, 8> corners = { v0, v1, v2, v3, v4, v5, v6, v7 };
885 
886  // Reinitialize min max to use in loop.
889 
890  // Loop through corners, rotate and translate them to global frame, get global min max position.
891  for (Vec3D& pos : corners)
892  {
893  getOrientation().rotate(pos);
894  pos += getPosition();
895  min = Vec3D::min(min, pos);
896  max = Vec3D::max(max, pos);
897  }
898 
901 }
void rotate(Vec3D &position) const
Definition: Quaternion.cc:550
void corners(const MatrixType &m)
Definition: corners.cpp:17

References boundingBoxMax_, boundingBoxMaxGlobal_, boundingBoxMin_, boundingBoxMinGlobal_, corners(), BaseInteractable::getOrientation(), BaseInteractable::getPosition(), constants::inf, max, Vec3D::max(), min, Vec3D::min(), Quaternion::rotate(), v1(), and v2().

Referenced by move(), rotate(), setOrientation(), setPosition(), and updateBoundingBox().

◆ write()

void TriangleMeshWall::write ( std::ostream &  os) const
overridevirtual

Writes a TriangleMeshWall to an output stream, for example a restart file.

Reimplemented from BaseWall.

Reimplemented in WearableTriangleMeshWall.

93 {
94  BaseWall::write(os);
95 
96  os << " points " << vertices_.size();
97  for (const Vertex& v : vertices_)
98  os << ' ' << v.position;
99  os << " cells " << triangles_.size();
100  for (const Triangle& t : triangles_)
101  os << ' ' << t.vertexIndices[0] << ' ' << t.vertexIndices[1] << ' ' << t.vertexIndices[2];
102  os << " periodicCompanions " << periodicCompanions_.size();
103  for (auto& p : periodicCompanions_)
104  os << ' ' << p.first << ' ' << p.second;
105 }
void write(std::ostream &os) const override
Function that writes a BaseWall to an output stream, usually a restart file.
Definition: BaseWall.cc:79

References p, periodicCompanions_, plotPSD::t, triangles_, v, vertices_, and BaseWall::write().

Referenced by WearableTriangleMeshWall::write().

◆ writeVTK()

void TriangleMeshWall::writeVTK ( VTKContainer vtk) const
overridevirtual

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 from BaseWall.

282 {
283  const unsigned long s = vtk.points.size();
284 
285  for (auto& v : vertices_)
286  {
287  vtk.points.push_back(getOrientation().rotate(v.position) + getPosition());
288  }
289 
290  for (auto& t : triangles_)
291  {
292  vtk.triangleStrips.push_back({ static_cast<double>(s + t.vertexIndices[0]),
293  static_cast<double>(s + t.vertexIndices[1]),
294  static_cast<double>(s + t.vertexIndices[2]) });
295  }
296 }
RealScalar s
Definition: level1_cplx_impl.h:130
std::vector< std::vector< double > > triangleStrips
Definition: BaseWall.h:19
std::vector< Vec3D > points
Definition: BaseWall.h:18

References BaseInteractable::getOrientation(), BaseInteractable::getPosition(), VTKContainer::points, rotate(), s, plotPSD::t, triangles_, VTKContainer::triangleStrips, v, and vertices_.

Member Data Documentation

◆ boundingBoxMax_

Vec3D TriangleMeshWall::boundingBoxMax_
private

◆ boundingBoxMaxGlobal_

Vec3D TriangleMeshWall::boundingBoxMaxGlobal_
private

◆ boundingBoxMin_

Vec3D TriangleMeshWall::boundingBoxMin_
private

Bounding box corners in lab frame and global frame. Used to speed up contact detection. HGrid uses the global frame min max.

Referenced by isWithinBoundingBox(), TriangleMeshWall(), updateBoundingBox(), and updateBoundingBoxGlobal().

◆ boundingBoxMinGlobal_

Vec3D TriangleMeshWall::boundingBoxMinGlobal_
private

◆ periodicCompanions_

std::vector<std::pair<unsigned, unsigned> > TriangleMeshWall::periodicCompanions_
private

◆ triangles_

◆ vertices_


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