Skip to content

Commit

Permalink
Fix hardcoded float in TreeTraversal
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Dec 3, 2024
1 parent c4653c5 commit 51b8677
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/spatial/detail/ArborX_TreeTraversal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,15 @@ struct TreeTraversal<BVH, Predicates, Callback, NearestPredicateTag>
HappyTreeFriends::getInternalBoundingVolume(bvh, j));
};

using Coordinate =
decltype(predicate.distance(HappyTreeFriends::getIndexable(bvh, 0)));

constexpr int SENTINEL = -1;
int stack[64];
auto *stack_ptr = stack;
*stack_ptr++ = SENTINEL;
#if !defined(__CUDA_ARCH__)
float stack_distance[64];
Coordinate stack_distance[64];
auto *stack_distance_ptr = stack_distance;
*stack_distance_ptr++ = 0.f;
#endif
Expand All @@ -226,14 +229,14 @@ struct TreeTraversal<BVH, Predicates, Callback, NearestPredicateTag>
int left_child;
int right_child;

float distance_left = 0.f;
float distance_right = 0.f;
float distance_node = 0.f;
Coordinate distance_left = 0;
Coordinate distance_right = 0;
Coordinate distance_node = 0;

// Nodes with a distance that exceed that radius can safely be
// discarded. Initialize the radius to infinity and tighten it once k
// neighbors have been found.
auto radius = KokkosExt::ArithmeticTraits::infinity<float>::value;
auto radius = KokkosExt::ArithmeticTraits::infinity<Coordinate>::value;

do
{
Expand Down

0 comments on commit 51b8677

Please sign in to comment.