Skip to content
Snippets Groups Projects
Commit 2f57a309 authored by Christian Engwer's avatar Christian Engwer
Browse files

Merge branch 'do-not-check-non-existent-geometries' into 'master'

Do not check non existent geometries

This MR introduces hasGeometry<Grid,codim> and makes sure that the grid check does not test these geometries for subentities.

It turns out that all the grids I use do implement all geometries (my previous claim was an oversight).

Unfortunately I had to base this on !114 which needs to get merged before. I will mark this as WIP until that time.
Closes #14 
Closes #40

See merge request !117
parents dce08c0d 38f7ec98
No related branches found
No related tags found
1 merge request!117Do not check non existent geometries
Pipeline #
......@@ -57,6 +57,16 @@ namespace Dune
static const bool v = false;
};
/** \brief Specialize with 'false' for all codims that a grid does not
implement geometries for. (default=true)
\ingroup GICapabilities
*/
template<class Grid, int codim>
struct hasGeometry
{
static const bool v = true;
};
/** \brief specialize with 'true' for all codims that a grid can communicate data on (default=false)
*
* \note Being able to communicate data on a codimension implies that the
......
......@@ -63,6 +63,22 @@ namespace Dune
> capVar;
check(capVar,entity);
}
template<class Geometry>
static void checkGeometryStatic(const Geometry& geometry)
{
std::integral_constant<
bool, Dune::Capabilities::hasGeometry<GI,codim>::v
> capVar;
checkGeometry(capVar, geometry);
}
template<class Geometry>
static void checkGeometry(const std::true_type&,const Geometry& geometry)
{
Dune::checkGeometry(geometry);
}
template<class Geometry>
static void checkGeometry(const std::false_type&,const Geometry& geometry)
{}
template <class Entity>
static void check(const std::true_type&, const Entity &entity)
{
......@@ -73,7 +89,36 @@ namespace Dune
if( subEn.type() != subGeo.type() )
std::cerr << "Error: Entity and geometry report different geometry types on codimension " << codim << "." << std::endl;
checkGeometry(subGeo);
// Move from dynamic codim to static codim to
// prevent checking non-existing geometries
switch(codim+1)
{
case 0:
{
Operation<0> geometryChecker;
geometryChecker.checkGeometryStatic(subGeo);
break;
}
case 1:
{
Operation<1> geometryChecker;
geometryChecker.checkGeometryStatic(subGeo);
break;
}
case 2:
{
Operation<2> geometryChecker;
geometryChecker.checkGeometryStatic(subGeo);
break;
}
case 3:
{
Operation<3> geometryChecker;
geometryChecker.checkGeometryStatic(subGeo);
break;
}
}
}
}
template <class Entity>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment