dune-localfunctions
2.11
Toggle main menu visibility
Loading...
Searching...
No Matches
dune
localfunctions
lagrange
p0
p0localbasis.hh
Go to the documentation of this file.
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
10
#include <dune/common/fmatrix.hh>
11
12
#include <
dune/localfunctions/common/localbasis.hh
>
13
14
namespace
Dune
15
{
29
template
<
class
D,
class
R,
int
d>
30
class
P0LocalBasis
31
{
32
public
:
34
typedef
LocalBasisTraits<D,d,Dune::FieldVector<D,d>
,R,1,Dune::FieldVector<R,1>,
35
Dune::FieldMatrix<R,1,d> >
Traits
;
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
Dune
Definition
bdfmcube.hh:18
Dune::LocalBasisTraits
Type traits for LocalBasisVirtualInterface.
Definition
common/localbasis.hh:35
Dune::LocalBasisTraits< D, d, Dune::FieldVector< D, d >, R, 1, Dune::FieldVector< R, 1 >, Dune::FieldMatrix< R, 1, d > >::DomainType
D DomainType
Definition
common/localbasis.hh:43
Dune::P0LocalBasis
Constant shape function.
Definition
p0localbasis.hh:31
Dune::P0LocalBasis::order
unsigned int order() const
Polynomial order of the shape functions.
Definition
p0localbasis.hh:80
Dune::P0LocalBasis::evaluateJacobian
void evaluateJacobian(const typename Traits::DomainType &, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition
p0localbasis.hh:53
Dune::P0LocalBasis::evaluateFunction
void evaluateFunction(const typename Traits::DomainType &, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition
p0localbasis.hh:44
Dune::P0LocalBasis::partial
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
Dune::P0LocalBasis::size
unsigned int size() const
number of shape functions
Definition
p0localbasis.hh:38
Dune::P0LocalBasis::Traits
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
localbasis.hh
Generated by
1.17.0