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_){};
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_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)); }
223 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)); }
224 int face_edge(const int f_id, const int le_id) const;
225 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)); }
226
227 inline int cell_ref_level(const int c_id) const { return elements[valid_to_all_elem(c_id)].level; }
228
229 bool is_boundary_vertex(const int vertex_global_id) const override { return vertices[valid_to_all_vertex(vertex_global_id)].isboundary; }
230 bool is_boundary_edge(const int edge_global_id) const override { return edges[valid_to_all_edge(edge_global_id)].isboundary; }
231 bool is_boundary_face(const int face_global_id) const override { return faces[valid_to_all_face(face_global_id)].isboundary; }
232 bool is_boundary_element(const int element_global_id) const override;
233
234 bool save(const std::string &path) const override
235 {
236 // TODO
237 return false;
238 }
239
240 bool build_from_matrices(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) override;
241
242 void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector<std::vector<int>> &nodes) override;
243
244 void normalize() override;
245
246 void compute_elements_tag() override;
247 void update_elements_tag() override;
248
249 double edge_length(const int gid) const override;
250
251 RowVectorNd point(const int global_index) const override;
252 void set_point(const int global_index, const RowVectorNd &p) override;
253 RowVectorNd edge_barycenter(const int e) const override;
254 RowVectorNd face_barycenter(const int f) const override;
255 RowVectorNd cell_barycenter(const int c) const override;
256
257 void bounding_box(RowVectorNd &min, RowVectorNd &max) const override;
258
259 void compute_boundary_ids(const double eps) override;
260 void compute_boundary_ids(const std::function<int(const RowVectorNd &)> &marker) override;
261 void compute_boundary_ids(const std::function<int(const RowVectorNd &, bool)> &marker) override;
262 void compute_boundary_ids(const std::function<int(const size_t, const RowVectorNd &, bool)> &marker) override;
263 void compute_boundary_ids(const std::function<int(const std::vector<int> &, bool)> &marker) override;
264 void compute_boundary_ids(const std::function<int(const size_t, const std::vector<int> &, const RowVectorNd &, bool)> &marker) override;
265
266 void compute_body_ids(const std::function<int(const size_t, const RowVectorNd &)> &marker) override;
267 void set_boundary_ids(const std::vector<int> &boundary_ids) override;
268 void set_body_ids(const std::vector<int> &body_ids) override;
269
270 int get_boundary_id(const int primitive) const override { return faces[valid_to_all_face(primitive)].boundary_id; };
271 int get_body_id(const int primitive) const override { return elements[valid_to_all_elem(primitive)].body_id; };
272
273 void triangulate_faces(Eigen::MatrixXi &tris, Eigen::MatrixXd &pts, std::vector<int> &ranges) const override;
274
275 RowVectorNd kernel(const int cell_id) const override;
276 // navigation wrapper
277 Navigation3D::Index get_index_from_element(int hi, int lf, int lv) const override;
278 Navigation3D::Index get_index_from_element(int hi) const override;
279
280 Navigation3D::Index get_index_from_element_edge(int hi, int v0, int v1) const override;
281 Navigation3D::Index get_index_from_element_face(int hi, int v0, int v1, int v2) const override;
282
283 std::vector<uint32_t> vertex_neighs(const int v_gid) const override;
284 std::vector<uint32_t> edge_neighs(const int e_gid) const override;
285
286 int leader_edge_of_vertex(const int v_id) const
287 {
288 assert(adj_prepared);
289 return (vertices[valid_to_all_vertex(v_id)].edge < 0) ? -1 : all_to_valid_edge(vertices[valid_to_all_vertex(v_id)].edge);
290 }
291 int leader_edge_of_edge(const int e_id) const
292 {
293 assert(adj_prepared);
294 return (edges[valid_to_all_edge(e_id)].leader < 0) ? -1 : all_to_valid_edge(edges[valid_to_all_edge(e_id)].leader);
295 }
296
297 int leader_face_of_vertex(const int v_id) const
298 {
299 assert(adj_prepared);
300 int id_full = vertices[valid_to_all_vertex(v_id)].face;
301 return (id_full < 0) ? -1 : all_to_valid_face(id_full);
302 }
303 int leader_face_of_edge(const int e_id) const
304 {
305 assert(adj_prepared);
306 int id_full = edges[valid_to_all_edge(e_id)].leader_face;
307 return (id_full < 0) ? -1 : all_to_valid_face(id_full);
308 }
309 int leader_face_of_face(const int f_id) const
310 {
311 assert(adj_prepared);
312 int id_full = faces[valid_to_all_face(f_id)].leader;
313 return (id_full < 0) ? -1 : all_to_valid_face(id_full);
314 }
315
316 // number of follower edges of a leader edge
317 int n_follower_edges(const int e_id) const
318 {
319 assert(adj_prepared);
320 return edges[valid_to_all_edge(e_id)].followers.size();
321 }
322 int n_follower_faces(const int e_id) const
323 {
324 assert(adj_prepared);
325 return faces[valid_to_all_face(e_id)].followers.size();
326 }
327
328 // Navigation in a surface mesh
333
334 // Iterate in a mesh
337
338 void get_vertex_elements_neighs(const int v_id, std::vector<int> &ids) const override;
339 void get_edge_elements_neighs(const int e_id, std::vector<int> &ids) const override;
340 void get_face_elements_neighs(const int f_id, std::vector<int> &ids) const;
341
342 void refine_element(int id_full);
343 void refine_elements(const std::vector<int> &ids);
344
345 void coarsen_element(int id_full);
346
347 void mark_boundary();
348
359
360 void build_index_mapping();
361
362 std::array<int, 4> get_ordered_vertices_from_tet(const int element_index) const override;
363
364 void append(const Mesh &mesh) override;
365
366 std::unique_ptr<Mesh> copy() const override;
367
368 private:
370 {
371 long operator()(const Eigen::Vector2i &a) const
372 {
373 return (long)((long)984120265 * a[0] + (long)125965121 * a[1]);
374 }
375 };
376
378 {
379 long operator()(const Eigen::Vector3i &a) const
380 {
381 return (long)((long)984120265 * a[0] + (long)125965121 * a[1] + (long)495698413 * a[2]);
382 }
383 };
384
385 protected:
386 bool load(const std::string &path) override;
387 bool load(const GEO::Mesh &M) override;
388
389 // index map from vertices to valid ones, and its inverse
390 inline int all_to_valid_vertex(const int id) const
391 {
392 assert(index_prepared);
393 return all_to_valid_vertexMap[id];
394 };
395 inline int valid_to_all_vertex(const int id) const
396 {
397 assert(index_prepared);
398 return valid_to_all_vertexMap[id];
399 };
400
401 // index map from edges to valid ones, and its inverse
402 inline int all_to_valid_edge(const int id) const
403 {
404 assert(index_prepared);
405 return all_to_valid_edgeMap[id];
406 };
407 inline int valid_to_all_edge(const int id) const
408 {
409 assert(index_prepared);
410 return valid_to_all_edgeMap[id];
411 };
412
413 // index map from faces to valid ones, and its inverse
414 inline int all_to_valid_face(const int id) const
415 {
416 assert(index_prepared);
417 return all_to_valid_faceMap[id];
418 };
419 inline int valid_to_all_face(const int id) const
420 {
421 assert(index_prepared);
422 return valid_to_all_faceMap[id];
423 };
424
425 // index map from elements to valid ones, and its inverse
426 inline int all_to_valid_elem(const int id) const
427 {
428 assert(index_prepared);
429 return all_to_valid_elemMap[id];
430 };
431 inline int valid_to_all_elem(const int id) const
432 {
433 assert(index_prepared);
434 return valid_to_all_elemMap[id];
435 };
436
437 // find the mid-point of edge v[0]v[1], return -1 if not exists
438 int find_vertex(Eigen::Vector2i v) const;
439 int find_vertex(const int v1, const int v2) const { return find_vertex(Eigen::Vector2i(v1, v2)); };
440
441 // find the mid-point of edge v[0]v[1], create one if not exists
442 int get_vertex(Eigen::Vector2i v);
443
444 // find the edge v[0]v[1], return -1 if not exists
445 int find_edge(Eigen::Vector2i v) const;
446 int find_edge(const int v1, const int v2) const { return find_edge(Eigen::Vector2i(v1, v2)); };
447
448 // find the edge v[0]v[1], create one if not exists
449 int get_edge(Eigen::Vector2i v);
450 int get_edge(const int v1, const int v2) { return get_edge(Eigen::Vector2i(v1, v2)); };
451
452 // find the face, return -1 if not exists
453 int find_face(Eigen::Vector3i v) const;
454 int find_face(const int v1, const int v2, const int v3) const { return find_face(Eigen::Vector3i(v1, v2, v3)); };
455 // find the face, create one if not exists
456 int get_face(Eigen::Vector3i v);
457 int get_face(const int v1, const int v2, const int v3) { return get_face(Eigen::Vector3i(v1, v2, v3)); };
458
459 void traverse_edge(Eigen::Vector2i v, double p1, double p2, int depth, std::vector<follower_edge> &list) const;
461
462 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;
464
466
467 int add_element(Eigen::Vector4i v, int parent = -1);
468
469 int n_elements = 0;
470
471 bool index_prepared = false;
472 bool adj_prepared = false;
473
474 std::vector<ncElem> elements;
475 std::vector<ncVert> vertices;
476 std::vector<ncBoundary> edges;
477 std::vector<ncBoundary> faces;
478
479 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D> midpointMap;
480 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D> edgeMap;
481 std::unordered_map<Eigen::Vector3i, int, ArrayHasher3D> faceMap;
482
487
488 std::vector<int> refineHistory;
489
490 // elementAdj(i, j) = 1 iff element i touches element j
491 Eigen::SparseMatrix<bool, Eigen::RowMajor> elementAdj;
492 };
493 } // namespace mesh
494} // namespace polyfem
int V
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
Definition Mesh.hpp:39
int all_to_valid_vertex(const int id) const
Definition NCMesh3D.hpp:390
int find_vertex(Eigen::Vector2i v) const
Definition NCMesh3D.cpp:973
bool is_boundary_element(const int element_global_id) const override
is cell boundary
Definition NCMesh3D.cpp:42
std::vector< int > all_to_valid_elemMap
Definition NCMesh3D.hpp:483
int leader_face_of_vertex(const int v_id) const
Definition NCMesh3D.hpp:297
int find_edge(const int v1, const int v2) const
Definition NCMesh3D.hpp:446
int cell_ref_level(const int c_id) const
Definition NCMesh3D.hpp:227
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:407
Navigation3D::Index next_around_edge(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:613
int face_edge(const int f_id, const int le_id) const
Definition NCMesh3D.cpp:18
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
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:270
std::unordered_map< Eigen::Vector2i, int, ArrayHasher2D > midpointMap
Definition NCMesh3D.hpp:479
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:349
int n_follower_faces(const int e_id) const
Definition NCMesh3D.hpp:322
bool save(const std::string &path) const override
Definition NCMesh3D.hpp:234
std::vector< ncBoundary > edges
Definition NCMesh3D.hpp:476
int valid_to_all_face(const int id) const
Definition NCMesh3D.hpp:419
void bounding_box(RowVectorNd &min, RowVectorNd &max) const override
computes the bbox of the mesh
Definition NCMesh3D.cpp:149
void append(const Mesh &mesh) override
appends a new mesh to the end of this
Definition NCMesh3D.cpp:899
std::vector< int > refineHistory
Definition NCMesh3D.hpp:488
double edge_length(const int gid) const override
edge length
Definition NCMesh3D.cpp:107
int n_edges() const override
number of edges
Definition NCMesh3D.hpp:197
int n_follower_edges(const int e_id) const
Definition NCMesh3D.hpp:317
int get_edge(Eigen::Vector2i v)
void set_point(const int global_index, const RowVectorNd &p) override
Set the point.
Definition NCMesh3D.cpp:120
int add_element(Eigen::Vector4i v, int parent=-1)
int get_face(Eigen::Vector3i v)
void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector< std::vector< int > > &nodes) override
attach high order nodes
Definition NCMesh3D.cpp:80
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:286
RowVectorNd cell_barycenter(const int c) const override
cell barycenter
Definition NCMesh3D.cpp:140
std::vector< uint32_t > edge_neighs(const int e_gid) const override
Definition NCMesh3D.cpp:543
int all_to_valid_elem(const int id) const
Definition NCMesh3D.hpp:426
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:454
std::vector< ncVert > vertices
Definition NCMesh3D.hpp:475
void triangulate_faces(Eigen::MatrixXi &tris, Eigen::MatrixXd &pts, std::vector< int > &ranges) const override
generate a triangular representation of every face
Definition NCMesh3D.cpp:313
Navigation3D::Index get_index_from_element_edge(int hi, int v0, int v1) const override
Definition NCMesh3D.cpp:454
std::unordered_map< Eigen::Vector2i, int, ArrayHasher2D > edgeMap
Definition NCMesh3D.hpp:480
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:439
virtual ~NCMesh3D()=default
void refine(const int n_refinement, const double t) override
refine the mesh
Definition NCMesh3D.cpp:26
void normalize() override
normalize the mesh
Definition NCMesh3D.cpp:87
std::vector< int > all_to_valid_vertexMap
Definition NCMesh3D.hpp:484
int all_to_valid_edge(const int id) const
Definition NCMesh3D.hpp:402
void get_face_elements_neighs(const int f_id, std::vector< int > &ids) const
Definition NCMesh3D.cpp:634
std::unique_ptr< Mesh > copy() const override
Create a copy of the mesh.
Definition NCMesh3D.cpp:924
int valid_to_all_elem(const int id) const
Definition NCMesh3D.hpp:431
void refine_element(int id_full)
Definition NCMesh3D.cpp:641
Navigation3D::Index switch_vertex(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:552
int leader_face_of_edge(const int e_id) const
Definition NCMesh3D.hpp:303
RowVectorNd kernel(const int cell_id) const override
Definition NCMesh3D.cpp:417
bool is_boundary_vertex(const int vertex_global_id) const override
is vertex boundary
Definition NCMesh3D.hpp:229
int cell_face(const int c_id, const int lf_id) const override
Definition NCMesh3D.hpp:221
bool build_from_matrices(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) override
build a mesh from matrices
Definition NCMesh3D.cpp:52
void compute_elements_tag() override
compute element types, see ElementType
Definition NCMesh3D.cpp:99
NCMesh3D & operator=(NCMesh3D &&)=default
RowVectorNd point(const int global_index) const override
point coordinates
Definition NCMesh3D.cpp:115
void compute_body_ids(const std::function< int(const size_t, const RowVectorNd &)> &marker) override
computes boundary selections based on a function
Definition NCMesh3D.cpp:284
std::vector< int > all_to_valid_edgeMap
Definition NCMesh3D.hpp:485
int find_edge(Eigen::Vector2i v) const
Definition NCMesh3D.cpp:995
Navigation3D::Index get_index_from_element(int hi, int lf, int lv) const override
Definition NCMesh3D.cpp:422
int get_face(const int v1, const int v2, const int v3)
Definition NCMesh3D.hpp:457
bool is_boundary_face(const int face_global_id) const override
is face boundary
Definition NCMesh3D.hpp:231
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:486
void coarsen_element(int id_full)
Definition NCMesh3D.cpp:754
int leader_edge_of_edge(const int e_id) const
Definition NCMesh3D.hpp:291
Navigation3D::Index next_around_face(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:617
std::vector< int > valid_to_all_elemMap
Definition NCMesh3D.hpp:483
std::vector< int > valid_to_all_edgeMap
Definition NCMesh3D.hpp:485
RowVectorNd face_barycenter(const int f) const override
face barycenter
Definition NCMesh3D.cpp:132
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:271
bool is_boundary_edge(const int edge_global_id) const override
is edge boundary
Definition NCMesh3D.hpp:230
Navigation3D::Index switch_element(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:594
void get_vertex_elements_neighs(const int v_id, std::vector< int > &ids) const override
Definition NCMesh3D.cpp:622
NCMesh3D(const NCMesh3D &)=default
std::vector< ncElem > elements
Definition NCMesh3D.hpp:474
std::unordered_map< Eigen::Vector3i, int, ArrayHasher3D > faceMap
Definition NCMesh3D.hpp:481
RowVectorNd edge_barycenter(const int e) const override
edge barycenter
Definition NCMesh3D.cpp:125
std::vector< int > valid_to_all_faceMap
Definition NCMesh3D.hpp:486
std::vector< uint32_t > vertex_neighs(const int v_gid) const override
Definition NCMesh3D.cpp:535
std::vector< int > valid_to_all_vertexMap
Definition NCMesh3D.hpp:484
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:103
int get_edge(const int v1, const int v2)
Definition NCMesh3D.hpp:450
int valid_to_all_vertex(const int id) const
Definition NCMesh3D.hpp:395
int edge_vertex(const int e_id, const int lv_id) const override
id of the edge vertex
Definition NCMesh3D.hpp:225
void refine_elements(const std::vector< int > &ids)
Definition NCMesh3D.cpp:744
int get_vertex(Eigen::Vector2i v)
Definition NCMesh3D.cpp:982
int find_face(Eigen::Vector3i v) const
void get_edge_elements_neighs(const int e_id, std::vector< int > &ids) const override
Definition NCMesh3D.cpp:628
int cell_edge(const int c_id, const int le_id) const override
Definition NCMesh3D.hpp:222
void compute_boundary_ids(const double eps) override
computes the selection based on the bbx of the mesh.
Definition NCMesh3D.cpp:166
Navigation3D::Index switch_face(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:573
int leader_face_of_face(const int f_id) const
Definition NCMesh3D.hpp:309
Eigen::SparseMatrix< bool, Eigen::RowMajor > elementAdj
Definition NCMesh3D.hpp:491
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:223
int all_to_valid_face(const int id) const
Definition NCMesh3D.hpp:414
int n_face_cells(const int f_id) const
Definition NCMesh3D.hpp:215
bool load(const std::string &path) override
loads a mesh from the path
Definition NCMesh3D.cpp:929
Navigation3D::Index get_index_from_element_face(int hi, int v0, int v1, int v2) const override
Definition NCMesh3D.cpp:487
void set_body_ids(const std::vector< int > &body_ids) override
Set the volume sections.
Definition NCMesh3D.cpp:304
void set_boundary_ids(const std::vector< int > &boundary_ids) override
Set the boundary selection from a vector.
Definition NCMesh3D.cpp:296
NCMesh3D(NCMesh3D &&)=default
std::vector< ncBoundary > faces
Definition NCMesh3D.hpp:477
Navigation3D::Index switch_edge(Navigation3D::Index idx) const override
Definition NCMesh3D.cpp:565
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:11
long operator()(const Eigen::Vector2i &a) const
Definition NCMesh3D.hpp:371
long operator()(const Eigen::Vector3i &a) const
Definition NCMesh3D.hpp:379
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