1#include <gtest/gtest.h>
2#include <lf/mesh/mesh.h>
10 const auto dim_mesh = mesh.
DimMesh();
12 for (size_type co_dim = 0; co_dim <= dim_mesh; ++co_dim) {
14 const auto no_of_entities = mesh.
NumEntities(co_dim);
16 std::vector<int> idx_use(no_of_entities, 0);
22 EXPECT_LT(current_idx, no_of_entities)
23 <<
"Index " << current_idx <<
" out of range";
24 idx_use[current_idx]++;
28 EXPECT_TRUE(e_ptr) <<
"Invalid pointer to entity "
29 <<
static_cast<int>(current_idx);
30 if (e_ptr !=
nullptr) {
31 EXPECT_EQ(current_idx, mesh.
Index(*e_ptr))
32 <<
"Index mismatch for codim " << co_dim <<
", index "
39 for (size_type idx_cnt = 0; idx_cnt < no_of_entities; ++idx_cnt) {
41 EXPECT_EQ(idx_use[idx_cnt], 1)
42 <<
"Index " << idx_cnt <<
" occurs " << idx_use[idx_cnt] <<
" times!";
Interface class representing a topological entity in a cellular complex
Abstract interface for objects representing a single mesh.
virtual const mesh::Entity * EntityByIndex(dim_t codim, base::glb_idx_t index) const =0
Method for accessing an entity through its index.
virtual std::span< const Entity *const > Entities(unsigned codim) const =0
All entities of a given codimension.
virtual size_type NumEntities(unsigned codim) const =0
The number of Entities that have the given codimension.
virtual unsigned DimMesh() const =0
The dimension of the manifold described by the mesh, or equivalently the maximum dimension of the ref...
virtual size_type Index(const Entity &e) const =0
Acess to the index of a mesh entity of any co-dimension.
unsigned int size_type
general type for variables related to size of arrays
unsigned int glb_idx_t
type for global index of mesh entities (nodes, edges, cells)
Utilities for testing sanity of mesh data structures and tests involving meshes.
void checkEntityIndexing(const Mesh &mesh)
Function for testing mesh indexing (should be called from google test)