Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
GaussLegendreRules.h
Go to the documentation of this file.
1 #pragma once
2 
10 namespace UA_CoMP {
11 namespace Num {
12 
20 {
21 public:
27  static constexpr unsigned int getOrder() { return 2; }
28 
37  template <class Ftor>
38  static typename Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
39  {
42 
43  constexpr double z1{0.577350269189626};
44 
45  const Arg h{0.5 * d};
46  const Arg m{l + h};
47  return static_cast<Res>(h * (f(m - z1 * h) + f(m + z1 * h)));
48  }
49 };
50 
58 {
59 public:
65  static constexpr unsigned int getOrder() { return 4; }
66 
75  template <class Ftor>
76  static typename Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
77  {
80 
81  constexpr double z1{0.339981043584856};
82  constexpr double z2{0.861136311594053};
83  constexpr double w1{0.652145154862546};
84  constexpr double w2{0.347854845137454};
85 
86  const Arg h{0.5 * d};
87  const Arg m{l + h};
88  const Res s{w1 * (f(m - z1 * h) + f(m + z1 * h)) + w2 * (f(m - z2 * h) + f(m + z2 * h))};
89  return h * s;
90  }
91 };
92 
100 {
101 public:
107  static constexpr unsigned int getOrder() { return 8; }
108 
117  template <class Ftor>
118  static typename Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
119  {
122 
123  constexpr double z1{0.183434642495650};
124  constexpr double z2{0.525532409916329};
125  constexpr double z3{0.796666477413627};
126  constexpr double z4{0.960289856497536};
127 
128  constexpr double w1{0.362683783378362};
129  constexpr double w2{0.313706645877887};
130  constexpr double w3{0.222381034453374};
131  constexpr double w4{0.101228536290376};
132 
133  const Arg h{0.5 * d};
134  const Arg m{l + h};
135  const Res s{w1 * (f(m - z1 * h) + f(m + z1 * h)) + w2 * (f(m - z2 * h) + f(m + z2 * h)) +
136  w3 * (f(m - z3 * h) + f(m + z3 * h)) + w4 * (f(m - z4 * h) + f(m + z4 * h))};
137  return h * s;
138  }
139 };
140 
148 {
149 public:
155  static constexpr unsigned int getOrder() { return 16; }
156 
165  template <class Ftor>
166  static typename Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
167  {
170 
171  constexpr double z1{0.0950125098376374};
172  constexpr double z2{0.281603550779259};
173  constexpr double z3{0.458016777657227};
174  constexpr double z4{0.617876244402644};
175  constexpr double z5{0.755404408355003};
176  constexpr double z6{0.865631202387832};
177  constexpr double z7{0.944575023073233};
178  constexpr double z8{0.989400934991650};
179 
180  constexpr double w1{0.189450610455068};
181  constexpr double w2{0.182603415044924};
182  constexpr double w3{0.169156519395003};
183  constexpr double w4{0.149595988816577};
184  constexpr double w5{0.124628971255534};
185  constexpr double w6{0.0951585116824928};
186  constexpr double w7{0.0622535239386479};
187  constexpr double w8{0.0271524594117541};
188 
189  const Arg h{0.5 * d};
190  const Arg m{l + h};
191  const Res s{w1 * (f(m - z1 * h) + f(m + z1 * h)) + w2 * (f(m - z2 * h) + f(m + z2 * h)) +
192  w3 * (f(m - z3 * h) + f(m + z3 * h)) + w4 * (f(m - z4 * h) + f(m + z4 * h)) +
193  w5 * (f(m - z5 * h) + f(m + z5 * h)) + w6 * (f(m - z6 * h) + f(m + z6 * h)) +
194  w7 * (f(m - z7 * h) + f(m + z7 * h)) + w8 * (f(m - z8 * h) + f(m + z8 * h))};
195  return h * s;
196  }
197 };
198 
206 {
207 public:
213  static constexpr unsigned int getOrder() { return 32; }
214 
223  template <class Ftor>
224  static typename Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
225  {
228 
229  constexpr double z1{0.99726386184948};
230  constexpr double z2{0.98561151154527};
231  constexpr double z3{0.96476225558751};
232  constexpr double z4{0.93490607593774};
233  constexpr double z5{0.89632115576605};
234  constexpr double z6{0.84936761373257};
235  constexpr double z7{0.79448379596794};
236  constexpr double z8{0.73218211874029};
237  constexpr double z9{0.66304426693022};
238  constexpr double z10{0.58771575724076};
239  constexpr double z11{0.50689990893223};
240  constexpr double z12{0.42135127613064};
241  constexpr double z13{0.33186860228213};
242  constexpr double z14{0.23928736225214};
243  constexpr double z15{0.14447196158280};
244  constexpr double z16{0.048307665687738};
245 
246  constexpr double w1{0.0070186100094701};
247  constexpr double w2{0.016274394730906};
248  constexpr double w3{0.025392065309262};
249  constexpr double w4{0.034273862913021};
250  constexpr double w5{0.042835898022227};
251  constexpr double w6{0.050998059262376};
252  constexpr double w7{0.058684093478536};
253  constexpr double w8{0.065822222776362};
254  constexpr double w9{0.072345794108849};
255  constexpr double w10{0.078193895787070};
256  constexpr double w11{0.083311924226947};
257  constexpr double w12{0.087652093004404};
258  constexpr double w13{0.091173878695764};
259  constexpr double w14{0.093844399080805};
260  constexpr double w15{0.095638720079275};
261  constexpr double w16{0.096540088514728};
262 
263  const Arg h{0.5 * d};
264  const Arg m{l + h};
265  // The sum was split in two contributions because the CodeWarrior 5.0 chokes otherwise.
266  const Res s{w1 * (f(m - z1 * h) + f(m + z1 * h)) + w2 * (f(m - z2 * h) + f(m + z2 * h)) +
267  w3 * (f(m - z3 * h) + f(m + z3 * h)) + w4 * (f(m - z4 * h) + f(m + z4 * h)) +
268  w5 * (f(m - z5 * h) + f(m + z5 * h)) + w6 * (f(m - z6 * h) + f(m + z6 * h)) +
269  w7 * (f(m - z7 * h) + f(m + z7 * h)) + w8 * (f(m - z8 * h) + f(m + z8 * h)) +
270  w9 * (f(m - z9 * h) + f(m + z9 * h)) + w10 * (f(m - z10 * h) + f(m + z10 * h)) +
271  w11 * (f(m - z11 * h) + f(m + z11 * h)) + w12 * (f(m - z12 * h) + f(m + z12 * h)) +
272  w13 * (f(m - z13 * h) + f(m + z13 * h)) + w14 * (f(m - z14 * h) + f(m + z14 * h)) +
273  w15 * (f(m - z15 * h) + f(m + z15 * h)) + w16 * (f(m - z16 * h) + f(m + z16 * h))};
274  return h * s;
275  }
276 };
277 
278 } // namespace Num
279 } // namespace UA_CoMP
The Gauss-Legendre rule of order 16.
The Gauss-Legendre rule of order 4.
static constexpr unsigned int getOrder()
Return the order of the rule.
static Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
Execute the rule on the cell.
static Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
Execute the rule on the cell.
static constexpr unsigned int getOrder()
Return the order of the rule.
static Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
Execute the rule on the cell.
The Gauss-Legendre rule of order 32.
typename std::remove_cv< typename std::remove_reference< T >::type >::type type
Definition: AQ_Util.h:18
static Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
Execute the rule on the cell.
The Gauss-Legendre rule of order 2.
static constexpr unsigned int getOrder()
Return the order of the rule.
static constexpr unsigned int getOrder()
Return the order of the rule.
The Gauss-Legendre rule of order 8.
static Ftor::result_type sum(typename Ftor::argument_type l, typename Ftor::argument_type d, Ftor f)
Execute the rule on the cell.
static constexpr unsigned int getOrder()
Return the order of the rule.