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>
36 sign0 = sign1 = sign2 = sign3 = 1.0;
46 sign0 = (s[0]) ? -1.0 : 1.0;
47 sign1 = (s[1]) ? -1.0 : 1.0;
48 sign2 = (s[2]) ? -1.0 : 1.0;
49 sign3 = (s[3]) ? -1.0 : 1.0;
65 std::vector<typename Traits::RangeType>& out)
const
68 auto const& x = in[0], y = in[1];
70 const auto tmp1 = - x*(x*(x*(35*x - 80) + 60) - 16) - 1;
71 const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1;
72 const auto tmp3 = 2*y - 1;
73 const auto tmp4 = y*(6*y - 6) + 1;
74 const auto tmp5 = y*(y*(20*y - 30) + 12) - 1;
75 const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4);
76 const auto tmp7 = - y*(y*(y*(35*y - 80) + 60) - 16) - 1;
77 const auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1;
78 const auto tmp9 = 2*x - 1;
79 const auto tmp10 = x*(6*x - 6) + 1;
80 const auto tmp11 = x*(x*(20*x - 30) + 12) - 1;
81 const auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4);
82 const auto tmp13 = -x*(x*(x*(7*x - 14) + 9) - 2);
83 const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2);
84 const auto tmp15 = x*(x*(2*x - 3) + 1);
85 const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1);
86 const auto tmp17 = -y*(y*(y*(7*y - 14) + 9) - 2);
87 const auto tmp18 = y*(y*(2*y - 3) + 1);
88 const auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1);
89 const auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2);
93 out[1][0]=(-3.0*tmp2*tmp3);
95 out[2][0]=sign0*(-5.0*tmp2*tmp4);
97 out[3][0]=(-7.0*tmp2*tmp5);
100 out[4][0]=sign1*tmp6;
102 out[5][0]=(-3.0*tmp6*tmp3);
104 out[6][0]=sign1*(5.0*tmp6*tmp4);
106 out[7][0]=(-7.0*tmp6*tmp5);
110 out[8][1]=sign2*tmp7;
112 out[9][1]=3.0*tmp9*tmp8;
114 out[10][1]=sign2*(-5.0*tmp10*tmp8);
116 out[11][1]=7.0*tmp11*tmp8;
119 out[12][1]=sign3*tmp12;
121 out[13][1]=3.0*tmp9*tmp12;
123 out[14][1]=sign3*5.0*tmp10*tmp12;
125 out[15][1]=7.0*tmp11*tmp12;
127 out[16][0]=10.0*tmp13;
129 out[17][0]=-30.0*tmp14*tmp3;
131 out[18][0]=-50.0*tmp14*tmp4;
133 out[19][0]=-70.0*tmp14*tmp5;
135 out[20][0]=-30.0*tmp15;
137 out[21][0]=-90.0*tmp15*tmp3;
139 out[22][0]=-150.0*tmp15*tmp4;
141 out[23][0]=-210.0*tmp15*tmp5;
143 out[24][0]=-70.0*tmp16;
145 out[25][0]=-210.0*tmp16*tmp3;
147 out[26][0]=-350.0*tmp16*tmp4;
149 out[27][0]=-490.0*tmp16*tmp5;
152 out[28][1]=10.0*tmp17;
154 out[29][1]=-30.0*tmp18;
156 out[30][1]=-70.0*tmp19;
158 out[31][1]=-30.0*tmp9*tmp20;
160 out[32][1]=-90.0*tmp9*tmp18;
162 out[33][1]=-210.0*tmp9*tmp19;
164 out[34][1]=-50.0*tmp10*tmp20;
166 out[35][1]=-150.0*tmp10*tmp18;
168 out[36][1]=-350.0*tmp10*tmp19;
170 out[37][1]=-70.0*tmp11*tmp20;
172 out[38][1]=-210.0*tmp11*tmp18;
174 out[39][1]=-490.0*tmp11*tmp19;
184 std::vector<typename Traits::JacobianType>& out)
const
187 auto const& x = in[0], y = in[1];
189 const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1;
190 const auto tmp3 = 2*y - 1;
191 const auto tmp4 = y*(6*y - 6) + 1;
192 const auto tmp5 = y*(y*(20*y - 30) + 12) - 1;
193 const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4);
194 const auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1;
195 const auto tmp9 = 2*x - 1;
196 const auto tmp10 = x*(6*x - 6) + 1;
197 const auto tmp11 = x*(x*(20*x - 30) + 12) - 1;
198 const auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4);
199 const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2);
200 const auto tmp15 = x*(x*(2*x - 3) + 1);
201 const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1);
202 const auto tmp18 = y*(y*(2*y - 3) + 1);
203 const auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1);
204 const auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2);
207 const auto dxtmp1 = 16 - x*(x*(140*x - 240) + 120);
208 const auto dxtmp2 = x*(x*(140*x - 240) + 120) - 16;
209 const auto dytmp3 = 2;
210 const auto dytmp4 = 12*y - 6;
211 const auto dytmp5 = y*(60*y - 60) + 12;
212 const auto dxtmp6 = x*(x*(140*x - 180) + 60) - 4;
213 const auto dytmp7 = 16 - y*(y*(140*y - 240) + 120);
214 const auto dytmp8 = y*(y*(140*y - 240) + 120) - 16;
215 const auto dxtmp9 = 2;
216 const auto dxtmp10 = 12*x - 6;
217 const auto dxtmp11 = x*(60*x - 60) + 12;
218 const auto dytmp12 = y*(y*(140*y - 180) + 60) - 4;
219 const auto dxtmp13 = 2 - x*(x*(28*x - 42) + 18);
220 const auto dxtmp14 = x*(x*(28*x - 42) + 18) - 2;
221 const auto dxtmp15 = x*(6*x - 6) + 1;
222 const auto dxtmp16 = x*(x*(20*x - 30) + 12) - 1;
223 const auto dytmp17 = 2 - y*(y*(28*y - 42) + 18);
224 const auto dytmp18 = y*(6*y - 6) + 1;
225 const auto dytmp19 = y*(y*(20*y - 30) + 12) - 1;
226 const auto dytmp20 = y*(y*(28*y - 42) + 18) - 2;
230 out[0][0][0]=sign0*dxtmp1;
232 out[1][0][0]=(-3.0*dxtmp2*tmp3);
234 out[2][0][0]=sign0*(-5.0*dxtmp2*tmp4);
236 out[3][0][0]=(-7.0*dxtmp2*tmp5);
239 out[4][0][0]=sign1*dxtmp6;
241 out[5][0][0]=(-3.0*dxtmp6*tmp3);
243 out[6][0][0]=sign1*(5.0*dxtmp6*tmp4);
245 out[7][0][0]=(-7.0*dxtmp6*tmp5);
251 out[9][1][0]=3.0*dxtmp9*tmp8;
253 out[10][1][0]=sign2*(-5.0*dxtmp10*tmp8);
255 out[11][1][0]=7.0*dxtmp11*tmp8;
260 out[13][1][0]=3.0*dxtmp9*tmp12;
262 out[14][1][0]=sign3*5.0*dxtmp10*tmp12;
264 out[15][1][0]=7.0*dxtmp11*tmp12;
266 out[16][0][0]=10.0*dxtmp13;
268 out[17][0][0]=-30.0*dxtmp14*tmp3;
270 out[18][0][0]=-50.0*dxtmp14*tmp4;
272 out[19][0][0]=-70.0*dxtmp14*tmp5;
274 out[20][0][0]=-30.0*dxtmp15;
276 out[21][0][0]=-90.0*dxtmp15*tmp3;
278 out[22][0][0]=-150.0*dxtmp15*tmp4;
280 out[23][0][0]=-210.0*dxtmp15*tmp5;
282 out[24][0][0]=-70.0*dxtmp16;
284 out[25][0][0]=-210.0*dxtmp16*tmp3;
286 out[26][0][0]=-350.0*dxtmp16*tmp4;
288 out[27][0][0]=-490.0*dxtmp16*tmp5;
297 out[31][1][0]=-30.0*dxtmp9*tmp20;
299 out[32][1][0]=-90.0*dxtmp9*tmp18;
301 out[33][1][0]=-210.0*dxtmp9*tmp19;
303 out[34][1][0]=-50.0*dxtmp10*tmp20;
305 out[35][1][0]=-150.0*dxtmp10*tmp18;
307 out[36][1][0]=-350.0*dxtmp10*tmp19;
309 out[37][1][0]=-70.0*dxtmp11*tmp20;
311 out[38][1][0]=-210.0*dxtmp11*tmp18;
313 out[39][1][0]=-490.0*dxtmp11*tmp19;
319 out[1][0][1]=(-3.0*tmp2*dytmp3);
321 out[2][0][1]=sign0*(-5.0*tmp2*dytmp4);
323 out[3][0][1]=(-7.0*tmp2*dytmp5);
328 out[5][0][1]=(-3.0*tmp6*dytmp3);
330 out[6][0][1]=sign1*(5.0*tmp6*dytmp4);
332 out[7][0][1]=(-7.0*tmp6*dytmp5);
336 out[8][1][1]=sign2*dytmp7;
338 out[9][1][1]=3.0*tmp9*dytmp8;
340 out[10][1][1]=sign2*(-5.0*tmp10*dytmp8);
342 out[11][1][1]=7.0*tmp11*dytmp8;
345 out[12][1][1]=sign3*dytmp12;
347 out[13][1][1]=3.0*tmp9*dytmp12;
349 out[14][1][1]=sign3*5.0*tmp10*dytmp12;
351 out[15][1][1]=7.0*tmp11*dytmp12;
355 out[17][0][1]=-30.0*tmp14*dytmp3;
357 out[18][0][1]=-50.0*tmp14*dytmp4;
359 out[19][0][1]=-70.0*tmp14*dytmp5;
363 out[21][0][1]=-90.0*tmp15*dytmp3;
365 out[22][0][1]=-150.0*tmp15*dytmp4;
367 out[23][0][1]=-210.0*tmp15*dytmp5;
371 out[25][0][1]=-210.0*tmp16*dytmp3;
373 out[26][0][1]=-350.0*tmp16*dytmp4;
375 out[27][0][1]=-490.0*tmp16*dytmp5;
378 out[28][1][1]=10.0*dytmp17;
380 out[29][1][1]=-30.0*dytmp18;
382 out[30][1][1]=-70.0*dytmp19;
384 out[31][1][1]=-30.0*tmp9*dytmp20;
386 out[32][1][1]=-90.0*tmp9*dytmp18;
388 out[33][1][1]=-210.0*tmp9*dytmp19;
390 out[34][1][1]=-50.0*tmp10*dytmp20;
392 out[35][1][1]=-150.0*tmp10*dytmp18;
394 out[36][1][1]=-350.0*tmp10*dytmp19;
396 out[37][1][1]=-70.0*tmp11*dytmp20;
398 out[38][1][1]=-210.0*tmp11*dytmp18;
400 out[39][1][1]=-490.0*tmp11*dytmp19;
407 std::vector<typename Traits::RangeType>& out)
const
410 if (totalOrder == 0) {
412 }
else if (totalOrder == 1) {
414 auto const direction = std::distance(
order.begin(), std::find(
order.begin(),
order.end(), 1));
415 auto const& x = in[0], y = in[1];
417 if (direction == 0) {
419 auto tmp4 = y*(6*y - 6) + 1;
420 auto tmp5 = y*(y*(20*y - 30) + 12) - 1;
421 auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1;
422 auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4);
423 auto tmp18 = y*(y*(2*y - 3) + 1);
424 auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1);
425 auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2);
427 auto dxtmp1 = 16 - x*(x*(140*x - 240) + 120);
428 auto dxtmp2 = x*(x*(140*x - 240) + 120) - 16;
429 auto dxtmp6 = x*(x*(140*x - 180) + 60) - 4;
431 auto dxtmp10 = 12*x - 6;
432 auto dxtmp11 = x*(60*x - 60) + 12;
433 auto dxtmp13 = 2 - x*(x*(28*x - 42) + 18);
434 auto dxtmp14 = x*(x*(28*x - 42) + 18) - 2;
435 auto dxtmp15 = x*(6*x - 6) + 1;
436 auto dxtmp16 = x*(x*(20*x - 30) + 12) - 1;
438 out[0][0]=sign0*dxtmp1;
440 out[1][0]=(-3.0*dxtmp2*tmp3);
442 out[2][0]=sign0*(-5.0*dxtmp2*tmp4);
444 out[3][0]=(-7.0*dxtmp2*tmp5);
447 out[4][0]=sign1*dxtmp6;
449 out[5][0]=(-3.0*dxtmp6*tmp3);
451 out[6][0]=sign1*(5.0*dxtmp6*tmp4);
453 out[7][0]=(-7.0*dxtmp6*tmp5);
459 out[9][1]=3.0*dxtmp9*tmp8;
461 out[10][1]=sign2*(-5.0*dxtmp10*tmp8);
463 out[11][1]=7.0*dxtmp11*tmp8;
468 out[13][1]=3.0*dxtmp9*tmp12;
470 out[14][1]=sign3*5.0*dxtmp10*tmp12;
472 out[15][1]=7.0*dxtmp11*tmp12;
474 out[16][0]=10.0*dxtmp13;
476 out[17][0]=-30.0*dxtmp14*tmp3;
478 out[18][0]=-50.0*dxtmp14*tmp4;
480 out[19][0]=-70.0*dxtmp14*tmp5;
482 out[20][0]=-30.0*dxtmp15;
484 out[21][0]=-90.0*dxtmp15*tmp3;
486 out[22][0]=-150.0*dxtmp15*tmp4;
488 out[23][0]=-210.0*dxtmp15*tmp5;
490 out[24][0]=-70.0*dxtmp16;
492 out[25][0]=-210.0*dxtmp16*tmp3;
494 out[26][0]=-350.0*dxtmp16*tmp4;
496 out[27][0]=-490.0*dxtmp16*tmp5;
505 out[31][1]=-30.0*dxtmp9*tmp20;
507 out[32][1]=-90.0*dxtmp9*tmp18;
509 out[33][1]=-210.0*dxtmp9*tmp19;
511 out[34][1]=-50.0*dxtmp10*tmp20;
513 out[35][1]=-150.0*dxtmp10*tmp18;
515 out[36][1]=-350.0*dxtmp10*tmp19;
517 out[37][1]=-70.0*dxtmp11*tmp20;
519 out[38][1]=-210.0*dxtmp11*tmp18;
521 out[39][1]=-490.0*dxtmp11*tmp19;
522 }
else if (direction == 1) {
523 const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1;
524 const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4);
525 const auto tmp9 = 2*x - 1;
526 const auto tmp10 = x*(6*x - 6) + 1;
527 const auto tmp11 = x*(x*(20*x - 30) + 12) - 1;
528 const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2);
529 const auto tmp15 = x*(x*(2*x - 3) + 1);
530 const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1);
532 const auto dytmp3 = 2;
533 const auto dytmp4 = 12*y - 6;
534 const auto dytmp5 = y*(60*y - 60) + 12;
535 const auto dytmp7 = 16 - y*(y*(140*y - 240) + 120);
536 const auto dytmp8 = y*(y*(140*y - 240) + 120) - 16;
537 const auto dytmp12 = y*(y*(140*y - 180) + 60) - 4;
538 const auto dytmp17 = 2 - y*(y*(28*y - 42) + 18);
539 const auto dytmp18 = y*(6*y - 6) + 1;
540 const auto dytmp19 = y*(y*(20*y - 30) + 12) - 1;
541 const auto dytmp20 = y*(y*(28*y - 42) + 18) - 2;
545 out[1][0]=(-3.0*tmp2*dytmp3);
547 out[2][0]=sign0*(-5.0*tmp2*dytmp4);
549 out[3][0]=(-7.0*tmp2*dytmp5);
554 out[5][0]=(-3.0*tmp6*dytmp3);
556 out[6][0]=sign1*(5.0*tmp6*dytmp4);
558 out[7][0]=(-7.0*tmp6*dytmp5);
562 out[8][1]=sign2*dytmp7;
564 out[9][1]=3.0*tmp9*dytmp8;
566 out[10][1]=sign2*(-5.0*tmp10*dytmp8);
568 out[11][1]=7.0*tmp11*dytmp8;
571 out[12][1]=sign3*dytmp12;
573 out[13][1]=3.0*tmp9*dytmp12;
575 out[14][1]=sign3*5.0*tmp10*dytmp12;
577 out[15][1]=7.0*tmp11*dytmp12;
581 out[17][0]=-30.0*tmp14*dytmp3;
583 out[18][0]=-50.0*tmp14*dytmp4;
585 out[19][0]=-70.0*tmp14*dytmp5;
589 out[21][0]=-90.0*tmp15*dytmp3;
591 out[22][0]=-150.0*tmp15*dytmp4;
593 out[23][0]=-210.0*tmp15*dytmp5;
597 out[25][0]=-210.0*tmp16*dytmp3;
599 out[26][0]=-350.0*tmp16*dytmp4;
601 out[27][0]=-490.0*tmp16*dytmp5;
604 out[28][1]=10.0*dytmp17;
606 out[29][1]=-30.0*dytmp18;
608 out[30][1]=-70.0*dytmp19;
610 out[31][1]=-30.0*tmp9*dytmp20;
612 out[32][1]=-90.0*tmp9*dytmp18;
614 out[33][1]=-210.0*tmp9*dytmp19;
616 out[34][1]=-50.0*tmp10*dytmp20;
618 out[35][1]=-150.0*tmp10*dytmp18;
620 out[36][1]=-350.0*tmp10*dytmp19;
622 out[37][1]=-70.0*tmp11*dytmp20;
624 out[38][1]=-210.0*tmp11*dytmp18;
626 out[39][1]=-490.0*tmp11*dytmp19;
642 R sign0, sign1, sign2, sign3;
A dense n x m matrix.
Definition: fmatrix.hh:68
vector space out of a tensor product of fields.
Definition: fvector.hh:93
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:53
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:183
RT3Cube2DLocalBasis()
Standard constructor.
Definition: raviartthomas3cube2dlocalbasis.hh:34
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:64
RT3Cube2DLocalBasis(std::bitset< 4 > s)
Make set number s, where 0 <= s < 16.
Definition: raviartthomas3cube2dlocalbasis.hh:44
unsigned int order() const
Polynomial order of the shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:636
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:405
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
T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:331
Dune namespace.
Definition: alignedallocator.hh:10
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:32
D DomainType
domain type
Definition: localbasis.hh:43