PolyFEM
Loading...
Searching...
No Matches
MeshProcessing3D.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Mesh3DStorage.hpp"
4#include <iostream>
5#include <fstream>
6#include <array>
7
8namespace polyfem
9{
10 namespace mesh
11 {
12 namespace MeshProcessing3D
13 {
14#define Jacobian_Precision 1.e-7
15 const int hex_face_table[6][4] =
16 {
17 {0, 1, 2, 3},
18 {4, 7, 6, 5},
19 {0, 4, 5, 1},
20 {3, 2, 6, 7},
21 {0, 3, 7, 4},
22 {1, 5, 6, 2},
23 };
24 const int hex_tetra_table[8][4] =
25 {
26 {0, 3, 4, 1},
27 {1, 0, 5, 2},
28 {2, 1, 6, 3},
29 {3, 2, 7, 0},
30 {4, 7, 5, 0},
31 {5, 4, 6, 1},
32 {6, 5, 7, 2},
33 {7, 6, 4, 3},
34 };
35 const int tet_faces[4][3] = {
36 {1, 0, 2},
37 {3, 2, 0},
38 {1, 2, 3},
39 {0, 1, 3}};
40 const int tet_edges[6][2] = {
41 {0, 1},
42 {0, 2},
43 {0, 3},
44 {1, 2},
45 {1, 3},
46 {2, 3}};
47
50 double a_jacobian(Eigen::Vector3d &v0, Eigen::Vector3d &v1, Eigen::Vector3d &v2, Eigen::Vector3d &v3);
51
53 void refine_catmul_clark_polar(Mesh3DStorage &M, int iter, std::vector<int> &Parents);
55
58 void ele_subdivison_levels(const Mesh3DStorage &hmi, std::vector<int> &Ls);
59
61 template <typename RangeA, typename RangeB>
62 void set_intersection_own(const RangeA &A, const RangeB &B, std::array<uint32_t, 2> &C, int &num)
63 {
64 int n = 0;
65 for (const auto a : A)
66 {
67 for (const auto b : B)
68 {
69 if (a == b)
70 {
71 C[n++] = a;
72 if (n == num)
73 break;
74 }
75 }
76 if (n == num)
77 break;
78 }
79 }
80 } // namespace MeshProcessing3D
81 } // namespace mesh
82} // namespace polyfem
Topology of a conforming 3D mesh (used by CMesh3D), stored as flat arrays indexed by entity id.
void set_intersection_own(const RangeA &A, const RangeB &B, std::array< uint32_t, 2 > &C, int &num)
The first num common ids of A and B (in the order of A).
void reorder_hex_mesh_propogation(Mesh3DStorage &hmi)
void global_orientation_hexes(Mesh3DStorage &hmi)
double a_jacobian(Eigen::Vector3d &v0, Eigen::Vector3d &v1, Eigen::Vector3d &v2, Eigen::Vector3d &v3)
void refine_red_refinement_tet(Mesh3DStorage &M, int iter)
void orient_surface_mesh(Mesh3DStorage &hmi)
void build_connectivity(Mesh3DStorage &hmi)
void orient_volume_mesh(Mesh3DStorage &hmi)
void ele_subdivison_levels(const Mesh3DStorage &hmi, std::vector< int > &Ls)
void refine_catmul_clark_polar(Mesh3DStorage &M, int iter, std::vector< int > &Parents)