Class documentation of Concepts

Loading...
Searching...
No Matches
estimator.hh
Go to the documentation of this file.
1
7#ifndef estimator_hh
8#define estimator_hh
9
10
12#include "space/space.hh"
13#include "toolbox/hashMap.hh"
14#include "function/vector.hh"
15
16namespace concepts{
17
18template<typename F>
20
21public:
22 const Real getGlobal() const {
23 return globError_;
24 }
25
26protected:
27
29 spc_(spc), sol_(sol) {};
30
31 virtual std::ostream& info(std::ostream& os) const=0;
32 //local reference to the Space
33 const concepts::SpaceOnCells<F>& spc_;
34 //local reference to the solution
35 const concepts::Vector<F>& sol_;
36 //the global error
37 Real globError_;
38};
39
41// * Abstract class representing error estimators in one dimension.
42// */
43//template<typename F>
44//class Estimator1D : public concepts::Estimator<F>{
45//
46// public:
47// Estimator1D(const concepts::SpaceOnCells<F>& spc,const concepts::Vector<F>& sol):Estimator<F>(spc,sol){};
48//
49// protected:
50// virtual std::ostream& info(std::ostream& os) const;
51//
52//
53//};
54//
55//
57// * Abstract class representing error estimators in two dimensions.
58// */
59//template<typename F>
60//class Estimator2D : public concepts::Estimator<F>{
61//
62// public:
63// Estimator2D(const concepts::SpaceOnCells<F>& spc,const concepts::Vector<F>& sol):Estimator<F>(spc,sol){};
64//
65// protected:
66// virtual std::ostream& info(std::ostream& os) const;
67//
68//
69//};
70//
72// * Abstract class representing error estimators in three dimensions.
73// */
74//template<typename F>
75//class Estimator3D : public concepts::Estimator<F>{
76//
77// public:
78// Estimator3D(const concepts::SpaceOnCells<F>& spc,const concepts::Vector<F>& sol):Estimator<F>(spc,sol){};
79//
80// protected:
81// virtual std::ostream& info(std::ostream& os) const;
82//};
83
84
90template<class F>
92
93public:
94
95 typedef HashMap<Real>::iterator iterator;
96 typedef HashMap<Real>::const_iterator const_iterator;
97
98
99 //################# Iterator section
100 inline iterator begin() {
101 return iterator(locError_.begin());
102 }
103
104 inline const_iterator begin() const {
105 return const_iterator(locError_.begin());
106 }
107
108 inline iterator end() {
109 return iterator(locError_.end());
110 }
111
112 inline const_iterator end() const {
113 return const_iterator(locError_.end());
114 }
115
116 inline uint nelm() const{
117 return locError_.size();
118 }
119
123 const Real operator()(uint key)const{
124 concepts::HashMap<Real>::const_iterator iter = locError_.find(key);
125 conceptsAssert(iter!=locError_.end(), concepts::Assertion());
126 return iter->second;
127 }
128
129 virtual LocalEstimator<F>* clone() const = 0;
130
131
132 virtual F operator()(const Connector& cntr, const Real p,const Real t = 0.0) const{
133 return this->operator()(cntr.key());
134 }
135 virtual F operator()(const Connector& cntr, const Real2d& p, const Real t = 0.0) const{
136 return this->operator()(cntr.key());
137 }
138 virtual F operator()(const Connector& cntr, const Real3d& p, const Real t = 0.0) const{
139 return this->operator()(cntr.key());
140 }
141
142protected:
143
144 //private constructor on may not create instance of this abstract class
145 LocalEstimator(const concepts::SpaceOnCells<F>& spc, const concepts::Vector<F>& sol):Estimator<F>(spc,sol){};
146
147
148 virtual std::ostream& info(std::ostream& os) const=0;
149
150 //mapping of elements keys to local errors
151 concepts::HashMap<Real> locError_;
152
153};
154
155//further possible abstract classes :
156
157//class SubdomainEstimator
158//class GoalOrientedEstimator
159
160
161}
162
163#endif // estimator_hh
const Key & key() const
Returns the key of the connector.
Definition connector.hh:105
virtual std::ostream & info(std::ostream &os) const =0
Returns information in an output stream.
virtual F operator()(const Connector &cntr, const Real p, const Real t=0.0) const
Definition estimator.hh:132
virtual LocalEstimator< F > * clone() const =0
Virtual copy constructor.
const Real operator()(uint key) const
Definition estimator.hh:123
virtual std::ostream & info(std::ostream &os) const =0
Returns information in an output stream.
#define conceptsAssert(cond, exc)
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320