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