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 
16 namespace concepts{
17 
18 template<typename F>
19 class Estimator: public OutputOperator {
20 
21 public:
22  const Real getGlobal() const {
23  return globError_;
24  }
25 
26 protected:
27 
29  spc_(spc), sol_(sol) {};
30 
31  virtual std::ostream& info(std::ostream& os) const=0;
32  //local reference to the Space
34  //local reference to the solution
36  //the global error
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 
90 template<class F>
92 
93 public:
94 
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{
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 
142 protected:
143 
144  //private constructor on may not create instance of this abstract class
146 
147 
148  virtual std::ostream& info(std::ostream& os) const=0;
149 
150  //mapping of elements keys to local errors
152 
153 };
154 
155 //further possible abstract classes :
156 
157 //class SubdomainEstimator
158 //class GoalOrientedEstimator
159 
160 
161 }
162 
163 #endif // estimator_hh
virtual LocalEstimator< F > * clone() const =0
Virtual constructor.
Piecewise defined function on a number of cells.
const_iterator end() const
Definition: estimator.hh:112
virtual F operator()(const Connector &cntr, const Real2d &p, const Real t=0.0) const
Definition: estimator.hh:135
LocalEstimator(const concepts::SpaceOnCells< F > &spc, const concepts::Vector< F > &sol)
Definition: estimator.hh:145
virtual F operator()(const Connector &cntr, const Real3d &p, const Real t=0.0) const
Definition: estimator.hh:138
Estimator(const concepts::SpaceOnCells< F > &spc, const concepts::Vector< F > &sol)
Definition: estimator.hh:28
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Definition: exceptions.hh:394
const_iterator begin() const
Definition: estimator.hh:104
HashMap< Real >::const_iterator const_iterator
Definition: estimator.hh:96
Exception class for assertions.
Definition: exceptions.hh:258
const Key & key() const
Returns the key of the connector.
Definition: connector.hh:105
virtual F operator()(const Connector &cntr, const Real p, const Real t=0.0) const
Gives the value in an particular cell on a particular point.
Definition: estimator.hh:132
const Real operator()(uint key) const
Return the error on given local element, that belongs to the input key.
Definition: estimator.hh:123
const concepts::Vector< F > & sol_
Definition: estimator.hh:35
Abstract class for a space.
Definition: space.hh:81
const Real getGlobal() const
Definition: estimator.hh:22
virtual std::ostream & info(std::ostream &os) const =0
Returns information in an output stream.
concepts::HashMap< Real > locError_
Definition: estimator.hh:151
Class providing an output operator.
HashMap< Real >::iterator iterator
Definition: estimator.hh:95
An abstract class for elements of the topology.
Definition: connector.hh:85
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
const concepts::SpaceOnCells< F > & spc_
Definition: estimator.hh:33
virtual std::ostream & info(std::ostream &os) const =0
Returns information in an output stream.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich