/**************************************************************************** * Copyright (c) 2017-2022 by the ArborX authors * * All rights reserved. * * * * This file is part of the ArborX library. ArborX is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ #ifndef ARBORX_HYPERBOX_HPP #define ARBORX_HYPERBOX_HPP #include #include #include #include #include #include namespace ArborX::ExperimentalHyperGeometry { /** * Axis-Aligned Bounding Box. This is just a thin wrapper around an array of * size 2x spatial dimension with a default constructor to initialize * properly an "empty" box. */ template struct Box { KOKKOS_FUNCTION constexpr Box() { for (int d = 0; d < DIM; ++d) { _min_corner[d] = Details::KokkosExt::ArithmeticTraits::finite_max::value; _max_corner[d] = Details::KokkosExt::ArithmeticTraits::finite_min::value; } } KOKKOS_FUNCTION constexpr Box(Point const &min_corner, Point const &max_corner) : _min_corner(min_corner) , _max_corner(max_corner) {} KOKKOS_FUNCTION constexpr auto &minCorner() { return _min_corner; } KOKKOS_FUNCTION constexpr auto const &minCorner() const { return _min_corner; } KOKKOS_FUNCTION constexpr auto &maxCorner() { return _max_corner; } KOKKOS_FUNCTION constexpr auto const &maxCorner() const { return _max_corner; } Point _min_corner; Point _max_corner; }; } // namespace ArborX::ExperimentalHyperGeometry template struct ArborX::GeometryTraits::dimension< ArborX::ExperimentalHyperGeometry::Box> { static constexpr int value = DIM; }; template struct ArborX::GeometryTraits::tag< ArborX::ExperimentalHyperGeometry::Box> { using type = BoxTag; }; template struct ArborX::GeometryTraits::coordinate_type< ArborX::ExperimentalHyperGeometry::Box> { using type = Coordinate; }; template struct [[deprecated]] Kokkos::reduction_identity< ArborX::ExperimentalHyperGeometry::Box> { KOKKOS_FUNCTION static ArborX::ExperimentalHyperGeometry::Box sum() { return {}; } }; #endif