Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
MeshPlane.cpp
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2 *
3 *
4 * MoDELib is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_MeshPlane_cpp_
9#define model_MeshPlane_cpp_
10
11#include <numbers>
12#include <cfloat>
13#include <tuple>
14#include <vector>
15#include <Eigen/Dense>
16
17#include <MeshModule.h>
18#include <PolyhedralMesh.h>
19
20namespace model
21{
22
23 /**********************************************************************/
24 template <int dim>
26 {
28 for(const auto& incidence : face.perimeter)
29 {
30 temp.emplace_back(std::make_shared<MeshBoundarySegment<dim>>(
31 incidence.source()->position,incidence.sink()->position,&face));
32 }
33 return temp;
34 }
35
36 /**********************************************************************/
37 template <int dim>
39 {
40
41 if(temp.size()<3)
42 {
43 throw std::runtime_error("MeshPlane: Sorting MeshIntersections failed. temp.size()="+std::to_string(temp.size()));
44 }
45
46 for(const auto& seg : temp)
47 {
48 if(seg->hasZeroLength())
49 {
50 throw std::runtime_error("Plane-Face intersection has zero length");
51 }
52 }
53 }
54
55 /**********************************************************************/
56 template <int dim>
58 const size_t& rID,
59 const VectorDim& p,
60 const VectorDim& n) :
61 /* init */ Plane<dim>(p,n)
62 /* init */,regionIDs(rID,rID)
63 // /* init */,meshIntersections(mesh,rID,*this)
64 /* init */,meshIntersections(BoundingMeshSegments<dim>(mesh,rID,*this))
65 {
72
73 }
74
75 /**********************************************************************/
76 template <int dim>
78 const size_t& rID1,
79 const size_t& rID2) :
80 /* init */ Plane<dim>(face.asPlane())
81 /* init */,regionIDs(rID1,rID2)
82 // /* init */ meshIntersections(getFaceBoundary(face)) // WARNING: CALLING meshIntersections with rID1
83 /* init */,meshIntersections(getFaceBoundary(face))
84 {
86 }
87
88 // /**********************************************************************/
89 // template <class T>
90 // friend T& operator << (T& os, const MeshPlane<dim>& gp)
91 // {
92 // for (const auto& x : gp.meshIntersections)
93 // {
94 // os<<gp.sID<<" "<<*x;
95 // }
96 // return os;
97 // }
98
99 template struct MeshPlane<3>;
100
101}
102#endif
Class template representing a straight line at the intersection of PlanarMeshFaces.
MeshPlane(const SimplicialMesh< dim > &mesh, const size_t &rID, const VectorDim &p, const VectorDim &n)
Definition MeshPlane.cpp:57
const std::pair< int, int > regionIDs
Definition MeshPlane.h:46
static BoundingMeshSegments< dim > getFaceBoundary(const Polyhedron< dim, dim-1 > &face)
Definition MeshPlane.cpp:25
static void checkPlaneIntersections(const BoundingMeshSegments< dim > &temp)
Definition MeshPlane.cpp:38
const BoundingMeshSegments< dim > meshIntersections
Definition MeshPlane.h:47
Eigen::Matrix< double, dim, 1 > VectorDim
Definition MeshPlane.h:36
Plane(const VectorDim &p, const VectorDim &n)
Definition Plane.cpp:20
vertex p[3]
vertex temp