Beispiel #1
0
int main(int argc, char* argv[])
{
  // Create mesh
  UnitCubeMesh mesh(SIZE, SIZE, SIZE);

  // First call
  BoundingBoxTree tree;
  tree.build(mesh);
  Point point(-1.0, -1.0, 0.0);
  tree.compute_closest_entity(point);
  cout << "Built tree, searching for closest point" << endl;

  // Call repeatedly
  tic();
  for (int i = 0; i < NUM_REPS; i++)
  {
    tree.compute_closest_entity(point);
    point.coordinates()[1] += 2.0 / static_cast<double>(NUM_REPS);
  }
  const double t = toc();

  // Report result
  info("BENCH %g", t);

  return 0;
}
Beispiel #2
0
int main(int argc, char* argv[])
{
  info("Build bounding box tree on UnitCubeMesh(%d, %d, %d)",
       SIZE, SIZE, SIZE);

  // Create mesh
  UnitCubeMesh mesh(SIZE, SIZE, SIZE);

  // Create and build tree
  tic();
  BoundingBoxTree tree;
  tree.build(mesh);
  info("BENCH %g", toc());

  return 0;
}
 MeshObject(int n_,
            const double *x_,
            int nt_,
            const int *tri_)
     : n(n_), x((const Vec3d*)x_), nt(nt_), tri((const Vec3i*)tri_)
 {
     assert(x && tri && n>=0 && nt>=0);
     if(nt==0) return;
     std::vector<BoundingBox> box(nt);
     for(int t=0; t<nt; ++t){
         int i, j, k; assign(tri[t], i, j, k);
         box[t].build_from_points(x[i], x[j], x[k]);
     }
     tree.construct_from_leaf_boxes(nt, &box[0]);
 }
Beispiel #4
0
double bench_dolfin(const Mesh& mesh)
{
  cout << "Running DOLFIN bench" << endl;

  // First call
  BoundingBoxTree tree;
  tree.build(mesh);
  Point point(-1.0, -1.0, 0.0);
  tree.compute_closest_entity(point, mesh);

  cout << "Built tree, searching for closest point" << endl;

  // Call repeatedly
  tic();
  for (int i = 0; i < NUM_REPS; i++)
  {
    //std::pair<unsigned int, double> ret = tree.compute_closest_entity(point, mesh);
    //cout << ret.first << " " << ret.second << endl;
    tree.compute_closest_entity(point, mesh);
    point.coordinates()[1] += 2.0 / static_cast<double>(NUM_REPS);
  }

  return toc();
}