5#ifndef DUNE_DUAL_P1_LOCALBASIS_HH
6#define DUNE_DUAL_P1_LOCALBASIS_HH
10#include <dune/common/fvector.hh>
11#include <dune/common/fmatrix.hh>
33 template<
class D,
class R,
int dim,
bool faceDualT=false>
51 std::vector<typename Traits::RangeType>& out)
const
54 std::vector<typename Traits::RangeType> p1Values(
size());
58 for (
int i=0; i<dim; i++) {
60 p1Values[i+1] = in[i];
66 for (
int i=0; i<=dim; i++) {
67 out[i] = (dim+!
faceDual)*p1Values[i];
68 for (
int j=0; j<i; j++)
69 out[i] -= p1Values[j];
71 for (
int j=i+1; j<=dim; j++)
72 out[i] -= p1Values[j];
79 std::vector<typename Traits::JacobianType>& out)
const
82 std::vector<typename Traits::JacobianType> p1Jacs(
size());
84 for (
int i=0; i<dim; i++)
87 for (
int i=0; i<dim; i++)
88 for (
int j=0; j<dim; j++)
89 p1Jacs[i+1][0][j] = (i==j);
94 for (
size_t i=0; i<=dim; i++) {
96 out[i][0].axpy(dim+!
faceDual,p1Jacs[i][0]);
98 for (
size_t j=0; j<i; j++)
99 out[i][0] -= p1Jacs[j][0];
101 for (
int j=i+1; j<=dim; j++)
102 out[i][0] -= p1Jacs[j][0];
109 std::vector<typename Traits::RangeType>& out)
const
111 auto totalOrder = std::accumulate(
order.begin(),
order.end(), 0);
112 if (totalOrder == 0) {
115 DUNE_THROW(NotImplemented,
"Desired derivative order is not implemented");
Definition bdfmcube.hh:18
Type traits for LocalBasisVirtualInterface.
Definition common/localbasis.hh:35
D DomainType
domain type
Definition common/localbasis.hh:43
Dual Lagrange shape functions on the simplex.
Definition dualp1localbasis.hh:35
unsigned int order() const
Polynomial order of the shape functions.
Definition dualp1localbasis.hh:120
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition dualp1localbasis.hh:50
static const bool faceDual
Determines if the basis is only biorthogonal on adjacent faces.
Definition dualp1localbasis.hh:38
void partial(const std::array< unsigned int, dim > &order, const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate partial derivatives of all shape functions.
Definition dualp1localbasis.hh:107
unsigned int size() const
number of shape functions
Definition dualp1localbasis.hh:44
LocalBasisTraits< D, dim, Dune::FieldVector< D, dim >, R, 1, Dune::FieldVector< R, 1 >, Dune::FieldMatrix< R, 1, dim > > Traits
export type traits for function signature
Definition dualp1localbasis.hh:41
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition dualp1localbasis.hh:78