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

#include <CMesh3D.hpp>

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

Public Member Functions

 CMesh3D ()=default
 
virtual ~CMesh3D ()=default
 
 CMesh3D (CMesh3D &&)=default
 
CMesh3Doperator= (CMesh3D &&)=default
 
 CMesh3D (const CMesh3D &)=default
 
CMesh3Doperator= (const CMesh3D &)=default
 
bool is_conforming () const override
 if the mesh is conforming
 
void refine (const int n_refinement, const double t) override
 refine the mesh
 
int n_cells () const override
 number of cells
 
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 n_cell_vertices (const int c_id) const override
 number of vertices of a cell
 
int n_cell_edges (const int c_id) const override
 
int n_cell_faces (const int c_id) const override
 
int cell_vertex (const int c_id, const int lv_id) const override
 id of the vertex of a cell
 
int cell_face (const int c_id, const int lf_id) const override
 
int cell_edge (const int c_id, const int le_id) const override
 
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
 
void elements_boxes (std::vector< std::array< Eigen::Vector3d, 2 > > &boxes) const override
 constructs a box around every element (3d cell, 2d face)
 
void barycentric_coords (const RowVectorNd &p, const int el_id, Eigen::MatrixXd &coord) const override
 constructs barycentric coodiantes for a point p.
 
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_face (const int face_global_id) const override
 is face 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
 
void normalize () override
 normalize the mesh
 
double quad_area (const int gid) const override
 area of a quad face of an hex mesh
 
void compute_elements_tag () override
 compute element types, see ElementType
 
RowVectorNd kernel (const int cell_id) const override
 
RowVectorNd point (const int vertex_id) const override
 point coordinates
 
void set_point (const int global_index, const RowVectorNd &p) override
 Set the point.
 
RowVectorNd edge_barycenter (const int e) const override
 edge barycenter
 
RowVectorNd face_barycenter (const int f) const override
 face barycenter
 
RowVectorNd cell_barycenter (const int c) const override
 cell barycenter
 
void bounding_box (RowVectorNd &min, RowVectorNd &max) const override
 computes the bbox of the mesh
 
Navigation3D::Index get_index_from_element (int hi, int lf, int lv) const override
 
Navigation3D::Index get_index_from_element (int hi) const override
 
Navigation3D::Index get_index_from_element_edge (int hi, int v0, int v1) const override
 
Navigation3D::Index get_index_from_element_face (int hi, int v0, int v1, int v2) const override
 
std::vector< uint32_t > vertex_neighs (const int v_gid) const override
 
std::vector< uint32_t > edge_neighs (const int e_gid) const override
 
Navigation3D::Index switch_vertex (Navigation3D::Index idx) const override
 
Navigation3D::Index switch_edge (Navigation3D::Index idx) const override
 
Navigation3D::Index switch_face (Navigation3D::Index idx) const override
 
Navigation3D::Index switch_element (Navigation3D::Index idx) const override
 
Navigation3D::Index next_around_edge (Navigation3D::Index idx) const override
 
Navigation3D::Index next_around_face (Navigation3D::Index idx) const override
 
void get_vertex_elements_neighs (const int v_id, std::vector< int > &ids) const override
 
void get_edge_elements_neighs (const int e_id, std::vector< int > &ids) const override
 
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_body_ids (const std::function< int(const size_t, const RowVectorNd &)> &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 triangulate_faces (Eigen::MatrixXi &tris, Eigen::MatrixXd &pts, std::vector< int > &ranges) const override
 generate a triangular representation of every face
 
Mesh3DStoragemesh_storge ()
 
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::Mesh3D
 Mesh3D ()=default
 
virtual ~Mesh3D ()=default
 
 Mesh3D (Mesh3D &&)=default
 
Mesh3Doperator= (Mesh3D &&)=default
 
 Mesh3D (const Mesh3D &)=default
 
Mesh3Doperator= (const Mesh3D &)=default
 
bool is_volume () const override
 checks if mesh is volume
 
void elements_boxes (std::vector< std::array< Eigen::Vector3d, 2 > > &boxes) const override
 constructs a box around every element (3d cell, 2d face)
 
void barycentric_coords (const RowVectorNd &p, const int el_id, Eigen::MatrixXd &coord) const override
 constructs barycentric coodiantes for a point p.
 
void compute_cell_jacobian (const int el_id, const Eigen::MatrixXd &reference_map, Eigen::MatrixXd &jacobian) const
 
double tri_area (const int gid) const override
 area of a tri face of a tet mesh
 
RowVectorNd edge_node (const Navigation3D::Index &index, const int n_new_nodes, const int i) const
 
RowVectorNd face_node (const Navigation3D::Index &index, const int n_new_nodes, const int i, const int j) const
 
RowVectorNd cell_node (const Navigation3D::Index &index, const int n_new_nodes, const int i, const int j, const int k) 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.
 
void to_face_functions (std::array< std::function< Navigation3D::Index(Navigation3D::Index)>, 6 > &to_face) const
 
void to_vertex_functions (std::array< std::function< Navigation3D::Index(Navigation3D::Index)>, 8 > &to_vertex) const
 
void to_edge_functions (std::array< std::function< Navigation3D::Index(Navigation3D::Index)>, 12 > &to_edge) const
 
std::array< int, 8 > get_ordered_vertices_from_hex (const int element_index) const
 
virtual std::array< int, 4 > get_ordered_vertices_from_tet (const int element_index) const
 
void compute_element_barycenters (Eigen::MatrixXd &barycenters) const override
 utility for 2d/3d.
 
- 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 void update_elements_tag ()
 Update elements types.
 
virtual double edge_length (const int gid) const
 edge length
 
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\).
 

Static Public Member Functions

static void geomesh_2_mesh_storage (const GEO::Mesh &gm, Mesh3DStorage &m)
 
- 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 Member Functions

bool load (const std::string &path) override
 loads a mesh from the path
 
bool load (const GEO::Mesh &M) 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

Mesh3DStorage mesh_
 

Additional Inherited Members

- 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 18 of file CMesh3D.hpp.

Constructor & Destructor Documentation

◆ CMesh3D() [1/3]

polyfem::mesh::CMesh3D::CMesh3D ( )
default

◆ ~CMesh3D()

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

◆ CMesh3D() [2/3]

polyfem::mesh::CMesh3D::CMesh3D ( CMesh3D &&  )
default

◆ CMesh3D() [3/3]

polyfem::mesh::CMesh3D::CMesh3D ( const CMesh3D )
default

Member Function Documentation

◆ append()

void polyfem::mesh::CMesh3D::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 1676 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::append(), polyfem::mesh::Mesh3DStorage::append(), compute_elements_tag(), mesh_, and polyfem::mesh::Navigation3D::prepare_mesh().

Here is the call graph for this function:

◆ attach_higher_order_nodes()

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

◆ barycentric_coords()

void polyfem::mesh::CMesh3D::barycentric_coords ( const RowVectorNd p,
const int  el_id,
Eigen::MatrixXd &  coord 
) const
overridevirtual

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

Implements polyfem::mesh::Mesh.

Definition at line 1662 of file CMesh3D.cpp.

References polyfem::mesh::Mesh3D::get_ordered_vertices_from_tet(), polyfem::mesh::Mesh::is_simplex(), and point().

Here is the call graph for this function:

◆ bounding_box()

void polyfem::mesh::CMesh3D::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 1004 of file CMesh3D.cpp.

References mesh_, polyfem::mesh::Mesh3DStorage::points, and V.

Referenced by compute_boundary_ids(), and normalize().

Here is the caller graph for this function:

◆ build_from_matrices()

bool polyfem::mesh::CMesh3D::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 469 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::cell_nodes_, polyfem::mesh::Mesh::edge_nodes_, polyfem::F, polyfem::mesh::Mesh::face_nodes_, load(), and V.

Here is the call graph for this function:

◆ cell_barycenter()

RowVectorNd polyfem::mesh::CMesh3D::cell_barycenter ( const int  c) const
overridevirtual

cell barycenter

Parameters
[in]cglobal cell index
Returns
cell barycenter

Implements polyfem::mesh::Mesh.

Definition at line 1585 of file CMesh3D.cpp.

References polyfem::mesh::Mesh3DStorage::elements, mesh_, n_cell_vertices(), n_vertices(), and point().

Referenced by compute_body_ids(), and load().

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

◆ cell_edge()

int polyfem::mesh::CMesh3D::cell_edge ( const int  c_id,
const int  le_id 
) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 43 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::elements, and mesh_.

◆ cell_face()

int polyfem::mesh::CMesh3D::cell_face ( const int  c_id,
const int  lf_id 
) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 42 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::elements, and mesh_.

◆ cell_vertex()

int polyfem::mesh::CMesh3D::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 CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::elements, and mesh_.

Referenced by attach_higher_order_nodes(), and elements_boxes().

Here is the caller graph for this function:

◆ compute_body_ids()

void polyfem::mesh::CMesh3D::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 1305 of file CMesh3D.cpp.

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

Here is the call graph for this function:

◆ compute_boundary_ids() [1/6]

void polyfem::mesh::CMesh3D::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 1272 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, bounding_box(), face_barycenter(), is_boundary_face(), and n_faces().

Here is the call graph for this function:

◆ compute_boundary_ids() [2/6]

void polyfem::mesh::CMesh3D::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 1199 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, face_barycenter(), is_boundary_face(), and n_faces().

Here is the call graph for this function:

◆ compute_boundary_ids() [3/6]

void polyfem::mesh::CMesh3D::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 1214 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, face_barycenter(), is_boundary_face(), and n_faces().

Here is the call graph for this function:

◆ compute_boundary_ids() [4/6]

void polyfem::mesh::CMesh3D::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 1226 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, face_barycenter(), is_boundary_face(), and n_faces().

Here is the call graph for this function:

◆ compute_boundary_ids() [5/6]

void polyfem::mesh::CMesh3D::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 1254 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, face_barycenter(), face_vertex(), is_boundary_face(), n_face_vertices(), and n_faces().

Here is the call graph for this function:

◆ compute_boundary_ids() [6/6]

void polyfem::mesh::CMesh3D::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 1238 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::boundary_ids_, face_vertex(), is_boundary_face(), n_face_vertices(), and n_faces().

Here is the call graph for this function:

◆ compute_elements_tag()

◆ copy()

std::unique_ptr< Mesh > polyfem::mesh::CMesh3D::copy ( ) const
overridevirtual

Create a copy of the mesh.

Returns
pointer to the new copy mesh

Implements polyfem::mesh::Mesh.

Definition at line 1688 of file CMesh3D.cpp.

◆ edge_barycenter()

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

edge barycenter

Parameters
[in]eglobal edge index
Returns
edge barycenter

Implements polyfem::mesh::Mesh.

Definition at line 1564 of file CMesh3D.cpp.

References polyfem::mesh::Mesh3DStorage::edges, mesh_, and point().

Here is the call graph for this function:

◆ edge_neighs()

std::vector< uint32_t > polyfem::mesh::CMesh3D::edge_neighs ( const int  e_gid) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 84 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::edges, and mesh_.

◆ edge_vertex()

int polyfem::mesh::CMesh3D::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 45 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::edges, and mesh_.

◆ elements_boxes()

void polyfem::mesh::CMesh3D::elements_boxes ( std::vector< std::array< Eigen::Vector3d, 2 > > &  boxes) const
overridevirtual

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

Parameters
[out]boxesaxis aligned bounding boxes

Implements polyfem::mesh::Mesh.

Definition at line 1640 of file CMesh3D.cpp.

References cell_vertex(), n_cell_vertices(), polyfem::mesh::Mesh::n_elements(), and point().

Here is the call graph for this function:

◆ face_barycenter()

RowVectorNd polyfem::mesh::CMesh3D::face_barycenter ( const int  f) const
overridevirtual

face barycenter

Parameters
[in]fglobal face index
Returns
face barycenter

Implements polyfem::mesh::Mesh.

Definition at line 1571 of file CMesh3D.cpp.

References polyfem::mesh::Mesh3DStorage::faces, mesh_, n_face_vertices(), n_vertices(), 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:

◆ face_vertex()

int polyfem::mesh::CMesh3D::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 44 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::faces, and mesh_.

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

Here is the caller graph for this function:

◆ geomesh_2_mesh_storage()

void polyfem::mesh::CMesh3D::geomesh_2_mesh_storage ( const GEO::Mesh &  gm,
Mesh3DStorage m 
)
static

◆ get_edge_elements_neighs()

void polyfem::mesh::CMesh3D::get_edge_elements_neighs ( const int  e_id,
std::vector< int > &  ids 
) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 101 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::edges, and mesh_.

◆ get_index_from_element() [1/2]

Navigation3D::Index polyfem::mesh::CMesh3D::get_index_from_element ( int  hi) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 78 of file CMesh3D.hpp.

References polyfem::mesh::Navigation3D::get_index_from_element_face(), and mesh_.

Here is the call graph for this function:

◆ get_index_from_element() [2/2]

Navigation3D::Index polyfem::mesh::CMesh3D::get_index_from_element ( int  hi,
int  lf,
int  lv 
) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 77 of file CMesh3D.hpp.

References polyfem::mesh::Navigation3D::get_index_from_element_face(), and mesh_.

Referenced by attach_higher_order_nodes().

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

◆ get_index_from_element_edge()

Navigation3D::Index polyfem::mesh::CMesh3D::get_index_from_element_edge ( int  hi,
int  v0,
int  v1 
) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 80 of file CMesh3D.hpp.

References polyfem::mesh::Navigation3D::get_index_from_element_edge(), and mesh_.

Here is the call graph for this function:

◆ get_index_from_element_face()

Navigation3D::Index polyfem::mesh::CMesh3D::get_index_from_element_face ( int  hi,
int  v0,
int  v1,
int  v2 
) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 81 of file CMesh3D.hpp.

References polyfem::mesh::Navigation3D::get_index_from_element_tri(), and mesh_.

Here is the call graph for this function:

◆ get_vertex_elements_neighs()

void polyfem::mesh::CMesh3D::get_vertex_elements_neighs ( const int  v_id,
std::vector< int > &  ids 
) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 96 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Mesh3DStorage::vertices.

◆ is_boundary_edge()

bool polyfem::mesh::CMesh3D::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 51 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::edges, and mesh_.

◆ is_boundary_element()

bool polyfem::mesh::CMesh3D::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 1178 of file CMesh3D.cpp.

References polyfem::mesh::Mesh3DStorage::elements, is_boundary_face(), is_boundary_vertex(), and mesh_.

Here is the call graph for this function:

◆ is_boundary_face()

bool polyfem::mesh::CMesh3D::is_boundary_face ( const int  face_global_id) const
inlineoverridevirtual

is face boundary

Parameters
[in]face_global_idglobal face id
Returns
is face boundary

Implements polyfem::mesh::Mesh.

Definition at line 52 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::faces, and mesh_.

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_vertex()

bool polyfem::mesh::CMesh3D::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 50 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Mesh3DStorage::vertices.

Referenced by is_boundary_element().

Here is the caller graph for this function:

◆ is_conforming()

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

if the mesh is conforming

Returns
if the mesh is conforming

Implements polyfem::mesh::Mesh.

Definition at line 28 of file CMesh3D.hpp.

◆ kernel()

RowVectorNd polyfem::mesh::CMesh3D::kernel ( const int  cell_id) const
overridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 1334 of file CMesh3D.cpp.

References polyfem::mesh::Mesh3DStorage::elements, and mesh_.

◆ load() [1/2]

◆ load() [2/2]

bool polyfem::mesh::CMesh3D::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 80 of file CMesh3D.cpp.

References cell_barycenter(), polyfem::mesh::Mesh::cell_nodes_, compute_elements_tag(), polyfem::mesh::Mesh::edge_nodes_, polyfem::mesh::Mesh3DStorage::elements, polyfem::utils::StringUtils::endswith(), polyfem::mesh::Mesh::face_nodes_, polyfem::mesh::Mesh3DStorage::faces, polyfem::mesh::find(), polyfem::mesh::Element::fs, polyfem::mesh::Element::fs_flag, polyfem::mesh::Vertex::id, polyfem::mesh::Face::id, polyfem::mesh::Element::id, load(), mesh_, n_cells(), polyfem::mesh::Mesh3DStorage::points, polyfem::mesh::Navigation3D::prepare_mesh(), polyfem::mesh::Mesh3DStorage::vertices, polyfem::mesh::Face::vs, polyfem::mesh::Element::vs, x, y, and z.

Referenced by build_from_matrices(), and load().

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

◆ mesh_storge()

Mesh3DStorage & polyfem::mesh::CMesh3D::mesh_storge ( )
inline

Definition at line 118 of file CMesh3D.hpp.

References mesh_.

◆ n_cell_edges()

int polyfem::mesh::CMesh3D::n_cell_edges ( const int  c_id) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 39 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::elements, and mesh_.

◆ n_cell_faces()

int polyfem::mesh::CMesh3D::n_cell_faces ( const int  c_id) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 40 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::elements, and mesh_.

◆ n_cell_vertices()

int polyfem::mesh::CMesh3D::n_cell_vertices ( const int  c_id) const
inlineoverridevirtual

number of vertices of a cell

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

Implements polyfem::mesh::Mesh.

Definition at line 38 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::elements, and mesh_.

Referenced by cell_barycenter(), and elements_boxes().

Here is the caller graph for this function:

◆ n_cells()

int polyfem::mesh::CMesh3D::n_cells ( ) const
inlineoverridevirtual

number of cells

Returns
number of cells

Implements polyfem::mesh::Mesh.

Definition at line 32 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::elements, and mesh_.

Referenced by attach_higher_order_nodes(), load(), and normalize().

Here is the caller graph for this function:

◆ n_edges()

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

number of edges

Returns
number of edges

Implements polyfem::mesh::Mesh.

Definition at line 34 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::edges, and mesh_.

Referenced by attach_higher_order_nodes().

Here is the caller graph for this function:

◆ n_face_vertices()

int polyfem::mesh::CMesh3D::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 CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::faces, and mesh_.

Referenced by compute_boundary_ids(), compute_boundary_ids(), face_barycenter(), quad_area(), and triangulate_faces().

Here is the caller graph for this function:

◆ n_faces()

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

number of faces

Returns
number of faces

Implements polyfem::mesh::Mesh.

Definition at line 33 of file CMesh3D.hpp.

References polyfem::mesh::Mesh3DStorage::faces, and mesh_.

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

Here is the caller graph for this function:

◆ n_vertices()

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

number of vertices

Returns
number of vertices

Implements polyfem::mesh::Mesh.

Definition at line 35 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Mesh3DStorage::points.

Referenced by cell_barycenter(), face_barycenter(), quad_area(), refine(), and triangulate_faces().

Here is the caller graph for this function:

◆ next_around_edge()

Navigation3D::Index polyfem::mesh::CMesh3D::next_around_edge ( Navigation3D::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 93 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Navigation3D::next_around_3Dedge().

Here is the call graph for this function:

◆ next_around_face()

Navigation3D::Index polyfem::mesh::CMesh3D::next_around_face ( Navigation3D::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 94 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Navigation3D::next_around_2Dface().

Referenced by attach_higher_order_nodes().

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

◆ normalize()

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

normalize the mesh

Implements polyfem::mesh::Mesh.

Definition at line 1011 of file CMesh3D.cpp.

References bounding_box(), polyfem::mesh::Mesh::cell_nodes_, polyfem::mesh::Mesh::edge_nodes_, polyfem::mesh::Mesh3DStorage::elements, polyfem::mesh::Mesh::face_nodes_, polyfem::mesh::Mesh3D::get_edges(), polyfem::logger(), mesh_, n_cells(), polyfem::mesh::Mesh3DStorage::points, V, and val.

Here is the call graph for this function:

◆ operator=() [1/2]

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

◆ operator=() [2/2]

CMesh3D & polyfem::mesh::CMesh3D::operator= ( const CMesh3D )
default

◆ point()

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

point coordinates

Parameters
[in]global_indexglobal vertex index
Returns
RowVectorNd

Implements polyfem::mesh::Mesh.

Definition at line 1328 of file CMesh3D.cpp.

References mesh_, and polyfem::mesh::Mesh3DStorage::points.

Referenced by barycentric_coords(), cell_barycenter(), edge_barycenter(), elements_boxes(), face_barycenter(), quad_area(), and triangulate_faces().

Here is the caller graph for this function:

◆ quad_area()

double polyfem::mesh::CMesh3D::quad_area ( const int  gid) const
overridevirtual

area of a quad face of an hex mesh

Parameters
[in]gidglobal face id
Returns
face area

Reimplemented from polyfem::mesh::Mesh.

Definition at line 1543 of file CMesh3D.cpp.

References polyfem::mesh::Mesh3DStorage::faces, mesh_, n_face_vertices(), n_vertices(), and point().

Here is the call graph for this function:

◆ refine()

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

◆ save()

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

Implements polyfem::mesh::Mesh.

Definition at line 416 of file CMesh3D.cpp.

References polyfem::mesh::Mesh3DStorage::elements, polyfem::utils::StringUtils::endswith(), polyfem::mesh::Mesh3DStorage::faces, mesh_, polyfem::mesh::Mesh3DStorage::points, and polyfem::mesh::to_geogram_mesh().

Here is the call graph for this function:

◆ set_point()

void polyfem::mesh::CMesh3D::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 1317 of file CMesh3D.cpp.

References mesh_, polyfem::mesh::Mesh3DStorage::points, and polyfem::mesh::Mesh3DStorage::vertices.

◆ switch_edge()

Navigation3D::Index polyfem::mesh::CMesh3D::switch_edge ( Navigation3D::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 88 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Navigation3D::switch_edge().

Referenced by attach_higher_order_nodes().

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

◆ switch_element()

Navigation3D::Index polyfem::mesh::CMesh3D::switch_element ( Navigation3D::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 90 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Navigation3D::switch_element().

Here is the call graph for this function:

◆ switch_face()

Navigation3D::Index polyfem::mesh::CMesh3D::switch_face ( Navigation3D::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 89 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Navigation3D::switch_face().

Referenced by attach_higher_order_nodes().

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

◆ switch_vertex()

Navigation3D::Index polyfem::mesh::CMesh3D::switch_vertex ( Navigation3D::Index  idx) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 87 of file CMesh3D.hpp.

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

Referenced by attach_higher_order_nodes().

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

◆ triangulate_faces()

void polyfem::mesh::CMesh3D::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 1071 of file CMesh3D.cpp.

References polyfem::mesh::Mesh::cell_barycenters(), polyfem::mesh::Mesh3DStorage::elements, polyfem::mesh::Mesh::face_barycenters(), polyfem::mesh::Mesh3DStorage::faces, polyfem::mesh::Element::fs, mesh_, n_face_vertices(), n_faces(), n_vertices(), point(), polyfem::mesh::Mesh3DStorage::points, and polyfem::mesh::Element::vs.

Here is the call graph for this function:

◆ vertex_neighs()

std::vector< uint32_t > polyfem::mesh::CMesh3D::vertex_neighs ( const int  v_gid) const
inlineoverridevirtual

Implements polyfem::mesh::Mesh3D.

Definition at line 83 of file CMesh3D.hpp.

References mesh_, and polyfem::mesh::Mesh3DStorage::vertices.

Member Data Documentation

◆ mesh_


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