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