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

aglowav2/xfy.hh
Go to the documentation of this file.
00001 /* Far field matrices X, F and Y.
00002  */
00003 
00004 #ifndef aglowav2xy_hh
00005 #define aglowav2xy_hh
00006 
00007 #include "cluster/expansion.hh"
00008 #include "aglowav2/space.hh"
00009 
00010 namespace aglowav2 {
00011 
00012   // ****************************************************************** XY00 **
00013 
00017   template<class F = concepts::Real>
00018   class XY00 {
00019   public:
00027     XY00(const Haar3d0<F>& spc, const cluster::ExpansionXY<F>& exp,
00028    const cluster::ExpansionXY<F>* shftExp = 0);
00030     virtual ~XY00();
00031 
00032     inline const Haar3d0<F>& space() const {return spc_;}
00034     cluster::XYColExpPtr* operator[](uint i) const {return elmptr_[i];}
00036     inline uint memory() const;
00037 
00038   private:
00045     void constructor_(cluster::XYColReal* xy,
00046           const cluster::ExpansionXY<F>* shftExp);
00047 
00048   protected:
00050     const cluster::ExpansionXY<F>& exp_;
00051 
00052   private:
00054     const Haar3d0<F>& spc_;
00056     cluster::XYColExpPtr** elmptr_;
00058     cluster::XYColExp* xy_;
00059   };
00060 
00061   template<class F>
00062   XY00<F>::~XY00() {
00063     for(uint i = 0; i < spc_.nelm(); i++)  delete elmptr_[i];
00064     delete[] elmptr_;
00065     delete xy_;
00066   }
00067 
00068   template<class F>
00069   uint XY00<F>::memory() const {
00070     return sizeof(XY00<F>) + spc_.nelm()*sizeof(elmptr_[0]) + xy_->memory();
00071   }
00072 
00073   // ******************************************************************* Y00 **
00074 
00078   template<class F = concepts::Real>
00079   class Y00 : private XY00<F> {
00080   public:
00085     inline Y00(const cluster::ExpansionXY<F>& exp, const Haar3d0<F>& spc);
00086 
00088     inline const Haar3d0<F>& space() const {return XY00<F>::space();}
00090     inline cluster::XYColExpPtr* operator[](uint i) const;
00092     inline uint memory() const {return XY00<F>::memory();}
00093   };
00094 
00095   template<class F>
00096   Y00<F>::Y00(const cluster::ExpansionXY<F>& exp, const Haar3d0<F>& spc)
00097     : XY00<F>(spc, exp, 0) {}
00098 
00099   template<class F>
00100   cluster::XYColExpPtr* Y00<F>::operator[](uint i) const {
00101     return XY00<F>::operator[](i);
00102   }
00103 
00104   // ******************************************************************* X00 **
00105 
00109   template<class F = concepts::Real>
00110   class X00 : protected XY00<F> {
00111   public:
00117     inline X00(const cluster::ExpansionXY<F>& exp,
00118          const cluster::ExpansionXY<F>& shftExp, const Haar3d0<F>& spc);
00119 
00121     inline const Haar3d0<F>& space() const {return XY00<F>::space();}
00123     inline cluster::XYColExpPtr* operator[](uint i) const;
00125     inline uint memory() const {return XY00<F>::memory();}
00127     inline void apply(cluster::XYColExpPtr* x, const F* src, F* dst) const;
00128   };
00129 
00130   template<class F>
00131   X00<F>::X00(const cluster::ExpansionXY<F>& exp,
00132         const cluster::ExpansionXY<F>& shftExp, const Haar3d0<F>& spc)
00133     : XY00<F>(spc, exp, &shftExp) {}
00134 
00135   template<class F>
00136   cluster::XYColExpPtr* X00<F>::operator[](uint i) const {
00137     return XY00<F>::operator[](i);
00138   }
00139 
00140   template<class F>
00141   void X00<F>::apply(cluster::XYColExpPtr* x, const F* src, F* dst) const {
00142     this->exp_.apply(x, src, dst);
00143   }
00144 
00145   // ******************************************************************* F00 **
00146 
00150   template<class F = concepts::Real>
00151   class F00 {
00152   public:
00159     F00(const X00<F>& X, const Y00<F>& Y, const cluster::ExpansionF<F>& exp,
00160   concepts::Real eta);
00162     ~F00() {delete foo_;  delete[] fee_;}
00163 
00164     inline const Haar3d0<F>& space() const {return X_.space();}
00166     inline bool admissible(const Haar3dXXX<F>& elmX,
00167          const Haar3dXXX<F>& elmY);
00177     void operator()(uint idxX, uint idxY, F* valXY,
00178         uint dx, uint dy, uint nx, uint ny);
00189     void operator()(uint idxX, uint idxY, F* valXY, F* valYX, uint dx, uint dy,
00190         uint nx, uint ny);
00191 
00192   private:
00193     const X00<F>& X_;
00194     const Y00<F>& Y_;
00195     const cluster::ExpansionF<F>& exp_;
00197     uint m_;
00199     concepts::Real eta_;
00200 
00202     F* fee_;
00203     cluster::FColExp* foo_;
00205     concepts::Real3d z_;
00206   };
00207 
00208   template<class F>
00209   F00<F>::F00(const X00<F>& X, const Y00<F>& Y,
00210         const cluster::ExpansionF<F>& exp, concepts::Real eta)
00211     : X_(X), Y_(Y), exp_(exp), m_(exp.m()), eta_(eta) {
00212 
00213     if (&X_.space() != &Y_.space())
00214       throw conceptsException(concepts::
00215                   MissingFeature("Different spaces not supported"));
00216 
00217     fee_ = new F[exp.blksz(m_)];
00218     foo_ = exp.getCol(exp.blksz(m_));
00219   }
00220 
00221   template<class F>
00222   bool F00<F>::admissible(const Haar3dXXX<F>& elmX,
00223         const Haar3dXXX<F>& elmY) {
00224     z_  = elmY.center();
00225     z_ -= elmX.center();
00226     return (elmX.radius() + elmY.radius() < eta_*z_.l2());
00227   }
00228 
00229 } // namespace aglowav2
00230 
00231 #endif // aglowav2xy_hh

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