|
PolyFEM
|
#include <Mesh2D.hpp>
Public Member Functions | |
| Mesh2D ()=default | |
| virtual | ~Mesh2D ()=default |
| Mesh2D (Mesh2D &&)=default | |
| Mesh2D & | operator= (Mesh2D &&)=default |
| Mesh2D (const Mesh2D &)=default | |
| Mesh2D & | operator= (const Mesh2D &)=default |
| bool | is_volume () const override |
| checks if mesh is volume | |
| int | n_cells () const override |
| number of cells | |
| int | n_cell_vertices (const int c_id) const override |
| number of vertices of a cell | |
| bool | is_boundary_face (const int face_global_id) const override |
| is face boundary | |
| virtual std::pair< RowVectorNd, int > | edge_node (const Navigation::Index &index, const int n_new_nodes, const int i) const =0 |
| virtual std::pair< RowVectorNd, int > | face_node (const Navigation::Index &index, const int n_new_nodes, const int i, const int j) const =0 |
| RowVectorNd | cell_barycenter (const int index) const override |
| cell barycenter | |
| void | compute_face_jacobian (const int el_id, const Eigen::MatrixXd &reference_map, Eigen::MatrixXd &jacobian) const |
| virtual Navigation::Index | get_index_from_face (int f, int lv=0) const =0 |
| virtual Navigation::Index | switch_vertex (Navigation::Index idx) const =0 |
| virtual Navigation::Index | switch_edge (Navigation::Index idx) const =0 |
| virtual Navigation::Index | switch_face (Navigation::Index idx) const =0 |
| void | barycentric_coords (const RowVectorNd &p, const int el_id, Eigen::MatrixXd &coord) const override |
| constructs barycentric coodiantes for a point p. | |
| RowVectorNd | face_barycenter (const int index) const override |
| face barycenter | |
| void | compute_element_barycenters (Eigen::MatrixXd &barycenters) const override |
| utility for 2d/3d. | |
| void | elements_boxes (std::vector< std::array< Eigen::Vector3d, 2 > > &boxes) const override |
| constructs a box around every element (3d cell, 2d face) | |
| Navigation::Index | next_around_face (Navigation::Index idx) const |
| Navigation::Index | next_around_vertex (Navigation::Index idx) const |
| void | get_edges (Eigen::MatrixXd &p0, Eigen::MatrixXd &p1) const override |
| Get all the edges. | |
| void | get_edges (Eigen::MatrixXd &p0, Eigen::MatrixXd &p1, const std::vector< bool > &valid_elements) const override |
| Get all the edges according to valid_elements selection. | |
Public Member Functions inherited from polyfem::mesh::Mesh | |
| virtual std::unique_ptr< Mesh > | copy () const =0 |
| Create a copy of the mesh. | |
| virtual | ~Mesh ()=default |
| Destroy the Mesh object. | |
| Mesh (Mesh &&)=default | |
| Construct a new Mesh object. | |
| Mesh & | operator= (Mesh &&)=default |
| Copy constructor. | |
| Mesh (const Mesh &)=default | |
| Construct a new Mesh object. | |
| Mesh & | operator= (const Mesh &)=default |
| virtual void | refine (const int n_refinement, const double t)=0 |
| refine the mesh | |
| int | dimension () const |
| utily for dimension | |
| virtual bool | is_conforming () const =0 |
| if the mesh is conforming | |
| int | n_elements () const |
| utitlity to return the number of elements, cells or faces in 3d and 2d | |
| int | n_boundary_elements () const |
| utitlity to return the number of boundary elements, faces or edges in 3d and 2d | |
| virtual int | n_faces () const =0 |
| number of faces | |
| virtual int | n_edges () const =0 |
| number of edges | |
| virtual int | n_vertices () const =0 |
| number of vertices | |
| virtual int | n_face_vertices (const int f_id) const =0 |
| number of vertices of a face | |
| virtual int | edge_vertex (const int e_id, const int lv_id) const =0 |
| id of the edge vertex | |
| virtual int | face_vertex (const int f_id, const int lv_id) const =0 |
| id of the face vertex | |
| virtual int | cell_vertex (const int f_id, const int lv_id) const =0 |
| id of the vertex of a cell | |
| int | element_vertex (const int el_id, const int lv_id) const |
| id of the vertex of a element | |
| std::vector< int > | element_vertices (const int el_id) const |
| list of vids of an element | |
| int | boundary_element_vertex (const int primitive_id, const int lv_id) const |
| virtual bool | is_boundary_vertex (const int vertex_global_id) const =0 |
| is vertex boundary | |
| virtual bool | is_boundary_edge (const int edge_global_id) const =0 |
| is edge boundary | |
| virtual bool | is_boundary_element (const int element_global_id) const =0 |
| is cell boundary | |
| virtual bool | save (const std::string &path) const =0 |
| virtual void | attach_higher_order_nodes (const Eigen::MatrixXd &V, const std::vector< std::vector< int > > &nodes)=0 |
| attach high order nodes | |
| const Eigen::MatrixXi & | orders () const |
| order of each element | |
| bool | is_rational () const |
| check if curved mesh has rational polynomials elements | |
| void | set_is_rational (const bool in_is_rational) |
| Set the is rational object. | |
| virtual void | normalize ()=0 |
| normalize the mesh | |
| virtual void | compute_elements_tag ()=0 |
| compute element types, see ElementType | |
| virtual void | update_elements_tag () |
| Update elements types. | |
| virtual double | edge_length (const int gid) const |
| edge length | |
| virtual double | quad_area (const int gid) const |
| area of a quad face of an hex mesh | |
| virtual double | tri_area (const int gid) const |
| area of a tri face of a tet mesh | |
| virtual RowVectorNd | point (const int global_index) const =0 |
| point coordinates | |
| virtual void | set_point (const int global_index, const RowVectorNd &p)=0 |
| Set the point. | |
| virtual RowVectorNd | edge_barycenter (const int e) const =0 |
| edge barycenter | |
| void | edge_barycenters (Eigen::MatrixXd &barycenters) const |
| all edges barycenters | |
| void | face_barycenters (Eigen::MatrixXd &barycenters) const |
| all face barycenters | |
| void | cell_barycenters (Eigen::MatrixXd &barycenters) const |
| all cells barycenters | |
| virtual void | bounding_box (RowVectorNd &min, RowVectorNd &max) const =0 |
| computes the bbox of the mesh | |
| bool | is_spline_compatible (const int el_id) const |
| checks if element is spline compatible | |
| bool | is_cube (const int el_id) const |
| checks if element is cube compatible | |
| bool | is_polytope (const int el_id) const |
| checks if element is polygon compatible | |
| bool | is_simplex (const int el_id) const |
| checks if element is simplex | |
| bool | is_prism (const int el_id) const |
| checks if element is a prism | |
| const std::vector< ElementType > & | elements_tag () const |
| Returns the elements types. | |
| void | set_tag (const int el, const ElementType type) |
| changes the element type | |
| void | compute_node_ids (const std::function< int(const size_t, const RowVectorNd &, bool)> &marker) |
| computes boundary selections based on a function | |
| virtual void | load_boundary_ids (const std::string &path) |
| loads the boundary selections for a file | |
| 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 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 | |
| virtual void | set_boundary_ids (const std::vector< int > &boundary_ids) |
| Set the boundary selection from a vector. | |
| virtual void | set_body_ids (const std::vector< int > &body_ids) |
| Set the volume sections. | |
| virtual int | get_default_boundary_id (const int primitive) const |
| Get the default boundary selection of an element (face in 3d, edge in 2d) | |
| virtual int | get_boundary_id (const int primitive) const |
| Get the boundary selection of an element (face in 3d, edge in 2d) | |
| virtual int | get_node_id (const int node_id) const |
| Get the boundary selection of a node. | |
| void | update_nodes (const Eigen::VectorXi &in_node_to_node) |
| Update the node ids to reorder them. | |
| virtual int | get_body_id (const int primitive) const |
| Get the volume selection of an element (cell in 3d, face in 2d) | |
| virtual const std::vector< int > & | get_body_ids () const |
| Get the volume selection of all elements (cells in 3d, faces in 2d) | |
| bool | has_node_ids () const |
| checks if points selections are available | |
| bool | has_boundary_ids () const |
| checks if surface selections are available | |
| virtual bool | has_body_ids () const |
| checks if volumes selections are available | |
| const std::vector< double > & | cell_weights (const int cell_index) const |
| weights for rational polynomial meshes | |
| void | set_cell_weights (const std::vector< std::vector< double > > &in_cell_weights) |
| Set the cell weights for rational polynomial meshes. | |
| virtual void | prepare_mesh () |
| method used to finalize the mesh. | |
| bool | has_poly () const |
| checks if the mesh has polytopes | |
| bool | has_prism () const |
| checks if the mesh has prisms | |
| bool | is_simplicial () const |
| checks if the mesh is simplicial | |
| bool | is_linear () const |
| check if the mesh is linear | |
| std::vector< std::pair< int, int > > | edges () const |
| list of sorted edges. | |
| std::vector< std::vector< int > > | faces () const |
| list of sorted faces. | |
| 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 | |
| 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 | |
| const Eigen::VectorXi & | in_ordered_vertices () const |
| Order of the input vertices. | |
| const Eigen::MatrixXi & | in_ordered_edges () const |
| Order of the input edges. | |
| const Eigen::MatrixXi & | in_ordered_faces () const |
| Order of the input edges. | |
| virtual void | append (const Mesh &mesh) |
| appends a new mesh to the end of this | |
| void | append (const std::unique_ptr< Mesh > &mesh) |
| appends a new mesh to the end of this, utility that takes pointer, calls other one | |
| void | apply_affine_transformation (const MatrixNd &A, const VectorNd &b) |
| Apply an affine transformation \(Ax+b\) to the vertex positions \(x\). | |
Additional Inherited Members | |
Static Public Member Functions inherited from polyfem::mesh::Mesh | |
| static std::unique_ptr< Mesh > | create (const std::string &path, const bool non_conforming=false) |
| factory to build the proper mesh | |
| static std::unique_ptr< Mesh > | create (GEO::Mesh &M, const bool non_conforming=false) |
| factory to build the proper mesh | |
| static std::unique_ptr< Mesh > | create (const Eigen::MatrixXd &vertices, const Eigen::MatrixXi &cells, const bool non_conforming=false) |
| factory to build the proper mesh | |
| static std::unique_ptr< Mesh > | create (const int dim, const bool non_conforming=false) |
| factory to build the proper empty mesh | |
Protected Member Functions inherited from polyfem::mesh::Mesh | |
| Mesh ()=default | |
| Construct a new Mesh object. | |
| virtual bool | load (const std::string &path)=0 |
| loads a mesh from the path | |
| virtual bool | load (const GEO::Mesh &M)=0 |
| loads a mesh from a geo mesh | |
Protected Attributes inherited from polyfem::mesh::Mesh | |
| std::vector< ElementType > | elements_tag_ |
| list of element types | |
| std::vector< int > | node_ids_ |
| list of node labels | |
| std::vector< int > | boundary_ids_ |
| list of surface labels | |
| std::vector< int > | body_ids_ |
| list of volume labels | |
| Eigen::MatrixXi | orders_ |
| list of geometry orders, one per cell | |
| bool | is_rational_ = false |
| stores if the mesh is rational | |
| std::vector< EdgeNodes > | edge_nodes_ |
| high-order nodes associates to edges | |
| std::vector< FaceNodes > | face_nodes_ |
| high-order nodes associates to faces | |
| std::vector< CellNodes > | cell_nodes_ |
| high-order nodes associates to cells | |
| std::vector< std::vector< double > > | cell_weights_ |
| weights associates to cells for rational polynomail meshes | |
| Eigen::VectorXi | in_ordered_vertices_ |
| Order of the input vertices. | |
| Eigen::MatrixXi | in_ordered_edges_ |
| Order of the input edges. | |
| Eigen::MatrixXi | in_ordered_faces_ |
| Order of the input faces, TODO: change to std::vector of Eigen::Vector. | |
Definition at line 15 of file Mesh2D.hpp.
|
default |
|
virtualdefault |
|
default |
|
default |
|
overridevirtual |
constructs barycentric coodiantes for a point p.
WARNING works only for simplices
| [in] | p | query point |
| [in] | el_id | element id |
| [out] | coord | matrix containing the barycentric coodinates |
Implements polyfem::mesh::Mesh.
Definition at line 85 of file Mesh2D.cpp.
References get_index_from_face(), polyfem::mesh::Mesh::is_simplex(), next_around_face(), and polyfem::mesh::Mesh::point().
|
inlineoverridevirtual |
cell barycenter
| [in] | c | global cell index |
Implements polyfem::mesh::Mesh.
Definition at line 39 of file Mesh2D.hpp.
|
inlineoverridevirtual |
utility for 2d/3d.
In 2d it returns face_barycenters, in 3d it returns cell_barycenters
| [out] | barycenters | the barycenters |
Implements polyfem::mesh::Mesh.
Definition at line 57 of file Mesh2D.hpp.
References polyfem::mesh::Mesh::face_barycenters().
| void polyfem::mesh::Mesh2D::compute_face_jacobian | ( | const int | el_id, |
| const Eigen::MatrixXd & | reference_map, | ||
| Eigen::MatrixXd & | jacobian | ||
| ) | const |
Definition at line 101 of file Mesh2D.cpp.
References get_index_from_face(), polyfem::mesh::Mesh::is_simplex(), next_around_face(), and polyfem::mesh::Mesh::point().
Referenced by polyfem::solver::AMIPSForm::AMIPSForm(), and polyfem::State::set_materials().
|
pure virtual |
Implemented in polyfem::mesh::CMesh2D, and polyfem::mesh::NCMesh2D.
Referenced by polyfem::mesh::MeshNodes::node_ids_from_edge().
|
overridevirtual |
constructs a box around every element (3d cell, 2d face)
| [out] | boxes | axis aligned bounding boxes |
Implements polyfem::mesh::Mesh.
Definition at line 121 of file Mesh2D.cpp.
References get_index_from_face(), polyfem::mesh::Mesh::n_elements(), polyfem::mesh::Mesh::n_face_vertices(), next_around_face(), and polyfem::mesh::Mesh::point().
|
overridevirtual |
face barycenter
| [in] | f | global face index |
Implements polyfem::mesh::Mesh.
Definition at line 69 of file Mesh2D.cpp.
References get_index_from_face(), polyfem::mesh::Mesh::n_face_vertices(), polyfem::mesh::Mesh::n_vertices(), next_around_face(), polyfem::mesh::Mesh::point(), and polyfem::mesh::Navigation::Index::vertex.
Referenced by polyfem::mesh::CMesh2D::compute_body_ids(), polyfem::mesh::NCMesh2D::compute_body_ids(), and polyfem::solver::ElasticVariableToSimulation::inverse_eval().
|
pure virtual |
Implemented in polyfem::mesh::CMesh2D, and polyfem::mesh::NCMesh2D.
Referenced by polyfem::mesh::MeshNodes::node_ids_from_face().
|
overridevirtual |
Get all the edges.
| [out] | p0 | edge first vertex |
| [out] | p1 | edge second vertex |
Implements polyfem::mesh::Mesh.
Definition at line 21 of file Mesh2D.cpp.
References polyfem::mesh::Mesh::edge_vertex(), polyfem::mesh::Mesh::n_edges(), and polyfem::mesh::Mesh::point().
Referenced by polyfem::mesh::CMesh2D::normalize(), and polyfem::refinement::APriori::p_refine().
|
overridevirtual |
Get all the edges according to valid_elements selection.
| [out] | p0 | edge first vertex |
| [out] | p1 | edge second vertex |
| [in] | valid_elements | flag to compute the edge |
Implements polyfem::mesh::Mesh.
Definition at line 36 of file Mesh2D.cpp.
References get_index_from_face(), polyfem::mesh::Mesh::n_face_vertices(), next_around_face(), polyfem::mesh::Mesh::point(), and switch_vertex().
|
pure virtual |
Implemented in polyfem::mesh::CMesh2D, and polyfem::mesh::NCMesh2D.
Referenced by barycentric_coords(), polyfem::basis::SplineBasis2d::build_bases(), polyfem::basis::BarycentricBasis2d::build_bases(), polyfem::basis::compute_epsilon(), compute_face_jacobian(), elements_boxes(), face_barycenter(), get_edges(), and polyfem::refinement::APriori::p_refine().
|
inlineoverridevirtual |
is face boundary
| [in] | face_global_id | global face id |
Implements polyfem::mesh::Mesh.
Definition at line 30 of file Mesh2D.hpp.
|
inlineoverridevirtual |
checks if mesh is volume
Implements polyfem::mesh::Mesh.
Definition at line 25 of file Mesh2D.hpp.
Referenced by polyfem::basis::PolygonalBasis2d::build_bases(), polyfem::basis::SplineBasis2d::build_bases(), polyfem::basis::BarycentricBasis2d::build_bases(), and polyfem::basis::PolygonalBasis2d::compute_integral_constraints().
|
inlineoverridevirtual |
number of vertices of a cell
| [in] | c_id | global cell id (face for 2d meshes) |
Implements polyfem::mesh::Mesh.
Definition at line 28 of file Mesh2D.hpp.
References polyfem::mesh::Mesh::n_face_vertices().
|
inlineoverridevirtual |
number of cells
Implements polyfem::mesh::Mesh.
Definition at line 27 of file Mesh2D.hpp.
|
inline |
Definition at line 61 of file Mesh2D.hpp.
References switch_edge(), and switch_vertex().
Referenced by polyfem::mesh::CMesh2D::attach_higher_order_nodes(), barycentric_coords(), polyfem::basis::compute_epsilon(), compute_face_jacobian(), elements_boxes(), face_barycenter(), get_edges(), polyfem::mesh::CMesh2D::is_boundary_element(), polyfem::utils::BoundarySampler::normal_for_polygon_edge(), polyfem::refinement::APriori::p_refine(), polyfem::utils::BoundarySampler::quadrature_for_polygon_edge(), and polyfem::utils::BoundarySampler::sample_polygon_edge().
|
inline |
Definition at line 62 of file Mesh2D.hpp.
References switch_edge(), and switch_face().
|
pure virtual |
Implemented in polyfem::mesh::CMesh2D, and polyfem::mesh::NCMesh2D.
Referenced by next_around_face(), and next_around_vertex().
|
pure virtual |
Implemented in polyfem::mesh::CMesh2D, and polyfem::mesh::NCMesh2D.
Referenced by next_around_vertex(), polyfem::mesh::MeshNodes::node_ids_from_edge(), and polyfem::refinement::APriori::p_refine().
|
pure virtual |
Implemented in polyfem::mesh::CMesh2D, and polyfem::mesh::NCMesh2D.
Referenced by polyfem::basis::compute_epsilon(), get_edges(), next_around_face(), polyfem::basis::LagrangeBasis2d::quad_edge_local_nodes(), and polyfem::basis::LagrangeBasis2d::tri_edge_local_nodes().