Chi-Tech
meshcutting.h
Go to the documentation of this file.
1#ifndef CHI_MESH_MESH_CUTTING_H
2#define CHI_MESH_MESH_CUTTING_H
3
4#include "mesh/chi_mesh.h"
5#include "mesh/Cell/cell.h"
6
7namespace chi_mesh
8{
9namespace mesh_cutting
10{
11 typedef std::pair<uint64_t, uint64_t> Edge;
12
13 /**A general structure storing the two vertex-ids
14 * to be cut or being cut. Additionally a cut-point
15 * id is stored.*/
16 struct ECI //EdgeCutInfo
17 {
19 uint64_t cut_point_id=0;
20
21 ECI() = default;
22
23 explicit ECI(Edge in_edge,
24 uint64_t in_cutpoint_id) :
25 vertex_ids(std::move(in_edge)),
26 cut_point_id(in_cutpoint_id)
27 {}
28
29 static
30 bool Comparator(const ECI& edge_cut_info,
31 const Edge& ref_edge)
32 {
33 return ref_edge == edge_cut_info.vertex_ids;
34 }
35 };
36
37 //2D_utils
38 Edge MakeUniqueEdge(const Edge& edge);
39 Edge MakeEdgeFromPolygonEdgeIndex(const std::vector<uint64_t>& vertex_ids,
40 size_t edge_index);
42 const chi_mesh::MeshContinuum& grid);
43
45 const MeshContinuum& mesh,
46 const std::vector<uint64_t>& vertex_ids,
47 chi_mesh::Cell& cell);
48
49 bool CheckPolygonQuality(const MeshContinuum& mesh,
50 const chi_mesh::Cell& cell,
51 bool check_convexity=false);
52
53 //2D_cutcell
54 void CutPolygon(const std::vector<ECI>& cut_edges,
55 const std::set<uint64_t>& cut_vertices,
56 const Vector3 &plane_point,
57 const Vector3 &plane_normal,
58 MeshContinuum& mesh,
59 chi_mesh::Cell& cell);
60
61 //3D_utils
63 const chi_mesh::Cell& cell,
64 bool check_convexity=false);
65
66 std::set<size_t> FindNeighborFaceIndices(
67 const std::vector<std::vector<uint64_t>>& proxy_faces,
68 size_t face_index);
69
70 std::vector<Edge> FindNonManifoldEdges(
71 const std::vector<std::vector<uint64_t>>& proxy_faces);
72
73 std::vector<Edge> StitchEdgesEndToEnd(
74 const std::vector<Edge>& edges);
75
77 const MeshContinuum& mesh,
78 const std::vector<std::vector<uint64_t>>& raw_faces,
79 chi_mesh::Cell& cell);
80
81
82 //3D_cutcell
83 void Cut3DCell(const std::vector<ECI>& global_cut_edges,
84 const std::set<uint64_t>& number,
85 const Vector3 &plane_point,
86 const Vector3 &plane_normal,
87 double float_compare,
88 MeshContinuum& mesh,
89 chi_mesh::Cell& cell,
90 bool verbose=false);
91
92 //plane
94 const Vector3& plane_point,
95 const Vector3& plane_normal,
96 double merge_tolerance=1.0e-3,
97 double float_compare=1.0e-10);
98}
99}
100
101#endif //CHI_MESH_MESH_CUTTING_H
void PopulatePolygonFromVertices(const MeshContinuum &mesh, const std::vector< uint64_t > &vertex_ids, chi_mesh::Cell &cell)
Edge MakeUniqueEdge(const Edge &edge)
std::set< size_t > FindNeighborFaceIndices(const std::vector< std::vector< uint64_t > > &proxy_faces, size_t face_index)
void CutMeshWithPlane(MeshContinuum &mesh, const Vector3 &plane_point, const Vector3 &plane_normal, double merge_tolerance=1.0e-3, double float_compare=1.0e-10)
void CutPolygon(const std::vector< ECI > &cut_edges, const std::set< uint64_t > &cut_vertices, const Vector3 &plane_point, const Vector3 &plane_normal, MeshContinuum &mesh, chi_mesh::Cell &cell)
Edge MakeEdgeFromPolygonEdgeIndex(const std::vector< uint64_t > &vertex_ids, size_t edge_index)
std::vector< Edge > FindNonManifoldEdges(const std::vector< std::vector< uint64_t > > &proxy_faces)
void Cut3DCell(const std::vector< ECI > &global_cut_edges, const std::set< uint64_t > &number, const Vector3 &plane_point, const Vector3 &plane_normal, double float_compare, MeshContinuum &mesh, chi_mesh::Cell &cell, bool verbose=false)
void PopulatePolyhedronFromFaces(const MeshContinuum &mesh, const std::vector< std::vector< uint64_t > > &raw_faces, chi_mesh::Cell &cell)
std::vector< Edge > StitchEdgesEndToEnd(const std::vector< Edge > &edges)
bool CheckPolyhedronQuality(const MeshContinuum &mesh, const chi_mesh::Cell &cell, bool check_convexity=false)
bool CheckPolygonQuality(const MeshContinuum &mesh, const chi_mesh::Cell &cell, bool check_convexity=false)
chi_mesh::Vector3 GetEdgeCentroid(const Edge &edge, const chi_mesh::MeshContinuum &grid)
std::pair< uint64_t, uint64_t > Edge
Definition: meshcutting.h:11
ECI(Edge in_edge, uint64_t in_cutpoint_id)
Definition: meshcutting.h:23
static bool Comparator(const ECI &edge_cut_info, const Edge &ref_edge)
Definition: meshcutting.h:30