From ad5dd3f9d78aaffe8b6c870dd18c2efcb0ec0edb Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 10 Jan 2023 23:56:06 +0000 Subject: [PATCH] Add comments ans provide fallback implementation --- source/grid/grid_tools.cc | 5 ++++- source/particles/particle_handler.cc | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index ffa7317bea..36e2d8bcc7 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -3012,7 +3012,10 @@ namespace GridTools } else { - // Fixed in + // For some clang-based compilers and boost versions the call to + // RTree::query doesn't compile. Since using an rtree here is just a + // performance improvement disabling this branch is OK. + // This is fixed in boost in // https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a #if defined(FEATURE_BOOST_BUNDLED_CONFIGURED) || \ !(defined(__clang_major__) && __clang_major__ >= 16) || \ diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index 28b9694cd2..1acfb2b42b 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -1372,7 +1372,7 @@ namespace Particles }); // Search all of the cells adjacent to the closest vertex of the - // previous cell Most likely we will find the particle in them. + // previous cell. Most likely we will find the particle in them. for (unsigned int i = 0; i < n_neighbor_cells; ++i) { typename std::set:: @@ -1393,13 +1393,16 @@ namespace Particles } } - // Fixed in - // https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a + if (!found_cell) + { + // For some clang-based compilers and boost versions the call to + // RTree::query doesn't compile. We use a slower implementation as + // workaround. + // This is fixed in boost in + // https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a #if defined(FEATURE_BOOST_BUNDLED_CONFIGURED) || \ !(defined(__clang_major__) && __clang_major__ >= 16) || \ BOOST_VERSION >= 108100 - if (!found_cell) - { // The particle is not in a neighbor of the old cell. // Look for the new cell in the whole local domain. // This case is rare. @@ -1414,6 +1417,12 @@ namespace Particles AssertDimension(closest_vertex_in_domain.size(), 1); const unsigned int closest_vertex_index_in_domain = closest_vertex_in_domain[0].second; +#else + const unsigned int closest_vertex_index_in_domain = + GridTools::find_closest_vertex(*mapping, + *triangulation, + out_particle->get_location()); +#endif // Search all of the cells adjacent to the closest vertex of the // domain. Most likely we will find the particle in them. @@ -1432,7 +1441,6 @@ namespace Particles } } } -#endif if (!found_cell) { -- 2.39.5