5#ifndef DUNE_LOCALFUNCTIONS_LAGRANGE_LAGRANGEPRISM_HH
6#define DUNE_LOCALFUNCTIONS_LAGRANGE_LAGRANGEPRISM_HH
15#include <dune/geometry/referenceelements.hh>
17#include <dune/localfunctions/common/localbasis.hh>
18#include <dune/localfunctions/common/localfiniteelementtraits.hh>
19#include <dune/localfunctions/common/localkey.hh>
21namespace Dune {
namespace Impl
25 template<
int compileTimeOrder>
26 struct LagrangePrismOrderTraits;
29 template<
int compileTimeOrder>
30 requires (compileTimeOrder >= 0)
31 struct LagrangePrismOrderTraits<compileTimeOrder>
33 static constexpr bool is_static_order =
true;
35 constexpr LagrangePrismOrderTraits(
int = compileTimeOrder)
37 static_assert((0 <= compileTimeOrder) and (compileTimeOrder <= 2),
"LagrangePrism: Only order 0,1, and 2 are supported");
43 static constexpr unsigned int order() {
44 return compileTimeOrder;
50 static constexpr std::size_t
size() {
51 return binomial(compileTimeOrder+2,2) * (compileTimeOrder+1);
58 struct LagrangePrismOrderTraits<-1>
60 unsigned int runTimeOrder_;
63 static constexpr bool is_static_order =
false;
65 constexpr explicit LagrangePrismOrderTraits(
int runTimeOrder)
66 : runTimeOrder_(runTimeOrder >= 0 ? (unsigned int)(runTimeOrder) : 0u)
67 , size_(
binomial(runTimeOrder+2,2) * (runTimeOrder+1))
69 if ((runTimeOrder < 0) or (runTimeOrder > 2))
76 constexpr unsigned int order()
const
84 constexpr std::size_t
size()
const
99 template<
class D,
class R,
int compileTimeOrder>
100 class LagrangePrismLocalBasis
101 :
public LagrangePrismOrderTraits<compileTimeOrder>
103 using OrderTraits = LagrangePrismOrderTraits<compileTimeOrder>;
104 static constexpr std::size_t dim = 3;
106 using Traits = LocalBasisTraits<D,dim,FieldVector<D,dim>,R,1,FieldVector<R,1>,FieldMatrix<R,1,dim> >;
108 constexpr LagrangePrismLocalBasis(OrderTraits orderTraits)
109 : OrderTraits(orderTraits)
112 using OrderTraits::order;
113 using OrderTraits::size;
117 std::vector<typename Traits::RangeType>& out)
const
130 out[0] = (1.0-in[0]-in[1])*(1.0-in[2]);
131 out[1] = in[0]*(1-in[2]);
132 out[2] = in[1]*(1-in[2]);
133 out[3] = in[2]*(1.0-in[0]-in[1]);
134 out[4] = in[0]*in[2];
135 out[5] = in[1]*in[2];
142 FieldVector<R,3> segmentShapeFunction;
143 segmentShapeFunction[0] = 1 + in[2] * (-3 + 2*in[2]);
144 segmentShapeFunction[1] = in[2] * (4 - 4*in[2]);
145 segmentShapeFunction[2] = in[2] * (-1 + 2*in[2]);
147 FieldVector<R, 6> triangleShapeFunction;
148 triangleShapeFunction[0] = 2 * (1 - in[0] - in[1]) * (0.5 - in[0] - in[1]);
149 triangleShapeFunction[1] = 2 * in[0] * (-0.5 + in[0]);
150 triangleShapeFunction[2] = 2 * in[1] * (-0.5 + in[1]);
151 triangleShapeFunction[3] = 4*in[0] * (1 - in[0] - in[1]);
152 triangleShapeFunction[4] = 4*in[1] * (1 - in[0] - in[1]);
153 triangleShapeFunction[5] = 4*in[0]*in[1];
156 out[0] = triangleShapeFunction[0] * segmentShapeFunction[0];
157 out[1] = triangleShapeFunction[1] * segmentShapeFunction[0];
158 out[2] = triangleShapeFunction[2] * segmentShapeFunction[0];
161 out[3] = triangleShapeFunction[0] * segmentShapeFunction[2];
162 out[4] = triangleShapeFunction[1] * segmentShapeFunction[2];
163 out[5] = triangleShapeFunction[2] * segmentShapeFunction[2];
166 out[6] = triangleShapeFunction[0] * segmentShapeFunction[1];
167 out[7] = triangleShapeFunction[1] * segmentShapeFunction[1];
168 out[8] = triangleShapeFunction[2] * segmentShapeFunction[1];
171 out[9] = triangleShapeFunction[3] * segmentShapeFunction[0];
172 out[10] = triangleShapeFunction[4] * segmentShapeFunction[0];
173 out[11] = triangleShapeFunction[5] * segmentShapeFunction[0];
176 out[12] = triangleShapeFunction[3] * segmentShapeFunction[2];
177 out[13] = triangleShapeFunction[4] * segmentShapeFunction[2];
178 out[14] = triangleShapeFunction[5] * segmentShapeFunction[2];
181 out[15] = triangleShapeFunction[3] * segmentShapeFunction[1];
182 out[16] = triangleShapeFunction[4] * segmentShapeFunction[1];
183 out[17] = triangleShapeFunction[5] * segmentShapeFunction[1];
188 DUNE_THROW(NotImplemented,
"LagrangePrismLocalBasis::evaluateFunction for order " << order());
197 std::vector<typename Traits::JacobianType>& out)
const
204 std::fill(out[0][0].begin(), out[0][0].end(), 0);
210 out[0][0] = {in[2]-1, in[2]-1, in[0]+in[1]-1};
211 out[1][0] = {1-in[2], 0, -in[0]};
212 out[2][0] = { 0, 1-in[2], -in[1]};
213 out[3][0] = { -in[2], -in[2], 1-in[0]-in[1]};
214 out[4][0] = { in[2], 0, in[0]};
215 out[5][0] = { 0, in[2], in[1]};
223 FieldVector<R, 6> triangleShapeFunction;
224 triangleShapeFunction[0] = 2 * (1 - in[0] - in[1]) * (0.5 - in[0] - in[1]);
225 triangleShapeFunction[1] = 2 * in[0] * (-0.5 + in[0]);
226 triangleShapeFunction[2] = 2 * in[1] * (-0.5 + in[1]);
227 triangleShapeFunction[3] = 4*in[0] * (1 - in[0] - in[1]);
228 triangleShapeFunction[4] = 4*in[1] * (1 - in[0] - in[1]);
229 triangleShapeFunction[5] = 4*in[0]*in[1];
231 std::array<std::array<R,2>,6> triangleShapeFunctionDer;
232 triangleShapeFunctionDer[0] = {-3 + 4*(in[0] + in[1]), -3 + 4*(in[0] + in[1])};
233 triangleShapeFunctionDer[1] = { -1 + 4*in[0], 0};
234 triangleShapeFunctionDer[2] = { 0, -1 + 4*in[1]};
235 triangleShapeFunctionDer[3] = { 4 - 8*in[0] - 4*in[1], -4*in[0]};
236 triangleShapeFunctionDer[4] = { -4*in[1], 4 - 4*in[0] - 8*in[1]};
237 triangleShapeFunctionDer[5] = { 4*in[1], 4*in[0]};
240 FieldVector<R,3> segmentShapeFunction;
241 segmentShapeFunction[0] = 1 + in[2] * (-3 + 2*in[2]);
242 segmentShapeFunction[1] = in[2] * ( 4 - 4*in[2]);
243 segmentShapeFunction[2] = in[2] * (-1 + 2*in[2]);
245 FieldVector<R,3> segmentShapeFunctionDer;
246 segmentShapeFunctionDer[0] = -3 + 4*in[2];
247 segmentShapeFunctionDer[1] = 4 - 8*in[2];
248 segmentShapeFunctionDer[2] = -1 + 4*in[2];
251 out[0][0][0] = triangleShapeFunctionDer[0][0] * segmentShapeFunction[0];
252 out[0][0][1] = triangleShapeFunctionDer[0][1] * segmentShapeFunction[0];
253 out[0][0][2] = triangleShapeFunction[0] * segmentShapeFunctionDer[0];
255 out[1][0][0] = triangleShapeFunctionDer[1][0] * segmentShapeFunction[0];
256 out[1][0][1] = triangleShapeFunctionDer[1][1] * segmentShapeFunction[0];
257 out[1][0][2] = triangleShapeFunction[1] * segmentShapeFunctionDer[0];
259 out[2][0][0] = triangleShapeFunctionDer[2][0] * segmentShapeFunction[0];
260 out[2][0][1] = triangleShapeFunctionDer[2][1] * segmentShapeFunction[0];
261 out[2][0][2] = triangleShapeFunction[2] * segmentShapeFunctionDer[0];
264 out[3][0][0] = triangleShapeFunctionDer[0][0] * segmentShapeFunction[2];
265 out[3][0][1] = triangleShapeFunctionDer[0][1] * segmentShapeFunction[2];
266 out[3][0][2] = triangleShapeFunction[0] * segmentShapeFunctionDer[2];
268 out[4][0][0] = triangleShapeFunctionDer[1][0] * segmentShapeFunction[2];
269 out[4][0][1] = triangleShapeFunctionDer[1][1] * segmentShapeFunction[2];
270 out[4][0][2] = triangleShapeFunction[1] * segmentShapeFunctionDer[2];
272 out[5][0][0] = triangleShapeFunctionDer[2][0] * segmentShapeFunction[2];
273 out[5][0][1] = triangleShapeFunctionDer[2][1] * segmentShapeFunction[2];
274 out[5][0][2] = triangleShapeFunction[2] * segmentShapeFunctionDer[2];
277 out[6][0][0] = triangleShapeFunctionDer[0][0] * segmentShapeFunction[1];
278 out[6][0][1] = triangleShapeFunctionDer[0][1] * segmentShapeFunction[1];
279 out[6][0][2] = triangleShapeFunction[0] * segmentShapeFunctionDer[1];
281 out[7][0][0] = triangleShapeFunctionDer[1][0] * segmentShapeFunction[1];
282 out[7][0][1] = triangleShapeFunctionDer[1][1] * segmentShapeFunction[1];
283 out[7][0][2] = triangleShapeFunction[1] * segmentShapeFunctionDer[1];
285 out[8][0][0] = triangleShapeFunctionDer[2][0] * segmentShapeFunction[1];
286 out[8][0][1] = triangleShapeFunctionDer[2][1] * segmentShapeFunction[1];
287 out[8][0][2] = triangleShapeFunction[2] * segmentShapeFunctionDer[1];
290 out[9][0][0] = triangleShapeFunctionDer[3][0] * segmentShapeFunction[0];
291 out[9][0][1] = triangleShapeFunctionDer[3][1] * segmentShapeFunction[0];
292 out[9][0][2] = triangleShapeFunction[3] * segmentShapeFunctionDer[0];
294 out[10][0][0] = triangleShapeFunctionDer[4][0] * segmentShapeFunction[0];
295 out[10][0][1] = triangleShapeFunctionDer[4][1] * segmentShapeFunction[0];
296 out[10][0][2] = triangleShapeFunction[4] * segmentShapeFunctionDer[0];
298 out[11][0][0] = triangleShapeFunctionDer[5][0] * segmentShapeFunction[0];
299 out[11][0][1] = triangleShapeFunctionDer[5][1] * segmentShapeFunction[0];
300 out[11][0][2] = triangleShapeFunction[5] * segmentShapeFunctionDer[0];
303 out[12][0][0] = triangleShapeFunctionDer[3][0] * segmentShapeFunction[2];
304 out[12][0][1] = triangleShapeFunctionDer[3][1] * segmentShapeFunction[2];
305 out[12][0][2] = triangleShapeFunction[3] * segmentShapeFunctionDer[2];
307 out[13][0][0] = triangleShapeFunctionDer[4][0] * segmentShapeFunction[2];
308 out[13][0][1] = triangleShapeFunctionDer[4][1] * segmentShapeFunction[2];
309 out[13][0][2] = triangleShapeFunction[4] * segmentShapeFunctionDer[2];
311 out[14][0][0] = triangleShapeFunctionDer[5][0] * segmentShapeFunction[2];
312 out[14][0][1] = triangleShapeFunctionDer[5][1] * segmentShapeFunction[2];
313 out[14][0][2] = triangleShapeFunction[5] * segmentShapeFunctionDer[2];
316 out[15][0][0] = triangleShapeFunctionDer[3][0] * segmentShapeFunction[1];
317 out[15][0][1] = triangleShapeFunctionDer[3][1] * segmentShapeFunction[1];
318 out[15][0][2] = triangleShapeFunction[3] * segmentShapeFunctionDer[1];
320 out[16][0][0] = triangleShapeFunctionDer[4][0] * segmentShapeFunction[1];
321 out[16][0][1] = triangleShapeFunctionDer[4][1] * segmentShapeFunction[1];
322 out[16][0][2] = triangleShapeFunction[4] * segmentShapeFunctionDer[1];
324 out[17][0][0] = triangleShapeFunctionDer[5][0] * segmentShapeFunction[1];
325 out[17][0][1] = triangleShapeFunctionDer[5][1] * segmentShapeFunction[1];
326 out[17][0][2] = triangleShapeFunction[5] * segmentShapeFunctionDer[1];
331 DUNE_THROW(NotImplemented,
"LagrangePrismLocalBasis::evaluateJacobian for order " << order());
340 void partial(
const std::array<unsigned int,dim>& order,
342 std::vector<typename Traits::RangeType>& out)
const
350 evaluateFunction(in, out);
355 if (OrderTraits::order()==0)
362 if (OrderTraits::order()==1)
366 auto direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
386 out[0] = in[0]+in[1]-1;
389 out[3] = 1-in[0]-in[1];
394 DUNE_THROW(RangeError,
"Component out of range.");
396 }
else if (totalOrder == 2) {
398 if (order[0] == 1 && order[2] == 1) {
405 }
else if (order[1] == 1 && order[2] == 1) {
413 for (std::size_t i = 0; i <
size(); ++i)
418 std::fill(out.begin(), out.end(), 0.0);
425 if (OrderTraits::order()==2)
429 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
434 FieldVector<R,6> triangleShapeFunctionDerX;
435 triangleShapeFunctionDerX[0] = -3 + 4*(in[0] + in[1]);
436 triangleShapeFunctionDerX[1] = -1 + 4* in[0];
437 triangleShapeFunctionDerX[2] = 0;
438 triangleShapeFunctionDerX[3] = 4 - 8* in[0] - 4*in[1];
439 triangleShapeFunctionDerX[4] = -4*in[1];
440 triangleShapeFunctionDerX[5] = 4*in[1];
442 FieldVector<R,3> segmentShapeFunction;
443 segmentShapeFunction[0] = 1 + in[2] * (-3 + 2*in[2]);
444 segmentShapeFunction[1] = in[2] * ( 4 - 4*in[2]);
445 segmentShapeFunction[2] = in[2] * (-1 + 2*in[2]);
447 out[0] = triangleShapeFunctionDerX[0] * segmentShapeFunction[0];
448 out[1] = triangleShapeFunctionDerX[1] * segmentShapeFunction[0];
449 out[2] = triangleShapeFunctionDerX[2] * segmentShapeFunction[0];
450 out[3] = triangleShapeFunctionDerX[0] * segmentShapeFunction[2];
451 out[4] = triangleShapeFunctionDerX[1] * segmentShapeFunction[2];
452 out[5] = triangleShapeFunctionDerX[2] * segmentShapeFunction[2];
453 out[6] = triangleShapeFunctionDerX[0] * segmentShapeFunction[1];
454 out[7] = triangleShapeFunctionDerX[1] * segmentShapeFunction[1];
455 out[8] = triangleShapeFunctionDerX[2] * segmentShapeFunction[1];
456 out[9] = triangleShapeFunctionDerX[3] * segmentShapeFunction[0];
457 out[10] = triangleShapeFunctionDerX[4] * segmentShapeFunction[0];
458 out[11] = triangleShapeFunctionDerX[5] * segmentShapeFunction[0];
459 out[12] = triangleShapeFunctionDerX[3] * segmentShapeFunction[2];
460 out[13] = triangleShapeFunctionDerX[4] * segmentShapeFunction[2];
461 out[14] = triangleShapeFunctionDerX[5] * segmentShapeFunction[2];
462 out[15] = triangleShapeFunctionDerX[3] * segmentShapeFunction[1];
463 out[16] = triangleShapeFunctionDerX[4] * segmentShapeFunction[1];
464 out[17] = triangleShapeFunctionDerX[5] * segmentShapeFunction[1];
469 FieldVector<R,6> triangleShapeFunctionDerY;
470 triangleShapeFunctionDerY[0] = -3 + 4*(in[0] + in[1]);
471 triangleShapeFunctionDerY[1] = 0;
472 triangleShapeFunctionDerY[2] = -1 + 4* in[1];
473 triangleShapeFunctionDerY[3] = -4* in[0];
474 triangleShapeFunctionDerY[4] = 4 - 4* in[0] - 8*in[1];
475 triangleShapeFunctionDerY[5] = 4* in[0];
477 FieldVector<R,3> segmentShapeFunction;
478 segmentShapeFunction[0] = 1 + in[2] * (-3 + 2*in[2]);
479 segmentShapeFunction[1] = in[2] * ( 4 - 4*in[2]);
480 segmentShapeFunction[2] = in[2] * (-1 + 2*in[2]);
482 out[0] = triangleShapeFunctionDerY[0] * segmentShapeFunction[0];
483 out[1] = triangleShapeFunctionDerY[1] * segmentShapeFunction[0];
484 out[2] = triangleShapeFunctionDerY[2] * segmentShapeFunction[0];
485 out[3] = triangleShapeFunctionDerY[0] * segmentShapeFunction[2];
486 out[4] = triangleShapeFunctionDerY[1] * segmentShapeFunction[2];
487 out[5] = triangleShapeFunctionDerY[2] * segmentShapeFunction[2];
488 out[6] = triangleShapeFunctionDerY[0] * segmentShapeFunction[1];
489 out[7] = triangleShapeFunctionDerY[1] * segmentShapeFunction[1];
490 out[8] = triangleShapeFunctionDerY[2] * segmentShapeFunction[1];
491 out[9] = triangleShapeFunctionDerY[3] * segmentShapeFunction[0];
492 out[10] = triangleShapeFunctionDerY[4] * segmentShapeFunction[0];
493 out[11] = triangleShapeFunctionDerY[5] * segmentShapeFunction[0];
494 out[12] = triangleShapeFunctionDerY[3] * segmentShapeFunction[2];
495 out[13] = triangleShapeFunctionDerY[4] * segmentShapeFunction[2];
496 out[14] = triangleShapeFunctionDerY[5] * segmentShapeFunction[2];
497 out[15] = triangleShapeFunctionDerY[3] * segmentShapeFunction[1];
498 out[16] = triangleShapeFunctionDerY[4] * segmentShapeFunction[1];
499 out[17] = triangleShapeFunctionDerY[5] * segmentShapeFunction[1];
504 FieldVector<R, 6> triangleShapeFunction;
505 triangleShapeFunction[0] = 2 * (1 - in[0] - in[1]) * (0.5 - in[0] - in[1]);
506 triangleShapeFunction[1] = 2 * in[0] * (-0.5 + in[0]);
507 triangleShapeFunction[2] = 2 * in[1] * (-0.5 + in[1]);
508 triangleShapeFunction[3] = 4*in[0] * (1 - in[0] - in[1]);
509 triangleShapeFunction[4] = 4*in[1] * (1 - in[0] - in[1]);
510 triangleShapeFunction[5] = 4*in[0]*in[1];
512 FieldVector<R,3> segmentShapeFunctionDer;
513 segmentShapeFunctionDer[0] = -3 + 4*in[2];
514 segmentShapeFunctionDer[1] = 4 - 8*in[2];
515 segmentShapeFunctionDer[2] = -1 + 4*in[2];
517 out[0] = triangleShapeFunction[0] * segmentShapeFunctionDer[0];
518 out[1] = triangleShapeFunction[1] * segmentShapeFunctionDer[0];
519 out[2] = triangleShapeFunction[2] * segmentShapeFunctionDer[0];
520 out[3] = triangleShapeFunction[0] * segmentShapeFunctionDer[2];
521 out[4] = triangleShapeFunction[1] * segmentShapeFunctionDer[2];
522 out[5] = triangleShapeFunction[2] * segmentShapeFunctionDer[2];
523 out[6] = triangleShapeFunction[0] * segmentShapeFunctionDer[1];
524 out[7] = triangleShapeFunction[1] * segmentShapeFunctionDer[1];
525 out[8] = triangleShapeFunction[2] * segmentShapeFunctionDer[1];
526 out[9] = triangleShapeFunction[3] * segmentShapeFunctionDer[0];
527 out[10] = triangleShapeFunction[4] * segmentShapeFunctionDer[0];
528 out[11] = triangleShapeFunction[5] * segmentShapeFunctionDer[0];
529 out[12] = triangleShapeFunction[3] * segmentShapeFunctionDer[2];
530 out[13] = triangleShapeFunction[4] * segmentShapeFunctionDer[2];
531 out[14] = triangleShapeFunction[5] * segmentShapeFunctionDer[2];
532 out[15] = triangleShapeFunction[3] * segmentShapeFunctionDer[1];
533 out[16] = triangleShapeFunction[4] * segmentShapeFunctionDer[1];
534 out[17] = triangleShapeFunction[5] * segmentShapeFunctionDer[1];
538 DUNE_THROW(RangeError,
"Component out of range.");
541 DUNE_THROW(NotImplemented,
"Desired derivative order is not implemented");
547 DUNE_THROW(NotImplemented,
"LagrangePrismLocalBasis::partial not implemented for order " << OrderTraits::order());
556 template<
int compileTimeOrder>
557 class LagrangePrismLocalCoefficients
558 :
public LagrangePrismOrderTraits<compileTimeOrder>
560 using OrderTraits = LagrangePrismOrderTraits<compileTimeOrder>;
563 using OrderTraits::order;
564 using OrderTraits::size;
567 LagrangePrismLocalCoefficients (OrderTraits orderTraits)
568 : OrderTraits(orderTraits)
573 localKeys_[0] = LocalKey(0,0,0);
579 for (std::size_t i=0; i<
size(); i++)
580 localKeys_[i] = LocalKey(i,3,0);
587 localKeys_[0] = LocalKey(0,3,0);
588 localKeys_[1] = LocalKey(1,3,0);
589 localKeys_[2] = LocalKey(2,3,0);
590 localKeys_[3] = LocalKey(3,3,0);
591 localKeys_[4] = LocalKey(4,3,0);
592 localKeys_[5] = LocalKey(5,3,0);
595 localKeys_[6] = LocalKey(0,2,0);
596 localKeys_[7] = LocalKey(1,2,0);
597 localKeys_[8] = LocalKey(2,2,0);
598 localKeys_[9] = LocalKey(3,2,0);
599 localKeys_[10] = LocalKey(4,2,0);
600 localKeys_[11] = LocalKey(5,2,0);
601 localKeys_[12] = LocalKey(6,2,0);
602 localKeys_[13] = LocalKey(7,2,0);
603 localKeys_[14] = LocalKey(8,2,0);
606 localKeys_[15] = LocalKey(0,1,0);
607 localKeys_[16] = LocalKey(1,1,0);
608 localKeys_[17] = LocalKey(2,1,0);
614 DUNE_THROW(NotImplemented,
"LagrangePrismLocalCoefficients not implemented for order " << order());
618 LagrangePrismLocalCoefficients ()
619 requires(OrderTraits::is_static_order)
620 : LagrangePrismLocalCoefficients(OrderTraits())
625 const LocalKey& localKey (std::size_t i)
const
627 return localKeys_[i];
631 std::vector<LocalKey> localKeys_;
638 template<
class D,
class R,
int compileTimeOrder>
639 class LagrangePrismLocalInterpolation
640 :
public LagrangePrismOrderTraits<compileTimeOrder>
642 using Traits =
typename LagrangePrismLocalBasis<D,R,compileTimeOrder>::Traits;
643 using OrderTraits = LagrangePrismOrderTraits<compileTimeOrder>;
646 constexpr LagrangePrismLocalInterpolation(OrderTraits orderTraits)
647 : OrderTraits(orderTraits)
657 template<
typename F,
typename C>
658 void interpolate (
const F& f, std::vector<C>& out)
const
660 constexpr auto dim = Traits::dimDomain;
661 auto k = OrderTraits::order();
662 using Domain =
typename Traits::DomainType;
663 using DomainField =
typename Traits::DomainFieldType;
665 out.resize(OrderTraits::size());
678 for (
unsigned int i=0; i<OrderTraits::size(); i++)
688 out[0] = f( Domain( {0.0, 0.0, 0.0} ) );
689 out[1] = f( Domain( {1.0, 0.0, 0.0} ) );
690 out[2] = f( Domain( {0.0, 1.0, 0.0} ) );
691 out[3] = f( Domain( {0.0, 0.0, 1.0} ) );
692 out[4] = f( Domain( {1.0, 0.0, 1.0} ) );
693 out[5] = f( Domain( {0.0, 1.0, 1.0} ) );
694 out[6] = f( Domain( {0.0, 0.0, 0.5} ) );
695 out[7] = f( Domain( {1.0, 0.0, 0.5} ) );
696 out[8] = f( Domain( {0.0, 1.0, 0.5} ) );
697 out[9] = f( Domain( {0.5, 0.0, 0.0} ) );
698 out[10] = f( Domain( {0.0, 0.5, 0.0} ) );
699 out[11] = f( Domain( {0.5, 0.5, 0.0} ) );
700 out[12] = f( Domain( {0.5, 0.0, 1.0} ) );
701 out[13] = f( Domain( {0.0, 0.5, 1.0} ) );
702 out[14] = f( Domain( {0.5, 0.5, 1.0} ) );
703 out[15] = f( Domain( {0.5, 0.0, 0.5} ) );
704 out[16] = f( Domain( {0.0, 0.5, 0.5} ) );
705 out[17] = f( Domain( {0.5, 0.5, 0.5} ) );
710 DUNE_THROW(NotImplemented,
"LagrangePrismLocalInterpolation not implemented for order " << k);
725 template<
class D,
class R,
int compileTimeOrder = -1>
727 :
public Impl::LagrangePrismOrderTraits<compileTimeOrder>
729 using OrderTraits = Impl::LagrangePrismOrderTraits<compileTimeOrder>;
735 Impl::LagrangePrismLocalCoefficients<compileTimeOrder>,
736 Impl::LagrangePrismLocalInterpolation<D,R,compileTimeOrder> >;
742 , coefficients_(*this)
743 , interpolation_(*this)
745 static_assert(OrderTraits::is_static_order,
"Default constructor only allowed for compile-time >= 0");
746 static_assert((0 <= compileTimeOrder) and (compileTimeOrder <= 2),
"LagrangePrism: Only order 0,1, and 2 are supported");
751 : OrderTraits(runTimeOrder)
753 , coefficients_(*this)
754 , interpolation_(*this)
756 static_assert(not OrderTraits::is_static_order,
"Passing a run-time order only allowed for compile-time = -1");
757 if ((runTimeOrder < 0) or (runTimeOrder > 2))
772 return coefficients_;
779 return interpolation_;
790 Impl::LagrangePrismLocalBasis<D,R,compileTimeOrder> basis_;
791 Impl::LagrangePrismLocalCoefficients<compileTimeOrder> coefficients_;
792 Impl::LagrangePrismLocalInterpolation<D,R,compileTimeOrder> interpolation_;
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:375
Lagrange finite element for 3d prisms with arbitrary compile-time polynomial order.
Definition: lagrangeprism.hh:728
const Traits::LocalInterpolationType & localInterpolation() const
Returns object that evaluates degrees of freedom.
Definition: lagrangeprism.hh:777
const Traits::LocalCoefficientsType & localCoefficients() const
Returns the assignment of the degrees of freedom to the element subentities.
Definition: lagrangeprism.hh:770
static constexpr GeometryType type()
The reference element that the local finite element is defined on.
Definition: lagrangeprism.hh:784
constexpr LagrangePrismLocalFiniteElement()
Constructor for compile-time order.
Definition: lagrangeprism.hh:739
const Traits::LocalBasisType & localBasis() const
Returns the local basis, i.e., the set of shape functions.
Definition: lagrangeprism.hh:763
constexpr LagrangePrismLocalFiniteElement(int runTimeOrder)
Constructor for run-time order.
Definition: lagrangeprism.hh:750
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_THROW(E,...)
Definition: exceptions.hh:314
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:528
constexpr GeometryType vertex
GeometryType representing a vertex.
Definition: type.hh:492
void interpolate(const F &f, const GFS &gfs, XG &xg)
interpolation from a given grid function
Definition: interpolate.hh:177
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:284
Some useful basic math stuff.
Dune namespace
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
static constexpr T binomial(const T &n, const T &k) noexcept
calculate the binomial coefficient n over k as a constexpr
Definition: math.hh:113
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:156
D DomainType
domain type
Definition: localbasis.hh:43
traits helper struct
Definition: localfiniteelementtraits.hh:13
LB LocalBasisType
Definition: localfiniteelementtraits.hh:16
LC LocalCoefficientsType
Definition: localfiniteelementtraits.hh:20
LI LocalInterpolationType
Definition: localfiniteelementtraits.hh:24