int MatMgnt3d::UpwEqu2DwnChk_dgemv int  level,
Index3  ii,
const DblNumVec &  effDen,
DblNumVec &  effVal
 

Definition at line 311 of file matmgnt3d.cpp.

References _hom, _knl, _np, _upwEqu2DwnChk, dim(), Kernel3d::kernel(), regPos(), and trgDOF().

00312 {
00313   OffTns<DblNumMat>& _UpwEqu2DwnChk = (_hom==true) ? _upwEqu2DwnChk[0] : _upwEqu2DwnChk[l];
00314   double R = (_hom==true) ? 1.0 : 1.0/pow(2.0, l); //OffTns< DblNumMat >& _UpwEqu2DwnChk = _upwEqu2DwnChk[l];  double R       = 1.0/pow(2.0, l);
00315   if(_UpwEqu2DwnChk.m()==0)      _UpwEqu2DwnChk.resize(7,7,7,-3,-3,-3);
00316   //DblNumMat* _UpwEqu2DwnChkii = new DblNumMat;
00317   DblNumMat& _UpwEqu2DwnChkii = _UpwEqu2DwnChk(idx[0], idx[1], idx[2]);
00318   
00319   int effNum = (2*_np+2)*(2*_np)*(2*_np);
00320   int srcDOF = this->srcDOF();
00321   int trgDOF = this->trgDOF();
00322   
00323   //---------compute matrix
00324   if(_UpwEqu2DwnChkii.m()==0) { //compute it if necessary
00325          //-----------------------       //cerr<<"UpwEqu2DwnChk(FFT) compute"<<endl;     //COMPUTE FFT   //Index3 idx = ii.idx();        
00326          iA( idx.linfty()>1 );
00327          DblNumMat denPos(dim(),1);      for(int i=0; i<dim(); i++)             denPos(i,0) = double(idx(i))*2.0*R; //shift
00328          DblNumMat chkPos(dim(),regPos().n());   clear(chkPos);  iC( daxpy(R, regPos(), chkPos) );
00329          DblNumMat tt(regPos().n()*trgDOF, srcDOF);
00330          iC( _knl.kernel(denPos, denPos, chkPos, tt) );
00331          // move data to tmp
00332          DblNumMat tmp(trgDOF,regPos().n()*srcDOF);
00333          for(int k=0; k<regPos().n();k++) {
00334                 for(int i=0; i<trgDOF; i++)
00335                   for(int j=0; j<srcDOF; j++) {
00336                          tmp(i,j+k*srcDOF) = tt(i+k*trgDOF,j);
00337                   }
00338          }
00339          _UpwEqu2DwnChkii.resize(trgDOF*srcDOF, effNum); //_memused[4] += dof*dof*effNum(UE)*sizeof(double);
00340          //forward FFT from tmp to _UpwEqu2DwnChkii;
00341          
00342          int nnn[3];  nnn[0] = 2*_np;  nnn[1] = 2*_np;  nnn[2] = 2*_np;
00343          fftw_plan forplan = fftw_plan_many_dft_r2c(3,nnn,srcDOF*trgDOF, tmp.data(),NULL, srcDOF*trgDOF,1, (fftw_complex*)(_UpwEqu2DwnChkii.data()),NULL, srcDOF*trgDOF,1, FFTW_ESTIMATE);
00344          fftw_execute(forplan);
00345          fftw_destroy_plan(forplan);
00346 
00347          //rfftwnd_real_to_complex(_forplan, srcDOF*trgDOF, tmp.data(), srcDOF*trgDOF, 1, (fftw_complex*)(_UpwEqu2DwnChkii.data()), srcDOF*trgDOF, 1);
00348   }
00349   //---------matvec
00350   /*
00351   //scale
00352   DblNumVec tmpDen(effDen.m(), false, _wsbuf);  clear(tmpDen);
00353   fftw_complex* denptr = NULL;// = (fftw_complex*)(tmpDen.data());
00354   if(_hom==true) {
00355          vector<double> sclvec(srcDOF);  for(int s=0; s<srcDOF; s++)            sclvec[s] = pow(2.0, l*_degVec[s]);
00356          int cnt = 0;
00357          for(int i=0; i<effDen.m()/srcDOF; i++)
00358                 for(int s=0; s<srcDOF; s++) {
00359                   tmpDen(cnt) = effDen(cnt) * sclvec[s];                cnt++;
00360                 }
00361          denptr = (fftw_complex*)(tmpDen.data());
00362   } else {
00363          denptr = (fftw_complex*)(effDen.data());
00364   }
00365   */
00366   //fft mult
00367   double nrmfc = 1.0/double(regPos().n());
00368   fftw_complex* matPtr  = (fftw_complex*)(_UpwEqu2DwnChkii.data());
00369   fftw_complex* denPtr = (fftw_complex*)(effDen.data());
00370   fftw_complex* chkPtr   = (fftw_complex*)(effVal.data());
00371   int matStp  = srcDOF*trgDOF;
00372   int denStp = srcDOF;
00373   int chkStp   = trgDOF;
00374   
00375   double newalpha = nrmfc;
00376   for(int i=0; i<trgDOF; i++)
00377          for(int j=0; j<srcDOF; j++) {
00378                 int matOff = j*trgDOF + i;
00379                 int denOff = j;
00380                 int chkOff = i;
00381                 iC( cptwvv(effNum/2, newalpha, matPtr+matOff, matStp, denPtr+denOff, denStp, chkPtr+chkOff, chkStp) );
00382          }
00383   return (0);
00384 }


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