Class documentation of Concepts

Loading...
Searching...
No Matches
xy01.hh
Go to the documentation of this file.
1
6#ifndef clusterXY01_hh
7#define clusterXY01_hh
8
10#include "cluster/xy.hh"
11
12namespace cluster {
13
14 // ****************************************************************** XY01 **
15
19 template<class Node>
20 class XY01 {
23 typedef typename Traits::F F;
24
25 const Tree<Node>& tree_;
26 F* fncval_;
27
33 void constructor_(const Node* chld, const Node* prnt);
35 bool info_(std::ostream& os, uint idx, const Node* nd) const;
36
37 protected:
40 struct XYFnc {
44 F* pval;
46 F* val;
47 };
48
51 struct XYCol {
55 uint idx;
60
62 XYCol(XYColExp* value) : val(value) {}
64 ~XYCol() {delete val;}
65 };
66
70 const uint blksz_;
71
75 const uint nfnc_;
79 uint ncol_;
80
82 std::ostream& info(std::ostream& os) const;
83
84 public:
89 XY01(const Tree<Node>& tree, const ExpansionXY<F>& exp);
90 ~XY01();
91
93 inline F* operator[](uint i) const {return fnc_[i].val;}
95 inline float memory() const;
97 inline const concepts::Space<F>& space() const {return tree_.space();}
99 inline const Tree<Node>& tree() const {return tree_;}
101 void zero();
103 std::ostream& info(std::ostream& os, uint idx) const;
104 };
105
106 template<class Node>
107 inline float XY01<Node>::memory() const {
108 return sizeof(XY01<Node>)
109 + (float)ncol_ * (sizeof(XYCol) + (col_ ? col_->val->memory() : 0))
110 + (float)nfnc_ * (sizeof(XYFnc) + blksz_ * sizeof(F));
111 }
112
113 // ******************************************************************* X01 **
114
118 template<class Node>
119 class X01 : public ClstX<Node>, private XY01<Node> {
120 public:
122 typedef typename ClstX<Node>::Traits Traits;
123 typedef typename ClstX<Node>::F F;
124
125 inline X01(const Tree<Node>& tree, const ExpansionXY<F>& exp);
126
130 inline F* operator[](uint i) const;
131 void gather(concepts::Vector<F>& fnc);
133 inline float memory() const;
135 inline const concepts::Space<F>& space() const;
137 inline const Tree<Node>& tree() const;
139 inline void zero() {XY01<Node>::zero();}
140
141 protected:
142 typedef typename XY01<Node>::XYFnc XYFnc;
143 typedef typename XY01<Node>::XYCol XYCol;
144
145 inline std::ostream& info(std::ostream& os) const;
146 };
147
148 template<class Node>
149 inline X01<Node>::X01(const Tree<Node>& tree, const ExpansionXY<F>& exp)
150 : XY01<Node>(tree, exp) {
151 }
152
153 template<class Node>
154 inline typename X01<Node>::F* X01<Node>::operator[](uint i) const {
155 return XY01<Node>::operator[](i);
156 }
157
158 template<class Node>
159 inline const Tree<Node>& X01<Node>::tree() const {
160 return XY01<Node>::tree();
161 }
162
163 template<class Node>
166 return XY01<Node>::space();
167 }
168
169 template<class Node>
170 inline std::ostream& X01<Node>::info(std::ostream& os) const {
171 os << concepts::typeOf(*this) <<"("; XY01<Node>::info(os);
172 os << ", mem = " << memory() / 1024.0 << "KB)";
173 return os;
174 }
175
176 template<class Node>
177 inline float X01<Node>::memory() const {
178 return sizeof(X01<Node>) + XY01<Node>::memory() - sizeof(XY01<Node>);
179 }
180
181 // ******************************************************************* Y01 **
182
186 template<class Node>
187 class Y01 : public ClstY<Node>, private XY01<Node> {
188 public:
190 typedef typename ClstY<Node>::Traits Traits;
191 typedef typename ClstY<Node>::F F;
192
193 inline Y01(const Tree<Node>& tree, const ExpansionXY<F>& exp);
194
198 inline F* operator[](uint i) const;
199 void scatter(const concepts::Vector<F>& fnc);
201 inline float memory() const;
203 inline const concepts::Space<F>& space() const;
205 inline const Tree<Node>& tree() const;
207 inline void zero() {XY01<Node>::zero();}
208
209 protected:
210 typedef typename XY01<Node>::XYFnc XYFnc;
211 typedef typename XY01<Node>::XYCol XYCol;
212
213 inline std::ostream& info(std::ostream& os) const;
214 };
215
216 template<class Node>
217 inline Y01<Node>::Y01(const Tree<Node>& tree, const ExpansionXY<F>& exp)
218 : XY01<Node>(tree, exp) {
219 }
220
221 template<class Node>
222 inline typename Y01<Node>::F* Y01<Node>::operator[](uint i) const {
223 return XY01<Node>::operator[](i);
224 }
225
226 template<class Node>
227 inline const Tree<Node>& Y01<Node>::tree() const {
228 return XY01<Node>::tree();
229 }
230
231 template<class Node>
234 return XY01<Node>::space();
235 }
236
237 template<class Node>
238 inline std::ostream& Y01<Node>::info(std::ostream& os) const {
239 os << concepts::typeOf(*this) << "("; XY01<Node>::info(os);
240 os << ", mem = " << memory() / 1024.0 << "KB)";
241 return os;
242 }
243
244 template<class Node>
245 inline float Y01<Node>::memory() const {
246 return sizeof(Y01<Node>) + XY01<Node>::memory() - sizeof(XY01<Node>);
247 }
248
249} // namespace cluster
250
251#endif // clusterXY01_hh
Node::CF F
Field of the node (Real or Cmplx)
Definition tree.hh:255
const concepts::Space< F > & space() const
Space of the tree.
Definition tree.hh:310
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition xy01.hh:170
ClstX< Node >::Traits Traits
Interface for the far field X.
Definition xy01.hh:122
void zero()
Sets the auxiliary vectors to zero.
Definition xy01.hh:139
const Tree< Node > & tree() const
Cluster tree.
Definition xy01.hh:159
float memory() const
Size of memory used by X01 in Bytes.
Definition xy01.hh:177
const concepts::Space< F > & space() const
Space.
Definition xy01.hh:165
F * operator[](uint i) const
Definition xy01.hh:154
const concepts::Space< F > & space() const
Space.
Definition xy01.hh:97
float memory() const
Size of memory used by XY01 in Bytes.
Definition xy01.hh:107
const ExpansionXY< F > & exp_
Kernel expansion.
Definition xy01.hh:68
XY01(const Tree< Node > &tree, const ExpansionXY< F > &exp)
const uint blksz_
Size of memory used for the expansion.
Definition xy01.hh:70
const uint nfnc_
Number of auxiliary vectors.
Definition xy01.hh:75
const Tree< Node > & tree() const
Cluster tree.
Definition xy01.hh:99
uint ncol_
Number of expansion coefficients.
Definition xy01.hh:79
std::ostream & info(std::ostream &os, uint idx) const
Detailed information about the unknown idx.
F * operator[](uint i) const
Returns i-th auxiliary vector.
Definition xy01.hh:93
void zero()
Sets auxiliary vectors to zero.
std::ostream & info(std::ostream &os) const
Basic information about the far field X, Y.
XYFnc * fnc_
Auxiliary vectors.
Definition xy01.hh:73
XYCol * col_
Expansion coefficients.
Definition xy01.hh:77
void zero()
Sets the auxiliary vectors to zero.
Definition xy01.hh:207
ClstY< Node >::Traits Traits
Interface for the far field Y.
Definition xy01.hh:190
F * operator[](uint i) const
Definition xy01.hh:222
float memory() const
Size of memory used by Y01 in Bytes.
Definition xy01.hh:245
const Tree< Node > & tree() const
Cluster tree.
Definition xy01.hh:227
const concepts::Space< F > & space() const
Space.
Definition xy01.hh:233
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition xy01.hh:238
std::string typeOf(const T &t)
Definition output.hh:43
uint idx
DoF number.
Definition xy01.hh:55
XYCol * lnk
Coefficients of next DoF.
Definition xy01.hh:53
F * fncval
Pointer to auxiliary vector.
Definition xy01.hh:57
XYCol(XYColExp *value)
Constructor.
Definition xy01.hh:62
~XYCol()
Destructor.
Definition xy01.hh:64
XYColExp * val
Vector of expansion coefficients.
Definition xy01.hh:59
F * val
One auxiliary vector.
Definition xy01.hh:46
concepts::Real3d z
Shift vector.
Definition xy01.hh:42
F * pval
Auxiliary vector of parent cluster.
Definition xy01.hh:44