DUNE-ACFEM (2.5.1)

parameteroperations.hh
1#ifndef __DUNE_ACFEM_PARAMETER_OPERATIONS__
2#define __DUNE_ACFEM_PARAMETER_OPERATIONS__
3
4#include "../expressions/expressionoperations.hh"
5#include "../expressions/parameterinterface.hh"
6
7namespace Dune {
8
9 namespace ACFem {
10
19 template<class UnOp>
20 struct UnaryParameterOperation;
21
22 template<class BinOp>
23 struct BinaryParameterOperation;
24
25 template<>
26 struct UnaryParameterOperation<MinusOperation>
27 {
28 template<class Value>
29 static void evaluate(const Value& value, Value& result)
30 {
31 result = -value;
32 }
33 };
34
36 template<>
37 struct UnaryParameterOperation<SinOperation>
38 {
39 template<class Value>
40 static void evaluate(const Value& value, Value& result)
41 {
42 for (int k = 0; k < Value::dimension; ++k) {
43 result[k] = std::sin(value[k]);
44 }
45 }
46 };
47
49 template<>
50 struct UnaryParameterOperation<CosOperation>
51 {
52 template<class Value>
53 static void evaluate(const Value& value, Value& result)
54 {
55 for (int k = 0; k < Value::dimension; ++k) {
56 result[k] = std::cos(value[k]);
57 }
58 }
59 };
60
62 template<>
63 struct UnaryParameterOperation<TanOperation>
64 {
65 template<class Value>
66 static void evaluate(const Value& value, Value& result)
67 {
68 for (int k = 0; k < Value::dimension; ++k) {
69 result[k] = std::tan(value[k]);
70 }
71 }
72 };
73
75 template<>
76 struct UnaryParameterOperation<AtanOperation>
77 {
78 template<class Value>
79 static void evaluate(const Value& value, Value& result)
80 {
81 for (int k = 0; k < Value::dimension; ++k) {
82 result[k] = std::atan(value[k]);
83 }
84 }
85 };
86
88 template<>
89 struct UnaryParameterOperation<AsinOperation>
90 {
91 template<class Value>
92 static void evaluate(const Value& value, Value& result)
93 {
94 for (int k = 0; k < Value::dimension; ++k) {
95 result[k] = std::asin(value[k]);
96 }
97 }
98 };
99
101 template<>
102 struct UnaryParameterOperation<AcosOperation>
103 {
104 template<class Value>
105 static void evaluate(const Value& value, Value& result)
106 {
107 for (int k = 0; k < Value::dimension; ++k) {
108 result[k] = std::acos(value[k]);
109 }
110 }
111 };
112
114 template<>
115 struct UnaryParameterOperation<SqrtOperation>
116 {
117 template<class Value>
118 static void evaluate(const Value& value, Value& result)
119 {
120 for (int k = 0; k < Value::dimension; ++k) {
121 result[k] = std::sqrt(value[k]);
122 }
123 }
124 };
125
127 template<>
128 struct UnaryParameterOperation<ExpOperation>
129 {
130 template<class Value>
131 static void evaluate(const Value& value, Value& result)
132 {
133 for (int k = 0; k < Value::dimension; ++k) {
134 result[k] = std::exp(value[k]);
135 }
136 }
137 };
138
140 template<>
141 struct UnaryParameterOperation<SquareOperation>
142 {
143 template<class Value>
144 static void evaluate(const Value& value, Value& result)
145 {
146 for (int k = 0; k < Value::dimension; ++k) {
147 result[k] = value[k] * value[k];
148 }
149 }
150 };
151
152 template<>
153 struct BinaryParameterOperation<PlusOperation>
154 {
155 template<class LeftValue, class RightValue, class Value>
156 static void evaluate(const LeftValue& left, const RightValue& right, Value& result)
157 {
158 result = left + right;
159 }
160 };
161
162 template<>
163 struct BinaryParameterOperation<MinusOperation>
164 {
165 template<class LeftValue, class RightValue, class Value>
166 static void evaluate(const LeftValue& left, const RightValue& right, Value& result)
167 {
168 result = left - right;
169 }
170 };
171
172 template<>
173 struct BinaryParameterOperation<MultiplyOperation>
174 {
175 template<class LeftValue, class RightValue, class Value>
176 static void evaluate(const LeftValue& left, const RightValue& right, Value& result)
177 {
178 result = left * right;
179 }
180 };
181
182 template<>
183 struct BinaryParameterOperation<SMultiplyOperation>
184 {
185 template<class LeftValue, class RightValue, class Value>
186 static void evaluate(const LeftValue& left, const RightValue& right, Value& result)
187 {
188 result = left * right;
189 }
190 };
191
193
195
196 } // ACFem::
197
198} // Dune::
199
200#endif
201
Taking the cosine of an object.
Definition: expressionoperations.hh:374
Taking the cosine of an object.
Definition: expressionoperations.hh:365
Taking the cosine of an object.
Definition: expressionoperations.hh:356
Taking the cosine of an object.
Definition: expressionoperations.hh:338
Exponentiation of an object.
Definition: expressionoperations.hh:293
Addition of two objects.
Definition: expressionoperations.hh:230
Taking the sine of an object.
Definition: expressionoperations.hh:329
Taking the square root of an object.
Definition: expressionoperations.hh:311
Taking the square of an object.
Definition: expressionoperations.hh:320
Taking the cosine of an object.
Definition: expressionoperations.hh:347
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Aug 13, 22:30, 2024)