dune-fem  2.8-git
common/localinterpolation.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_COMMON_LOCALINTERPOLATION_HH
2 #define DUNE_FEM_SPACE_COMMON_LOCALINTERPOLATION_HH
3 
4 #include <optional>
5 
7 
8 namespace Dune
9 {
10 
11  namespace Fem
12  {
13 
14  // Forward Declarations
15  // --------------------
16 
17  template< class DiscreteFunctionSpace >
18  class LocalInterpolation;
19 
20  template < class DiscreteFunctionSpace >
22  {
23  // do not copy this class
24  LocalInterpolation( const LocalInterpolation& ) = delete;
26 
27  protected:
28  typedef typename DiscreteFunctionSpaceType :: InterpolationType InterpolationType;
29 
30  public:
31  typedef typename DiscreteFunctionSpaceType :: EntityType EntityType;
32 
34  : interpolation_( space.interpolation() )
35  {}
36 
43  void bind ( const EntityType& entity )
44  {
45  interpolation_.bind( entity );
46  }
47 
51  void unbind ()
52  {
53  interpolation_.unbind();
54  }
55 
61  template< class LocalFunction, class LocalDofVector >
62  void operator () ( const LocalFunction &localFunction, LocalDofVector &dofs ) const
63  {
65  }
66 
67  protected:
69  };
70 
71 
72  template< class DiscreteFunctionSpace >
74  {
75  typedef typename DiscreteFunctionSpace :: InterpolationImplType
76  InterpolationImplType;
77 
78  public:
79  typedef typename DiscreteFunctionSpace::EntityType EntityType;
80 
82  : space_( space )
83  , interpolation_()
84  {}
85 
86  void bind( const EntityType& entity )
87  {
88  interpolation_.emplace( space_.localInterpolation( entity ) );
89  }
90 
91  void unbind()
92  {
93  interpolation().unbind();
94  }
95 
97  template< class LocalFunction, class LocalDofVector >
98  void operator () ( const LocalFunction &localFunction, LocalDofVector &dofs ) const
99  {
101  }
102 
103  protected:
104  const InterpolationImplType& interpolation() const
105  {
106  assert( interpolation_.has_value() );
107  return *interpolation_;
108  }
109  InterpolationImplType& interpolation()
110  {
111  assert( interpolation_.has_value() );
112  return *interpolation_;
113  }
114 
116  std::optional< InterpolationImplType > interpolation_;
117  };
118 
119 
120  } // namespace Fem
121 
122 } // namespace Dune
123 
124 #endif // #ifndef DUNE_FEM_SPACE_COMMON_LOCALINTERPOLATION_HH
Definition: bindguard.hh:11
static GridFunctionView< GF > localFunction(const GF &gf)
Definition: gridfunctionview.hh:118
IteratorRange< typename DF::DofIteratorType > dofs(DF &df)
Iterates over all DOFs.
Definition: rangegenerators.hh:76
interface for local functions
Definition: localfunction.hh:77
Definition: common/localinterpolation.hh:22
void unbind()
clears the local interpolation by removing the basisFunctionSet
Definition: common/localinterpolation.hh:51
void bind(const EntityType &entity)
initialize the local interpolation for an entity
Definition: common/localinterpolation.hh:43
LocalInterpolation(const DiscreteFunctionSpaceType &space)
Definition: common/localinterpolation.hh:33
DiscreteFunctionSpaceType ::InterpolationType InterpolationType
Definition: common/localinterpolation.hh:28
DiscreteFunctionSpaceType ::EntityType EntityType
Definition: common/localinterpolation.hh:31
void operator()(const LocalFunction &localFunction, LocalDofVector &dofs) const
computes interpolation of locaFunction on entity and stores result in dofs
Definition: common/localinterpolation.hh:62
InterpolationType interpolation_
Definition: common/localinterpolation.hh:68
Definition: common/localinterpolation.hh:74
DiscreteFunctionSpace::EntityType EntityType
Definition: common/localinterpolation.hh:79
void unbind()
Definition: common/localinterpolation.hh:91
void bind(const EntityType &entity)
Definition: common/localinterpolation.hh:86
InterpolationImplType & interpolation()
Definition: common/localinterpolation.hh:109
const InterpolationImplType & interpolation() const
Definition: common/localinterpolation.hh:104
void operator()(const LocalFunction &localFunction, LocalDofVector &dofs) const
TODO, documentation.
Definition: common/localinterpolation.hh:98
LocalInterpolationWrapper(const DiscreteFunctionSpace &space)
Definition: common/localinterpolation.hh:81
const DiscreteFunctionSpace & space_
Definition: common/localinterpolation.hh:115
std::optional< InterpolationImplType > interpolation_
Definition: common/localinterpolation.hh:116
discrete function space