dune-fem  2.4.1-rc
finitevolume/interpolation.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_FINITEVOLUME_INTERPOLATION_HH
2 #define DUNE_FEM_SPACE_FINITEVOLUME_INTERPOLATION_HH
3 
4 #include <functional>
5 
7 
8 #include "basisfunctionset.hh"
9 
10 namespace Dune
11 {
12 
13  namespace Fem
14  {
15 
16  // FiniteVolumeLocalInterpolation
17  // ------------------------------
18 
19  template< class GridPart, class Range >
21  {
23 
24  public:
26  typedef GridPart GridPartType;
28  typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
29 
32 
37  explicit FiniteVolumeLocalInterpolation ( const EntityType &entity )
38  : entity_( entity )
39  {}
40 
47  FiniteVolumeLocalInterpolation ( const ThisType & ) = default;
48 
49  FiniteVolumeLocalInterpolation &operator= ( const ThisType & ) = default;
50 
58  BasisFunctionSetType basisFunctionSet () const
59  {
60  return BasisFunctionSetType( entity() );
61  }
62 
64  template< class LocalFunction, class LocalDofVector >
65  void operator() ( const LocalFunction &localFunction, LocalDofVector &localDofVector ) const
66  {
67  apply( localFunction, localDofVector );
68  }
69 
71  template< class LocalFunction, class LocalDofVector >
72  void apply ( const LocalFunction &localFunction, LocalDofVector &localDofVector ) const
73  {
74  Range value;
76  for( int i = 0; i < Range::dimension; ++i )
77  localDofVector[ i ] = value[ i ];
78  }
79 
82  private:
83  const EntityType &entity () const { return entity_.get(); }
84 
85  std::reference_wrapper< const EntityType > entity_;
86  };
87 
88  } // namespace Fem
89 
90 } // namespace Dune
91 
92 #endif // #ifndef DUNE_FEM_SPACE_FINITEVOLUME_INTERPOLATION_HH
Definition: finitevolume/basisfunctionset.hh:24
void apply(const LocalFunction &localFunction, LocalDofVector &localDofVector) const
interpolate local function
Definition: finitevolume/interpolation.hh:72
GridPart GridPartType
grid part type
Definition: finitevolume/interpolation.hh:26
static void apply(const LocalFunction &localFunction, typename LocalFunction::RangeType &average)
Definition: average.hh:143
FiniteVolumeLocalInterpolation & operator=(const ThisType &)=default
interface for local functions
Definition: localfunction.hh:41
Definition: finitevolume/interpolation.hh:20
Definition: coordinate.hh:4
FiniteVolumeBasisFunctionSet< EntityType, Range > BasisFunctionSetType
basis function set type
Definition: finitevolume/interpolation.hh:31
GridPartType::template Codim< 0 >::EntityType EntityType
entity type
Definition: finitevolume/interpolation.hh:28
FiniteVolumeLocalInterpolation(const EntityType &entity)
Definition: finitevolume/interpolation.hh:37
BasisFunctionSetType basisFunctionSet() const
return basis function set
Definition: finitevolume/interpolation.hh:58
void operator()(const LocalFunction &localFunction, LocalDofVector &localDofVector) const
interpolate local function
Definition: finitevolume/interpolation.hh:65