1#ifndef __DUNE_ACFEM_FUNCTIONS_LOCALFUNCTIONTRAITS_HH__
2#define __DUNE_ACFEM_FUNCTIONS_LOCALFUNCTIONTRAITS_HH__
4#include <dune/fem/function/localfunction/temporary.hh>
5#include <dune/fem/function/localfunction/const.hh>
7#include "../common/types.hh"
8#include "../common/quadraturepoint.hh"
14 namespace GridFunction {
17 template<
class T,
class SFINAE =
void>
32 std::enable_if_t<(IsDecay<T>{}
33 && std::is_same<void, decltype(std::declval<T>().bind(std::declval<typename T::EntityType>()))>{}
34 && std::is_same<void, decltype(std::declval<T>().evaluate(
35 std::declval<PlaceholderQuadraturePoint<typename T::DomainType> >(),
36 std::declval<typename T::RangeType&>()))>{}
44 template<
class T,
class SFINAE =
void>
59 std::enable_if_t<(IsDecay<T>{}
60 && std::is_same<T, Fem::ConstLocalFunction<typename T::GridFunctionType> >{}
67 template<
class T,
class SFINAE =
void>
68 struct IsDiscreteFunctionSpace
73 struct IsDiscreteFunctionSpace<T,
std::enable_if_t<!IsDecay<T>{}> >
74 : IsDiscreteFunctionSpace<T, std::decay_t<T> >
78 struct IsDiscreteFunctionSpace<T,
std::enable_if_t<(IsDecay<T>{} && std::is_same<T, typename T::DiscreteFunctionSpaceType>{})> >
85 template<
class T,
class SFINAE =
void>
100 std::enable_if_t<(IsDecay<T>{}
101 && std::is_base_of<Fem::HasLocalFunction, T>{}
111 :
BoolConstant<IsConstLocalFunction<T>::value || IsWrappableByConstLocalFunction<T>::value>
122 constexpr auto ensureConstLocalFunction(F&& f)
124 return Fem::ConstLocalFunction<std::decay_t<F> >(std::forward<F>(f));
128 template<class F, std::enable_if_t<IsConstLocalFunction<F>::value,
int> = 0>
129 constexpr decltype(
auto) ensureConstLocalFunction(F&& f)
131 return std::forward<F>(f);
135 template<
class DiscreteSpace,
class Dof =
typename DiscreteSpace::RangeFieldType>
136 Fem::TemporaryLocalFunction<DiscreteSpace, Dof>
137 temporaryLocalFunction(
const DiscreteSpace& space,
const Dof& dummy = Dof())
139 return Fem::TemporaryLocalFunction<DiscreteSpace, Dof>(space);
144 using GridFunction::IsConstLocalFunction;
145 using GridFunction::IsDiscreteFunctionSpace;
146 using GridFunction::IsWrappableByConstLocalFunction;
147 using GridFunction::ensureConstLocalFunction;
148 using GridFunction::temporaryLocalFunction;
Constant< bool, V > BoolConstant
Short-cut for integral constant of type bool.
Definition: types.hh:48
BoolConstant< false > FalseType
Alias for std::false_type.
Definition: types.hh:110
BoolConstant< true > TrueType
Alias for std::true_type.
Definition: types.hh:107
TrueType if T can be passed through constLocalFunction().
Definition: localfunctiontraits.hh:112
Definition: localfunctiontraits.hh:47
Definition: localfunctiontraits.hh:20
Definition: localfunctiontraits.hh:88