Commit 39d3bd9d authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Replace IfGeometry by toGeometryTypeIdConstant

The latter is lambda-friendly and allows to avoid explicit
maker/factory structs and thus some indirection.
parent 9b7cf76c
Pipeline #36531 passed with stage
in 11 minutes and 24 seconds
......@@ -11,6 +11,7 @@
#include <dune/geometry/quadraturerules.hh>
#include <dune/geometry/referenceelements.hh>
#include <dune/geometry/type.hh>
#include <dune/geometry/typeindex.hh>
#include <dune/localfunctions/common/localkey.hh>
#include <dune/localfunctions/utility/interpolationhelper.hh>
......@@ -171,7 +172,9 @@ namespace Dune
* And depending on the dynamic face index a different face geometry is needed.
*
*/
TestFaceBasis *faceBasis = Impl::IfGeometryType< CreateFaceBasis, dimension-1 >::apply( refElement.type( face, 1 ), order );
TestFaceBasis *faceBasis = Impl::toGeometryTypeIdConstant<dimension-1>(refElement.type( face, 1 ), [&](auto faceGeometryTypeId) {
return TestFaceBasisFactory::template create< decltype(faceGeometryTypeId)::value >( order );
});
faceStructure_.emplace_back( faceBasis, refElement.integrationOuterNormal( face ) );
}
assert( faceStructure_.size() == faceSize_ );
......@@ -188,12 +191,6 @@ namespace Dune
const Dune::FieldVector< Field, dimension > *normal_;
};
template< GeometryType::Id faceGeometryId >
struct CreateFaceBasis
{
static TestFaceBasis *apply ( std::size_t order ) { return TestFaceBasisFactory::template create< faceGeometryId >( order ); }
};
std::vector< FaceStructure > faceStructure_;
TestBasis *testBasis_ = nullptr;
GeometryType geometry_;
......
......@@ -4,6 +4,7 @@
#define DUNE_GENERIC_LOCALFINITEELEMENT_HH
#include <dune/geometry/type.hh>
#include <dune/geometry/typeindex.hh>
#include <dune/localfunctions/common/localfiniteelementtraits.hh>
#include <dune/localfunctions/utility/l2interpolation.hh>
......@@ -43,7 +44,9 @@ namespace Dune
key_( key ),
finiteElement_()
{
Impl::IfGeometryType< FiniteElement::template Maker, dimDomain >::apply( type(), key_, finiteElement_ );
Impl::toGeometryTypeIdConstant<dimDomain>(type(), [&](auto geometryTypeId) {
finiteElement_.template create<decltype(geometryTypeId)::value>(key_);
});
}
/** \todo Please doc me */
......@@ -52,7 +55,9 @@ namespace Dune
key_( other.key_ ),
finiteElement_()
{
Impl::IfGeometryType< FiniteElement::template Maker, dimDomain >::apply( type(), key_, finiteElement_ );
Impl::toGeometryTypeIdConstant<dimDomain>(type(), [&](auto geometryTypeId) {
finiteElement_.template create<decltype(geometryTypeId)::value>(key_);
});
}
~GenericLocalFiniteElement()
......@@ -118,14 +123,6 @@ namespace Dune
coeff_=0;
interpol_=0;
}
template< GeometryType::Id geometryId >
struct Maker
{
static void apply ( const Key &key, FiniteElement &finiteElement )
{
finiteElement.template create<geometryId>(key);
};
};
typename Traits::LocalBasisType *basis_;
typename Traits::LocalCoefficientsType *coeff_;
typename Traits::LocalInterpolationType *interpol_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment