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
12#include <memory>
13
14namespace polyfem
15{
16 namespace mesh
17 {
18 class Mesh;
19
21 {
22 int id;
23 std::unique_ptr<Mesh> mesh;
24 };
25
46
76 class Mesh
77 {
78 protected:
81 {
82 public:
83 int v1 = -1, v2 = -1;
84 std::vector<int> nodes_ids;
85 Eigen::MatrixXd nodes;
86 };
87
90 {
91 public:
92 int v1 = -1, v2 = -1, v3 = -1;
93 std::vector<int> nodes_ids;
94 Eigen::MatrixXd nodes;
95 };
96
99 {
100 public:
101 int v1 = -1, v2 = -1, v3 = -1, v4 = -1;
102 std::vector<int> nodes_ids;
103 Eigen::MatrixXd nodes;
104 };
105
106 public:
108 static std::unique_ptr<Mesh> create(MeshData data, bool non_conforming = false);
109
111 MeshData to_mesh_data() const;
112
115 virtual std::unique_ptr<Mesh> copy() const = 0;
116
118 std::vector<MeshWithID> split() const;
119
120 protected:
124 Mesh() = default;
125
126 public:
129 virtual ~Mesh() = default;
133 Mesh(Mesh &&) = default;
138 Mesh &operator=(Mesh &&) = default;
142 Mesh(const Mesh &) = default;
147 Mesh &operator=(const Mesh &) = default;
148
160 virtual void refine(const int n_refinement, const double t) = 0;
161
166 virtual bool is_volume() const = 0;
171 int dimension() const { return (is_volume() ? 3 : 2); }
176 virtual bool is_conforming() const = 0;
181 int n_elements() const { return (is_volume() ? n_cells() : n_faces()); }
186 int n_boundary_elements() const { return (is_volume() ? n_faces() : n_edges()); }
187
192 virtual int n_cells() const = 0;
197 virtual int n_faces() const = 0;
201 virtual int n_edges() const = 0;
205 virtual int n_vertices() const = 0;
206
211 virtual int n_face_vertices(const int f_id) const = 0;
216 virtual int n_cell_vertices(const int c_id) const = 0;
222 virtual int edge_vertex(const int e_id, const int lv_id) const = 0;
228 virtual int face_vertex(const int f_id, const int lv_id) const = 0;
234 virtual int cell_vertex(const int f_id, const int lv_id) const = 0;
240 int element_vertex(const int el_id, const int lv_id) const
241 {
242 return (is_volume() ? cell_vertex(el_id, lv_id) : face_vertex(el_id, lv_id));
243 }
244
249 std::vector<int> element_vertices(const int el_id) const
250 {
251 std::vector<int> res;
252 for (int i = 0; i < n_cell_vertices(el_id); ++i)
253 res.push_back(element_vertex(el_id, i));
254 std::sort(res.begin(), res.end());
255 return res;
256 }
257
258 int boundary_element_vertex(const int primitive_id, const int lv_id) const
259 {
260 return (is_volume() ? face_vertex(primitive_id, lv_id) : edge_vertex(primitive_id, lv_id));
261 }
262
267 virtual bool is_boundary_vertex(const int vertex_global_id) const = 0;
272 virtual bool is_boundary_edge(const int edge_global_id) const = 0;
277 virtual bool is_boundary_face(const int face_global_id) const = 0;
282 virtual bool is_boundary_element(const int element_global_id) const = 0;
283
284 private:
286 bool build_from_data(const MeshData &data);
287
290 virtual bool build_topology(const MeshData &data) = 0;
291
292 public:
297 virtual void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector<std::vector<int>> &nodes) = 0;
301 inline const Eigen::MatrixXi &orders() const { return orders_; }
305 inline bool is_rational() const { return is_rational_; }
309 inline void set_is_rational(const bool in_is_rational) { is_rational_ = in_is_rational; }
310
313 virtual void normalize() = 0;
314
316 virtual void compute_elements_tag() = 0;
318 virtual void update_elements_tag() { assert(false); }
319
324 virtual double edge_length(const int gid) const
325 {
326 assert(false);
327 return 0;
328 }
333 virtual double quad_area(const int gid) const
334 {
335 assert(false);
336 return 0;
337 }
342 virtual double tri_area(const int gid) const
343 {
344 assert(false);
345 return 0;
346 }
347
352 virtual RowVectorNd point(const int global_index) const = 0;
357 virtual void set_point(const int global_index, const RowVectorNd &p) = 0;
358
363 virtual RowVectorNd edge_barycenter(const int e) const = 0;
368 virtual RowVectorNd face_barycenter(const int f) const = 0;
373 virtual RowVectorNd cell_barycenter(const int c) const = 0;
374
378 void edge_barycenters(Eigen::MatrixXd &barycenters) const;
382 void face_barycenters(Eigen::MatrixXd &barycenters) const;
386 void cell_barycenters(Eigen::MatrixXd &barycenters) const;
390 virtual void compute_element_barycenters(Eigen::MatrixXd &barycenters) const = 0;
391
395 virtual void elements_boxes(std::vector<std::array<Eigen::Vector3d, 2>> &boxes) const = 0;
401 virtual void barycentric_coords(const RowVectorNd &p, const int el_id, Eigen::MatrixXd &coord) const = 0;
402
407 virtual void bounding_box(RowVectorNd &min, RowVectorNd &max) const = 0;
408
413 bool is_spline_compatible(const int el_id) const;
418 bool is_cube(const int el_id) const;
423 bool is_polytope(const int el_id) const;
428 bool is_simplex(const int el_id) const;
433 bool is_prism(const int el_id) const;
434
439 bool is_pyramid(const int el_id) const;
440
444 const std::vector<ElementType> &elements_tag() const { return elements_tag_; }
449 void set_tag(const int el, const ElementType type) { elements_tag_[el] = type; }
450
454 void compute_node_ids(const std::function<int(const size_t, const RowVectorNd &, bool)> &marker);
455
459 virtual void compute_boundary_ids(const std::function<int(const size_t, const std::vector<int> &, const RowVectorNd &, bool)> &marker) = 0;
460
464 virtual void compute_body_ids(const std::function<int(const size_t, const std::vector<int> &, const RowVectorNd &)> &marker) = 0;
465
469 virtual void set_boundary_ids(const std::vector<int> &boundary_ids)
470 {
471 assert(boundary_ids.size() == n_boundary_elements());
472 boundary_ids_ = boundary_ids;
473 }
477 virtual void set_body_ids(const std::vector<int> &body_ids)
478 {
479 assert(body_ids.size() == n_elements());
480 body_ids_ = body_ids;
481 }
482
487 virtual int get_default_boundary_id(const int primitive) const
488 {
489 if (is_volume() ? is_boundary_face(primitive) : is_boundary_edge(primitive))
490 return std::numeric_limits<int>::max(); // default for no selected boundary
491 else
492 return -1; // default for no boundary
493 }
494
499 virtual int get_boundary_id(const int primitive) const
500 {
501 return has_boundary_ids() ? (boundary_ids_.at(primitive)) : get_default_boundary_id(primitive);
502 }
503
509 virtual int get_node_id(const int node_id) const
510 {
511 if (node_id >= 0 && node_id < node_ids_.size())
512 return node_ids_[node_id];
513 else
514 return -1; // default for no boundary (and for vertices without an id)
515 }
516
521 virtual int get_body_id(const int primitive) const
522 {
523 if (has_body_ids())
524 return body_ids_.at(primitive);
525 else
526 return 0;
527 }
530 virtual const std::vector<int> &get_body_ids() const
531 {
532 return body_ids_;
533 }
534
536 void set_geometry_ids(const std::vector<int> &geometry_ids)
537 {
538 assert(geometry_ids.size() == n_elements());
539 geometry_ids_ = geometry_ids;
540 }
541
543 int get_geometry_id(const int element) const
544 {
545 return has_geometry_ids() ? geometry_ids_.at(element) : 0;
546 }
547
548 const std::vector<int> &get_geometry_ids() const { return geometry_ids_; }
549 bool has_geometry_ids() const { return !geometry_ids_.empty(); }
553 bool has_node_ids() const { return !node_ids_.empty(); }
557 bool has_boundary_ids() const { return !boundary_ids_.empty(); }
561 virtual bool has_body_ids() const { return !body_ids_.empty(); }
562
567 virtual void get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1) const = 0;
573 virtual void get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1, const std::vector<bool> &valid_elements) const = 0;
574
575 // /// @brief generate a triangular representation of every face
576 // ///
577 // /// @param[out] tris triangles connectivity
578 // /// @param[out] pts triangles vertices
579 // /// @param[out] ranges connection to original faces
580 // virtual void triangulate_faces(Eigen::MatrixXi &tris, Eigen::MatrixXd &pts, std::vector<int> &ranges) const = 0;
581
586 const std::vector<double> &cell_weights(const int cell_index) const { return cell_weights_[cell_index]; }
590 void set_cell_weights(const std::vector<std::vector<double>> &in_cell_weights) { cell_weights_ = in_cell_weights; }
591
594 virtual void prepare_mesh() {};
595
599 bool has_poly() const
600 {
601 for (int i = 0; i < n_elements(); ++i)
602 {
603 if (is_polytope(i))
604 return true;
605 }
606
607 return false;
608 }
609
613 bool has_prism() const
614 {
615 for (int i = 0; i < n_elements(); ++i)
616 {
617 if (is_prism(i))
618 return true;
619 }
620
621 return false;
622 }
623
627 bool has_pyramids() const
628 {
629 for (int i = 0; i < n_elements(); ++i)
630 {
631 if (is_pyramid(i))
632 return true;
633 }
634
635 return false;
636 }
637
641 bool is_simplicial() const
642 {
643 for (int i = 0; i < n_elements(); ++i)
644 {
645 if (!is_simplex(i))
646 return false;
647 }
648
649 return true;
650 }
651
655 inline bool is_linear() const { return orders_.size() == 0 || orders_.maxCoeff() == 1; }
656
660 std::vector<std::pair<int, int>> edges() const;
664 std::vector<std::vector<int>> faces() const;
665
669 std::unordered_map<std::pair<int, int>, size_t, polyfem::utils::HashPair> edges_to_ids() const;
673 std::unordered_map<std::vector<int>, size_t, polyfem::utils::HashVector> faces_to_ids() const;
674
678 inline const Eigen::VectorXi &in_ordered_vertices() const { return in_ordered_vertices_; }
682 inline const Eigen::MatrixXi &in_ordered_edges() const { return in_ordered_edges_; }
686 inline const Eigen::MatrixXi &in_ordered_faces() const { return in_ordered_faces_; }
687
691 virtual void append(const Mesh &mesh);
692
696 void append(const std::unique_ptr<Mesh> &mesh)
697 {
698 if (mesh != nullptr)
699 append(*mesh);
700 }
701
706 virtual void apply_affine_transformation(const MatrixNd &A, const VectorNd &b);
707
708 protected:
710 virtual void remove_elements(const std::vector<bool> &keep) = 0;
711 void filter_element_data(const std::vector<bool> &keep);
715 void transform_higher_order_data(const MatrixNd &A, const VectorNd &b);
716
718 std::vector<ElementType> elements_tag_;
720 std::vector<int> node_ids_;
722 std::vector<int> boundary_ids_;
724 std::vector<int> body_ids_;
726 std::vector<int> geometry_ids_;
728 Eigen::MatrixXi orders_;
730 bool is_rational_ = false;
731
733 std::vector<EdgeNodes> edge_nodes_;
735 std::vector<FaceNodes> face_nodes_;
737 std::vector<CellNodes> cell_nodes_;
739 std::vector<std::vector<double>> cell_weights_;
746 Eigen::MatrixXd higher_order_nodes_;
747 std::vector<std::vector<int>> higher_order_connectivity_;
748
750 Eigen::VectorXi in_ordered_vertices_;
752 Eigen::MatrixXi in_ordered_edges_;
754 Eigen::MatrixXi in_ordered_faces_;
755 };
756 } // namespace mesh
757} // namespace polyfem
int V
Class to store the high-order cells nodes.
Definition Mesh.hpp:99
std::vector< int > nodes_ids
Definition Mesh.hpp:102
Class to store the high-order edge nodes.
Definition Mesh.hpp:81
Eigen::MatrixXd nodes
Definition Mesh.hpp:85
std::vector< int > nodes_ids
Definition Mesh.hpp:84
Class to store the high-order face nodes.
Definition Mesh.hpp:90
std::vector< int > nodes_ids
Definition Mesh.hpp:93
Eigen::MatrixXd nodes
Definition Mesh.hpp:94
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:77
int n_elements() const
utitlity to return the number of elements, cells or faces in 3d and 2d
Definition Mesh.hpp:181
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:521
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:324
void set_cell_weights(const std::vector< std::vector< double > > &in_cell_weights)
Set the cell weights for rational polynomial meshes.
Definition Mesh.hpp:590
const Eigen::MatrixXi & in_ordered_edges() const
Order of the input edges.
Definition Mesh.hpp:682
bool is_polytope(const int el_id) const
checks if element is polygon compatible
Definition Mesh.cpp:374
Eigen::MatrixXi orders_
list of geometry orders, one per cell
Definition Mesh.hpp:728
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:439
bool is_rational() const
check if curved mesh has rational polynomials elements
Definition Mesh.hpp:305
Mesh()=default
Construct a new Mesh object.
std::vector< ElementType > elements_tag_
list of element types
Definition Mesh.hpp:718
void clear_data_lost_by_refinement()
Drop the labels and the higher-order geometry before a conforming refinement.
Definition Mesh.cpp:702
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:240
bool is_rational_
stores if the mesh is rational
Definition Mesh.hpp:730
bool has_boundary_ids() const
checks if surface selections are available
Definition Mesh.hpp:557
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:342
void cell_barycenters(Eigen::MatrixXd &barycenters) const
all cells barycenters
Definition Mesh.cpp:329
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:641
std::vector< std::vector< int > > higher_order_connectivity_
Definition Mesh.hpp:747
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:318
int get_geometry_id(const int element) const
Get the geometry ID of an element. The default geometry is 0.
Definition Mesh.hpp:543
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:361
bool has_node_ids() const
checks if points selections are available
Definition Mesh.hpp:553
virtual void set_body_ids(const std::vector< int > &body_ids)
Set the volume sections.
Definition Mesh.hpp:477
virtual RowVectorNd point(const int global_index) const =0
point coordinates
const Eigen::MatrixXi & orders() const
order of each element
Definition Mesh.hpp:301
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:754
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:380
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:499
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:392
void face_barycenters(Eigen::MatrixXd &barycenters) const
all face barycenters
Definition Mesh.cpp:320
virtual double quad_area(const int gid) const
area of a quad face of an hex mesh
Definition Mesh.hpp:333
virtual bool has_body_ids() const
checks if volumes selections are available
Definition Mesh.hpp:561
bool has_prism() const
checks if the mesh has prisms
Definition Mesh.hpp:613
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:341
virtual void prepare_mesh()
method used to finalize the mesh.
Definition Mesh.hpp:594
std::vector< int > geometry_ids_
list of geometry labels, one per top-dimensional element
Definition Mesh.hpp:726
void set_is_rational(const bool in_is_rational)
Set the is rational object.
Definition Mesh.hpp:309
Mesh & operator=(Mesh &&)=default
Copy constructor.
std::vector< int > boundary_ids_
list of surface labels
Definition Mesh.hpp:722
bool is_prism(const int el_id) const
checks if element is a prism
Definition Mesh.cpp:397
bool is_linear() const
check if the mesh is linear
Definition Mesh.hpp:655
void clear_higher_order_data()
Definition Mesh.cpp:715
virtual void apply_affine_transformation(const MatrixNd &A, const VectorNd &b)
Apply an affine transformation to the vertex positions (and to every other stored position,...
Definition Mesh.cpp:687
std::vector< int > node_ids_
list of node labels, one per vertex
Definition Mesh.hpp:720
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:455
bool has_pyramids() const
checks if the mesh has pyramids
Definition Mesh.hpp:627
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:737
MeshData to_mesh_data() const
Capture the complete runtime mesh in the canonical, format-independent representation.
Definition Mesh.cpp:103
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:739
const std::vector< double > & cell_weights(const int cell_index) const
weights for rational polynomial meshes
Definition Mesh.hpp:586
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:407
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:536
std::vector< MeshWithID > split() const
Split the mesh according to its per-element geometry IDs.
Definition Mesh.cpp:29
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:696
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:599
Eigen::MatrixXd higher_order_nodes_
Canonical connectivity is retained because the runtime edge/face caches do not preserve the original ...
Definition Mesh.hpp:746
std::vector< int > element_vertices(const int el_id) const
list of vids of an element
Definition Mesh.hpp:249
const Eigen::VectorXi & in_ordered_vertices() const
Order of the input vertices.
Definition Mesh.hpp:678
std::vector< int > body_ids_
list of volume labels
Definition Mesh.hpp:724
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:487
int dimension() const
utily for dimension
Definition Mesh.hpp:171
virtual int n_cells() const =0
number of cells
void transform_higher_order_data(const MatrixNd &A, const VectorNd &b)
Definition Mesh.cpp:723
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:530
static std::unique_ptr< Mesh > create(MeshData data, bool non_conforming=false)
Construct a runtime mesh from format-independent decoded data.
Definition Mesh.cpp:83
std::vector< FaceNodes > face_nodes_
high-order nodes associates to faces
Definition Mesh.hpp:735
virtual int n_faces() const =0
number of faces
const std::vector< ElementType > & elements_tag() const
Returns the elements types.
Definition Mesh.hpp:444
bool build_from_data(const MeshData &data)
Import all topology and metadata from MeshData.
Definition Mesh.cpp:206
const std::vector< int > & get_geometry_ids() const
Definition Mesh.hpp:548
std::vector< EdgeNodes > edge_nodes_
high-order nodes associates to edges
Definition Mesh.hpp:733
std::vector< std::vector< int > > faces() const
list of sorted faces.
Definition Mesh.cpp:423
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:186
void filter_element_data(const std::vector< bool > &keep)
Definition Mesh.cpp:49
Eigen::MatrixXi in_ordered_edges_
Order of the input edges.
Definition Mesh.hpp:752
void set_tag(const int el, const ElementType type)
changes the element type
Definition Mesh.hpp:449
virtual void append(const Mesh &mesh)
appends a new mesh to the end of this
Definition Mesh.cpp:474
bool is_pyramid(const int el_id) const
checks if element is a pyramid
Definition Mesh.cpp:402
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:686
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:469
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:311
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:743
Eigen::VectorXi in_ordered_vertices_
Order of the input vertices.
Definition Mesh.hpp:750
virtual bool is_boundary_element(const int element_global_id) const =0
is cell boundary
bool has_geometry_ids() const
Definition Mesh.hpp:549
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:509
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:258
ElementType
Type of Element, check [Poly-Spline Finite Element Method] for a complete description.
Definition Mesh.hpp:31
@ 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:23