DUNE PDELab (git)

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// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_P0LOCALBASIS_HH
6#define DUNE_P0LOCALBASIS_HH
7
8#include <numeric>
9
11
12#include <dune/localfunctions/common/localbasis.hh>
13
14namespace Dune
15{
29 template<class D, class R, int d>
31 {
32 public:
36
38 unsigned int size () const
39 {
40 return 1;
41 }
42
44 inline void evaluateFunction (const typename Traits::DomainType&,
45 std::vector<typename Traits::RangeType>& out) const
46 {
47 out.resize(1);
48 out[0] = 1;
49 }
50
52 inline void
53 evaluateJacobian (const typename Traits::DomainType&, // position
54 std::vector<typename Traits::JacobianType>& out) const // return value
55 {
56 out.resize(1);
57 for (int i=0; i<d; i++)
58 out[0][0][i] = 0;
59 }
60
66 void partial(const std::array<unsigned int,d>& order,
67 const typename Traits::DomainType& in,
68 std::vector<typename Traits::RangeType>& out) const
69 {
70 auto totalOrder = std::accumulate(order.begin(), order.end(), 0);
71 if (totalOrder == 0) {
72 evaluateFunction(in, out);
73 } else {
74 out.resize(1);
75 out[0] = 0;
76 }
77 }
78
80 unsigned int order () const
81 {
82 return 0;
83 }
84 };
85
86}
87
88#endif
A dense n x m matrix.
Definition: fmatrix.hh:117
vector space out of a tensor product of fields.
Definition: fvector.hh:91
Definition: p0localbasis.hh:31
unsigned int order() const
Polynomial order of the shape functions.
Definition: p0localbasis.hh:80
void evaluateJacobian(const typename Traits::DomainType &, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: p0localbasis.hh:53
void evaluateFunction(const typename Traits::DomainType &, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: p0localbasis.hh:44
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:66
unsigned int size() const
number of shape functions
Definition: p0localbasis.hh:38
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:35
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:279
Dune namespace.
Definition: alignedallocator.hh:13
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:35
D DomainType
domain type
Definition: localbasis.hh:43
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)