Class documentation of Concepts

Loading...
Searching...
No Matches
expansion.hh
Go to the documentation of this file.
1
6#ifndef expansion_hh
7#define expansion_hh
8
10#include "space/element.hh"
11
12namespace cluster {
13
14 // *********************************************************** XYColExpPtr **
15
19 public:
20 virtual void operator+=(uint i) = 0;
21 virtual void operator-=(uint i) = 0;
22 };
23
24 // ************************************************************* XYColFPtr **
25
28 template <class F = concepts::Real>
29 class XYColFPtr : public XYColExpPtr {
30 public:
31 XYColFPtr() : val_(0) {}
32 XYColFPtr(F* val) : val_(val) {}
33
34 void operator+=(uint i) {val_ += i;}
35 void operator-=(uint i) {val_ -= i;}
36
37 inline F* value() const {return val_;}
38
39 protected:
40 F* val_;
41 };
42
43 // ************************************************************** XYColExp **
44
47 class XYColExp : public XYColExpPtr {
48 public:
49 virtual ~XYColExp() {}
50
51 virtual XYColExpPtr* operator[](uint i) const = 0;
52 virtual uint memory() const = 0;
53 };
54
55 // **************************************************************** XYColF **
56
59 template <class F = concepts::Real>
60 class XYColF : public XYColExp, public XYColFPtr<F> {
61 public:
62 typedef XYColFPtr<F> ColPtr;
63
64 inline XYColF(uint blksz, uint n) : blksz_(blksz), n_(n) {
65 this->val_ = new F[blksz_*n_];
66 std::memset(this->val_, 0, blksz_ * n_ * sizeof(F));
67 }
68 inline ~XYColF() {delete[] this->val_;}
69
70 XYColFPtr<F>* operator[](uint i) const {
71 return new XYColFPtr<F>(&this->val_[i*blksz_]);
72 }
73 uint memory() const {return sizeof(XYColF<F>) + blksz_ * n_ * sizeof(F);}
74 void operator+=(uint i) {
76 }
77 void operator-=(uint i) {
79 }
80
81 private:
82 uint blksz_;
83 uint n_;
84 };
85
86 // ************************************************************** typedefs **
87
90
91 // *********************************************************** ExpansionXY **
92
97 template <class F = concepts::Real>
99 public:
100 virtual ~ExpansionXY() {}
101
103 virtual uint blksz() const = 0;
105 virtual uint m() const = 0;
110 virtual XYColExp* getCol(uint blksz, uint n) const = 0;
117 virtual void evaluate(const concepts::Element<F>& elm,
118 const concepts::Real3d& c,
119 XYColExpPtr* XY[]) const = 0;
125 virtual void shift(const concepts::Real3d& z, const concepts::Real src[],
126 concepts::Real dst[]) const = 0;
127 virtual void shift(const concepts::Real3d& z, const concepts::Cmplx src[],
128 concepts::Cmplx dst[]) const = 0;
135 virtual void apply(const XYColExpPtr* XY, const F src[],
136 F dst[]) const = 0;
137 };
138
139 // *************************************************************** FColExp **
140
143 class FColExp {
144 friend std::ostream& operator<<(std::ostream& os, const FColExp& f);
145 public:
146 virtual ~FColExp() {}
147 virtual uint memory(uint blksz) const = 0;
148 virtual void info(std::ostream& os, uint) const { os << "FColExp()"; }
149 };
150
151 // ***************************************************************** FColF **
152
155 template <class F = concepts::Real>
156 class FColF : public FColExp {
157 public:
158 inline FColF(uint blksz) {this->val_ = new F[blksz];}
159 inline ~FColF() {delete[] this->val_;}
160
161 inline F* value() const {return this->val_;}
162 uint memory(uint blksz) const {
163 return sizeof(FColF<F>) + blksz * sizeof(F);
164 }
165 void info(std::ostream& os, uint blksz) const {
166 for(uint i = 0; i < blksz-1; i++) os << this->val_[i] << ", ";
167 os << this->val_[blksz-1];
168 }
169
170 private:
171 F* val_;
172 };
173
174 // ************************************************************** typedefs **
175
177
178 // ************************************************************ ExpansionF **
179
184 template <class Fspc = concepts::Real>
186 public:
187 virtual ~ExpansionF() {}
188
192 virtual uint blksz(uint m) const = 0;
194 virtual uint m() const = 0;
197 virtual FColExp* getCol(uint blksz) const = 0;
204 virtual void evaluate(uint m, const concepts::Real3d& z,
205 FColExp* Fexp) const = 0;
213 virtual void apply(uint m, const FColExp* Fexp, const Fspc src[],
214 Fspc dst[]) const = 0;
215 };
216
217} // namespace cluster
218
219#endif // expansion_hh
#define conceptsException(exc)
virtual uint blksz(uint m) const =0
virtual void evaluate(uint m, const concepts::Real3d &z, FColExp *Fexp) const =0
virtual void apply(uint m, const FColExp *Fexp, const Fspc src[], Fspc dst[]) const =0
virtual FColExp * getCol(uint blksz) const =0
virtual uint m() const =0
Order of the expansion.
virtual void evaluate(const concepts::Element< F > &elm, const concepts::Real3d &c, XYColExpPtr *XY[]) const =0
virtual uint blksz() const =0
Size of memory used for the expansion.
virtual void shift(const concepts::Real3d &z, const concepts::Real src[], concepts::Real dst[]) const =0
virtual XYColExp * getCol(uint blksz, uint n) const =0
virtual uint m() const =0
Order of the expansion.
virtual void apply(const XYColExpPtr *XY, const F src[], F dst[]) const =0
double Real
Definition typedefs.hh:39
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.
Definition typedefs.hh:42