DUNE PDELab (2.8)

p0localbasis.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_P0LOCALBASIS_HH
4#define DUNE_P0LOCALBASIS_HH
5
6#include <numeric>
7
9
10#include <dune/localfunctions/common/localbasis.hh>
11
12namespace Dune
13{
26 template<class D, class R, int d>
28 {
29 public:
33
35 unsigned int size () const
36 {
37 return 1;
38 }
39
41 inline void evaluateFunction (const typename Traits::DomainType&,
42 std::vector<typename Traits::RangeType>& out) const
43 {
44 out.resize(1);
45 out[0] = 1;
46 }
47
49 inline void
50 evaluateJacobian (const typename Traits::DomainType&, // position
51 std::vector<typename Traits::JacobianType>& out) const // return value
52 {
53 out.resize(1);
54 for (int i=0; i<d; i++)
55 out[0][0][i] = 0;
56 }
57
63 void partial(const std::array<unsigned int,d>& order,
64 const typename Traits::DomainType& in,
65 std::vector<typename Traits::RangeType>& out) const
66 {
67 auto totalOrder = std::accumulate(order.begin(), order.end(), 0);
68 if (totalOrder == 0) {
69 evaluateFunction(in, out);
70 } else {
71 out.resize(1);
72 out[0] = 0;
73 }
74 }
75
77 unsigned int order () const
78 {
79 return 0;
80 }
81 };
82
83}
84
85#endif
A dense n x m matrix.
Definition: fmatrix.hh:69
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Constant shape function.
Definition: p0localbasis.hh:28
unsigned int order() const
Polynomial order of the shape functions.
Definition: p0localbasis.hh:77
void evaluateJacobian(const typename Traits::DomainType &, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: p0localbasis.hh:50
void evaluateFunction(const typename Traits::DomainType &, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: p0localbasis.hh:41
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: p0localbasis.hh:63
unsigned int size() const
number of shape functions
Definition: p0localbasis.hh:35
LocalBasisTraits< D, d, Dune::FieldVector< D, d >, R, 1, Dune::FieldVector< R, 1 >, Dune::FieldMatrix< R, 1, d > > Traits
export type traits for function signature
Definition: p0localbasis.hh:32
Implements a matrix constructed from a given type representing a field and compile-time given number ...
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:289
Dune namespace.
Definition: alignedallocator.hh:11
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:32
D DomainType
domain type
Definition: localbasis.hh:43
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)