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 
15 namespace 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>
99  inline void TaylorX<Fspc>::shift(const concepts::Real3d& z,
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 
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;
156  void evaluate(const concepts::Real3d& z, const concepts::Unit3d& h,
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>
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 
325 
327  uint m_;
329  uint blksz_;
331  uint gauss_;
332 
333  protected:
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;
356  void evaluate(const concepts::Real3d& z, const concepts::Unit3d& h,
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>
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 
429 
430  public:
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
XYColReal * getCol(uint blksz, uint n) const
Allocates memory for the expansion coefficients and sets it to zero.
Definition: taylor.hh:389
void shift(const concepts::Real3d &z, const concepts::Cmplx src[], concepts::Cmplx dst[]) const
DTaylorY(uint m, uint gauss)
Constructor.
void evaluate(const bem::Constant3d001< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
uint blksz() const
Definition: taylor.hh:347
uint m_
Expansion order.
Definition: taylor.hh:227
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 concepts::Real3d &z, const concepts::Unit3d &h, concepts::Real Y[]) const
Evaluation of the expansion coefficients of one point.
virtual FColReal * getCol(uint blksz) const
Allocates memory for the expansion coefficients.
Definition: taylor.hh:445
uint blksz_
Memory used for expansion coefficients.
Definition: taylor.hh:229
An abstract class for an element of a space.
Definition: exceptions.hh:15
void evaluate(const bem::Constant3d002< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
concepts::Real * foo_
Auxiliary vectors.
Definition: taylor.hh:235
void evaluate(const concepts::Element< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
Computation of the expansion coefficients.
TaylorLaplaceF(uint m)
Constructor.
Definition: taylor.hh:434
void shift(const concepts::Real3d &z, const concepts::Cmplx src[], concepts::Cmplx dst[]) const
TaylorY< Fspc > Y_
Expansion used for shift and apply.
Definition: taylor.hh:324
void evaluate(const bem::Constant3d001< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
Linear triangular element.
Definition: element.hh:141
XYColF< concepts::Real > XYColReal
Definition: expansion.hh:89
XYColReal * getCol(uint blksz, uint n) const
Allocates memory for the expansion coefficients and sets it to zero.
Definition: taylor.hh:294
uint m_
Expansion order.
Definition: taylor.hh:327
Class to hold expansion coefficients of type F.
Definition: expansion.hh:156
TaylorX< Fspc > X_
Expansion used for shift and apply.
Definition: taylor.hh:124
Constant triangular element.
Definition: element.hh:239
#define conceptsException(exc)
Prepares an exception for throwing.
Definition: exceptions.hh:344
uint blksz() const
Definition: taylor.hh:46
DTaylorX(uint m, uint gauss)
Constructor.
void shift(const concepts::Real3d &z, const F src[], F dst[], uint foo) const
void evaluate(const bem::Linear3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
concepts::Real * foo_
Auxiliary vectors.
Definition: taylor.hh:335
void evaluate(const bem::Constant3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
uint m() const
Definition: taylor.hh:47
void evaluate(const concepts::Element< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
Computation of the expansion coefficients.
void evaluate(const bem::Constant3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
uint blksz(uint m) const
Size of memory used for the expansion.
Definition: taylor.hh:441
uint m() const
Definition: taylor.hh:442
void evaluate(const bem::Constant3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const bem::Linear3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
part of the Taylor kernel expansion
Definition: taylor.hh:224
void evaluate(const concepts::Element< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
Computation of the expansion coefficients.
void evaluate(const bem::Constant3d002< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
uint gauss() const
Definition: taylor.hh:249
void evaluate(const concepts::Real3d &z, concepts::Real Y[]) const
Evaluation of the expansion coefficients of one point.
uint gauss_
Number of quadrature points.
Definition: taylor.hh:30
concepts::Real * foo_
Auxiliary vectors.
Definition: taylor.hh:34
void apply(uint m, const FColExp *Fexp, const Fspc src[], Fspc dst[]) const
Definition: taylor.hh:470
void apply(const concepts::Real Y[], const Fspc src[], Fspc dst[]) const
uint gauss_
Number of quadrature points.
Definition: taylor.hh:131
void evaluate(const bem::Linear3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void shift(const concepts::Real3d &z, const F src[], F dst[], uint foo) const
void evaluate(const concepts::Real3d &z, const concepts::Unit3d &h, concepts::Real X[]) const
Evaluation of the expansion coefficients of one point.
void evaluate(uint m, const concepts::Real3d &z, FColExp *Fexp) const
Definition: taylor.hh:460
uint blksz_
Memory used for expansion coefficients.
Definition: taylor.hh:28
uint m() const
Definition: taylor.hh:148
uint m_
Expansion order.
Definition: taylor.hh:26
Constant space element with a level dependent key.
Definition: element.hh:335
TaylorY(uint m, uint gauss)
Constructor.
void apply(const XYColExpPtr *Y, const Fspc src[], Fspc dst[]) const
Definition: taylor.hh:408
uint gauss() const
Definition: taylor.hh:149
uint m() const
Definition: taylor.hh:248
XYColReal * getCol(uint blksz, uint n) const
Allocates memory for the expansion coefficients and sets it to zero.
Definition: taylor.hh:94
void evaluate(uint m, const concepts::Real3d &z, FColReal Fexp[]) const
void apply(const XYColExpPtr *Y, const Fspc src[], Fspc dst[]) const
Definition: taylor.hh:306
virtual ~TaylorLaplaceF()
Definition: taylor.hh:436
Abstract class for the and the part of a kernel expansion.
Definition: expansion.hh:98
void shift(const concepts::Real3d &z, const concepts::Real src[], concepts::Real dst[]) const
Shifting the expansion.
Definition: taylor.hh:394
void apply(const XYColExpPtr *X, const Fspc src[], Fspc dst[]) const
Definition: taylor.hh:106
A vector of dimension dim and length 1.
FColF< concepts::Real > FColReal
Definition: expansion.hh:176
Fspc * fee_
Definition: taylor.hh:35
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.
Definition: typedefs.hh:39
uint m_
Expansion order.
Definition: taylor.hh:127
uint blksz() const
Definition: taylor.hh:247
uint blksz_
Memory used for expansion coefficients.
Definition: taylor.hh:329
uint gauss() const
Definition: taylor.hh:349
TaylorX(uint m, uint gauss)
Constructor.
Used for the cluster classes for the boundary element method.
Definition: cebysev.hh:13
Abstract class for the part of a kernel expansion.
Definition: expansion.hh:185
void evaluate(const bem::Linear3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
Constant triangular element with normed basis function.
Definition: element.hh:427
uint blksz() const
Definition: taylor.hh:147
Normal derivative of the part of the Taylor kernel expansion.
Definition: taylor.hh:121
part of the Taylor expansion of the Laplace kernel.
Definition: taylor.hh:423
void apply(const concepts::Real X[], const Fspc src[], Fspc dst[]) const
void evaluate(const bem::Constant3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
uint gauss() const
Definition: taylor.hh:48
uint blksz_
Memory used for expansion coefficients.
Definition: taylor.hh:129
Exception class to express a missing feature.
Definition: exceptions.hh:206
F * value() const
Definition: expansion.hh:37
Class to hold expansion coefficients of type F.
Definition: expansion.hh:60
uint gauss_
Number of quadrature points.
Definition: taylor.hh:231
Dirac element on triangles (used for collocation method).
Definition: element.hh:29
concepts::Real * foo_
Auxiliary vectors.
Definition: taylor.hh:135
void evaluate(const bem::Constant3d002< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void apply(Operator< F > &op, const Matrix< H > &mX, Matrix< I > &mY)
Multiplication with a matrix.
Definition: matrix.hh:256
Abstract class for a pointer to the expansion coefficients.
Definition: expansion.hh:18
concepts::Real * foo_
Auxiliary vector.
Definition: taylor.hh:428
XYColReal * getCol(uint blksz, uint n) const
Allocates memory for the expansion coefficients and sets it to zero.
Definition: taylor.hh:190
void evaluate(const concepts::Element< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
Computation of the expansion coefficients.
void apply(uint m, const FColReal Fexp[], const Fspc src[], Fspc dst[]) const
void evaluate(const concepts::Real3d &z, concepts::Real X[]) const
Evaluation of the expansion coefficients of one point.
void evaluate(const bem::Dirac3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
uint m() const
Definition: taylor.hh:348
void evaluate(const bem::Constant3d001< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *Y[]) const
void shift(const concepts::Real3d &z, const concepts::Real src[], concepts::Real dst[]) const
Shifting the expansion coefficients.
Definition: taylor.hh:195
void apply(const XYColExpPtr *X, const Fspc src[], Fspc dst[]) const
Definition: taylor.hh:209
uint m_
Expansion order.
Definition: taylor.hh:425
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
Shifting the expansion.
Definition: taylor.hh:299
Normal derivative of the part of the Taylor kernel expansion.
Definition: taylor.hh:321
part of the Taylor kernel expansion
Definition: taylor.hh:23
void evaluate(const bem::Constant3d001< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
void evaluate(const bem::Dirac3d000< Fspc > &elm, const concepts::Real3d &c, XYColExpPtr *X[]) const
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
uint gauss_
Number of quadrature points.
Definition: taylor.hh:331
concepts::Real * fee_
Definition: taylor.hh:336
Abstract class to hold the expansion coefficients.
Definition: expansion.hh:143
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich