14#include <lagrange/chain_corners_around_edges.h>
15#include <lagrange/chain_corners_around_vertices.h>
16#include <lagrange/corner_to_edge_mapping.h>
29template <
typename MeshType>
33 using Scalar =
typename MeshType::Scalar;
34 using Index =
typename MeshType::Index;
35 using FacetArray =
typename MeshType::FacetArray;
36 using IndexArray = Eigen::Matrix<Index, Eigen::Dynamic, 1>;
39 MeshNavigation(
const MeshType& mesh) { initialize(mesh); }
120 logger().error(
"Invalid corner id for edge {}", e);
121 throw std::runtime_error(
"Invalid edge id");
143 logger().error(
"Invalid corner id for edge {}", e);
144 throw std::runtime_error(
"Invalid edge id");
160 Index num_incident_facets = 0;
162 return num_incident_facets;
174 Index num_incident_facets = 0;
176 return num_incident_facets;
254 template <
typename Func>
272 template <
typename Func>
290 template <
typename Func>
307 template <
typename Func>
317 void initialize(
const MeshType& mesh)
328 mesh.get_num_vertices(),
334 m_is_boundary_vertex.assign(mesh.get_num_vertices(),
false);
338 m_is_boundary_vertex[v[0]] =
true;
339 m_is_boundary_vertex[v[1]] =
true;
352 std::vector<bool> m_is_boundary_vertex;
bool is_boundary_edge(Index e) const
Determines whether the specified edge e is a boundary edge.
Definition MeshNavigation.h:229
IndexArray m_c2e
Corner to edge mapping.
Definition MeshNavigation.h:347
bool is_boundary_vertex(Index v) const
Determines whether the specified vertex v is a boundary vertex.
Definition MeshNavigation.h:243
Index get_num_facets_around_vertex(Index v) const
Count the number of facets incident to a given vertex.
Definition MeshNavigation.h:157
Index get_one_corner_around_edge(Index e) const
Get the index of one corner around a given edge.
Definition MeshNavigation.h:207
Index get_edge(Index f, Index lv) const
Gets the edge index corresponding to (f, lv) – (f, lv+1).
Definition MeshNavigation.h:57
Index m_vertex_per_facet
Number of vertex per facet (assumed constant).
Definition MeshNavigation.h:345
Index get_first_corner_around_edge(Index e) const
Get the index of the first corner around a given edge.
Definition MeshNavigation.h:77
Index get_first_corner_around_vertex(Index v) const
Get the index of the first corner around a given vertex.
Definition MeshNavigation.h:96
Index get_num_facets_around_edge(Index e) const
Count the number of facets incident to a given edge.
Definition MeshNavigation.h:171
IndexArray m_v2c
Vertex to first corner in the chain.
Definition MeshNavigation.h:350
IndexArray m_next_corner_around_vertex
Next corner in the chain around a vertex.
Definition MeshNavigation.h:351
void foreach_facets_around_edge(Index e, Func func) const
Applies a function to each facet around a prescribed edge.
Definition MeshNavigation.h:273
void foreach_corners_around_edge(Index e, Func func) const
Applies a function to each corner around a prescribed edge.
Definition MeshNavigation.h:308
Index get_next_corner_around_vertex(Index c) const
Gets the next corner around the vertex associated to a corner.
Definition MeshNavigation.h:106
Index get_one_facet_around_edge(Index e) const
Get the index of one facet around a given edge.
Definition MeshNavigation.h:186
IndexArray m_e2c
Edge to first corner in the chain.
Definition MeshNavigation.h:348
IndexArray m_next_corner_around_edge
Next corner in the chain around an edge.
Definition MeshNavigation.h:349
Index get_one_corner_around_vertex(Index v) const
Get the index of one corner around a given vertex.
Definition MeshNavigation.h:220
Index get_num_edges() const
Gets the number of edges.
Definition MeshNavigation.h:47
Index get_vertex_opposite_edge(const FacetArray &facets, Index e) const
Returns a vertex id opposite the edge.
Definition MeshNavigation.h:138
Index get_next_corner_around_edge(Index c) const
Gets the next corner around the edge associated to a corner.
Definition MeshNavigation.h:87
void foreach_facets_around_vertex(Index v, Func func) const
Applies a function to each facet around a prescribed vertex.
Definition MeshNavigation.h:255
void foreach_corners_around_vertex(Index v, Func func) const
Applies a function to each corner around a prescribed vertex.
Definition MeshNavigation.h:291
Index get_edge_from_corner(Index c) const
Gets the edge index corresponding to a corner index.
Definition MeshNavigation.h:68
std::array< Index, 2 > get_edge_vertices(const FacetArray &facets, Index e) const
Retrieve edge endpoints.
Definition MeshNavigation.h:116
LA_CORE_API spdlog::logger & logger()
Retrieves the current logger.
Definition Logger.cpp:40
#define la_runtime_assert(...)
Runtime assertion check.
Definition assert.h:174
constexpr T invalid()
You can use invalid<T>() to get a value that can represent "invalid" values, such as invalid indices ...
Definition invalid.h:40
constexpr auto safe_cast(SourceType value) -> std::enable_if_t<!std::is_same< SourceType, TargetType >::value, TargetType >
Perform safe cast from SourceType to TargetType, where "safe" means:
Definition safe_cast.h:50
Main namespace for Lagrange.
Eigen::Index corner_to_edge_mapping(const Eigen::MatrixBase< DerivedF > &F, Eigen::PlainObjectBase< DerivedC > &C2E)
Computes a mapping from mesh corners (k*f+i) to unique edge ids.
Definition corner_to_edge_mapping.impl.h:36
void chain_corners_around_edges(const Eigen::MatrixBase< DerivedF > &facets, const Eigen::MatrixBase< DerivedC > &corner_to_edge, Eigen::PlainObjectBase< DerivedE > &edge_to_corner, Eigen::PlainObjectBase< DerivedN > &next_corner_around_edge)
Chains facet corners around edges of a mesh.
Definition chain_corners_around_edges.h:39
void chain_corners_around_vertices(typename DerivedF::Scalar num_vertices, const Eigen::MatrixBase< DerivedF > &facets, Eigen::PlainObjectBase< DerivedE > &vertex_to_corner, Eigen::PlainObjectBase< DerivedN > &next_corner_around_vertex)
Chains facet corners around vertices of a mesh.
Definition chain_corners_around_vertices.h:41