dune-localfunctions
3.0-git
dune
localfunctions
lagrange
p1
p1localinterpolation.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
#ifndef DUNE_P1_LOCALINTERPOLATION_HH
4
#define DUNE_P1_LOCALINTERPOLATION_HH
5
6
#include <vector>
7
8
namespace
Dune
9
{
10
template
<
int
dim,
class
LB>
11
class
P1LocalInterpolation
12
{
13
public
:
15
template
<
typename
F,
typename
C>
16
void
interpolate
(
const
F& f, std::vector<C>& out)
const
17
{
18
typename
LB::Traits::RangeType y;
19
typename
LB::Traits::DomainType x;
20
21
out.resize(dim+1);
22
23
// vertex 0
24
for
(
int
i=0; i<dim; i++)
25
x[i] = 0;
26
f.evaluate(x,y); out[0] = y;
27
28
// remaining vertices
29
for
(
int
i=0; i<dim; i++) {
30
for
(
int
j=0; j<dim; j++)
31
x[j] = (i==j);
32
33
f.evaluate(x,y); out[i+1] = y;
34
35
}
36
37
}
38
39
};
40
}
41
42
#endif
Dune
Definition
brezzidouglasmarini1cube2d.hh:14
Dune::P1LocalInterpolation
Definition
p1localinterpolation.hh:12
Dune::P1LocalInterpolation::interpolate
void interpolate(const F &f, std::vector< C > &out) const
Local interpolation of a function.
Definition
p1localinterpolation.hh:16
Generated by
1.9.8