dune-localfunctions
2.11
Toggle main menu visibility
Loading...
Searching...
No Matches
dune
localfunctions
whitney
edges0.5
whitney/edges0.5/interpolation.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
6
#ifndef DUNE_LOCALFUNCTIONS_WHITNEY_EDGES0_5_INTERPOLATION_HH
7
#define DUNE_LOCALFUNCTIONS_WHITNEY_EDGES0_5_INTERPOLATION_HH
8
9
#include <cstddef>
10
#include <vector>
11
12
#include <
dune/localfunctions/whitney/edges0.5/common.hh
>
13
14
namespace
Dune
{
15
17
//
18
// Interpolation
19
//
20
22
29
template
<
class
Geometry,
class
Traits_>
30
class
EdgeS0_5Interpolation
:
31
private
EdgeS0_5Common
<Traits_::dimDomainLocal,
32
typename Traits_::DomainField>
33
{
34
public
:
35
typedef
Traits_
Traits
;
36
37
private
:
38
static
const
std::size_t dim = Traits::dimDomainLocal;
39
typedef
EdgeS0_5Common<dim, typename Traits::DomainField>
Base;
40
using
Base::refelem
;
41
using
Base::s
;
42
43
std::vector<typename Traits::DomainGlobal> edgev;
44
45
public
:
47
53
template
<
typename
VertexOrder>
54
EdgeS0_5Interpolation
(
const
Geometry& geo,
55
const
VertexOrder& vertexOrder) :
56
edgev(s)
57
{
58
for
(std::size_t i = 0; i < s; ++i) {
59
const
std::size_t i0 = refelem.subEntity(i,dim-1,0,dim);
60
const
std::size_t i1 = refelem.subEntity(i,dim-1,1,dim);
61
62
edgev[i] = geo.corner(i1);
63
edgev[i] -= geo.corner(i0);
64
edgev[i] /= edgev[i].two_norm();
65
66
const
typename
VertexOrder::iterator& edgeVertexOrder =
67
vertexOrder.begin(dim-1, i);
68
if
(edgeVertexOrder[0] > edgeVertexOrder[1])
69
edgev[i] *= -1;
70
}
71
}
72
74
template
<
typename
F,
typename
C>
75
void
interpolate
(
const
F& f, std::vector<C>& out)
const
{
76
typename
Traits::Range y;
77
78
out.resize(s);
79
80
for
(std::size_t i = 0; i < s; ++i) {
81
y = f(refelem.position(i,dim-1));
82
83
out[i] = y * edgev[i];
84
}
85
}
86
};
87
88
}
// namespace Dune
89
90
#endif
// DUNE_LOCALFUNCTIONS_WHITNEY_EDGES0_5_INTERPOLATION_HH
common.hh
Dune
Definition
bdfmcube.hh:18
Dune::EdgeS0_5Common
Common base class for edge elements.
Definition
common.hh:23
Dune::EdgeS0_5Common< dim, typename Traits::DomainField >::refelem
RefElem refelem
Definition
common.hh:30
Dune::EdgeS0_5Common< dim, typename Traits::DomainField >::s
std::size_t s
Definition
common.hh:38
Dune::EdgeS0_5Interpolation::interpolate
void interpolate(const F &f, std::vector< C > &out) const
Interpolation of a function.
Definition
whitney/edges0.5/interpolation.hh:75
Dune::EdgeS0_5Interpolation< Geometry, typename Basis::Traits >::Traits
typename Basis::Traits Traits
Definition
whitney/edges0.5/interpolation.hh:35
Dune::EdgeS0_5Interpolation::EdgeS0_5Interpolation
EdgeS0_5Interpolation(const Geometry &geo, const VertexOrder &vertexOrder)
constructor
Definition
whitney/edges0.5/interpolation.hh:54
Generated by
1.17.0