5#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS12DLOCALBASIS_HH
6#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS12DLOCALBASIS_HH
13#include "../../common/localbasis.hh"
26 template<
class D,
class R>
41 for (
size_t i=0; i<3; i++)
42 sign_[i] = (s[i]) ? -1.0 : 1.0;
58 std::vector<typename Traits::RangeType>& out)
const
61 out[0][0] = sign_[0]*(in[0] - 4.0*in[0]*in[1]);
62 out[0][1] = sign_[0]*(-1.0 + 5.0*in[1] - 4.0*in[1]*in[1]);
63 out[1][0] = sign_[1]*(-1.0 + 5.0*in[0] - 4.0*in[0]*in[0]);
64 out[1][1] = sign_[1]*(in[1] - 4.0*in[0]*in[1]);
65 out[2][0] = sign_[2]*(-3.0*in[0] + 4.0*in[0]*in[0] + 4.0*in[1]*in[0]);
66 out[2][1] = sign_[2]*(-3.0*in[1] + 4.0*in[0]*in[1] + 4.0*in[1]*in[1]);
67 out[3][0] = -5.0*in[0] + 8.0*in[0]*in[0] + 4.0*in[1]*in[0];
68 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];
69 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];
70 out[4][1] = 5.0*in[1] - 4.0*in[0]*in[1] - 8.0*in[1]*in[1];
71 out[5][0] = in[0] - 4.0*in[0]*in[0] + 4.0*in[1]*in[0];
72 out[5][1] = -1.0*in[1] - 4.0*in[0]*in[1] + 4.0*in[1]*in[1];
73 out[6][0] = 16.0*in[0] - 16.0*in[0]*in[0] - 8.0*in[1]*in[0];
74 out[6][1] = 8.0*in[1] - 16.0*in[0]*in[1] - 8.0*in[1]*in[1];
75 out[7][0] = 8.0*in[0] - 8.0*in[0]*in[0] - 16.0*in[1]*in[0];
76 out[7][1] = 16.0*in[1] - 8.0*in[0]*in[1] - 16.0*in[1]*in[1];
86 std::vector<typename Traits::JacobianType>& out)
const
90 out[0][0][0] = sign_[0]*(1.0 - 4.0*in[1]);
91 out[0][0][1] = sign_[0]*(-4.0*in[0]);
93 out[0][1][1] = sign_[0]*(5.0 - 8.0*in[1]);
95 out[1][0][0] = sign_[1]*(5.0 - 8.0*in[0]);
97 out[1][1][0] = sign_[1]*(-4.0*in[1]);
98 out[1][1][1] = sign_[1]*(1.0 - 4.0*in[0]);
100 out[2][0][0] = sign_[2]*(-3.0 + 8.0*in[0] + 4.0*in[1]);
101 out[2][0][1] = sign_[2]*(4.0*in[0]);
102 out[2][1][0] = sign_[2]*(4.0*in[1]);
103 out[2][1][1] = sign_[2]*(-3.0 + 4.0*in[0] + 8.0*in[1]);
105 out[3][0][0] = -5.0 + 16.0*in[0] + 4.0*in[1];
106 out[3][0][1] = 4.0*in[0];
107 out[3][1][0] = -6.0 + 8.0*in[1];
108 out[3][1][1] = -7.0 + 8.0*in[0] + 8.0*in[1];
110 out[4][0][0] = 7.0 - 8.0*in[0] - 8.0*in[1];
111 out[4][0][1] = 6.0 - 8.0*in[0];
112 out[4][1][0] = -4.0*in[1];
113 out[4][1][1] = 5.0 - 4.0*in[0] - 16.0*in[1];
115 out[5][0][0] = 1.0 - 8.0*in[0] + 4*in[1];
116 out[5][0][1] = 4.0*in[0];
117 out[5][1][0] = -4.0*in[1];
118 out[5][1][1] = -1.0 - 4.0*in[0] + 8.0*in[1];
120 out[6][0][0] = 16.0 - 32.0*in[0] - 8.0*in[1];
121 out[6][0][1] = -8.0*in[0];
122 out[6][1][0] = -16.0*in[1];
123 out[6][1][1] = 8.0 - 16.0*in[0] - 16.0*in[1];
125 out[7][0][0] = 8.0 - 16.0*in[0] - 16.0*in[1];
126 out[7][0][1] = -16.0*in[0];
127 out[7][1][0] = -8.0*in[1];
128 out[7][1][1] = 16.0 - 8.0*in[0] - 32.0*in[1];
134 std::vector<typename Traits::RangeType>& out)
const
137 if (totalOrder == 0) {
139 }
else if (totalOrder == 1) {
140 auto const direction = std::distance(
order.begin(), std::find(
order.begin(),
order.end(), 1));
145 out[0][0] = sign_[0]*(1.0 - 4.0*in[1]);
147 out[1][0] = sign_[1]*(5.0 - 8.0*in[0]);
148 out[1][1] = sign_[1]*(-4.0*in[1]);
149 out[2][0] = sign_[2]*(-3.0 + 8.0*in[0] + 4.0*in[1]);
150 out[2][1] = sign_[2]*(4.0*in[1]);
151 out[3][0] = -5.0 + 16.0*in[0] + 4.0*in[1];
152 out[3][1] = -6.0 + 8.0*in[1];
153 out[4][0] = 7.0 - 8.0*in[0] - 8.0*in[1];
154 out[4][1] = -4.0*in[1];
155 out[5][0] = 1.0 - 8.0*in[0] + 4*in[1];
156 out[5][1] = -4.0*in[1];
157 out[6][0] = 16.0 - 32.0*in[0] - 8.0*in[1];
158 out[6][1] = -16.0*in[1];
159 out[7][0] = 8.0 - 16.0*in[0] - 16.0*in[1];
160 out[7][1] = -8.0*in[1];
163 out[2][1] = sign_[2]*(-3.0 + 4.0*in[0] + 8.0*in[1]);
164 out[2][0] = sign_[2]*(4.0*in[0]);
165 out[1][1] = sign_[1]*(1.0 - 4.0*in[0]);
167 out[0][0] = sign_[0]*(-4.0*in[0]);
168 out[0][1] = sign_[0]*(5.0 - 8.0*in[1]);
169 out[3][0] = 4.0*in[0];
170 out[3][1] = -7.0 + 8.0*in[0] + 8.0*in[1];
171 out[4][0] = 6.0 - 8.0*in[0];
172 out[4][1] = 5.0 - 4.0*in[0] - 16.0*in[1];
173 out[5][0] = 4.0*in[0];
174 out[5][1] = -1.0 - 4.0*in[0] + 8.0*in[1];
175 out[6][0] = -8.0*in[0];
176 out[6][1] = 8.0 - 16.0*in[0] - 16.0*in[1];
177 out[7][0] = -16.0*in[0];
178 out[7][1] = 16.0 - 8.0*in[0] - 32.0*in[1];
195 std::array<R,3> sign_;
A dense n x m matrix.
Definition: fmatrix.hh:117
Default exception for dummy implementations.
Definition: exceptions.hh:263
First order Raviart-Thomas shape functions on the reference triangle.
Definition: raviartthomas12dlocalbasis.hh:28
RT12DLocalBasis(std::bitset< 3 > s=0)
Make set number s, where 0 <= s < 8.
Definition: raviartthomas12dlocalbasis.hh:39
unsigned int size() const
number of shape functions
Definition: raviartthomas12dlocalbasis.hh:46
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:132
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: raviartthomas12dlocalbasis.hh:85
unsigned int order() const
Polynomial order of the shape functions.
Definition: raviartthomas12dlocalbasis.hh:189
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: raviartthomas12dlocalbasis.hh:57
Default exception class for range errors.
Definition: exceptions.hh:254
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:279
Dune namespace.
Definition: alignedallocator.hh:13
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:35
D DomainType
domain type
Definition: localbasis.hh:43