Example #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;
}
Example #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;
}
Example #3
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();
}