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

Defines the Geometry::test_utils module and provides a number of test functions to check geometry objects. More...

Functions

void checkChildGeometry (const lf::geometry::Geometry &geom, const lf::geometry::RefinementPattern &ref_pat, const std::function< lf::quad::QuadRule(lf::base::RefEl)> &qr_provider)
 Checks that the mapping geom.ChildGeometry() is the same as geom composed with the mapping imposed by ref_pat.
 
void checkChildGeometryVolume (const lf::geometry::Geometry &geom, const lf::refinement::RefPat &refPat, const lf::base::sub_idx_t &anchor=lf::refinement::idx_nil)
 Checks if the total volume is conserved after call to ChildGeometry()
 
void checkIntegrationElement (const lf::geometry::Geometry &geom, const Eigen::MatrixXd &eval_points)
 Checks if IntegrationElement() is implemented correctly under the assumption that Jacobian() is correct.
 
void checkJacobian (const lf::geometry::Geometry &geom, const Eigen::MatrixXd &eval_points, const double &tolerance)
 Checks if Jacobian() is implemented correctly by comparing it to the symmetric difference quotient approximation.
 
void checkJacobianInverseGramian (const lf::geometry::Geometry &geom, const Eigen::MatrixXd &eval_points)
 Checks if JacobianInverseGramian() is implemented correctly assuming that Jacobian() is correct.
 
void checkSubGeometry (const lf::geometry::Geometry &geom, const std::function< lf::quad::QuadRule(lf::base::RefEl)> &qrProvider)
 Checks that geometry objects obtained through SubGeometry() map the same points on the reference elements to the same global points.
 

Detailed Description

Defines the Geometry::test_utils module and provides a number of test functions to check geometry objects.

Function Documentation

◆ checkChildGeometry()

void lf::geometry::test_utils::checkChildGeometry ( const lf::geometry::Geometry & geom,
const lf::geometry::RefinementPattern & ref_pat,
const std::function< lf::quad::QuadRule(lf::base::RefEl)> & qr_provider )

Checks that the mapping geom.ChildGeometry() is the same as geom composed with the mapping imposed by ref_pat.

Parameters
geomThe geometry object whose ChildGeometry() method should be checked
ref_patThe refinement pattern that is used for the test
qr_providerProvides the quadrature rules whose points are used to check whether the two mappings agree
Warning
For non-linear mappings, this test can fail, especially for quadrilaterals which are split into triangles! In this case it makes sense to use a nodal quadrature rule for the test (see quad::make_QuadRuleNodal())

Definition at line 15 of file check_child_geometry.cc.

References lf::geometry::Geometry::ChildGeometry(), lf::geometry::RefinementPattern::ChildPolygons(), lf::geometry::Geometry::DimGlobal(), lf::geometry::Geometry::DimLocal(), lf::geometry::Geometry::Global(), lf::base::RefEl::kPoint(), lf::base::RefEl::kQuad(), lf::base::RefEl::kSegment(), lf::base::RefEl::kTria(), lf::geometry::RefinementPattern::LatticeConst(), lf::geometry::RefinementPattern::NumChildren(), lf::geometry::RefinementPattern::RefEl(), and lf::geometry::Geometry::RefEl().

◆ checkChildGeometryVolume()

void lf::geometry::test_utils::checkChildGeometryVolume ( const lf::geometry::Geometry & geom,
const lf::refinement::RefPat & refPat,
const lf::base::sub_idx_t & anchor = lf::refinement::idx_nil )

Checks if the total volume is conserved after call to ChildGeometry()

Parameters
geomgeometry object to be evaluated
refPatrefinement pattern for child generation
anchorlocal number of anchor element for refinement pattern

Definition at line 80 of file check_child_geometry.cc.

References lf::geometry::Geometry::ChildGeometry(), lf::geometry::Geometry::IntegrationElement(), lf::quad::make_QuadRule(), lf::geometry::Geometry::RefEl(), and lf::refinement::rp_nil.

◆ checkIntegrationElement()

void lf::geometry::test_utils::checkIntegrationElement ( const lf::geometry::Geometry & geom,
const Eigen::MatrixXd & eval_points )

Checks if IntegrationElement() is implemented correctly under the assumption that Jacobian() is correct.

Parameters
geomgeometry object to be evaluated
eval_pointspoints at which Jacobian should be checked

Definition at line 17 of file check_integration_element.cc.

References lf::geometry::Geometry::DimGlobal(), lf::geometry::Geometry::DimLocal(), lf::geometry::Geometry::IntegrationElement(), and lf::geometry::Geometry::Jacobian().

◆ checkJacobian()

void lf::geometry::test_utils::checkJacobian ( const lf::geometry::Geometry & geom,
const Eigen::MatrixXd & eval_points,
const double & tolerance )

Checks if Jacobian() is implemented correctly by comparing it to the symmetric difference quotient approximation.

Parameters
geomgeometry object to be evaluated
eval_pointspoints at which Jacobian should be checked
tolerancetolerance for floating point equality check

Definition at line 15 of file check_jacobian.cc.

References lf::geometry::Geometry::DimGlobal(), lf::geometry::Geometry::DimLocal(), lf::geometry::Geometry::Global(), and lf::geometry::Geometry::Jacobian().

◆ checkJacobianInverseGramian()

void lf::geometry::test_utils::checkJacobianInverseGramian ( const lf::geometry::Geometry & geom,
const Eigen::MatrixXd & eval_points )

Checks if JacobianInverseGramian() is implemented correctly assuming that Jacobian() is correct.

Parameters
geomgeometry object to be evaluated
eval_pointspoints ar which JacobianInverseGramian should be checked

Definition at line 17 of file check_jacobian_inverse_gramian.cc.

References lf::geometry::Geometry::DimGlobal(), lf::geometry::Geometry::DimLocal(), lf::geometry::Geometry::Jacobian(), and lf::geometry::Geometry::JacobianInverseGramian().

◆ checkSubGeometry()

void lf::geometry::test_utils::checkSubGeometry ( const lf::geometry::Geometry & geom,
const std::function< lf::quad::QuadRule(lf::base::RefEl)> & qrProvider )

Checks that geometry objects obtained through SubGeometry() map the same points on the reference elements to the same global points.

Parameters
geomgeometry object to be evaluated
qrProviderfunction returning a QuadRule object associated with the given RefEl

Definition at line 17 of file check_sub_geometry.cc.

References lf::geometry::Geometry::DimLocal(), lf::geometry::Geometry::Global(), lf::base::RefEl::kPoint(), lf::base::RefEl::NodeCoords(), lf::geometry::Geometry::RefEl(), and lf::geometry::Geometry::SubGeometry().