3#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS3_CUBE2D_LOCALBASIS_HH
4#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS3_CUBE2D_LOCALBASIS_HH
12#include "../../common/localbasis.hh"
25 template<
class D,
class R>
40 sign0 = (s[0]) ? -1.0 : 1.0;
41 sign1 = (s[1]) ? -1.0 : 1.0;
42 sign2 = (s[2]) ? -1.0 : 1.0;
43 sign3 = (s[3]) ? -1.0 : 1.0;
59 std::vector<typename Traits::RangeType>& out)
const
62 auto const& x = in[0], y = in[1];
64 const auto tmp1 = - x*(x*(x*(35*x - 80) + 60) - 16) - 1;
65 const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1;
66 const auto tmp3 = 2*y - 1;
67 const auto tmp4 = y*(6*y - 6) + 1;
68 const auto tmp5 = y*(y*(20*y - 30) + 12) - 1;
69 const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4);
70 const auto tmp7 = - y*(y*(y*(35*y - 80) + 60) - 16) - 1;
71 const auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1;
72 const auto tmp9 = 2*x - 1;
73 const auto tmp10 = x*(6*x - 6) + 1;
74 const auto tmp11 = x*(x*(20*x - 30) + 12) - 1;
75 const auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4);
76 const auto tmp13 = -x*(x*(x*(7*x - 14) + 9) - 2);
77 const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2);
78 const auto tmp15 = x*(x*(2*x - 3) + 1);
79 const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1);
80 const auto tmp17 = -y*(y*(y*(7*y - 14) + 9) - 2);
81 const auto tmp18 = y*(y*(2*y - 3) + 1);
82 const auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1);
83 const auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2);
87 out[1][0]=(-3.0*tmp2*tmp3);
89 out[2][0]=sign0*(-5.0*tmp2*tmp4);
91 out[3][0]=(-7.0*tmp2*tmp5);
96 out[5][0]=(-3.0*tmp6*tmp3);
98 out[6][0]=sign1*(5.0*tmp6*tmp4);
100 out[7][0]=(-7.0*tmp6*tmp5);
104 out[8][1]=sign2*tmp7;
106 out[9][1]=3.0*tmp9*tmp8;
108 out[10][1]=sign2*(-5.0*tmp10*tmp8);
110 out[11][1]=7.0*tmp11*tmp8;
113 out[12][1]=sign3*tmp12;
115 out[13][1]=3.0*tmp9*tmp12;
117 out[14][1]=sign3*5.0*tmp10*tmp12;
119 out[15][1]=7.0*tmp11*tmp12;
121 out[16][0]=10.0*tmp13;
123 out[17][0]=-30.0*tmp14*tmp3;
125 out[18][0]=-50.0*tmp14*tmp4;
127 out[19][0]=-70.0*tmp14*tmp5;
129 out[20][0]=-30.0*tmp15;
131 out[21][0]=-90.0*tmp15*tmp3;
133 out[22][0]=-150.0*tmp15*tmp4;
135 out[23][0]=-210.0*tmp15*tmp5;
137 out[24][0]=-70.0*tmp16;
139 out[25][0]=-210.0*tmp16*tmp3;
141 out[26][0]=-350.0*tmp16*tmp4;
143 out[27][0]=-490.0*tmp16*tmp5;
146 out[28][1]=10.0*tmp17;
148 out[29][1]=-30.0*tmp18;
150 out[30][1]=-70.0*tmp19;
152 out[31][1]=-30.0*tmp9*tmp20;
154 out[32][1]=-90.0*tmp9*tmp18;
156 out[33][1]=-210.0*tmp9*tmp19;
158 out[34][1]=-50.0*tmp10*tmp20;
160 out[35][1]=-150.0*tmp10*tmp18;
162 out[36][1]=-350.0*tmp10*tmp19;
164 out[37][1]=-70.0*tmp11*tmp20;
166 out[38][1]=-210.0*tmp11*tmp18;
168 out[39][1]=-490.0*tmp11*tmp19;
178 std::vector<typename Traits::JacobianType>& out)
const
181 auto const& x = in[0], y = in[1];
183 const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1;
184 const auto tmp3 = 2*y - 1;
185 const auto tmp4 = y*(6*y - 6) + 1;
186 const auto tmp5 = y*(y*(20*y - 30) + 12) - 1;
187 const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4);
188 const auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1;
189 const auto tmp9 = 2*x - 1;
190 const auto tmp10 = x*(6*x - 6) + 1;
191 const auto tmp11 = x*(x*(20*x - 30) + 12) - 1;
192 const auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4);
193 const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2);
194 const auto tmp15 = x*(x*(2*x - 3) + 1);
195 const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1);
196 const auto tmp18 = y*(y*(2*y - 3) + 1);
197 const auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1);
198 const auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2);
201 const auto dxtmp1 = 16 - x*(x*(140*x - 240) + 120);
202 const auto dxtmp2 = x*(x*(140*x - 240) + 120) - 16;
203 const auto dytmp3 = 2;
204 const auto dytmp4 = 12*y - 6;
205 const auto dytmp5 = y*(60*y - 60) + 12;
206 const auto dxtmp6 = x*(x*(140*x - 180) + 60) - 4;
207 const auto dytmp7 = 16 - y*(y*(140*y - 240) + 120);
208 const auto dytmp8 = y*(y*(140*y - 240) + 120) - 16;
209 const auto dxtmp9 = 2;
210 const auto dxtmp10 = 12*x - 6;
211 const auto dxtmp11 = x*(60*x - 60) + 12;
212 const auto dytmp12 = y*(y*(140*y - 180) + 60) - 4;
213 const auto dxtmp13 = 2 - x*(x*(28*x - 42) + 18);
214 const auto dxtmp14 = x*(x*(28*x - 42) + 18) - 2;
215 const auto dxtmp15 = x*(6*x - 6) + 1;
216 const auto dxtmp16 = x*(x*(20*x - 30) + 12) - 1;
217 const auto dytmp17 = 2 - y*(y*(28*y - 42) + 18);
218 const auto dytmp18 = y*(6*y - 6) + 1;
219 const auto dytmp19 = y*(y*(20*y - 30) + 12) - 1;
220 const auto dytmp20 = y*(y*(28*y - 42) + 18) - 2;
224 out[0][0][0]=sign0*dxtmp1;
226 out[1][0][0]=(-3.0*dxtmp2*tmp3);
228 out[2][0][0]=sign0*(-5.0*dxtmp2*tmp4);
230 out[3][0][0]=(-7.0*dxtmp2*tmp5);
233 out[4][0][0]=sign1*dxtmp6;
235 out[5][0][0]=(-3.0*dxtmp6*tmp3);
237 out[6][0][0]=sign1*(5.0*dxtmp6*tmp4);
239 out[7][0][0]=(-7.0*dxtmp6*tmp5);
245 out[9][1][0]=3.0*dxtmp9*tmp8;
247 out[10][1][0]=sign2*(-5.0*dxtmp10*tmp8);
249 out[11][1][0]=7.0*dxtmp11*tmp8;
254 out[13][1][0]=3.0*dxtmp9*tmp12;
256 out[14][1][0]=sign3*5.0*dxtmp10*tmp12;
258 out[15][1][0]=7.0*dxtmp11*tmp12;
260 out[16][0][0]=10.0*dxtmp13;
262 out[17][0][0]=-30.0*dxtmp14*tmp3;
264 out[18][0][0]=-50.0*dxtmp14*tmp4;
266 out[19][0][0]=-70.0*dxtmp14*tmp5;
268 out[20][0][0]=-30.0*dxtmp15;
270 out[21][0][0]=-90.0*dxtmp15*tmp3;
272 out[22][0][0]=-150.0*dxtmp15*tmp4;
274 out[23][0][0]=-210.0*dxtmp15*tmp5;
276 out[24][0][0]=-70.0*dxtmp16;
278 out[25][0][0]=-210.0*dxtmp16*tmp3;
280 out[26][0][0]=-350.0*dxtmp16*tmp4;
282 out[27][0][0]=-490.0*dxtmp16*tmp5;
291 out[31][1][0]=-30.0*dxtmp9*tmp20;
293 out[32][1][0]=-90.0*dxtmp9*tmp18;
295 out[33][1][0]=-210.0*dxtmp9*tmp19;
297 out[34][1][0]=-50.0*dxtmp10*tmp20;
299 out[35][1][0]=-150.0*dxtmp10*tmp18;
301 out[36][1][0]=-350.0*dxtmp10*tmp19;
303 out[37][1][0]=-70.0*dxtmp11*tmp20;
305 out[38][1][0]=-210.0*dxtmp11*tmp18;
307 out[39][1][0]=-490.0*dxtmp11*tmp19;
313 out[1][0][1]=(-3.0*tmp2*dytmp3);
315 out[2][0][1]=sign0*(-5.0*tmp2*dytmp4);
317 out[3][0][1]=(-7.0*tmp2*dytmp5);
322 out[5][0][1]=(-3.0*tmp6*dytmp3);
324 out[6][0][1]=sign1*(5.0*tmp6*dytmp4);
326 out[7][0][1]=(-7.0*tmp6*dytmp5);
330 out[8][1][1]=sign2*dytmp7;
332 out[9][1][1]=3.0*tmp9*dytmp8;
334 out[10][1][1]=sign2*(-5.0*tmp10*dytmp8);
336 out[11][1][1]=7.0*tmp11*dytmp8;
339 out[12][1][1]=sign3*dytmp12;
341 out[13][1][1]=3.0*tmp9*dytmp12;
343 out[14][1][1]=sign3*5.0*tmp10*dytmp12;
345 out[15][1][1]=7.0*tmp11*dytmp12;
349 out[17][0][1]=-30.0*tmp14*dytmp3;
351 out[18][0][1]=-50.0*tmp14*dytmp4;
353 out[19][0][1]=-70.0*tmp14*dytmp5;
357 out[21][0][1]=-90.0*tmp15*dytmp3;
359 out[22][0][1]=-150.0*tmp15*dytmp4;
361 out[23][0][1]=-210.0*tmp15*dytmp5;
365 out[25][0][1]=-210.0*tmp16*dytmp3;
367 out[26][0][1]=-350.0*tmp16*dytmp4;
369 out[27][0][1]=-490.0*tmp16*dytmp5;
372 out[28][1][1]=10.0*dytmp17;
374 out[29][1][1]=-30.0*dytmp18;
376 out[30][1][1]=-70.0*dytmp19;
378 out[31][1][1]=-30.0*tmp9*dytmp20;
380 out[32][1][1]=-90.0*tmp9*dytmp18;
382 out[33][1][1]=-210.0*tmp9*dytmp19;
384 out[34][1][1]=-50.0*tmp10*dytmp20;
386 out[35][1][1]=-150.0*tmp10*dytmp18;
388 out[36][1][1]=-350.0*tmp10*dytmp19;
390 out[37][1][1]=-70.0*tmp11*dytmp20;
392 out[38][1][1]=-210.0*tmp11*dytmp18;
394 out[39][1][1]=-490.0*tmp11*dytmp19;
401 std::vector<typename Traits::RangeType>& out)
const
404 if (totalOrder == 0) {
406 }
else if (totalOrder == 1) {
408 auto const direction = std::distance(
order.begin(), std::find(
order.begin(),
order.end(), 1));
409 auto const& x = in[0], y = in[1];
411 if (direction == 0) {
413 auto tmp4 = y*(6*y - 6) + 1;
414 auto tmp5 = y*(y*(20*y - 30) + 12) - 1;
415 auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1;
416 auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4);
417 auto tmp18 = y*(y*(2*y - 3) + 1);
418 auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1);
419 auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2);
421 auto dxtmp1 = 16 - x*(x*(140*x - 240) + 120);
422 auto dxtmp2 = x*(x*(140*x - 240) + 120) - 16;
423 auto dxtmp6 = x*(x*(140*x - 180) + 60) - 4;
425 auto dxtmp10 = 12*x - 6;
426 auto dxtmp11 = x*(60*x - 60) + 12;
427 auto dxtmp13 = 2 - x*(x*(28*x - 42) + 18);
428 auto dxtmp14 = x*(x*(28*x - 42) + 18) - 2;
429 auto dxtmp15 = x*(6*x - 6) + 1;
430 auto dxtmp16 = x*(x*(20*x - 30) + 12) - 1;
432 out[0][0]=sign0*dxtmp1;
434 out[1][0]=(-3.0*dxtmp2*tmp3);
436 out[2][0]=sign0*(-5.0*dxtmp2*tmp4);
438 out[3][0]=(-7.0*dxtmp2*tmp5);
441 out[4][0]=sign1*dxtmp6;
443 out[5][0]=(-3.0*dxtmp6*tmp3);
445 out[6][0]=sign1*(5.0*dxtmp6*tmp4);
447 out[7][0]=(-7.0*dxtmp6*tmp5);
453 out[9][1]=3.0*dxtmp9*tmp8;
455 out[10][1]=sign2*(-5.0*dxtmp10*tmp8);
457 out[11][1]=7.0*dxtmp11*tmp8;
462 out[13][1]=3.0*dxtmp9*tmp12;
464 out[14][1]=sign3*5.0*dxtmp10*tmp12;
466 out[15][1]=7.0*dxtmp11*tmp12;
468 out[16][0]=10.0*dxtmp13;
470 out[17][0]=-30.0*dxtmp14*tmp3;
472 out[18][0]=-50.0*dxtmp14*tmp4;
474 out[19][0]=-70.0*dxtmp14*tmp5;
476 out[20][0]=-30.0*dxtmp15;
478 out[21][0]=-90.0*dxtmp15*tmp3;
480 out[22][0]=-150.0*dxtmp15*tmp4;
482 out[23][0]=-210.0*dxtmp15*tmp5;
484 out[24][0]=-70.0*dxtmp16;
486 out[25][0]=-210.0*dxtmp16*tmp3;
488 out[26][0]=-350.0*dxtmp16*tmp4;
490 out[27][0]=-490.0*dxtmp16*tmp5;
499 out[31][1]=-30.0*dxtmp9*tmp20;
501 out[32][1]=-90.0*dxtmp9*tmp18;
503 out[33][1]=-210.0*dxtmp9*tmp19;
505 out[34][1]=-50.0*dxtmp10*tmp20;
507 out[35][1]=-150.0*dxtmp10*tmp18;
509 out[36][1]=-350.0*dxtmp10*tmp19;
511 out[37][1]=-70.0*dxtmp11*tmp20;
513 out[38][1]=-210.0*dxtmp11*tmp18;
515 out[39][1]=-490.0*dxtmp11*tmp19;
516 }
else if (direction == 1) {
517 const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1;
518 const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4);
519 const auto tmp9 = 2*x - 1;
520 const auto tmp10 = x*(6*x - 6) + 1;
521 const auto tmp11 = x*(x*(20*x - 30) + 12) - 1;
522 const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2);
523 const auto tmp15 = x*(x*(2*x - 3) + 1);
524 const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1);
526 const auto dytmp3 = 2;
527 const auto dytmp4 = 12*y - 6;
528 const auto dytmp5 = y*(60*y - 60) + 12;
529 const auto dytmp7 = 16 - y*(y*(140*y - 240) + 120);
530 const auto dytmp8 = y*(y*(140*y - 240) + 120) - 16;
531 const auto dytmp12 = y*(y*(140*y - 180) + 60) - 4;
532 const auto dytmp17 = 2 - y*(y*(28*y - 42) + 18);
533 const auto dytmp18 = y*(6*y - 6) + 1;
534 const auto dytmp19 = y*(y*(20*y - 30) + 12) - 1;
535 const auto dytmp20 = y*(y*(28*y - 42) + 18) - 2;
539 out[1][0]=(-3.0*tmp2*dytmp3);
541 out[2][0]=sign0*(-5.0*tmp2*dytmp4);
543 out[3][0]=(-7.0*tmp2*dytmp5);
548 out[5][0]=(-3.0*tmp6*dytmp3);
550 out[6][0]=sign1*(5.0*tmp6*dytmp4);
552 out[7][0]=(-7.0*tmp6*dytmp5);
556 out[8][1]=sign2*dytmp7;
558 out[9][1]=3.0*tmp9*dytmp8;
560 out[10][1]=sign2*(-5.0*tmp10*dytmp8);
562 out[11][1]=7.0*tmp11*dytmp8;
565 out[12][1]=sign3*dytmp12;
567 out[13][1]=3.0*tmp9*dytmp12;
569 out[14][1]=sign3*5.0*tmp10*dytmp12;
571 out[15][1]=7.0*tmp11*dytmp12;
575 out[17][0]=-30.0*tmp14*dytmp3;
577 out[18][0]=-50.0*tmp14*dytmp4;
579 out[19][0]=-70.0*tmp14*dytmp5;
583 out[21][0]=-90.0*tmp15*dytmp3;
585 out[22][0]=-150.0*tmp15*dytmp4;
587 out[23][0]=-210.0*tmp15*dytmp5;
591 out[25][0]=-210.0*tmp16*dytmp3;
593 out[26][0]=-350.0*tmp16*dytmp4;
595 out[27][0]=-490.0*tmp16*dytmp5;
598 out[28][1]=10.0*dytmp17;
600 out[29][1]=-30.0*dytmp18;
602 out[30][1]=-70.0*dytmp19;
604 out[31][1]=-30.0*tmp9*dytmp20;
606 out[32][1]=-90.0*tmp9*dytmp18;
608 out[33][1]=-210.0*tmp9*dytmp19;
610 out[34][1]=-50.0*tmp10*dytmp20;
612 out[35][1]=-150.0*tmp10*dytmp18;
614 out[36][1]=-350.0*tmp10*dytmp19;
616 out[37][1]=-70.0*tmp11*dytmp20;
618 out[38][1]=-210.0*tmp11*dytmp18;
620 out[39][1]=-490.0*tmp11*dytmp19;
636 R sign0, sign1, sign2, sign3;
A dense n x m matrix.
Definition: fmatrix.hh:69
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Default exception for dummy implementations.
Definition: exceptions.hh:261
Second order Raviart-Thomas shape functions on the reference quadrilateral.
Definition: raviartthomas3cube2dlocalbasis.hh:27
unsigned int size() const
number of shape functions
Definition: raviartthomas3cube2dlocalbasis.hh:47
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:177
RT3Cube2DLocalBasis(std::bitset< 4 > s=0)
Make set number s, where 0 <= s < 16.
Definition: raviartthomas3cube2dlocalbasis.hh:38
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:58
unsigned int order() const
Polynomial order of the shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:630
void partial(const std::array< unsigned int, 2 > &order, const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate partial derivatives of all shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:399
Default exception class for range errors.
Definition: exceptions.hh:252
Implements a matrix constructed from a given type representing a field and compile-time given number ...
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:289
Dune namespace.
Definition: alignedallocator.hh:11
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:32
D DomainType
domain type
Definition: localbasis.hh:43