5#ifndef DUNE_LOCALFUNCTIONS_ENRICHED_SIMPLEXP1BUBBLE_LOCALBASIS_HH
6#define DUNE_LOCALFUNCTIONS_ENRICHED_SIMPLEXP1BUBBLE_LOCALBASIS_HH
12#include <dune/common/fvector.hh>
13#include <dune/common/fmatrix.hh>
14#include <dune/common/math.hh>
33 template<
class D,
class R,
int dim>
39 using DomainType = FieldVector<D,dim>;
42 using RangeType = FieldVector<R,1>;
45 using JacobianType = FieldMatrix<R,1,dim>;
47 static constexpr int dimension = dim;
48 static constexpr int numVertices = dim+1;
55 static constexpr std::size_t
size () noexcept
62 std::vector<RangeType>& out)
66 out.back() = power(dim+1, dim+1);
67 for (
int i = 0; i < dim; ++i) {
77 std::vector<JacobianType>& out)
81 for (
int i = 0; i < dim; ++i) {
83 for (
int j = 0; j < dim; ++j)
84 out[j+1][0][i] = (i == j);
88 for (
int i = 0; i < dim; ++i) {
89 out.back()[0][i] = power(dim+1, dim+1) * (tmp - in[i]);
90 for (
int j = i+1; j < dim+i; ++j)
91 out.back()[0][i] *= in[j % dim];
96 static constexpr void partial (
const std::array<unsigned int, dim>&
order,
98 std::vector<RangeType>& out)
100 unsigned int totalOrder = 0;
101 for (
int i = 0; i < dim; ++i)
102 totalOrder +=
order[i];
104 switch (totalOrder) {
111 for (
int i = 0; i < dim; ++i)
116 for (
int j = 0; j < dim; ++j) {
120 out.back() = power(dim+1, dim+1) * (tmp - in[d]);
121 for (
int j = d+1; j < dim+d; ++j)
122 out.back() *= in[j % dim];
125 throw std::runtime_error(
"Desired derivative order is not implemented");
130 static constexpr unsigned int order () noexcept
Definition bdfmcube.hh:18
Type traits for LocalBasisVirtualInterface.
Definition common/localbasis.hh:35
P1 basis in dim-d enriched by an (order dim+1) element bubble function.
Definition enriched/simplexp1bubble/localbasis.hh:35
static constexpr void evaluateJacobian(const DomainType &in, std::vector< JacobianType > &out)
Evaluate Jacobian of all shape functions.
Definition enriched/simplexp1bubble/localbasis.hh:76
static constexpr void evaluateFunction(const DomainType &in, std::vector< RangeType > &out)
Evaluate all shape functions.
Definition enriched/simplexp1bubble/localbasis.hh:61
static constexpr void partial(const std::array< unsigned int, dim > &order, const DomainType &in, std::vector< RangeType > &out)
Evaluate partial derivatives of all shape functions.
Definition enriched/simplexp1bubble/localbasis.hh:96
static constexpr unsigned int order() noexcept
Returns maximal polynomial order of the basis functions.
Definition enriched/simplexp1bubble/localbasis.hh:130
static constexpr std::size_t size() noexcept
Returns number of shape functions.
Definition enriched/simplexp1bubble/localbasis.hh:55
Interpolation into the SimplexP1BubbleLocalBasis.
Definition enriched/simplexp1bubble/localinterpolation.hh:34