Skip to content

Commit

Permalink
Overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Oct 8, 2024
1 parent a540ffd commit 83d86ed
Show file tree
Hide file tree
Showing 32 changed files with 84 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/cluster/detail/ArborX_BoruvkaHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef ARBORX_BORUVKA_HELPERS_HPP
#define ARBORX_BORUVKA_HELPERS_HPP

#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Distance.hpp>
#include <detail/ArborX_HappyTreeFriends.hpp>
#include <detail/ArborX_WeightedEdge.hpp>
#include <kokkos_ext/ArborX_KokkosExtArithmeticTraits.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/cluster/detail/ArborX_MutualReachabilityDistance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define ARBORX_MUTUAL_REACHABILITY_DISTANCE_HPP

#include <detail/ArborX_AccessTraits.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <detail/ArborX_HappyTreeFriends.hpp>
#include <detail/ArborX_Predicates.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <ArborX_Point.hpp>
#include <ArborX_Sphere.hpp>
#include <algorithms/ArborX_Convert.hpp>
#include <detail/ArborX_AccessTraits.hpp>
#include <detail/ArborX_Callbacks.hpp>

Expand Down
1 change: 0 additions & 1 deletion src/geometry/ArborX_KDOP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <ArborX_Box.hpp>
#include <ArborX_GeometryTraits.hpp>
#include <ArborX_Point.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <kokkos_ext/ArborX_KokkosExtArithmeticTraits.hpp>
#include <misc/ArborX_Vector.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/geometry/ArborX_Ray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <ArborX_Point.hpp>
#include <ArborX_Sphere.hpp>
#include <ArborX_Triangle.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp> // equal
#include <algorithms/ArborX_Equals.hpp>
#include <kokkos_ext/ArborX_KokkosExtArithmeticTraits.hpp>
#include <misc/ArborX_Vector.hpp>

Expand Down
1 change: 0 additions & 1 deletion src/geometry/ArborX_Segment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#define ARBORX_SEGMENT_HPP

#include <ArborX_GeometryTraits.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <misc/ArborX_Vector.hpp>

#include <Kokkos_Clamp.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/geometry/ArborX_Tetrahedron.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <ArborX_GeometryTraits.hpp>
#include <ArborX_Point.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>

#include <Kokkos_Array.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ArborX_Box.hpp>
#include <ArborX_GeometryTraits.hpp>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ArborX_GeometryTraits.hpp>
#include <misc/ArborX_Vector.hpp>

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ArborX_GeometryTraits.hpp>

#include <Kokkos_Array.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ArborX_GeometryTraits.hpp>
#include <misc/ArborX_Vector.hpp>

#include <Kokkos_Core.hpp>

Expand Down Expand Up @@ -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 <typename Point, typename Box,
std::enable_if_t<GeometryTraits::is_point_v<Point> &&
GeometryTraits::is_box_v<Box>> * = nullptr>
KOKKOS_FUNCTION void translateAndScale(Point const &in, Point &out,
Box const &ref)
{
static_assert(GeometryTraits::dimension_v<Point> ==
GeometryTraits::dimension_v<Box>);
constexpr int DIM = GeometryTraits::dimension_v<Point>;
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
41 changes: 41 additions & 0 deletions src/geometry/algorithms/ArborX_TranslateAndScale.hpp
Original file line number Diff line number Diff line change
@@ -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 <ArborX_GeometryTraits.hpp>

#include <Kokkos_Macros.hpp>

namespace ArborX::Details
{
// transformation that maps the unit cube into a new axis-aligned box
// NOTE safe to perform in-place
template <typename Point, typename Box,
std::enable_if_t<GeometryTraits::is_point_v<Point> &&
GeometryTraits::is_box_v<Box>> * = nullptr>
KOKKOS_FUNCTION void translateAndScale(Point const &in, Point &out,
Box const &ref)
{
static_assert(GeometryTraits::dimension_v<Point> ==
GeometryTraits::dimension_v<Box>);
constexpr int DIM = GeometryTraits::dimension_v<Point>;
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
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define ARBORX_INTERP_COMPACT_RADIAL_BASIS_FUNCTION_HPP

#include <ArborX_GeometryTraits.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Distance.hpp>

#include <Kokkos_Core.hpp>

Expand Down
1 change: 0 additions & 1 deletion src/spatial/detail/ArborX_BatchedQueries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define ARBORX_BATCHED_QUERIES_HPP

#include <ArborX_Box.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp> // returnCentroid, translateAndScale
#include <detail/ArborX_SpaceFillingCurves.hpp>
#include <misc/ArborX_SortUtils.hpp> // sortObjects

Expand Down
3 changes: 2 additions & 1 deletion src/spatial/detail/ArborX_BruteForceImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
#ifndef ARBORX_BRUTE_FORCE_IMPL_HPP
#define ARBORX_BRUTE_FORCE_IMPL_HPP

#include <detail/ArborX_GeometryAlgorithms.hpp> // expand
#include <algorithms/ArborX_Reducer.hpp>
#include <detail/ArborX_NearestBufferProvider.hpp>
#include <detail/ArborX_Predicates.hpp>
#include <kokkos_ext/ArborX_KokkosExtArithmeticTraits.hpp>
#include <kokkos_ext/ArborX_KokkosExtStdAlgorithms.hpp>
#include <kokkos_ext/ArborX_KokkosExtViewHelpers.hpp>
#include <misc/ArborX_Exception.hpp>
Expand Down
1 change: 1 addition & 0 deletions src/spatial/detail/ArborX_PredicateHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <ArborX_GeometryTraits.hpp>
#include <ArborX_Sphere.hpp>
#include <algorithms/ArborX_Convert.hpp>
#include <detail/ArborX_AccessTraits.hpp>
#include <detail/ArborX_Predicates.hpp>

Expand Down
7 changes: 6 additions & 1 deletion src/spatial/detail/ArborX_Predicates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
#ifndef ARBORX_PREDICATE_HPP
#define ARBORX_PREDICATE_HPP

#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Distance.hpp>
#include <algorithms/ArborX_Intersects.hpp>

#include <Kokkos_Macros.hpp>

#include <type_traits>

namespace ArborX
{
Expand Down
3 changes: 2 additions & 1 deletion src/spatial/detail/ArborX_SpaceFillingCurves.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

#include <ArborX_Box.hpp>
#include <ArborX_Point.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Centroid.hpp>
#include <algorithms/ArborX_TranslateAndScale.hpp>
#include <detail/ArborX_MortonCode.hpp>

#include <Kokkos_DetectionIdiom.hpp>
Expand Down
5 changes: 3 additions & 2 deletions src/spatial/detail/ArborX_TreeConstruction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#ifndef ARBORX_TREE_CONSTRUCTION_HPP
#define ARBORX_TREE_CONSTRUCTION_HPP

#include <detail/ArborX_GeometryAlgorithms.hpp> // expand
#include <detail/ArborX_Node.hpp> // makeLeafNode
#include <algorithms/ArborX_Expand.hpp>
#include <algorithms/ArborX_Reducer.hpp>
#include <detail/ArborX_Node.hpp> // makeLeafNode
#include <detail/ArborX_SpaceFillingCurves.hpp>
#include <kokkos_ext/ArborX_KokkosExtArithmeticTraits.hpp>
#include <misc/ArborX_Exception.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/spatial/detail/ArborX_TreeTraversal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#ifndef ARBORX_TREE_TRAVERSAL_HPP
#define ARBORX_TREE_TRAVERSAL_HPP

#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <detail/ArborX_HappyTreeFriends.hpp>
#include <detail/ArborX_NearestBufferProvider.hpp>
#include <detail/ArborX_Node.hpp> // ROPE_SENTINEL
Expand Down
1 change: 0 additions & 1 deletion test/ArborXTest_LegacyTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <detail/ArborX_AccessTraits.hpp>
#include <detail/ArborX_Callbacks.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <detail/ArborX_PairValueIndex.hpp>

#include <Kokkos_Macros.hpp>
Expand Down
6 changes: 5 additions & 1 deletion test/tstBoostGeometryAdapters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
#include "ArborX_BoostGeometryAdapters.hpp"
#include <ArborX_Box.hpp>
#include <ArborX_Point.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Centroid.hpp>
#include <algorithms/ArborX_Distance.hpp>
#include <algorithms/ArborX_Equals.hpp>
#include <algorithms/ArborX_Intersects.hpp>
#include <algorithms/ArborX_Valid.hpp>

#include <boost/test/unit_test.hpp>

Expand Down
2 changes: 1 addition & 1 deletion test/tstBoostRangeAdapters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "ArborX_EnableViewComparison.hpp"
#include <ArborX_Box.hpp>
#include <ArborX_Point.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Distance.hpp>

#include <Kokkos_Core.hpp>

Expand Down
8 changes: 7 additions & 1 deletion test/tstDetailsAlgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
#include <ArborX_Sphere.hpp>
#include <ArborX_Tetrahedron.hpp>
#include <ArborX_Triangle.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Centroid.hpp>
#include <algorithms/ArborX_Convert.hpp>
#include <algorithms/ArborX_Distance.hpp>
#include <algorithms/ArborX_Equals.hpp>
#include <algorithms/ArborX_Expand.hpp>
#include <algorithms/ArborX_Intersects.hpp>
#include <algorithms/ArborX_Valid.hpp>
#include <kokkos_ext/ArborX_KokkosExtArithmeticTraits.hpp>

#include <boost/mpl/list.hpp>
Expand Down
4 changes: 3 additions & 1 deletion test/tstDetailsGeometryReducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

#include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES
#include <ArborX_Box.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Equals.hpp>
#include <algorithms/ArborX_Expand.hpp>
#include <algorithms/ArborX_Reducer.hpp>

#include <Kokkos_Core.hpp>

Expand Down
1 change: 0 additions & 1 deletion test/tstDetailsTreeConstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "ArborXTest_LegacyTree.hpp"
#include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES
#include "ArborX_EnableViewComparison.hpp"
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <detail/ArborX_IndexableGetter.hpp>
#include <detail/ArborX_MortonCode.hpp> // expandBits, morton32
#include <detail/ArborX_Node.hpp> // ROPE SENTINEL
Expand Down
1 change: 0 additions & 1 deletion test/tstInterpDetailsCompactRadialBasisFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "ArborX_EnableDeviceTypes.hpp"
#include "ArborX_EnableViewComparison.hpp"
#include <ArborX_Point.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <detail/ArborX_InterpDetailsCompactRadialBasisFunction.hpp>

#include "BoostTest_CUDA_clang_workarounds.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/tstKDOP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <ArborX_Box.hpp>
#include <ArborX_KDOP.hpp>
#include <ArborX_Point.hpp>
#include <detail/ArborX_GeometryAlgorithms.hpp>
#include <algorithms/ArborX_Intersects.hpp>

#include "BoostTest_CUDA_clang_workarounds.hpp"
#include <boost/test/unit_test.hpp>
Expand Down

0 comments on commit 83d86ed

Please sign in to comment.