fmm3d_mpi.hpp

Go to the documentation of this file.
00001 /* Kernel Independent Fast Multipole Method
00002    Copyright (C) 2004 Lexing Ying, New York University
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2, or (at your option)
00007 any later version.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT
00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00012 for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; see the file COPYING.  If not, write to the Free
00016 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017 02111-1307, USA.  */
00018 
00028 #ifndef _FMM3D_HPP_
00029 #define _FMM3D_HPP_
00030 
00031 #include "knlmat3d_mpi.hpp"
00032 #include "let3d_mpi.hpp"
00033 #include "matmgnt3d_mpi.hpp"
00034 
00036 class FMM3d_MPI: public KnlMat3d_MPI
00037 {
00038 public:
00039   typedef pair<int,int> intpair;
00040   enum {          UE=0, UC=1, DE=2, DC=3,  };
00044 
00045   //------------------------------------
00046 public:
00048 
00049   class NodeExt {
00050   public:
00052          NodeExt(): _vLstInNum(0), _vLstInCnt(0), _vLstOthNum(0), _vLstOthCnt(0) {;}
00054          int _vLstInNum;
00056          int _vLstInCnt;
00058          DblNumVec _effVal;
00060          int _vLstOthNum;
00062          int _vLstOthCnt;
00064          DblNumVec _effDen;
00065 };
00067   class Node {
00068   protected:
00070          NodeExt* _ptr;
00071   public:
00073          Node(): _ptr(NULL) {;}
00075          ~Node() {
00076                 if(_ptr!=NULL)            delete _ptr;
00077          }
00079          NodeExt* ptr() {               if(_ptr==NULL)  _ptr = new NodeExt();           return _ptr;     }
00081          int& vLstInNum() { return ptr()->_vLstInNum; }
00083          int& vLstInCnt() { return ptr()->_vLstInCnt; }
00085          DblNumVec& effVal() { return ptr()->_effVal; }
00087          int& vLstOthNum() { return ptr()->_vLstOthNum; }
00089          int& vLstOthCnt() { return ptr()->_vLstOthCnt; }
00091          DblNumVec& effDen() { return ptr()->_effDen; }
00092   };
00093   
00094   //------------------------------------
00095 protected:
00097   Point3 _ctr;
00099   int    _rootLevel; 
00101   int _np;  
00102   //COMPONENTS, local member and data  vector<int> _stphds, _evlhds;
00104   Let3d_MPI* _let;
00108   MatMgnt3d_MPI* _matmgnt;
00109 
00111   vector<Node> _nodeVec;
00112 
00114   Vec _glbSrcExaPos;
00116   Vec _glbSrcExaNor;
00118   Vec _glbSrcExaDen;
00120   Vec _glbSrcUpwEquDen;
00121 
00123   Vec _ctbSrcExaPos;
00125   Vec _ctbSrcExaNor;
00127   Vec _ctbSrcExaDen;
00129   Vec _ctbSrcUpwEquDen;
00131   Vec _ctbSrcUpwChkVal;
00133   VecScatter _ctb2GlbSrcExaPos;
00135   VecScatter _ctb2GlbSrcExaDen;
00137   VecScatter _ctb2GlbSrcUpwEquDen;
00138 
00140   Vec _evaTrgExaPos;
00142   Vec _evaTrgExaVal;
00144   Vec _evaTrgDwnEquDen;
00146   Vec _evaTrgDwnChkVal;
00147 
00149   Vec _usrSrcExaPos;
00151   Vec _usrSrcExaNor;
00153   Vec _usrSrcExaDen;
00155   Vec _usrSrcUpwEquDen;
00157   VecScatter _usr2GlbSrcExaPos;
00159   VecScatter _usr2GlbSrcExaDen;
00161   VecScatter _usr2GlbSrcUpwEquDen;
00162   
00163   //IMPORTANT
00168   Kernel3d_MPI _knl_mm;
00169   
00170 public:
00173   FMM3d_MPI(const string& p);
00174   ~FMM3d_MPI();
00175   //MEMBER ACCESS
00177   Point3& ctr() { return _ctr; }
00179   int& rootLevel() { return _rootLevel; }
00181   int& np() { return _np; }
00182   //SETUP and USE
00184   int setup();
00186   int evaluate(Vec srcDen, Vec trgVal);
00188   int check(Vec srcDen, Vec trgVal, int numchk, double& rerr);  //int report();
00189   //OTHER ACCESS
00191   Let3d_MPI* let() { return _let; }
00193   MatMgnt3d_MPI* matmgnt() { return _matmgnt; }
00194 
00196   Node& node(int gNodeIdx) { return _nodeVec[gNodeIdx]; }
00197   
00198 protected:
00200   int datSze(int tp) { return _matmgnt->plnDatSze(tp); }
00201   //multiplication
00203   int SrcEqu2TrgChk_dgemv(const DblNumMat& srcPos, const DblNumMat& srcNor, const DblNumMat& trgPos, const DblNumVec& srcDen, DblNumVec& trgVal);
00205   int SrcEqu2UpwChk_dgemv(const DblNumMat& srcPos, const DblNumMat& srcNor, Point3 trgctr, double trgrad, const DblNumVec& srcDen, DblNumVec& trgVal);
00207   int SrcEqu2DwnChk_dgemv(const DblNumMat& srcPos, const DblNumMat& srcNor, Point3 trgctr, double trgrad, const DblNumVec& srcDen, DblNumVec& trgVal);
00209   int DwnEqu2TrgChk_dgemv(Point3 srcctr, double srcrad, const DblNumMat& trgPos, const DblNumVec& srcDen, DblNumVec& trgVal);
00211   int UpwEqu2TrgChk_dgemv(Point3 srcctr, double srcrad, const DblNumMat& trgPos, const DblNumVec& srcDen, DblNumVec& trgVal);
00212   //contributor data
00214   DblNumMat ctbSrcExaPos(int gNodeIdx);
00216   DblNumMat ctbSrcExaNor(int gNodeIdx);
00218   DblNumVec ctbSrcExaDen(int gNodeIdx);
00220   DblNumVec ctbSrcUpwEquDen(int gNodeIdx);
00222   DblNumVec ctbSrcUpwChkVal(int gNodeIdx);
00223   
00224   //user data
00226   DblNumMat usrSrcExaPos(int gNodeIdx);
00228   DblNumMat usrSrcExaNor(int gNodeIdx);
00230   DblNumVec usrSrcExaDen(int gNodeIdx);
00232   DblNumVec usrSrcUpwEquDen(int gNodeIdx);
00233   
00234   //evaluator data
00236   DblNumMat evaTrgExaPos(int gNodeIdx);
00238   DblNumVec evaTrgExaVal(int gNodeIdx);
00240   DblNumVec evaTrgDwnEquDen(int gNodeIdx);
00242   DblNumVec evaTrgDwnChkVal(int gNodeIdx);
00243   
00244 };
00245 #endif

Generated on Sun Dec 4 21:12:40 2005 for fmm3d_mpi by  doxygen 1.4.5