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 
19 namespace concepts {
20 
21 // **************************************************** FluxesError **
22 
26 class FluxesError: public ExceptionBase {
27 public:
31  FluxesError(const std::string& errorMessage) throw () {
32  errorMessage_ = errorMessage;
33  }
34 
35  virtual ~FluxesError() throw () {
36  }
37  ;
38 protected:
39  virtual std::ostream& info(std::ostream& os) const throw () {
40  return os << concepts::typeOf(*this)<< "[" << errorMessage_ << " ]";
41 
42  }
43 private:
44  std::string errorMessage_;
45 };
46 
47 }
48 
49 namespace hp2D {
50 
51 
52 
59 class Fluxes: public concepts::ElementFormula<Real, Real> {
60 
61 public:
63 
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 {
89  return 0;
90  }
92  const concepts::Real3d& p, const Real t = 0.0) const {
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 
128  conceptsAssert(iter != Minv_.end(),concepts::Assertion());
129  return iter->second;
130  }
131 
132 
133 protected:
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 
149 private:
150 
152 
161  //atm K -> E -> coeffs
162  //atm computed to times for have sth
164 
169 
170 
172 
177 };
178 
179 
180 //TODO Documentation
181 
182 class LocalFluxes: public concepts::ElementFormula<Real, Real> {
183 
184 public:
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 {
201  return 0;
202  }
203 
205  const concepts::Real3d& p, const Real t = 0.0) const {
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 
237 
246  //atm K -> E -> coeffs
247  //atm computed to times for have sth
249 
254 
255  const uint K_;
256 
258 };
259 
260 
261 }
262 
263 #endif //fluxes_hh
concepts::HashMap< concepts::Vector< Real > > coeffs_
The coefficients computed by M_{e}*alpha_K,e = Moments_K,e per each edge.
Definition: fluxes.hh:163
Real operator()(const concepts::ElementWithCell< Real > &elm, const concepts::Real p, const Real t=0.0) const
The elm should be a hp1D::Element of an identical TraceSpace like was given in the constructor.
Builds the trace space of an FE space.
Definition: traces.hh:52
Real operator()(const concepts::ElementWithCell< Real > &elm, const concepts::Real2d &p, const Real t=0.0) const
Definition: fluxes.hh:198
#define conceptsException(exc)
Prepares an exception for throwing.
Definition: exceptions.hh:344
Base class for exceptions.
Definition: exceptions.hh:86
virtual ~LocalFluxes()
Definition: fluxes.hh:210
#define EPS
Definition: typedefs.hh:22
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Definition: exceptions.hh:394
virtual LocalFluxes * clone() const
Virtual constructor.
Definition: fluxes.hh:214
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition: fluxes.hh:220
const concepts::LapackChol * getInverseMass(uint m)
Definition: fluxes.hh:126
2D hp-FEM for H1-conforming elements.
concepts::ElementAndFacette< hp2D::Element< Real > > UnderlyingElement
Definition: fluxes.hh:62
Fluxes(hp2D::TraceSpace &spc, const EquilibratedMomentsAO< Real > &moments)
Constructor for the Fluxes, request for a hp2D::TraceSpace The Moments should be Moments not approxim...
concepts::HashMap< concepts::Vector< Real > > coeffs_
The coefficients computed by M_{e}*alpha_K,e = Moments_K,e per each edge.
Definition: fluxes.hh:248
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition: fluxes.hh:135
concepts::ElementAndFacette< hp2D::Element< Real > > UnderlyingElement
Definition: fluxes.hh:185
const hp2D::TraceSpace & tspc_
local reference to the TraceSpace given in the Constructor.
Definition: fluxes.hh:176
Real operator()(const concepts::ElementWithCell< Real > &elm, const concepts::Real3d &p, const Real t=0.0) const
Definition: fluxes.hh:91
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition: fluxes.hh:39
Exception class for assertions.
Definition: exceptions.hh:258
uint currElmKey_
Definition: fluxes.hh:151
Interface for a formula defined element by element.
Exception class to handle errors in the Fluxes class.
Definition: fluxes.hh:26
virtual Fluxes * clone() const
Virtual constructor.
Definition: fluxes.hh:122
const hp2D::Fluxes & globFlux_
Definition: fluxes.hh:257
Real operator()(const concepts::ElementWithCell< Real > &elm, const concepts::Real2d &p, const Real t=0.0) const
Definition: fluxes.hh:86
const uint K_
Definition: fluxes.hh:255
const concepts::Vector< Real > & getCoeffs(uint E) const
Definition: fluxes.hh:106
std::string errorMessage_
Definition: fluxes.hh:44
Linear solver using Lapack subroutine DPOSV.
Definition: lapack.hh:30
Real operator()(const concepts::ElementWithCell< Real > &elm, const concepts::Real p, const Real t=0.0) const
The elm should be a hp1D::Element of an identical TraceSpace like was given in the constructor.
const hp2D::TraceSpace & locTspc_
local reference to the TraceSpace given in the Constructor.
Definition: fluxes.hh:253
virtual ~Fluxes()
Definition: fluxes.hh:114
concepts::HashMap< concepts::LapackChol * > Minv_
Locally stored Cholesky Decomposition of the Edge-MassMatrices on reference domain.
Definition: fluxes.hh:168
Exception class to express a missing feature.
Definition: exceptions.hh:206
FluxesError(const std::string &errorMessage)
Constructor.
Definition: fluxes.hh:31
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
void compress(Real eps=EPS)
Real operator()(const concepts::ElementWithCell< Real > &elm, const concepts::Real3d &p, const Real t=0.0) const
Definition: fluxes.hh:204
Real getWeight(uint E, uint K) const
Definition: fluxes.hh:97
virtual ~FluxesError()
Definition: fluxes.hh:35
Application of this class is to solve local Problems on one Quad.
Definition: fluxes.hh:59
Container for an element and one facette (edge or face).
Definition: element.hh:113
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
concepts::HashMap< concepts::Sequence< UnderlyingElement > > uelm_
Definition: fluxes.hh:171
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
LocalFluxes(hp2D::TraceSpace &locTspc, uint K, const Fluxes &globalflux)
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich