dune-fem  2.8-git
lagrange/interpolation.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_LAGRANGE_INTERPOLATION_HH
2 #define DUNE_FEM_SPACE_LAGRANGE_INTERPOLATION_HH
3 
4 #include <cstddef>
5 
6 #include <utility>
7 
8 #include "lagrangepoints.hh"
9 
10 namespace Dune
11 {
12 
13  namespace Fem
14  {
15 
16  // LagrangeLocalInterpolation
17  // --------------------------
18 
19  template< class GridPart, int maxOrder, class BasisFunctionSet >
21  {
23 
24  public:
29 
30  private:
32 
33  public:
39  : pointSet_( nullptr )
41  {
42  }
43 
46  : pointSet_( &pointSet ),
48  {}
49 
52  : pointSet_( &pointSet ),
54  {}
55 
63  LagrangeLocalInterpolation ( const ThisType & ) = default;
64 
67  : pointSet_( std::move( other.pointSet_ ) ),
68  basisFunctionSet_( std::move( other.basisFunctionSet_ ) )
69  {}
70 
73 
76  {
77  pointSet_ = other.pointSet_ ;
78  basisFunctionSet_ = std::move( other.basisFunctionSet_ );
79  return *this;
80  }
81 
90  {
91  return basisFunctionSet_;
92  }
93 
95  template< class LocalFunction, class LocalDofVector >
96  void operator() ( const LocalFunction &localFunction, LocalDofVector &localDofVector ) const
97  {
98  apply( localFunction, localDofVector );
99  }
100 
102  template< class LocalFunction, class LocalDofVector >
103  void apply ( const LocalFunction &localFunction, LocalDofVector &localDofVector ) const
104  {
105  const LagrangePointSetType &pointSet = this->pointSet();
106 
107  int k = 0;
108  const std::size_t nop = pointSet.nop();
109  for( std::size_t pt = 0; pt < nop; ++pt )
110  {
111  typename FunctionSpaceType::RangeType phi;
112  localFunction.evaluate( pointSet[ pt ], phi );
113  for( int i = 0; i < FunctionSpaceType::dimRange; ++i )
114  localDofVector[ k++ ] = phi[ i ];
115  }
116  }
117 
120  void unbind()
121  {
122  pointSet_ = nullptr;
123  // basisFunctionSet_ = BasisFunctionSetType();
124  }
125 
126  protected:
128  {
129  assert( pointSet_ );
130  return *pointSet_;
131  }
132 
133  const LagrangePointSetType* pointSet_ = nullptr;
135  };
136 
137  } // namespace Fem
138 
139 } // namespace Dune
140 
141 #endif // #ifndef DUNE_FEM_SPACE_LAGRANGE_INTERPOLATION_HH
Definition: bindguard.hh:11
static GridFunctionView< GF > localFunction(const GF &gf)
Definition: gridfunctionview.hh:118
interface for local functions
Definition: localfunction.hh:77
Interface class for basis function sets.
Definition: basisfunctionset/basisfunctionset.hh:31
A vector valued function space.
Definition: functionspace.hh:60
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
Definition: lagrange/interpolation.hh:21
LagrangeLocalInterpolation(const LagrangePointSetType &pointSet, const BasisFunctionSetType &basisFunctionSet)
Definition: lagrange/interpolation.hh:44
LagrangeLocalInterpolation(ThisType &&other)
move constructor
Definition: lagrange/interpolation.hh:66
BasisFunctionSetType basisFunctionSet_
Definition: lagrange/interpolation.hh:134
BasisFunctionSet BasisFunctionSetType
basis function set type
Definition: lagrange/interpolation.hh:26
LagrangeLocalInterpolation()
Definition: lagrange/interpolation.hh:38
LagrangePointSet< GridPart, maxOrder > LagrangePointSetType
point set type
Definition: lagrange/interpolation.hh:28
void apply(const LocalFunction &localFunction, LocalDofVector &localDofVector) const
apply interpolation
Definition: lagrange/interpolation.hh:103
LagrangeLocalInterpolation(const ThisType &)=default
copy constructor
void unbind()
Definition: lagrange/interpolation.hh:120
const LagrangePointSetType & pointSet() const
Definition: lagrange/interpolation.hh:127
void operator()(const LocalFunction &localFunction, LocalDofVector &localDofVector) const
apply interpolation
Definition: lagrange/interpolation.hh:96
LagrangeLocalInterpolation(const LagrangePointSetType &pointSet, BasisFunctionSetType &&basisFunctionSet)
Definition: lagrange/interpolation.hh:50
BasisFunctionSetType basisFunctionSet() const
return basis function set
Definition: lagrange/interpolation.hh:89
LagrangeLocalInterpolation & operator=(const ThisType &)=default
assignment operator
const LagrangePointSetType * pointSet_
Definition: lagrange/interpolation.hh:133
Definition: lagrangepoints.hh:685