4#ifndef DUNE_LOCALFUNCTIONS_QKLOCALBASIS_HH
5#define DUNE_LOCALFUNCTIONS_QKLOCALBASIS_HH
15#include <dune/localfunctions/common/localbasis.hh>
16#include <dune/localfunctions/common/localfiniteelementtraits.hh>
33 template<
class D,
class R,
int k,
int d>
37 static R p (
int i, D x)
40 for (
int j=0; j<=k; j++)
41 if (j!=i) result *= (k*x-j)/(i-j);
46 static R dp (
int i, D x)
50 for (
int j=0; j<=k; j++)
53 R prod( (k*1.0)/(i-j) );
54 for (
int l=0; l<=k; l++)
56 prod *= (k*x-l)/(i-l);
64 static R ddp (
int j, D x)
68 for (
int i=0; i<=k; i++)
75 for (
int m=0; m<=k; m++)
80 R prod( (k*1.0)/(j-m) );
81 for (
int l=0; l<=k; l++)
82 if (l!=i && l!=j && l!=m)
83 prod *= (k*x-l)/(j-l);
87 result += sum * ( (k*1.0)/(j-i) );
97 for (
int j=0; j<d; j++)
106 typedef LocalBasisTraits<D,d,Dune::FieldVector<D,d>,R,1,
Dune::FieldVector<R,1>,
Dune::FieldMatrix<R,1,d> >
Traits;
116 std::vector<typename Traits::RangeType>& out)
const
119 for (
size_t i=0; i<
size(); i++)
128 for (
int j=0; j<d; j++)
129 out[i] *= p(alpha[j],in[j]);
139 std::vector<typename Traits::JacobianType>& out)
const
144 for (
size_t i=0; i<
size(); i++)
150 for (
int j=0; j<d; j++)
154 out[i][0][j] = dp(alpha[j],in[j]);
157 for (
int l=0; l<d; l++)
159 out[i][0][j] *= p(alpha[l],in[l]);
171 std::vector<typename Traits::RangeType>& out)
const
176 for (
size_t i=0; i<
size(); i++)
185 for (std::size_t l=0; l<d; l++)
190 out[i][0] *= p(alpha[l],in[l]);
193 out[i][0] *= dp(alpha[l],in[l]);
196 out[i][0] *= ddp(alpha[l],in[l]);
A dense n x m matrix.
Definition: fmatrix.hh:68
vector space out of a tensor product of fields.
Definition: fvector.hh:93
Default exception for dummy implementations.
Definition: exceptions.hh:261
Lagrange shape functions of order k on the reference cube.
Definition: qklocalbasis.hh:35
void partial(const std::array< unsigned int, d > &order, const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate partial derivatives of any order of all shape functions.
Definition: qklocalbasis.hh:169
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: qklocalbasis.hh:115
unsigned int size() const
number of shape functions
Definition: qklocalbasis.hh:109
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: qklocalbasis.hh:138
unsigned int order() const
Polynomial order of the shape functions.
Definition: qklocalbasis.hh:206
Various implementations of the power function for run-time and static arguments.
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
Dune namespace.
Definition: alignedallocator.hh:10
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:32
D DomainType
domain type
Definition: localbasis.hh:43
Calculates m^p at compile time.
Definition: power.hh:20
A unique label for each type of element that can occur in a grid.