From 83d86edf933aa0a668519235ad5f260f42d2ac8e Mon Sep 17 00:00:00 2001 From: Andrey Prokopenko Date: Tue, 8 Oct 2024 08:46:13 -0400 Subject: [PATCH] Overhaul --- src/cluster/detail/ArborX_BoruvkaHelpers.hpp | 2 +- .../ArborX_MutualReachabilityDistance.hpp | 1 - .../ArborX_DistributedTreeNearestHelpers.hpp | 1 + src/geometry/ArborX_KDOP.hpp | 1 - src/geometry/ArborX_Ray.hpp | 2 +- src/geometry/ArborX_Segment.hpp | 1 - src/geometry/ArborX_Tetrahedron.hpp | 1 - .../ArborX_Centroid.hpp} | 2 +- .../ArborX_Convert.hpp} | 0 .../ArborX_Distance.hpp} | 2 +- .../ArborX_Equals.hpp} | 0 .../ArborX_Expand.hpp} | 0 .../ArborX_Intersects.hpp} | 4 +- .../ArborX_Reducer.hpp} | 34 ++------------- .../algorithms/ArborX_TranslateAndScale.hpp | 41 +++++++++++++++++++ .../ArborX_Valid.hpp} | 0 ...nterpDetailsCompactRadialBasisFunction.hpp | 2 +- src/spatial/detail/ArborX_BatchedQueries.hpp | 1 - src/spatial/detail/ArborX_BruteForceImpl.hpp | 3 +- .../detail/ArborX_PredicateHelpers.hpp | 1 + src/spatial/detail/ArborX_Predicates.hpp | 7 +++- .../detail/ArborX_SpaceFillingCurves.hpp | 3 +- .../detail/ArborX_TreeConstruction.hpp | 5 ++- src/spatial/detail/ArborX_TreeTraversal.hpp | 1 - test/ArborXTest_LegacyTree.hpp | 1 - test/tstBoostGeometryAdapters.cpp | 6 ++- test/tstBoostRangeAdapters.cpp | 2 +- test/tstDetailsAlgorithms.cpp | 8 +++- test/tstDetailsGeometryReducer.cpp | 4 +- test/tstDetailsTreeConstruction.cpp | 1 - ...nterpDetailsCompactRadialBasisFunction.cpp | 1 - test/tstKDOP.cpp | 2 +- 32 files changed, 84 insertions(+), 56 deletions(-) rename src/geometry/{detail/ArborX_GeometryCentroid.hpp => algorithms/ArborX_Centroid.hpp} (98%) rename src/geometry/{detail/ArborX_GeometryConvert.hpp => algorithms/ArborX_Convert.hpp} (100%) rename src/geometry/{detail/ArborX_GeometryDistance.hpp => algorithms/ArborX_Distance.hpp} (99%) rename src/geometry/{detail/ArborX_GeometryEquals.hpp => algorithms/ArborX_Equals.hpp} (100%) rename src/geometry/{detail/ArborX_GeometryExpand.hpp => algorithms/ArborX_Expand.hpp} (100%) rename src/geometry/{detail/ArborX_GeometryIntersects.hpp => algorithms/ArborX_Intersects.hpp} (99%) rename src/geometry/{detail/ArborX_GeometryAlgorithms.hpp => algorithms/ArborX_Reducer.hpp} (65%) create mode 100644 src/geometry/algorithms/ArborX_TranslateAndScale.hpp rename src/geometry/{detail/ArborX_GeometryValid.hpp => algorithms/ArborX_Valid.hpp} (100%) diff --git a/src/cluster/detail/ArborX_BoruvkaHelpers.hpp b/src/cluster/detail/ArborX_BoruvkaHelpers.hpp index 95b118d49..ff31da940 100644 --- a/src/cluster/detail/ArborX_BoruvkaHelpers.hpp +++ b/src/cluster/detail/ArborX_BoruvkaHelpers.hpp @@ -12,7 +12,7 @@ #ifndef ARBORX_BORUVKA_HELPERS_HPP #define ARBORX_BORUVKA_HELPERS_HPP -#include +#include #include #include #include diff --git a/src/cluster/detail/ArborX_MutualReachabilityDistance.hpp b/src/cluster/detail/ArborX_MutualReachabilityDistance.hpp index 99d6cc2d5..e08513ecc 100644 --- a/src/cluster/detail/ArborX_MutualReachabilityDistance.hpp +++ b/src/cluster/detail/ArborX_MutualReachabilityDistance.hpp @@ -13,7 +13,6 @@ #define ARBORX_MUTUAL_REACHABILITY_DISTANCE_HPP #include -#include #include #include diff --git a/src/distributed/detail/ArborX_DistributedTreeNearestHelpers.hpp b/src/distributed/detail/ArborX_DistributedTreeNearestHelpers.hpp index f3fc73cc7..aca18b246 100644 --- a/src/distributed/detail/ArborX_DistributedTreeNearestHelpers.hpp +++ b/src/distributed/detail/ArborX_DistributedTreeNearestHelpers.hpp @@ -13,6 +13,7 @@ #include #include +#include #include #include diff --git a/src/geometry/ArborX_KDOP.hpp b/src/geometry/ArborX_KDOP.hpp index 8a4f38aa9..9d1d78b23 100644 --- a/src/geometry/ArborX_KDOP.hpp +++ b/src/geometry/ArborX_KDOP.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/src/geometry/ArborX_Ray.hpp b/src/geometry/ArborX_Ray.hpp index 3aa8209e9..a43c7e209 100644 --- a/src/geometry/ArborX_Ray.hpp +++ b/src/geometry/ArborX_Ray.hpp @@ -15,7 +15,7 @@ #include #include #include -#include // equal +#include #include #include diff --git a/src/geometry/ArborX_Segment.hpp b/src/geometry/ArborX_Segment.hpp index 6bb2709aa..b7bb2f199 100644 --- a/src/geometry/ArborX_Segment.hpp +++ b/src/geometry/ArborX_Segment.hpp @@ -12,7 +12,6 @@ #define ARBORX_SEGMENT_HPP #include -#include #include #include diff --git a/src/geometry/ArborX_Tetrahedron.hpp b/src/geometry/ArborX_Tetrahedron.hpp index 7be862953..3827de36b 100644 --- a/src/geometry/ArborX_Tetrahedron.hpp +++ b/src/geometry/ArborX_Tetrahedron.hpp @@ -14,7 +14,6 @@ #include #include -#include #include diff --git a/src/geometry/detail/ArborX_GeometryCentroid.hpp b/src/geometry/algorithms/ArborX_Centroid.hpp similarity index 98% rename from src/geometry/detail/ArborX_GeometryCentroid.hpp rename to src/geometry/algorithms/ArborX_Centroid.hpp index c3555b0f0..3daa73211 100644 --- a/src/geometry/detail/ArborX_GeometryCentroid.hpp +++ b/src/geometry/algorithms/ArborX_Centroid.hpp @@ -11,7 +11,7 @@ #ifndef ARBORX_DETAILS_GEOMETRY_CENTROID_HPP #define ARBORX_DETAILS_GEOMETRY_CENTROID_HPP -#include "ArborX_GeometryExpand.hpp" +#include "ArborX_Expand.hpp" #include #include diff --git a/src/geometry/detail/ArborX_GeometryConvert.hpp b/src/geometry/algorithms/ArborX_Convert.hpp similarity index 100% rename from src/geometry/detail/ArborX_GeometryConvert.hpp rename to src/geometry/algorithms/ArborX_Convert.hpp diff --git a/src/geometry/detail/ArborX_GeometryDistance.hpp b/src/geometry/algorithms/ArborX_Distance.hpp similarity index 99% rename from src/geometry/detail/ArborX_GeometryDistance.hpp rename to src/geometry/algorithms/ArborX_Distance.hpp index d75cd6886..ebcd0f809 100644 --- a/src/geometry/detail/ArborX_GeometryDistance.hpp +++ b/src/geometry/algorithms/ArborX_Distance.hpp @@ -11,7 +11,7 @@ #ifndef ARBORX_DETAILS_GEOMETRY_DISTANCE_HPP #define ARBORX_DETAILS_GEOMETRY_DISTANCE_HPP -#include "ArborX_GeometryEquals.hpp" +#include "ArborX_Equals.hpp" #include #include diff --git a/src/geometry/detail/ArborX_GeometryEquals.hpp b/src/geometry/algorithms/ArborX_Equals.hpp similarity index 100% rename from src/geometry/detail/ArborX_GeometryEquals.hpp rename to src/geometry/algorithms/ArborX_Equals.hpp diff --git a/src/geometry/detail/ArborX_GeometryExpand.hpp b/src/geometry/algorithms/ArborX_Expand.hpp similarity index 100% rename from src/geometry/detail/ArborX_GeometryExpand.hpp rename to src/geometry/algorithms/ArborX_Expand.hpp diff --git a/src/geometry/detail/ArborX_GeometryIntersects.hpp b/src/geometry/algorithms/ArborX_Intersects.hpp similarity index 99% rename from src/geometry/detail/ArborX_GeometryIntersects.hpp rename to src/geometry/algorithms/ArborX_Intersects.hpp index 8f7361ef9..9e5f66413 100644 --- a/src/geometry/detail/ArborX_GeometryIntersects.hpp +++ b/src/geometry/algorithms/ArborX_Intersects.hpp @@ -11,8 +11,8 @@ #ifndef ARBORX_DETAILS_GEOMETRY_INTERSECTS_HPP #define ARBORX_DETAILS_GEOMETRY_INTERSECTS_HPP -#include "ArborX_GeometryDistance.hpp" -#include "ArborX_GeometryExpand.hpp" +#include "ArborX_Distance.hpp" +#include "ArborX_Expand.hpp" #include #include diff --git a/src/geometry/detail/ArborX_GeometryAlgorithms.hpp b/src/geometry/algorithms/ArborX_Reducer.hpp similarity index 65% rename from src/geometry/detail/ArborX_GeometryAlgorithms.hpp rename to src/geometry/algorithms/ArborX_Reducer.hpp index 850967103..7924008cc 100644 --- a/src/geometry/detail/ArborX_GeometryAlgorithms.hpp +++ b/src/geometry/algorithms/ArborX_Reducer.hpp @@ -8,18 +8,11 @@ * * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ -#ifndef ARBORX_ALGORITHMS_HPP -#define ARBORX_ALGORITHMS_HPP - -#include "ArborX_GeometryCentroid.hpp" -#include "ArborX_GeometryConvert.hpp" -#include "ArborX_GeometryDistance.hpp" -#include "ArborX_GeometryEquals.hpp" -#include "ArborX_GeometryExpand.hpp" -#include "ArborX_GeometryIntersects.hpp" -#include "ArborX_GeometryValid.hpp" + +#ifndef ARBORX_REDUCER_HPP +#define ARBORX_REDUCER_HPP + #include -#include #include @@ -73,25 +66,6 @@ struct GeometryReducer bool references_scalar() const { return _references_scalar; } }; -// transformation that maps the unit cube into a new axis-aligned box -// NOTE safe to perform in-place -template && - GeometryTraits::is_box_v> * = nullptr> -KOKKOS_FUNCTION void translateAndScale(Point const &in, Point &out, - Box const &ref) -{ - static_assert(GeometryTraits::dimension_v == - GeometryTraits::dimension_v); - constexpr int DIM = GeometryTraits::dimension_v; - for (int d = 0; d < DIM; ++d) - { - auto const a = ref.minCorner()[d]; - auto const b = ref.maxCorner()[d]; - out[d] = (a != b ? (in[d] - a) / (b - a) : 0); - } -} - } // namespace ArborX::Details #endif diff --git a/src/geometry/algorithms/ArborX_TranslateAndScale.hpp b/src/geometry/algorithms/ArborX_TranslateAndScale.hpp new file mode 100644 index 000000000..7facbafc5 --- /dev/null +++ b/src/geometry/algorithms/ArborX_TranslateAndScale.hpp @@ -0,0 +1,41 @@ +/**************************************************************************** + * 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_TRANSLATE_AND_SCALE_HPP +#define ARBORX_TRANSLATE_AND_SCALE_HPP + +#include + +#include + +namespace ArborX::Details +{ +// transformation that maps the unit cube into a new axis-aligned box +// NOTE safe to perform in-place +template && + GeometryTraits::is_box_v> * = nullptr> +KOKKOS_FUNCTION void translateAndScale(Point const &in, Point &out, + Box const &ref) +{ + static_assert(GeometryTraits::dimension_v == + GeometryTraits::dimension_v); + constexpr int DIM = GeometryTraits::dimension_v; + for (int d = 0; d < DIM; ++d) + { + auto const a = ref.minCorner()[d]; + auto const b = ref.maxCorner()[d]; + out[d] = (a != b ? (in[d] - a) / (b - a) : 0); + } +} +} // namespace ArborX::Details + +#endif diff --git a/src/geometry/detail/ArborX_GeometryValid.hpp b/src/geometry/algorithms/ArborX_Valid.hpp similarity index 100% rename from src/geometry/detail/ArborX_GeometryValid.hpp rename to src/geometry/algorithms/ArborX_Valid.hpp diff --git a/src/interpolation/detail/ArborX_InterpDetailsCompactRadialBasisFunction.hpp b/src/interpolation/detail/ArborX_InterpDetailsCompactRadialBasisFunction.hpp index e4389b3cb..7fac1b48b 100644 --- a/src/interpolation/detail/ArborX_InterpDetailsCompactRadialBasisFunction.hpp +++ b/src/interpolation/detail/ArborX_InterpDetailsCompactRadialBasisFunction.hpp @@ -13,7 +13,7 @@ #define ARBORX_INTERP_COMPACT_RADIAL_BASIS_FUNCTION_HPP #include -#include +#include #include diff --git a/src/spatial/detail/ArborX_BatchedQueries.hpp b/src/spatial/detail/ArborX_BatchedQueries.hpp index 539890937..78cec8bb9 100644 --- a/src/spatial/detail/ArborX_BatchedQueries.hpp +++ b/src/spatial/detail/ArborX_BatchedQueries.hpp @@ -13,7 +13,6 @@ #define ARBORX_BATCHED_QUERIES_HPP #include -#include // returnCentroid, translateAndScale #include #include // sortObjects diff --git a/src/spatial/detail/ArborX_BruteForceImpl.hpp b/src/spatial/detail/ArborX_BruteForceImpl.hpp index e1d11fe98..cc5437b1f 100644 --- a/src/spatial/detail/ArborX_BruteForceImpl.hpp +++ b/src/spatial/detail/ArborX_BruteForceImpl.hpp @@ -12,9 +12,10 @@ #ifndef ARBORX_BRUTE_FORCE_IMPL_HPP #define ARBORX_BRUTE_FORCE_IMPL_HPP -#include // expand +#include #include #include +#include #include #include #include diff --git a/src/spatial/detail/ArborX_PredicateHelpers.hpp b/src/spatial/detail/ArborX_PredicateHelpers.hpp index 1390e1927..d988eee81 100644 --- a/src/spatial/detail/ArborX_PredicateHelpers.hpp +++ b/src/spatial/detail/ArborX_PredicateHelpers.hpp @@ -13,6 +13,7 @@ #include #include +#include #include #include diff --git a/src/spatial/detail/ArborX_Predicates.hpp b/src/spatial/detail/ArborX_Predicates.hpp index 702a575b8..5c3ca6941 100644 --- a/src/spatial/detail/ArborX_Predicates.hpp +++ b/src/spatial/detail/ArborX_Predicates.hpp @@ -11,7 +11,12 @@ #ifndef ARBORX_PREDICATE_HPP #define ARBORX_PREDICATE_HPP -#include +#include +#include + +#include + +#include namespace ArborX { diff --git a/src/spatial/detail/ArborX_SpaceFillingCurves.hpp b/src/spatial/detail/ArborX_SpaceFillingCurves.hpp index 662274a93..80d8e0814 100644 --- a/src/spatial/detail/ArborX_SpaceFillingCurves.hpp +++ b/src/spatial/detail/ArborX_SpaceFillingCurves.hpp @@ -14,7 +14,8 @@ #include #include -#include +#include +#include #include #include diff --git a/src/spatial/detail/ArborX_TreeConstruction.hpp b/src/spatial/detail/ArborX_TreeConstruction.hpp index b93f2e403..84c1f6d25 100644 --- a/src/spatial/detail/ArborX_TreeConstruction.hpp +++ b/src/spatial/detail/ArborX_TreeConstruction.hpp @@ -12,8 +12,9 @@ #ifndef ARBORX_TREE_CONSTRUCTION_HPP #define ARBORX_TREE_CONSTRUCTION_HPP -#include // expand -#include // makeLeafNode +#include +#include +#include // makeLeafNode #include #include #include diff --git a/src/spatial/detail/ArborX_TreeTraversal.hpp b/src/spatial/detail/ArborX_TreeTraversal.hpp index a97011985..b742fb5b8 100644 --- a/src/spatial/detail/ArborX_TreeTraversal.hpp +++ b/src/spatial/detail/ArborX_TreeTraversal.hpp @@ -11,7 +11,6 @@ #ifndef ARBORX_TREE_TRAVERSAL_HPP #define ARBORX_TREE_TRAVERSAL_HPP -#include #include #include #include // ROPE_SENTINEL diff --git a/test/ArborXTest_LegacyTree.hpp b/test/ArborXTest_LegacyTree.hpp index 64123bc95..7cce3f502 100644 --- a/test/ArborXTest_LegacyTree.hpp +++ b/test/ArborXTest_LegacyTree.hpp @@ -14,7 +14,6 @@ #include #include -#include #include #include diff --git a/test/tstBoostGeometryAdapters.cpp b/test/tstBoostGeometryAdapters.cpp index a4cbd0c62..3d7899645 100644 --- a/test/tstBoostGeometryAdapters.cpp +++ b/test/tstBoostGeometryAdapters.cpp @@ -12,7 +12,11 @@ #include "ArborX_BoostGeometryAdapters.hpp" #include #include -#include +#include +#include +#include +#include +#include #include diff --git a/test/tstBoostRangeAdapters.cpp b/test/tstBoostRangeAdapters.cpp index b1e10682e..e09aebe8b 100644 --- a/test/tstBoostRangeAdapters.cpp +++ b/test/tstBoostRangeAdapters.cpp @@ -13,7 +13,7 @@ #include "ArborX_EnableViewComparison.hpp" #include #include -#include +#include #include diff --git a/test/tstDetailsAlgorithms.cpp b/test/tstDetailsAlgorithms.cpp index af771ed00..ed6746709 100644 --- a/test/tstDetailsAlgorithms.cpp +++ b/test/tstDetailsAlgorithms.cpp @@ -15,7 +15,13 @@ #include #include #include -#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/test/tstDetailsGeometryReducer.cpp b/test/tstDetailsGeometryReducer.cpp index d4b0ab0de..cf80ab7bd 100644 --- a/test/tstDetailsGeometryReducer.cpp +++ b/test/tstDetailsGeometryReducer.cpp @@ -11,7 +11,9 @@ #include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES #include -#include +#include +#include +#include #include diff --git a/test/tstDetailsTreeConstruction.cpp b/test/tstDetailsTreeConstruction.cpp index b7a609912..f093d4136 100644 --- a/test/tstDetailsTreeConstruction.cpp +++ b/test/tstDetailsTreeConstruction.cpp @@ -11,7 +11,6 @@ #include "ArborXTest_LegacyTree.hpp" #include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES #include "ArborX_EnableViewComparison.hpp" -#include #include #include // expandBits, morton32 #include // ROPE SENTINEL diff --git a/test/tstInterpDetailsCompactRadialBasisFunction.cpp b/test/tstInterpDetailsCompactRadialBasisFunction.cpp index 7cb086b06..2882650d3 100644 --- a/test/tstInterpDetailsCompactRadialBasisFunction.cpp +++ b/test/tstInterpDetailsCompactRadialBasisFunction.cpp @@ -12,7 +12,6 @@ #include "ArborX_EnableDeviceTypes.hpp" #include "ArborX_EnableViewComparison.hpp" #include -#include #include #include "BoostTest_CUDA_clang_workarounds.hpp" diff --git a/test/tstKDOP.cpp b/test/tstKDOP.cpp index 8a73c2c9a..e393bf8f1 100644 --- a/test/tstKDOP.cpp +++ b/test/tstKDOP.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include "BoostTest_CUDA_clang_workarounds.hpp" #include