dense3d.cpp

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 #include "dense3d.hpp"
00019 #include "common/vecmatop.hpp"
00020 
00022 Dense3d::Dense3d(const string& p): KnlMat3d(p)
00023 {
00024 }
00025 
00026 Dense3d::~Dense3d()
00027 {
00028 }
00029 
00030 // ----------------------------------------------------------------------
00031 int Dense3d::setup(map<string,string>&)
00032 {
00033   iA(_srcPos!=NULL && _srcNor!=NULL && _trgPos!=NULL);
00034   iA((*_srcPos).m()==dim() && (*_trgPos).m()==dim());  //nothing to do
00035   return 0;
00036 }
00037 
00038 // ---------------------------------------------------------------------- 
00039 int Dense3d::evaluate(const DblNumVec& srcDen, DblNumVec& trgVal) 
00040 {
00041   //-----------------------------------
00042   iA(srcDen.m()==srcDOF()*(*_srcPos).n());  iA(trgVal.m()==trgDOF()*(*_trgPos).n());
00043   
00044   int dim  = this->dim();
00045   int srcDOF = this->srcDOF();
00046   int trgDOF = this->trgDOF();
00047   /* Number of sources */
00048   int numSrc = (*_srcPos).n();
00049   /* Number of targets */
00050   int numTrg = (*_trgPos).n();
00051   
00052   DblNumMat inter(trgDOF, numSrc*srcDOF);
00053   for(int i=0; i<numTrg; i++) {
00054          DblNumMat onePosMat(dim, 1, false, (*_trgPos).clmdata(i));
00055          DblNumVec oneValVec(trgDOF, false, trgVal.data()+trgDOF*i);
00056          iC( _knl.kernel((*_srcPos), (*_srcNor), onePosMat, inter) );
00057          iC( dgemv(1.0, inter, srcDen, 0.0, oneValVec) );
00058   }
00059   
00060   return 0;
00061 }

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