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>
52 template<
class D,
class R>
53 class RefinedP1LocalBasis<D,R,1>
54 :
public RefinedSimplexLocalBasis<D,1>
62 static constexpr unsigned int size ()
69 std::vector<typename Traits::RangeType>& out)
const
75 this->getSubElement(in, subElement, local);
80 out[0] = 1 - local[0];
88 out[1] = 1 - local[0];
99 std::vector<typename Traits::JacobianType>& out)
const
105 this->getSubElement(in, subElement, local);
107 switch (subElement) {
126 void partial (
const std::array<unsigned int, 1>& order,
128 std::vector<typename Traits::RangeType>& out)
const
130 auto totalOrder = order[0];
131 if (totalOrder == 0) {
132 evaluateFunction(in, out);
133 }
else if (totalOrder == 1)
139 this->getSubElement(in, subElement, local);
141 switch (subElement) {
155 out[0] = out[1] = out[2] = 0;
162 static constexpr unsigned int order ()
193 template<
class D,
class R>
194 class RefinedP1LocalBasis<D,R,2>
195 :
public RefinedSimplexLocalBasis<D,2>
203 static constexpr unsigned int size ()
210 std::vector<typename Traits::RangeType>& out)
const
216 this->getSubElement(in, subElement, local);
218 switch (subElement) {
221 out[0] = 1 - local[0] - local[1];
232 out[1] = 1 - local[0] - local[1];
244 out[3] = 1 - local[0] - local[1];
254 out[4] = 1 - local[0] - local[1];
263 std::vector<typename Traits::JacobianType>& out)
const
269 this->getSubElement(in, subElement, local);
271 switch (subElement) {
274 out[0][0][0] = -2; out[0][0][1] = -2;
275 out[1][0][0] = 2; out[1][0][1] = 0;
276 out[2][0][0] = 0; out[2][0][1] = 0;
277 out[3][0][0] = 0; out[3][0][1] = 2;
278 out[4][0][0] = 0; out[4][0][1] = 0;
279 out[5][0][0] = 0; out[5][0][1] = 0;
284 out[0][0][0] = 0; out[0][0][1] = 0;
285 out[1][0][0] = -2; out[1][0][1] = -2;
286 out[2][0][0] = 2; out[2][0][1] = 0;
287 out[3][0][0] = 0; out[3][0][1] = 0;
288 out[4][0][0] = 0; out[4][0][1] = 2;
289 out[5][0][0] = 0; out[5][0][1] = 0;
294 out[0][0][0] = 0; out[0][0][1] = 0;
295 out[1][0][0] = 0; out[1][0][1] = 0;
296 out[2][0][0] = 0; out[2][0][1] = 0;
297 out[3][0][0] = -2; out[3][0][1] = -2;
298 out[4][0][0] = 2; out[4][0][1] = 0;
299 out[5][0][0] = 0; out[5][0][1] = 2;
303 out[0][0][0] = 0; out[0][0][1] = 0;
304 out[1][0][0] = 0; out[1][0][1] = -2;
305 out[2][0][0] = 0; out[2][0][1] = 0;
306 out[3][0][0] = -2; out[3][0][1] = 0;
307 out[4][0][0] = 2; out[4][0][1] = 2;
308 out[5][0][0] = 0; out[5][0][1] = 0;
313 void partial (
const std::array<unsigned int, 2>& order,
315 std::vector<typename Traits::RangeType>& out)
const
318 if (totalOrder == 0) {
319 evaluateFunction(in, out);
320 }
else if (totalOrder == 1) {
323 this->getSubElement(in, subElement, local);
325 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
328 for (std::size_t i = 0; i < size(); ++i)
334 switch (subElement) {
355 switch (subElement) {
379 for (std::size_t i = 0; i < size(); ++i)
387 static constexpr unsigned int order ()
422 template<
class D,
class R>
423 class RefinedP1LocalBasis<D,R,3>
424 :
public RefinedSimplexLocalBasis<D,3>
432 static constexpr unsigned int size ()
439 std::vector<typename Traits::RangeType>& out)
const
445 this->getSubElement(in, subElement, local);
447 switch (subElement) {
450 out[0] = 1 - local[0] - local[1] - local[2];
465 out[1] = 1 - local[0] - local[1] -local[2];
481 out[3] = 1 - local[0] - local[1] -local[2];
498 out[6] = 1 - local[0] - local[1] -local[2];
507 out[1] = 1 - local[0] - local[1] -local[2];
524 out[4] = 1 - local[0] - local[1] -local[2];
537 out[3] = 1 - local[0] - local[1] -local[2];
551 out[3] = 1 - local[0] - local[1] -local[2];
566 std::vector<typename Traits::JacobianType>& out)
const
572 this->getSubElement(in, subElement, local);
574 switch (subElement) {
577 out[0][0][0] = -2; out[0][0][1] = -2; out[0][0][2] = -2;
578 out[1][0][0] = 2; out[1][0][1] = 0; out[1][0][2] = 0;
579 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
580 out[3][0][0] = 0; out[3][0][1] = 2; out[3][0][2] = 0;
581 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
582 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
583 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 2;
584 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 0;
585 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
586 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
591 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
592 out[1][0][0] = -2; out[1][0][1] = -2; out[1][0][2] = -2;
593 out[2][0][0] = 2; out[2][0][1] = 0; out[2][0][2] = 0;
594 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = 0;
595 out[4][0][0] = 0; out[4][0][1] = 2; out[4][0][2] = 0;
596 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
597 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
598 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 2;
599 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
600 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
605 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
606 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
607 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
608 out[3][0][0] = -2; out[3][0][1] = -2; out[3][0][2] = -2;
609 out[4][0][0] = 2; out[4][0][1] = 0; out[4][0][2] = 0;
610 out[5][0][0] = 0; out[5][0][1] = 2; out[5][0][2] = 0;
611 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
612 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 0;
613 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 2;
614 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
619 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
620 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
621 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
622 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = 0;
623 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
624 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
625 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = -2;
626 out[7][0][0] = 2; out[7][0][1] = 0; out[7][0][2] = 0;
627 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 0;
628 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 2;
633 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
634 out[1][0][0] = 0; out[1][0][1] = -2; out[1][0][2] = -2;
635 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
636 out[3][0][0] = 0; out[3][0][1] = 2; out[3][0][2] = 0;
637 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
638 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
639 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = 0;
640 out[7][0][0] = 2; out[7][0][1] = 2; out[7][0][2] = 2;
641 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
642 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
647 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
648 out[1][0][0] = 0; out[1][0][1] = -2; out[1][0][2] = -2;
649 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
650 out[3][0][0] = -2; out[3][0][1] = 0; out[3][0][2] = 0;
651 out[4][0][0] = 2; out[4][0][1] = 2; out[4][0][2] = 0;
652 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
653 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
654 out[7][0][0] = 0; out[7][0][1] = 0; out[7][0][2] = 2;
655 out[8][0][0] = 0; out[8][0][1] = 0; out[8][0][2] = 0;
656 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
661 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
662 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
663 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
664 out[3][0][0] = 0; out[3][0][1] = 0; out[3][0][2] = -2;
665 out[4][0][0] = 0; out[4][0][1] = 0; out[4][0][2] = 0;
666 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
667 out[6][0][0] = -2; out[6][0][1] = -2; out[6][0][2] = 0;
668 out[7][0][0] = 2; out[7][0][1] = 0; out[7][0][2] = 0;
669 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 2;
670 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
675 out[0][0][0] = 0; out[0][0][1] = 0; out[0][0][2] = 0;
676 out[1][0][0] = 0; out[1][0][1] = 0; out[1][0][2] = 0;
677 out[2][0][0] = 0; out[2][0][1] = 0; out[2][0][2] = 0;
678 out[3][0][0] = -2; out[3][0][1] = -2; out[3][0][2] = -2;
679 out[4][0][0] = 2; out[4][0][1] = 2; out[4][0][2] = 0;
680 out[5][0][0] = 0; out[5][0][1] = 0; out[5][0][2] = 0;
681 out[6][0][0] = 0; out[6][0][1] = 0; out[6][0][2] = 0;
682 out[7][0][0] = 0; out[7][0][1] = -2; out[7][0][2] = 0;
683 out[8][0][0] = 0; out[8][0][1] = 2; out[8][0][2] = 2;
684 out[9][0][0] = 0; out[9][0][1] = 0; out[9][0][2] = 0;
690 void partial (
const std::array<unsigned int, 3>& order,
692 std::vector<typename Traits::RangeType>& out)
const
695 if (totalOrder == 0) {
696 evaluateFunction(in, out);
697 }
else if (totalOrder == 1) {
700 this->getSubElement(in, subElement, local);
702 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
705 for (std::size_t i = 0; i < size(); ++i)
711 switch (subElement) {
749 switch (subElement) {
790 switch (subElement) {
831 for (std::size_t i = 0; i < size(); ++i)
839 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:95
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:59
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: refinedp1localbasis.hh:98
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:162
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:68
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:126
static constexpr unsigned int size()
number of shape functions
Definition: refinedp1localbasis.hh:62
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: refinedp1localbasis.hh:262
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:200
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:209
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:313
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:387
static constexpr unsigned int size()
number of shape functions
Definition: refinedp1localbasis.hh:203
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:690
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: refinedp1localbasis.hh:438
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:429
static constexpr unsigned int size()
number of shape functions
Definition: refinedp1localbasis.hh:432
static constexpr unsigned int order()
Polynomial order of the shape functions Doesn't really apply: these shape functions are only piecewis...
Definition: refinedp1localbasis.hh:839
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: refinedp1localbasis.hh:565
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
Contains a base class for LocalBasis classes based on uniform refinement.
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:34
D DomainType
domain type
Definition: localbasis.hh:42