/**************************************************************************** * 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_SPACE_FILLING_CURVES_HPP #define ARBORX_SPACE_FILLING_CURVES_HPP #include #include #include #include #include #include #include namespace ArborX { namespace Experimental { struct Morton32 { template && GeometryTraits::is_point_v> * = nullptr> KOKKOS_FUNCTION auto operator()(Box const &scene_bounding_box, Point p) const { Details::translateAndScale(p, p, scene_bounding_box); return Details::morton32(p); } template && !GeometryTraits::is_point_v> * = nullptr> KOKKOS_FUNCTION auto operator()(Box const &scene_bounding_box, Geometry const &geometry) const { using Details::returnCentroid; auto p = returnCentroid(geometry); Details::translateAndScale(p, p, scene_bounding_box); return Details::morton32(p); } }; struct Morton64 { template && GeometryTraits::is_point_v> * = nullptr> KOKKOS_FUNCTION auto operator()(Box const &scene_bounding_box, Point p) const { Details::translateAndScale(p, p, scene_bounding_box); return Details::morton64(p); } template && !GeometryTraits::is_point_v> * = nullptr> KOKKOS_FUNCTION auto operator()(Box const &scene_bounding_box, Geometry const &geometry) const { using Details::returnCentroid; auto p = returnCentroid(geometry); Details::translateAndScale(p, p, scene_bounding_box); return Details::morton64(p); } }; } // namespace Experimental namespace Details { template void check_valid_space_filling_curve(SpaceFillingCurve const &) { using Point = ExperimentalHyperGeometry::Point; using Box = ExperimentalHyperGeometry::Box; static_assert(std::is_invocable_v); static_assert(std::is_invocable_v); using OrderValueType = std::invoke_result_t; static_assert(std::is_same_v || std::is_same_v); static_assert(std::is_same_v< OrderValueType, std::invoke_result_t>); } } // namespace Details } // namespace ArborX #endif