LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
Functions | Variables
lf::mesh::test_utils Namespace Reference

Utilities for testing sanity of mesh data structures and tests involving meshes. More...

Functions

void checkEntityIndexing (const Mesh &mesh)
 Function for testing mesh indexing (should be called from google test)
 
void checkGeometryOrientation (const Entity &e)
 Makes sure that the coordinates of the nodes obtained through e.SubEntities()[i].Geometry() match the ones obtained through e.Geometry()
 
void checkLocalTopology (const Entity &e)
 Function for testing consistency of subentities.
 
void checkRelCodim (const Entity &e)
 consistence check for local (relative) co-dimensions
 
bool checkMeshCompleteness (const Mesh &mesh)
 Function testing topological completeness of a mesh.
 
std::shared_ptr< spdlog::logger > & WatertightLogger ()
 Logger that is used by isWatertightMesh() to output additional information.
 
std::vector< std::pair< lf::base::RefEl, base::glb_idx_t > > isWatertightMesh (const Mesh &mesh, bool vertices_only=true)
 check for match of entity geometries
 
std::shared_ptr< lf::mesh::MeshGenerateHybrid2DTestMesh (int selector=0, double scale=1.0)
 Generates a simple 2D hybrid test mesh.
 

Variables

static const lf::base::size_type GenerateHybrid2DTestMesh_maxsel = 8
 

Detailed Description

Utilities for testing sanity of mesh data structures and tests involving meshes.

Function Documentation

◆ checkEntityIndexing()

void lf::mesh::test_utils::checkEntityIndexing ( const Mesh & mesh)

Function for testing mesh indexing (should be called from google test)

Parameters
meshA reference to the mesh to be checked

This function tests whether all entities of a mesh are indexed consecutively

Definition at line 8 of file check_entity_indexing.cc.

References lf::mesh::Mesh::DimMesh(), lf::mesh::Mesh::Entities(), lf::mesh::Mesh::EntityByIndex(), lf::mesh::Mesh::Index(), and lf::mesh::Mesh::NumEntities().

◆ checkGeometryOrientation()

void lf::mesh::test_utils::checkGeometryOrientation ( const Entity & e)

Makes sure that the coordinates of the nodes obtained through e.SubEntities()[i].Geometry() match the ones obtained through e.Geometry()

Parameters
eThe entity to check.

Definition at line 6 of file check_geometry_orientation.cc.

References lf::base::RefEl::Dimension(), lf::mesh::Entity::Geometry(), lf::geometry::Geometry::Global(), lf::base::RefEl::NodeCoords(), lf::mesh::Entity::RefEl(), and lf::mesh::Entity::SubEntities().

◆ checkLocalTopology()

void lf::mesh::test_utils::checkLocalTopology ( const Entity & e)

Function for testing consistency of subentities.

Parameters
ea (reference) to a mesh entity

This function verifies the consistency of the local topology, that is whether subentities of sub-entities are also subentities of the entity.

Definition at line 6 of file check_local_topology.cc.

References lf::base::RefEl::Dimension(), lf::mesh::Entity::RefEl(), and lf::mesh::Entity::SubEntities().

◆ checkMeshCompleteness()

bool lf::mesh::test_utils::checkMeshCompleteness ( const Mesh & mesh)

Function testing topological completeness of a mesh.

Parameters
meshA reference to the mesh to be checked

All entities of dimension dim of a mesh must be subentities of at least one entity of dimension dim+1, if dim is smaller than the topological dimension of the mesh

Definition at line 13 of file check_mesh_completeness.cc.

References lf::mesh::Mesh::DimMesh(), lf::mesh::Mesh::Entities(), lf::mesh::Mesh::Index(), and lf::mesh::Mesh::NumEntities().

◆ checkRelCodim()

void lf::mesh::test_utils::checkRelCodim ( const Entity & e)

consistence check for local (relative) co-dimensions

Parameters
ea (reference) to a mesh entity of any type

Implements a test whether dimensions of sub-entities match the relative dimension with which they are accessed through the Entity::SubEntities() method of lf::mesh::Entity.

Definition at line 58 of file check_local_topology.cc.

References lf::base::RefEl::Dimension(), lf::mesh::Entity::RefEl(), and lf::mesh::Entity::SubEntities().

◆ GenerateHybrid2DTestMesh()

std::shared_ptr< lf::mesh::Mesh > lf::mesh::test_utils::GenerateHybrid2DTestMesh ( int selector = 0,
double scale = 1.0 )

Generates a simple 2D hybrid test mesh.

Parameters
selectorinteger parameter for the selection of test meshes
scalefactor for scaling all the coordinates in the meshes

The following line of code provides a pointer to the default test mesh:

#include "lf/mesh/test_utils/test_meshes.h"
...
auto mesh_p =
std::shared_ptr< lf::mesh::Mesh > GenerateHybrid2DTestMesh(int selector, double scale)
Generates a simple 2D hybrid test mesh.
  • Test mesh selected with selector = 0: domain \([0.3]^2\)*scale
  • Test mesh generated when selector = 1;
    This mesh contains parallelograms, that is, affine quadrilaterals.
  • Test mesh generated when selector = 3;
    This is a purely triangular mesh
  • selector = 4: test mesh of [0,3]^2 with triangles and quads
  • selector = 5: test mesh of [0,3]^2 with triangles and parallelograms, all affine
  • selector = 6: hybrid mesh of a triangular domain
  • selector = 7: hybrid mesh comprising one quadrilateral and one triangle
  • selector = 8: hybrid mesh containing triangles and rectangles only.

Definition at line 14 of file test_meshes.cc.

References lf::mesh::utils::TPTriagMeshBuilder::Build(), lf::base::RefEl::kQuad(), lf::base::RefEl::kTria(), lf::mesh::utils::StructuredMeshBuilder::setBottomLeftCorner(), and lf::mesh::utils::StructuredMeshBuilder::setNumYCells().

◆ isWatertightMesh()

std::vector< std::pair< lf::base::RefEl, base::glb_idx_t > > lf::mesh::test_utils::isWatertightMesh ( const Mesh & mesh,
bool vertices_only = true )

check for match of entity geometries

Parameters
meshA reference to the mesh to be checked
vertices_onlyif true, then only the correct vertex positions are checked, otherwise edges are included
Returns
a vector of types and indices of those entities for which the test has failed
Note
For special geometries the exact matching of cell and edge shapes may not be intended

Logger

This function logs additional information to WatertightLogger(). See Loggers and Debug output for more information.

Definition at line 86 of file check_mesh_completeness.cc.

References lf::mesh::Mesh::DimMesh(), lf::mesh::Mesh::Entities(), lf::mesh::Mesh::Index(), lf::base::RefEl::NodeCoords(), lf::base::RefEl::NumNodes(), lf::base::RefEl::RefEl(), and WatertightLogger().

◆ WatertightLogger()

std::shared_ptr< spdlog::logger > & lf::mesh::test_utils::WatertightLogger ( )

Logger that is used by isWatertightMesh() to output additional information.

Definition at line 80 of file check_mesh_completeness.cc.

References lf::base::InitLogger().

Referenced by isWatertightMesh().

Variable Documentation

◆ GenerateHybrid2DTestMesh_maxsel

const lf::base::size_type lf::mesh::test_utils::GenerateHybrid2DTestMesh_maxsel = 8
static

Definition at line 57 of file test_meshes.h.