dune-fem  2.8-git
dgl2projection.hh
Go to the documentation of this file.
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 
14 
16 
17 namespace Dune
18 {
19 
20  namespace Fem
21  {
22 
23  // DGL2ProjectionImpl
24  // ------------------
25 
26  // implementation of L2 projection for discontinuous spaces
28  {
29  template <int dummy, bool hasLocalFunction>
30  struct ProjectChooser
31  {
32  template <class FunctionImp, class FunctionSpace>
34  {
35  const FunctionImp& function_;
36  public:
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
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
static void interpolate(const GridFunction &u, DiscreteFunction &v)
perform native interpolation of a discrete function space
Definition: common/interpolate.hh:54
Definition: bindguard.hh:11
BasicGridFunctionAdapter provides local functions for a Function.
Definition: gridfunctionadapter.hh:79
Definition: dgl2projection.hh:28
static void projectFunction(const FunctionImp &func, DiscreteFunctionImp &discFunc, int polOrd=-1)
Definition: dgl2projection.hh:89
static void apply(const FunctionImp &f, DiscreteFunctionImp &discFunc)
project function to discrete space
Definition: dgl2projection.hh:82
void evaluate(const DomainType &local, RangeType &ret) const
Definition: dgl2projection.hh:42
FunctionAdapter(const FunctionImp &f)
Definition: dgl2projection.hh:40
FunctionSpaceType ::DomainType DomainType
Definition: dgl2projection.hh:39
FunctionSpace FunctionSpaceType
Definition: dgl2projection.hh:37
FunctionSpaceType ::RangeType RangeType
Definition: dgl2projection.hh:38
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
FunctionSpaceTraits::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67