xy01.hh

Go to the documentation of this file.
1 
6 #ifndef clusterXY01_hh
7 #define clusterXY01_hh
8 
9 #include "cluster/expansion.hh"
10 #include "cluster/xy.hh"
11 
12 namespace cluster {
13 
14  // ****************************************************************** XY01 **
15 
19  template<class Node>
20  class XY01 {
23  typedef typename Traits::F F;
24 
25  const Tree<Node>& tree_;
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;
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
const concepts::Space< F > & space() const
Space.
Definition: xy01.hh:233
const uint nfnc_
Number of auxiliary vectors.
Definition: xy01.hh:75
float memory() const
Size of memory used by Y01 in Bytes.
Definition: xy01.hh:245
std::ostream & info(std::ostream &os, uint idx) const
Detailed information about the unknown idx.
const concepts::Space< F > & space() const
Space.
Definition: xy01.hh:165
~XYCol()
Destructor.
Definition: xy01.hh:64
ClstXY< Node >::F F
Definition: xy.hh:49
Data structure to hold the expansion coefficients.
Definition: xy01.hh:51
Abstract class for a space.
Data structure for auxiliary vectors (one vector per cluster)
Definition: xy01.hh:40
XYFnc * fnc_
Auxiliary vectors.
Definition: xy01.hh:73
std::ostream & info(std::ostream &os) const
Basic information about the far field X, Y.
bool info_(std::ostream &os, uint idx, const Node *nd) const
Information method used for recursive calls from info(os, idx)
void zero()
Sets auxiliary vectors to zero.
const Tree< Node > & tree_
Definition: xy01.hh:25
XY01< Node >::XYCol XYCol
Definition: xy01.hh:143
TreeTraits< Node > Traits
Interface for the far field X, Y.
Definition: xy01.hh:22
float memory() const
Size of memory used by XY01 in Bytes.
Definition: xy01.hh:107
void scatter(const concepts::Vector< F > &fnc)
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition: xy01.hh:170
const ExpansionXY< F > & exp_
Kernel expansion.
Definition: xy01.hh:68
F * pval
Auxiliary vector of parent cluster.
Definition: xy01.hh:44
XY01< Node >::XYFnc XYFnc
Definition: xy01.hh:142
uint idx
DoF number.
Definition: xy01.hh:55
X01(const Tree< Node > &tree, const ExpansionXY< F > &exp)
Definition: xy01.hh:149
ClstY< Node >::Traits Traits
Interface for the far field Y.
Definition: xy01.hh:190
F * operator[](uint i) const
Returns the i-th auxiliary vector (vector corresponding to the i-th cluster)
Definition: xy01.hh:222
Interface class for a node in a cluster tree.
Definition: tree.hh:252
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition: xy01.hh:238
void zero()
Sets the auxiliary vectors to zero.
Definition: xy01.hh:139
Abstract class for the far field matrix Y.
Definition: xy.hh:60
float memory() const
Size of memory used by X01 in Bytes.
Definition: xy01.hh:177
const concepts::Space< F > & space() const
Space of the tree.
Definition: tree.hh:310
XY01< Node >::XYFnc XYFnc
Definition: xy01.hh:210
XY01< Node >::XYCol XYCol
Definition: xy01.hh:211
Class to hide some implementation details of the far field matrices X, Y.
Definition: xy01.hh:20
Abstract class to hold the expansion coefficients.
Definition: expansion.hh:47
Class for far field part X.
Definition: xy01.hh:119
Class for far field part Y.
Definition: xy01.hh:187
void zero()
Sets the auxiliary vectors to zero.
Definition: xy01.hh:207
const Tree< Node > & tree() const
Cluster tree.
Definition: xy01.hh:227
XYCol(XYColExp *value)
Constructor.
Definition: xy01.hh:62
const Tree< Node > & tree() const
Cluster tree.
Definition: xy01.hh:99
void constructor_(const Node *chld, const Node *prnt)
Constructor for recursive calls throw MissingFeature.
ClstX< Node >::Traits Traits
Interface for the far field X.
Definition: xy01.hh:122
F * val
One auxiliary vector.
Definition: xy01.hh:46
Abstract class for the and the part of a kernel expansion.
Definition: expansion.hh:98
Traits::F F
Definition: xy.hh:25
F * fncval_
Definition: xy01.hh:26
Node::CF F
Field of the node (Real or Cmplx)
Definition: tree.hh:255
XYCol * col_
Expansion coefficients.
Definition: xy01.hh:77
Abstract class for the far field matrix X.
Definition: xy.hh:47
uint ncol_
Number of expansion coefficients.
Definition: xy01.hh:79
XYColExp * val
Vector of expansion coefficients.
Definition: xy01.hh:59
Used for the cluster classes for the boundary element method.
Definition: cebysev.hh:13
const Tree< Node > & tree() const
Cluster tree.
Definition: xy01.hh:159
ClstX< Node >::F F
Definition: xy01.hh:123
F * operator[](uint i) const
Returns the i-th auxiliary vector (vector corresponding to the i-th cluster)
Definition: xy01.hh:154
Traits::F F
Definition: xy01.hh:23
void gather(concepts::Vector< F > &fnc)
const uint blksz_
Size of memory used for the expansion.
Definition: xy01.hh:70
Y01(const Tree< Node > &tree, const ExpansionXY< F > &exp)
Definition: xy01.hh:217
XY01(const Tree< Node > &tree, const ExpansionXY< F > &exp)
Constructor.
F * fncval
Pointer to auxiliary vector.
Definition: xy01.hh:57
concepts::Real3d z
Shift vector.
Definition: xy01.hh:42
XYCol * lnk
Coefficients of next DoF.
Definition: xy01.hh:53
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
const concepts::Space< F > & space() const
Space.
Definition: xy01.hh:97
ClstY< Node >::F F
Definition: xy01.hh:191
ClstXY< Node >::F F
Definition: xy.hh:62
F * operator[](uint i) const
Returns i-th auxiliary vector.
Definition: xy01.hh:93
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich