Class documentation of Concepts

Loading...
Searching...
No Matches
cebysevK.hh
Go to the documentation of this file.
1
6#ifndef clusterCebysevK_hh
7#define clusterCebysevK_hh
8
10#include "cluster/expansion.hh"
11#include "bem/kernel.hh"
12
13namespace cluster {
14
15 // ******************************************************* CebysevKFTraits **
16
19 template <class K>
21 public:
22 typedef typename K::F Fkrnl;
23
24 static Fkrnl eval(K& k, const concepts::Real3d& x,
25 const concepts::Real3d& y) {return k(x, y);}
26 };
27
28 // ************************************************************* CebysevKF **
29
34 template <class K = bem::Laplace, class Fspc = concepts::Real>
35 class CebysevKF : public ExpansionF<Fspc> {
36 public:
38 typedef typename Traits::Fkrnl Fkrnl;
39
40 private:
42 uint m_;
44 concepts::Real eta_;
46 concepts::Real** cebysev_;
52 Fkrnl* kernel_;
54 K& krnl_;
56 Fkrnl* d_;
57 Fkrnl* dd_;
58
59 inline int index_(int ix, int iy, int iz) const;
60
61 public:
67 CebysevKF(K& krnl, uint m, concepts::Real eta);
68
69 virtual ~CebysevKF();
70
71 uint blksz(uint m) const {return (m * (m * (m + 3) + 2)) / 6;}
72 uint m() const {return m_;}
74 virtual FColF<Fkrnl>* getCol(uint blksz) const {
75 return new FColF<Fkrnl>(blksz);
76 }
77
79 void fit(uint m, const concepts::Real3d& z, Fkrnl F[]) const;
81 void ceby2poly(uint m, const concepts::Real3d& z, Fkrnl F[]) const;
82
84 inline void evaluate(uint m, const concepts::Real3d& z,
85 FColExp* Fexp) const;
86 inline void evaluate(uint m, const concepts::Real3d& z,
87 FColF<Fkrnl> Fexp[]) const;
89 inline void apply(uint m, const FColExp* Fexp,
90 const Fspc src[], Fspc dst[]) const;
91 void apply(uint m, const FColF<Fkrnl> Fexp[],
92 const Fspc src[], Fspc dst[]) const;
93 };
94
95 template <class K, class Fspc>
96 inline int CebysevKF<K, Fspc>::index_(int ix, int iy, int iz) const {
97 int m = ix + iy + iz;
98 return (((m+3)*m+2)*m + ((3-ix)*3*ix)) / 6 + m*ix + iy;
99 }
100
101 template <class K, class Fspc>
102 inline void CebysevKF<K, Fspc>::evaluate(uint m, const concepts::Real3d& z,
103 FColExp* Fexp) const {
104 FColF<Fkrnl>* fexp = dynamic_cast<FColF<Fkrnl>*>(Fexp);
105 if (fexp) {
106 Fkrnl* 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 K, class Fspc>
116 inline void CebysevKF<K, Fspc>::evaluate(uint m, const concepts::Real3d& z,
117 FColF<Fkrnl> Fexp[]) const {
118 Fkrnl* F = Fexp->value();
119 fit(m, z, F); ceby2poly(m, z, F);
120 }
121
122 template <class K, class Fspc>
123 inline void CebysevKF<K, Fspc>::apply(uint m, const FColExp* Fexp,
124 const Fspc src[], Fspc dst[]) const {
125 const FColF<Fkrnl>* fexp = dynamic_cast<const FColF<Fkrnl>*>(Fexp);
126 if (fexp) {apply(m, fexp, src, dst); return;}
127
128 throw
129 conceptsException(concepts::MissingFeature("FColExp not supported"));
130 }
131
132} // namespace cluster
133
134#endif // clusterCebysevK_hh
#define conceptsException(exc)
void fit(uint m, const concepts::Real3d &z, Fkrnl F[]) const
Interpolation.
CebysevKF(K &krnl, uint m, concepts::Real eta)
uint m() const
Order of the expansion.
Definition cebysevK.hh:72
virtual FColF< Fkrnl > * getCol(uint blksz) const
Allocates memory for the expansion coefficients.
Definition cebysevK.hh:74
void evaluate(uint m, const concepts::Real3d &z, FColExp *Fexp) const
Definition cebysevK.hh:102
void apply(uint m, const FColExp *Fexp, const Fspc src[], Fspc dst[]) const
Definition cebysevK.hh:123
void ceby2poly(uint m, const concepts::Real3d &z, Fkrnl F[]) const
Conversion from Cebysev to monomial basis of interpolation polynom.
uint blksz(uint m) const
Definition cebysevK.hh:71
double Real
Definition typedefs.hh:39