kernel3d.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 _KERNEL3D_HPP_
00019 #define _KERNEL3D_HPP_
00020 
00021 #include "common/nummat.hpp"
00022 
00023 using std::vector;
00024 
00025 //eqt: 1 2 3 4 5 6
00026 //lyr: s d r p
00027 //qnt: u p ...
00028 
00029 enum {
00031   KNL_LAP_S_U = 111,
00033   KNL_LAP_D_U = 121,
00035   KNL_LAP_I   = 191, 
00037 
00038   KNL_STK_F_U = 301,
00040   KNL_STK_S_U = 311,
00042   KNL_STK_S_P = 312,
00044   KNL_STK_D_U = 321,
00046   KNL_STK_D_P = 322,
00048   KNL_STK_R_U = 331,
00050   KNL_STK_R_P = 332,
00052   KNL_STK_I   = 391,
00054   KNL_STK_E   = 392, 
00055   //navier kernels  //KNL_NAV_F_U = 501, //used for fmm
00057   KNL_NAV_S_U = 511, //single displacement
00058   KNL_NAV_D_U = 521, //double displacement
00059   KNL_NAV_R_U = 531,
00060   KNL_NAV_I   = 591, //identity tensor
00061   KNL_NAV_E   = 592, //levi-civita tensor
00062   //other kernels
00063   KNL_SQRTLAP = 901,
00064   KNL_EXP     = 902,
00065   //error
00066   KNL_ERR = -1
00067 };
00068 
00069 #define _mindif 1e-8
00070 //-------------------------------
00071 class Kernel3d
00072 {
00073 protected:
00074   int _kernelType;
00075   vector<double> _coefs;  //static double _mindif; //minimal difference
00076 public:
00077   Kernel3d(): _kernelType(KNL_ERR) {;}
00078   Kernel3d(int kernelType, const vector<double>& coefs): _kernelType(kernelType), _coefs(coefs) {;}
00079   Kernel3d(const Kernel3d& c): _kernelType(c._kernelType), _coefs(c._coefs) {;}
00080   Kernel3d& operator=(const Kernel3d& c) { _kernelType = c._kernelType; _coefs = c._coefs; return *this; }
00081   int& kernelType()                          { return _kernelType; }
00082   const int& kernelType() const              { return _kernelType; }
00083   vector<double>& coefs()             { return _coefs; }
00084   const vector<double>& coefs() const { return _coefs; }
00085   int dim() { return 3; }
00086   int srcDOF() const;
00087   int trgDOF() const;
00089   bool homogeneous() const;
00091   void homogeneousDeg(vector<double>&) const; 
00092   //each kernelType handles coef in its own way, can be empty
00093   int kernel(const DblNumMat& srcPos, const DblNumMat& srcNor, const DblNumMat& trgPos, DblNumMat& inter);
00094 };
00095 
00096 inline bool operator==(const Kernel3d& a, const Kernel3d& b) {
00097   return (a.kernelType()==b.kernelType() && a.coefs()==b.coefs());
00098 }
00099 
00100 #endif

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