dune-localfunctions  2.11
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 // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5 #ifndef DUNE_RANNACHER_TUREK_LOCALINTERPOLATION_HH
6 #define DUNE_RANNACHER_TUREK_LOCALINTERPOLATION_HH
7 
8 #include <cassert>
9 #include <vector>
10 
11 #include <dune/common/fvector.hh>
12 
13 #include <dune/geometry/referenceelements.hh>
14 
16 
17 namespace Dune
18 {
19 
29  template< class D, class R, unsigned int d >
31  {
33  R, 1, FieldVector< R, 1 >,
34  FieldMatrix< R, 1, d > > Traits;
35 
36  public:
37  template< class F, class C >
38  void interpolate ( const F &f, std::vector< C > &out ) const
39  {
40  typedef typename Traits::DomainType DomainType;
41 
42  // get cubic reference element
43  auto referenceElement = ReferenceElements< D, d >::cube();
44 
45  const int size = 2*d;
46  assert( size == referenceElement.size( 1 ) );
47 
48  // resize vector
49  out.resize( size );
50 
51  // evaluate local function in barycenter of codim 1 subentities
52  for( int i = 0; i < size; ++i )
53  {
54  const DomainType &x = referenceElement.position( i, 1 );
55  out[ i ] = f(x);
56  }
57  }
58 
59  };
60 
61 } // namespace Dune
62 
63 #endif // #ifndef DUNE_RANNACHER_TUREK_LOCALINTERPOLATION_HH
please doc me
Definition: rannachertureklocalinterpolation.hh:30
Definition: bdfmcube.hh:17
D DomainType
domain type
Definition: common/localbasis.hh:43
void interpolate(const F &f, std::vector< C > &out) const
Definition: rannachertureklocalinterpolation.hh:38
Type traits for LocalBasisVirtualInterface.
Definition: common/localbasis.hh:34