Skip to content
Snippets Groups Projects
Commit 5f9f4be6 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

allow order() as memberfunction of gridfunctions and redirect free function to...

allow order() as memberfunction of gridfunctions and redirect free function to this memberfunction if available
parent 73513f33
Branches
Tags
1 merge request!34allow order() as memberfunction of gridfunctions
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment