PolyFEM
Loading...
Searching...
No Matches
Mesh.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <polyfem/Common.hpp>
9
10#include <Eigen/Dense>
11#include <geogram/mesh/mesh.h>
12
13#include <memory>
14
15namespace polyfem
16{
17 namespace mesh
18 {
19 class Mesh;
20
22 {
23 int id;
24 std::unique_ptr<Mesh> mesh;
25 };
26
47
49 class Mesh
50 {
51 protected:
54 {
55 public:
56 int v1, v2;
57 std::vector<int> nodes_ids;
58 Eigen::MatrixXd nodes;
59 };
60
63 {
64 public:
65 int v1, v2, v3;
66 std::vector<int> nodes_ids;
67 Eigen::MatrixXd nodes;
68 };
69
72 {
73 public:
74 int v1, v2, v3, v4;
75 std::vector<int> nodes_ids;
76 Eigen::MatrixXd nodes;
77 };
78
79 public:
81 static std::unique_ptr<Mesh> create(MeshData data, bool non_conforming = false);
82
84 MeshData to_mesh_data() const;
85
88 virtual std::unique_ptr<Mesh> copy() const = 0;
89
91 std::vector<MeshWithID> split() const;
92
93 protected:
97 Mesh() = default;
98
99 public:
102 virtual ~Mesh() = default;
106 Mesh(Mesh &&) = default;
111 Mesh &operator=(Mesh &&) = default;
115 Mesh(const Mesh &) = default;
120 Mesh &operator=(const Mesh &) = default;
121
127 virtual void refine(const int n_refinement, const double t) = 0;
128
133 virtual bool is_volume() const = 0;
138 int dimension() const { return (is_volume() ? 3 : 2); }
143 virtual bool is_conforming() const = 0;
148 int n_elements() const { return (is_volume() ? n_cells() : n_faces()); }
153 int n_boundary_elements() const { return (is_volume() ? n_faces() : n_edges()); }
154
159 virtual int n_cells() const = 0;
164 virtual int n_faces() const = 0;
168 virtual int n_edges() const = 0;
172 virtual int n_vertices() const = 0;
173
178 virtual int n_face_vertices(const int f_id) const = 0;
183 virtual int n_cell_vertices(const int c_id) const = 0;
189 virtual int edge_vertex(const int e_id, const int lv_id) const = 0;
195 virtual int face_vertex(const int f_id, const int lv_id) const = 0;
201 virtual int cell_vertex(const int f_id, const int lv_id) const = 0;
207 int element_vertex(const int el_id, const int lv_id) const
208 {
209 return (is_volume() ? cell_vertex(el_id, lv_id) : face_vertex(el_id, lv_id));
210 }
211
216 std::vector<int> element_vertices(const int el_id) const
217 {
218 std::vector<int> res;
219 for (int i = 0; i < n_cell_vertices(el_id); ++i)
220 res.push_back(element_vertex(el_id, i));
221 std::sort(res.begin(), res.end());
222 return res;
223 }
224
225 int boundary_element_vertex(const int primitive_id, const int lv_id) const
226 {
227 return (is_volume() ? face_vertex(primitive_id, lv_id) : edge_vertex(primitive_id, lv_id));
228 }
229
234 virtual bool is_boundary_vertex(const int vertex_global_id) const = 0;
239 virtual bool is_boundary_edge(const int edge_global_id) const = 0;
244 virtual bool is_boundary_face(const int face_global_id) const = 0;
249 virtual bool is_boundary_element(const int element_global_id) const = 0;
250
251 private:
253 bool build_from_data(const MeshData &data);
254
257 virtual bool build_topology(const MeshData &data) = 0;
258
259 public:
264 virtual void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector<std::vector<int>> &nodes) = 0;
268 inline const Eigen::MatrixXi &orders() const { return orders_; }
272 inline bool is_rational() const { return is_rational_; }
276 inline void set_is_rational(const bool in_is_rational) { is_rational_ = in_is_rational; }
277
280 virtual void normalize() = 0;
281
283 virtual void compute_elements_tag() = 0;
285 virtual void update_elements_tag() { assert(false); }
286
291 virtual double edge_length(const int gid) const
292 {
293 assert(false);
294 return 0;
295 }
300 virtual double quad_area(const int gid) const
301 {
302 assert(false);
303 return 0;
304 }
309 virtual double tri_area(const int gid) const
310 {
311 assert(false);
312 return 0;
313 }
314
319 virtual RowVectorNd point(const int global_index) const = 0;
324 virtual void set_point(const int global_index, const RowVectorNd &p) = 0;
325
330 virtual RowVectorNd edge_barycenter(const int e) const = 0;
335 virtual RowVectorNd face_barycenter(const int f) const = 0;
340 virtual RowVectorNd cell_barycenter(const int c) const = 0;
341
345 void edge_barycenters(Eigen::MatrixXd &barycenters) const;
349 void face_barycenters(Eigen::MatrixXd &barycenters) const;
353 void cell_barycenters(Eigen::MatrixXd &barycenters) const;
357 virtual void compute_element_barycenters(Eigen::MatrixXd &barycenters) const = 0;
358
362 virtual void elements_boxes(std::vector<std::array<Eigen::Vector3d, 2>> &boxes) const = 0;
368 virtual void barycentric_coords(const RowVectorNd &p, const int el_id, Eigen::MatrixXd &coord) const = 0;
369
374 virtual void bounding_box(RowVectorNd &min, RowVectorNd &max) const = 0;
375
380 bool is_spline_compatible(const int el_id) const;
385 bool is_cube(const int el_id) const;
390 bool is_polytope(const int el_id) const;
395 bool is_simplex(const int el_id) const;
400 bool is_prism(const int el_id) const;
401
406 bool is_pyramid(const int el_id) const;
407
411 const std::vector<ElementType> &elements_tag() const { return elements_tag_; }
416 void set_tag(const int el, const ElementType type) { elements_tag_[el] = type; }
417
421 void compute_node_ids(const std::function<int(const size_t, const RowVectorNd &, bool)> &marker);
422
426 virtual void compute_boundary_ids(const std::function<int(const size_t, const std::vector<int> &, const RowVectorNd &, bool)> &marker) = 0;
427
431 virtual void compute_body_ids(const std::function<int(const size_t, const std::vector<int> &, const RowVectorNd &)> &marker) = 0;
432
436 virtual void set_boundary_ids(const std::vector<int> &boundary_ids)
437 {
438 assert(boundary_ids.size() == n_boundary_elements());
439 boundary_ids_ = boundary_ids;
440 }
444 virtual void set_body_ids(const std::vector<int> &body_ids)
445 {
446 assert(body_ids.size() == n_elements());
447 body_ids_ = body_ids;
448 }
449
454 virtual int get_default_boundary_id(const int primitive) const
455 {
456 if (is_volume() ? is_boundary_face(primitive) : is_boundary_edge(primitive))
457 return std::numeric_limits<int>::max(); // default for no selected boundary
458 else
459 return -1; // default for no boundary
460 }
461
466 virtual int get_boundary_id(const int primitive) const
467 {
468 return has_boundary_ids() ? (boundary_ids_.at(primitive)) : get_default_boundary_id(primitive);
469 }
470
475 virtual int get_node_id(const int node_id) const
476 {
477 if (has_node_ids())
478 return node_ids_.at(node_id);
479 else
480 return -1; // default for no boundary
481 }
482
486 void update_nodes(const Eigen::VectorXi &in_node_to_node);
487
492 virtual int get_body_id(const int primitive) const
493 {
494 if (has_body_ids())
495 return body_ids_.at(primitive);
496 else
497 return 0;
498 }
501 virtual const std::vector<int> &get_body_ids() const
502 {
503 return body_ids_;
504 }
505
507 void set_geometry_ids(const std::vector<int> &geometry_ids)
508 {
509 assert(geometry_ids.size() == n_elements());
510 geometry_ids_ = geometry_ids;
511 }
512
514 int get_geometry_id(const int element) const
515 {
516 return has_geometry_ids() ? geometry_ids_.at(element) : 0;
517 }
518
519 const std::vector<int> &get_geometry_ids() const { return geometry_ids_; }
520 bool has_geometry_ids() const { return !geometry_ids_.empty(); }
524 bool has_node_ids() const { return !node_ids_.empty(); }
528 bool has_boundary_ids() const { return !boundary_ids_.empty(); }
532 virtual bool has_body_ids() const { return !body_ids_.empty(); }
533
538 virtual void get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1) const = 0;
544 virtual void get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1, const std::vector<bool> &valid_elements) const = 0;
545
546 // /// @brief generate a triangular representation of every face
547 // ///
548 // /// @param[out] tris triangles connectivity
549 // /// @param[out] pts triangles vertices
550 // /// @param[out] ranges connection to original faces
551 // virtual void triangulate_faces(Eigen::MatrixXi &tris, Eigen::MatrixXd &pts, std::vector<int> &ranges) const = 0;
552
557 const std::vector<double> &cell_weights(const int cell_index) const { return cell_weights_[cell_index]; }
561 void set_cell_weights(const std::vector<std::vector<double>> &in_cell_weights) { cell_weights_ = in_cell_weights; }
562
565 virtual void prepare_mesh() {};
566
570 bool has_poly() const
571 {
572 for (int i = 0; i < n_elements(); ++i)
573 {
574 if (is_polytope(i))
575 return true;
576 }
577
578 return false;
579 }
580
584 bool has_prism() const
585 {
586 for (int i = 0; i < n_elements(); ++i)
587 {
588 if (is_prism(i))
589 return true;
590 }
591
592 return false;
593 }
594
598 bool has_pyramids() const
599 {
600 for (int i = 0; i < n_elements(); ++i)
601 {
602 if (is_pyramid(i))
603 return true;
604 }
605
606 return false;
607 }
608
612 bool is_simplicial() const
613 {
614 for (int i = 0; i < n_elements(); ++i)
615 {
616 if (!is_simplex(i))
617 return false;
618 }
619
620 return true;
621 }
622
626 inline bool is_linear() const { return orders_.size() == 0 || orders_.maxCoeff() == 1; }
627
631 std::vector<std::pair<int, int>> edges() const;
635 std::vector<std::vector<int>> faces() const;
636
640 std::unordered_map<std::pair<int, int>, size_t, polyfem::utils::HashPair> edges_to_ids() const;
644 std::unordered_map<std::vector<int>, size_t, polyfem::utils::HashVector> faces_to_ids() const;
645
649 inline const Eigen::VectorXi &in_ordered_vertices() const { return in_ordered_vertices_; }
653 inline const Eigen::MatrixXi &in_ordered_edges() const { return in_ordered_edges_; }
657 inline const Eigen::MatrixXi &in_ordered_faces() const { return in_ordered_faces_; }
658
662 virtual void append(const Mesh &mesh);
663
667 void append(const std::unique_ptr<Mesh> &mesh)
668 {
669 if (mesh != nullptr)
670 append(*mesh);
671 }
672
676 void apply_affine_transformation(const MatrixNd &A, const VectorNd &b);
677
678 protected:
680 virtual void remove_elements(const std::vector<bool> &keep) = 0;
681 void filter_element_data(const std::vector<bool> &keep);
683 void transform_higher_order_data(const MatrixNd &A, const VectorNd &b);
684
686 std::vector<ElementType> elements_tag_;
688 std::vector<int> node_ids_;
690 std::vector<int> boundary_ids_;
692 std::vector<int> body_ids_;
694 std::vector<int> geometry_ids_;
696 Eigen::MatrixXi orders_;
698 bool is_rational_ = false;
699
701 std::vector<EdgeNodes> edge_nodes_;
703 std::vector<FaceNodes> face_nodes_;
705 std::vector<CellNodes> cell_nodes_;
707 std::vector<std::vector<double>> cell_weights_;
714 Eigen::MatrixXd higher_order_nodes_;
715 std::vector<std::vector<int>> higher_order_connectivity_;
716
718 Eigen::VectorXi in_ordered_vertices_;
720 Eigen::MatrixXi in_ordered_edges_;
722 Eigen::MatrixXi in_ordered_faces_;
723 };
724 } // namespace mesh
725} // namespace polyfem
int V
Class to store the high-order cells nodes.
Definition Mesh.hpp:72
Eigen::MatrixXd nodes
Definition Mesh.hpp:76
std::vector< int > nodes_ids
Definition Mesh.hpp:75
Class to store the high-order edge nodes.
Definition Mesh.hpp:54
Eigen::MatrixXd nodes
Definition Mesh.hpp:58
std::vector< int > nodes_ids
Definition Mesh.hpp:57
Class to store the high-order face nodes.
Definition Mesh.hpp:63
std::vector< int > nodes_ids
Definition Mesh.hpp:66
Eigen::MatrixXd nodes
Definition Mesh.hpp:67
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 n_elements() const
utitlity to return the number of elements, cells or faces in 3d and 2d
Definition Mesh.hpp:148
virtual int n_vertices() const =0
number of vertices
virtual int get_body_id(const int primitive) const
Get the volume selection of an element (cell in 3d, face in 2d)
Definition Mesh.hpp:492
virtual void compute_element_barycenters(Eigen::MatrixXd &barycenters) const =0
utility for 2d/3d.
virtual double edge_length(const int gid) const
edge length
Definition Mesh.hpp:291
void set_cell_weights(const std::vector< std::vector< double > > &in_cell_weights)
Set the cell weights for rational polynomial meshes.
Definition Mesh.hpp:561
const Eigen::MatrixXi & in_ordered_edges() const
Order of the input edges.
Definition Mesh.hpp:653
bool is_polytope(const int el_id) const
checks if element is polygon compatible
Definition Mesh.cpp:340
Eigen::MatrixXi orders_
list of geometry orders, one per cell
Definition Mesh.hpp:696
std::unordered_map< std::pair< int, int >, size_t, polyfem::utils::HashPair > edges_to_ids() const
map from edge (pair of v id) to the id of the edge
Definition Mesh.cpp:421
bool is_rational() const
check if curved mesh has rational polynomials elements
Definition Mesh.hpp:272
Mesh()=default
Construct a new Mesh object.
std::vector< ElementType > elements_tag_
list of element types
Definition Mesh.hpp:686
virtual RowVectorNd edge_barycenter(const int e) const =0
edge barycenter
virtual void get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1) const =0
Get all the edges.
int element_vertex(const int el_id, const int lv_id) const
id of the vertex of a element
Definition Mesh.hpp:207
bool is_rational_
stores if the mesh is rational
Definition Mesh.hpp:698
bool has_boundary_ids() const
checks if surface selections are available
Definition Mesh.hpp:528
virtual void compute_boundary_ids(const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &, bool)> &marker)=0
computes boundary selections based on a function
virtual double tri_area(const int gid) const
area of a tri face of a tet mesh
Definition Mesh.hpp:309
void cell_barycenters(Eigen::MatrixXd &barycenters) const
all cells barycenters
Definition Mesh.cpp:295
virtual void get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1, const std::vector< bool > &valid_elements) const =0
Get all the edges according to valid_elements selection.
bool is_simplicial() const
checks if the mesh is simplicial
Definition Mesh.hpp:612
std::vector< std::vector< int > > higher_order_connectivity_
Definition Mesh.hpp:715
virtual bool is_conforming() const =0
if the mesh is conforming
virtual void bounding_box(RowVectorNd &min, RowVectorNd &max) const =0
computes the bbox of the mesh
virtual void barycentric_coords(const RowVectorNd &p, const int el_id, Eigen::MatrixXd &coord) const =0
constructs barycentric coodiantes for a point p.
virtual RowVectorNd face_barycenter(const int f) const =0
face barycenter
virtual void update_elements_tag()
Update elements types.
Definition Mesh.hpp:285
int get_geometry_id(const int element) const
Get the geometry ID of an element. The default geometry is 0.
Definition Mesh.hpp:514
Mesh & operator=(const Mesh &)=default
virtual void compute_elements_tag()=0
compute element types, see ElementType
virtual void set_point(const int global_index, const RowVectorNd &p)=0
Set the point.
bool is_cube(const int el_id) const
checks if element is cube compatible
Definition Mesh.cpp:327
bool has_node_ids() const
checks if points selections are available
Definition Mesh.hpp:524
virtual void set_body_ids(const std::vector< int > &body_ids)
Set the volume sections.
Definition Mesh.hpp:444
virtual RowVectorNd point(const int global_index) const =0
point coordinates
const Eigen::MatrixXi & orders() const
order of each element
Definition Mesh.hpp:268
virtual bool is_boundary_face(const int face_global_id) const =0
is face boundary
Eigen::MatrixXi in_ordered_faces_
Order of the input faces, TODO: change to std::vector of Eigen::Vector.
Definition Mesh.hpp:722
void compute_node_ids(const std::function< int(const size_t, const RowVectorNd &, bool)> &marker)
computes boundary selections based on a function
Definition Mesh.cpp:362
virtual int get_boundary_id(const int primitive) const
Get the boundary selection of an element (face in 3d, edge in 2d)
Definition Mesh.hpp:466
virtual bool is_boundary_vertex(const int vertex_global_id) const =0
is vertex boundary
bool is_simplex(const int el_id) const
checks if element is simplex
Definition Mesh.cpp:374
void face_barycenters(Eigen::MatrixXd &barycenters) const
all face barycenters
Definition Mesh.cpp:286
virtual double quad_area(const int gid) const
area of a quad face of an hex mesh
Definition Mesh.hpp:300
virtual bool has_body_ids() const
checks if volumes selections are available
Definition Mesh.hpp:532
bool has_prism() const
checks if the mesh has prisms
Definition Mesh.hpp:584
virtual void normalize()=0
normalize the mesh
bool is_spline_compatible(const int el_id) const
checks if element is spline compatible
Definition Mesh.cpp:307
virtual void prepare_mesh()
method used to finalize the mesh.
Definition Mesh.hpp:565
std::vector< int > geometry_ids_
list of geometry labels, one per top-dimensional element
Definition Mesh.hpp:694
void set_is_rational(const bool in_is_rational)
Set the is rational object.
Definition Mesh.hpp:276
Mesh & operator=(Mesh &&)=default
Copy constructor.
std::vector< int > boundary_ids_
list of surface labels
Definition Mesh.hpp:690
bool is_prism(const int el_id) const
checks if element is a prism
Definition Mesh.cpp:379
bool is_linear() const
check if the mesh is linear
Definition Mesh.hpp:626
void clear_higher_order_data()
Definition Mesh.cpp:685
void apply_affine_transformation(const MatrixNd &A, const VectorNd &b)
Apply an affine transformation to the vertex positions .
Definition Mesh.cpp:670
std::vector< int > node_ids_
list of node labels
Definition Mesh.hpp:688
std::unordered_map< std::vector< int >, size_t, polyfem::utils::HashVector > faces_to_ids() const
map from face (tuple of v id) to the id of the face
Definition Mesh.cpp:437
bool has_pyramids() const
checks if the mesh has pyramids
Definition Mesh.hpp:598
virtual void refine(const int n_refinement, const double t)=0
refine the mesh
std::vector< CellNodes > cell_nodes_
high-order nodes associates to cells
Definition Mesh.hpp:705
MeshData to_mesh_data() const
Capture the complete runtime mesh in the canonical, format-independent representation.
Definition Mesh.cpp:100
virtual bool build_topology(const MeshData &data)=0
Construct only the dimension-specific topology.
std::vector< std::vector< double > > cell_weights_
weights associates to cells for rational polynomail meshes
Definition Mesh.hpp:707
const std::vector< double > & cell_weights(const int cell_index) const
weights for rational polynomial meshes
Definition Mesh.hpp:557
virtual bool is_volume() const =0
checks if mesh is volume
std::vector< std::pair< int, int > > edges() const
list of sorted edges.
Definition Mesh.cpp:389
void update_nodes(const Eigen::VectorXi &in_node_to_node)
Update the node ids to reorder them.
Definition Mesh.cpp:346
virtual int edge_vertex(const int e_id, const int lv_id) const =0
id of the edge vertex
virtual std::unique_ptr< Mesh > copy() const =0
Create a copy of the mesh.
void set_geometry_ids(const std::vector< int > &geometry_ids)
Set the geometry selection, one ID per element.
Definition Mesh.hpp:507
std::vector< MeshWithID > split() const
Split the mesh according to its per-element geometry IDs.
Definition Mesh.cpp:26
void append(const std::unique_ptr< Mesh > &mesh)
appends a new mesh to the end of this, utility that takes pointer, calls other one
Definition Mesh.hpp:667
virtual bool is_boundary_edge(const int edge_global_id) const =0
is edge boundary
virtual void remove_elements(const std::vector< bool > &keep)=0
Remove all top-dimensional elements whose mask entry is false.
bool has_poly() const
checks if the mesh has polytopes
Definition Mesh.hpp:570
Eigen::MatrixXd higher_order_nodes_
Canonical connectivity is retained because the runtime edge/face caches do not preserve the original ...
Definition Mesh.hpp:714
std::vector< int > element_vertices(const int el_id) const
list of vids of an element
Definition Mesh.hpp:216
const Eigen::VectorXi & in_ordered_vertices() const
Order of the input vertices.
Definition Mesh.hpp:649
std::vector< int > body_ids_
list of volume labels
Definition Mesh.hpp:692
virtual int get_default_boundary_id(const int primitive) const
Get the default boundary selection of an element (face in 3d, edge in 2d)
Definition Mesh.hpp:454
int dimension() const
utily for dimension
Definition Mesh.hpp:138
virtual int n_cells() const =0
number of cells
void transform_higher_order_data(const MatrixNd &A, const VectorNd &b)
Definition Mesh.cpp:693
virtual const std::vector< int > & get_body_ids() const
Get the volume selection of all elements (cells in 3d, faces in 2d)
Definition Mesh.hpp:501
static std::unique_ptr< Mesh > create(MeshData data, bool non_conforming=false)
Construct a runtime mesh from format-independent decoded data.
Definition Mesh.cpp:80
std::vector< FaceNodes > face_nodes_
high-order nodes associates to faces
Definition Mesh.hpp:703
virtual int n_faces() const =0
number of faces
const std::vector< ElementType > & elements_tag() const
Returns the elements types.
Definition Mesh.hpp:411
bool build_from_data(const MeshData &data)
Import all topology and metadata from MeshData.
Definition Mesh.cpp:203
const std::vector< int > & get_geometry_ids() const
Definition Mesh.hpp:519
std::vector< EdgeNodes > edge_nodes_
high-order nodes associates to edges
Definition Mesh.hpp:701
std::vector< std::vector< int > > faces() const
list of sorted faces.
Definition Mesh.cpp:405
virtual void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector< std::vector< int > > &nodes)=0
attach high order nodes
int n_boundary_elements() const
utitlity to return the number of boundary elements, faces or edges in 3d and 2d
Definition Mesh.hpp:153
void filter_element_data(const std::vector< bool > &keep)
Definition Mesh.cpp:46
Eigen::MatrixXi in_ordered_edges_
Order of the input edges.
Definition Mesh.hpp:720
void set_tag(const int el, const ElementType type)
changes the element type
Definition Mesh.hpp:416
virtual void append(const Mesh &mesh)
appends a new mesh to the end of this
Definition Mesh.cpp:456
bool is_pyramid(const int el_id) const
checks if element is a pyramid
Definition Mesh.cpp:384
Mesh(Mesh &&)=default
Construct a new Mesh object.
virtual RowVectorNd cell_barycenter(const int c) const =0
cell barycenter
const Eigen::MatrixXi & in_ordered_faces() const
Order of the input edges.
Definition Mesh.hpp:657
virtual int n_edges() const =0
number of edges
virtual void set_boundary_ids(const std::vector< int > &boundary_ids)
Set the boundary selection from a vector.
Definition Mesh.hpp:436
virtual void compute_body_ids(const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &)> &marker)=0
computes boundary selections based on a function
void edge_barycenters(Eigen::MatrixXd &barycenters) const
all edges barycenters
Definition Mesh.cpp:277
virtual int cell_vertex(const int f_id, const int lv_id) const =0
id of the vertex of a cell
virtual int n_face_vertices(const int f_id) const =0
number of vertices of a face
virtual void elements_boxes(std::vector< std::array< Eigen::Vector3d, 2 > > &boxes) const =0
constructs a box around every element (3d cell, 2d face)
bool has_explicit_polyhedral_topology_
Whether the source MeshData supplied explicit face/cell incidence.
Definition Mesh.hpp:711
Eigen::VectorXi in_ordered_vertices_
Order of the input vertices.
Definition Mesh.hpp:718
virtual bool is_boundary_element(const int element_global_id) const =0
is cell boundary
bool has_geometry_ids() const
Definition Mesh.hpp:520
virtual int n_cell_vertices(const int c_id) const =0
number of vertices of a cell
virtual int get_node_id(const int node_id) const
Get the boundary selection of a node.
Definition Mesh.hpp:475
virtual ~Mesh()=default
Destroy the Mesh object.
virtual int face_vertex(const int f_id, const int lv_id) const =0
id of the face vertex
Mesh(const Mesh &)=default
Construct a new Mesh object.
int boundary_element_vertex(const int primitive_id, const int lv_id) const
Definition Mesh.hpp:225
ElementType
Type of Element, check [Poly-Spline Finite Element Method] for a complete description.
Definition Mesh.hpp:32
@ REGULAR_INTERIOR_CUBE
Triangle/tet element.
@ REGULAR_BOUNDARY_CUBE
Quad/Hex incident to more than 1 singular vertices (should not happen in 2D)
@ MULTI_SINGULAR_BOUNDARY_CUBE
Quad incident to exactly 1 singular vertex (in 2D); hex incident to exactly 1 singular interior edge,...
@ MULTI_SINGULAR_INTERIOR_CUBE
Quad/hex incident to exactly 1 singular vertex (in 2D) or edge (in 3D)
@ SIMPLE_SINGULAR_INTERIOR_CUBE
Regular quad/hex inside a 3^n patch.
@ INTERFACE_CUBE
Boundary hex that is not regular nor SimpleSingularBoundaryCube.
@ INTERIOR_POLYTOPE
Quad/hex that is at the interface with a polytope (if a cube has both external boundary and and inter...
@ SIMPLE_SINGULAR_BOUNDARY_CUBE
Boundary quad/hex, where all boundary vertices/edges are incident to at most 2 quads/hexes.
@ BOUNDARY_POLYTOPE
Interior polytope.
Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 3, 1 > VectorNd
Definition Types.hpp:11
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor, 3, 3 > MatrixNd
Definition Types.hpp:14
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:13
std::unique_ptr< Mesh > mesh
Definition Mesh.hpp:24