Skip to content

Commit 033b4fc

Browse files
authored
Merge pull request #883 from niermann999/feat-refactored-algebra
ref: streamline algebra-plugins interface
2 parents 17d9b55 + 8864767 commit 033b4fc

File tree

110 files changed

+853
-1283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+853
-1283
lines changed

.github/workflows/builds.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
run: |
113113
cd build
114114
source ${GITHUB_WORKSPACE}/.github/ci_setup.sh ${{ matrix.PLATFORM.NAME }}
115-
ctest -R detray_unit_test_. -E ._eigen --output-on-failure
115+
ctest -R detray_unit_test_. -E "._eigen|._vc_aos" --output-on-failure
116116
117117
# Containerised build jobs.
118118
device-container:

core/CMakeLists.txt

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Detray library, part of the ACTS project (R&D line)
22
#
3-
# (c) 2021-2023 CERN for the benefit of the ACTS project
3+
# (c) 2021-2024 CERN for the benefit of the ACTS project
44
#
55
# Mozilla Public License Version 2.0
66

@@ -11,21 +11,23 @@ message(STATUS "Building 'detray::core' component")
1111
file(
1212
GLOB _detray_core_public_headers
1313
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
14-
"include/detray/coordinates/*.hpp"
14+
"include/detray/builders/*.hpp"
1515
"include/detray/core/*.hpp"
1616
"include/detray/definitions/*.hpp"
17+
"include/detray/geometry/coordinates/*.hpp"
18+
"include/detray/geometry/shapes/*.hpp"
1719
"include/detray/geometry/*.hpp"
1820
"include/detray/grids/*.hpp"
19-
"include/detray/intersection/bounding_box/*.hpp"
20-
"include/detray/intersection/*.hpp"
21-
"include/detray/masks/*.hpp"
2221
"include/detray/materials/*.hpp"
22+
"include/detray/navigation/accelerators/*.hpp"
23+
"include/detray/navigation/intersection/bounding_box/*.hpp"
24+
"include/detray/navigation/intersection/soa/*.hpp"
25+
"include/detray/navigation/intersection/*.hpp"
26+
"include/detray/navigation/*.hpp"
2327
"include/detray/propagator/actors/*.hpp"
2428
"include/detray/propagator/*.hpp"
25-
"include/detray/surface_finders/grid/*.hpp"
26-
"include/detray/surface_finders/*.hpp"
27-
"include/detray/tools/*.hpp"
2829
"include/detray/tracks/*.hpp"
30+
"include/detray/utils/grid/*.hpp"
2931
"include/detray/utils/ranges/*.hpp"
3032
"include/detray/utils/*.hpp"
3133
)

core/include/detray/builders/cylinder_portal_generator.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class cylinder_portal_generator final
361361

362362
for (const auto &sf_desc : surfaces) {
363363
const auto &trf = transforms.at(sf_desc.transform());
364-
mean += getter::perp(trf.translation());
364+
mean += vector::perp(trf.translation());
365365
}
366366

367367
return static_cast<scalar_t>(mean /

core/include/detray/builders/homogeneous_material_generator.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#include "detray/definitions/detail/indexing.hpp"
1313
#include "detray/definitions/detail/qualifiers.hpp"
1414
#include "detray/materials/material.hpp"
15+
#include "detray/materials/material_rod.hpp"
1516
#include "detray/materials/predefined_materials.hpp"
17+
#include "detray/utils/ranges.hpp"
1618

1719
// System include(s)
1820
#include <sstream>

core/include/detray/builders/homogeneous_volume_material_builder.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "detray/builders/volume_builder_interface.hpp"
1313
#include "detray/materials/material.hpp"
1414
#include "detray/materials/predefined_materials.hpp"
15+
#include "detray/utils/ranges.hpp"
1516

1617
// System include(s)
1718
#include <iostream>

core/include/detray/builders/material_map_generator.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
#include "detray/geometry/shapes/cylinder2D.hpp"
1616
#include "detray/geometry/shapes/ring2D.hpp"
1717
#include "detray/materials/material.hpp"
18+
#include "detray/materials/material_rod.hpp"
1819
#include "detray/materials/material_slab.hpp"
1920
#include "detray/materials/predefined_materials.hpp"
21+
#include "detray/utils/grid/detail/axis.hpp"
2022
#include "detray/utils/ranges.hpp"
2123

2224
// System include(s)

core/include/detray/builders/volume_builder.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class volume_builder : public volume_builder_interface<detector_t> {
129129
const typename detector_t::point3_type& t,
130130
const typename detector_t::vector3_type& x,
131131
const typename detector_t::vector3_type& z) override {
132-
m_trf = typename detector_t::transform3_type{t, z, x, true};
132+
m_trf = typename detector_t::transform3_type{t, z, x};
133133
}
134134

135135
/// Add data for (a) new surface(s) to the builder

core/include/detray/definitions/detail/algebra.hpp

+20-75
Original file line numberDiff line numberDiff line change
@@ -21,103 +21,48 @@
2121
#error "No algebra plugin selected! Please link to one of the algebra plugins."
2222
#endif
2323

24-
// Project include(s)
25-
#include "detray/utils/concepts.hpp"
26-
27-
// System include(s)
28-
#include <type_traits>
24+
// Algebra-plugins include(s)
25+
#include "algebra/utils/print.hpp"
2926

3027
namespace detray {
3128

32-
namespace detail {
33-
/// The detray scalar types (can be SIMD)
34-
/// @{
35-
template <typename T>
36-
struct get_scalar {};
37-
38-
// TODO replace by scalar concept from algebra-plugins
39-
template <concepts::arithmetic T>
40-
struct get_scalar<T> {
41-
using scalar = T;
42-
};
43-
44-
template <typename T>
45-
requires(!std::same_as<typename T::scalar, void>) struct get_scalar<T> {
46-
using scalar = typename T::scalar;
47-
};
48-
/// @}
49-
50-
/// The detray algebra types (can be SIMD)
51-
/// @{
52-
template <typename T>
53-
struct get_algebra {};
54-
55-
template <typename T>
56-
requires(!std::same_as<typename T::point3D, void>) struct get_algebra<T> {
57-
using point2D = typename T::point2D;
58-
using point3D = typename T::point3D;
59-
using vector3D = typename T::vector3D;
60-
using transform3D = typename T::transform3D;
61-
};
62-
/// @}
63-
64-
/// The detray matrix types
65-
/// @{
66-
template <typename T>
67-
struct get_matrix {};
68-
69-
template <typename T>
70-
requires(
71-
!std::same_as<typename T::matrix_operator, void>) struct get_matrix<T> {
72-
using matrix_operator = typename T::matrix_operator;
73-
using size_type = typename matrix_operator::size_ty;
74-
75-
template <std::size_t ROWS, std::size_t COLS>
76-
using matrix = typename matrix_operator::template matrix_type<
77-
static_cast<size_type>(ROWS), static_cast<size_type>(COLS)>;
78-
};
79-
/// @}
29+
// Pull in the print operator definitions for the algebra types
30+
using algebra::operator<<;
8031

81-
} // namespace detail
32+
template <typename A>
33+
using dvalue = typename algebra::get_value_t<A>;
8234

83-
template <template <typename> class A, typename T>
84-
using dsimd = typename A<float>::template simd<T>;
35+
template <typename A>
36+
using dbool = typename algebra::get_boolean_t<A>;
8537

86-
template <typename A = detray::scalar>
87-
using dscalar = typename detail::get_scalar<A>::scalar;
38+
template <typename A, typename T>
39+
using dsimd = algebra::get_simd_t<A, T>;
8840

8941
template <typename A>
90-
using dpoint2D = typename detail::get_algebra<A>::point2D;
42+
using dsize_type = algebra::get_size_t<A>;
9143

9244
template <typename A>
93-
using dpoint3D = typename detail::get_algebra<A>::point3D;
45+
using dscalar = algebra::get_scalar_t<A>;
9446

9547
template <typename A>
96-
using dvector3D = typename detail::get_algebra<A>::vector3D;
48+
using dpoint2D = algebra::get_point2D_t<A>;
9749

9850
template <typename A>
99-
using dtransform3D = typename detail::get_algebra<A>::transform3D;
51+
using dpoint3D = algebra::get_point3D_t<A>;
10052

10153
template <typename A>
102-
using dmatrix_operator = typename detail::get_matrix<A>::matrix_operator;
54+
using dvector3D = algebra::get_vector3D_t<A>;
10355

10456
template <typename A>
105-
using dsize_type = typename detail::get_matrix<A>::size_type;
57+
using dtransform3D = algebra::get_transform3D_t<A>;
10658

10759
template <typename A, std::size_t R, std::size_t C>
108-
using dmatrix = typename detail::get_matrix<A>::template matrix<R, C>;
60+
using dmatrix = algebra::get_matrix_t<A, R, C>;
10961

110-
namespace concepts {
62+
namespace detail {
11163

112-
/// Check if an algebra has soa layout
113-
/// @{
114-
template <typename A>
115-
concept soa_algebra = (!concepts::arithmetic<dscalar<A>>);
64+
using namespace ::algebra::boolean;
11665

117-
template <typename A>
118-
concept aos_algebra = (!concepts::soa_algebra<A>);
119-
/// @}
120-
121-
} // namespace concepts
66+
} // namespace detail
12267

12368
} // namespace detray

core/include/detray/definitions/detail/boolean.hpp

-76
This file was deleted.

0 commit comments

Comments
 (0)