space.hh

Go to the documentation of this file.
1 
6 #ifndef aglowavSpace_hh
7 #define aglowavSpace_hh
8 
9 #ifdef __GUNG__
10  #pragma interface
11 #endif
12 
14 #include "space/space.hh"
15 #include "aglowav/element.hh"
16 #include "aglowav/tree.hh"
17 #include "basics/output.hh"
18 
19 namespace aglowav {
20 
21  // ********************************************************* Haar3dDFSScan **
22 
27  template<class F = concepts::Real>
28  class Haar3dDFSScan : public concepts::Scan<concepts::Element<F> > {
29  public:
31  virtual Haar3dXXX<F>& operator++(int) = 0;
32  };
33 
34 
35  // ********************************************************* Haar3dBFSScan **
36 
41  template<class F = concepts::Real>
42  class Haar3dBFSScan : public concepts::Scan<concepts::Element<F> > {
43  public:
45  virtual Haar3dXXX<F>& operator++(int) = 0;
47  virtual void skip(uint lvl) = 0;
48  };
49 
50  // **************************************************************** Haar3d **
51 
55  template<class F = concepts::Real>
56  class Haar3d : public concepts::Space<F> {
57  public:
59  virtual ~Haar3d() {}
60 
62  virtual uint nlvl() const = 0;
64  virtual Haar3dDFSScan<F>* dfsscan() const = 0;
66  virtual Haar3dBFSScan<F>* bfsscan() const = 0;
67  };
68 
69  // ******************************************************* BiHaar3dDFSScan **
70 
75  template<class F = concepts::Real>
76  class BiHaar3dDFSScan : public Haar3dDFSScan<F> {
77  public:
82  BiHaar3dDFSScan(Haar3d000<F>* elm, uint ht);
86  inline ~BiHaar3dDFSScan() {delete[] stk_;}
87 
91  inline BiHaar3dDFSScan<F>* clone() const {
92  return new BiHaar3dDFSScan<F>(*this);
93  }
95  inline bool eos() const {return sptr_[0] ? 0 : 1;}
96 
97  private:
99  uint ht_;
104  };
105 
106  // ******************************************************* BiHaar3dBFSScan **
107 
112  template<class F = concepts::Real>
113  class BiHaar3dBFSScan : public Haar3dBFSScan<F> {
114  public:
123  inline ~BiHaar3dBFSScan() {delete[] stk_;}
124 
128  inline BiHaar3dBFSScan* clone() const {
129  return new BiHaar3dBFSScan<F>(*this);
130  }
132  inline bool eos() const {return sptr_[0] ? 0 : 1;}
134  void skip(uint lvl);
135 
136  private:
138  uint ht_;
143  };
144 
145  // ************************************************************** BiHaar3d **
146 
151  template<class F = concepts::Real>
152  class BiHaar3d : public Haar3d<F> {
153  public:
158 
160  inline uint dim() const {return dim_;}
162  inline uint nelm() const {return nelm_;}
164  inline uint nlvl() const {return nlvl_;}
166  inline BiHaar3dDFSScan<F>* dfsscan() const;
168  inline BiHaar3dBFSScan<F>* bfsscan() const;
170  inline BiHaar3dBFSScan<F>* scan() const;
171 
172  protected:
174  std::ostream& info(std::ostream& os) const;
175 
176  private:
179  typename Haar3dXXX<F, 2>::Key& key);
180 
183 
185  uint dim_;
187  uint nelm_;
189  uint nlvl_;
192  };
193 
194  template<class F>
196  return new BiHaar3dDFSScan<F>(elm_, nlvl_);
197  }
198 
199  template<class F>
201  return new BiHaar3dBFSScan<F>(elm_, nlvl_);
202  }
203 
204  template<class F>
206  return new BiHaar3dBFSScan<F>(elm_, nlvl_);
207  }
208 
209  template<class F>
210  std::ostream& BiHaar3d<F>::info(std::ostream& os) const {
211  os << "aglowav::" << concepts::typeOf(*this)<< "(dim = " << dim_ << ", nlevel = " << nlvl_;
212  return os << ", nElement = " << nelm_ << ')';
213  }
214 
215 } // namespace aglowav
216 
217 #endif // aglowavSpace_hh
~BiHaar3dDFSScan()
Destructor.
Definition: space.hh:86
Haar3d000< F > ** sptr_
Stack pointer.
Definition: space.hh:103
Binary tree.
Definition: tree.hh:88
Haar3d000< F > ** stk_
Begin of the stack.
Definition: space.hh:140
Scanner of the Haar3d space ("breadth" first search (bfs)) (1.
Definition: space.hh:42
BiHaar3dDFSScan(const BiHaar3dDFSScan< F > &sc)
Copy constructor.
virtual Haar3dBFSScan< F > * bfsscan() const =0
Scanner ("breadth" first search (1. parent, 2. children))
Haar3d000< F > & operator++(int)
Next element.
Abstract class for a space.
BiHaar3dDFSScan< F > * dfsscan() const
Scanner (depth first search (1. children, 2. parent))
Definition: space.hh:195
Haar3d000< F > & operator++(int)
Next element.
BiHaar3dDFSScan(Haar3d000< F > *elm, uint ht)
Constructor.
Scanner of the Haar3d space (depth first search (dfs)) (1.
Definition: space.hh:28
Agglomerated binary wavelet space.
Definition: space.hh:152
void destructor_(Haar3d000< F > *elm)
Recursive destructor.
Haar3d000< F > ** sptr_
Stack pointer.
Definition: space.hh:142
BiHaar3dBFSScan(const BiHaar3dBFSScan< F > &sc)
Copy constructor.
Binary node for the cluster and Haar wavelet agglomeration algorithm.
Definition: tree.hh:124
Abstract space element for the agglomerated wavelets.
Definition: element.hh:104
Key of the wavelet element.
Definition: element.hh:110
virtual Haar3dXXX< F > & operator++(int)=0
Next element.
std::ostream & info(std::ostream &os) const
Information about the space.
Definition: space.hh:210
uint nlvl() const
Maximal number of levels.
Definition: space.hh:164
~BiHaar3d()
Destructor.
Definition: space.hh:157
virtual Haar3dDFSScan< F > * dfsscan() const =0
Scanner (depth first search (1. children, 2. parent))
Binary space element for the agglomerated wavelets.
Definition: element.hh:162
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
uint dim() const
Dimenstion of the space.
Definition: space.hh:160
~BiHaar3dBFSScan()
Destructor.
Definition: space.hh:123
Agglomerated wavelet space.
Definition: space.hh:56
Haar3d000< F > ** stk_
Begin of the stack.
Definition: space.hh:101
bool eos() const
End of scan.
Definition: space.hh:132
Scanner of the BiHaar3d space ("breadth" first search (bfs)) (1.
Definition: space.hh:113
uint nelm_
Space elements.
Definition: space.hh:187
uint dim_
Space dimension.
Definition: space.hh:185
void skip(uint lvl)
Skips the levels l > lvl of the subtree.
BiHaar3d(BiTree< BiClNode00< F > > &tree)
Constructor.
uint ht_
Height of the stack.
Definition: space.hh:138
virtual Haar3dXXX< F > & operator++(int)=0
Next element.
uint ht_
Height of the stack.
Definition: space.hh:99
Used for the aglowav classes for the boundary element method.
Definition: element.hh:21
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
BiHaar3dBFSScan< F > * scan() const
Scanner (same as bfsscan())
Definition: space.hh:205
bool eos() const
End of scan.
Definition: space.hh:95
BiHaar3dDFSScan< F > * clone() const
New scanner.
Definition: space.hh:91
uint nelm() const
Number of elements.
Definition: space.hh:162
virtual uint nlvl() const =0
Maximal number of levels.
Haar3d000< F > * elm_
Root of the wavelet tree.
Definition: space.hh:191
BiHaar3dBFSScan< F > * bfsscan() const
Scanner ("breadth" first search (1. parent, 2. children))
Definition: space.hh:200
BiHaar3dBFSScan(Haar3d000< F > *elm, uint ht)
Constructor.
Scanner of the BiHaar3d space (depth first search (dfs)) (1.
Definition: space.hh:76
BiHaar3dBFSScan * clone() const
New scanner.
Definition: space.hh:128
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
virtual ~Haar3d()
Destructor.
Definition: space.hh:59
uint nlvl_
Maximal number of levels.
Definition: space.hh:189
Haar3d000< F > * constructor_(BiClNode00< F > *nd, concepts::Real *m, typename Haar3dXXX< F, 2 >::Key &key)
Recursive constructor.
virtual void skip(uint lvl)=0
Skips the levels of the subtree.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich