Class documentation of Concepts

Loading...
Searching...
No Matches
fluxes.hh
Go to the documentation of this file.
1
7#ifndef fluxes_estimator_hh
8#define fluxes_estimator_hh
9
12
13
14#include "operator/lapack.hh"
15#include "basics/exceptions.hh"
16#include "moments.hh"
17
18
19namespace concepts {
20
21// **************************************************** FluxesError **
22
27public:
31 FluxesError(const std::string& errorMessage) throw () {
32 errorMessage_ = errorMessage;
33 }
34
35 virtual ~FluxesError() throw () {
36 }
37 ;
38protected:
39 virtual std::ostream& info(std::ostream& os) const throw () {
40 return os << concepts::typeOf(*this)<< "[" << errorMessage_ << " ]";
41
42 }
43private:
44 std::string errorMessage_;
45};
46
47}
48
49namespace hp2D {
50
51
52
59class Fluxes: public concepts::ElementFormula<Real, Real> {
60
61public:
62 typedef concepts::ElementAndFacette<hp2D::Element<Real> > UnderlyingElement;
63
75 Fluxes(hp2D::TraceSpace& spc,const EquilibratedMomentsAO<Real>& moments);
76
77 void compress(Real eps = EPS);
78
83 const concepts::Real p, const Real t = 0.0) const;
84
85
87 const concepts::Real2d& p, const Real t = 0.0) const {
88 concepts::conceptsException(concepts::MissingFeature("Not implemented"));
89 return 0;
90 }
92 const concepts::Real3d& p, const Real t = 0.0) const {
93 concepts::conceptsException(concepts::MissingFeature("Not implemented"));
94 return 0;
95 }
96
97 Real getWeight(uint E, uint K) const {
98 concepts::HashMap<concepts::Sequence<UnderlyingElement> >::const_iterator iter = uelm_.find(E);
99 conceptsAssert(iter != uelm_.end(), concepts::Assertion());
100 if(iter->second[0].elm->support().key().key()==K)
101 return 1.0;
102 else
103 return -1.0;
104 }
105
106 const concepts::Vector<Real>& getCoeffs(uint E) const {
107 concepts::HashMap<concepts::Vector<Real> >::const_iterator iter = coeffs_.find(E);
108 conceptsAssert(iter != coeffs_.end(), concepts::Assertion());
109 return iter->second;
110 }
111
112
113
114 virtual ~Fluxes() {
115 //delete allocated cholesky descompositions
116 for(concepts::HashMap<concepts::LapackChol*>::iterator iter = Minv_.begin(); iter != Minv_.end(); ++iter){
117 delete iter->second;
118 iter->second = 0;
119 }
120 }
121
122 virtual Fluxes* clone() const {
123 return new hp2D::Fluxes(*this);
124 }
125
126 const concepts::LapackChol* getInverseMass(uint m){
128 conceptsAssert(iter != Minv_.end(),concepts::Assertion());
129 return iter->second;
130 }
131
132
133protected:
134
135 std::ostream& info(std::ostream& os) const {
136 os << concepts::typeOf(*this) << "[ #edges = "<<coeffs_.size()<<std::endl;
137 concepts::HashMap<concepts::Vector<Real> >::const_iterator iter = coeffs_.begin();
138 for( ;iter != coeffs_.end(); ++iter) {
139 os<< "Edge("<<iter->first<<") --> (";
140 uint i=0;
141 for( ; i< iter->second.size()-1;++i){
142 os<< iter->second[i] << " , ";
143 }
144 os << iter->second[i] <<")"<<std::endl;
145 }
146 return os<<"]"<<std::endl;
147 }
148
149private:
150
151 uint currElmKey_;
152
161 //atm K -> E -> coeffs
162 //atm computed to times for have sth
164
169
170
172
176 const hp2D::TraceSpace& tspc_;
177};
178
179
180//TODO Documentation
181
182class LocalFluxes: public concepts::ElementFormula<Real, Real> {
183
184public:
185 typedef concepts::ElementAndFacette<hp2D::Element<Real> > UnderlyingElement;
186
187 //@pre the local tracespace just has edges with keys given in the globalflux
188
189 LocalFluxes(hp2D::TraceSpace& locTspc,uint K, const Fluxes& globalflux);
190
195 const concepts::Real p, const Real t = 0.0) const;
196
197
199 const concepts::Real2d& p, const Real t = 0.0) const {
200 concepts::conceptsException(concepts::MissingFeature("Not implemented"));
201 return 0;
202 }
203
205 const concepts::Real3d& p, const Real t = 0.0) const {
206 concepts::conceptsException(concepts::MissingFeature("Not implemented"));
207 return 0;
208 }
209
210 virtual ~LocalFluxes() {
211 //TODO IMPLEMENT
212 }
213
214 virtual LocalFluxes* clone() const {
215 return new hp2D::LocalFluxes(*this);
216 }
217
218 protected:
219
220 std::ostream& info(std::ostream& os) const {
221 os << concepts::typeOf(*this) << "[ #edges = "<<coeffs_.size()<<std::endl;
222 concepts::HashMap<concepts::Vector<Real> >::const_iterator iter = coeffs_.begin();
223 for( ;iter != coeffs_.end(); ++iter) {
224 os<< "Edge("<<iter->first<<") --> (";
225 uint i=0;
226 for( ; i< iter->second.size()-1;++i){
227 os<< iter->second[i] << " , ";
228 }
229 os << iter->second[i] <<")"<<std::endl;
230 }
231 return os<<"]"<<std::endl;
232 }
233
234 private:
235
236 uint currElmKey_;
237
246 //atm K -> E -> coeffs
247 //atm computed to times for have sth
249
253 const hp2D::TraceSpace& locTspc_;
254
255 const uint K_;
256
257 const hp2D::Fluxes& globFlux_;
258};
259
260
261}
262
263#endif //fluxes_hh
virtual Real operator()(const ElementWithCell< Real > &elm, const Real p, const Real t=0.0) const=0
FluxesError(const std::string &errorMessage)
Definition fluxes.hh:31
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition fluxes.hh:39
#define conceptsAssert(cond, exc)
std::string typeOf(const T &t)
Definition output.hh:43
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320