Lagrange
Loading...
Searching...
No Matches
Mesh< _VertexArray, _FacetArray > Class Template Reference
Inheritance diagram for Mesh< _VertexArray, _FacetArray >:
MeshBase

Public Types

using VertexArray = _VertexArray
 
using FacetArray = _FacetArray
 
using VertexType
 
using MeshType = Mesh<VertexArray, FacetArray>
 
using Scalar = typename VertexArray::Scalar
 
using Index = typename FacetArray::Scalar
 
using AttributeArray = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
 
using IndexArray = FacetArray
 
using AttributeMesh = Mesh<AttributeArray, IndexArray>
 
using Geometry = MeshGeometry<VertexArray, FacetArray>
 
using AdjacencyList = typename Connectivity<Geometry>::AdjacencyList
 
using IndexList = typename Connectivity<Geometry>::IndexList
 
using Edge = EdgeType<Index>
 
using UVArray = AttributeArray
 
using UVIndices = IndexArray
 
using UVType = Eigen::Matrix<Scalar, 1, 2>
 

Public Member Functions

 Mesh ()
 The default constructor only build a frame of the data structure with null geometry and attributes.
 
 Mesh (std::shared_ptr< Geometry > geom)
 
 Mesh (const Mesh &other)=delete
 
void operator= (const Mesh &other)=delete
 
void initialize (const VertexArray &vertices, const FacetArray &facets)
 
bool is_initialized () const
 
Index get_dim () const
 
Index get_num_vertices () const
 
Index get_num_facets () const
 
Index get_vertex_per_facet () const
 
const VertexArray & get_vertices () const
 
const FacetArray & get_facets () const
 
VertexArray & ref_vertices ()
 
FacetArray & ref_facets ()
 
std::vector< std::string > get_vertex_attribute_names () const
 
std::vector< std::string > get_facet_attribute_names () const
 
std::vector< std::string > get_corner_attribute_names () const
 
std::vector< std::string > get_edge_attribute_names () const
 
std::vector< std::string > get_indexed_attribute_names () const
 
bool has_vertex_attribute (const std::string &name) const
 
bool has_facet_attribute (const std::string &name) const
 
bool has_corner_attribute (const std::string &name) const
 
bool has_edge_attribute (const std::string &name) const
 
bool has_indexed_attribute (const std::string &name) const
 
void add_vertex_attribute (const std::string &name) const
 
void add_facet_attribute (const std::string &name) const
 
void add_corner_attribute (const std::string &name) const
 
void add_edge_attribute (const std::string &name) const
 
void add_indexed_attribute (const std::string &name) const
 
const AttributeArray & get_vertex_attribute (const std::string &name) const
 
decltype(auto) get_vertex_attribute_array (const std::string &name) const
 
decltype(auto) get_vertex_attribute_array (const std::string &name)
 
const AttributeArray & get_facet_attribute (const std::string &name) const
 
decltype(auto) get_facet_attribute_array (const std::string &name) const
 
decltype(auto) get_facet_attribute_array (const std::string &name)
 
const AttributeArray & get_corner_attribute (const std::string &name) const
 
decltype(auto) get_corner_attribute_array (const std::string &name) const
 
decltype(auto) get_corner_attribute_array (const std::string &name)
 
const AttributeArray & get_edge_attribute (const std::string &name) const
 
decltype(auto) get_edge_attribute_array (const std::string &name) const
 
decltype(auto) get_edge_attribute_array (const std::string &name)
 
auto get_indexed_attribute (const std::string &name) const
 
auto get_indexed_attribute_array (const std::string &name) const
 
auto get_indexed_attribute_array (const std::string &name)
 
void set_vertex_attribute (const std::string &name, const AttributeArray &attr)
 
void set_facet_attribute (const std::string &name, const AttributeArray &attr)
 
void set_corner_attribute (const std::string &name, const AttributeArray &attr)
 
void set_edge_attribute (const std::string &name, const AttributeArray &attr)
 
template<typename Derived>
void set_vertex_attribute_array (const std::string &name, Derived &&attr)
 
template<typename Derived>
void set_facet_attribute_array (const std::string &name, Derived &&attr)
 
template<typename Derived>
void set_corner_attribute_array (const std::string &name, Derived &&attr)
 
template<typename Derived>
void set_edge_attribute_array (const std::string &name, Derived &&attr)
 
void set_indexed_attribute (const std::string &name, const AttributeArray &values, const IndexArray &indices)
 
void remove_vertex_attribute (const std::string &name)
 
void remove_facet_attribute (const std::string &name)
 
void remove_corner_attribute (const std::string &name)
 
void remove_edge_attribute (const std::string &name)
 
void remove_indexed_attribute (const std::string &name)
 
template<typename Derived>
void import_vertices (Eigen::PlainObjectBase< Derived > &vertices)
 
template<typename Derived>
void import_facets (Eigen::PlainObjectBase< Derived > &facets)
 
template<typename AttributeDerived>
void import_vertex_attribute (const std::string &name, AttributeDerived &&attr) const
 
template<typename AttributeDerived>
void import_facet_attribute (const std::string &name, AttributeDerived &&attr) const
 
template<typename AttributeDerived>
void import_corner_attribute (const std::string &name, AttributeDerived &&attr) const
 
template<typename AttributeDerived>
void import_edge_attribute (const std::string &name, AttributeDerived &&attr) const
 
template<typename ValueDerived, typename IndexDerived>
void import_indexed_attribute (const std::string &name, ValueDerived &&values, IndexDerived &&indices)
 
template<typename Derived>
void export_vertices (Eigen::PlainObjectBase< Derived > &vertices)
 
template<typename Derived>
void export_facets (Eigen::PlainObjectBase< Derived > &facets)
 
template<typename Derived>
void export_vertex_attribute (const std::string &name, Eigen::PlainObjectBase< Derived > &attr)
 
template<typename Derived>
void export_facet_attribute (const std::string &name, Eigen::PlainObjectBase< Derived > &attr)
 
template<typename Derived>
void export_corner_attribute (const std::string &name, Eigen::PlainObjectBase< Derived > &attr)
 
template<typename Derived>
void export_edge_attribute (const std::string &name, Eigen::PlainObjectBase< Derived > &attr)
 
template<typename ValueDerived, typename IndexDerived>
void export_indexed_attribute (const std::string &name, Eigen::PlainObjectBase< ValueDerived > &values, Eigen::PlainObjectBase< IndexDerived > &indices)
 
void initialize_connectivity ()
 
bool is_connectivity_initialized () const
 
const AdjacencyList & get_vertex_vertex_adjacency () const
 
const AdjacencyList & get_vertex_facet_adjacency () const
 
const AdjacencyList & get_facet_facet_adjacency () const
 
const IndexList & get_vertices_adjacent_to_vertex (Index vi) const
 
const IndexList & get_facets_adjacent_to_vertex (Index vi) const
 
const IndexList & get_facets_adjacent_to_facet (Index fi) const
 
void initialize_edge_data ()
 Edge data initialization.
 
void clear_edge_data ()
 Clear edge data.
 
bool is_edge_data_initialized () const
 Edge data accessors (const)
 
Index get_num_edges () const
 Gets the number of edges.
 
Index get_edge (Index f, Index lv) const
 Gets the edge index corresponding to (f, lv) – (f, lv+1).
 
Index get_edge_from_corner (Index c) const
 Gets the edge index corresponding to a corner index.
 
Index find_edge_from_vertices (Index v0, Index v1) const
 Retrieve the edge id from end vertices (v0, v1).
 
std::array< Index, 2 > get_edge_vertices (Index e) const
 Retrieve edge endpoints.
 
Index get_vertex_opposite_edge (Index e) const
 Returns a vertex id opposite the edge.
 
Index get_num_facets_around_vertex (Index v) const
 Count the number of facets incident to a given vertex.
 
Index get_num_facets_around_edge (Index e) const
 Count the number of facets incident to a given edge.
 
Index get_one_facet_around_edge (Index e) const
 Get the index of one facet around a given edge.
 
Index get_one_corner_around_edge (Index e) const
 Get the index of one corner around a given edge.
 
Index get_one_corner_around_vertex (Index v) const
 Get the index of one corner around a given vertex.
 
bool is_boundary_edge (Index e) const
 Determines whether the specified edge e is a boundary edge.
 
bool is_boundary_vertex (Index v) const
 Determines whether the specified vertex v is a boundary vertex.
 
template<typename Func>
void foreach_facets_around_vertex (Index v, Func func) const
 Applies a function to each facet around a prescribed vertex.
 
template<typename Func>
void foreach_facets_around_edge (Index e, Func func) const
 Applies a function to each facet around a prescribed edge.
 
template<typename Func>
void foreach_corners_around_vertex (Index v, Func func) const
 Applies a function to each corner around a prescribed vertex.
 
template<typename Func>
void foreach_corners_around_edge (Index e, Func func) const
 Applies a function to each corner around a prescribed edge.
 
void initialize_topology ()
 
bool is_topology_initialized () const
 
bool is_edge_manifold () const
 
bool is_vertex_manifold () const
 
const MeshTopology< MeshType > & get_topology () const
 
void initialize_components ()
 
bool is_components_initialized () const
 
Index get_num_components () const
 
const std::vector< IndexList > & get_components () const
 
const IndexList & get_per_facet_component_ids () const
 
bool is_uv_initialized () const
 
void initialize_uv (const UVArray &uv, const UVIndices &uv_indices)
 
void import_uv (UVArray &&uv, UVIndices &&uv_indices)
 
decltype(auto) get_uv () const
 
decltype(auto) get_uv_indices () const
 
decltype(auto) get_uv_mesh () const
 
void clear_uv () const
 
template<typename Archive>
void serialize_impl (Archive &ar)
 

Protected Member Functions

void init_attributes ()
 

Protected Attributes

std::shared_ptr< Geometrym_geometry
 
std::unique_ptr< MeshTopology< MeshType > > m_topology
 
std::unique_ptr< MeshNavigation< MeshType > > m_navigation
 
std::unique_ptr< Connectivity< Geometry > > m_connectivity
 
std::unique_ptr< Components< Geometry > > m_components
 
std::unique_ptr< experimental::AttributeManagerm_vertex_attributes
 
std::unique_ptr< experimental::AttributeManagerm_facet_attributes
 
std::unique_ptr< experimental::AttributeManagerm_corner_attributes
 
std::unique_ptr< experimental::AttributeManagerm_edge_attributes
 
std::unique_ptr< experimental::IndexedAttributeManagerm_indexed_attributes
 

Member Typedef Documentation

◆ VertexType

template<typename _VertexArray, typename _FacetArray>
using VertexType
Initial value:
Eigen::Matrix<typename VertexArray::Scalar, 1, VertexArray::ColsAtCompileTime>

Constructor & Destructor Documentation

◆ Mesh()

template<typename _VertexArray, typename _FacetArray>
Mesh ( )
inline

The default constructor only build a frame of the data structure with null geometry and attributes.

One could initialize everything using initialize() method.

Member Function Documentation

◆ get_num_edges()

template<typename _VertexArray, typename _FacetArray>
Index get_num_edges ( ) const
inline

Gets the number of edges.

Returns
The number of edges.

◆ get_edge()

template<typename _VertexArray, typename _FacetArray>
Index get_edge ( Index f,
Index lv ) const
inline

Gets the edge index corresponding to (f, lv) – (f, lv+1).

Parameters
[in]fFacet index.
[in]lvLocal vertex index [0, get_vertex_per_facet()[.
Returns
The edge.

◆ get_edge_from_corner()

template<typename _VertexArray, typename _FacetArray>
Index get_edge_from_corner ( Index c) const
inline

Gets the edge index corresponding to a corner index.

Parameters
[in]cCorner index.
Returns
The edge.

◆ find_edge_from_vertices()

template<typename _VertexArray, typename _FacetArray>
Index find_edge_from_vertices ( Index v0,
Index v1 ) const
inline

Retrieve the edge id from end vertices (v0, v1).

Todo
Move this to MeshNavigation?
Parameters
[in]v0Edge edge point 0.
[in]v1Edge edge point 1.
Returns
The edge index if (v0, v1) is a valid edge; invalid<Index>() otherwise.

◆ get_edge_vertices()

template<typename _VertexArray, typename _FacetArray>
std::array< Index, 2 > get_edge_vertices ( Index e) const
inline

Retrieve edge endpoints.

Parameters
[in]eQueried edge index.
Returns
Array of vertex ids at the edge endpoints.

◆ get_vertex_opposite_edge()

template<typename _VertexArray, typename _FacetArray>
Index get_vertex_opposite_edge ( Index e) const
inline

Returns a vertex id opposite the edge.

If the edge is a boundary edge, there is only one incident facet f, and the returned vertex will the vertex id opposite e on facet f. Otherwise, the returned vertex will be a vertex opposite e on a arbitrary incident facet f.

Parameters
[in]eQueried edge index.
Returns
Vertex id.

◆ get_num_facets_around_vertex()

template<typename _VertexArray, typename _FacetArray>
Index get_num_facets_around_vertex ( Index v) const
inline

Count the number of facets incident to a given vertex.

Parameters
[in]vQueried vertex index.
Returns
Number of facets incident to the queried vertex.

◆ get_num_facets_around_edge()

template<typename _VertexArray, typename _FacetArray>
Index get_num_facets_around_edge ( Index e) const
inline

Count the number of facets incident to a given edge.

Parameters
[in]eQueried edge index.
Returns
Number of facets incident to the queried edge.

◆ get_one_facet_around_edge()

template<typename _VertexArray, typename _FacetArray>
Index get_one_facet_around_edge ( Index e) const
inline

Get the index of one facet around a given edge.

Parameters
[in]eQueried edge index.
Returns
Face index of one facet incident to the queried edge.

◆ get_one_corner_around_edge()

template<typename _VertexArray, typename _FacetArray>
Index get_one_corner_around_edge ( Index e) const
inline

Get the index of one corner around a given edge.

Parameters
[in]eQueried edge index.
Returns
Index of the first corner around the queried edge.

◆ get_one_corner_around_vertex()

template<typename _VertexArray, typename _FacetArray>
Index get_one_corner_around_vertex ( Index v) const
inline

Get the index of one corner around a given vertex.

Parameters
[in]vQueried vertex index.
Returns
Index of the first corner around the queried vertex.

◆ is_boundary_edge()

template<typename _VertexArray, typename _FacetArray>
bool is_boundary_edge ( Index e) const
inline

Determines whether the specified edge e is a boundary edge.

Parameters
[in]eQueried edge index.
Returns
True if the specified edge e is a boundary edge, False otherwise.

◆ is_boundary_vertex()

template<typename _VertexArray, typename _FacetArray>
bool is_boundary_vertex ( Index v) const
inline

Determines whether the specified vertex v is a boundary vertex.

Parameters
[in]vQueried vertex index.
Returns
True if the specified vertex v is a boundary vertex, False otherwise.

◆ foreach_facets_around_vertex()

template<typename _VertexArray, typename _FacetArray>
template<typename Func>
void foreach_facets_around_vertex ( Index v,
Func func ) const
inline

Applies a function to each facet around a prescribed vertex.

Parameters
[in]vQueried vertex index.
[in]funcCallback to apply to each incident facet.
Template Parameters
FuncA callable function of type Index -> void.

◆ foreach_facets_around_edge()

template<typename _VertexArray, typename _FacetArray>
template<typename Func>
void foreach_facets_around_edge ( Index e,
Func func ) const
inline

Applies a function to each facet around a prescribed edge.

Parameters
[in]eQueried edge index.
[in]funcCallback to apply to each incident facet.
Template Parameters
FuncA callable function of type Index -> void.

◆ foreach_corners_around_vertex()

template<typename _VertexArray, typename _FacetArray>
template<typename Func>
void foreach_corners_around_vertex ( Index v,
Func func ) const
inline

Applies a function to each corner around a prescribed vertex.

Parameters
[in]vQueried vertex index.
[in]funcCallback to apply to each incident facet.
Template Parameters
FuncA callable function of type Index -> void.

◆ foreach_corners_around_edge()

template<typename _VertexArray, typename _FacetArray>
template<typename Func>
void foreach_corners_around_edge ( Index e,
Func func ) const
inline

Applies a function to each corner around a prescribed edge.

Parameters
[in]eQueried edge index.
[in]funcCallback to apply to each incident facet.
Template Parameters
FuncA callable function of type Index -> void.

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