3#ifndef DUNE_LOCALFUNCTIONS_BREZZIDOUGLASFORTINMARINI_CUBE_LOCALBASIS_HH
4#define DUNE_LOCALFUNCTIONS_BREZZIDOUGLASFORTINMARINI_CUBE_LOCALBASIS_HH
18#include <dune/localfunctions/common/localbasis.hh>
33 template<
class D,
class R,
unsigned int dim,
unsigned int order>
37 "`BDFMCubeLocalBasis` not implemented for chosen `dim` and `order`." );
42 template<
class D,
class R,
unsigned int dim>
46 "`BDFMCubeLocalBasis` not defined for order 0." );
56 template<
class D,
class R >
69 std::fill(s_.begin(), s_.end(), 1);
79 for (
auto i : range(4))
80 s_[i] = s[i] ? -1 : 1;
84 unsigned int size ()
const {
return 4; }
96 out[0] = {s_[0]*(in[0]-1), 0 };
97 out[1] = {s_[1]*(in[0]) , 0 };
98 out[2] = {0, s_[2]*(in[1]-1)};
99 out[3] = {0, s_[3]*(in[1]) };
112 out[0] = {{s_[0], 0}, {0, 0}};
113 out[1] = {{s_[1], 0}, {0, 0}};
114 out[2] = {{0, 0}, {0, s_[2]}};
115 out[3] = {{0, 0}, {0, s_[3]}};
125 void partial (
const std::array<unsigned int, 2>& order,
127 std::vector<RangeType>& out)
const
130 evaluateFunction(in, out);
136 unsigned int order ()
const {
return 1; }
148 template<
class D,
class R >
161 std::fill(s_.begin(), s_.end(), 1);
171 for (
auto i : range(4))
172 s_[i] = s[i] ? -1 : 1;
176 unsigned int size ()
const {
return 10; }
188 const auto& x = in[0];
189 const auto& y = in[1];
192 out[0] = {pre*s_[0]*(3*x-1), 0};
193 out[1] = { pre*3*(2*y-1), 0};
196 out[2] = {pre*s_[1]*(3*x-2), 0};
197 out[3] = {pre* 3*(2*y-1), 0};
200 out[4] = {0, pre*s_[2]*(3*y-1)};
201 out[5] = {0, pre*3*(2*x-1)};
204 out[6] = {0, pre*s_[3]*(3*y-2)};
205 out[7] = {0, pre*3*(2*x-1)};
207 out[8] = {6*x*(1-x), 0};
209 out[9] = {0, 6*y*(1-y)};
222 const auto& x = in[0];
223 const auto& y = in[1];
225 out[0] = {{s_[0]*(4-6*x), 0}, {0, 0}};
226 out[1] = {{3-6*y, 6-6*x}, {0, 0}};
228 out[2] = {{s_[1]*(6*x-2), 0}, {0, 0}};
229 out[3] = {{6*y-3, 6*x}, {0, 0}};
231 out[4] = {{0, 0}, {0, s_[2]*(4-6*y)}};
232 out[5] = {{0, 0}, {6-6*y, 3-6*x}};
234 out[6] = {{0, 0}, {0, s_[3]*(6*y-2)}};
235 out[7] = {{0, 0}, {6*y, 6*x-3}};
237 out[8] = {{6-12*x, 0}, {0, 0}};
239 out[9] = {{0, 0}, {0, 6-12*y}};
249 void partial (
const std::array<unsigned int, 2>& order,
251 std::vector<RangeType>& out)
const
254 evaluateFunction(in, out);
260 unsigned int order ()
const {
return 2; }
272 template<
class D,
class R >
285 std::fill(s_.begin(), s_.end(), 1);
295 for (
auto i : range(4))
296 s_[i] = s[i] ? -1 : 1;
300 unsigned int size ()
const {
return 18; }
312 const auto& x = in[0];
313 const auto& y = in[1];
316 out[0] = {pre*s_[0]*-1*(10*x*x-8*x+1), 0};
317 out[1] = {pre* 3*(1-3*x)*(2*y-1), 0};
318 out[2] = {pre* s_[0]*-5*(6*y*y-6*y+1), 0};
321 out[3] = {pre*s_[1]*(10*x*x-12*x+3), 0};
322 out[4] = {pre* 3*(3*x-2)*(2*y-1), 0};
323 out[5] = {pre*s_[1]*5*(6*y*y-6*y+1), 0};
326 out[6] = {0, pre*s_[2]*-1*(10*y*y-8*y+1)};
327 out[7] = {0, pre* 3*(1-3*y)*(2*x-1)};
328 out[8] = {0, pre*s_[2]*-5*( 6*x*x-6*x+1)};
331 out[9] = {0, pre*s_[3]*(10*y*y-12*y+3)};
332 out[10] = {0, pre* 3*(3*y-2)*(2*x-1)};
333 out[11] = {0, pre*s_[3]*5*(6*x*x-6*x+1)};
336 out[12] = {pre* 6 , 0};
337 out[14] = {pre*30*(2*x-1), 0};
338 out[16] = {pre*18*(2*y-1), 0};
341 out[13] = {0, pre* 6 };
342 out[15] = {0, pre*18*(2*x-1)};
343 out[17] = {0, pre*30*(2*y-1)};
356 const auto& x = in[0];
357 const auto& y = in[1];
359 out[0] = {{s_[0]*(30*x*x-36*x+9), 0}, {0, 0}};
360 out[1] = {{ 6*(6*x*y-3*x-4*y+2), 6*(3*x*x-4*x+1)}, {0, 0}};
361 out[2] = {{s_[0]*5*(6*y*y-6*y+1), s_[0]*30*(x-1)*(2*y-1)}, {0, 0}};
363 out[3] = {{ s_[1]*30*x*x-24*x+3, 0}, {0, 0}};
364 out[4] = {{ 6*(3*x-1)*(2*y-1), 6*x*(3*x-2)}, {0, 0}};
365 out[5] = {{s_[1]*5*(6*y*y-6*y+1), s_[1]*30*x*(2*y-1)}, {0, 0}};
367 out[6] = {{0, 0}, { 0, s_[2]*(30*y*y-36*y+9)}};
368 out[7] = {{0, 0}, { 6*(3*y*y-4*y+1), 6*(6*y*x-3*y-4*x+2)}};
369 out[8] = {{0, 0}, {s_[2]*30*(y-1)*(2*x-1), s_[2]*5*(6*x*x-6*x+1)}};
371 out[9] = {{0, 0}, { 0, s_[3]*30*y*y-24*y+3}};
372 out[10] = {{0, 0}, { 6*y*(3*y-2), 6*(3*y-1)*(2*x-1)}};
373 out[11] = {{0, 0}, {s_[3]*30*y*(2*x-1), s_[3]*5*(6*x*x-6*x+1)}};
375 out[12] = {{ -6*(2*x-1), 0}, {0, 0}};
376 out[14] = {{ -30*(6*x*x-6*x+1), 0}, {0, 0}};
377 out[16] = {{-18*(2*x-1)*(2*y-1), 36*x*(1-x)}, {0, 0}};
379 out[13] = {{0, 0}, { 0, -6*(2*y-1)}};
380 out[15] = {{0, 0}, {36*y*(1-y), -18*(2*y-1)*(2*x-1)}};
381 out[17] = {{0, 0}, { 0, -30*(6*y*y-6*y+1)}};
391 void partial (
const std::array<unsigned int, 2>& order,
393 std::vector<RangeType>& out)
const
396 evaluateFunction(in, out);
402 unsigned int order ()
const {
return 3; }
unsigned int size() const
number of shape functions
Definition: localbasis.hh:84
unsigned int order() const
Polynomial order of the shape functions.
Definition: localbasis.hh:136
void evaluateFunction(const DomainType &in, std::vector< RangeType > &out) const
Evaluate all shape functions.
Definition: localbasis.hh:92
BDFMCubeLocalBasis()
Standard constructor.
Definition: localbasis.hh:67
void partial(const std::array< unsigned int, 2 > &order, const DomainType &in, std::vector< RangeType > &out) const
Evaluate all partial derivatives of all shape functions.
Definition: localbasis.hh:125
void evaluateJacobian(const DomainType &in, std::vector< JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: localbasis.hh:108
BDFMCubeLocalBasis(std::bitset< 4 > s)
Make set number s, where 0<= s < 16.
Definition: localbasis.hh:77
void evaluateFunction(const DomainType &in, std::vector< RangeType > &out) const
Evaluate all shape functions.
Definition: localbasis.hh:184
void partial(const std::array< unsigned int, 2 > &order, const DomainType &in, std::vector< RangeType > &out) const
Evaluate all partial derivatives of all shape functions.
Definition: localbasis.hh:249
unsigned int size() const
number of shape functions
Definition: localbasis.hh:176
BDFMCubeLocalBasis()
Standard constructor.
Definition: localbasis.hh:159
void evaluateJacobian(const DomainType &in, std::vector< JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: localbasis.hh:218
unsigned int order() const
Polynomial order of the shape functions.
Definition: localbasis.hh:260
BDFMCubeLocalBasis(std::bitset< 4 > s)
Make set number s, where 0<= s < 16.
Definition: localbasis.hh:169
BDFMCubeLocalBasis()
Standard constructor.
Definition: localbasis.hh:283
void evaluateJacobian(const DomainType &in, std::vector< JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: localbasis.hh:352
BDFMCubeLocalBasis(std::bitset< 4 > s)
Make set number s, where 0<= s < 16.
Definition: localbasis.hh:293
unsigned int size() const
number of shape functions
Definition: localbasis.hh:300
unsigned int order() const
Polynomial order of the shape functions.
Definition: localbasis.hh:402
void evaluateFunction(const DomainType &in, std::vector< RangeType > &out) const
Evaluate all shape functions.
Definition: localbasis.hh:308
void partial(const std::array< unsigned int, 2 > &order, const DomainType &in, std::vector< RangeType > &out) const
Evaluate all partial derivatives of all shape functions.
Definition: localbasis.hh:391
Brezzi-Douglas-Fortin-Marini shape functions on a reference cube.
Definition: localbasis.hh:35
A dense n x m matrix.
Definition: fmatrix.hh:69
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Default exception for dummy implementations.
Definition: exceptions.hh:261
Traits for type conversions and type information.
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
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:289
Some useful basic math stuff.
Dune namespace.
Definition: alignedallocator.hh:11
Utilities for reduction like operations on ranges.
template which always yields a false value
Definition: typetraits.hh:124
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:32