Skip to content

Commit

Permalink
Address minor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Oct 23, 2023
1 parent bfa6054 commit 94e9120
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/details/ArborX_MinimumSpanningTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#include <ArborX_HyperBox.hpp>
#include <ArborX_LinearBVH.hpp>

#if KOKKOS_VERSION >= 40200
#include <Kokkos_Assert.hpp> // KOKKOS_ASSERT
#else
#include <impl/Kokkos_Error.hpp> // KOKKOS_ASSERT
#endif

#include <Kokkos_MathematicalFunctions.hpp> // isfinite, signbit

#if KOKKOS_VERSION >= 40100
Expand Down Expand Up @@ -570,7 +576,7 @@ void computeParents(ExecutionSpace const &space, Edges const &edges,

using MemorySpace = typename SidedParents::memory_space;

auto num_edges = edges.size();
int num_edges = edges.size();

// Encode both a sided parent and an edge weight into long long.
// This way, once we sort based on this value, edges with the same sided
Expand Down Expand Up @@ -619,8 +625,8 @@ void computeParents(ExecutionSpace const &space, Edges const &edges,
// signbit instead of >= 0 just as an extra precaution against negative
// floating zeros.
static_assert(sizeof(int) == sizeof(float));
assert(Kokkos::isfinite(edge.weight) &&
Kokkos::signbit(edge.weight) == 0);
KOKKOS_ASSERT(Kokkos::isfinite(edge.weight) &&
Kokkos::signbit(edge.weight) == 0);
keys(e) = (key << shift) + KokkosExt::bit_cast<int>(edge.weight);
});

Expand Down Expand Up @@ -660,7 +666,7 @@ void computeParents(ExecutionSpace const &space, Edges const &edges,
// Find the index of the smallest edge with the same weight in
// this chain
int m = i;
for (int k = i + 1; k < (int)num_edges && keys(k) == key; ++k)
for (int k = i + 1; k < num_edges && keys(k) == key; ++k)
if (edges(permute(k)) < edges(permute(m)))
m = k;

Expand All @@ -675,7 +681,7 @@ void computeParents(ExecutionSpace const &space, Edges const &edges,
Kokkos::RangePolicy<ExecutionSpace>(space, 0, num_edges),
KOKKOS_LAMBDA(int const i) {
int e = permute(i);
if (i == (int)num_edges - 1)
if (i == num_edges - 1)
{
// The parent of the root node is set to -1
parents(e) = -1;
Expand Down

0 comments on commit 94e9120

Please sign in to comment.