3#ifndef DUNE_RANNACHER_TUREK_2D_LOCALBASIS_HH
4#define DUNE_RANNACHER_TUREK_2D_LOCALBASIS_HH
12#include <dune/localfunctions/common/localbasis.hh>
17 template<
class D,
class R >
18 struct RannacherTurek2DLocalBasis
20 typedef LocalBasisTraits< D, 2, FieldVector< D, 2 >,
21 R, 1, FieldVector< R, 1 >,
22 FieldMatrix< R, 1, 2 > > Traits;
25 unsigned int size ()
const
32 std::vector< typename Traits::RangeType > &out )
const
36 out[0] = .75 - 2*in[0] + in[1] + qbase;
37 out[1] = -.25 + in[1] + qbase;
38 out[2] = .75 + in[0] - 2*in[1] - qbase;
39 out[3] = -.25 + in[0] - qbase;
44 std::vector< typename Traits::JacobianType > &out )
const
51 out[0][0][0] = -2 + 2*in[0]; out[0][0][1] = 1 - 2*in[1];
52 out[1][0][0] = 2*in[0]; out[1][0][1] = 1 - 2*in[1];
53 out[2][0][0] = 1 - 2*in[0]; out[2][0][1] = -2 + 2*in[1];
54 out[3][0][0] = 1 - 2*in[0]; out[3][0][1] = 2*in[1];
58 void partial (
const std::array<unsigned int, 2>& order,
60 std::vector<typename Traits::RangeType>& out)
const
63 if (totalOrder == 0) {
64 evaluateFunction(in, out);
65 }
else if (totalOrder == 1) {
66 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
71 out[0] = -2 + 2*in[0];
79 out[2] = -2 + 2*in[1];
83 DUNE_THROW(RangeError,
"Component out of range.");
85 }
else if (totalOrder == 2) {
86 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 2));
99 out[0] = out[1] = out[2] = out[3] = 0;
103 out[0] = out[1] = out[2] = out[3] = 0;
108 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:216
T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:331
Dune namespace.
Definition: alignedallocator.hh:10
D DomainType
domain type
Definition: localbasis.hh:43
DF DomainFieldType
Export type for domain field.
Definition: localbasis.hh:34