DUNE-FEM (unstable)

dgl2projection.hh
1#ifndef DUNE_FEM_DGL2PROJECTION_HH
2#define DUNE_FEM_DGL2PROJECTION_HH
3#warning "Deprecated header, use #include <dune/fem/space/common/interpolate.hh> instead!"
4
5#include <type_traits>
6
7#include <dune/fem/quadrature/cachingquadrature.hh>
8#include <dune/fem/operator/common/operator.hh>
9#include <dune/fem/function/common/discretefunction.hh>
10#include <dune/fem/function/common/gridfunctionadapter.hh>
11#include <dune/fem/function/common/localcontribution.hh>
12#include <dune/fem/function/localfunction/const.hh>
13#include <dune/fem/operator/1order/localmassmatrix.hh>
14
15#include <dune/fem/space/common/interpolate.hh>
16
17namespace Dune
18{
19
20 namespace Fem
21 {
22
23 // DGL2ProjectionImpl
24 // ------------------
25
26 // implementation of L2 projection for discontinuous spaces
27 class DGL2ProjectionImpl
28 {
29 template <int dummy, bool hasLocalFunction>
30 struct ProjectChooser
31 {
32 template <class FunctionImp, class FunctionSpace>
33 class FunctionAdapter
34 {
35 const FunctionImp& function_;
36 public:
37 typedef FunctionSpace FunctionSpaceType;
38 typedef typename FunctionSpaceType :: RangeType RangeType;
39 typedef typename FunctionSpaceType :: DomainType DomainType;
40 FunctionAdapter(const FunctionImp& f) : function_(f) {}
41
42 void evaluate(const DomainType& local,
43 RangeType& ret) const
44 {
45 function_.evaluate( local , ret );
46 }
47 };
48
49 template <class FunctionImp, class DiscreteFunctionImp>
50 static void project(const FunctionImp& f,
51 DiscreteFunctionImp& discFunc,
52 const int polOrd)
53 {
54 // some typedefs
55 typedef typename DiscreteFunctionImp :: DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
56 typedef typename DiscreteFunctionSpaceType :: GridPartType GridPartType;
57 typedef FunctionAdapter<FunctionImp, typename DiscreteFunctionSpaceType :: FunctionSpaceType> FunctionAdapterType;
58 // create function adapter in case of incorrect implementation
59 FunctionAdapterType af( f );
60 // create discrete function adapter
61 GridFunctionAdapter< FunctionAdapterType, GridPartType> adapter(
62 "DGL2projection::adapter" , f , discFunc.space().gridPart(), discFunc.space().order() );
63 DGL2ProjectionImpl::projectFunction(adapter, discFunc, polOrd);
64 }
65 };
66
67 template <int dummy>
68 struct ProjectChooser<dummy,true>
69 {
70 template <class FunctionImp, class DiscreteFunctionImp>
71 static void project(const FunctionImp& f,
72 DiscreteFunctionImp& discFunc,
73 const int polOrd )
74 {
75 DGL2ProjectionImpl::projectFunction(f, discFunc, polOrd);
76 }
77 };
78
79 public:
81 template <class FunctionImp, class DiscreteFunctionImp>
82 static void apply(const FunctionImp& f, DiscreteFunctionImp& discFunc )
83 {
84 project( f, discFunc );
85 }
86
87 protected:
88 template <class FunctionImp, class DiscreteFunctionImp>
89 static void projectFunction(const FunctionImp& func,
90 DiscreteFunctionImp& discFunc,
91 int polOrd = -1)
92 {
93 interpolate( func, discFunc );
94 }
95 };
96
97 } // namespace Fem
98
99} // namespace Dune
100
101#endif // #ifndef DUNE_FEM_DGL2PROJECTION_HH
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
FunctionSpaceTraits::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
A vector valued function space.
Definition: functionspace.hh:60
static void interpolate(const GridFunction &u, DiscreteFunction &v)
perform native interpolation of a discrete function space
Definition: interpolate.hh:54
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)