DUNE-FEM (unstable)

interpolation.hh
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
10namespace Dune
11{
12
13 namespace Fem
14 {
15
16 // LagrangeLocalInterpolation
17 // --------------------------
18
19 template< class GridPart, int maxOrder, class BasisFunctionSet >
20 class LagrangeLocalInterpolation
21 {
22 typedef LagrangeLocalInterpolation< GridPart, maxOrder, BasisFunctionSet > ThisType;
23
24 public:
26 typedef BasisFunctionSet BasisFunctionSetType;
28 typedef LagrangePointSet< GridPart, maxOrder > LagrangePointSetType;
29
30 private:
32
33 public:
38 LagrangeLocalInterpolation ()
39 : pointSet_( nullptr )
40 , basisFunctionSet_()
41 {
42 }
43
44 LagrangeLocalInterpolation ( const LagrangePointSetType &pointSet,
45 const BasisFunctionSetType &basisFunctionSet )
46 : pointSet_( &pointSet ),
47 basisFunctionSet_( basisFunctionSet )
48 {}
49
50 LagrangeLocalInterpolation ( const LagrangePointSetType &pointSet,
51 BasisFunctionSetType &&basisFunctionSet )
52 : pointSet_( &pointSet ),
53 basisFunctionSet_( std::forward< BasisFunctionSetType >( basisFunctionSet ) )
54 {}
55
63 LagrangeLocalInterpolation ( const ThisType & ) = default;
64
66 LagrangeLocalInterpolation ( ThisType &&other )
67 : pointSet_( std::move( other.pointSet_ ) ),
68 basisFunctionSet_( std::move( other.basisFunctionSet_ ) )
69 {}
70
72 LagrangeLocalInterpolation &operator= ( const ThisType & ) = default;
73
75 LagrangeLocalInterpolation &operator= ( ThisType &&other )
76 {
77 pointSet_ = other.pointSet_ ;
78 basisFunctionSet_ = std::move( other.basisFunctionSet_ );
79 return *this;
80 }
81
89 BasisFunctionSetType basisFunctionSet () const
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:
127 const LagrangePointSetType &pointSet () const
128 {
129 assert( pointSet_ );
130 return *pointSet_;
131 }
132
133 const LagrangePointSetType* pointSet_ = nullptr;
134 BasisFunctionSetType basisFunctionSet_;
135 };
136
137 } // namespace Fem
138
139} // namespace Dune
140
141#endif // #ifndef DUNE_FEM_SPACE_LAGRANGE_INTERPOLATION_HH
FunctionSpace< typename Entity::Geometry::ctype, typename Range::value_type, Entity::Geometry::coorddimension, Range::dimension > FunctionSpaceType
function space type
Definition: basisfunctionset.hh:40
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
A vector valued function space.
Definition: functionspace.hh:60
Dune namespace.
Definition: alignedallocator.hh:13
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)