DUNE-ACFEM (unstable)

examineutil.hh
1#ifndef __DUNE_ACFEM_EXPRESSIONS_EXAMINEUTIL_HH__
2#define __DUNE_ACFEM_EXPRESSIONS_EXAMINEUTIL_HH__
3
4#include "../mpl/accumulate.hh"
5#include "examine.hh"
6#include "runtimeequal.hh"
7#include "weight.hh"
8
9namespace Dune
10{
11 namespace ACFem
12 {
13 namespace Expressions
14 {
15
25 template<class E, class T>
27
39 template<class E, class T>
41
42 template<class E>
43 using NumberOfTerminals = ExamineAdd<E, IsSelfExpression>;
44
45 template<class E>
46 constexpr inline std::size_t numberOfTerminals()
47 {
48 return NumberOfTerminals<E>::value;
49 }
50
51 template<class E>
52 constexpr inline std::size_t numberOfTerminals(E&&)
53 {
54 return numberOfTerminals<E>();
55 }
56
71 template<class E, class T>
72 using SubExpressionMultiplicity = ExamineAdd<EnclosedType<E>, AreRuntimeEqual, EnclosedType<T> >;
73
75 template<class E, class T>
76 constexpr auto subExpressionMultiplicity(E&& e = E{}, T&& t = T{})
77 {
78 return SubExpressionMultiplicity<E, T>::value;
79 }
80
81 namespace ExamineImpl
82 {
84 template<class Dummy, class ArgDepths>
86 : IndexConstant<1+ArgDepths::value>
87 {};
88 }
89
91 template<class E>
92 using Depth = ExamineRecurse<E, std::size_t, Max, ExamineImpl::DepthFunctor>;
93
95 template<class E>
96 constexpr std::size_t depth()
97 {
98 return Depth<E>::value;
99 }
100
102 template<class E>
103 constexpr auto depth(E&& e)
104 {
105 return depth<E>();
106 }
107
108 template<class T, class SFINAE = void>
109 constexpr inline std::size_t ExpressionWeightV = addLoop<Arity<T>::value>([](auto i) { return ExpressionWeightV<Operand<decltype(i)::value, T> >; }, WeightV<T>);
110
111 template<class T>
112 constexpr inline std::size_t ExpressionWeightV<T, std::enable_if_t<IsSelfExpression<T>::value> > = WeightV<T>;
113
115 template<class E>
116 constexpr auto weight()
117 {
118 return ExpressionWeightV<E>;
119 }
120
122 template<class E>
123 constexpr auto weight(E&&)
124 {
125 return weight<E>();
126 }
127
131 template<std::size_t Id, class E>
132 using ExplicitlyDependsOn = ExamineOr<E, IndeterminateMatch, IndexConstant<Id> >;
133
134 } // NS Expressions
135
136 using Expressions::ExpressionWeightV;
137
138 } // NS ACFem
139} // NS Dune
140
141#endif // __DUNE_ACFEM_EXPRESSIONS_EXAMINEUTIL_HH__
decltype(operate(std::declval< OptOrF >(), std::declval< Rest >()...)) ExpressionType
Generate the type of an expression by calling operate().
Definition: optimizationbase.hh:256
Constant< std::size_t, V > IndexConstant
Short-cut for integral constant of type std::size_t.
Definition: types.hh:44
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)