5#ifndef DUNE_RANNACHER_TUREK_2D_LOCALBASIS_HH
6#define DUNE_RANNACHER_TUREK_2D_LOCALBASIS_HH
14#include <dune/localfunctions/common/localbasis.hh>
22 template<
class D,
class R >
23 struct RannacherTurek2DLocalBasis
25 typedef LocalBasisTraits< D, 2, FieldVector< D, 2 >,
26 R, 1, FieldVector< R, 1 >,
27 FieldMatrix< R, 1, 2 > > Traits;
30 unsigned int size ()
const
37 std::vector< typename Traits::RangeType > &out )
const
41 out[0] = .75 - 2*in[0] + in[1] + qbase;
42 out[1] = -.25 + in[1] + qbase;
43 out[2] = .75 + in[0] - 2*in[1] - qbase;
44 out[3] = -.25 + in[0] - qbase;
49 std::vector< typename Traits::JacobianType > &out )
const
56 out[0][0][0] = -2 + 2*in[0]; out[0][0][1] = 1 - 2*in[1];
57 out[1][0][0] = 2*in[0]; out[1][0][1] = 1 - 2*in[1];
58 out[2][0][0] = 1 - 2*in[0]; out[2][0][1] = -2 + 2*in[1];
59 out[3][0][0] = 1 - 2*in[0]; out[3][0][1] = 2*in[1];
63 void partial (
const std::array<unsigned int, 2>& order,
65 std::vector<typename Traits::RangeType>& out)
const
68 if (totalOrder == 0) {
69 evaluateFunction(in, out);
70 }
else if (totalOrder == 1) {
71 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
76 out[0] = -2 + 2*in[0];
84 out[2] = -2 + 2*in[1];
88 DUNE_THROW(RangeError,
"Component out of range.");
90 }
else if (totalOrder == 2) {
91 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 2));
104 out[0] = out[1] = out[2] = out[3] = 0;
108 out[0] = out[1] = out[2] = out[3] = 0;
113 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,...)
Definition: exceptions.hh:312
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:280
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
D DomainType
domain type
Definition: localbasis.hh:43
DF DomainFieldType
Export type for domain field.
Definition: localbasis.hh:37