Skip to content
Snippets Groups Projects
Commit f2d76472 authored by Oliver Sander's avatar Oliver Sander
Browse files

[!126] Make tolerances in checkGeometry depending on ctype

Merge branch 'issue/check_geometry_tolerances' into 'master'

ref:core/dune-geometry

### Summary

Replaces fixed tolerances 1.e-8 with ctype dependent tolerance

### Details

Tests with geometries using float as ctype may fail to reach the desired fixed
tolerance 1.e-8. This is corrected by using the
tolerance=sqrt(numeric_limits<ctype>::epsilon()) value. This value gives
approximately

-   `tolerance<double> = 1.5e-8` and
-   `tolerance<float> = 3.5e-4`

and thus previous test runs with ctype=double should also pass the test with
this change.

See merge request [core/dune-geometry!126]

  [core/dune-geometry!126]: gitlab.dune-project.org/core/dune-geometry/merge_requests/126
parents acb8e429 b8d9e5f5
No related branches found
No related tags found
1 merge request!126Make tolerances in checkGeometry depending on ctype
Pipeline #20889 passed
......@@ -154,7 +154,7 @@ namespace Dune
const typename TestGeometry::LocalCoordinate &x = ip.position();
// Test whether the methods 'local' and 'global' are inverse to each other
if ( (x - geometry.local( geometry.global( x ) )).two_norm() > 1e-8 ) {
if ( (x - geometry.local( geometry.global( x ) )).two_norm() > tolerance ) {
std::cerr << "Error: global and local are not inverse to each other." << std::endl;
pass = false;
}
......@@ -203,7 +203,7 @@ namespace Dune
bool isId = true;
for( int j = 0; j < mydim; ++j )
for( int k = 0; k < mydim; ++k )
isId &= (std::abs( id[ j ][ k ] - (j == k ? 1 : 0) ) < 1e-8);
isId &= (std::abs( id[ j ][ k ] - (j == k ? 1 : 0) ) < tolerance);
if( !isId)
{
std::cerr << "Error: jacobianTransposed and jacobianInverseTransposed are not inverse to each other." << std::endl;
......@@ -226,12 +226,12 @@ namespace Dune
for( int k = 0; k < coorddim; ++k )
jtj[ i ][ j ] += jtAsFieldMatrix[ i ][ k ] * jtAsFieldMatrix[ j ][ k ];
if( std::abs( std::sqrt( jtj.determinant() ) - geometry.integrationElement( x ) ) > 1e-8 ) {
if( std::abs( std::sqrt( jtj.determinant() ) - geometry.integrationElement( x ) ) > tolerance ) {
std::cerr << "Error: integrationElement is not consistent with jacobianTransposed." << std::endl;
pass = false;
}
if (geometry.affine())
if( std::abs( geometry.volume() - refElement.volume()*geometry.integrationElement( x ) ) > 1e-8 ) {
if( std::abs( geometry.volume() - refElement.volume()*geometry.integrationElement( x ) ) > tolerance ) {
std::cerr << "Error: volume is not consistent with jacobianTransposed." << std::endl;
pass = false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment