PolyFEM
Loading...
Searching...
No Matches
polyfem::mesh::CMesh2D Class Reference

#include <CMesh2D.hpp>

Inheritance diagram for polyfem::mesh::CMesh2D:
[legend]
Collaboration diagram for polyfem::mesh::CMesh2D:
[legend]

Public Member Functions

 CMesh2D ()=default
 
virtual ~CMesh2D ()=default
 
 CMesh2D (CMesh2D &&)=delete
 
CMesh2Doperator= (CMesh2D &&)=delete
 
 CMesh2D (const CMesh2D &)=delete
 
CMesh2Doperator= (const CMesh2D &)=delete
 
void refine (const int n_refinement, const double t) override
 refine the mesh
 
bool is_conforming () const override
 if the mesh is conforming
 
int n_faces () const override
 number of faces
 
int n_edges () const override
 number of edges
 
int n_vertices () const override
 number of vertices
 
int n_face_vertices (const int f_id) const override
 number of vertices of a face
 
int face_vertex (const int f_id, const int lv_id) const override
 id of the face vertex
 
int edge_vertex (const int e_id, const int lv_id) const override
 id of the edge vertex
 
int cell_vertex (const int f_id, const int lv_id) const override
 id of the vertex of a cell
 
bool is_boundary_vertex (const int vertex_global_id) const override
 is vertex boundary
 
bool is_boundary_edge (const int edge_global_id) const override
 is edge boundary
 
bool is_boundary_element (const int element_global_id) const override
 is cell boundary
 
bool save (const std::string &path) const override
 
bool build_from_matrices (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) override
 build a mesh from matrices
 
void attach_higher_order_nodes (const Eigen::MatrixXd &V, const std::vector< std::vector< int > > &nodes) override
 attach high order nodes
 
RowVectorNd edge_node (const Navigation::Index &index, const int n_new_nodes, const int i) const override
 
RowVectorNd face_node (const Navigation::Index &index, const int n_new_nodes, const int i, const int j) const override
 
void normalize () override
 normalize the mesh
 
double edge_length (const int gid) const override
 edge length
 
void compute_elements_tag () override
 compute element types, see ElementType
 
virtual void update_elements_tag () override
 Update elements types.
 
void set_point (const int global_index, const RowVectorNd &p) override
 Set the point.
 
virtual RowVectorNd point (const int global_index) const override
 point coordinates
 
virtual RowVectorNd edge_barycenter (const int index) const override
 edge barycenter
 
virtual void bounding_box (RowVectorNd &min, RowVectorNd &max) const override
 computes the bbox of the mesh
 
void compute_boundary_ids (const double eps) override
 computes the selection based on the bbx of the mesh.
 
void compute_boundary_ids (const std::function< int(const RowVectorNd &)> &marker) override
 computes boundary selections based on a function
 
void compute_boundary_ids (const std::function< int(const RowVectorNd &, bool)> &marker) override
 computes boundary selections based on a function
 
void compute_boundary_ids (const std::function< int(const size_t, const RowVectorNd &, bool)> &marker) override
 computes boundary selections based on a function
 
void compute_boundary_ids (const std::function< int(const std::vector< int > &, bool)> &marker) override
 computes boundary selections based on a function
 
void compute_boundary_ids (const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &, bool)> &marker) override
 computes boundary selections based on a function
 
void compute_body_ids (const std::function< int(const size_t, const RowVectorNd &)> &marker) override
 computes boundary selections based on a function
 
Navigation::Index get_index_from_face (int f, int lv=0) const override
 
Navigation::Index switch_vertex (Navigation::Index idx) const override
 
Navigation::Index switch_edge (Navigation::Index idx) const override
 
Navigation::Index switch_face (Navigation::Index idx) const override
 
void triangulate_faces (Eigen::MatrixXi &tris, Eigen::MatrixXd &pts, std::vector< int > &ranges) const override
 generate a triangular representation of every face
 
void append (const Mesh &mesh) override
 appends a new mesh to the end of this
 
std::unique_ptr< Meshcopy () const override
 Create a copy of the mesh.
 
- Public Member Functions inherited from polyfem::mesh::Mesh2D
 Mesh2D ()=default
 
virtual ~Mesh2D ()=default
 
 Mesh2D (Mesh2D &&)=default
 
Mesh2Doperator= (Mesh2D &&)=default
 
 Mesh2D (const Mesh2D &)=default
 
Mesh2Doperator= (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
 
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
 
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 ~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
 
int dimension () const
 utily for dimension
 
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
 
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
 
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 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
 
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
 
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 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 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.
 
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\).
 

Protected Member Functions

bool load (const std::string &path) override
 loads a mesh from the path
 
bool load (const GEO::Mesh &mesh) override
 loads a mesh from a geo mesh
 
- Protected Member Functions inherited from polyfem::mesh::Mesh
 Mesh ()=default
 Construct a new Mesh object.
 

Private Attributes

GEO::Mesh mesh_
 
std::unique_ptr< GEO::Attribute< GEO::index_t > > c2e_
 
std::unique_ptr< GEO::Attribute< bool > > boundary_vertices_
 
std::unique_ptr< GEO::Attribute< bool > > boundary_edges_
 

Additional Inherited Members

- Static Public Member Functions inherited from polyfem::mesh::Mesh
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 Attributes inherited from polyfem::mesh::Mesh
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.
 

Detailed Description

Definition at line 17 of file CMesh2D.hpp.

Constructor & Destructor Documentation

◆ CMesh2D() [1/3]

polyfem::mesh::CMesh2D::CMesh2D ( )
default

◆ ~CMesh2D()

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

◆ CMesh2D() [2/3]

polyfem::mesh::CMesh2D::CMesh2D ( CMesh2D &&  )
delete

◆ CMesh2D() [3/3]

polyfem::mesh::CMesh2D::CMesh2D ( const CMesh2D )
delete

Member Function Documentation

◆ append()

void polyfem::mesh::CMesh2D::append ( const Mesh mesh)
overridevirtual

appends a new mesh to the end of this

Parameters
[in]meshto append

Reimplemented from polyfem::mesh::Mesh.

Definition at line 686 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::append(), boundary_edges_, boundary_vertices_, c2e_, mesh_, n_faces(), n_vertices(), point(), polyfem::mesh::Navigation::prepare_mesh(), and set_point().

Here is the call graph for this function:

◆ attach_higher_order_nodes()

void polyfem::mesh::CMesh2D::attach_higher_order_nodes ( const Eigen::MatrixXd &  V,
const std::vector< std::vector< int > > &  nodes 
)
overridevirtual

attach high order nodes

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

Implements polyfem::mesh::Mesh.

Definition at line 197 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::cell_nodes_, polyfem::mesh::Mesh::edge_nodes_, polyfem::mesh::Mesh::face_nodes_, get_index_from_face(), mesh_, n_edges(), n_faces(), polyfem::mesh::Mesh2D::next_around_face(), polyfem::mesh::Mesh::orders_, switch_vertex(), V, and polyfem::mesh::Navigation::Index::vertex.

Here is the call graph for this function:

◆ bounding_box()

void polyfem::mesh::CMesh2D::bounding_box ( RowVectorNd min,
RowVectorNd max 
) const
overridevirtual

computes the bbox of the mesh

Parameters
[out]minmin coodiante
[out]maxmax coodiante

Implements polyfem::mesh::Mesh.

Definition at line 399 of file CMesh2D.cpp.

References mesh_.

Referenced by compute_boundary_ids().

Here is the caller graph for this function:

◆ build_from_matrices()

bool polyfem::mesh::CMesh2D::build_from_matrices ( const Eigen::MatrixXd &  V,
const Eigen::MatrixXi &  F 
)
overridevirtual

build a mesh from matrices

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

Implements polyfem::mesh::Mesh.

Definition at line 173 of file CMesh2D.cpp.

References boundary_edges_, boundary_vertices_, c2e_, polyfem::mesh::Mesh::cell_nodes_, compute_elements_tag(), polyfem::mesh::Mesh::edge_nodes_, polyfem::F, polyfem::mesh::Mesh::face_nodes_, mesh_, polyfem::mesh::orient_normals_2d(), polyfem::mesh::Navigation::prepare_mesh(), polyfem::mesh::to_geogram_mesh(), and V.

Here is the call graph for this function:

◆ cell_vertex()

int polyfem::mesh::CMesh2D::cell_vertex ( const int  f_id,
const int  lv_id 
) const
inlineoverridevirtual

id of the vertex of a cell

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

Implements polyfem::mesh::Mesh.

Definition at line 41 of file CMesh2D.hpp.

References mesh_.

◆ compute_body_ids()

void polyfem::mesh::CMesh2D::compute_body_ids ( const std::function< int(const size_t, const RowVectorNd &)> &  marker)
overridevirtual

computes boundary selections based on a function

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

Implements polyfem::mesh::Mesh.

Definition at line 576 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::body_ids_, polyfem::mesh::Mesh2D::face_barycenter(), and polyfem::mesh::Mesh::n_elements().

Here is the call graph for this function:

◆ compute_boundary_ids() [1/6]

void polyfem::mesh::CMesh2D::compute_boundary_ids ( const double  eps)
overridevirtual

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

Implements polyfem::mesh::Mesh.

Definition at line 588 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, bounding_box(), edge_barycenter(), is_boundary_edge(), and n_edges().

Here is the call graph for this function:

◆ compute_boundary_ids() [2/6]

void polyfem::mesh::CMesh2D::compute_boundary_ids ( const std::function< int(const RowVectorNd &)> &  marker)
overridevirtual

computes boundary selections based on a function

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

Implements polyfem::mesh::Mesh.

Definition at line 618 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, edge_barycenter(), is_boundary_edge(), and n_edges().

Here is the call graph for this function:

◆ compute_boundary_ids() [3/6]

void polyfem::mesh::CMesh2D::compute_boundary_ids ( const std::function< int(const RowVectorNd &, bool)> &  marker)
overridevirtual

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

Implements polyfem::mesh::Mesh.

Definition at line 635 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, edge_barycenter(), is_boundary_edge(), and n_edges().

Here is the call graph for this function:

◆ compute_boundary_ids() [4/6]

void polyfem::mesh::CMesh2D::compute_boundary_ids ( const std::function< int(const size_t, const RowVectorNd &, bool)> &  marker)
overridevirtual

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

Implements polyfem::mesh::Mesh.

Definition at line 647 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, edge_barycenter(), is_boundary_edge(), and n_edges().

Here is the call graph for this function:

◆ compute_boundary_ids() [5/6]

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

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

Implements polyfem::mesh::Mesh.

Definition at line 672 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, edge_barycenter(), edge_vertex(), is_boundary_edge(), and n_edges().

Here is the call graph for this function:

◆ compute_boundary_ids() [6/6]

void polyfem::mesh::CMesh2D::compute_boundary_ids ( const std::function< int(const std::vector< int > &, bool)> &  marker)
overridevirtual

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

Implements polyfem::mesh::Mesh.

Definition at line 659 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, edge_vertex(), is_boundary_edge(), and n_edges().

Here is the call graph for this function:

◆ compute_elements_tag()

void polyfem::mesh::CMesh2D::compute_elements_tag ( )
overridevirtual

compute element types, see ElementType

Implements polyfem::mesh::Mesh.

Definition at line 557 of file CMesh2D.cpp.

References polyfem::mesh::compute_element_tags(), polyfem::mesh::Mesh::elements_tag_, and mesh_.

Referenced by build_from_matrices(), load(), and refine().

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

◆ copy()

◆ edge_barycenter()

RowVectorNd polyfem::mesh::CMesh2D::edge_barycenter ( const int  e) const
overridevirtual

edge barycenter

Parameters
[in]eglobal edge index
Returns
edge barycenter

Implements polyfem::mesh::Mesh.

Definition at line 568 of file CMesh2D.cpp.

References mesh_, and point().

Referenced by compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), and compute_boundary_ids().

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

◆ edge_length()

double polyfem::mesh::CMesh2D::edge_length ( const int  gid) const
overridevirtual

edge length

Parameters
[in]gidglobal edge id
Returns
edge length

Reimplemented from polyfem::mesh::Mesh.

Definition at line 458 of file CMesh2D.cpp.

References mesh_, and point().

Here is the call graph for this function:

◆ edge_node()

RowVectorNd polyfem::mesh::CMesh2D::edge_node ( const Navigation::Index index,
const int  n_new_nodes,
const int  i 
) const
overridevirtual

Implements polyfem::mesh::Mesh2D.

Definition at line 333 of file CMesh2D.cpp.

References polyfem::mesh::Navigation::Index::edge, polyfem::mesh::Mesh::edge_nodes_, polyfem::mesh::Navigation::Index::face, polyfem::mesh::Mesh::orders_, point(), switch_vertex(), and polyfem::mesh::Navigation::Index::vertex.

Here is the call graph for this function:

◆ edge_vertex()

int polyfem::mesh::CMesh2D::edge_vertex ( const int  e_id,
const int  lv_id 
) const
inlineoverridevirtual

id of the edge vertex

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

Implements polyfem::mesh::Mesh.

Definition at line 40 of file CMesh2D.hpp.

References mesh_.

Referenced by compute_boundary_ids(), and compute_boundary_ids().

Here is the caller graph for this function:

◆ face_node()

RowVectorNd polyfem::mesh::CMesh2D::face_node ( const Navigation::Index index,
const int  n_new_nodes,
const int  i,
const int  j 
) const
overridevirtual

Implements polyfem::mesh::Mesh2D.

Definition at line 355 of file CMesh2D.cpp.

References polyfem::mesh::Navigation::Index::face, polyfem::mesh::Mesh::face_nodes_, polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::orders_, point(), switch_edge(), switch_vertex(), and polyfem::mesh::Navigation::Index::vertex.

Here is the call graph for this function:

◆ face_vertex()

int polyfem::mesh::CMesh2D::face_vertex ( const int  f_id,
const int  lv_id 
) const
inlineoverridevirtual

id of the face vertex

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

Implements polyfem::mesh::Mesh.

Definition at line 39 of file CMesh2D.hpp.

References mesh_.

◆ get_index_from_face()

Navigation::Index polyfem::mesh::CMesh2D::get_index_from_face ( int  f,
int  lv = 0 
) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh2D.

Definition at line 88 of file CMesh2D.hpp.

References c2e_, polyfem::mesh::Navigation::get_index_from_face(), and mesh_.

Referenced by attach_higher_order_nodes(), is_boundary_element(), polyfem::utils::BoundarySampler::normal_for_polygon_edge(), polyfem::utils::BoundarySampler::quadrature_for_polygon_edge(), and polyfem::utils::BoundarySampler::sample_polygon_edge().

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

◆ is_boundary_edge()

bool polyfem::mesh::CMesh2D::is_boundary_edge ( const int  edge_global_id) const
inlineoverridevirtual

is edge boundary

Parameters
[in]edge_global_idglobal edge id
Returns
is edge boundary

Implements polyfem::mesh::Mesh.

Definition at line 48 of file CMesh2D.hpp.

References boundary_edges_.

Referenced by compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), and is_boundary_element().

Here is the caller graph for this function:

◆ is_boundary_element()

bool polyfem::mesh::CMesh2D::is_boundary_element ( const int  element_global_id) const
overridevirtual

is cell boundary

Parameters
[in]element_global_idglobal cell id
Returns
is cell boundary

Implements polyfem::mesh::Mesh.

Definition at line 481 of file CMesh2D.cpp.

References get_index_from_face(), is_boundary_edge(), n_face_vertices(), and polyfem::mesh::Mesh2D::next_around_face().

Here is the call graph for this function:

◆ is_boundary_vertex()

bool polyfem::mesh::CMesh2D::is_boundary_vertex ( const int  vertex_global_id) const
inlineoverridevirtual

is vertex boundary

Parameters
[in]vertex_global_idglobal vertex id
Returns
is vertex boundary

Implements polyfem::mesh::Mesh.

Definition at line 43 of file CMesh2D.hpp.

References boundary_vertices_.

◆ is_conforming()

bool polyfem::mesh::CMesh2D::is_conforming ( ) const
inlineoverridevirtual

if the mesh is conforming

Returns
if the mesh is conforming

Implements polyfem::mesh::Mesh.

Definition at line 31 of file CMesh2D.hpp.

◆ load() [1/2]

bool polyfem::mesh::CMesh2D::load ( const GEO::Mesh &  M)
overrideprotectedvirtual

loads a mesh from a geo mesh

Parameters
[in]Mgeo mesh
Returns
if success

Implements polyfem::mesh::Mesh.

Definition at line 142 of file CMesh2D.cpp.

References boundary_edges_, boundary_vertices_, c2e_, polyfem::mesh::Mesh::cell_nodes_, compute_elements_tag(), polyfem::mesh::Mesh::edge_nodes_, polyfem::mesh::Mesh::face_nodes_, mesh_, polyfem::mesh::orient_normals_2d(), and polyfem::mesh::Navigation::prepare_mesh().

Here is the call graph for this function:

◆ load() [2/2]

bool polyfem::mesh::CMesh2D::load ( const std::string &  path)
overrideprotectedvirtual

loads a mesh from the path

Parameters
[in]pathfile location
Returns
if success

Implements polyfem::mesh::Mesh.

Definition at line 96 of file CMesh2D.cpp.

◆ n_edges()

int polyfem::mesh::CMesh2D::n_edges ( ) const
inlineoverridevirtual

number of edges

Returns
number of edges

Implements polyfem::mesh::Mesh.

Definition at line 34 of file CMesh2D.hpp.

References mesh_.

Referenced by attach_higher_order_nodes(), compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), compute_boundary_ids(), and compute_boundary_ids().

Here is the caller graph for this function:

◆ n_face_vertices()

int polyfem::mesh::CMesh2D::n_face_vertices ( const int  f_id) const
inlineoverridevirtual

number of vertices of a face

Parameters
[in]f_idglobal face id
Returns
number of vertices

Implements polyfem::mesh::Mesh.

Definition at line 37 of file CMesh2D.hpp.

References mesh_.

Referenced by is_boundary_element(), polyfem::utils::BoundarySampler::normal_for_polygon_edge(), polyfem::utils::BoundarySampler::quadrature_for_polygon_edge(), and polyfem::utils::BoundarySampler::sample_polygon_edge().

Here is the caller graph for this function:

◆ n_faces()

int polyfem::mesh::CMesh2D::n_faces ( ) const
inlineoverridevirtual

number of faces

Returns
number of faces

Implements polyfem::mesh::Mesh.

Definition at line 33 of file CMesh2D.hpp.

References mesh_.

Referenced by append(), and attach_higher_order_nodes().

Here is the caller graph for this function:

◆ n_vertices()

int polyfem::mesh::CMesh2D::n_vertices ( ) const
inlineoverridevirtual

number of vertices

Returns
number of vertices

Implements polyfem::mesh::Mesh.

Definition at line 35 of file CMesh2D.hpp.

References mesh_.

Referenced by append(), and triangulate_faces().

Here is the caller graph for this function:

◆ normalize()

void polyfem::mesh::CMesh2D::normalize ( )
overridevirtual

normalize the mesh

Implements polyfem::mesh::Mesh.

Definition at line 413 of file CMesh2D.cpp.

References polyfem::mesh::Mesh::edge_nodes_, polyfem::mesh::Mesh::face_nodes_, polyfem::mesh::Mesh2D::get_edges(), polyfem::logger(), and mesh_.

Here is the call graph for this function:

◆ operator=() [1/2]

CMesh2D & polyfem::mesh::CMesh2D::operator= ( CMesh2D &&  )
delete

◆ operator=() [2/2]

CMesh2D & polyfem::mesh::CMesh2D::operator= ( const CMesh2D )
delete

◆ point()

RowVectorNd polyfem::mesh::CMesh2D::point ( const int  global_index) const
overridevirtual

point coordinates

Parameters
[in]global_indexglobal vertex index
Returns
RowVectorNd

Implements polyfem::mesh::Mesh.

Definition at line 472 of file CMesh2D.cpp.

References mesh_.

Referenced by append(), edge_barycenter(), edge_length(), edge_node(), face_node(), polyfem::utils::BoundarySampler::normal_for_polygon_edge(), polyfem::utils::BoundarySampler::quadrature_for_polygon_edge(), and polyfem::utils::BoundarySampler::sample_polygon_edge().

Here is the caller graph for this function:

◆ refine()

void polyfem::mesh::CMesh2D::refine ( const int  n_refinement,
const double  t 
)
overridevirtual

refine the mesh

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

Implements polyfem::mesh::Mesh.

Definition at line 25 of file CMesh2D.cpp.

References boundary_edges_, boundary_vertices_, c2e_, polyfem::mesh::Polygons::catmul_clark_split_func(), compute_elements_tag(), polyfem::mesh::generate_edges(), polyfem::mesh::Mesh::in_ordered_edges_, polyfem::mesh::Mesh::in_ordered_faces_, polyfem::mesh::Mesh::in_ordered_vertices_, polyfem::mesh::Mesh::is_simplex(), mesh_, polyfem::mesh::Mesh::n_elements(), polyfem::mesh::Mesh::orders_, polyfem::mesh::Polygons::polar_split_func(), polyfem::mesh::Navigation::prepare_mesh(), polyfem::mesh::refine_polygonal_mesh(), and polyfem::mesh::refine_triangle_mesh().

Here is the call graph for this function:

◆ save()

bool polyfem::mesh::CMesh2D::save ( const std::string &  path) const
overridevirtual

Implements polyfem::mesh::Mesh.

Definition at line 165 of file CMesh2D.cpp.

References mesh_.

◆ set_point()

void polyfem::mesh::CMesh2D::set_point ( const int  global_index,
const RowVectorNd p 
)
overridevirtual

Set the point.

Parameters
[in]global_indexglobal vertex index
[in]pvalue

Implements polyfem::mesh::Mesh.

Definition at line 466 of file CMesh2D.cpp.

References mesh_.

Referenced by append().

Here is the caller graph for this function:

◆ switch_edge()

Navigation::Index polyfem::mesh::CMesh2D::switch_edge ( Navigation::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh2D.

Definition at line 92 of file CMesh2D.hpp.

References c2e_, mesh_, and polyfem::mesh::Navigation::switch_edge().

Referenced by face_node(), polyfem::utils::BoundarySampler::normal_for_polygon_edge(), polyfem::utils::BoundarySampler::quadrature_for_polygon_edge(), and polyfem::utils::BoundarySampler::sample_polygon_edge().

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

◆ switch_face()

Navigation::Index polyfem::mesh::CMesh2D::switch_face ( Navigation::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh2D.

Definition at line 93 of file CMesh2D.hpp.

References c2e_, mesh_, and polyfem::mesh::Navigation::switch_face().

Here is the call graph for this function:

◆ switch_vertex()

Navigation::Index polyfem::mesh::CMesh2D::switch_vertex ( Navigation::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh2D.

Definition at line 91 of file CMesh2D.hpp.

References mesh_, and polyfem::mesh::Navigation::switch_vertex().

Referenced by attach_higher_order_nodes(), edge_node(), and face_node().

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

◆ triangulate_faces()

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

generate a triangular representation of every face

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

Implements polyfem::mesh::Mesh.

Definition at line 496 of file CMesh2D.cpp.

References mesh_, and n_vertices().

Here is the call graph for this function:

◆ update_elements_tag()

void polyfem::mesh::CMesh2D::update_elements_tag ( )
overridevirtual

Update elements types.

Reimplemented from polyfem::mesh::Mesh.

Definition at line 563 of file CMesh2D.cpp.

References polyfem::mesh::compute_element_tags(), polyfem::mesh::Mesh::elements_tag_, and mesh_.

Here is the call graph for this function:

Member Data Documentation

◆ boundary_edges_

std::unique_ptr<GEO::Attribute<bool> > polyfem::mesh::CMesh2D::boundary_edges_
private

Definition at line 109 of file CMesh2D.hpp.

Referenced by append(), build_from_matrices(), is_boundary_edge(), load(), and refine().

◆ boundary_vertices_

std::unique_ptr<GEO::Attribute<bool> > polyfem::mesh::CMesh2D::boundary_vertices_
private

Definition at line 108 of file CMesh2D.hpp.

Referenced by append(), build_from_matrices(), is_boundary_vertex(), load(), and refine().

◆ c2e_

std::unique_ptr<GEO::Attribute<GEO::index_t> > polyfem::mesh::CMesh2D::c2e_
private

◆ mesh_


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