Dune Core Modules (2.6.0)

p1localinterpolation.hh
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
8namespace 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 namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)