Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: detray ranges #303

Merged
merged 41 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
46d314e
implement ranges and subrange view
niermann999 Sep 9, 2022
b592421
make subrange const correct and nisc changes
niermann999 Sep 11, 2022
7d42947
Implement iota view
niermann999 Sep 11, 2022
6c061f5
add enumerate view
niermann999 Sep 16, 2022
5eeaaec
enumerage subrange integration test
niermann999 Sep 16, 2022
8140ab2
split type deduction from implementation
niermann999 Sep 16, 2022
dc04eca
implement 'single' view
niermann999 Sep 16, 2022
b7f99f1
Implementa chained iterators
niermann999 Sep 17, 2022
1e3370f
reimplement chain iterator
niermann999 Sep 20, 2022
d398b92
remove iterator traits header
niermann999 Sep 22, 2022
7c563d2
remove old enumerate header
niermann999 Sep 22, 2022
a277d81
make iterator impl nested
niermann999 Sep 22, 2022
8eab018
collaps 'iterable' interface into 'range' trait
niermann999 Sep 22, 2022
957f434
some cleanup
niermann999 Sep 22, 2022
bf08e2d
add 'pick' view
niermann999 Sep 24, 2022
391edb0
cleanup
niermann999 Sep 24, 2022
968747f
implement iterator tags and missing interface
niermann999 Sep 27, 2022
85a4aff
fix pick and enumerate functions
niermann999 Sep 29, 2022
390acdd
Fix chain and usage of darray as range
niermann999 Sep 30, 2022
1ff8905
Expand ranges traits and test them
niermann999 Oct 2, 2022
24db989
add empty view
niermann999 Oct 2, 2022
a332b74
make track generator a view
niermann999 Oct 2, 2022
d9db07f
Implement volume graph iterators as views
niermann999 Oct 2, 2022
2832938
reimplement single view and add cuda test
niermann999 Oct 3, 2022
fa32cd1
use thrust iterator tags on device
niermann999 Oct 3, 2022
b31bcf5
adapt CUDA tests
niermann999 Oct 3, 2022
49b07ab
Rename chain to joind, extend ranges header and various fixes
niermann999 Oct 3, 2022
4357f98
correctly implement view interface and cleanup traits
niermann999 Oct 4, 2022
cd24be9
cleanup
niermann999 Oct 4, 2022
502cffe
small fixes
niermann999 Oct 4, 2022
ec2f521
format
niermann999 Oct 4, 2022
ba81b2a
remove constexpr in track generator
niermann999 Oct 4, 2022
467af7e
remove thrust iterator tags for now
niermann999 Oct 4, 2022
cbc7454
fix CUDA test
niermann999 Oct 4, 2022
c0638a2
Reimplement some std iterator functions
niermann999 Oct 4, 2022
fffcc5d
format
niermann999 Oct 4, 2022
d81bc85
Switch grid bin content to ranges
niermann999 Oct 12, 2022
ceaf277
format
niermann999 Oct 12, 2022
ae46e65
adapt CUDA test
niermann999 Oct 12, 2022
3bc0bdd
add missing header
niermann999 Oct 12, 2022
9e92cab
use limits instead of climits
niermann999 Oct 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,15 @@ detray_add_library( detray_core core
"include/detray/tracks/tracks.hpp"
# utils include(s)
"include/detray/utils/column_wise_operator.hpp"
"include/detray/utils/enumerate.hpp"
"include/detray/utils/ranges/detail/iterator_functions.hpp"
"include/detray/utils/ranges/empty.hpp"
"include/detray/utils/ranges/enumerate.hpp"
"include/detray/utils/ranges/iota.hpp"
"include/detray/utils/ranges/join.hpp"
"include/detray/utils/ranges/pick.hpp"
"include/detray/utils/ranges/ranges.hpp"
"include/detray/utils/ranges/single.hpp"
"include/detray/utils/ranges/subrange.hpp"
"include/detray/utils/invalid_values.hpp"
"include/detray/utils/quadratic_equation.hpp"
"include/detray/utils/ratio.hpp"
Expand Down
1 change: 1 addition & 0 deletions core/include/detray/core/detail/tuple_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

// Project include(s)
#include "detray/definitions/detail/accessor.hpp"
#include "detray/definitions/indexing.hpp"
#include "detray/definitions/qualifiers.hpp"

namespace detray {
Expand Down
3 changes: 2 additions & 1 deletion core/include/detray/core/detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "detray/geometry/surface.hpp"
#include "detray/geometry/volume.hpp"
#include "detray/tools/bin_association.hpp"
#include "detray/utils/ranges.hpp"

// Vecmem include(s)
#include <vecmem/memory/memory_resource.hpp>
Expand Down Expand Up @@ -479,7 +480,7 @@ class detector {
<< " volumes." << std::endl;
ss << " local surface finders." << std::endl;

for (const auto &[i, v] : enumerate(_volumes)) {
for (const auto [i, v] : detray::views::enumerate(_volumes)) {
ss << "[>>] Volume at index " << i << ": " << std::endl;
ss << " - name: '" << v.name(names) << "'" << std::endl;

Expand Down
6 changes: 3 additions & 3 deletions core/include/detray/core/transform_store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "detray/definitions/indexing.hpp"
#include "detray/definitions/qualifiers.hpp"
#include "detray/utils/enumerate.hpp"
#include "detray/utils/ranges.hpp"

namespace detray {

Expand Down Expand Up @@ -71,7 +71,7 @@ class static_transform_store {
DETRAY_HOST_DEVICE
inline auto range(const size_t begin, const size_t end,
const context & /*ctx*/) const {
return iterator_range(_data, dindex_range{begin, end});
return detray::ranges::subrange(_data, dindex_range{begin, end});
}

/** Access to a predefined range of elements
Expand Down Expand Up @@ -229,4 +229,4 @@ inline static_transform_store_data<static_transform_store<vector_t> > get_data(
return static_transform_store_data(store);
}

} // namespace detray
} // namespace detray
3 changes: 1 addition & 2 deletions core/include/detray/definitions/detail/accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@

#include <algorithm>
#include <array>
#include <climits>
#include <limits>
#include <tuple>
#include <type_traits>
#include <utility>

#include "detray/definitions/indexing.hpp"
#include "detray/definitions/qualifiers.hpp"

namespace detray {
Expand Down
14 changes: 14 additions & 0 deletions core/include/detray/definitions/units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,21 @@ constexpr double m = 1000.0;
constexpr double mm3 = mm * mm * mm;
constexpr double cm3 = cm * cm * cm;

// Time, native unit mm = [speed-of-light * time] = mm/s * s
constexpr double s = 299792458000.0;
constexpr double fs = 1e-15 * s;
constexpr double ps = 1e-12 * s;
constexpr double ns = 1e-9 * s;
constexpr double us = 1e-6 * s;
constexpr double ms = 1e-3 * s;
constexpr double min = 60.0 * s;
constexpr double h = 3600.0 * s;

// Energy, native unit GeV
constexpr double keV = 0.000001;
constexpr double MeV = 0.001;
constexpr double GeV = 1.0;
constexpr double TeV = 1e3;

// Atomic mass unit u
// 1u == 0.93149410242 GeV/c
Expand All @@ -43,6 +54,9 @@ constexpr double mol = 1.0;
// Avogadro constant
constexpr double kAvogadro = 6.02214076e23 / unit_constants::mol;

// Charge, native unit e (elementary charge)
constexpr double e = 1.0;

// Magnetic field, native unit GeV/(e*mm)
constexpr double T = 0.000299792458; // equivalent to c in appropriate SI units

Expand Down
Loading