fmm3d.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 #ifndef _FMM3D_HPP_
00019 #define _FMM3D_HPP_
00020 
00021 #include "knlmat3d.hpp"
00022 #include "let3d.hpp"
00023 #include "matmgnt3d.hpp"
00024 
00025 
00026 //-------------------------------------------
00028 
00031 class FMM3d: public KnlMat3d
00032 {
00033 public:
00034   typedef pair<int,int> intpair;
00040   enum {         UE=0,   UC=1,   DE=2,   DC=3,  };
00041   //------------------------------------
00043   class Node {
00044   protected:
00046          int _VinNum;
00048          int _VinCnt;
00050          DblNumVec _effVal;
00052          int _VotNum;
00054          int _VotCnt; 
00056          DblNumVec _effDen;
00057   public:
00058          Node() : _VinNum(0), _VinCnt(0), _VotNum(0), _VotCnt(0) {;}
00059          int& VinNum() { return _VinNum; }
00060          int& VinCnt() { return _VinCnt; }
00062          DblNumVec& effVal() { return _effVal; }
00063          int& VotNum() { return _VotNum; }
00064          int& VotCnt() { return _VotCnt; }
00066          DblNumVec& effDen() { return _effDen; }
00067   };
00068   
00069 protected:
00070   //PARAMS (REQ)
00072   Point3 _center;
00074   int    _rootLevel;
00075   //PARAMS (OPT)
00076   int _np;
00077   //COMPONENTS, local member and data  vector<int> _stphds, _evlhds;
00078   Let3d* _let;
00079   MatMgnt3d* _matmgnt;
00080   
00081   vector<Node> _nodeVec;
00082 
00084   DblNumMat _srcExaPos;
00085   DblNumMat _srcExaNor;
00087   DblNumVec _srcExaDen;
00089   DblNumVec _srcUpwEquDen;
00091   DblNumVec _srcUpwChkVal;
00093   DblNumMat _trgExaPos;
00095   DblNumVec _trgExaVal;
00097   DblNumVec _trgDwnEquDen;
00099   DblNumVec _trgDwnChkVal;
00100   
00101   //IMPORTANT LEXING
00102   Kernel3d _knl_mm; //elq used in matmgnt
00103   int _mul_mm; //mul used in matmgnt  //FUNCTIONS: eq, lt, qt, sdof, tdof
00104 public:
00105   FMM3d(const string& p);
00106   ~FMM3d();
00107 
00109   Point3& center() { return _center; }
00111   int& rootLevel() { return _rootLevel; }
00112   int& np() { return _np; }  
00113   
00115   int setup(map<string,string>& opts);
00117   int evaluate(const DblNumVec& srcDen, DblNumVec& trgVal);
00119   int check(const DblNumVec& srcDen, DblNumVec& trgVal, int numChk, double& relativeErr);  
00120   
00121   Let3d* let() { return _let; }
00122   MatMgnt3d* matmgnt() { return _matmgnt; }
00123   vector<Node>& nodeVec() { return _nodeVec; }
00124   Node& node(int gNodeIdx) { return _nodeVec[gNodeIdx]; }
00125 
00126 protected:
00128   int datSze(int tp) { return _matmgnt->plnDatSze(tp); }
00129   
00131   int SrcEqu2TrgChk_dgemv(const DblNumMat& srcPos, const DblNumMat& srcNor, const DblNumMat& trgPos, const DblNumVec& srcDen, DblNumVec& trgVal);
00133   int SrcEqu2UpwChk_dgemv(const DblNumMat& srcPos, const DblNumMat& srcNor, Point3 trgCtr, double trgRad, const DblNumVec& srcDen, DblNumVec& trgVal);
00135   int SrcEqu2DwnChk_dgemv(const DblNumMat& srcPos, const DblNumMat& srcNor, Point3 trgCtr, double trgRad, const DblNumVec& srcDen, DblNumVec& trgVal);
00137   int DwnEqu2TrgChk_dgemv(Point3 srcCtr, double srcRad, const DblNumMat& trgPos, const DblNumVec& srcDen, DblNumVec& trgVal);
00138   /* Upward Equivalent To Target Check */
00139   int UpwEqu2TrgChk_dgemv(Point3 srcCtr, double srcRad, const DblNumMat& trgPos, const DblNumVec& srcDen, DblNumVec& trgVal);
00140 
00141   //contributor data
00142   DblNumMat srcExaPos(int gNodeIdx);
00143   DblNumMat srcExaNor(int gNodeIdx);
00144   DblNumVec srcExaDen(int gNodeIdx);
00145   DblNumVec srcUpwEquDen(int gNodeIdx);
00146   DblNumVec srcUpwChkVal(int gNodeIdx);
00147   //evaluator data
00148   DblNumMat trgExaPos(int gNodeIdx);
00149   DblNumVec trgExaVal(int gNodeIdx);
00150   DblNumVec trgDwnEquDen(int gNodeIdx);
00151   DblNumVec trgDwnChkVal(int gNodeIdx);
00152   
00154   int srcData();
00156   int trgData();
00157 };
00158 
00159 #endif

Generated on Sun Dec 4 19:24:39 2005 for fmm3d by  doxygen 1.4.5