PolyFEM
Loading...
Searching...
No Matches
polyfem::mesh::Mesh Class Referenceabstract

Abstract mesh class to capture 2d/3d conforming and non-conforming meshes. More...

#include <Mesh.hpp>

Inheritance diagram for polyfem::mesh::Mesh:
[legend]

Classes

class  CellNodes
 Class to store the high-order cells nodes. More...
 
class  EdgeNodes
 Class to store the high-order edge nodes. More...
 
class  FaceNodes
 Class to store the high-order face nodes. More...
 

Public Member Functions

virtual std::unique_ptr< Meshcopy () const =0
 Create a copy of the mesh.
 
virtual ~Mesh ()=default
 Destroy the Mesh object.
 
 Mesh (Mesh &&)=default
 Construct a new Mesh object.
 
Meshoperator= (Mesh &&)=default
 Copy constructor.
 
 Mesh (const Mesh &)=default
 Construct a new Mesh object.
 
Meshoperator= (const Mesh &)=default
 
virtual void refine (const int n_refinement, const double t)=0
 refine the mesh
 
virtual bool is_volume () const =0
 checks if mesh is volume
 
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_cells () const =0
 number of cells
 
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 n_cell_vertices (const int c_id) const =0
 number of vertices of a cell
 
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
 
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_face (const int face_global_id) const =0
 is face 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
 
virtual RowVectorNd face_barycenter (const int f) const =0
 face barycenter
 
virtual RowVectorNd cell_barycenter (const int c) const =0
 cell 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 compute_element_barycenters (Eigen::MatrixXd &barycenters) const =0
 utility for 2d/3d.
 
virtual void elements_boxes (std::vector< std::array< Eigen::Vector3d, 2 > > &boxes) const =0
 constructs a box around every element (3d cell, 2d face)
 
virtual void barycentric_coords (const RowVectorNd &p, const int el_id, Eigen::MatrixXd &coord) const =0
 constructs barycentric coodiantes for a point p.
 
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 simples compatible
 
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 double eps)=0
 computes the selection based on the bbx of the mesh.
 
virtual void compute_boundary_ids (const std::function< int(const RowVectorNd &)> &marker)=0
 computes boundary selections based on a function
 
virtual void compute_boundary_ids (const std::function< int(const RowVectorNd &, bool)> &marker)=0
 computes boundary selections based on a function
 
virtual void compute_boundary_ids (const std::function< int(const size_t, const RowVectorNd &, bool)> &marker)=0
 computes boundary selections based on a function
 
virtual void compute_boundary_ids (const std::function< int(const std::vector< int > &, bool)> &marker)=0
 computes boundary selections based on a function
 
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 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
 
virtual void get_edges (Eigen::MatrixXd &p0, Eigen::MatrixXd &p1) const =0
 Get all the edges.
 
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.
 
virtual void triangulate_faces (Eigen::MatrixXi &tris, Eigen::MatrixXd &pts, std::vector< int > &ranges) const =0
 generate a triangular representation of every face
 
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 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::HashPairedges_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::HashVectorfaces_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\).
 

Static Public Member Functions

static std::unique_ptr< Meshcreate (const std::string &path, const bool non_conforming=false)
 factory to build the proper mesh
 
static std::unique_ptr< Meshcreate (GEO::Mesh &M, const bool non_conforming=false)
 factory to build the proper mesh
 
static std::unique_ptr< Meshcreate (const Eigen::MatrixXd &vertices, const Eigen::MatrixXi &cells, const bool non_conforming=false)
 factory to build the proper mesh
 
static std::unique_ptr< Meshcreate (const int dim, const bool non_conforming=false)
 factory to build the proper empty mesh
 

Protected Member Functions

 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

std::vector< ElementTypeelements_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< EdgeNodesedge_nodes_
 high-order nodes associates to edges
 
std::vector< FaceNodesface_nodes_
 high-order nodes associates to faces
 
std::vector< CellNodescell_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.
 

Private Member Functions

virtual bool build_from_matrices (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F)=0
 build a mesh from matrices
 

Detailed Description

Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.

Definition at line 38 of file Mesh.hpp.

Constructor & Destructor Documentation

◆ Mesh() [1/3]

polyfem::mesh::Mesh::Mesh ( )
protecteddefault

Construct a new Mesh object.

◆ ~Mesh()

virtual polyfem::mesh::Mesh::~Mesh ( )
virtualdefault

Destroy the Mesh object.

◆ Mesh() [2/3]

polyfem::mesh::Mesh::Mesh ( Mesh &&  )
default

Construct a new Mesh object.

◆ Mesh() [3/3]

polyfem::mesh::Mesh::Mesh ( const Mesh )
default

Construct a new Mesh object.

Member Function Documentation

◆ append() [1/2]

void polyfem::mesh::Mesh::append ( const Mesh mesh)
virtual

appends a new mesh to the end of this

Parameters
[in]meshto append

Reimplemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Definition at line 490 of file Mesh.cpp.

References polyfem::utils::append_rows(), body_ids_, boundary_ids_, cell_nodes_, cell_weights_, edge_nodes_, elements_tag_, face_nodes_, get_boundary_id(), get_default_boundary_id(), get_node_id(), has_body_ids(), has_boundary_ids(), has_node_ids(), in_ordered_edges_, in_ordered_faces_, in_ordered_vertices_, is_rational_, n_boundary_elements(), n_elements(), n_vertices(), node_ids_, and orders_.

Referenced by polyfem::mesh::CMesh2D::append(), polyfem::mesh::NCMesh2D::append(), polyfem::mesh::CMesh3D::append(), polyfem::mesh::NCMesh3D::append(), and append().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ append() [2/2]

void polyfem::mesh::Mesh::append ( const std::unique_ptr< Mesh > &  mesh)
inline

appends a new mesh to the end of this, utility that takes pointer, calls other one

Parameters
[in]meshpointer to append

Definition at line 634 of file Mesh.hpp.

References append().

Here is the call graph for this function:

◆ apply_affine_transformation()

void polyfem::mesh::Mesh::apply_affine_transformation ( const MatrixNd A,
const VectorNd b 
)

Apply an affine transformation \(Ax+b\) to the vertex positions \(x\).

Parameters
[in]AMultiplicative matrix component of transformation
[in]bAdditive translation component of transformation

Definition at line 628 of file Mesh.cpp.

References cell_nodes_, edge_nodes_, face_nodes_, n_vertices(), point(), and set_point().

Here is the call graph for this function:

◆ attach_higher_order_nodes()

virtual void polyfem::mesh::Mesh::attach_higher_order_nodes ( const Eigen::MatrixXd &  V,
const std::vector< std::vector< int > > &  nodes 
)
pure virtual

attach high order nodes

Parameters
[in]Vnodes
[in]nodeslist of nodes per element

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ barycentric_coords()

virtual void polyfem::mesh::Mesh::barycentric_coords ( const RowVectorNd p,
const int  el_id,
Eigen::MatrixXd &  coord 
) const
pure virtual

constructs barycentric coodiantes for a point p.

WARNING works only for simplices

Parameters
[in]pquery point
[in]el_idelement id
[out]coordmatrix containing the barycentric coodinates

Implemented in polyfem::mesh::Mesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::Mesh3D.

Referenced by polyfem::io::OutGeometryData::build_grid().

Here is the caller graph for this function:

◆ boundary_element_vertex()

int polyfem::mesh::Mesh::boundary_element_vertex ( const int  primitive_id,
const int  lv_id 
) const
inline

Definition at line 222 of file Mesh.hpp.

References edge_vertex(), face_vertex(), and is_volume().

Here is the call graph for this function:

◆ bounding_box()

virtual void polyfem::mesh::Mesh::bounding_box ( RowVectorNd min,
RowVectorNd max 
) const
pure virtual

computes the bbox of the mesh

Parameters
[out]minmin coodiante
[out]maxmax coodiante

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by polyfem::io::OutGeometryData::build_grid(), polyfem::solver::OperatorSplittingSolver::initialize_mesh(), and polyfem::solver::LinearFilter::LinearFilter().

Here is the caller graph for this function:

◆ build_from_matrices()

virtual bool polyfem::mesh::Mesh::build_from_matrices ( const Eigen::MatrixXd &  V,
const Eigen::MatrixXi &  F 
)
privatepure virtual

build a mesh from matrices

Parameters
[in]Vvertices
[in]Fconnectivity
Returns
if success

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ cell_barycenter()

virtual RowVectorNd polyfem::mesh::Mesh::cell_barycenter ( const int  c) const
pure virtual

cell barycenter

Parameters
[in]cglobal cell index
Returns
cell barycenter

Implemented in polyfem::mesh::CMesh3D, polyfem::mesh::NCMesh3D, and polyfem::mesh::Mesh2D.

Referenced by cell_barycenters(), polyfem::mesh::Mesh3D::cell_node(), polyfem::solver::ElasticVariableToSimulation::inverse_eval(), and polyfem::mesh::MeshNodes::node_id_from_primitive().

Here is the caller graph for this function:

◆ cell_barycenters()

void polyfem::mesh::Mesh::cell_barycenters ( Eigen::MatrixXd &  barycenters) const

all cells barycenters

Parameters
[out]barycenters

Definition at line 316 of file Mesh.cpp.

References cell_barycenter(), dimension(), and n_cells().

Referenced by polyfem::mesh::Mesh3D::compute_element_barycenters(), polyfem::solver::LinearFilter::LinearFilter(), polyfem::mesh::CMesh3D::triangulate_faces(), and polyfem::mesh::NCMesh3D::triangulate_faces().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cell_vertex()

virtual int polyfem::mesh::Mesh::cell_vertex ( const int  f_id,
const int  lv_id 
) const
pure virtual

id of the vertex of a cell

Parameters
[in]f_idglobal cell id
[in]lv_idlocal vertex id
Returns
vertex id

Implemented in polyfem::mesh::CMesh3D, polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, and polyfem::mesh::NCMesh3D.

Referenced by polyfem::solver::OperatorSplittingSolver::advection_PIC(), element_vertex(), polyfem::mesh::Mesh3D::elements_boxes(), polyfem::solver::OperatorSplittingSolver::initialize_mesh(), polyfem::refinement::APriori::p_refine(), and polyfem::io::MshWriter::write().

Here is the caller graph for this function:

◆ cell_weights()

const std::vector< double > & polyfem::mesh::Mesh::cell_weights ( const int  cell_index) const
inline

weights for rational polynomial meshes

Parameters
[in]cell_indexindex of the cell
Returns
list of weights

Definition at line 552 of file Mesh.hpp.

References cell_weights_.

◆ compute_body_ids()

virtual void polyfem::mesh::Mesh::compute_body_ids ( const std::function< int(const size_t, const RowVectorNd &)> &  marker)
pure virtual

computes boundary selections based on a function

Parameters
[in]markerlambda function that takes the id and barycenter and returns an integer

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ compute_boundary_ids() [1/6]

virtual void polyfem::mesh::Mesh::compute_boundary_ids ( const double  eps)
pure virtual

computes the selection based on the bbx of the mesh.

Left gets 1, bottom 2, right 3, top 4, front 5, back 6

Parameters
[in]epstolerance for proximity

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ compute_boundary_ids() [2/6]

virtual void polyfem::mesh::Mesh::compute_boundary_ids ( const std::function< int(const RowVectorNd &)> &  marker)
pure virtual

computes boundary selections based on a function

Parameters
[in]markerlambda function that takes the barycenter and returns an integer

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ compute_boundary_ids() [3/6]

virtual void polyfem::mesh::Mesh::compute_boundary_ids ( const std::function< int(const RowVectorNd &, bool)> &  marker)
pure virtual

computes boundary selections based on a function

Parameters
[in]markerlambda function that takes the barycenter and true/false if the element is on the boundary and returns an integer

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ compute_boundary_ids() [4/6]

virtual void polyfem::mesh::Mesh::compute_boundary_ids ( const std::function< int(const size_t, const RowVectorNd &, bool)> &  marker)
pure virtual

computes boundary selections based on a function

Parameters
[in]markerlambda function that takes the id, barycenter, and true/false if the element is on the boundary and returns an integer

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ compute_boundary_ids() [5/6]

virtual void polyfem::mesh::Mesh::compute_boundary_ids ( const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &, bool)> &  marker)
pure virtual

computes boundary selections based on a function

Parameters
[in]markerlambda function that takes the id, the list of vertices, the barycenter, and true/false if the element is on the boundary and returns an integer

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ compute_boundary_ids() [6/6]

virtual void polyfem::mesh::Mesh::compute_boundary_ids ( const std::function< int(const std::vector< int > &, bool)> &  marker)
pure virtual

computes boundary selections based on a function

Parameters
[in]markerlambda function that takes the list of vertices and true/false if the element is on the boundary and returns an integer

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ compute_element_barycenters()

virtual void polyfem::mesh::Mesh::compute_element_barycenters ( Eigen::MatrixXd &  barycenters) const
pure virtual

utility for 2d/3d.

In 2d it returns face_barycenters, in 3d it returns cell_barycenters

Parameters
[out]barycentersthe barycenters

Implemented in polyfem::mesh::Mesh2D, and polyfem::mesh::Mesh3D.

◆ compute_elements_tag()

virtual void polyfem::mesh::Mesh::compute_elements_tag ( )
pure virtual

compute element types, see ElementType

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ compute_node_ids()

void polyfem::mesh::Mesh::compute_node_ids ( const std::function< int(const size_t, const RowVectorNd &, bool)> &  marker)

computes boundary selections based on a function

Parameters
[in]markerlambda function that takes the node id, the position, and true/false if the element is on the boundary and returns an integer

Definition at line 383 of file Mesh.cpp.

References is_boundary_vertex(), n_vertices(), node_ids_, and point().

Here is the call graph for this function:

◆ copy()

virtual std::unique_ptr< Mesh > polyfem::mesh::Mesh::copy ( ) const
pure virtual

Create a copy of the mesh.

Returns
pointer to the new copy mesh

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ create() [1/4]

std::unique_ptr< Mesh > polyfem::mesh::Mesh::create ( const Eigen::MatrixXd &  vertices,
const Eigen::MatrixXi &  cells,
const bool  non_conforming = false 
)
static

factory to build the proper mesh

Parameters
[in]verticeslist of vertices
[in]cellslist of cells
[in]non_conformingyes or no for non conforming mesh
Returns
pointer to the mesh

Definition at line 243 of file Mesh.cpp.

References create(), and edges().

Here is the call graph for this function:

◆ create() [2/4]

std::unique_ptr< Mesh > polyfem::mesh::Mesh::create ( const int  dim,
const bool  non_conforming = false 
)
static

factory to build the proper empty mesh

Parameters
[in]dimdimension of the mesh
[in]non_conformingyes or no for non conforming mesh
Returns
pointer to the mesh

Definition at line 84 of file Mesh.cpp.

◆ create() [3/4]

std::unique_ptr< Mesh > polyfem::mesh::Mesh::create ( const std::string &  path,
const bool  non_conforming = false 
)
static

factory to build the proper mesh

Parameters
[in]pathmesh path
[in]non_conformingyes or no for non conforming mesh
Returns
pointer to the mesh

Definition at line 173 of file Mesh.cpp.

References create(), polyfem::utils::StringUtils::endswith(), polyfem::io::MshReader::load(), and polyfem::logger().

Referenced by polyfem::mesh::LocalMesh< M >::build_bases(), create(), create(), create(), polyfem::mesh::LocalRelaxationData< M >::init_mesh(), polyfem::State::load_mesh(), polyfem::State::load_mesh(), polyfem::mesh::Remesher::project_quantities(), and polyfem::mesh::read_fem_mesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create() [4/4]

std::unique_ptr< Mesh > polyfem::mesh::Mesh::create ( GEO::Mesh &  M,
const bool  non_conforming = false 
)
static

factory to build the proper mesh

Parameters
[in]Mgeo mesh
[in]non_conformingyes or no for non conforming mesh
Returns
pointer to the mesh

Definition at line 98 of file Mesh.cpp.

References create(), polyfem::mesh::generate_edges(), polyfem::mesh::is_planar(), and polyfem::logger().

Here is the call graph for this function:

◆ dimension()

int polyfem::mesh::Mesh::dimension ( ) const
inline

utily for dimension

Returns
int 2 or 3

Definition at line 148 of file Mesh.hpp.

References is_volume().

Referenced by polyfem::io::Evaluator::average_grad_based_function(), polyfem::mesh::Remesher::build_bases(), polyfem::io::OutGeometryData::build_high_order_vis_mesh(), polyfem::io::OutGeometryData::build_vis_mesh(), cell_barycenters(), polyfem::io::OutStatsData::compute_errors(), polyfem::io::Evaluator::compute_stress_at_quadrature_points(), polyfem::io::Evaluator::compute_tensor_value(), polyfem::assembler::GenericTensorProblem::dirichlet_bc(), polyfem::problem::ElasticProblem::dirichlet_bc(), polyfem::problem::TorsionElasticProblem::dirichlet_bc(), polyfem::problem::DoubleTorsionElasticProblem::dirichlet_bc(), polyfem::problem::ElasticProblemZeroBC::dirichlet_bc(), polyfem::problem::WalkProblem::dirichlet_bc(), polyfem::problem::PointBasedTensorProblem::dirichlet_bc(), polyfem::assembler::GenericTensorProblem::dirichlet_nodal_value(), edge_barycenters(), polyfem::io::OutGeometryData::export_data(), face_barycenters(), polyfem::solver::BodyForm::force_shape_derivative(), polyfem::solver::OperatorSplittingSolver::initialize_mesh(), polyfem::assembler::RhsAssembler::integrate_bc(), polyfem::io::Evaluator::interpolate_at_local_vals(), polyfem::io::Evaluator::interpolate_at_local_vals(), polyfem::io::Evaluator::interpolate_function(), polyfem::assembler::RhsAssembler::lsq_bc(), polyfem::mesh::MeshNodes::MeshNodes(), polyfem::assembler::GenericTensorProblem::neumann_bc(), polyfem::problem::ElasticCantileverExact::neumann_bc(), polyfem::problem::PointBasedTensorProblem::neumann_bc(), polyfem::assembler::RhsAssembler::sample_bc(), polyfem::io::OutGeometryData::save_contact_surface(), polyfem::io::OutStatsData::save_json(), polyfem::io::OutGeometryData::save_points(), polyfem::io::OutGeometryData::save_surface(), polyfem::io::OutGeometryData::save_volume(), polyfem::io::OutGeometryData::save_wire(), polyfem::assembler::Problem::setup_bc(), and polyfem::io::MshWriter::write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ edge_barycenter()

virtual RowVectorNd polyfem::mesh::Mesh::edge_barycenter ( const int  e) const
pure virtual

edge barycenter

Parameters
[in]eglobal edge index
Returns
edge barycenter

Implemented in polyfem::mesh::CMesh3D, polyfem::mesh::NCMesh3D, polyfem::mesh::CMesh2D, and polyfem::mesh::NCMesh2D.

Referenced by edge_barycenters(), and polyfem::mesh::MeshNodes::node_id_from_primitive().

Here is the caller graph for this function:

◆ edge_barycenters()

void polyfem::mesh::Mesh::edge_barycenters ( Eigen::MatrixXd &  barycenters) const

all edges barycenters

Parameters
[out]barycenters

Definition at line 298 of file Mesh.cpp.

References dimension(), edge_barycenter(), and n_edges().

Here is the call graph for this function:

◆ edge_length()

virtual double polyfem::mesh::Mesh::edge_length ( const int  gid) const
inlinevirtual

edge length

Parameters
[in]gidglobal edge id
Returns
edge length

Reimplemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, and polyfem::mesh::NCMesh3D.

Definition at line 290 of file Mesh.hpp.

Referenced by polyfem::utils::BoundarySampler::quadrature_for_polygon_edge(), polyfem::utils::BoundarySampler::quadrature_for_quad_edge(), polyfem::utils::BoundarySampler::quadrature_for_tri_edge(), and polyfem::io::OutGeometryData::save_surface().

Here is the caller graph for this function:

◆ edge_vertex()

virtual int polyfem::mesh::Mesh::edge_vertex ( const int  e_id,
const int  lv_id 
) const
pure virtual

id of the edge vertex

Parameters
[in]e_idglobal edge id
[in]lv_idlocal vertex index
Returns
int id of the face vertex

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by boundary_element_vertex(), edges(), edges_to_ids(), polyfem::mesh::Mesh2D::get_edges(), polyfem::mesh::Mesh3D::get_edges(), polyfem::mesh::Mesh3D::get_edges(), and polyfem::io::Evaluator::get_sidesets().

Here is the caller graph for this function:

◆ edges()

std::vector< std::pair< int, int > > polyfem::mesh::Mesh::edges ( ) const

list of sorted edges.

Used to map to input vertices

Returns
list of sorted edges

Definition at line 423 of file Mesh.cpp.

References edge_vertex(), and n_edges().

Referenced by create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ edges_to_ids()

std::unordered_map< std::pair< int, int >, size_t, HashPair > polyfem::mesh::Mesh::edges_to_ids ( ) const

map from edge (pair of v id) to the id of the edge

Returns
map

Definition at line 455 of file Mesh.cpp.

References edge_vertex(), and n_edges().

Here is the call graph for this function:

◆ element_vertex()

int polyfem::mesh::Mesh::element_vertex ( const int  el_id,
const int  lv_id 
) const
inline

id of the vertex of a element

Parameters
[in]el_idglobal element id
[in]lv_idlocal vertex id
Returns
vertex id

Definition at line 217 of file Mesh.hpp.

References cell_vertex(), face_vertex(), and is_volume().

Here is the call graph for this function:

◆ elements_boxes()

virtual void polyfem::mesh::Mesh::elements_boxes ( std::vector< std::array< Eigen::Vector3d, 2 > > &  boxes) const
pure virtual

constructs a box around every element (3d cell, 2d face)

Parameters
[out]boxesaxis aligned bounding boxes

Implemented in polyfem::mesh::Mesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::Mesh3D.

Referenced by polyfem::io::OutGeometryData::build_grid().

Here is the caller graph for this function:

◆ elements_tag()

const std::vector< ElementType > & polyfem::mesh::Mesh::elements_tag ( ) const
inline

Returns the elements types.

Returns
vector of element types

Definition at line 399 of file Mesh.hpp.

References elements_tag_.

Referenced by polyfem::io::OutStatsData::compute_mesh_stats(), polyfem::io::OutStatsData::count_flipped_elements(), and polyfem::mesh::CMesh3D::refine().

Here is the caller graph for this function:

◆ face_barycenter()

virtual RowVectorNd polyfem::mesh::Mesh::face_barycenter ( const int  f) const
pure virtual

face barycenter

Parameters
[in]fglobal face index
Returns
face barycenter

Implemented in polyfem::mesh::CMesh3D, polyfem::mesh::NCMesh3D, and polyfem::mesh::Mesh2D.

Referenced by face_barycenters(), polyfem::io::Evaluator::get_sidesets(), polyfem::io::Evaluator::interpolate_boundary_function(), polyfem::io::Evaluator::interpolate_boundary_function_at_vertices(), polyfem::io::Evaluator::interpolate_boundary_tensor_function(), and polyfem::mesh::MeshNodes::node_id_from_primitive().

Here is the caller graph for this function:

◆ face_barycenters()

void polyfem::mesh::Mesh::face_barycenters ( Eigen::MatrixXd &  barycenters) const

all face barycenters

Parameters
[out]barycenters

Definition at line 307 of file Mesh.cpp.

References dimension(), face_barycenter(), and n_faces().

Referenced by polyfem::mesh::Mesh2D::compute_element_barycenters(), polyfem::solver::LinearFilter::LinearFilter(), polyfem::mesh::CMesh3D::triangulate_faces(), and polyfem::mesh::NCMesh3D::triangulate_faces().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ face_vertex()

virtual int polyfem::mesh::Mesh::face_vertex ( const int  f_id,
const int  lv_id 
) const
pure virtual

id of the face vertex

Parameters
[in]f_idglobal face id
[in]lv_idlocal vertex index
Returns
int id of the face vertex

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by boundary_element_vertex(), polyfem::basis::BarycentricBasis2d::build_bases(), element_vertex(), faces(), faces_to_ids(), polyfem::io::Evaluator::get_sidesets(), polyfem::refinement::APriori::p_refine(), polyfem::mesh::to_geogram_mesh(), and polyfem::mesh::Mesh3D::tri_area().

Here is the caller graph for this function:

◆ faces()

std::vector< std::vector< int > > polyfem::mesh::Mesh::faces ( ) const

list of sorted faces.

Used to map to input vertices

Returns
list of sorted faces

Definition at line 439 of file Mesh.cpp.

References face_vertex(), n_face_vertices(), and n_faces().

Referenced by polyfem::mesh::CMesh3D::attach_higher_order_nodes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ faces_to_ids()

std::unordered_map< std::vector< int >, size_t, HashVector > polyfem::mesh::Mesh::faces_to_ids ( ) const

map from face (tuple of v id) to the id of the face

Returns
map

Definition at line 471 of file Mesh.cpp.

References face_vertex(), n_face_vertices(), and n_faces().

Here is the call graph for this function:

◆ get_body_id()

virtual int polyfem::mesh::Mesh::get_body_id ( const int  primitive) const
inlinevirtual

Get the volume selection of an element (cell in 3d, face in 2d)

Parameters
[in]primitiveelement id
Returns
label of element

Reimplemented in polyfem::mesh::NCMesh2D, and polyfem::mesh::NCMesh3D.

Definition at line 504 of file Mesh.hpp.

References body_ids_, and has_body_ids().

Referenced by polyfem::solver::PerBody2PerElem::apply_jacobian(), polyfem::solver::PerBody2PerElem::eval(), polyfem::assembler::GenericTensorProblem::initial_acceleration(), polyfem::assembler::GenericTensorProblem::initial_solution(), polyfem::assembler::GenericScalarProblem::initial_solution(), polyfem::assembler::GenericTensorProblem::initial_velocity(), polyfem::solver::PerBody2PerElem::PerBody2PerElem(), polyfem::solver::PerBody2PerNode::PerBody2PerNode(), polyfem::io::OutGeometryData::save_surface(), and polyfem::io::OutGeometryData::save_volume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_body_ids()

virtual const std::vector< int > & polyfem::mesh::Mesh::get_body_ids ( ) const
inlinevirtual

Get the volume selection of all elements (cells in 3d, faces in 2d)

Returns
Const reference to the vector of body IDs

Definition at line 513 of file Mesh.hpp.

References body_ids_.

Referenced by polyfem::io::MshWriter::write().

Here is the caller graph for this function:

◆ get_boundary_id()

virtual int polyfem::mesh::Mesh::get_boundary_id ( const int  primitive) const
inlinevirtual

Get the boundary selection of an element (face in 3d, edge in 2d)

Parameters
[in]primitiveelement id
Returns
label of element

Reimplemented in polyfem::mesh::NCMesh2D, and polyfem::mesh::NCMesh3D.

Definition at line 478 of file Mesh.hpp.

References boundary_ids_, get_default_boundary_id(), and has_boundary_ids().

Referenced by append(), polyfem::assembler::RhsAssembler::compute_energy_hess(), polyfem::assembler::GenericTensorProblem::dirichlet_bc(), polyfem::assembler::GenericScalarProblem::dirichlet_bc(), polyfem::problem::ElasticProblem::dirichlet_bc(), polyfem::problem::TorsionElasticProblem::dirichlet_bc(), polyfem::problem::DoubleTorsionElasticProblem::dirichlet_bc(), polyfem::problem::ElasticProblemZeroBC::dirichlet_bc(), polyfem::problem::WalkProblem::dirichlet_bc(), polyfem::problem::NodeProblem::dirichlet_bc(), polyfem::problem::PointBasedTensorProblem::dirichlet_bc(), polyfem::problem::ConstantVelocity::dirichlet_bc(), polyfem::problem::DrivenCavity::dirichlet_bc(), polyfem::problem::DrivenCavityC0::dirichlet_bc(), polyfem::problem::DrivenCavitySmooth::dirichlet_bc(), polyfem::problem::Flow::dirichlet_bc(), polyfem::problem::FlowWithObstacle::dirichlet_bc(), polyfem::problem::CornerFlow::dirichlet_bc(), polyfem::problem::Lshape::dirichlet_bc(), polyfem::problem::UnitFlowWithObstacle::dirichlet_bc(), polyfem::problem::StokesLawProblem::dirichlet_bc(), polyfem::problem::Airfoil::dirichlet_bc(), polyfem::io::Evaluator::get_sidesets(), polyfem::assembler::RhsAssembler::lsq_bc(), polyfem::assembler::GenericTensorProblem::neumann_bc(), polyfem::assembler::GenericScalarProblem::neumann_bc(), polyfem::problem::ElasticCantileverExact::neumann_bc(), polyfem::problem::NodeProblem::neumann_bc(), polyfem::problem::PointBasedTensorProblem::neumann_bc(), polyfem::assembler::GenericTensorProblem::pressure_bc(), polyfem::assembler::RhsAssembler::sample_bc(), polyfem::io::OutGeometryData::save_surface(), and polyfem::assembler::Problem::setup_bc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_default_boundary_id()

virtual int polyfem::mesh::Mesh::get_default_boundary_id ( const int  primitive) const
inlinevirtual

Get the default boundary selection of an element (face in 3d, edge in 2d)

Parameters
[in]primitiveelement id
Returns
default label of element

Definition at line 466 of file Mesh.hpp.

References is_boundary_edge(), is_boundary_face(), and is_volume().

Referenced by append(), and get_boundary_id().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_edges() [1/2]

virtual void polyfem::mesh::Mesh::get_edges ( Eigen::MatrixXd &  p0,
Eigen::MatrixXd &  p1 
) const
pure virtual

Get all the edges.

Parameters
[out]p0edge first vertex
[out]p1edge second vertex

Implemented in polyfem::mesh::Mesh2D, and polyfem::mesh::Mesh3D.

Referenced by polyfem::io::OutStatsData::compute_mesh_size(), and polyfem::solver::OperatorSplittingSolver::initialize_hashtable().

Here is the caller graph for this function:

◆ get_edges() [2/2]

virtual void polyfem::mesh::Mesh::get_edges ( Eigen::MatrixXd &  p0,
Eigen::MatrixXd &  p1,
const std::vector< bool > &  valid_elements 
) const
pure virtual

Get all the edges according to valid_elements selection.

Parameters
[out]p0edge first vertex
[out]p1edge second vertex
[in]valid_elementsflag to compute the edge

Implemented in polyfem::mesh::Mesh2D, and polyfem::mesh::Mesh3D.

◆ get_node_id()

virtual int polyfem::mesh::Mesh::get_node_id ( const int  node_id) const
inlinevirtual

Get the boundary selection of a node.

Parameters
[in]node_idnode id
Returns
label of node

Definition at line 487 of file Mesh.hpp.

References has_node_ids(), and node_ids_.

Referenced by append(), polyfem::assembler::GenericTensorProblem::dirichlet_nodal_value(), polyfem::assembler::GenericScalarProblem::dirichlet_nodal_value(), polyfem::io::OutGeometryData::save_points(), and polyfem::assembler::Problem::setup_bc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_body_ids()

virtual bool polyfem::mesh::Mesh::has_body_ids ( ) const
inlinevirtual

checks if volumes selections are available

Returns
volumes selections are available

Definition at line 528 of file Mesh.hpp.

References body_ids_.

Referenced by append(), and get_body_id().

Here is the caller graph for this function:

◆ has_boundary_ids()

bool polyfem::mesh::Mesh::has_boundary_ids ( ) const
inline

checks if surface selections are available

Returns
surface selections are available

Definition at line 524 of file Mesh.hpp.

References boundary_ids_.

Referenced by append(), and get_boundary_id().

Here is the caller graph for this function:

◆ has_node_ids()

bool polyfem::mesh::Mesh::has_node_ids ( ) const
inline

checks if points selections are available

Returns
points selections are available

Definition at line 520 of file Mesh.hpp.

References node_ids_.

Referenced by append(), get_node_id(), and polyfem::assembler::Problem::setup_bc().

Here is the caller graph for this function:

◆ has_poly()

bool polyfem::mesh::Mesh::has_poly ( ) const
inline

checks if the mesh has polytopes

Returns
if the mesh has polytopes

Definition at line 565 of file Mesh.hpp.

References is_polytope(), and n_elements().

Referenced by polyfem::io::OutGeometryData::extract_boundary_mesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ in_ordered_edges()

const Eigen::MatrixXi & polyfem::mesh::Mesh::in_ordered_edges ( ) const
inline

Order of the input edges.

Returns
matrix of indices one per edge, pointing to the two vertices

Definition at line 620 of file Mesh.hpp.

References in_ordered_edges_.

◆ in_ordered_faces()

const Eigen::MatrixXi & polyfem::mesh::Mesh::in_ordered_faces ( ) const
inline

Order of the input edges.

Returns
matrix of indices one per faces, pointing to the face vertices

Definition at line 624 of file Mesh.hpp.

References in_ordered_faces_.

◆ in_ordered_vertices()

const Eigen::VectorXi & polyfem::mesh::Mesh::in_ordered_vertices ( ) const
inline

Order of the input vertices.

Returns
vector of indices, one per vertex

Definition at line 616 of file Mesh.hpp.

References in_ordered_vertices_.

◆ is_boundary_edge()

virtual bool polyfem::mesh::Mesh::is_boundary_edge ( const int  edge_global_id) const
pure virtual

is edge boundary

Parameters
[in]edge_global_idglobal edge id
Returns
is edge boundary

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by get_default_boundary_id(), polyfem::mesh::MeshNodes::MeshNodes(), and polyfem::mesh::MeshNodes::node_ids_from_edge().

Here is the caller graph for this function:

◆ is_boundary_element()

virtual bool polyfem::mesh::Mesh::is_boundary_element ( const int  element_global_id) const
pure virtual

is cell boundary

Parameters
[in]element_global_idglobal cell id
Returns
is cell boundary

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by polyfem::io::OutGeometryData::build_vis_mesh(), polyfem::io::Evaluator::check_scalar_value(), polyfem::io::Evaluator::compute_scalar_value(), polyfem::io::Evaluator::compute_tensor_value(), and polyfem::io::Evaluator::interpolate_function().

Here is the caller graph for this function:

◆ is_boundary_face()

virtual bool polyfem::mesh::Mesh::is_boundary_face ( const int  face_global_id) const
pure virtual

is face boundary

Parameters
[in]face_global_idglobal face id
Returns
is face boundary

Implemented in polyfem::mesh::Mesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by get_default_boundary_id(), polyfem::io::Evaluator::interpolate_boundary_function(), polyfem::mesh::MeshNodes::MeshNodes(), polyfem::mesh::MeshNodes::node_ids_from_face(), and polyfem::mesh::to_geogram_mesh().

Here is the caller graph for this function:

◆ is_boundary_vertex()

virtual bool polyfem::mesh::Mesh::is_boundary_vertex ( const int  vertex_global_id) const
pure virtual

is vertex boundary

Parameters
[in]vertex_global_idglobal vertex id
Returns
is vertex boundary

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by compute_node_ids(), and polyfem::mesh::MeshNodes::MeshNodes().

Here is the caller graph for this function:

◆ is_conforming()

virtual bool polyfem::mesh::Mesh::is_conforming ( ) const
pure virtual

if the mesh is conforming

Returns
if the mesh is conforming

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by polyfem::io::OutGeometryData::extract_boundary_mesh().

Here is the caller graph for this function:

◆ is_cube()

bool polyfem::mesh::Mesh::is_cube ( const int  el_id) const

checks if element is cube compatible

Parameters
[in]el_idelement id
Returns
is cube compatible

Definition at line 348 of file Mesh.cpp.

References elements_tag_, polyfem::mesh::INTERFACE_CUBE, polyfem::mesh::MULTI_SINGULAR_BOUNDARY_CUBE, polyfem::mesh::MULTI_SINGULAR_INTERIOR_CUBE, polyfem::mesh::REGULAR_BOUNDARY_CUBE, polyfem::mesh::REGULAR_INTERIOR_CUBE, polyfem::mesh::SIMPLE_SINGULAR_BOUNDARY_CUBE, and polyfem::mesh::SIMPLE_SINGULAR_INTERIOR_CUBE.

Referenced by polyfem::io::Evaluator::average_grad_based_function(), polyfem::io::OutGeometryData::build_high_order_vis_mesh(), polyfem::io::OutGeometryData::build_vis_mesh(), polyfem::mesh::Mesh3D::cell_node(), polyfem::io::Evaluator::check_scalar_value(), polyfem::io::Evaluator::compute_scalar_value(), polyfem::io::Evaluator::compute_stress_at_quadrature_points(), polyfem::io::Evaluator::compute_tensor_value(), polyfem::io::Evaluator::compute_vertex_values(), polyfem::io::OutGeometryData::extract_boundary_mesh(), polyfem::mesh::Mesh3D::face_node(), polyfem::mesh::CMesh2D::face_node(), polyfem::mesh::Mesh3D::get_ordered_vertices_from_hex(), polyfem::basis::LagrangeBasis3d::hex_face_local_nodes(), polyfem::io::Evaluator::interpolate_boundary_function(), polyfem::io::Evaluator::interpolate_boundary_function_at_vertices(), polyfem::io::Evaluator::interpolate_boundary_tensor_function(), polyfem::io::Evaluator::interpolate_function(), polyfem::basis::LagrangeBasis2d::quad_edge_local_nodes(), polyfem::io::OutGeometryData::save_surface(), polyfem::io::OutGeometryData::save_volume(), polyfem::io::OutGeometryData::save_wire(), and polyfem::mesh::to_geogram_mesh().

Here is the caller graph for this function:

◆ is_linear()

bool polyfem::mesh::Mesh::is_linear ( ) const
inline

check if the mesh is linear

Returns
if the mesh is linear

Definition at line 593 of file Mesh.hpp.

References orders_.

Referenced by polyfem::io::OutGeometryData::build_high_order_vis_mesh().

Here is the caller graph for this function:

◆ is_polytope()

◆ is_rational()

bool polyfem::mesh::Mesh::is_rational ( ) const
inline

check if curved mesh has rational polynomials elements

Returns
if mesh is rational

Definition at line 271 of file Mesh.hpp.

References is_rational_.

◆ is_simplex()

bool polyfem::mesh::Mesh::is_simplex ( const int  el_id) const

checks if element is simples compatible

Parameters
[in]el_idelement id
Returns
is simples compatible

Definition at line 418 of file Mesh.cpp.

References elements_tag_, and polyfem::mesh::SIMPLEX.

Referenced by polyfem::io::Evaluator::average_grad_based_function(), polyfem::mesh::Mesh2D::barycentric_coords(), polyfem::mesh::CMesh3D::barycentric_coords(), polyfem::mesh::Mesh3D::barycentric_coords(), polyfem::io::OutGeometryData::build_grid(), polyfem::io::OutGeometryData::build_high_order_vis_mesh(), polyfem::io::OutGeometryData::build_vis_mesh(), polyfem::mesh::Mesh3D::cell_node(), polyfem::io::Evaluator::check_scalar_value(), polyfem::mesh::Mesh3D::compute_cell_jacobian(), polyfem::mesh::Mesh2D::compute_face_jacobian(), polyfem::io::OutStatsData::compute_mesh_size(), polyfem::io::Evaluator::compute_scalar_value(), polyfem::io::Evaluator::compute_stress_at_quadrature_points(), polyfem::io::Evaluator::compute_tensor_value(), polyfem::io::Evaluator::compute_vertex_values(), polyfem::io::OutGeometryData::extract_boundary_mesh(), polyfem::mesh::Mesh3D::face_node(), polyfem::mesh::CMesh2D::face_node(), polyfem::io::Evaluator::interpolate_boundary_function(), polyfem::io::Evaluator::interpolate_boundary_function_at_vertices(), polyfem::io::Evaluator::interpolate_boundary_tensor_function(), polyfem::io::Evaluator::interpolate_function(), is_simplicial(), polyfem::mesh::MeshNodes::node_ids_from_cell(), polyfem::mesh::MeshNodes::node_ids_from_face(), polyfem::mesh::MeshNodes::node_ids_from_face(), polyfem::refinement::APriori::p_refine(), polyfem::refinement::APriori::p_refine(), polyfem::mesh::CMesh2D::refine(), polyfem::io::OutGeometryData::save_surface(), polyfem::io::OutGeometryData::save_volume(), polyfem::io::OutGeometryData::save_wire(), polyfem::basis::LagrangeBasis3d::tet_face_local_nodes(), and polyfem::basis::LagrangeBasis2d::tri_edge_local_nodes().

Here is the caller graph for this function:

◆ is_simplicial()

bool polyfem::mesh::Mesh::is_simplicial ( ) const
inline

checks if the mesh is simplicial

Returns
if the mesh is simplicial

Definition at line 579 of file Mesh.hpp.

References is_simplex(), and n_elements().

Referenced by polyfem::io::OutGeometryData::extract_boundary_mesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_spline_compatible()

bool polyfem::mesh::Mesh::is_spline_compatible ( const int  el_id) const

checks if element is spline compatible

Parameters
[in]el_idelement id
Returns
is spline compatible

Definition at line 328 of file Mesh.cpp.

References elements_tag_, is_volume(), polyfem::mesh::REGULAR_BOUNDARY_CUBE, and polyfem::mesh::REGULAR_INTERIOR_CUBE.

Referenced by polyfem::basis::SplineBasis2d::build_bases(), and polyfem::basis::SplineBasis3d::build_bases().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_volume()

virtual bool polyfem::mesh::Mesh::is_volume ( ) const
pure virtual

checks if mesh is volume

Returns
if mesh is volumetric

Implemented in polyfem::mesh::Mesh2D, and polyfem::mesh::Mesh3D.

Referenced by polyfem::assembler::RhsAssembler::assemble(), boundary_element_vertex(), polyfem::io::OutGeometryData::build_grid(), polyfem::io::OutGeometryData::build_high_order_vis_mesh(), polyfem::io::OutGeometryData::build_vis_boundary_mesh(), polyfem::io::OutGeometryData::build_vis_mesh(), polyfem::io::Evaluator::check_scalar_value(), polyfem::assembler::RhsAssembler::compute_energy(), polyfem::assembler::RhsAssembler::compute_energy_hess(), polyfem::io::OutStatsData::compute_errors(), polyfem::io::OutStatsData::compute_mesh_size(), polyfem::io::Evaluator::compute_scalar_value(), polyfem::io::Evaluator::compute_stress_at_quadrature_points(), polyfem::io::Evaluator::compute_tensor_value(), polyfem::io::Evaluator::compute_vertex_values(), polyfem::io::OutStatsData::count_flipped_elements(), dimension(), element_vertex(), polyfem::io::OutGeometryData::extract_boundary_mesh(), polyfem::solver::BodyForm::force_shape_derivative(), get_default_boundary_id(), polyfem::io::Evaluator::get_sidesets(), polyfem::problem::NodeValues::init(), polyfem::io::OutGeometryData::init_sampler(), polyfem::assembler::RhsAssembler::integrate_bc(), polyfem::io::Evaluator::interpolate_at_local_vals(), polyfem::io::Evaluator::interpolate_boundary_function(), polyfem::io::Evaluator::interpolate_boundary_function_at_vertices(), polyfem::io::Evaluator::interpolate_boundary_tensor_function(), polyfem::io::Evaluator::interpolate_function(), is_spline_compatible(), polyfem::solver::LinearFilter::LinearFilter(), polyfem::mesh::MeshNodes::MeshNodes(), n_boundary_elements(), n_elements(), polyfem::utils::BoundarySampler::normal_for_polygon_edge(), polyfem::refinement::APriori::p_refine(), polyfem::utils::BoundarySampler::quadrature_for_polygon_edge(), polyfem::utils::BoundarySampler::sample_polygon_edge(), polyfem::io::OutGeometryData::save_surface(), polyfem::io::OutGeometryData::save_volume(), polyfem::io::OutGeometryData::save_wire(), polyfem::assembler::RhsAssembler::time_bc(), and polyfem::io::MshWriter::write().

Here is the caller graph for this function:

◆ load() [1/2]

virtual bool polyfem::mesh::Mesh::load ( const GEO::Mesh &  M)
protectedpure virtual

loads a mesh from a geo mesh

Parameters
[in]Mgeo mesh
Returns
if success

Implemented in polyfem::mesh::CMesh3D, polyfem::mesh::NCMesh3D, polyfem::mesh::CMesh2D, and polyfem::mesh::NCMesh2D.

◆ load() [2/2]

virtual bool polyfem::mesh::Mesh::load ( const std::string &  path)
protectedpure virtual

loads a mesh from the path

Parameters
[in]pathfile location
Returns
if success

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ load_boundary_ids()

void polyfem::mesh::Mesh::load_boundary_ids ( const std::string &  path)
virtual

loads the boundary selections for a file

Parameters
[in]pathfile's path

Definition at line 395 of file Mesh.cpp.

References boundary_ids_, and n_boundary_elements().

Here is the call graph for this function:

◆ n_boundary_elements()

int polyfem::mesh::Mesh::n_boundary_elements ( ) const
inline

utitlity to return the number of boundary elements, faces or edges in 3d and 2d

Returns
number of boundary elements

Definition at line 163 of file Mesh.hpp.

References is_volume(), n_edges(), and n_faces().

Referenced by append(), load_boundary_ids(), and set_boundary_ids().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ n_cell_vertices()

virtual int polyfem::mesh::Mesh::n_cell_vertices ( const int  c_id) const
pure virtual

number of vertices of a cell

Parameters
[in]c_idglobal cell id (face for 2d meshes)
Returns
number of vertices

Implemented in polyfem::mesh::Mesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by polyfem::mesh::Mesh3D::elements_boxes(), polyfem::mesh::extract_polyhedra(), and polyfem::io::MshWriter::write().

Here is the caller graph for this function:

◆ n_cells()

virtual int polyfem::mesh::Mesh::n_cells ( ) const
pure virtual

number of cells

Returns
number of cells

Implemented in polyfem::mesh::Mesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by cell_barycenters(), polyfem::mesh::extract_polyhedra(), polyfem::mesh::MeshNodes::MeshNodes(), n_elements(), polyfem::refinement::APriori::p_refine(), and polyfem::mesh::to_geogram_mesh().

Here is the caller graph for this function:

◆ n_edges()

virtual int polyfem::mesh::Mesh::n_edges ( ) const
pure virtual

number of edges

Returns
number of edges

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by edge_barycenters(), edges(), edges_to_ids(), polyfem::mesh::Mesh2D::get_edges(), polyfem::mesh::Mesh3D::get_edges(), polyfem::io::Evaluator::get_sidesets(), polyfem::problem::NodeValues::init(), polyfem::mesh::MeshNodes::MeshNodes(), and n_boundary_elements().

Here is the caller graph for this function:

◆ n_elements()

int polyfem::mesh::Mesh::n_elements ( ) const
inline

utitlity to return the number of elements, cells or faces in 3d and 2d

Returns
number of elements

Definition at line 158 of file Mesh.hpp.

References is_volume(), n_cells(), and n_faces().

Referenced by append(), polyfem::solver::PerBody2PerElem::apply_jacobian(), polyfem::basis::PolygonalBasis2d::build_bases(), polyfem::basis::PolygonalBasis3d::build_bases(), polyfem::basis::SplineBasis2d::build_bases(), polyfem::basis::SplineBasis3d::build_bases(), polyfem::basis::BarycentricBasis2d::build_bases(), polyfem::mesh::CMesh2D::compute_body_ids(), polyfem::mesh::CMesh3D::compute_body_ids(), polyfem::basis::PolygonalBasis3d::compute_integral_constraints(), polyfem::basis::PolygonalBasis2d::compute_integral_constraints(), polyfem::compute_integral_constraints(), polyfem::io::OutStatsData::compute_mesh_stats(), polyfem::io::Evaluator::compute_stress_at_quadrature_points(), polyfem::mesh::Mesh2D::elements_boxes(), polyfem::mesh::CMesh3D::elements_boxes(), polyfem::mesh::Mesh3D::elements_boxes(), polyfem::solver::PerBody2PerElem::eval(), has_poly(), polyfem::io::OutGeometryData::init_sampler(), polyfem::io::Evaluator::interpolate_boundary_function(), polyfem::io::Evaluator::interpolate_boundary_function_at_vertices(), polyfem::io::Evaluator::interpolate_boundary_tensor_function(), is_simplicial(), polyfem::refinement::APriori::p_refine(), polyfem::solver::PerBody2PerElem::PerBody2PerElem(), polyfem::solver::PerBody2PerNode::PerBody2PerNode(), polyfem::mesh::CMesh2D::refine(), polyfem::io::OutStatsData::save_json(), set_body_ids(), and polyfem::io::MshWriter::write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ n_face_vertices()

virtual int polyfem::mesh::Mesh::n_face_vertices ( const int  f_id) const
pure virtual

◆ n_faces()

virtual int polyfem::mesh::Mesh::n_faces ( ) const
pure virtual

◆ n_vertices()

◆ normalize()

virtual void polyfem::mesh::Mesh::normalize ( )
pure virtual

◆ operator=() [1/2]

Mesh & polyfem::mesh::Mesh::operator= ( const Mesh )
default
Returns
Mesh&

◆ operator=() [2/2]

Mesh & polyfem::mesh::Mesh::operator= ( Mesh &&  )
default

Copy constructor.

Returns
Mesh&

◆ orders()

const Eigen::MatrixXi & polyfem::mesh::Mesh::orders ( ) const
inline

order of each element

Returns
matrix containing order

Definition at line 267 of file Mesh.hpp.

References orders_.

Referenced by polyfem::io::OutStatsData::save_json().

Here is the caller graph for this function:

◆ point()

virtual RowVectorNd polyfem::mesh::Mesh::point ( const int  global_index) const
pure virtual

point coordinates

Parameters
[in]global_indexglobal vertex index
Returns
RowVectorNd

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::NCMesh3D, and polyfem::mesh::CMesh3D.

Referenced by polyfem::solver::OperatorSplittingSolver::advection_PIC(), apply_affine_transformation(), polyfem::mesh::Mesh2D::barycentric_coords(), polyfem::mesh::Mesh3D::barycentric_coords(), polyfem::mesh::Remesher::build_bases(), polyfem::basis::BarycentricBasis2d::build_bases(), polyfem::mesh::Mesh3D::cell_node(), polyfem::mesh::Mesh3D::compute_cell_jacobian(), polyfem::basis::compute_epsilon(), polyfem::mesh::Mesh2D::compute_face_jacobian(), compute_node_ids(), polyfem::mesh::Mesh3D::edge_node(), polyfem::mesh::Mesh2D::elements_boxes(), polyfem::mesh::Mesh3D::elements_boxes(), polyfem::mesh::extract_polyhedra(), polyfem::mesh::Mesh2D::face_barycenter(), polyfem::mesh::Mesh3D::face_node(), polyfem::mesh::Mesh2D::get_edges(), polyfem::mesh::Mesh3D::get_edges(), polyfem::mesh::Mesh2D::get_edges(), polyfem::mesh::Mesh3D::get_edges(), polyfem::io::Evaluator::get_sidesets(), polyfem::solver::OperatorSplittingSolver::initialize_mesh(), polyfem::mesh::MeshNodes::node_id_from_primitive(), polyfem::refinement::APriori::p_refine(), polyfem::refinement::APriori::p_refine(), polyfem::mesh::to_geogram_mesh(), polyfem::mesh::Mesh3D::tri_area(), and polyfem::io::MshWriter::write().

Here is the caller graph for this function:

◆ prepare_mesh()

virtual void polyfem::mesh::Mesh::prepare_mesh ( )
inlinevirtual

method used to finalize the mesh.

It computes the cached stuff used in navigation

Reimplemented in polyfem::mesh::NCMesh2D, and polyfem::mesh::NCMesh3D.

Definition at line 560 of file Mesh.hpp.

◆ quad_area()

virtual double polyfem::mesh::Mesh::quad_area ( const int  gid) const
inlinevirtual

area of a quad face of an hex mesh

Parameters
[in]gidglobal face id
Returns
face area

Reimplemented in polyfem::mesh::CMesh3D.

Definition at line 299 of file Mesh.hpp.

Referenced by polyfem::utils::BoundarySampler::quadrature_for_quad_face(), and polyfem::io::OutGeometryData::save_surface().

Here is the caller graph for this function:

◆ refine()

virtual void polyfem::mesh::Mesh::refine ( const int  n_refinement,
const double  t 
)
pure virtual

refine the mesh

Parameters
[in]n_refinementnumber of refinements
[in]tposition of the refinement location (0.5 for standard refinement)

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ save()

virtual bool polyfem::mesh::Mesh::save ( const std::string &  path) const
pure virtual

◆ set_body_ids()

virtual void polyfem::mesh::Mesh::set_body_ids ( const std::vector< int > &  body_ids)
inlinevirtual

Set the volume sections.

Parameters
[in]body_idsvector of labels, one per element

Reimplemented in polyfem::mesh::NCMesh2D, and polyfem::mesh::NCMesh3D.

Definition at line 456 of file Mesh.hpp.

References body_ids_, and n_elements().

Here is the call graph for this function:

◆ set_boundary_ids()

virtual void polyfem::mesh::Mesh::set_boundary_ids ( const std::vector< int > &  boundary_ids)
inlinevirtual

Set the boundary selection from a vector.

Parameters
[in]boundary_idsvector one value per element

Reimplemented in polyfem::mesh::NCMesh2D, and polyfem::mesh::NCMesh3D.

Definition at line 448 of file Mesh.hpp.

References boundary_ids_, and n_boundary_elements().

Here is the call graph for this function:

◆ set_cell_weights()

void polyfem::mesh::Mesh::set_cell_weights ( const std::vector< std::vector< double > > &  in_cell_weights)
inline

Set the cell weights for rational polynomial meshes.

Parameters
[in]in_cell_weightsvector of vector containing the weights, one per cell

Definition at line 556 of file Mesh.hpp.

References cell_weights_.

◆ set_is_rational()

void polyfem::mesh::Mesh::set_is_rational ( const bool  in_is_rational)
inline

Set the is rational object.

Parameters
[in]in_is_rationalflag to enable/disable rational polynomials

Definition at line 275 of file Mesh.hpp.

References is_rational_.

◆ set_point()

virtual void polyfem::mesh::Mesh::set_point ( const int  global_index,
const RowVectorNd p 
)
pure virtual

Set the point.

Parameters
[in]global_indexglobal vertex index
[in]pvalue

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

Referenced by apply_affine_transformation().

Here is the caller graph for this function:

◆ set_tag()

void polyfem::mesh::Mesh::set_tag ( const int  el,
const ElementType  type 
)
inline

changes the element type

Parameters
[in]elelement id
[in]typetype of the element

Definition at line 404 of file Mesh.hpp.

References elements_tag_.

◆ tri_area()

virtual double polyfem::mesh::Mesh::tri_area ( const int  gid) const
inlinevirtual

area of a tri face of a tet mesh

Parameters
[in]gidglobal face id
Returns
tet area

Reimplemented in polyfem::mesh::Mesh3D.

Definition at line 308 of file Mesh.hpp.

Referenced by polyfem::utils::BoundarySampler::quadrature_for_tri_face(), and polyfem::io::OutGeometryData::save_surface().

Here is the caller graph for this function:

◆ triangulate_faces()

virtual void polyfem::mesh::Mesh::triangulate_faces ( Eigen::MatrixXi &  tris,
Eigen::MatrixXd &  pts,
std::vector< int > &  ranges 
) const
pure virtual

generate a triangular representation of every face

Parameters
[out]tristriangles connectivity
[out]ptstriangles vertices
[out]rangesconnection to original faces

Implemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, polyfem::mesh::CMesh3D, and polyfem::mesh::NCMesh3D.

◆ update_elements_tag()

virtual void polyfem::mesh::Mesh::update_elements_tag ( )
inlinevirtual

Update elements types.

Reimplemented in polyfem::mesh::CMesh2D, polyfem::mesh::NCMesh2D, and polyfem::mesh::NCMesh3D.

Definition at line 284 of file Mesh.hpp.

◆ update_nodes()

void polyfem::mesh::Mesh::update_nodes ( const Eigen::VectorXi &  in_node_to_node)

Update the node ids to reorder them.

Parameters
[in]in_node_to_nodemapping from input nodes to polyfem nodes

Definition at line 367 of file Mesh.cpp.

References n_vertices(), and node_ids_.

Here is the call graph for this function:

Member Data Documentation

◆ body_ids_

◆ boundary_ids_

◆ cell_nodes_

◆ cell_weights_

std::vector<std::vector<double> > polyfem::mesh::Mesh::cell_weights_
protected

weights associates to cells for rational polynomail meshes

Definition at line 677 of file Mesh.hpp.

Referenced by append(), cell_weights(), polyfem::mesh::CMesh2D::copy(), and set_cell_weights().

◆ edge_nodes_

◆ elements_tag_

◆ face_nodes_

◆ in_ordered_edges_

Eigen::MatrixXi polyfem::mesh::Mesh::in_ordered_edges_
protected

◆ in_ordered_faces_

Eigen::MatrixXi polyfem::mesh::Mesh::in_ordered_faces_
protected

Order of the input faces, TODO: change to std::vector of Eigen::Vector.

Definition at line 684 of file Mesh.hpp.

Referenced by append(), polyfem::mesh::CMesh2D::copy(), in_ordered_faces(), polyfem::mesh::CMesh2D::refine(), and polyfem::mesh::CMesh3D::refine().

◆ in_ordered_vertices_

Eigen::VectorXi polyfem::mesh::Mesh::in_ordered_vertices_
protected

◆ is_rational_

bool polyfem::mesh::Mesh::is_rational_ = false
protected

stores if the mesh is rational

Definition at line 668 of file Mesh.hpp.

Referenced by append(), polyfem::mesh::CMesh2D::copy(), is_rational(), and set_is_rational().

◆ node_ids_

std::vector<int> polyfem::mesh::Mesh::node_ids_
protected

list of node labels

Definition at line 660 of file Mesh.hpp.

Referenced by append(), compute_node_ids(), polyfem::mesh::CMesh2D::copy(), get_node_id(), has_node_ids(), and update_nodes().

◆ orders_


The documentation for this class was generated from the following files: