5#ifndef DUNE_RANNACHER_TUREK_2D_LOCALBASIS_HH
6#define DUNE_RANNACHER_TUREK_2D_LOCALBASIS_HH
14#include <dune/localfunctions/common/localbasis.hh>
19 template<
class D,
class R >
20 struct RannacherTurek2DLocalBasis
22 typedef LocalBasisTraits< D, 2, FieldVector< D, 2 >,
23 R, 1, FieldVector< R, 1 >,
24 FieldMatrix< R, 1, 2 > > Traits;
27 unsigned int size ()
const
34 std::vector< typename Traits::RangeType > &out )
const
38 out[0] = .75 - 2*in[0] + in[1] + qbase;
39 out[1] = -.25 + in[1] + qbase;
40 out[2] = .75 + in[0] - 2*in[1] - qbase;
41 out[3] = -.25 + in[0] - qbase;
46 std::vector< typename Traits::JacobianType > &out )
const
53 out[0][0][0] = -2 + 2*in[0]; out[0][0][1] = 1 - 2*in[1];
54 out[1][0][0] = 2*in[0]; out[1][0][1] = 1 - 2*in[1];
55 out[2][0][0] = 1 - 2*in[0]; out[2][0][1] = -2 + 2*in[1];
56 out[3][0][0] = 1 - 2*in[0]; out[3][0][1] = 2*in[1];
60 void partial (
const std::array<unsigned int, 2>& order,
62 std::vector<typename Traits::RangeType>& out)
const
65 if (totalOrder == 0) {
66 evaluateFunction(in, out);
67 }
else if (totalOrder == 1) {
68 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
73 out[0] = -2 + 2*in[0];
81 out[2] = -2 + 2*in[1];
85 DUNE_THROW(RangeError,
"Component out of range.");
87 }
else if (totalOrder == 2) {
88 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 2));
101 out[0] = out[1] = out[2] = out[3] = 0;
105 out[0] = out[1] = out[2] = out[3] = 0;
110 unsigned int order ()
const
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, 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
D DomainType
domain type
Definition: localbasis.hh:42
DF DomainFieldType
Export type for domain field.
Definition: localbasis.hh:36