3#ifndef DUNE_Pk1DLOCALBASIS_HH
4#define DUNE_Pk1DLOCALBASIS_HH
8#include <dune/localfunctions/common/localbasis.hh>
24 template<
class D,
class R,
unsigned int k>
47 for (
unsigned int i=0; i<=k; i++)
48 pos[i] = (1.0*i)/std::max(k,(
unsigned int)1);
59 std::vector<typename Traits::RangeType>& out)
const
63 for (
unsigned int i=0; i<N; i++)
66 for (
unsigned int alpha=0; alpha<i; alpha++)
67 out[i] *= (x[0]-pos[alpha])/(pos[i]-pos[alpha]);
68 for (
unsigned int gamma=i+1; gamma<=k; gamma++)
69 out[i] *= (x[0]-pos[gamma])/(pos[i]-pos[gamma]);
76 std::vector<typename Traits::JacobianType>& out)
const
80 for (
unsigned int i=0; i<=k; i++) {
85 for (
unsigned int a=0; a<i; a++)
88 for (
unsigned int alpha=0; alpha<i; alpha++)
89 product *= (alpha==a) ? 1.0/(pos[i]-pos[alpha])
90 : (x[0]-pos[alpha])/(pos[i]-pos[alpha]);
91 for (
unsigned int gamma=i+1; gamma<=k; gamma++)
92 product *= (pos[gamma]-x[0])/(pos[gamma]-pos[i]);
93 out[i][0][0] += product;
95 for (
unsigned int c=i+1; c<=k; c++)
98 for (
unsigned int alpha=0; alpha<i; alpha++)
99 product *= (x[0]-pos[alpha])/(pos[i]-pos[alpha]);
100 for (
unsigned int gamma=i+1; gamma<=k; gamma++)
101 product *= (gamma==c) ? -1.0/(pos[gamma]-pos[i])
102 : (pos[gamma]-x[0])/(pos[gamma]-pos[i]);
103 out[i][0][0] += product;
116 std::vector<typename Traits::RangeType>& out)
const
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 arbitrary order on the 1D reference triangle.
Definition: pk1dlocalbasis.hh:26
unsigned int order() const
Polynomial order of the shape functions.
Definition: pk1dlocalbasis.hh:128
unsigned int size() const
number of shape functions
Definition: pk1dlocalbasis.hh:52
void evaluateFunction(const typename Traits::DomainType &x, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: pk1dlocalbasis.hh:58
void partial(const std::array< unsigned int, 1 > &order, const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate partial derivatives of any order of all shape functions.
Definition: pk1dlocalbasis.hh:114
void evaluateJacobian(const typename Traits::DomainType &x, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: pk1dlocalbasis.hh:75
Pk1DLocalBasis()
Standard constructor.
Definition: pk1dlocalbasis.hh:45
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
Dune namespace.
Definition: alignedallocator.hh:10
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:32
D DomainType
domain type
Definition: localbasis.hh:43