DUNE-ACFEM (2.5.1)

estimatorinterface.hh
1#ifndef __ESTIMATOR_INTERFACE_HH__
2#define __ESTIMATOR_INTERFACE_HH__
3
4#include <dune/fem/misc/bartonnackmaninterface.hh>
5
6namespace Dune {
7
8 namespace ACFem {
9
28 enum FunctionSpaceNorm
29 {
30 L2Norm,
31 H1Norm
32 };
33
34 template<class Estimator>
35 struct EstimatorTraits
36 {
37 typedef void DiscreteFunctionSpaceType;
38 typedef void IteratorType;
39 };
40
41 template<class Estimator>
42 class EstimatorInterface
43 : public Dune::Fem::BartonNackmanInterface<EstimatorInterface<Estimator>,
44 Estimator>
45 {
46 typedef EstimatorInterface ThisType;
47 typedef Estimator ImplementationType;
48 typedef EstimatorTraits<ImplementationType> TraitsType;
49 typedef Dune::Fem::BartonNackmanInterface<ThisType, ImplementationType> BaseType;
50 using BaseType::asImp;
51 protected:
52 EstimatorInterface() {}
53 EstimatorInterface(const EstimatorInterface& other) {}
54 EstimatorInterface& operator=(const EstimatorInterface& other) {}
55 public:
56 typedef typename TraitsType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
57 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType;
58 typedef typename DiscreteFunctionSpaceType::GridPartType::GridType GridType;
59 typedef typename GridType::template Codim<0>::Entity ElementType;
60 typedef typename TraitsType::IteratorType IteratorType;
61
62 template<class DiscreteFunctionType>
63 RangeFieldType estimate(const DiscreteFunctionType& uh)
64 {
65 return asImp().estimate(uh);
66 }
67
68 size_t size() const {
69 return asImp().size();
70 }
71
72 IteratorType begin() const {
73 return asImp().begin();
74 }
75
76 IteratorType end() const {
77 return asImp().end();
78 }
79
80 const RangeFieldType& operator[](const size_t& idx) const
81 {
82 return asImp()[idx];
83 }
84
85 const RangeFieldType& operator[](const ElementType& entity) const
86 {
87 return asImp()[entity];
88 }
89
90 GridType& grid() const {
91 return asImp().grid();
92 }
93
94 const DiscreteFunctionSpaceType& space() const
95 {
96 return asImp().space();
97 }
98 };
99
100// No real default, just for completeness.
101 template<class Estimator>
102 class DefaultEstimator
103 : public EstimatorInterface<Estimator>
104 {
105 typedef Estimator ImplementationType;
106 typedef EstimatorInterface<ImplementationType> BaseType;
107 typedef DefaultEstimator<ImplementationType> ThisType;
108 typedef EstimatorTraits<ImplementationType> TraitsType;
109 protected:
110 DefaultEstimator() {}
111 DefaultEstimator(const DefaultEstimator& other) {}
112 DefaultEstimator& operator=(const DefaultEstimator& other) {}
113 public:
114 typedef typename TraitsType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
115 typedef typename DiscreteFunctionSpaceType::FunctionSpaceType FunctionSpaceType;
116 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
117 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
118 typedef typename GridPartType::GridType GridType;
119 typedef typename GridType::template Codim<0>::Entity ElementType;
120
121 template<class DiscreteFunctionType>
122 RangeFieldType estimate(const DiscreteFunctionType& uh)
123 {
124 return -1.0;
125 }
126
127 size_t size() const {
128 return 0;
129 }
130
131 const RangeFieldType& operator[](const size_t& idx) const
132 {
133 return -1.0;
134 }
135
136 const RangeFieldType& operator[](const ElementType& entity) const
137 {
138 return -1.0;
139 }
140
142
144
145 };
146
147 } // ACFem
148} // Dune
149
150#endif // __ESTIMATOR_INTERFACE_HH__
const Implementation & asImp(const Fem::BartonNackmanInterface< Interface, Implementation > &arg)
Up-cast to the implementation for any Fem::BartonNackmanInterface.
Definition: expressionoperations.hh:71
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Mar 12, 23:28, 2025)