Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

cluster/xy01.hh
Go to the documentation of this file.
00001 /* Far field matrices X01, Y01
00002  */
00003 
00004 #ifndef clusterXY01_hh
00005 #define clusterXY01_hh
00006 
00007 #include "cluster/expansion.hh"
00008 #include "cluster/xy.hh"
00009 
00010 namespace cluster {
00011 
00012   // ****************************************************************** XY01 **
00013 
00017   template<class Node>
00018   class XY01 {
00020     typedef TreeTraits<Node>   Traits;
00021     typedef typename Traits::F F;
00022   
00023     const Tree<Node>& tree_;
00024     F*                fncval_;
00025 
00031     void constructor_(const Node* chld, const Node* prnt);
00033     bool info_(std::ostream& os, uint idx, const Node* nd) const;
00034 
00035   protected:
00038     struct XYFnc { 
00040       concepts::Real3d z;
00042       F*     pval;
00044       F*     val;
00045     };
00046 
00049     struct XYCol {
00051       XYCol*    lnk;
00053       uint      idx;
00055       F*        fncval;
00057       XYColExp* val;
00058 
00060       XYCol(XYColExp* value) : val(value) {}
00062       ~XYCol() {delete val;}
00063     };
00064 
00066     const ExpansionXY<F>& exp_;
00068     const uint            blksz_;
00069 
00071     XYFnc*     fnc_;
00073     const uint nfnc_;
00075     XYCol*     col_;
00077     uint       ncol_;
00078 
00080     std::ostream& info(std::ostream& os) const;
00081 
00082   public:
00087     XY01(const Tree<Node>& tree, const ExpansionXY<F>& exp);
00088     ~XY01();
00089 
00091     inline F* operator[](uint i) const {return fnc_[i].val;}
00093     inline float memory() const;
00095     inline const concepts::Space<F>& space() const {return tree_.space();}
00097     inline const Tree<Node>& tree() const {return tree_;}
00099     void zero();
00101     std::ostream& info(std::ostream& os, uint idx) const;
00102   };
00103 
00104   template<class Node>
00105   inline float XY01<Node>::memory() const {
00106     return sizeof(XY01<Node>)
00107       + (float)ncol_ * (sizeof(XYCol) + (col_ ? col_->val->memory() : 0))
00108       + (float)nfnc_ * (sizeof(XYFnc) + blksz_ * sizeof(F));
00109   }
00110 
00111   // ******************************************************************* X01 **
00112 
00116   template<class Node>
00117   class X01 : public ClstX<Node>, private XY01<Node> {
00118   public:
00120     typedef typename ClstX<Node>::Traits Traits;
00121     typedef typename ClstX<Node>::F      F;
00122 
00123     inline X01(const Tree<Node>& tree, const ExpansionXY<F>& exp);
00124 
00128     inline F* operator[](uint i) const;
00129     void gather(concepts::Vector<F>& fnc);
00131     inline float memory() const;
00133     inline const concepts::Space<F>& space() const;
00135     inline const Tree<Node>& tree() const;
00137     inline void zero() {XY01<Node>::zero();}
00138 
00139   protected:
00140     typedef typename XY01<Node>::XYFnc XYFnc;
00141     typedef typename XY01<Node>::XYCol XYCol;
00142 
00143     inline std::ostream& info(std::ostream& os) const;
00144   };
00145 
00146   template<class Node>
00147   inline X01<Node>::X01(const Tree<Node>& tree, const ExpansionXY<F>& exp)
00148     : XY01<Node>(tree, exp) {
00149   }
00150 
00151   template<class Node>
00152   inline typename X01<Node>::F* X01<Node>::operator[](uint i) const {
00153     return XY01<Node>::operator[](i);
00154   }
00155 
00156   template<class Node>
00157   inline const Tree<Node>& X01<Node>::tree() const {
00158     return XY01<Node>::tree();
00159   }
00160 
00161   template<class Node>
00162   inline const concepts::Space<typename X01<Node>::F>&
00163   X01<Node>::space() const {
00164     return XY01<Node>::space();
00165   }
00166 
00167   template<class Node>
00168   inline std::ostream& X01<Node>::info(std::ostream& os) const {
00169     os << "X01("; XY01<Node>::info(os);
00170     os << ", mem = " << memory() / 1024.0 << "KB)";
00171     return os;
00172   }
00173 
00174   template<class Node>
00175   inline float X01<Node>::memory() const {
00176     return sizeof(X01<Node>) + XY01<Node>::memory() - sizeof(XY01<Node>);
00177   }
00178 
00179   // ******************************************************************* Y01 **
00180 
00184   template<class Node>
00185   class Y01 : public ClstY<Node>, private XY01<Node> {
00186   public:
00188     typedef typename ClstY<Node>::Traits Traits;
00189     typedef typename ClstY<Node>::F      F;
00190 
00191     inline Y01(const Tree<Node>& tree, const ExpansionXY<F>& exp);
00192 
00196     inline F* operator[](uint i) const;
00197     void scatter(const concepts::Vector<F>& fnc);
00199     inline float memory() const;
00201     inline const concepts::Space<F>& space() const;
00203     inline const Tree<Node>& tree() const;
00205     inline void zero() {XY01<Node>::zero();}
00206 
00207   protected:
00208     typedef typename XY01<Node>::XYFnc XYFnc;
00209     typedef typename XY01<Node>::XYCol XYCol;
00210 
00211     inline std::ostream& info(std::ostream& os) const;
00212   };
00213 
00214   template<class Node>
00215   inline Y01<Node>::Y01(const Tree<Node>& tree, const ExpansionXY<F>& exp)
00216     : XY01<Node>(tree, exp) {
00217   }
00218 
00219   template<class Node>
00220   inline typename Y01<Node>::F* Y01<Node>::operator[](uint i) const {
00221     return XY01<Node>::operator[](i);
00222   }
00223 
00224   template<class Node>
00225   inline const Tree<Node>& Y01<Node>::tree() const {
00226     return XY01<Node>::tree();
00227   }
00228 
00229   template<class Node>
00230   inline const concepts::Space<typename Y01<Node>::F>&
00231   Y01<Node>::space() const {
00232     return XY01<Node>::space();
00233   }
00234 
00235   template<class Node>
00236   inline std::ostream& Y01<Node>::info(std::ostream& os) const {
00237     os << "Y01("; XY01<Node>::info(os);
00238     os << ", mem = " << memory() / 1024.0 << "KB)";
00239     return os;
00240   }
00241 
00242   template<class Node>
00243   inline float Y01<Node>::memory() const {
00244     return sizeof(Y01<Node>) + XY01<Node>::memory() - sizeof(XY01<Node>);
00245   }
00246 
00247 } // namespace cluster
00248 
00249 #endif // clusterXY01_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)