IntersectionOfWalls.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef INTERSECTIONOFWALLS_H
6 #define INTERSECTIONOFWALLS_H
7 
8 #include <vector>
9 #include "BaseWall.h"
10 #include "InfiniteWall.h"
11 #include "Math/Vector.h"
12 
38 {
39 public:
41  {
44  };
45 
50 
55 
59  IntersectionOfWalls(const std::vector<normalAndPosition>& walls, const ParticleSpecies* species);
60 
64  ~IntersectionOfWalls() override;
65 
70 
74  IntersectionOfWalls* copy() const override;
75 
79  void clear();
80 
82  void setSpecies(const ParticleSpecies* species);
83 
84  void setHandler(WallHandler* wallHandler) override;
85 
89  unsigned int getNumberOfObjects();
90 
95  void addObject(Vec3D normal, Vec3D point);
96 
97  void addObject(Quaternion orientation, Vec3D position);
98 
99  void add3PointObject(Vec3D PointA, Vec3D PointB, Vec3D PointC);
100 
101  void setPointsAndLines(unsigned int n);
102 
106  void addTetraSTL(Vec3D PointA, Vec3D PointB, Vec3D PointC, Vec3D WallNormal, Mdouble Thickness, int wallidentifier);
107 
111  void addTetra(const Vec3D& PointA, const Vec3D& PointB, const Vec3D& PointC, Mdouble& Thickness);
112 
113 
114  void addPlate(const Vec3D& PointA, const Vec3D& PointB, const Vec3D& PointC, const Vec3D& WallNormal,
115  const Mdouble& Thickness, int wallidentifier);
116 
123  void addObject(Vec3D normal, Mdouble position);
124 
130  void createOpenPrism(std::vector<Vec3D> points, Vec3D prismAxis);
131 
137  void createPrism(std::vector<Vec3D> points, Vec3D prismAxis);
138 
144  void createOpenPrism(std::vector<Vec3D> points);
145 
151  void createPrism(std::vector<Vec3D> points);
152 
157  bool getDistanceAndNormal(const BaseParticle& p, Mdouble& distance, Vec3D& normal_return) const override;
158 
163  bool getDistanceAndNormal(const Vec3D& position, Mdouble wallInteractionRadius, Mdouble& distance,
164  Vec3D& normal_return) const;
165 
170 // void move(const Vec3D& move) override;
171 
175  void read(std::istream& is) override;
176 
180  void write(std::ostream& os) const override;
181 
185  std::string getName() const override;
186 
187  void writeVTK(VTKContainer& vtk) const override;
188 
189 // void rotate(const Vec3D& rotate) override;
190 
191 protected:
198  std::vector<InfiniteWall> wallObjects_;
199 
200 private:
206  std::vector<Vec3D> A_;
207 
213  std::vector<Vec3D> AB_;
214 
215 protected:
221  std::vector<Vec3D> C_;
222 };
223 
224 #endif
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
#define MERCURYDPM_DEPRECATED
Definition: GeneralDefine.h:16
float * p
Definition: Tutorial_Map_using.cpp:9
Definition: BaseParticle.h:33
Basic class for walls.
Definition: BaseWall.h:28
A IntersectionOfWalls is convex polygon defined as an intersection of InfiniteWall's.
Definition: IntersectionOfWalls.h:38
void read(std::istream &is) override
Move the IntersectionOfWalls to a new position, which is a Vec3D from the old position.
Definition: IntersectionOfWalls.cc:725
void clear()
Removes all parts of the walls.
Definition: IntersectionOfWalls.cc:81
void writeVTK(VTKContainer &vtk) const override
Definition: IntersectionOfWalls.cc:773
std::vector< Vec3D > AB_
A vector that stores the direction of the intersecting lines between two different InfiniteWall.
Definition: IntersectionOfWalls.h:213
void addObject(Vec3D normal, Vec3D point)
Adds a wall to the set of infinite walls, given a normal vector pointing into the wall (i....
Definition: IntersectionOfWalls.cc:117
std::vector< InfiniteWall > wallObjects_
The wall "segments"/directions that together make up the finite wall.
Definition: IntersectionOfWalls.h:198
std::vector< Vec3D > A_
A vector that stores a point for each intersecting line between two different InfiniteWall.
Definition: IntersectionOfWalls.h:206
void setPointsAndLines(unsigned int n)
Definition: IntersectionOfWalls.cc:330
void addTetraSTL(Vec3D PointA, Vec3D PointB, Vec3D PointC, Vec3D WallNormal, Mdouble Thickness, int wallidentifier)
constructs a tetrahedron for an STL file input
Definition: IntersectionOfWalls.cc:170
~IntersectionOfWalls() override
Destructor.
Definition: IntersectionOfWalls.cc:46
void createPrism(std::vector< Vec3D > points, Vec3D prismAxis)
Creates an open prism which is a polygon between the points and extends infinitely in the PrismAxis d...
Definition: IntersectionOfWalls.cc:461
void createOpenPrism(std::vector< Vec3D > points, Vec3D prismAxis)
Creates an open prism which is a polygon between the points, except the first and last point,...
Definition: IntersectionOfWalls.cc:446
unsigned int getNumberOfObjects()
Returns the number of objects.
Definition: IntersectionOfWalls.cc:104
IntersectionOfWalls * copy() const override
Wall copy method. It calls the copy constructor of this Wall, useful for polymorphism.
Definition: IntersectionOfWalls.cc:76
std::string getName() const override
Returns the name of the object, here the string "IntersectionOfWalls".
Definition: IntersectionOfWalls.cc:768
std::vector< Vec3D > C_
A vector that stores the intersection point of three different InfiniteWall.
Definition: IntersectionOfWalls.h:221
IntersectionOfWalls & operator=(const IntersectionOfWalls &other)
Definition: IntersectionOfWalls.cc:63
void addTetra(const Vec3D &PointA, const Vec3D &PointB, const Vec3D &PointC, Mdouble &Thickness)
constructs a tetrahedron from 3 input coordinates
Definition: IntersectionOfWalls.cc:239
void addPlate(const Vec3D &PointA, const Vec3D &PointB, const Vec3D &PointC, const Vec3D &WallNormal, const Mdouble &Thickness, int wallidentifier)
Definition: IntersectionOfWalls.cc:276
IntersectionOfWalls()
Default constructor.
Definition: IntersectionOfWalls.cc:12
void setHandler(WallHandler *wallHandler) override
A function which sets the WallHandler for this BaseWall.
Definition: IntersectionOfWalls.cc:90
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....
Definition: IntersectionOfWalls.cc:511
void setSpecies(const ParticleSpecies *species)
sets species of subwalls as well
Definition: IntersectionOfWalls.cc:51
void write(std::ostream &os) const override
Writes an IntersectionOfWalls to an output stream, for example a restart file.
Definition: IntersectionOfWalls.cc:755
void add3PointObject(Vec3D PointA, Vec3D PointB, Vec3D PointC)
Definition: IntersectionOfWalls.cc:138
Definition: ParticleSpecies.h:16
This class contains the 4 components of a quaternion and the standard operators and functions needed ...
Definition: Kernel/Math/Quaternion.h:42
Definition: Kernel/Math/Vector.h:30
Container to store all BaseWall.
Definition: WallHandler.h:22
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
Definition: IntersectionOfWalls.h:41
Vec3D normal
Definition: IntersectionOfWalls.h:42
Vec3D position
Definition: IntersectionOfWalls.h:43
Definition: BaseWall.h:17