void mexFunction int  nlhs,
mxArray *  plhs[],
int  nrhs,
const mxArray *  prhs[]
 

Definition at line 13 of file fmm3d_mex.cpp.

References MatMgnt3d::_mmvec, and mex2cpp().

00014 {
00015   if(nrhs!=9)
00016          mexErrMsgTxt("9 inputs required");
00017   if(nlhs!=2)
00018          mexErrMsgTxt("2 outputs required");
00019   
00020   DblNumMat srcpos; mex2cpp(prhs[0], srcpos);
00021   DblNumMat srcnor; mex2cpp(prhs[1], srcnor);
00022   DblNumMat trgpos; mex2cpp(prhs[2], trgpos);
00023   
00024   Point3 ctr; mex2cpp(prhs[3], ctr); //cerr<<ctr<<endl;
00025   int rootlvl; mex2cpp(prhs[4], rootlvl); //cerr<<rootlvl<<endl;
00026   Kernel3d knl; mex2cpp(prhs[5], knl); //cerr<<knl.kt()<<endl;
00027   int np; mex2cpp(prhs[6], np); iA(np==4 || np==6 || np==8); //cerr<<np<<endl;
00028   
00029   DblNumVec srcden; mex2cpp(prhs[7], srcden);
00030   
00031   mex2cpp(prhs[8], MatMgnt3d::_mmvec);
00032   
00033   char tmp[100];
00034   map<string, string> opts;
00035   if(       np==4) {
00036          sprintf(tmp, "%d", np); opts["-fmm3d_np"] = string(tmp);
00037          sprintf(tmp, "%d", 150);opts["-fmm3d_let3d_ptsmax"] = string(tmp);
00038          sprintf(tmp, "%d", 10); opts["-fmm3d_let3d_maxlevel"] = string(tmp);
00039   } else if(np==6) {
00040          sprintf(tmp, "%d", np); opts["-fmm3d_np"] = string(tmp);
00041          sprintf(tmp, "%d", 150);opts["-fmm3d_let3d_ptsmax"] = string(tmp);
00042          sprintf(tmp, "%d", 10); opts["-fmm3d_let3d_maxlevel"] = string(tmp);
00043   } else if(np==8) {
00044          sprintf(tmp, "%d", np); opts["-fmm3d_np"] = string(tmp);
00045          sprintf(tmp, "%d", 150);opts["-fmm3d_let3d_ptsmax"] = string(tmp);
00046          sprintf(tmp, "%d", 10); opts["-fmm3d_let3d_maxlevel"] = string(tmp);
00047   }
00048   
00049   FMM3d* fmm = new FMM3d("fmm3d_");
00050   fmm->srcpos()=&srcpos;  fmm->srcnor()=&srcpos;
00051   fmm->trgpos()=&trgpos;
00052   fmm->ctr() = Point3(0,0,0);  fmm->rootlvl() = 0;
00053   fmm->knl() = knl;
00054   iC( fmm->setup(opts) );
00055   
00056   iA( srcden.m()==knl.sdof()*srcpos.n()); //check size
00057   DblNumVec trgval(knl.tdof()*trgpos.n());
00058   iC( fmm->eval(srcden, trgval) );
00059   double rerr;  iC( fmm->check(srcden, trgval, 20, rerr) );  cout<<rerr<<endl;
00060   
00061   cpp2mex(trgval, plhs[0]);
00062   cpp2mex(MatMgnt3d::_mmvec, plhs[1]);
00063 
00064   delete fmm;
00065   
00066   return;
00067 }


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