Skip to content

Commit

Permalink
measure time for building kdlite
Browse files Browse the repository at this point in the history
  • Loading branch information
guo.2154 committed Jan 28, 2024
1 parent 6650eeb commit 47a5c6e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/ftk/mesh/mpas_mesh.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <ftk/mesh/simplicial_unstructured_2d_mesh.hh>
#include <ftk/numeric/mpas.hh>
#include <ftk/numeric/inverse_linear_interpolation_solver.hh>
#include <chrono>

namespace ftk {

Expand Down Expand Up @@ -129,9 +130,18 @@ void mpas_mesh<I, F>::initialize()
// kd_cells.reset(new kd_t<F, 3>);
// kd_cells->set_inputs(this->xyzCells);
// kd_cells->build();

fprintf(stderr, "building kdlite..\n");

typedef std::chrono::high_resolution_clock clock_type;

auto t0 = clock_type::now();
kdlite_heap.resize( n_cells()*3, -1 );
kdlite_build<3>((int)n_cells(), xyzCells.data(), kdlite_heap.data());

auto t1 = clock_type::now();
fprintf(stderr, "time_kdlite=%f\n",
std::chrono::duration_cast<std::chrono::nanoseconds>(t1-t0).count() * 1e-9);
}

template <typename I, typename F>
Expand Down

0 comments on commit 47a5c6e

Please sign in to comment.