3#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS12DLOCALBASIS_HH
4#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS12DLOCALBASIS_HH
11#include "../../common/localbasis.hh"
24 template<
class D,
class R>
34 sign0 = sign1 = sign2 = 1.0;
44 sign0 = sign1 = sign2 = 1.0;
72 std::vector<typename Traits::RangeType>& out)
const
75 out[0][0] = sign0*(in[0] - 4.0*in[0]*in[1]);
76 out[0][1] = sign0*(-1.0 + 5.0*in[1] - 4.0*in[1]*in[1]);
77 out[1][0] = sign1*(-1.0 + 5.0*in[0] - 4.0*in[0]*in[0]);
78 out[1][1] = sign1*(in[1] - 4.0*in[0]*in[1]);
79 out[2][0] = sign2*(-3.0*in[0] + 4.0*in[0]*in[0] + 4.0*in[1]*in[0]);
80 out[2][1] = sign2*(-3.0*in[1] + 4.0*in[0]*in[1] + 4.0*in[1]*in[1]);
81 out[3][0] = -5.0*in[0] + 8.0*in[0]*in[0] + 4.0*in[1]*in[0];
82 out[3][1] = 3.0 - 6.0*in[0] - 7.0*in[1] + 8.0*in[0]*in[1] + 4.0*in[1]*in[1];
83 out[4][0] = -3.0 + 7.0*in[0] + 6.0*in[1] - 4.0*in[0]*in[0] - 8.0*in[1]*in[0];
84 out[4][1] = 5.0*in[1] - 4.0*in[0]*in[1] - 8.0*in[1]*in[1];
85 out[5][0] = in[0] - 4.0*in[0]*in[0] + 4.0*in[1]*in[0];
86 out[5][1] = -1.0*in[1] - 4.0*in[0]*in[1] + 4.0*in[1]*in[1];
87 out[6][0] = 16.0*in[0] - 16.0*in[0]*in[0] - 8.0*in[1]*in[0];
88 out[6][1] = 8.0*in[1] - 16.0*in[0]*in[1] - 8.0*in[1]*in[1];
89 out[7][0] = 8.0*in[0] - 8.0*in[0]*in[0] - 16.0*in[1]*in[0];
90 out[7][1] = 16.0*in[1] - 8.0*in[0]*in[1] - 16.0*in[1]*in[1];
100 std::vector<typename Traits::JacobianType>& out)
const
104 out[0][0][0] = sign0*(1.0 - 4.0*in[1]);
105 out[0][0][1] = sign0*(-4.0*in[0]);
107 out[0][1][1] = sign0*(5.0 - 8.0*in[1]);
109 out[1][0][0] = sign1*(5.0 - 8.0*in[0]);
111 out[1][1][0] = sign1*(-4.0*in[1]);
112 out[1][1][1] = sign1*(1.0 - 4.0*in[0]);
114 out[2][0][0] = sign2*(-3.0 + 8.0*in[0] + 4.0*in[1]);
115 out[2][0][1] = sign2*(4.0*in[0]);
116 out[2][1][0] = sign2*(4.0*in[1]);
117 out[2][1][1] = sign2*(-3.0 + 4.0*in[0] + 8.0*in[1]);
119 out[3][0][0] = -5.0 + 16.0*in[0] + 4.0*in[1];
120 out[3][0][1] = 4.0*in[0];
121 out[3][1][0] = -6.0 + 8.0*in[1];
122 out[3][1][1] = -7.0 + 8.0*in[0] + 8.0*in[1];
124 out[4][0][0] = 7.0 - 8.0*in[0] - 8.0*in[1];
125 out[4][0][1] = 6.0 - 8.0*in[0];
126 out[4][1][0] = -4.0*in[1];
127 out[4][1][1] = 5.0 - 4.0*in[0] - 16.0*in[1];
129 out[5][0][0] = 1.0 - 8.0*in[0] + 4*in[1];
130 out[5][0][1] = 4.0*in[0];
131 out[5][1][0] = -4.0*in[1];
132 out[5][1][1] = -1.0 - 4.0*in[0] + 8.0*in[1];
134 out[6][0][0] = 16.0 - 32.0*in[0] - 8.0*in[1];
135 out[6][0][1] = -8.0*in[0];
136 out[6][1][0] = -16.0*in[1];
137 out[6][1][1] = 8.0 - 16.0*in[0] - 16.0*in[1];
139 out[7][0][0] = 8.0 - 16.0*in[0] - 16.0*in[1];
140 out[7][0][1] = -16.0*in[0];
141 out[7][1][0] = -8.0*in[1];
142 out[7][1][1] = 16.0 - 8.0*in[0] - 32.0*in[1];
148 std::vector<typename Traits::RangeType>& out)
const
151 if (totalOrder == 0) {
153 }
else if (totalOrder == 1) {
154 auto const direction = std::distance(
order.begin(), std::find(
order.begin(),
order.end(), 1));
159 out[0][0] = sign0*(1.0 - 4.0*in[1]);
161 out[1][0] = sign1*(5.0 - 8.0*in[0]);
162 out[1][1] = sign1*(-4.0*in[1]);
163 out[2][0] = sign2*(-3.0 + 8.0*in[0] + 4.0*in[1]);
164 out[2][1] = sign2*(4.0*in[1]);
165 out[3][0] = -5.0 + 16.0*in[0] + 4.0*in[1];
166 out[3][1] = -6.0 + 8.0*in[1];
167 out[4][0] = 7.0 - 8.0*in[0] - 8.0*in[1];
168 out[4][1] = -4.0*in[1];
169 out[5][0] = 1.0 - 8.0*in[0] + 4*in[1];
170 out[5][1] = -4.0*in[1];
171 out[6][0] = 16.0 - 32.0*in[0] - 8.0*in[1];
172 out[6][1] = -16.0*in[1];
173 out[7][0] = 8.0 - 16.0*in[0] - 16.0*in[1];
174 out[7][1] = -8.0*in[1];
177 out[2][1] = sign2*(-3.0 + 4.0*in[0] + 8.0*in[1]);
178 out[2][0] = sign2*(4.0*in[0]);
179 out[1][1] = sign1*(1.0 - 4.0*in[0]);
181 out[0][0] = sign0*(-4.0*in[0]);
182 out[0][1] = sign0*(5.0 - 8.0*in[1]);
183 out[3][0] = 4.0*in[0];
184 out[3][1] = -7.0 + 8.0*in[0] + 8.0*in[1];
185 out[4][0] = 6.0 - 8.0*in[0];
186 out[4][1] = 5.0 - 4.0*in[0] - 16.0*in[1];
187 out[5][0] = 4.0*in[0];
188 out[5][1] = -1.0 - 4.0*in[0] + 8.0*in[1];
189 out[6][0] = -8.0*in[0];
190 out[6][1] = 8.0 - 16.0*in[0] - 16.0*in[1];
191 out[7][0] = -16.0*in[0];
192 out[7][1] = 16.0 - 8.0*in[0] - 32.0*in[1];
209 R sign0, sign1, sign2;
A dense n x m matrix.
Definition: fmatrix.hh:69
vector space out of a tensor product of fields.
Definition: fvector.hh:96
Default exception for dummy implementations.
Definition: exceptions.hh:261
First order Raviart-Thomas shape functions on the reference triangle.
Definition: raviartthomas12dlocalbasis.hh:26
unsigned int size() const
number of shape functions
Definition: raviartthomas12dlocalbasis.hh:60
RT12DLocalBasis()
Standard constructor.
Definition: raviartthomas12dlocalbasis.hh:32
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: raviartthomas12dlocalbasis.hh:146
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: raviartthomas12dlocalbasis.hh:99
unsigned int order() const
Polynomial order of the shape functions.
Definition: raviartthomas12dlocalbasis.hh:203
RT12DLocalBasis(unsigned int s)
Make set number s, where 0 <= s < 8.
Definition: raviartthomas12dlocalbasis.hh:42
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: raviartthomas12dlocalbasis.hh:71
Default exception class for range errors.
Definition: exceptions.hh:252
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
T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:290
Dune namespace.
Definition: alignedallocator.hh:14
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:32
D DomainType
domain type
Definition: localbasis.hh:43