26 #ifndef MERCURYDPM_TRIANGLEMESHWALL_H
27 #define MERCURYDPM_TRIANGLEMESHWALL_H
65 const ParticleSpecies* species =
nullptr,
bool periodicInU =
false,
bool periodicInV =
false);
88 void read(std::istream& is)
override;
93 void write(std::ostream& os)
const override;
99 std::string
getName()
const override;
106 void set(
const std::vector<Vec3D>& points,
const std::vector<std::array<unsigned, 3>>& cells);
148 void removeTriangle(
unsigned index,
bool removeFreeVertex =
true);
216 void rotate(
const Vec3D& angularVelocity)
override;
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
Definition: BaseParticle.h:54
Basic class for walls.
Definition: BaseWall.h:49
Container to store Interaction objects.
Definition: InteractionHandler.h:45
Definition: ParticleSpecies.h:37
This class contains the 4 components of a quaternion and the standard operators and functions needed ...
Definition: Quaternion.h:63
Definition: TriangleMeshWall.h:33
void updateBoundingBox()
Sets the local and global bounding boxes. This method should be called any time a vertex is updated i...
Definition: TriangleMeshWall.cc:869
void write(std::ostream &os) const override
Writes a TriangleMeshWall to an output stream, for example a restart file.
Definition: TriangleMeshWall.cc:113
void setSpecies(const ParticleSpecies *species)
Definition: TriangleMeshWall.cc:319
void set(const std::vector< Vec3D > &points, const std::vector< std::array< unsigned, 3 >> &cells)
Set function creating triangles.
Definition: TriangleMeshWall.cc:133
void move(const Vec3D &move) override
Moves this BaseInteractable by adding an amount to the position.
Definition: TriangleMeshWall.cc:936
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:427
int getNumberOfSegmentsAndResolution(Mdouble length, Mdouble &resolution)
Finds the number of segments and the resolution needed to perfectly fit a length.
Definition: TriangleMeshWall.cc:783
void removeTriangle(unsigned index, bool removeFreeVertex=true)
Removes a single triangle from the mesh.
Definition: TriangleMeshWall.cc:351
std::string getName() const override
Returns the name of the object.
Definition: TriangleMeshWall.cc:128
std::vector< unsigned > getPeriodicCompanions(unsigned index)
Looks up the companions belonging to a vertex index, if it has any.
Definition: TriangleMeshWall.cc:537
TriangleMeshWall * copy() const override
Wall copy method.
Definition: TriangleMeshWall.cc:68
void rotate(const Vec3D &angularVelocity) override
Rotates this BaseInteractable.
Definition: TriangleMeshWall.cc:942
Vec3D boundingBoxMax_
Definition: TriangleMeshWall.h:272
TriangleMeshWall & operator=(const TriangleMeshWall &other)
Copy assignment operator.
Definition: TriangleMeshWall.cc:59
Vec3D boundingBoxMinGlobal_
Definition: TriangleMeshWall.h:273
void resetForceTorque(int numberOfOMPthreads) override
Definition: TriangleMeshWall.cc:294
void writeVTK(VTKContainer &vtk) const override
Definition: TriangleMeshWall.cc:302
Vec3D boundingBoxMaxGlobal_
Definition: TriangleMeshWall.h:273
void moveVertex(unsigned index, const Vec3D &dP)
Updates a vertex by a given change in position.
Definition: TriangleMeshWall.cc:328
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:791
void setPosition(const Vec3D &position) override
Sets the position of this BaseInteractable.
Definition: TriangleMeshWall.cc:924
void updateBoundingBoxGlobal()
Sets the global bounding box, using the bounding box in lab frame. This method should be called when ...
Definition: TriangleMeshWall.cc:889
std::vector< std::pair< unsigned, unsigned > > periodicCompanions_
Definition: TriangleMeshWall.h:262
void addToMesh(TriangleMeshWall mesh)
Adds a mesh to this mesh. When vertices share a position, only the one in the current mesh is kept an...
Definition: TriangleMeshWall.cc:666
Vec3D boundingBoxMin_
Bounding box corners in lab frame and global frame. Used to speed up contact detection....
Definition: TriangleMeshWall.h:272
~TriangleMeshWall() override=default
Destructor.
TriangleMeshWall()=default
Default constructor.
std::vector< Triangle > triangles_
Definition: TriangleMeshWall.h:258
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:862
BaseInteraction * getInteractionWith(BaseParticle *p, unsigned timeStamp, InteractionHandler *interactionHandler) override
Gets the interaction between a given BaseParticle and all TriangleWalls in this mesh at a given time....
Definition: TriangleMeshWall.cc:192
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:553
std::vector< Vertex > vertices_
Definition: TriangleMeshWall.h:259
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:661
bool isLocal(Vec3D &min, Vec3D &max) const override
Definition: TriangleMeshWall.cc:855
void read(std::istream &is) override
Reads a TriangleMeshWall from an input stream, for example a restart file.
Definition: TriangleMeshWall.cc:73
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...
Definition: TriangleMeshWall.cc:819
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:532
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:731
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 i...
Definition: TriangleMeshWall.cc:173
void setOrientation(const Quaternion &orientation) override
Sets the orientation of this BaseInteractable.
Definition: TriangleMeshWall.cc:930
A TriangleWall is convex polygon defined as an intersection of InfiniteWall's.
Definition: TriangleWall.h:57
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
Definition: TriangleMeshWall.h:220
std::array< unsigned, 3 > vertexIndices
Array of indices to the vertices vector of the 3 vertices the triangle is made of.
Definition: TriangleMeshWall.h:237
Triangle(const TriangleWall &w, std::array< unsigned, 3 > vi)
Constructor setting values.
Definition: TriangleMeshWall.h:231
TriangleWall wall
The TriangleWall.
Definition: TriangleMeshWall.h:231
Triangle()=default
Default constructor.
Definition: TriangleMeshWall.h:241
Vertex()=default
Default constructor.
std::vector< std::pair< unsigned, unsigned > > triangleIndices
Definition: TriangleMeshWall.h:254
Vertex(Vec3D P)
Definition: TriangleMeshWall.h:247
Vec3D position
The vertex position.
Definition: TriangleMeshWall.h:247
Definition: BaseWall.h:38