dune-localfunctions 2.8.0
rannachertureklocalinterpolation.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_RANNACHER_TUREK_LOCALINTERPOLATION_HH
4#define DUNE_RANNACHER_TUREK_LOCALINTERPOLATION_HH
5
6#include <cassert>
7#include <vector>
8
9#include <dune/common/fvector.hh>
10
11#include <dune/geometry/referenceelements.hh>
12
15
16namespace Dune
17{
18
26 template< class D, class R, unsigned int d >
28 {
30 R, 1, FieldVector< R, 1 >,
31 FieldMatrix< R, 1, d > > Traits;
32
33 public:
34 template< class F, class C >
35 void interpolate ( const F &ff, std::vector< C > &out ) const
36 {
37 typedef typename Traits::DomainType DomainType;
38
39 auto&& f = Impl::makeFunctionWithCallOperator<DomainType>(ff);
40
41 // get cubic reference element
42 auto referenceElement = ReferenceElements< D, d >::cube();
43
44 const int size = 2*d;
45 assert( size == referenceElement.size( 1 ) );
46
47 // resize vector
48 out.resize( size );
49
50 // evaluate local function in barycenter of codim 1 subentities
51 for( int i = 0; i < size; ++i )
52 {
53 const DomainType &x = referenceElement.position( i, 1 );
54 out[ i ] = f(x);
55 }
56 }
57
58 };
59
60} // namespace Dune
61
62#endif // #ifndef DUNE_RANNACHER_TUREK_LOCALINTERPOLATION_HH
Definition: bdfmcube.hh:16
Type traits for LocalBasisVirtualInterface.
Definition: common/localbasis.hh:32
D DomainType
domain type
Definition: common/localbasis.hh:43
please doc me
Definition: rannachertureklocalinterpolation.hh:28
void interpolate(const F &ff, std::vector< C > &out) const
Definition: rannachertureklocalinterpolation.hh:35