Class documentation of Concepts

Loading...
Searching...
No Matches
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
13namespace 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:
27 concepts::Real* val;
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_;
45 concepts::Real eta_;
47 concepts::Real** cebysev_;
53 concepts::Real* kernel_;
56 concepts::Real* dd_;
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>
116 inline void CebysevLaplaceF<Fspc>::evaluate(uint m,
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
#define conceptsException(exc)
CebysevLaplaceF(uint m, concepts::Real eta)
virtual FColReal * getCol(uint blksz) const
Allocates memory for the expansion coefficients.
Definition cebysev.hh:72
uint m() const
Order of the expansion.
Definition cebysev.hh:70
void ceby2poly(uint m, const concepts::Real3d &z, concepts::Real F[]) const
Conversion from Cebysev to monomial basis of interpolation polynom.
void fit(uint m, const concepts::Real3d &z, concepts::Real F[]) const
Interpolation.
void apply(uint m, const FColExp *Fexp, const Fspc src[], Fspc dst[]) const
Definition cebysev.hh:125
uint blksz(uint m) const
Definition cebysev.hh:69
void evaluate(uint m, const concepts::Real3d &z, FColExp *Fexp) const
Definition cebysev.hh:101
double Real
Definition typedefs.hh:39