Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. std::vector<double> genPoints()
  2. {
  3.   std::vector<double> pts;
  4.   int n_pts_1d = 16;
  5.   for (int i = 1; i < n_pts_1d; i++) {
  6.     double x = ((double)i) / n_pts_1d;
  7.     for (int j = 1; j < n_pts_1d; j++) {
  8.       double y = ((double)j) / n_pts_1d;
  9.       for (int k = 1; k < n_pts_1d; k++) {
  10.         double z = ((double)k) / n_pts_1d;
  11.         pts.push_back(x);
  12.         pts.push_back(y);
  13.         pts.push_back(z);
  14.       }
  15.     }
  16.   }
  17.  
  18.   return pts;
  19. }
  20.  
  21. std::vector<ot::TreeNode> buildOct()
  22. {
  23.   std::vector<double> pts = genPoints();
  24.   double gSize[3] = {1.0, 1.0, 1.0};
  25.   int dim = 3;
  26.   int maxOctDepth = 8;
  27.   int maxPtsPerOctant = 1;
  28.   bool incCorner = true;
  29.  
  30.   std::vector<ot::TreeNode> linOct, balOct, newLinOct;
  31.  
  32.   ot::points2Octree(pts, gSize, linOct, dim, maxOctDepth, maxPtsPerOctant, MPI_COMM_WORLD);
  33.   par::sampleSort<ot::TreeNode>(linOct, newLinOct, MPI_COMM_WORLD);
  34.   ot::balanceOctree (newLinOct, balOct, dim, maxOctDepth, incCorner, MPI_COMM_WORLD);
  35.  
  36.   return balOct;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement