Class documentation of Concepts

Loading...
Searching...
No Matches
taylor.hh
Go to the documentation of this file.
1
6#ifndef taylor_hh
7#define taylor_hh
8
9#include <cstring>
10
11#include "basics/exceptions.hh"
12#include "bem/element.hh"
13#include "cluster/expansion.hh"
14
15namespace cluster {
16
17 // *************************************************************** TaylorX **
18
22 template <class Fspc = concepts::Real>
23 class TaylorX : public ExpansionXY<Fspc> {
24
26 uint m_;
28 uint blksz_;
30 uint gauss_;
31
32 protected:
35 Fspc* fee_;
36
37 public:
42 TaylorX(uint m, uint gauss);
43
44 ~TaylorX() {delete[] foo_; delete[] fee_;}
45
46 uint blksz() const {return blksz_;}
47 uint m() const {return m_;}
48 uint gauss() const {return gauss_;}
49 inline XYColReal* getCol(uint blksz, uint n) const;
54 void evaluate(const concepts::Real3d& z, concepts::Real X[]) const;
56 inline void shift(const concepts::Real3d& z, const concepts::Real src[],
57 concepts::Real dst[]) const;
58 inline void shift(const concepts::Real3d& z, const concepts::Cmplx src[],
59 concepts::Cmplx dst[]) const;
60 template<class F>
61 void shift(const concepts::Real3d& z, const F src[], F dst[],
62 uint foo) const;
64 void apply(const concepts::Real X[], const Fspc src[], Fspc dst[]) const;
65 inline void apply(const XYColExpPtr* X, const Fspc src[],
66 Fspc dst[]) const;
67
75 const concepts::Real3d& c, XYColExpPtr* X[]) const;
78 const concepts::Real3d& c, XYColExpPtr* X[]) const;
81 const concepts::Real3d& c, XYColExpPtr* X[]) const;
84 const concepts::Real3d& c, XYColExpPtr* X[]) const;
87 const concepts::Real3d& c, XYColExpPtr* X[]) const;
90 const concepts::Real3d& c, XYColExpPtr* X[]) const;
91 };
92
93 template <class Fspc>
94 inline XYColReal* TaylorX<Fspc>::getCol(uint blksz, uint n) const {
95 return new XYColReal(blksz, n);
96 }
97
98 template <class Fspc>
100 const concepts::Real src[],
101 concepts::Real dst[]) const {
102 shift<concepts::Real>(z, src, dst, 0);
103 }
104
105 template <class Fspc>
106 void TaylorX<Fspc>::apply(const XYColExpPtr* X, const Fspc src[],
107 Fspc dst[]) const {
108 const XYColRealPtr* Xtay = dynamic_cast<const XYColRealPtr*>(X);
109 if (Xtay) {apply(Xtay->value(), src, dst); return;}
110
111 throw
112 conceptsException(concepts::MissingFeature("XYColExp not supported"));
113 }
114
115 // ************************************************************** DTaylorX **
116
120 template <class Fspc = concepts::Real>
121 class DTaylorX : public ExpansionXY<Fspc> {
122
124 TaylorX<Fspc> X_;
125
127 uint m_;
129 uint blksz_;
131 uint gauss_;
132
133 protected:
136 Fspc* fee_;
137
138 public:
143 DTaylorX(uint m, uint gauss);
144
145 ~DTaylorX() {delete[] fee_; delete[] foo_;}
146
147 uint blksz() const {return blksz_;}
148 uint m() const {return m_;}
149 uint gauss() const {return gauss_;}
150 inline XYColReal* getCol(uint blksz, uint n) const;
157 concepts::Real X[]) const;
159 inline void shift(const concepts::Real3d& z, const concepts::Real src[],
160 concepts::Real dst[]) const;
161 inline void shift(const concepts::Real3d& z, const concepts::Cmplx src[],
162 concepts::Cmplx dst[]) const;
164 inline void apply(const XYColExpPtr* X, const Fspc src[],
165 Fspc dst[]) const;
166
174 const concepts::Real3d& c, XYColExpPtr* X[]) const;
177 const concepts::Real3d& c, XYColExpPtr* X[]) const;
180 const concepts::Real3d& c, XYColExpPtr* X[]) const;
183 const concepts::Real3d& c, XYColExpPtr* X[]) const;
186 const concepts::Real3d& c, XYColExpPtr* X[]) const;
187 };
188
189 template <class Fspc>
190 inline XYColReal* DTaylorX<Fspc>::getCol(uint blksz, uint n) const {
191 return new XYColReal(blksz, n);
192 }
193
194 template <class Fspc>
196 const concepts::Real src[],
197 concepts::Real dst[]) const {
198 X_.shift(z, src, dst);
199 }
200
201 template <class Fspc>
202 inline void DTaylorX<Fspc>::shift(const concepts::Real3d& z,
203 const concepts::Cmplx src[],
204 concepts::Cmplx dst[]) const {
205 X_.shift(z, src, dst);
206 }
207
208 template <class Fspc>
209 inline void DTaylorX<Fspc>::apply(const XYColExpPtr* X,
210 const Fspc src[], Fspc dst[]) const {
211 const XYColRealPtr* Xtay = dynamic_cast<const XYColRealPtr*>(X);
212 if (Xtay) {X_.apply(Xtay->value(), src, dst); return;}
213
214 throw
215 conceptsException(concepts::MissingFeature("XYColExp not supported"));
216 }
217
218 // *************************************************************** TaylorY **
219
223 template <class Fspc = concepts::Real>
224 class TaylorY : public ExpansionXY<Fspc> {
225
227 uint m_;
229 uint blksz_;
231 uint gauss_;
232
233 protected:
236 Fspc* fee_;
237
238 public:
243 TaylorY(uint m, uint gauss);
244
245 ~TaylorY() {delete[] foo_; delete[] fee_;}
246
247 uint blksz() const {return blksz_;}
248 uint m() const {return m_;}
249 uint gauss() const {return gauss_;}
250 inline XYColReal* getCol(uint blksz, uint n) const;
255 void evaluate(const concepts::Real3d& z, concepts::Real Y[]) const;
256 inline void shift(const concepts::Real3d& z, const concepts::Real src[],
257 concepts::Real dst[]) const;
258 inline void shift(const concepts::Real3d& z, const concepts::Cmplx src[],
259 concepts::Cmplx dst[]) const;
260 template<class F>
261 void shift(const concepts::Real3d& z, const F src[], F dst[],
262 uint foo) const;
264 void apply(const concepts::Real Y[], const Fspc src[], Fspc dst[]) const;
265 inline void apply(const XYColExpPtr* Y, const Fspc src[],
266 Fspc dst[]) const;
267
275 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
278 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
281 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
284 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
287 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
290 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
291 };
292
293 template <class Fspc>
294 inline XYColReal* TaylorY<Fspc>::getCol(uint blksz, uint n) const {
295 return new XYColReal(blksz, n);
296 }
297
298 template <class Fspc>
300 const concepts::Real src[],
301 concepts::Real dst[]) const {
302 shift(z, src, dst, 0);
303 }
304
305 template <class Fspc>
306 inline void TaylorY<Fspc>::apply(const XYColExpPtr* Y, const Fspc src[],
307 Fspc dst[]) const {
308 const XYColRealPtr* Ytay = dynamic_cast<const XYColRealPtr*>(Y);
309 if (Ytay) {apply(Ytay->value(), src, dst); return;}
310
311 throw
312 conceptsException(concepts::MissingFeature("XYColExp not supported"));
313 }
314
315 // ************************************************************** DTaylorY **
316
320 template <class Fspc = concepts::Real>
321 class DTaylorY : public ExpansionXY<Fspc> {
322
324 TaylorY<Fspc> Y_;
325
327 uint m_;
329 uint blksz_;
331 uint gauss_;
332
333 protected:
336 concepts::Real* fee_;
337
338 public:
343 DTaylorY(uint m, uint gauss);
344
345 ~DTaylorY() {delete[] fee_; delete[] foo_;}
346
347 uint blksz() const {return blksz_;}
348 uint m() const {return m_;}
349 uint gauss() const {return gauss_;}
350 inline XYColReal* getCol(uint blksz, uint n) const;
357 concepts::Real Y[]) const;
358 inline void shift(const concepts::Real3d& z, const concepts::Real src[],
359 concepts::Real dst[]) const;
360 inline void shift(const concepts::Real3d& z, const concepts::Cmplx src[],
361 concepts::Cmplx dst[]) const;
363 inline void apply(const XYColExpPtr* Y, const Fspc src[],
364 Fspc dst[]) const;
365
373 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
376 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
379 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
382 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
385 const concepts::Real3d& c, XYColExpPtr* Y[]) const;
386 };
387
388 template <class Fspc>
389 inline XYColReal* DTaylorY<Fspc>::getCol(uint blksz, uint n) const {
390 return new XYColReal(blksz, n);
391 }
392
393 template <class Fspc>
395 const concepts::Real src[],
396 concepts::Real dst[]) const {
397 Y_.shift(z, src, dst);
398 }
399
400 template <class Fspc>
401 inline void DTaylorY<Fspc>::shift(const concepts::Real3d& z,
402 const concepts::Cmplx src[],
403 concepts::Cmplx dst[]) const {
404 Y_.shift(z, src, dst);
405 }
406
407 template <class Fspc>
408 inline void DTaylorY<Fspc>::apply(const XYColExpPtr* Y,
409 const Fspc src[], Fspc dst[]) const {
410 const XYColRealPtr* Ytay = dynamic_cast<const XYColRealPtr*>(Y);
411 if (Ytay) {Y_.apply(Ytay->value(), src, dst); return;}
412
413 throw
414 conceptsException(concepts::MissingFeature("XYColExp not supported"));
415 }
416
417 // ******************************************************** TaylorLapalceF **
418
422 template <class Fspc = concepts::Real>
423 class TaylorLaplaceF : public ExpansionF<Fspc> {
425 uint m_;
426
428 concepts::Real* foo_;
429
430 public:
434 TaylorLaplaceF(uint m) {m_ = m; foo_ = new concepts::Real[blksz(m)];}
435
436 virtual ~TaylorLaplaceF() {delete[] foo_;}
437
441 uint blksz(uint m) const {return (m * (m * (m + 3) + 2)) / 6;}
442 uint m() const {return m_;}
445 virtual FColReal* getCol(uint blksz) const {
446 return new FColReal(blksz);
447 }
449 inline void evaluate(uint m, const concepts::Real3d& z,
450 FColExp* Fexp) const;
451 void evaluate(uint m, const concepts::Real3d& z, FColReal Fexp[]) const;
453 inline void apply(uint m, const FColExp* Fexp, const Fspc src[],
454 Fspc dst[]) const;
455 void apply(uint m, const FColReal Fexp[], const Fspc src[],
456 Fspc dst[]) const;
457 };
458
459 template <class Fspc>
461 FColExp* Fexp) const {
462 FColReal* Ftay = dynamic_cast<FColReal*>(Fexp);
463 if (Ftay) {evaluate(m, z, Ftay); return;}
464
465 throw
466 conceptsException(concepts::MissingFeature("FColExp not supported"));
467 }
468
469 template <class Fspc>
470 void TaylorLaplaceF<Fspc>::apply(uint m, const FColExp* Fexp,
471 const Fspc src[], Fspc dst[]) const {
472 const FColReal* Ftay = dynamic_cast<const FColReal*>(Fexp);
473 if (Ftay) {apply(m, Ftay, src, dst); return;}
474
475 throw
476 conceptsException(concepts::MissingFeature("FColExp not supported"));
477 }
478
479} // namespace cluster
480
481#endif // taylor_hh
#define conceptsException(exc)
uint blksz() const
Size of memory used for the expansion.
Definition taylor.hh:147
XYColReal * getCol(uint blksz, uint n) const
Definition taylor.hh:190
void evaluate(const bem::Constant3d001< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
DTaylorX(uint m, uint gauss)
void evaluate(const concepts::Real3d &z, const concepts::Unit3d &h, concepts::Real X[]) const
uint m() const
Order of the expansion.
Definition taylor.hh:148
void evaluate(const concepts::Element< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const bem::Linear3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void apply(const XYColExpPtr *X, const Fspc src[], Fspc dst[]) const
Definition taylor.hh:209
void shift(const concepts::Real3d &z, const concepts::Real src[], concepts::Real dst[]) const
Shifting the expansion coefficients.
Definition taylor.hh:195
concepts::Real * foo_
Auxiliary vectors.
Definition taylor.hh:135
void evaluate(const bem::Constant3d002< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const bem::Constant3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
XYColReal * getCol(uint blksz, uint n) const
Definition taylor.hh:389
void shift(const concepts::Real3d &z, const concepts::Real src[], concepts::Real dst[]) const
Definition taylor.hh:394
void evaluate(const bem::Constant3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
uint blksz() const
Size of memory used for the expansion.
Definition taylor.hh:347
void evaluate(const concepts::Real3d &z, const concepts::Unit3d &h, concepts::Real Y[]) const
concepts::Real * foo_
Auxiliary vectors.
Definition taylor.hh:335
void evaluate(const bem::Constant3d002< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
uint m() const
Order of the expansion.
Definition taylor.hh:348
DTaylorY(uint m, uint gauss)
void evaluate(const bem::Constant3d001< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
void evaluate(const concepts::Element< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
void apply(const XYColExpPtr *Y, const Fspc src[], Fspc dst[]) const
Definition taylor.hh:408
void evaluate(const bem::Linear3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
uint m() const
Order of the expansion.
Definition taylor.hh:442
virtual FColReal * getCol(uint blksz) const
Definition taylor.hh:445
void evaluate(uint m, const concepts::Real3d &z, FColExp *Fexp) const
Definition taylor.hh:460
uint blksz(uint m) const
Definition taylor.hh:441
void apply(uint m, const FColExp *Fexp, const Fspc src[], Fspc dst[]) const
Definition taylor.hh:470
void shift(const concepts::Real3d &z, const concepts::Real src[], concepts::Real dst[]) const
Shifting the expansion coefficients.
Definition taylor.hh:99
void evaluate(const bem::Constant3d002< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const bem::Linear3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
uint blksz() const
Size of memory used for the expansion.
Definition taylor.hh:46
void apply(const concepts::Real X[], const Fspc src[], Fspc dst[]) const
uint m() const
Order of the expansion.
Definition taylor.hh:47
TaylorX(uint m, uint gauss)
concepts::Real * foo_
Auxiliary vectors.
Definition taylor.hh:34
XYColReal * getCol(uint blksz, uint n) const
Definition taylor.hh:94
void evaluate(const concepts::Real3d &z, concepts::Real X[]) const
void evaluate(const bem::Constant3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const bem::Constant3d001< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const concepts::Element< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const bem::Dirac3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const bem::Constant3d002< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
void shift(const concepts::Real3d &z, const concepts::Real src[], concepts::Real dst[]) const
Definition taylor.hh:299
concepts::Real * foo_
Auxiliary vectors.
Definition taylor.hh:235
void evaluate(const bem::Constant3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
void evaluate(const bem::Dirac3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
void apply(const concepts::Real Y[], const Fspc src[], Fspc dst[]) const
uint blksz() const
Size of memory used for the expansion.
Definition taylor.hh:247
TaylorY(uint m, uint gauss)
uint m() const
Order of the expansion.
Definition taylor.hh:248
void evaluate(const concepts::Real3d &z, concepts::Real Y[]) const
void evaluate(const concepts::Element< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
XYColReal * getCol(uint blksz, uint n) const
Definition taylor.hh:294
void evaluate(const bem::Linear3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
void evaluate(const bem::Constant3d001< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
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