5#ifndef DUNE_REFINED_P1_LOCALBASIS_HH
6#define DUNE_REFINED_P1_LOCALBASIS_HH
20 template<
class D,
class R,
int dim>
21 class RefinedP1LocalBasis
22 :
public RefinedSimplexLocalBasis<D,dim>
53 template<
class D,
class R>
54 class RefinedP1LocalBasis<D,R,1>
55 :
public RefinedSimplexLocalBasis<D,1>
63 static constexpr unsigned int size ()
70 std::vector<typename Traits::RangeType>& out)
const
76 this->getSubElement(in, subElement, local);
81 out[0] = 1 - local[0];
89 out[1] = 1 - local[0];
100 std::vector<typename Traits::JacobianType>& out)
const
106 this->getSubElement(in, subElement, local);
108 switch (subElement) {
127 void partial (
const std::array<unsigned int, 1>& order,
129 std::vector<typename Traits::RangeType>& out)
const
131 auto totalOrder = order[0];
132 if (totalOrder == 0) {
133 evaluateFunction(in, out);
134 }
else if (totalOrder == 1)
140 this->getSubElement(in, subElement, local);
142 switch (subElement) {
156 out[0] = out[1] = out[2] = 0;
163 static constexpr unsigned int order ()
195 template<
class D,
class R>
196 class RefinedP1LocalBasis<D,R,2>
197 :
public RefinedSimplexLocalBasis<D,2>
205 static constexpr unsigned int size ()
212 std::vector<typename Traits::RangeType>& out)
const
218 this->getSubElement(in, subElement, local);
220 switch (subElement) {
223 out[0] = 1 - local[0] - local[1];
234 out[1] = 1 - local[0] - local[1];
246 out[3] = 1 - local[0] - local[1];
256 out[4] = 1 - local[0] - local[1];
265 std::vector<typename Traits::JacobianType>& out)
const
271 this->getSubElement(in, subElement, local);
273 switch (subElement) {
276 out[0][0][0] = -2; out[0][0][1] = -2;
277 out[1][0][0] = 2; out[1][0][1] = 0;
278 out[2][0][0] = 0; out[2][0][1] = 0;
279 out[3][0][0] = 0; out[3][0][1] = 2;
280 out[4][0][0] = 0; out[4][0][1] = 0;
281 out[5][0][0] = 0; out[5][0][1] = 0;
286 out[0][0][0] = 0; out[0][0][1] = 0;
287 out[1][0][0] = -2; out[1][0][1] = -2;
288 out[2][0][0] = 2; out[2][0][1] = 0;
289 out[3][0][0] = 0; out[3][0][1] = 0;
290 out[4][0][0] = 0; out[4][0][1] = 2;
291 out[5][0][0] = 0; out[5][0][1] = 0;
296 out[0][0][0] = 0; out[0][0][1] = 0;
297 out[1][0][0] = 0; out[1][0][1] = 0;
298 out[2][0][0] = 0; out[2][0][1] = 0;
299 out[3][0][0] = -2; out[3][0][1] = -2;
300 out[4][0][0] = 2; out[4][0][1] = 0;
301 out[5][0][0] = 0; out[5][0][1] = 2;
305 out[0][0][0] = 0; out[0][0][1] = 0;
306 out[1][0][0] = 0; out[1][0][1] = -2;
307 out[2][0][0] = 0; out[2][0][1] = 0;
308 out[3][0][0] = -2; out[3][0][1] = 0;
309 out[4][0][0] = 2; out[4][0][1] = 2;
310 out[5][0][0] = 0; out[5][0][1] = 0;
315 void partial (
const std::array<unsigned int, 2>& order,
317 std::vector<typename Traits::RangeType>& out)
const
320 if (totalOrder == 0) {
321 evaluateFunction(in, out);
322 }
else if (totalOrder == 1) {
325 this->getSubElement(in, subElement, local);
327 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
330 for (std::size_t i = 0; i <
size(); ++i)
336 switch (subElement) {
357 switch (subElement) {
381 for (std::size_t i = 0; i <
size(); ++i)
389 static constexpr unsigned int order ()
425 template<
class D,
class R>
426 class RefinedP1LocalBasis<D,R,3>
427 :
public RefinedSimplexLocalBasis<D,3>
435 static constexpr unsigned int size ()
442 std::vector<typename Traits::RangeType>& out)
const
448 this->getSubElement(in, subElement, local);
450 switch (subElement) {
453 out[0] = 1 - local[0] - local[1] - local[2];
468 out[1] = 1 - local[0] - local[1] -local[2];
484 out[3] = 1 - local[0] - local[1] -local[2];
501 out[6] = 1 - local[0] - local[1] -local[2];
510 out[1] = 1 - local[0] - local[1] -local[2];
527 out[4] = 1 - local[0] - local[1] -local[2];
540 out[3] = 1 - local[0] - local[1] -local[2];
554 out[3] = 1 - local[0] - local[1] -local[2];
569 std::vector<typename Traits::JacobianType>& out)
const
575 this->getSubElement(in, subElement, local);
577 switch (subElement) {
580 out[0][0][0] = -2; out[0][0][1] = -2; out[0][0][2] = -2;
581 out[1][0][0] = 2; out[1][0][1] = 0; out[1][0][2] = 0;
582 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
583 out[3][0][0] = 0; out[3][0][1] = 2; out[3][0][2] = 0;
584 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
585 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
586 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 2;
587 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 0;
588 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
589 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
594 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
595 out[1][0][0] = -2; out[1][0][1] = -2; out[1][0][2] = -2;
596 out[2][0][0] = 2; out[2][0][1] = 0; out[2][0][2] = 0;
597 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = 0;
598 out[4][0][0] = 0; out[4][0][1] = 2; out[4][0][2] = 0;
599 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
600 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
601 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 2;
602 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
603 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
608 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
609 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
610 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
611 out[3][0][0] = -2; out[3][0][1] = -2; out[3][0][2] = -2;
612 out[4][0][0] = 2; out[4][0][1] = 0; out[4][0][2] = 0;
613 out[5][0][0] = 0; out[5][0][1] = 2; out[5][0][2] = 0;
614 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
615 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 0;
616 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 2;
617 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
622 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
623 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
624 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
625 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = 0;
626 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
627 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
628 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = -2;
629 out[7][0][0] = 2; out[7][0][1] = 0; out[7][0][2] = 0;
630 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 0;
631 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 2;
636 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
637 out[1][0][0] = 0; out[1][0][1] = -2; out[1][0][2] = -2;
638 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
639 out[3][0][0] = 0; out[3][0][1] = 2; out[3][0][2] = 0;
640 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
641 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
642 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = 0;
643 out[7][0][0] = 2; out[7][0][1] = 2; out[7][0][2] = 2;
644 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
645 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
650 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
651 out[1][0][0] = 0; out[1][0][1] = -2; out[1][0][2] = -2;
652 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
653 out[3][0][0] = -2; out[3][0][1] = 0; out[3][0][2] = 0;
654 out[4][0][0] = 2; out[4][0][1] = 2; out[4][0][2] = 0;
655 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
656 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
657 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 2;
658 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
659 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
664 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
665 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
666 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
667 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = -2;
668 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
669 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
670 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = 0;
671 out[7][0][0] = 2; out[7][0][1] = 0; out[7][0][2] = 0;
672 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 2;
673 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
678 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
679 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
680 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
681 out[3][0][0] = -2; out[3][0][1] = -2; out[3][0][2] = -2;
682 out[4][0][0] = 2; out[4][0][1] = 2; out[4][0][2] = 0;
683 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
684 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
685 out[7][0][0] = 0; out[7][0][1] = -2; out[7][0][2] = 0;
686 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 2;
687 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
693 void partial (
const std::array<unsigned int, 3>& order,
695 std::vector<typename Traits::RangeType>& out)
const
698 if (totalOrder == 0) {
699 evaluateFunction(in, out);
700 }
else if (totalOrder == 1) {
703 this->getSubElement(in, subElement, local);
705 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
708 for (std::size_t i = 0; i <
size(); ++i)
714 switch (subElement) {
752 switch (subElement) {
793 switch (subElement) {
834 for (std::size_t i = 0; i <
size(); ++i)
842 static constexpr unsigned int order ()
A dense n x m matrix.
Definition: fmatrix.hh:117
vector space out of a tensor product of fields.
Definition: fvector.hh:91
Default exception for dummy implementations.
Definition: exceptions.hh:263
Default exception class for range errors.
Definition: exceptions.hh:254
LocalBasisTraits< D, 1, Dune::FieldVector< D, 1 >, R, 1, Dune::FieldVector< R, 1 >, Dune::FieldMatrix< R, 1, 1 > > Traits
export type traits for function signature
Definition: refinedp1localbasis.hh:60
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: refinedp1localbasis.hh:99
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:163
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:69
void partial(const std::array< unsigned int, 1 > &order, const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate partial derivatives of all shape functions.
Definition: refinedp1localbasis.hh:127
static constexpr unsigned int size()
number of shape functions
Definition: refinedp1localbasis.hh:63
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: refinedp1localbasis.hh:264
LocalBasisTraits< D, 2, Dune::FieldVector< D, 2 >, R, 1, Dune::FieldVector< R, 1 >, Dune::FieldMatrix< R, 1, 2 > > Traits
export type traits for function signature
Definition: refinedp1localbasis.hh:202
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:211
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: refinedp1localbasis.hh:315
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:389
static constexpr unsigned int size()
number of shape functions
Definition: refinedp1localbasis.hh:205
void partial(const std::array< unsigned int, 3 > &order, const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate partial derivatives of all shape functions.
Definition: refinedp1localbasis.hh:693
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:441
LocalBasisTraits< D, 3, Dune::FieldVector< D, 3 >, R, 1, Dune::FieldVector< R, 1 >, Dune::FieldMatrix< R, 1, 3 > > Traits
export type traits for function signature
Definition: refinedp1localbasis.hh:432
static constexpr unsigned int size()
number of shape functions
Definition: refinedp1localbasis.hh:435
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:842
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: refinedp1localbasis.hh:568
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:279
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
Contains a base class for LocalBasis classes based on uniform refinement.
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:35
D DomainType
domain type
Definition: localbasis.hh:43