5#ifndef DUNE_GEOMETRY_TEST_COMPAREGEOMETRIES_HH
6#define DUNE_GEOMETRY_TEST_COMPAREGEOMETRIES_HH
19 return sqrt(std::numeric_limits<R>::epsilon());
22template <
class Geometry1,
class Geometry2,
23 class R = std::common_type_t<typename Geometry1::ctype, typename Geometry2::ctype>>
24bool compareGeometries (
const Geometry1& geo1,
const Geometry2& geo2,
25 R tolerance = defaultTolerance<R>())
27 if constexpr(Geometry1::mydimension != Geometry2::mydimension) {
28 std::cerr <<
"Error: Dimensions do not match." << std::endl;
31 else if constexpr(Geometry1::coorddimension != Geometry2::coorddimension) {
32 std::cerr <<
"Error: Coord-dimensions do not match." << std::endl;
38 if (geo1.affine() != geo2.affine()) {
39 std::cerr <<
"Error: Affine-property does not match." << std::endl;
43 if (geo1.type() != geo2.type()) {
44 std::cerr <<
"Error: GeometryType does not match." << std::endl;
48 if (geo1.corners() != geo2.corners()) {
49 std::cerr <<
"Error: Number of corners does not match." << std::endl;
53 for (
int i = 0; i < geo1.corners(); ++i) {
54 if ((geo1.corner(i) - geo2.corner(i)).two_norm() > tolerance) {
55 std::cerr <<
"Error: Corner " << i <<
" does not match." << std::endl;
60 if ((geo1.center() - geo2.center()).two_norm() > tolerance) {
61 std::cerr <<
"Error: Center does not match." << std::endl;
65 if (abs(geo1.volume() - geo2.volume()) > tolerance) {
66 std::cerr <<
"Error: Volume does not match." << std::endl;
71 for (
auto&& [pos,weight] : quadrature)
73 if ((geo1.global(pos) - geo2.global(pos)).two_norm() > tolerance) {
74 std::cerr <<
"Error: global(" << pos <<
") does not match." << std::endl;
78 if ((geo1.jacobian(pos) - geo2.jacobian(pos)).frobenius_norm() > tolerance) {
79 std::cerr <<
"Error: jacobian(" << pos <<
") does not match." << std::endl;
83 if ((geo1.jacobianTransposed(pos) - geo2.jacobianTransposed(pos)).frobenius_norm() > tolerance) {
84 std::cerr <<
"Error: jacobianTransposed(" << pos <<
") does not match." << std::endl;
88 if ((geo1.jacobianInverse(pos) - geo2.jacobianInverse(pos)).frobenius_norm() > tolerance) {
89 std::cerr <<
"Error: jacobianInverse(" << pos <<
") does not match." << std::endl;
93 if ((geo1.jacobianInverseTransposed(pos) - geo2.jacobianInverseTransposed(pos)).frobenius_norm() > tolerance) {
94 std::cerr <<
"Error: jacobianInverse(" << pos <<
") does not match." << std::endl;
98 if (abs(geo1.integrationElement(pos) - geo2.integrationElement(pos)) > tolerance) {
99 std::cerr <<
"Error: integrationElement(" << pos <<
") does not match." << std::endl;
static const QuadratureRule & rule(const GeometryType &t, int p, QuadratureType::Enum qt=QuadratureType::GaussLegendre)
select the appropriate QuadratureRule for GeometryType t and order p
Definition: quadraturerules.hh:326
Dune namespace.
Definition: alignedallocator.hh:13