cebysev.hh

Go to the documentation of this file.
1 
6 #ifndef cebysev_hh
7 #define cebysev_hh
8 
9 #include "basics/output.hh"
10 #include "basics/exceptions.hh"
11 #include "cluster/expansion.hh"
12 
13 namespace cluster {
14 
15  // ******************************************************* CebysevLaplaceF **
16 
20  template <class Fspc = concepts::Real>
21  class CebysevLaplaceF : public ExpansionF<Fspc> {
22 
25  class FColCebyLpl : public FColExp {
26  public:
28 
29  inline FColCebyLpl(uint blksz) {val = new concepts::Real[blksz];}
30  inline ~FColCebyLpl() {delete[] val;}
31 
32  uint memory(uint blksz) const {
33  return sizeof(FColCebyLpl) + blksz * sizeof(concepts::Real);
34  }
35  void info(std::ostream& os, uint blksz) const {
36  for(uint i = 0; i < blksz-1; i++) os << val[i] << ", ";
37  os << val[blksz-1] << ")";
38 
39  }
40  };
41 
43  uint m_;
57 
58  inline int index_(int ix, int iy, int iz) const;
59 
60  public:
66 
67  virtual ~CebysevLaplaceF();
68 
69  uint blksz(uint m) const {return (m * (m * (m + 3) + 2)) / 6;}
70  uint m() const {return m_;}
72  virtual FColReal* getCol(uint blksz) const {
73  return new FColReal(blksz);
74  }
75 
77  void fit(uint m, const concepts::Real3d& z, concepts::Real F[]) const;
79  void ceby2poly(uint m, const concepts::Real3d& z,
80  concepts::Real F[]) const;
81 
83  inline void evaluate(uint m, const concepts::Real3d& z,
84  FColExp* Fexp) const;
85  inline void evaluate(uint m, const concepts::Real3d& z,
86  FColReal Fexp[]) const;
88  inline void apply(uint m, const FColExp* Fexp, const Fspc src[],
89  Fspc dst[]) const;
90  void apply(uint m, const FColReal Fexp[], const Fspc src[],
91  Fspc dst[]) const;
92  };
93 
94  template <class Fspc>
95  inline int CebysevLaplaceF<Fspc>::index_(int ix, int iy, int iz) const {
96  int m = ix + iy + iz;
97  return (((m+3)*m+2)*m + ((3-ix)*3*ix)) / 6 + m*ix + iy;
98  }
99 
100  template <class Fspc>
102  const concepts::Real3d& z,
103  FColExp* Fexp) const {
104  FColReal* fexp = dynamic_cast<FColReal*>(Fexp);
105  if (fexp) {
106  concepts::Real* F = fexp->value();
107  fit(m, z, F); ceby2poly(m, z, F);
108  return;
109  }
110 
111  throw
112  conceptsException(concepts::MissingFeature("FColExp not supported"));
113  }
114 
115  template <class Fspc>
117  const concepts::Real3d& z,
118  FColReal Fexp[]) const {
119  concepts::Real* F = Fexp->value();
120  fit(m, z, F); ceby2poly(m, z, F);
121  return;
122  }
123 
124  template <class Fspc>
125  inline void CebysevLaplaceF<Fspc>::apply(uint m, const FColExp* Fexp,
126  const Fspc src[], Fspc dst[]) const {
127  const FColReal* fexp = dynamic_cast<const FColReal*>(Fexp);
128  if (fexp) {apply(m, fexp, src, dst); return;}
129 
130  throw
131  conceptsException(concepts::MissingFeature("FColExp not supported"));
132  }
133 
134 } // namespace cluster
135 
136 #endif // cebysev_hh
137 
concepts::Real * y_
Definition: cebysev.hh:50
uint memory(uint blksz) const
Definition: cebysev.hh:32
void ceby2poly(uint m, const concepts::Real3d &z, concepts::Real F[]) const
Conversion from Cebysev to monomial basis of interpolation polynom.
void info(std::ostream &os, uint blksz) const
Definition: cebysev.hh:35
void evaluate(uint m, const concepts::Real3d &z, FColExp *Fexp) const
Definition: cebysev.hh:101
uint blksz(uint m) const
Size of memory used for the expansion.
Definition: cebysev.hh:69
Class to hold expansion coefficients of type F.
Definition: expansion.hh:156
concepts::Real * x_
Interpolation points.
Definition: cebysev.hh:49
F * value() const
Definition: expansion.hh:161
#define conceptsException(exc)
Prepares an exception for throwing.
Definition: exceptions.hh:344
concepts::Real ** cebysev_
Values of the Cebysev polynomials.
Definition: cebysev.hh:47
concepts::Real * d_
Auxiliary vectors.
Definition: cebysev.hh:55
Class to hold the expansion coefficients.
Definition: cebysev.hh:25
uint m_
Expansion order.
Definition: cebysev.hh:43
concepts::Real * z_
Definition: cebysev.hh:51
FColF< concepts::Real > FColReal
Definition: expansion.hh:176
void apply(uint m, const FColExp *Fexp, const Fspc src[], Fspc dst[]) const
Definition: cebysev.hh:125
CebysevLaplaceF(uint m, concepts::Real eta)
Constructor.
virtual FColReal * getCol(uint blksz) const
Allocates memory for the expansion coefficients.
Definition: cebysev.hh:72
void apply(uint m, const FColReal Fexp[], const Fspc src[], Fspc dst[]) const
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
concepts::Real * dd_
Definition: cebysev.hh:56
concepts::Real eta_
Interpolation coefficient.
Definition: cebysev.hh:45
part of the Cebysev expansion of the Laplace kernel.
Definition: cebysev.hh:21
int index_(int ix, int iy, int iz) const
Definition: cebysev.hh:95
void fit(uint m, const concepts::Real3d &z, concepts::Real F[]) const
Interpolation.
concepts::Real * kernel_
values of the kernel function
Definition: cebysev.hh:53
Exception class to express a missing feature.
Definition: exceptions.hh:206
void apply(Operator< F > &op, const Matrix< H > &mX, Matrix< I > &mY)
Multiplication with a matrix.
Definition: matrix.hh:256
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
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