int Let3d::srcData  ) 
 

gdata

Definition at line 56 of file let3d.cpp.

References _srcPos, center(), dim(), nodeVec(), and radius().

00057 {
00058   //-----------------------------------------
00060   DblNumMat& pos = *(_srcPos);  iA( pos.m()==dim() );
00061   
00062   vector<Node>& nodeVec = this->nodeVec(); nodeVec.clear();
00063   vector< vector<int> > vecIdxs;  
00064   //local src number, the number of src point in each box
00065   vector<int> lclSrcNumVec; //glb 
00066   
00067   nodeVec.push_back( Node(-1,-1, Index3(0,0,0), 0) );
00068   vecIdxs.push_back( vector<int>() );
00069   vector<int>& curVecIdxs = vecIdxs[0];
00070   Point3 bbmin(center()-Point3(radius()));
00071   Point3 bbmax(center()+Point3(radius()));
00072   for(int k=0; k<pos.n(); k++) {
00073          Point3 tmp(pos.clmdata(k));     
00074          iA(tmp>=bbmin && tmp<=bbmax);//LEXING: IMPORANT
00075          curVecIdxs.push_back(k);
00076   }
00077   lclSrcNumVec.push_back( curVecIdxs.size() );
00078   
00079   int level = 0;
00080   int arrBeg = 0;
00081   int arrEnd = 1;
00082   int arrCnt = 0;
00083   while(arrBeg < arrEnd) {
00084          //1.
00085          arrCnt = arrEnd;
00086          for(int k=arrBeg; k < arrEnd; k++) {
00087                 //---
00088                 if( lclSrcNumVec[k]>ptsMax() && level<maxLevel()-1 ) {
00089                   nodeVec[k].child() = arrCnt;
00090                   arrCnt = arrCnt + pow2(dim());
00091                   //children's ess                
00092                   for(int a=0; a<2; a++) {
00093                          for(int b=0; b<2; b++) {
00094                                 for(int c=0; c<2; c++) {
00095                                   nodeVec.push_back( Node(k,-1, 2*nodeVec[k].path2Node()+Index3(a,b,c), nodeVec[k].depth()+1) ); //par, chd
00096                                   vecIdxs.push_back( vector<int>() );
00097                                   lclSrcNumVec.push_back( 0 );
00098                                 }
00099                          }
00100                   }
00101                   //children's vector of indices
00102                   Point3 centerCurNode( center(k) ); //get center of current node
00103                   for(vector<int>::iterator vecIdxsIt=vecIdxs[k].begin(); vecIdxsIt!=vecIdxs[k].end(); vecIdxsIt++) {
00104                          Point3 tmp(pos.clmdata(*vecIdxsIt));
00105                          Index3 idx;
00106                          for(int j=0; j<dim(); j++){
00107                                 idx(j) = (tmp(j) >= centerCurNode(j));
00108                          }
00109                          int chdGNodeIdx = child(k, idx);
00110                          vecIdxs[chdGNodeIdx].push_back(*vecIdxsIt);
00111                   }
00112                   vecIdxs[k].clear(); //VERY IMPORTANT
00113                   //children's lsm                
00114                   for(int a=0; a<2; a++) {
00115                          for(int b=0; b<2; b++) {
00116                                 for(int c=0; c<2; c++) {
00117                                   int chdGNodeIdx = child( k, Index3(a,b,c) );
00118                                   lclSrcNumVec[chdGNodeIdx] = vecIdxs[chdGNodeIdx].size();
00119                                 }
00120                          }
00121                   }
00122                 }
00123          }
00124          level++;
00125          arrBeg = arrEnd;
00126          arrEnd = arrCnt;
00127   }
00128   _level = level; //SET LEVEL
00129 
00130   //ordering of the boxes, in top-down or bottom-up fashion
00131   vector<int> orderBoxesVec     ;  iC( dwnOrderCollect(orderBoxesVec    ) );
00132   //set other parts of essvec
00133   int cnt = 0;
00134   int sum = 0;
00135   for(int i=0; i < orderBoxesVec        .size(); i++) {
00136          int gNodeIdx = orderBoxesVec   [i];
00137          if(lclSrcNumVec[gNodeIdx]>0) {
00138                 nodeVec[gNodeIdx].tag() = nodeVec[gNodeIdx].tag() | LET_SRCNODE;
00139                 nodeVec[gNodeIdx].srcNodeIdx() = cnt;
00140                 cnt++;
00141                 if(nodeVec[gNodeIdx].child()==-1) {
00142                   nodeVec[gNodeIdx].srcExaBeg() = sum;
00143                   nodeVec[gNodeIdx].srcExaNum() = lclSrcNumVec[gNodeIdx];
00144                   sum += lclSrcNumVec[gNodeIdx];
00145                   nodeVec[gNodeIdx].srcOwnVecIdxs() = vecIdxs[gNodeIdx];
00146                 }
00147          }
00148   }
00149   _srcNodeCnt = cnt;  _srcExaCnt = sum; //SET S cnts
00150   return 0;
00151 }


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