Lagrange
MeshNavigation< MeshType > Class Template Reference

This class is used to navigate elements of a mesh. More...

#include <lagrange/MeshNavigation.h>

Public Types

using Scalar = typename MeshType::Scalar
 
using Index = typename MeshType::Index
 
using FacetArray = typename MeshType::FacetArray
 
using IndexArray = Eigen::Matrix< Index, Eigen::Dynamic, 1 >
 

Public Member Functions

 MeshNavigation (const MeshType &mesh)
 
Index get_num_edges () const
 Gets the number of edges. More...
 
Index get_edge (Index f, Index lv) const
 Gets the edge index corresponding to (f, lv) – (f, lv+1). More...
 
Index get_edge_from_corner (Index c) const
 Gets the edge index corresponding to a corner index. More...
 
Index get_first_corner_around_edge (Index e) const
 Get the index of the first corner around a given edge. More...
 
Index get_next_corner_around_edge (Index c) const
 Gets the next corner around the edge associated to a corner. More...
 
Index get_first_corner_around_vertex (Index v) const
 Get the index of the first corner around a given vertex. More...
 
Index get_next_corner_around_vertex (Index c) const
 Gets the next corner around the vertex associated to a corner. More...
 
std::array< Index, 2 > get_edge_vertices (const FacetArray &facets, Index e) const
 Retrieve edge endpoints. More...
 
Index get_vertex_opposite_edge (const FacetArray &facets, Index e) const
 Returns a vertex id opposite the edge. More...
 
Index get_num_facets_around_vertex (Index v) const
 Count the number of facets incident to a given vertex. More...
 
Index get_num_facets_around_edge (Index e) const
 Count the number of facets incident to a given edge. More...
 
Index get_one_facet_around_edge (Index e) const
 Get the index of one facet around a given edge. More...
 
Index get_one_corner_around_edge (Index e) const
 Get the index of one corner around a given edge. More...
 
Index get_one_corner_around_vertex (Index v) const
 Get the index of one corner around a given vertex. More...
 
bool is_boundary_edge (Index e) const
 Determines whether the specified edge e is a boundary edge. More...
 
bool is_boundary_vertex (Index v) const
 Determines whether the specified vertex v is a boundary vertex. More...
 
template<typename Func >
void foreach_facets_around_vertex (Index v, Func func) const
 Applies a function to each facet around a prescribed vertex. More...
 
template<typename Func >
void foreach_facets_around_edge (Index e, Func func) const
 Applies a function to each facet around a prescribed edge. More...
 
template<typename Func >
void foreach_corners_around_vertex (Index v, Func func) const
 Applies a function to each corner around a prescribed vertex. More...
 
template<typename Func >
void foreach_corners_around_edge (Index e, Func func) const
 Applies a function to each corner around a prescribed edge. More...
 

Protected Member Functions

void initialize (const MeshType &mesh)
 

Protected Attributes

Index m_vertex_per_facet
 Number of vertex per facet (assumed constant).
 
IndexArray m_c2e
 Corner to edge mapping.
 
IndexArray m_e2c
 Edge to first corner in the chain.
 
IndexArray m_next_corner_around_edge
 Next corner in the chain around an edge.
 
IndexArray m_v2c
 Vertex to first corner in the chain.
 
IndexArray m_next_corner_around_vertex
 Next corner in the chain around a vertex.
 
std::vector< bool > m_is_boundary_vertex
 

Detailed Description

template<typename MeshType>
class lagrange::MeshNavigation< MeshType >

This class is used to navigate elements of a mesh.

By chaining facet corners around vertices and edges, this class is able to provide efficient iteration over incident facets of a vertex/edge, as well as detect boundary edges/vertices.

Template Parameters
MeshTypeMesh type.

Member Function Documentation

◆ get_num_edges()

Index get_num_edges ( ) const
inline

Gets the number of edges.

Returns
The number of edges.

◆ get_edge()

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

Index get_edge_from_corner ( Index  c) const
inline

Gets the edge index corresponding to a corner index.

Given a face (v0, v1, v2) with associated corners (c0, c1, c2), the edge associated to corner ci is the edge between (vi, vi+1), as determined by the corner_to_edge_mapping function.

Parameters
[in]cCorner index.
Returns
The edge.

◆ get_first_corner_around_edge()

Index get_first_corner_around_edge ( Index  e) const
inline

Get the index of the first corner around a given edge.

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

◆ get_next_corner_around_edge()

Index get_next_corner_around_edge ( Index  c) const
inline

Gets the next corner around the edge associated to a corner.

If the corner is the last one in the chain, this function returns invalid<Index>.

Parameters
[in]cCorner index.
Returns
Next corner around the edge.

◆ get_first_corner_around_vertex()

Index get_first_corner_around_vertex ( Index  v) const
inline

Get the index of the first corner around a given vertex.

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

◆ get_next_corner_around_vertex()

Index get_next_corner_around_vertex ( Index  c) const
inline

Gets the next corner around the vertex associated to a corner.

If the corner is the last one in the chain, this function returns invalid<Index>.

Parameters
[in]cCorner index.
Returns
Next corner around the vertex.

◆ get_edge_vertices()

std::array< Index, 2 > get_edge_vertices ( const FacetArray &  facets,
Index  e 
) const
inline

Retrieve edge endpoints.

Parameters
[in]facets#F x k array of facet indices.
[in]eQueried edge index.
Returns
Array of vertex ids at the edge endpoints.

◆ get_vertex_opposite_edge()

Index get_vertex_opposite_edge ( const FacetArray &  facets,
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]facets#F x k array of facet indices.
[in]eQueried edge index.
Returns
Vertex id.

◆ get_num_facets_around_vertex()

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

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

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

Index get_one_corner_around_edge ( Index  e) const
inline

Get the index of one corner around a given edge.

Note
While this is technically redundant with get_first_corner_around_edge, the latter can be used when iterating manually over a chain of corners, while this method can be used to retrieve a single 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()

Index get_one_corner_around_vertex ( Index  v) const
inline

Get the index of one corner around a given vertex.

Note
While this is technically redundant with get_first_corner_around_vertex, the latter can be used when iterating manually over a chain of corners, while this method can be used to retrieve a single corner around a given vertex.
Parameters
[in]vQueried vertex index.
Returns
Index of the first corner around the queried vertex.

◆ is_boundary_edge()

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

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

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

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

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

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 file: