3 #ifndef DUNE_RANNACHER_TUREK_3D_LOCALBASIS_HH 4 #define DUNE_RANNACHER_TUREK_3D_LOCALBASIS_HH 9 #include <dune/common/fvector.hh> 10 #include <dune/common/fmatrix.hh> 17 template<
class D,
class R >
20 static const int coefficients[ 6 ][ 6 ];
24 R, 1, FieldVector< R, 1 >,
35 std::vector< typename Traits::RangeType > &out )
const 38 RangeFieldType y[ 6 ] = { 1, in[ 0 ], in[ 1 ], in[ 2 ],
39 in[ 0 ]*in[ 0 ] - in[ 1 ]*in[ 1 ],
40 in[ 1 ]*in[ 1 ] - in[ 2 ]*in[ 2 ] };
42 for(
unsigned int i = 0; i <
size(); ++i )
44 out[ i ] = RangeFieldType( 0 );
45 for(
unsigned int j = 0; j < 6; ++j )
46 out[ i ] += coefficients[ i ][ j ]*y[ j ];
47 out[ i ] /= RangeFieldType( 3 );
53 std::vector< typename Traits::JacobianType > &out )
const 56 RangeFieldType y0[ 5 ] = { 1, 0, 0, 2*in[ 0 ], 0 };
57 RangeFieldType y1[ 5 ] = { 0, 1, 0, -2*in[ 1 ], 2*in[ 1 ] };
58 RangeFieldType y2[ 5 ] = { 0, 0, 1, 0, -2*in[ 2 ] };
61 for(
unsigned int i = 0; i <
size(); ++i )
63 out[ i ] = RangeFieldType( 0 );
64 for(
unsigned int j = 0; j < 5; ++j )
66 out[ i ][ 0 ][ 0 ] += coefficients[ i ][ j+1 ]*y0[ j ];
67 out[ i ][ 0 ][ 1 ] += coefficients[ i ][ j+1 ]*y1[ j ];
68 out[ i ][ 0 ][ 2 ] += coefficients[ i ][ j+1 ]*y2[ j ];
70 out[ i ] /= RangeFieldType( 3 );
77 std::vector<typename Traits::RangeType>& out)
const 79 auto totalOrder = std::accumulate(
order.begin(),
order.end(), 0);
80 if (totalOrder == 0) {
82 }
else if (totalOrder == 1) {
84 auto const direction = std::distance(
order.begin(), std::find(
order.begin(),
order.end(), 1));
87 RangeFieldType y[3][5] = { { 1.0, 0.0, 0.0, 2*in[0], 0.0 },
88 { 0.0, 1.0, 0.0, -2*in[1], 2*in[1] },
89 { 0.0, 0.0, 1.0, 0.0, -2*in[2] } };
91 for (std::size_t i = 0; i <
size(); ++i) {
92 out[i] = RangeFieldType{0};
93 for (std::size_t j = 0; j < 5; ++j)
94 out[i] += coefficients[i][j+1] * y[direction][j];
95 out[i] /= RangeFieldType{3};
98 DUNE_THROW(NotImplemented,
"Desired derivative order is not implemented");
114 template<
class D,
class R >
116 ::coefficients[ 6 ][ 6 ] = {{ 2, -7, 2, 2, 4, 2 },
117 { -1, -1, 2, 2, 4, 2 },
118 { 2, 2, -7, 2, -2, 2 },
119 { -1, 2, -1, 2, -2, 2 },
120 { 2, 2, 2, -7, -2, -4 },
121 { -1, 2, 2, -1, -2, -4 }};
125 #endif // #ifndef DUNE_RANNACHER_TUREK_3D_LOCALBASIS_HH void partial(const std::array< unsigned int, 3 > &order, const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate partial derivatives of all shape functions.
Definition: rannacherturek3dlocalbasis.hh:75
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:31
D DomainType
domain type
Definition: localbasis.hh:43
LocalBasisTraits< D, 3, FieldVector< D, 3 >, R, 1, FieldVector< R, 1 >, FieldMatrix< R, 1, 3 > > Traits
Definition: rannacherturek3dlocalbasis.hh:25
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
evaluate all shape functions
Definition: rannacherturek3dlocalbasis.hh:34
Definition: brezzidouglasmarini1cube2dlocalbasis.hh:15
Definition: rannacherturek3dlocalbasis.hh:18
RF RangeFieldType
Export type for range field.
Definition: localbasis.hh:46
unsigned int size() const
number of shape functions
Definition: rannacherturek3dlocalbasis.hh:28
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
evaluate jacobian of all shape functions
Definition: rannacherturek3dlocalbasis.hh:52
unsigned int order() const
polynomial order of the shape functions
Definition: rannacherturek3dlocalbasis.hh:103