PolyFEM
Loading...
Searching...
No Matches
NCMesh3D.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <set>
5#include <tuple>
6
7namespace polyfem
8{
9 namespace mesh
10 {
11 class NCMesh3D : public Mesh3D
12 {
13 public:
15 {
16 int id;
17 double p1, p2;
18
19 follower_edge(int id_, double p1_, double p2_)
20 {
21 id = id_;
22 p1 = p1_;
23 p2 = p2_;
24 }
25 };
26
28 {
29 int id;
30 Eigen::Vector2d p1, p2, p3;
31
32 follower_face(int id_, Eigen::Vector2d p1_, Eigen::Vector2d p2_, Eigen::Vector2d p3_)
33 {
34 id = id_;
35 p1 = p1_;
36 p2 = p2_;
37 p3 = p3_;
38 }
39 };
40
41 struct ncVert
42 {
43 ncVert(const Eigen::VectorXd pos_) : pos(pos_) {};
44 ~ncVert() {};
45
46 int n_elem() const
47 {
48 return elem_list.size();
49 }
50
51 void add_element(const int e)
52 {
53 elem_list.insert(e);
54 };
55
56 void remove_element(const int e)
57 {
58 int num = elem_list.erase(e);
59 assert(num == 1);
60 }
61
62 std::set<int> elem_list; // elements that contain this edge/face
63
64 Eigen::VectorXd pos;
65 bool isboundary = false;
66
67 int edge = -1; // only used if the vertex is on the interior of an edge
68 int face = -1; // only used if the vertex is on the interior of an face
69
70 double weight = -1.; // only 2d, the local position of this vertex on the edge
71 };
72
74 {
75 ncBoundary(const Eigen::VectorXi vert) : vertices(vert)
76 {
77 weights.setConstant(-1);
78 };
80
81 int n_elem() const
82 {
83 return elem_list.size();
84 }
85
86 void add_element(const int e)
87 {
88 elem_list.insert(e);
89 };
90
91 void remove_element(const int e)
92 {
93 int num = elem_list.erase(e);
94 assert(num == 1);
95 }
96
97 int get_element() const
98 {
99 assert(n_elem() > 0);
100 auto it = elem_list.cbegin();
101 return *it;
102 }
103
104 int find_opposite_element(int e) const
105 {
106 assert(n_elem() == 2);
107 bool exist = false;
108 int oppo = -1;
109 for (int elem : elem_list)
110 if (elem == e)
111 exist = true;
112 else
113 oppo = elem;
114
115 assert(oppo >= 0);
116 assert(exist);
117 return oppo;
118 }
119
120 std::set<int> elem_list; // elements that contain this edge/face
121 Eigen::VectorXi vertices;
122
123 bool isboundary = false; // valid only after calling mark_boundary()
124 int boundary_id = 0;
125
126 int leader = -1; // if this edge/face lies on a larger edge/face
127 std::vector<int> followers; // followers of this edge/face
128
129 int leader_face = -1; // if this edge lies in the interior of a face
130
131 std::vector<int> global_ids; // only used for building basis
132
133 // the following only used if it's an edge
134 Eigen::Vector2d weights; // position of this edge on its leader edge
135 };
136
137 struct ncElem
138 {
139 ncElem(const int dim_, const Eigen::VectorXi vertices_, const int level_, const int parent_) : dim(dim_), level(level_), parent(parent_), geom_vertices(vertices_)
140 {
142
143 assert(geom_vertices.size() == dim + 1);
144 edges.setConstant(3 * (dim - 1), 1, -1);
145 faces.setConstant(4 * (dim - 2), 1, -1);
146 children.setConstant(std::round(pow(2, dim)), 1, -1);
147 };
149
150 bool is_valid() const
151 {
152 return (!is_ghost) && (!is_refined);
153 };
154
155 bool is_not_valid() const
156 {
157 return is_ghost || is_refined;
158 };
159
160 int dim;
161 int level; // level of refinement
163 Eigen::VectorXi geom_vertices;
164
165 Eigen::VectorXi vertices; // geom_vertices with a different order that used in polyfem
166
167 Eigen::VectorXi edges;
168 Eigen::VectorXi faces;
169 Eigen::VectorXi children;
170
172
173 bool is_refined = false;
174 bool is_ghost = false;
175 };
176
177 NCMesh3D() = default;
178 virtual ~NCMesh3D() = default;
179 NCMesh3D(NCMesh3D &&) = default;
181 NCMesh3D(const NCMesh3D &) = default;
182 NCMesh3D &operator=(const NCMesh3D &) = default;
183
184 void refine(const int n_refinement, const double t) override;
185
186 bool is_conforming() const override { return false; }
187
188 int n_cells() const override { return n_elements; }
189 int n_faces() const override
190 {
191 int n = 0;
192 for (const auto &face : faces)
193 if (face.n_elem())
194 n++;
195 return n;
196 }
197 int n_edges() const override
198 {
199 int n = 0;
200 for (const auto &edge : edges)
201 if (edge.n_elem())
202 n++;
203 return n;
204 }
205 int n_vertices() const override
206 {
207 int n = 0;
208 for (const auto &vert : vertices)
209 if (vert.n_elem())
210 n++;
211 return n;
212 }
213
214 int n_face_vertices(const int f_id) const override { return 3; }
215 int n_face_cells(const int f_id) const { return faces[valid_to_all_face(f_id)].n_elem(); }
216 int n_edge_cells(const int e_id) const { return edges[valid_to_all_edge(e_id)].n_elem(); }
217 int n_cell_vertices(const int c_id) const override { return 4; }
218 int n_cell_edges(const int c_id) const override { return 6; }
219 int n_cell_faces(const int c_id) const override { return 4; }
220 int cell_vertex(const int f_id, const int lv_id) const override { return all_to_valid_vertex(elements[valid_to_all_elem(f_id)].vertices(lv_id)); }
221 int cell_face(const int c_id, const int lf_id) const override { return all_to_valid_face(elements[valid_to_all_elem(c_id)].faces(lf_id)); }
222 int cell_face_orientation(const int, const int) const override { return 1; }
223 int cell_edge(const int c_id, const int le_id) const override { return all_to_valid_edge(elements[valid_to_all_elem(c_id)].edges(le_id)); }
224 int face_vertex(const int f_id, const int lv_id) const override { return all_to_valid_vertex(faces[valid_to_all_face(f_id)].vertices(lv_id)); }
225 int face_edge(const int f_id, const int le_id) const;
226 int edge_vertex(const int e_id, const int lv_id) const override { return all_to_valid_vertex(edges[valid_to_all_edge(e_id)].vertices(lv_id)); }
227
228 inline int cell_ref_level(const int c_id) const { return elements[valid_to_all_elem(c_id)].level; }
229
230 bool is_boundary_vertex(const int vertex_global_id) const override { return vertices[valid_to_all_vertex(vertex_global_id)].isboundary; }
231 bool is_boundary_edge(const int edge_global_id) const override { return edges[valid_to_all_edge(edge_global_id)].isboundary; }
232 bool is_boundary_face(const int face_global_id) const override { return faces[valid_to_all_face(face_global_id)].isboundary; }
233 bool is_boundary_element(const int element_global_id) const override;
234
235 bool build_topology(const MeshData &data) override;
236
237 void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector<std::vector<int>> &nodes) override;
238
239 void normalize() override;
240
241 void compute_elements_tag() override;
242 void update_elements_tag() override;
243
244 double edge_length(const int gid) const override;
245
246 RowVectorNd point(const int global_index) const override;
247 void set_point(const int global_index, const RowVectorNd &p) override;
248 RowVectorNd edge_barycenter(const int e) const override;
249 RowVectorNd face_barycenter(const int f) const override;
250 RowVectorNd cell_barycenter(const int c) const override;
251
252 void bounding_box(RowVectorNd &min, RowVectorNd &max) const override;
253
254 void compute_boundary_ids(const std::function<int(const size_t, const std::vector<int> &, const RowVectorNd &, bool)> &marker) override;
255
256 void compute_body_ids(const std::function<int(const size_t, const std::vector<int> &, const RowVectorNd &)> &marker) override;
257 void set_boundary_ids(const std::vector<int> &boundary_ids) override;
258 void set_body_ids(const std::vector<int> &body_ids) override;
259
260 int get_boundary_id(const int primitive) const override { return faces[valid_to_all_face(primitive)].boundary_id; };
261 int get_body_id(const int primitive) const override { return elements[valid_to_all_elem(primitive)].body_id; };
262
263 // void triangulate_faces(Eigen::MatrixXi &tris, Eigen::MatrixXd &pts, std::vector<int> &ranges) const override;
264
265 RowVectorNd kernel(const int cell_id) const override;
266 // navigation wrapper
267 Navigation3D::Index get_index_from_element(int hi, int lf, int lv) const override;
268 Navigation3D::Index get_index_from_element(int hi) const override;
269
270 Navigation3D::Index get_index_from_element_edge(int hi, int v0, int v1) const override;
271 Navigation3D::Index get_index_from_element_face(int hi, int v0, int v1, int v2) const override;
272
273 std::vector<uint32_t> vertex_neighs(const int v_gid) const override;
274 std::vector<uint32_t> edge_neighs(const int e_gid) const override;
275
276 int leader_edge_of_vertex(const int v_id) const
277 {
278 assert(adj_prepared);
279 return (vertices[valid_to_all_vertex(v_id)].edge < 0) ? -1 : all_to_valid_edge(vertices[valid_to_all_vertex(v_id)].edge);
280 }
281 int leader_edge_of_edge(const int e_id) const
282 {
283 assert(adj_prepared);
284 return (edges[valid_to_all_edge(e_id)].leader < 0) ? -1 : all_to_valid_edge(edges[valid_to_all_edge(e_id)].leader);
285 }
286
287 int leader_face_of_vertex(const int v_id) const
288 {
289 assert(adj_prepared);
290 int id_full = vertices[valid_to_all_vertex(v_id)].face;
291 return (id_full < 0) ? -1 : all_to_valid_face(id_full);
292 }
293 int leader_face_of_edge(const int e_id) const
294 {
295 assert(adj_prepared);
296 int id_full = edges[valid_to_all_edge(e_id)].leader_face;
297 return (id_full < 0) ? -1 : all_to_valid_face(id_full);
298 }
299 int leader_face_of_face(const int f_id) const
300 {
301 assert(adj_prepared);
302 int id_full = faces[valid_to_all_face(f_id)].leader;
303 return (id_full < 0) ? -1 : all_to_valid_face(id_full);
304 }
305
306 // number of follower edges of a leader edge
307 int n_follower_edges(const int e_id) const
308 {
309 assert(adj_prepared);
310 return edges[valid_to_all_edge(e_id)].followers.size();
311 }
312 int n_follower_faces(const int e_id) const
313 {
314 assert(adj_prepared);
315 return faces[valid_to_all_face(e_id)].followers.size();
316 }
317
318 // Navigation in a surface mesh
323
324 // Iterate in a mesh
327
328 void get_vertex_elements_neighs(const int v_id, std::vector<int> &ids) const override;
329 void get_edge_elements_neighs(const int e_id, std::vector<int> &ids) const override;
330 void get_face_elements_neighs(const int f_id, std::vector<int> &ids) const;
331
332 void refine_element(int id_full);
333 void refine_elements(const std::vector<int> &ids);
334
335 void coarsen_element(int id_full);
336
337 void mark_boundary();
338
349
350 void build_index_mapping();
351
352 std::array<int, 4> get_ordered_vertices_from_tet(const int element_index) const override;
353
354 void append(const Mesh &mesh) override;
355
356 std::unique_ptr<Mesh> copy() const override;
357
358 private:
360 {
361 long operator()(const Eigen::Vector2i &a) const
362 {
363 return (long)((long)984120265 * a[0] + (long)125965121 * a[1]);
364 }
365 };
366
368 {
369 long operator()(const Eigen::Vector3i &a) const
370 {
371 return (long)((long)984120265 * a[0] + (long)125965121 * a[1] + (long)495698413 * a[2]);
372 }
373 };
374
375 protected:
376 void remove_elements(const std::vector<bool> &keep) override;
377
378 // index map from vertices to valid ones, and its inverse
379 inline int all_to_valid_vertex(const int id) const
380 {
381 assert(index_prepared);
382 return all_to_valid_vertexMap[id];
383 };
384 inline int valid_to_all_vertex(const int id) const
385 {
386 assert(index_prepared);
387 return valid_to_all_vertexMap[id];
388 };
389
390 // index map from edges to valid ones, and its inverse
391 inline int all_to_valid_edge(const int id) const
392 {
393 assert(index_prepared);
394 return all_to_valid_edgeMap[id];
395 };
396 inline int valid_to_all_edge(const int id) const
397 {
398 assert(index_prepared);
399 return valid_to_all_edgeMap[id];
400 };
401
402 // index map from faces to valid ones, and its inverse
403 inline int all_to_valid_face(const int id) const
404 {
405 assert(index_prepared);
406 return all_to_valid_faceMap[id];
407 };
408 inline int valid_to_all_face(const int id) const
409 {
410 assert(index_prepared);
411 return valid_to_all_faceMap[id];
412 };
413
414 // index map from elements to valid ones, and its inverse
415 inline int all_to_valid_elem(const int id) const
416 {
417 assert(index_prepared);
418 return all_to_valid_elemMap[id];
419 };
420 inline int valid_to_all_elem(const int id) const
421 {
422 assert(index_prepared);
423 return valid_to_all_elemMap[id];
424 };
425
426 // find the mid-point of edge v[0]v[1], return -1 if not exists
427 int find_vertex(Eigen::Vector2i v) const;
428 int find_vertex(const int v1, const int v2) const { return find_vertex(Eigen::Vector2i(v1, v2)); };
429
430 // find the mid-point of edge v[0]v[1], create one if not exists
431 int get_vertex(Eigen::Vector2i v);
432
433 // find the edge v[0]v[1], return -1 if not exists
434 int find_edge(Eigen::Vector2i v) const;
435 int find_edge(const int v1, const int v2) const { return find_edge(Eigen::Vector2i(v1, v2)); };
436
437 // find the edge v[0]v[1], create one if not exists
438 int get_edge(Eigen::Vector2i v);
439 int get_edge(const int v1, const int v2) { return get_edge(Eigen::Vector2i(v1, v2)); };
440
441 // find the face, return -1 if not exists
442 int find_face(Eigen::Vector3i v) const;
443 int find_face(const int v1, const int v2, const int v3) const { return find_face(Eigen::Vector3i(v1, v2, v3)); };
444 // find the face, create one if not exists
445 int get_face(Eigen::Vector3i v);
446 int get_face(const int v1, const int v2, const int v3) { return get_face(Eigen::Vector3i(v1, v2, v3)); };
447
448 void traverse_edge(Eigen::Vector2i v, double p1, double p2, int depth, std::vector<follower_edge> &list) const;
450
451 void traverse_face(int v1, int v2, int v3, Eigen::Vector2d p1, Eigen::Vector2d p2, Eigen::Vector2d p3, int depth, std::vector<follower_face> &face_list, std::vector<int> &edge_list) const;
453
455
456 int add_element(Eigen::Vector4i v, int parent = -1);
457
458 int n_elements = 0;
459
460 bool index_prepared = false;
461 bool adj_prepared = false;
462
463 std::vector<ncElem> elements;
464 std::vector<ncVert> vertices;
465 std::vector<ncBoundary> edges;
466 std::vector<ncBoundary> faces;
467
468 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D> midpointMap;
469 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D> edgeMap;
470 std::unordered_map<Eigen::Vector3i, int, ArrayHasher3D> faceMap;
471
476
477 std::vector<int> refineHistory;
478
479 // elementAdj(i, j) = 1 iff element i touches element j
480 Eigen::SparseMatrix<bool, Eigen::RowMajor> elementAdj;
481 };
482 } // namespace mesh
483} // namespace polyfem
int V
Eigen::RowVectorXd point
Format-independent input used to construct a runtime Mesh.
Definition MeshData.hpp:12
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
Definition Mesh.hpp:50
int all_to_valid_vertex(const int id) const
Definition NCMesh3D.hpp:379
void remove_elements(const std::vector< bool > &keep) override
Remove all top-dimensional elements whose mask entry is false.
Definition NCMesh3D.cpp:18
int find_vertex(Eigen::Vector2i v) const
Definition NCMesh3D.cpp:880
bool is_boundary_element(const int element_global_id) const override
is cell boundary
Definition NCMesh3D.cpp:92
void compute_body_ids(const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &)> &marker) override
computes boundary selections based on a function
Definition NCMesh3D.cpp:243
std::vector< int > all_to_valid_elemMap
Definition NCMesh3D.hpp:472
int leader_face_of_vertex(const int v_id) const
Definition NCMesh3D.hpp:287
int find_edge(const int v1, const int v2) const
Definition NCMesh3D.hpp:435
int cell_ref_level(const int c_id) const
Definition NCMesh3D.hpp:228
int n_faces() const override
number of faces
Definition NCMesh3D.hpp:189
int n_cell_vertices(const int c_id) const override
number of vertices of a cell
Definition NCMesh3D.hpp:217
NCMesh3D & operator=(const NCMesh3D &)=default
int valid_to_all_edge(const int id) const
Definition NCMesh3D.hpp:396
Navigation3D::Index next_around_edge(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:574
int face_edge(const int f_id, const int le_id) const
Definition NCMesh3D.cpp:67
int n_cell_faces(const int c_id) const override
Definition NCMesh3D.hpp:219
void traverse_edge(Eigen::Vector2i v, double p1, double p2, int depth, std::vector< follower_edge > &list) const
Definition NCMesh3D.cpp:944
int n_edge_cells(const int e_id) const
Definition NCMesh3D.hpp:216
int get_boundary_id(const int primitive) const override
Get the boundary selection of an element (face in 3d, edge in 2d)
Definition NCMesh3D.hpp:260
std::unordered_map< Eigen::Vector2i, int, ArrayHasher2D > midpointMap
Definition NCMesh3D.hpp:468
int n_cells() const override
number of cells
Definition NCMesh3D.hpp:188
void build_element_vertex_adjacency()
void prepare_mesh() override
method used to finalize the mesh.
Definition NCMesh3D.hpp:339
int n_follower_faces(const int e_id) const
Definition NCMesh3D.hpp:312
std::vector< ncBoundary > edges
Definition NCMesh3D.hpp:465
int valid_to_all_face(const int id) const
Definition NCMesh3D.hpp:408
void bounding_box(RowVectorNd &min, RowVectorNd &max) const override
computes the bbox of the mesh
Definition NCMesh3D.cpp:205
void append(const Mesh &mesh) override
appends a new mesh to the end of this
Definition NCMesh3D.cpp:850
std::vector< int > refineHistory
Definition NCMesh3D.hpp:477
double edge_length(const int gid) const override
edge length
Definition NCMesh3D.cpp:163
int n_edges() const override
number of edges
Definition NCMesh3D.hpp:197
void compute_boundary_ids(const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &, bool)> &marker) override
computes boundary selections based on a function
Definition NCMesh3D.cpp:222
int n_follower_edges(const int e_id) const
Definition NCMesh3D.hpp:307
int get_edge(Eigen::Vector2i v)
Definition NCMesh3D.cpp:911
void set_point(const int global_index, const RowVectorNd &p) override
Set the point.
Definition NCMesh3D.cpp:176
int add_element(Eigen::Vector4i v, int parent=-1)
int get_face(Eigen::Vector3i v)
Definition NCMesh3D.cpp:932
void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector< std::vector< int > > &nodes) override
attach high order nodes
Definition NCMesh3D.cpp:136
int n_face_vertices(const int f_id) const override
number of vertices of a face
Definition NCMesh3D.hpp:214
int leader_edge_of_vertex(const int v_id) const
Definition NCMesh3D.hpp:276
RowVectorNd cell_barycenter(const int c) const override
cell barycenter
Definition NCMesh3D.cpp:196
std::vector< uint32_t > edge_neighs(const int e_gid) const override
Definition NCMesh3D.cpp:504
int all_to_valid_elem(const int id) const
Definition NCMesh3D.hpp:415
int n_vertices() const override
number of vertices
Definition NCMesh3D.hpp:205
int find_face(const int v1, const int v2, const int v3) const
Definition NCMesh3D.hpp:443
std::vector< ncVert > vertices
Definition NCMesh3D.hpp:464
Navigation3D::Index get_index_from_element_edge(int hi, int v0, int v1) const override
Definition NCMesh3D.cpp:415
std::unordered_map< Eigen::Vector2i, int, ArrayHasher2D > edgeMap
Definition NCMesh3D.hpp:469
void traverse_face(int v1, int v2, int v3, Eigen::Vector2d p1, Eigen::Vector2d p2, Eigen::Vector2d p3, int depth, std::vector< follower_face > &face_list, std::vector< int > &edge_list) const
int find_vertex(const int v1, const int v2) const
Definition NCMesh3D.hpp:428
virtual ~NCMesh3D()=default
void refine(const int n_refinement, const double t) override
refine the mesh
Definition NCMesh3D.cpp:75
void normalize() override
normalize the mesh
Definition NCMesh3D.cpp:143
std::vector< int > all_to_valid_vertexMap
Definition NCMesh3D.hpp:473
int all_to_valid_edge(const int id) const
Definition NCMesh3D.hpp:391
bool build_topology(const MeshData &data) override
Construct only the dimension-specific topology.
Definition NCMesh3D.cpp:102
void get_face_elements_neighs(const int f_id, std::vector< int > &ids) const
Definition NCMesh3D.cpp:595
std::unique_ptr< Mesh > copy() const override
Create a copy of the mesh.
Definition NCMesh3D.cpp:875
int valid_to_all_elem(const int id) const
Definition NCMesh3D.hpp:420
void refine_element(int id_full)
Definition NCMesh3D.cpp:602
Navigation3D::Index switch_vertex(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:513
int leader_face_of_edge(const int e_id) const
Definition NCMesh3D.hpp:293
RowVectorNd kernel(const int cell_id) const override
Definition NCMesh3D.cpp:378
bool is_boundary_vertex(const int vertex_global_id) const override
is vertex boundary
Definition NCMesh3D.hpp:230
int cell_face(const int c_id, const int lf_id) const override
Definition NCMesh3D.hpp:221
void compute_elements_tag() override
compute element types, see ElementType
Definition NCMesh3D.cpp:155
NCMesh3D & operator=(NCMesh3D &&)=default
std::vector< int > all_to_valid_edgeMap
Definition NCMesh3D.hpp:474
int find_edge(Eigen::Vector2i v) const
Definition NCMesh3D.cpp:902
Navigation3D::Index get_index_from_element(int hi, int lf, int lv) const override
Definition NCMesh3D.cpp:383
int get_face(const int v1, const int v2, const int v3)
Definition NCMesh3D.hpp:446
bool is_boundary_face(const int face_global_id) const override
is face boundary
Definition NCMesh3D.hpp:232
int cell_vertex(const int f_id, const int lv_id) const override
id of the vertex of a cell
Definition NCMesh3D.hpp:220
std::vector< int > all_to_valid_faceMap
Definition NCMesh3D.hpp:475
void coarsen_element(int id_full)
Definition NCMesh3D.cpp:715
int leader_edge_of_edge(const int e_id) const
Definition NCMesh3D.hpp:281
Navigation3D::Index next_around_face(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:578
std::vector< int > valid_to_all_elemMap
Definition NCMesh3D.hpp:472
std::vector< int > valid_to_all_edgeMap
Definition NCMesh3D.hpp:474
RowVectorNd face_barycenter(const int f) const override
face barycenter
Definition NCMesh3D.cpp:188
int n_cell_edges(const int c_id) const override
Definition NCMesh3D.hpp:218
int get_body_id(const int primitive) const override
Get the volume selection of an element (cell in 3d, face in 2d)
Definition NCMesh3D.hpp:261
bool is_boundary_edge(const int edge_global_id) const override
is edge boundary
Definition NCMesh3D.hpp:231
Navigation3D::Index switch_element(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:555
void get_vertex_elements_neighs(const int v_id, std::vector< int > &ids) const override
Definition NCMesh3D.cpp:583
NCMesh3D(const NCMesh3D &)=default
std::vector< ncElem > elements
Definition NCMesh3D.hpp:463
std::unordered_map< Eigen::Vector3i, int, ArrayHasher3D > faceMap
Definition NCMesh3D.hpp:470
RowVectorNd edge_barycenter(const int e) const override
edge barycenter
Definition NCMesh3D.cpp:181
std::vector< int > valid_to_all_faceMap
Definition NCMesh3D.hpp:475
std::vector< uint32_t > vertex_neighs(const int v_gid) const override
Definition NCMesh3D.cpp:496
std::vector< int > valid_to_all_vertexMap
Definition NCMesh3D.hpp:473
std::array< int, 4 > get_ordered_vertices_from_tet(const int element_index) const override
void update_elements_tag() override
Update elements types.
Definition NCMesh3D.cpp:159
int get_edge(const int v1, const int v2)
Definition NCMesh3D.hpp:439
int valid_to_all_vertex(const int id) const
Definition NCMesh3D.hpp:384
int edge_vertex(const int e_id, const int lv_id) const override
id of the edge vertex
Definition NCMesh3D.hpp:226
void refine_elements(const std::vector< int > &ids)
Definition NCMesh3D.cpp:705
int get_vertex(Eigen::Vector2i v)
Definition NCMesh3D.cpp:889
int find_face(Eigen::Vector3i v) const
Definition NCMesh3D.cpp:923
void get_edge_elements_neighs(const int e_id, std::vector< int > &ids) const override
Definition NCMesh3D.cpp:589
int cell_edge(const int c_id, const int le_id) const override
Definition NCMesh3D.hpp:223
Navigation3D::Index switch_face(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:534
int leader_face_of_face(const int f_id) const
Definition NCMesh3D.hpp:299
Eigen::SparseMatrix< bool, Eigen::RowMajor > elementAdj
Definition NCMesh3D.hpp:480
bool is_conforming() const override
if the mesh is conforming
Definition NCMesh3D.hpp:186
int face_vertex(const int f_id, const int lv_id) const override
id of the face vertex
Definition NCMesh3D.hpp:224
int cell_face_orientation(const int, const int) const override
Definition NCMesh3D.hpp:222
int all_to_valid_face(const int id) const
Definition NCMesh3D.hpp:403
int n_face_cells(const int f_id) const
Definition NCMesh3D.hpp:215
Navigation3D::Index get_index_from_element_face(int hi, int v0, int v1, int v2) const override
Definition NCMesh3D.cpp:448
void set_body_ids(const std::vector< int > &body_ids) override
Set the volume sections.
Definition NCMesh3D.cpp:264
void set_boundary_ids(const std::vector< int > &boundary_ids) override
Set the boundary selection from a vector.
Definition NCMesh3D.cpp:255
NCMesh3D(NCMesh3D &&)=default
std::vector< ncBoundary > faces
Definition NCMesh3D.hpp:466
Navigation3D::Index switch_edge(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:526
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:13
long operator()(const Eigen::Vector2i &a) const
Definition NCMesh3D.hpp:361
long operator()(const Eigen::Vector3i &a) const
Definition NCMesh3D.hpp:369
follower_edge(int id_, double p1_, double p2_)
Definition NCMesh3D.hpp:19
follower_face(int id_, Eigen::Vector2d p1_, Eigen::Vector2d p2_, Eigen::Vector2d p3_)
Definition NCMesh3D.hpp:32
ncBoundary(const Eigen::VectorXi vert)
Definition NCMesh3D.hpp:75
ncElem(const int dim_, const Eigen::VectorXi vertices_, const int level_, const int parent_)
Definition NCMesh3D.hpp:139
void remove_element(const int e)
Definition NCMesh3D.hpp:56
void add_element(const int e)
Definition NCMesh3D.hpp:51
ncVert(const Eigen::VectorXd pos_)
Definition NCMesh3D.hpp:43