dune-localfunctions
3.0-git
dune
localfunctions
lagrange
q1
q1localinterpolation.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_Q1_LOCALINTERPOLATION_HH
4
#define DUNE_Q1_LOCALINTERPOLATION_HH
5
6
#include <vector>
7
8
namespace
Dune
9
{
10
12
template
<
int
dim,
class
LB>
13
class
Q1LocalInterpolation
14
{
15
public
:
16
18
template
<
typename
F,
typename
C>
19
void
interpolate
(
const
F& f, std::vector<C>& out)
const
20
{
21
typename
LB::Traits::DomainType x;
22
typename
LB::Traits::RangeType y;
23
24
out.resize(1<<dim);
25
26
for
(
int
i=0; i< (1<<dim); i++) {
27
28
// Generate coordinate of the i-th corner of the reference cube
29
// We could use the ReferenceElement for this as well, but it is
30
// still not clear how dune-localfunctions should have access to them.
31
for
(
int
j=0; j<dim; j++)
32
x[j] = (i & (1<<j)) ? 1.0 : 0.0;
33
34
f.evaluate(x,y); out[i] = y;
35
36
}
37
}
38
39
};
40
}
41
42
#endif
Dune
Definition
brezzidouglasmarini1cube2d.hh:14
Dune::Q1LocalInterpolation
Definition
q1localinterpolation.hh:14
Dune::Q1LocalInterpolation::interpolate
void interpolate(const F &f, std::vector< C > &out) const
Local interpolation of a function.
Definition
q1localinterpolation.hh:19
Generated by
1.9.8