dune-fem  2.4.1-rc
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 order, class BasisFunctionSet >
21  {
23 
24  public:
29 
30  private:
32 
33  public:
38  LagrangeLocalInterpolation ( const LagrangePointSetType &pointSet,
39  const BasisFunctionSetType &basisFunctionSet )
40  : pointSet_( pointSet ),
41  basisFunctionSet_( basisFunctionSet )
42  {}
43 
44  LagrangeLocalInterpolation ( const LagrangePointSetType &pointSet,
45  BasisFunctionSetType &&basisFunctionSet )
46  : pointSet_( pointSet ),
47  basisFunctionSet_( std::forward< BasisFunctionSetType >( basisFunctionSet ) )
48  {}
49 
57  LagrangeLocalInterpolation ( const ThisType & ) = default;
58 
60  LagrangeLocalInterpolation ( ThisType &&other )
61  : pointSet_( std::move( other.pointSet_ ) ),
62  basisFunctionSet_( std::move( other.basisFunctionSet_ ) )
63  {}
64 
66  LagrangeLocalInterpolation &operator= ( const ThisType & ) = default;
67 
70  {
71  pointSet_ = std::move( other.pointSet_ );
72  basisFunctionSet_ = std::move( other.basisFunctionSet_ );
73  return *this;
74  }
75 
83  BasisFunctionSetType basisFunctionSet () const
84  {
85  return basisFunctionSet_;
86  }
87 
89  template< class LocalFunction, class LocalDofVector >
90  void operator() ( const LocalFunction &localFunction, LocalDofVector &localDofVector ) const
91  {
92  apply( localFunction, localDofVector );
93  }
94 
96  template< class LocalFunction, class LocalDofVector >
97  void apply ( const LocalFunction &localFunction, LocalDofVector &localDofVector ) const
98  {
99  const LagrangePointSetType &pointSet = this->pointSet();
100 
101  int k = 0;
102  const std::size_t nop = pointSet.nop();
103  for( std::size_t pt = 0; pt < nop; ++pt )
104  {
105  typename FunctionSpaceType::RangeType phi;
106  localFunction.evaluate( pointSet[ pt ], phi );
107  for( int i = 0; i < FunctionSpaceType::dimRange; ++i )
108  localDofVector[ k++ ] = phi[ i ];
109  }
110  }
111 
114  private:
115  const LagrangePointSetType &pointSet () const { return pointSet_.get(); }
116 
117  std::reference_wrapper< const LagrangePointSetType > pointSet_;
118  BasisFunctionSetType basisFunctionSet_;
119  };
120 
121  } // namespace Fem
122 
123 } // namespace Dune
124 
125 #endif // #ifndef DUNE_FEM_SPACE_LAGRANGE_INTERPOLATION_HH
LagrangeLocalInterpolation & operator=(const ThisType &)=default
assignment operator
A vector valued function space.
Definition: functionspace.hh:16
LagrangeLocalInterpolation(ThisType &&other)
move constructor
Definition: lagrange/interpolation.hh:60
LagrangePointSet< GridPart, order > LagrangePointSetType
point set type
Definition: lagrange/interpolation.hh:28
dimension of range vector space
Definition: functionspaceinterface.hh:47
BasisFunctionSetType basisFunctionSet() const
return basis function set
Definition: lagrange/interpolation.hh:83
interface for local functions
Definition: localfunction.hh:41
Definition: lagrange/interpolation.hh:20
void operator()(const LocalFunction &localFunction, LocalDofVector &localDofVector) const
apply interpolation
Definition: lagrange/interpolation.hh:90
Definition: coordinate.hh:4
void apply(const LocalFunction &localFunction, LocalDofVector &localDofVector) const
apply interpolation
Definition: lagrange/interpolation.hh:97
STL namespace.
void move(ArrayInterface< T > &array, const unsigned int oldOffset, const unsigned int newOffset, const unsigned int length)
Definition: array_inline.hh:38
void evaluate(const PointType &x, RangeType &ret) const
evaluate the local function
Definition: localfunction.hh:300
BasisFunctionSet BasisFunctionSetType
basis function set type
Definition: lagrange/interpolation.hh:26
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:70
LagrangeLocalInterpolation(const LagrangePointSetType &pointSet, const BasisFunctionSetType &basisFunctionSet)
Definition: lagrange/interpolation.hh:38
Definition: lagrangepoints.hh:461
Definition: basisfunctionset/basisfunctionset.hh:31
LagrangeLocalInterpolation(const LagrangePointSetType &pointSet, BasisFunctionSetType &&basisFunctionSet)
Definition: lagrange/interpolation.hh:44