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

cluster/f03.hh
Go to the documentation of this file.
00001 /* Far field matrix F03
00002  */
00003 
00004 #ifndef clusterF03_hh
00005 #define clusterF03_hh
00006     
00007 #include "toolbox/scannerConnectors.hh"
00008 #include "toolbox/hashMap.hh"
00009 #include "cluster/expansion.hh"
00010 #include "cluster/f.hh"
00011 
00012 namespace cluster {
00013 
00014   // ******************************************************************* F03 **
00015 
00023   template<class NodeX, class NodeY>
00024   class F03 : public ClstF<NodeX, NodeY> {
00025   public:
00027     typedef typename ClstF<NodeX, NodeY>::TraitsX  TraitsX;
00028     typedef typename ClstF<NodeX, NodeY>::TraitsY  TraitsY;
00029     typedef typename ClstF<NodeX, NodeY>::FX       FX;
00030     typedef typename ClstF<NodeX, NodeY>::FY       FY;
00031     typedef typename ClstF<NodeX, NodeY>::NfldNodes NfldNodes;
00032     typedef typename ClstF<NodeX, NodeY>::NfldScan NfldScan;
00033   private:
00036     class Ffld {
00038       Ffld* lnk_;
00040       const NodeX* clstX_;
00041       const NodeY* clstY_;
00043       uint m_;
00045       FColExp* val_;
00046 
00047     public:
00048       inline Ffld(const NodeX* clstX, const NodeY* clstY, uint m,
00049       Ffld* lnk = 0)
00050   : lnk_(lnk), clstX_(clstX), clstY_(clstY), m_(m), val_(0) {}
00051       inline ~Ffld() {delete val_;}
00052 
00053       inline Ffld* link() const {return lnk_;}
00054       inline uint sigma() const {return TraitsX::index(clstX_);}
00055       inline uint tau() const {return TraitsY::index(clstY_);}
00056       inline concepts::Real3d z() const {
00057   return TraitsY::center(clstY_) - TraitsX::center(clstX_);
00058       }
00059       inline uint m() const {return m_;}
00060       inline FColExp* val(uint blksz, const ExpansionF<FX>& exp) {
00061   delete val_; val_ = blksz ? exp.getCol(blksz) : 0; return val_;
00062       }
00063       inline FColExp* val() const {return val_;}
00064     };
00065 
00067     const Tree<NodeX>& treeX_;
00068     const Tree<NodeY>& treeY_;
00069 
00071     const ExpansionF<FX>&  exp_;
00072 
00074     uint m_;
00075     concepts::Real eps_;
00076     concepts::Real s_;
00078     uint minsz_;
00079     int maxnffldval_;
00080 
00082     Ffld* ffld_;
00084     uint nffld_;
00086     FColExp* ffldval_;
00087     uint nffldval_;
00089     concepts::Joiner<NfldNodes, 1>* nfld_;
00091     uint nnfld_;
00092 
00094     void constructor_(const NodeX* clstX, const NodeY* clstY);
00095     template<class Trts, class Nd>
00096     uint info_(uint idx, const Nd* clst,
00097          __gnu_cxx::hash_map<uint, uint>& nlf) const;
00098 
00099   protected:
00100     std::ostream& info(std::ostream& os) const;
00101 
00102   public:
00103     F03(const Tree<NodeX>& treeX, const Tree<NodeY>& treeY,
00104   const ExpansionF<FX>& exp, concepts::Real eps, concepts::Real s,
00105   uint minsz, int maxnffldval);
00106     ~F03();
00107 
00109     void operator()(const ClstY<NodeY>& vecY, ClstX<NodeX>& vecX) const;
00110 
00111     inline NfldScan* scan() const {
00112       return new concepts::ListScan<NfldNodes>(*nfld_);
00113     }
00115     inline float memory() const;
00116     std::ostream& info(std::ostream& os, uint idxX, uint idxY) const;
00117   };
00118 
00119   template<class NodeX, class NodeY>
00120   inline float F03<NodeX, NodeY>::memory() const {
00121     float mem = (maxnffldval_ != -1 && (uint)maxnffldval_ < nffldval_)
00122       ? maxnffldval_ : nffldval_;
00123     return
00124       sizeof(F03<NodeX, NodeY>)
00125       + (float)nffld_ * sizeof(typename F03<NodeX, NodeY>::Ffld)
00126       + (float)nnfld_ * sizeof(concepts::Joiner<NfldNodes, 1>)
00127       + mem *
00128       (ffld_->val() ? ffld_->val()->memory(1)
00129        : ffld_->val(1, exp_)->memory(1));
00130   }
00131 
00132 } // namespace cluster
00133 
00134 #endif // clusterF03_hh

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