Dune Core Modules (2.6.0)

q1localinterpolation.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_Q1_LOCALINTERPOLATION_HH
4#define DUNE_Q1_LOCALINTERPOLATION_HH
5
6#include <vector>
7
8namespace Dune
9{
10
12 template<int dim, class LB>
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
Definition: q1localinterpolation.hh:14
void interpolate(const F &f, std::vector< C > &out) const
Local interpolation of a function.
Definition: q1localinterpolation.hh:19
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 26, 23:30, 2024)