1#ifndef __DUNE_ACFEM_FUNCTIONS_FUNCTIONTRAITS_HH__
2#define __DUNE_ACFEM_FUNCTIONS_FUNCTIONTRAITS_HH__
4#include "../common/types.hh"
5#include "../expressions/find.hh"
6#include "../expressions/treeoperand.hh"
7#include "../expressions/extract.hh"
8#include "../tensors/expressions.hh"
10#include "localfunctiontraits.hh"
16 namespace GridFunction {
18 using Expressions::TreeFind;
21 template<
class Expr,
class Gr
idPart, std::
size_t AutoDiffOrder, std::
size_t IndeterminateId>
22 class BindableTensorFunction;
25 constexpr std::size_t autoDiffOrder()
27 return decltype(std::decay_t<T>::autoDiffOrder())::value;
49 template<
class Expr,
class Gr
idPart, std::
size_t AutoDiffOrder, std::
size_t IndeterminateId>
54 template<
class T,
class SFINAE =
void>
55 struct RangeTensorTraits
60 struct RangeTensorTraits<T,
std::enable_if_t<!IsDecay<T>::value> >
61 : RangeTensorTraits<std::decay_t<T> >
64 template<
class Expr,
class Gr
idPart, std::
size_t AutoDiffOrder, std::
size_t IndeterminateId>
65 struct RangeTensorTraits<BindableTensorFunction<Expr, GridPart, AutoDiffOrder, IndeterminateId> >
70 struct RangeTensorTraits<
72 std::enable_if_t<(IsDecay<T>::value
73 && IsWrappableByConstLocalFunction<T>::value
74 && !IsTensorFunction<T>::value
75 && T::FunctionSpaceType::dimRange == 1
77 : TensorTraits<typename T::FunctionSpaceType::RangeFieldType>
81 struct RangeTensorTraits<
83 std::enable_if_t<(IsDecay<T>::value
84 && IsWrappableByConstLocalFunction<T>::value
85 && !IsTensorFunction<T>::value
86 && T::FunctionSpaceType::dimRange > 1
88 : TensorTraits<typename T::RangeType>
92 using RangeTensorType =
typename RangeTensorTraits<T>::TensorType;
95 template<
class T, std::
size_t AtLeastRequestedOrder = 0UL, std::
size_t AtMostRequestedOrder = ~0UL>
100 template<
class T, std::
size_t AtLeastRequestedOrder, std::
size_t AtMostRequestedOrder>
101 struct HasRegularity<T&, AtLeastRequestedOrder, AtMostRequestedOrder>
105 template<
class T, std::
size_t AtLeastRequestedOrder, std::
size_t AtMostRequestedOrder>
106 struct HasRegularity<T&&, AtLeastRequestedOrder, AtMostRequestedOrder>
107 : HasRegularity<std::decay_t<T>, AtLeastRequestedOrder, AtMostRequestedOrder>
115 template<
class Expr,
class GridPart, std::size_t AutoDiffOrder, std::size_t IndeterminateId,
116 std::size_t AtLeastRequestedOrder, std::size_t AtMostRequestedOrder>
118 AtLeastRequestedOrder, AtMostRequestedOrder>
119 :
BoolConstant<(AutoDiffOrder >= AtLeastRequestedOrder && AutoDiffOrder <= AtMostRequestedOrder)>
123 template<
class T,
class SFINAE =
void>
135 template<
class T,
class SFINAE =
void>
146 template<
class T,
class SFINAE =
void>
147 struct IsGridPartProvider
152 struct IsGridPartProvider<T,
std::enable_if_t<HasGridPartMethod<T>::value> >
157 struct IsGridPartProvider<
159 std::enable_if_t<(!HasGridPartMethod<T>::value
160 && !std::is_same<FalseType, TreeFind<HasGridPartMethod, T> >::value
165 template<class T, std::enable_if_t<HasGridPartMethod<T>::value,
int> = 0>
166 const auto& gridPart(T&& t)
171 template<class T, std::enable_if_t<!HasGridPartMethod<T>::value && IsGridPartProvider<T>::value,
int> = 0>
172 const auto& gridPart(T&& t)
174 using TreePos =
typename TreeFind<HasGridPartMethod, T>::Second;
175 return treeOperand(std::forward<T>(t), TreePos{}).gridPart();
178 template<
class T,
class SFINAE =
void>
179 struct HasSkeletonSupport
184 struct HasSkeletonSupport<
185 T,
VoidType<decltype(
std::declval<T>().classifyIntersection(FalseType{}))> >
190 constexpr bool hasSkeletonSupport()
192 return HasSkeletonSupport<T>::value;
196 constexpr bool hasSkeletonSupport(T&&)
198 return HasSkeletonSupport<T>::value;
202 template<
class T, std::enable_if_t<(IsTensorFunction<T>::value && !Expressions::IsClosure<T>::value),
int> = 0>
205 return std::forward<T>(t);
210 using GridFunction::IsTensorFunction;
Wrap a tensor into a Fem::BindableGridFunction.
Definition: bindabletensorfunction.hh:55
constexpr decltype(auto) expressionClosure(T &&t)
Do-nothing default implementation for pathologic cases.
Definition: interface.hh:93
Constant< bool, V > BoolConstant
Short-cut for integral constant of type bool.
Definition: types.hh:48
typename MakeType< void, Other... >::Type VoidType
Generate void regardless of the template argument list.
Definition: types.hh:151
BoolConstant< false > FalseType
Alias for std::false_type.
Definition: types.hh:110
BoolConstant< true > TrueType
Alias for std::true_type.
Definition: types.hh:107
Definition: functiontraits.hh:126
Definition: functiontraits.hh:138
Definition: functiontraits.hh:98
Definition: functiontraits.hh:34