Commit f5779842 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'issue/order_member_function' into 'master'

allow order() as memberfunction of gridfunctions

See merge request amdis/amdis-core!34
parents 73513f33 5f9f4be6
......@@ -78,13 +78,6 @@ namespace AMDiS
return lf.derivative();
}
/// \relates ConstantLocalFunction
template <class R, class D, class LC, class T>
int order(ConstantLocalFunction<R(D), LC, T> const& lf)
{
return 0;
}
/// \brief Gridfunction returning a constant value.
/**
......
......@@ -59,10 +59,10 @@ public:
}
/// \brief The \ref polynomialDegree() of the LocalFunctions
friend int order(LocalFunction const& self)
int order() const
{
assert( self.bound_ );
return polynomialDegree(*self.subTree_);
assert( bound_ );
return polynomialDegree(*subTree_);
}
/// \brief Return the bound element
......@@ -129,10 +129,10 @@ public:
/// Evaluate Gradient at bound element in local coordinates
Range operator()(Domain const& x) const;
friend int order(GradientLocalFunction const& self)
int order() const
{
assert( self.bound_ );
return std::max(0, polynomialDegree(*self.subTree_)-1);
assert( bound_ );
return std::max(0, polynomialDegree(*subTree_)-1);
}
/// Return the bound element
......
......@@ -136,6 +136,15 @@ namespace AMDiS
}
// polynomial order of local functions
template <class LocalFunction,
class = void_t<decltype(std::declval<LocalFunction>().order())> >
int order(LocalFunction const& lf)
{
return lf.order();
}
#ifndef DOXYGEN
template <class PreGridFct, class = void>
struct GridFunctionCreator
......
......@@ -40,7 +40,7 @@ namespace AMDiS
template <class LF>
using HasLocalFunctionOrder = decltype( order(std::declval<LF>()) );
using HasLocalFunctionOrder = decltype( AMDiS::order(std::declval<LF>()) );
/// \brief Factory for quadrature rule, that calculates the coefficient order from
......
Supports Markdown
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