Skip to content

Commit

Permalink
Provide proper expand(Box,Box) and expand(Box, Point)
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed May 4, 2024
1 parent 63fc08e commit fa35339
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/geometry/ArborX_DetailsAlgorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,15 @@ struct expand<BoxTag, PointTag, Box, Point>
{
KOKKOS_FUNCTION static void apply(Box &box, Point const &point)
{
box += point;
using Details::KokkosExt::max;
using Details::KokkosExt::min;

constexpr int DIM = GeometryTraits::dimension_v<Box>;
for (int d = 0; d < DIM; ++d)
{
box.minCorner()[d] = min(box.minCorner()[d], point[d]);
box.maxCorner()[d] = max(box.maxCorner()[d], point[d]);
}
}
};

Expand All @@ -414,7 +422,15 @@ struct expand<BoxTag, BoxTag, Box1, Box2>
{
KOKKOS_FUNCTION static void apply(Box1 &box, Box2 const &other)
{
box += other;
using Details::KokkosExt::max;
using Details::KokkosExt::min;

constexpr int DIM = GeometryTraits::dimension_v<Box1>;
for (int d = 0; d < DIM; ++d)
{
box.minCorner()[d] = min(box.minCorner()[d], other.minCorner()[d]);
box.maxCorner()[d] = max(box.maxCorner()[d], other.maxCorner()[d]);
}
}
};

Expand Down

0 comments on commit fa35339

Please sign in to comment.