3#ifndef DUNE_REFINED_P1_LOCALBASIS_HH
4#define DUNE_REFINED_P1_LOCALBASIS_HH
18 template<
class D,
class R,
int dim>
19 class RefinedP1LocalBasis
20 :
public RefinedSimplexLocalBasis<D,dim>
50 template<
class D,
class R>
51 class RefinedP1LocalBasis<D,R,1>
52 :
public RefinedSimplexLocalBasis<D,1>
60 static constexpr unsigned int size ()
67 std::vector<typename Traits::RangeType>& out)
const
73 this->getSubElement(in, subElement, local);
78 out[0] = 1 - local[0];
86 out[1] = 1 - local[0];
97 std::vector<typename Traits::JacobianType>& out)
const
103 this->getSubElement(in, subElement, local);
105 switch (subElement) {
124 void partial (
const std::array<unsigned int, 1>& order,
126 std::vector<typename Traits::RangeType>& out)
const
128 auto totalOrder = order[0];
129 if (totalOrder == 0) {
130 evaluateFunction(in, out);
131 }
else if (totalOrder == 1)
137 this->getSubElement(in, subElement, local);
139 switch (subElement) {
153 out[0] = out[1] = out[2] = 0;
160 static constexpr unsigned int order ()
191 template<
class D,
class R>
192 class RefinedP1LocalBasis<D,R,2>
193 :
public RefinedSimplexLocalBasis<D,2>
201 static constexpr unsigned int size ()
208 std::vector<typename Traits::RangeType>& out)
const
214 this->getSubElement(in, subElement, local);
216 switch (subElement) {
219 out[0] = 1 - local[0] - local[1];
230 out[1] = 1 - local[0] - local[1];
242 out[3] = 1 - local[0] - local[1];
252 out[4] = 1 - local[0] - local[1];
261 std::vector<typename Traits::JacobianType>& out)
const
267 this->getSubElement(in, subElement, local);
269 switch (subElement) {
272 out[0][0][0] = -2; out[0][0][1] = -2;
273 out[1][0][0] = 2; out[1][0][1] = 0;
274 out[2][0][0] = 0; out[2][0][1] = 0;
275 out[3][0][0] = 0; out[3][0][1] = 2;
276 out[4][0][0] = 0; out[4][0][1] = 0;
277 out[5][0][0] = 0; out[5][0][1] = 0;
282 out[0][0][0] = 0; out[0][0][1] = 0;
283 out[1][0][0] = -2; out[1][0][1] = -2;
284 out[2][0][0] = 2; out[2][0][1] = 0;
285 out[3][0][0] = 0; out[3][0][1] = 0;
286 out[4][0][0] = 0; out[4][0][1] = 2;
287 out[5][0][0] = 0; out[5][0][1] = 0;
292 out[0][0][0] = 0; out[0][0][1] = 0;
293 out[1][0][0] = 0; out[1][0][1] = 0;
294 out[2][0][0] = 0; out[2][0][1] = 0;
295 out[3][0][0] = -2; out[3][0][1] = -2;
296 out[4][0][0] = 2; out[4][0][1] = 0;
297 out[5][0][0] = 0; out[5][0][1] = 2;
301 out[0][0][0] = 0; out[0][0][1] = 0;
302 out[1][0][0] = 0; out[1][0][1] = -2;
303 out[2][0][0] = 0; out[2][0][1] = 0;
304 out[3][0][0] = -2; out[3][0][1] = 0;
305 out[4][0][0] = 2; out[4][0][1] = 2;
306 out[5][0][0] = 0; out[5][0][1] = 0;
311 void partial (
const std::array<unsigned int, 2>& order,
313 std::vector<typename Traits::RangeType>& out)
const
316 if (totalOrder == 0) {
317 evaluateFunction(in, out);
318 }
else if (totalOrder == 1) {
321 this->getSubElement(in, subElement, local);
323 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
326 for (std::size_t i = 0; i < size(); ++i)
332 switch (subElement) {
353 switch (subElement) {
377 for (std::size_t i = 0; i < size(); ++i)
385 static constexpr unsigned int order ()
420 template<
class D,
class R>
421 class RefinedP1LocalBasis<D,R,3>
422 :
public RefinedSimplexLocalBasis<D,3>
430 static constexpr unsigned int size ()
437 std::vector<typename Traits::RangeType>& out)
const
443 this->getSubElement(in, subElement, local);
445 switch (subElement) {
448 out[0] = 1 - local[0] - local[1] - local[2];
463 out[1] = 1 - local[0] - local[1] -local[2];
479 out[3] = 1 - local[0] - local[1] -local[2];
496 out[6] = 1 - local[0] - local[1] -local[2];
505 out[1] = 1 - local[0] - local[1] -local[2];
522 out[4] = 1 - local[0] - local[1] -local[2];
535 out[3] = 1 - local[0] - local[1] -local[2];
549 out[3] = 1 - local[0] - local[1] -local[2];
564 std::vector<typename Traits::JacobianType>& out)
const
570 this->getSubElement(in, subElement, local);
572 switch (subElement) {
575 out[0][0][0] = -2; out[0][0][1] = -2; out[0][0][2] = -2;
576 out[1][0][0] = 2; out[1][0][1] = 0; out[1][0][2] = 0;
577 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
578 out[3][0][0] = 0; out[3][0][1] = 2; out[3][0][2] = 0;
579 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
580 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
581 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 2;
582 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 0;
583 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
584 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
589 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
590 out[1][0][0] = -2; out[1][0][1] = -2; out[1][0][2] = -2;
591 out[2][0][0] = 2; out[2][0][1] = 0; out[2][0][2] = 0;
592 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = 0;
593 out[4][0][0] = 0; out[4][0][1] = 2; out[4][0][2] = 0;
594 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
595 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
596 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 2;
597 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
598 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
603 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
604 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
605 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
606 out[3][0][0] = -2; out[3][0][1] = -2; out[3][0][2] = -2;
607 out[4][0][0] = 2; out[4][0][1] = 0; out[4][0][2] = 0;
608 out[5][0][0] = 0; out[5][0][1] = 2; out[5][0][2] = 0;
609 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
610 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 0;
611 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 2;
612 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
617 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
618 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
619 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
620 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = 0;
621 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
622 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
623 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = -2;
624 out[7][0][0] = 2; out[7][0][1] = 0; out[7][0][2] = 0;
625 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 0;
626 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 2;
631 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
632 out[1][0][0] = 0; out[1][0][1] = -2; out[1][0][2] = -2;
633 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
634 out[3][0][0] = 0; out[3][0][1] = 2; out[3][0][2] = 0;
635 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
636 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
637 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = 0;
638 out[7][0][0] = 2; out[7][0][1] = 2; out[7][0][2] = 2;
639 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
640 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
645 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
646 out[1][0][0] = 0; out[1][0][1] = -2; out[1][0][2] = -2;
647 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
648 out[3][0][0] = -2; out[3][0][1] = 0; out[3][0][2] = 0;
649 out[4][0][0] = 2; out[4][0][1] = 2; out[4][0][2] = 0;
650 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
651 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
652 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 2;
653 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
654 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
659 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
660 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
661 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
662 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = -2;
663 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
664 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
665 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = 0;
666 out[7][0][0] = 2; out[7][0][1] = 0; out[7][0][2] = 0;
667 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 2;
668 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
673 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
674 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
675 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
676 out[3][0][0] = -2; out[3][0][1] = -2; out[3][0][2] = -2;
677 out[4][0][0] = 2; out[4][0][1] = 2; out[4][0][2] = 0;
678 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
679 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
680 out[7][0][0] = 0; out[7][0][1] = -2; out[7][0][2] = 0;
681 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 2;
682 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
688 void partial (
const std::array<unsigned int, 3>& order,
690 std::vector<typename Traits::RangeType>& out)
const
693 if (totalOrder == 0) {
694 evaluateFunction(in, out);
695 }
else if (totalOrder == 1) {
698 this->getSubElement(in, subElement, local);
700 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
703 for (std::size_t i = 0; i < size(); ++i)
709 switch (subElement) {
747 switch (subElement) {
788 switch (subElement) {
829 for (std::size_t i = 0; i < size(); ++i)
837 static constexpr unsigned int order ()
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
Default exception class for range errors.
Definition: exceptions.hh:252
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:57
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: refinedp1localbasis.hh:96
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:160
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:66
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:124
static constexpr unsigned int size()
number of shape functions
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:260
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:198
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:207
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:311
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:385
static constexpr unsigned int size()
number of shape functions
Definition: refinedp1localbasis.hh:201
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:688
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:436
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:427
static constexpr unsigned int size()
number of shape functions
Definition: refinedp1localbasis.hh:430
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:837
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: refinedp1localbasis.hh:563
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
Contains a base class for LocalBasis classes based on uniform refinement.
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:32
D DomainType
domain type
Definition: localbasis.hh:43