Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ file(
"include/detray/geometry/coordinates/*.hpp"
"include/detray/geometry/shapes/*.hpp"
"include/detray/geometry/*.hpp"
"include/detray/materials/*.hpp"
"include/detray/material/*.hpp"
"include/detray/navigation/accelerators/*.hpp"
"include/detray/navigation/intersection/bounding_box/*.hpp"
"include/detray/navigation/intersection/soa/*.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/include/detray/builders/detail/volume_connector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Project include(s)
#include "detray/definitions/containers.hpp"
#include "detray/definitions/indexing.hpp"
#include "detray/materials/predefined_materials.hpp"
#include "detray/material/predefined_materials.hpp"

// Vecmem include(s)
#include <vecmem/memory/host_memory_resource.hpp>
Expand Down
2 changes: 1 addition & 1 deletion core/include/detray/builders/grid_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class grid_builder : public volume_decorator<detector_t> {
const auto &new_sf_desc = det.surface(glob_idx);

assert(new_sf_desc.index() == glob_idx);
assert(!new_sf_desc.barcode().is_invalid());
assert(!new_sf_desc.identifier().is_invalid());

sf_desc = new_sf_desc;
}
Expand Down
6 changes: 3 additions & 3 deletions core/include/detray/builders/homogeneous_material_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "detray/definitions/algebra.hpp"
#include "detray/definitions/indexing.hpp"
#include "detray/geometry/shapes/unmasked.hpp"
#include "detray/materials/material.hpp"
#include "detray/material/material.hpp"
#include "detray/utils/logging.hpp"
#include "detray/utils/ranges.hpp"

Expand Down Expand Up @@ -44,7 +44,7 @@ class material_data {
/// Construct from a predefined material
///
/// @param mat predefined material, see
/// 'detray/materials/predefined_materials.hpp'
/// 'detray/material/predefined_materials.hpp'
/// @param thickness of the material slab/rod
/// @param sf_idx the index of the surface this material belongs to, needs
/// to be passed only if a special oredering must be observed
Expand Down Expand Up @@ -90,7 +90,7 @@ class material_data {
///
/// @param thickness of the material slab/rod
/// @param mat predefined material, see
/// 'detray/materials/predefined_materials.hpp'
/// 'detray/material/predefined_materials.hpp'
DETRAY_HOST
void append(const scalar_t thickness, const material<scalar_t> &mat) {
m_mat.push_back(mat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include "detray/definitions/algebra.hpp"
#include "detray/definitions/detail/qualifiers.hpp"
#include "detray/definitions/indexing.hpp"
#include "detray/materials/material.hpp"
#include "detray/materials/material_rod.hpp"
#include "detray/materials/predefined_materials.hpp"
#include "detray/material/material.hpp"
#include "detray/material/material_rod.hpp"
#include "detray/material/predefined_materials.hpp"
#include "detray/utils/logging.hpp"
#include "detray/utils/ranges.hpp"
#include "detray/utils/type_registry.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// Project include(s).
#include "detray/builders/volume_builder.hpp"
#include "detray/builders/volume_builder_interface.hpp"
#include "detray/materials/material.hpp"
#include "detray/materials/predefined_materials.hpp"
#include "detray/material/material.hpp"
#include "detray/material/predefined_materials.hpp"
#include "detray/utils/ranges.hpp"

// System include(s)
Expand Down
2 changes: 1 addition & 1 deletion core/include/detray/builders/material_map_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "detray/builders/volume_builder_interface.hpp"
#include "detray/geometry/concepts.hpp"
#include "detray/geometry/surface.hpp"
#include "detray/materials/material_map.hpp"
#include "detray/material/material_map.hpp"

// System include(s)
#include <cassert>
Expand Down
2 changes: 1 addition & 1 deletion core/include/detray/builders/material_map_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "detray/builders/surface_factory.hpp"
#include "detray/definitions/indexing.hpp"
#include "detray/geometry/shapes/unmasked.hpp"
#include "detray/materials/material.hpp"
#include "detray/material/material.hpp"
#include "detray/utils/logging.hpp"
#include "detray/utils/ranges.hpp"

Expand Down
8 changes: 4 additions & 4 deletions core/include/detray/builders/material_map_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include "detray/geometry/detail/surface_kernels.hpp"
#include "detray/geometry/shapes/cylinder2D.hpp"
#include "detray/geometry/shapes/ring2D.hpp"
#include "detray/materials/material.hpp"
#include "detray/materials/material_rod.hpp"
#include "detray/materials/material_slab.hpp"
#include "detray/materials/predefined_materials.hpp"
#include "detray/material/material.hpp"
#include "detray/material/material_rod.hpp"
#include "detray/material/material_slab.hpp"
#include "detray/material/predefined_materials.hpp"
#include "detray/utils/grid/detail/axis.hpp"
#include "detray/utils/logging.hpp"
#include "detray/utils/ranges.hpp"
Expand Down
4 changes: 2 additions & 2 deletions core/include/detray/builders/surface_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "detray/definitions/indexing.hpp"
#include "detray/geometry/mask.hpp"
#include "detray/geometry/shapes/unmasked.hpp"
#include "detray/materials/material_rod.hpp"
#include "detray/materials/material_slab.hpp"
#include "detray/material/material_rod.hpp"
#include "detray/material/material_slab.hpp"
#include "detray/utils/logging.hpp"
#include "detray/utils/ranges.hpp"
#include "detray/utils/type_registry.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/include/detray/builders/volume_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class volume_builder : public volume_builder_interface<detector_t> {

/// Find the surface range specifed by @param sf_id
auto find_range = [&](auto sf_id) {
// Compare given id to surface barcode
// Compare given id to surface identifier
auto is_sf_type = [sf_id](const auto& sf) {
return sf.id() == sf_id;
};
Expand Down
10 changes: 5 additions & 5 deletions core/include/detray/core/detail/surface_lookup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "detray/core/detail/container_views.hpp"
#include "detray/definitions/detail/qualifiers.hpp"
#include "detray/definitions/indexing.hpp"
#include "detray/geometry/barcode.hpp"
#include "detray/geometry/identifier.hpp"
#include "detray/utils/logging.hpp"

// Vecmem include(s)
Expand Down Expand Up @@ -190,11 +190,11 @@ class surface_lookup {
return m_container[sf_index];
}

/// @returns the surface descriptor according to the surface barcode
/// @param bcd
/// @returns the surface descriptor according to the surface identifier
/// @param geo_id
DETRAY_HOST_DEVICE
constexpr decltype(auto) search(geometry::barcode bcd) const {
return search(bcd.index());
constexpr decltype(auto) search(geometry::identifier geo_id) const {
return search(geo_id.index());
}

/// @returns the surface descriptor according to the searcher passed as
Expand Down
6 changes: 3 additions & 3 deletions core/include/detray/core/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#pragma once

// Project include(s)
#include "detray/materials/concepts.hpp"
#include "detray/materials/material_rod.hpp"
#include "detray/materials/material_slab.hpp"
#include "detray/material/concepts.hpp"
#include "detray/material/material_rod.hpp"
#include "detray/material/material_slab.hpp"
#include "detray/navigation/accelerators/concepts.hpp"
#include "detray/utils/grid/detail/concepts.hpp"
#include "detray/utils/type_registry.hpp"
Expand Down
4 changes: 2 additions & 2 deletions core/include/detray/core/detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class detector {
}

/// @returns a surface using a query objetc @param q. This can be an index,
/// a barcode or a source link searcher (see @c surface_lookup class)
/// a identifier or a source link searcher (see @c surface_lookup class)
template <typename query_t>
DETRAY_HOST_DEVICE constexpr decltype(auto) surface(query_t &&q) const {
return _surfaces.search(std::forward<query_t>(q));
Expand Down Expand Up @@ -337,7 +337,7 @@ class detector {
/// Contains the detector sub-volumes.
volume_container _volumes;

/// Lookup for surfaces from barcodes
/// Lookup for surfaces from identifiers
surface_lookup_container _surfaces;

/// Keeps all of the transform data in contiguous memory
Expand Down
6 changes: 3 additions & 3 deletions core/include/detray/geometry/detail/surface_kernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "detray/definitions/algebra.hpp"
#include "detray/definitions/detail/qualifiers.hpp"
#include "detray/definitions/indexing.hpp"
#include "detray/materials/concepts.hpp"
#include "detray/materials/detail/material_accessor.hpp"
#include "detray/materials/material.hpp"
#include "detray/material/concepts.hpp"
#include "detray/material/detail/material_accessor.hpp"
#include "detray/material/material.hpp"
#include "detray/utils/concepts.hpp"
#include "detray/utils/ranges.hpp"

Expand Down
6 changes: 3 additions & 3 deletions core/include/detray/geometry/detail/volume_kernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "detray/definitions/algebra.hpp"
#include "detray/definitions/detail/qualifiers.hpp"
#include "detray/definitions/indexing.hpp"
#include "detray/materials/concepts.hpp"
#include "detray/materials/detail/material_accessor.hpp"
#include "detray/materials/material.hpp"
#include "detray/material/concepts.hpp"
#include "detray/material/detail/material_accessor.hpp"
#include "detray/material/material.hpp"
#include "detray/navigation/accelerators/search_window.hpp"
#include "detray/navigation/concepts.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,23 @@
/// etc), an index to identify a surface in a geometry accelerator structure,
/// as well as two extra bytes that can be used to tag surfaces arbitrarily.
///
/// @note the detray barcode is not compatible with the ACTS GeometryIdentifier!
/// @note the detray identifier is not compatible with the ACTS
/// GeometryIdentifier!
///
/// @see
/// https://github.com/acts-project/acts/blob/main/Core/include/Acts/Geometry/GeometryIdentifier.hpp
class barcode {
class identifier {

public:
using value_t = std::uint_least64_t;
using encoder = detail::bit_encoder<value_t>;

/// Construct from an already encoded value.
DETRAY_HOST_DEVICE
constexpr explicit barcode(value_t encoded) : m_value(encoded) {}
constexpr explicit identifier(value_t encoded) : m_value(encoded) {}

/// Construct default barcode with all values set to 1.
constexpr barcode() = default;
/// Construct default identifier with all values set to 1.
constexpr identifier() = default;

/// @returns the encoded value.
DETRAY_HOST_DEVICE
Expand Down Expand Up @@ -86,42 +87,42 @@

/// Set the volume index.
DETRAY_HOST_DEVICE
constexpr barcode& set_volume(value_t volume) {
constexpr identifier& set_volume(value_t volume) {
encoder::template set_bits<k_volume_mask>(m_value, volume);
return *this;
}

/// Set the surface id.
DETRAY_HOST_DEVICE
constexpr barcode& set_id(surface_id id) {
constexpr identifier& set_id(surface_id id) {
encoder::template set_bits<k_id_mask>(
m_value, static_cast<value_t>(
static_cast<std::underlying_type_t<surface_id>>(id)));

Check warning on line 100 in core/include/detray/geometry/identifier.hpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer "std::to_underlying" to "std::underlying_type_t" to cast enums to their underlying type.

See more on https://sonarcloud.io/project/issues?id=acts-project_detray&issues=AZ0_DjeqG4UEpUEQW6UV&open=AZ0_DjeqG4UEpUEQW6UV&pullRequest=1131
return *this;
}

/// Set the surface index.
DETRAY_HOST_DEVICE
constexpr barcode& set_index(value_t index) {
constexpr identifier& set_index(value_t index) {
encoder::template set_bits<k_index_mask>(m_value, index);
return *this;
}

/// Set the transform index.
DETRAY_HOST_DEVICE
constexpr barcode& set_transform(value_t index) {
constexpr identifier& set_transform(value_t index) {
encoder::template set_bits<k_transform_mask>(m_value, index);
return *this;
}

/// Set the extra identifier.
DETRAY_HOST_DEVICE
constexpr barcode& set_extra(value_t extra) {
constexpr identifier& set_extra(value_t extra) {
encoder::template set_bits<k_extra_mask>(m_value, extra);
return *this;
}

/// Check whether the barcode is valid to use.
/// Check whether the identifier is valid to use.
/// @note The extra bits are allowed to be invalid and will not be checked
DETRAY_HOST_DEVICE
constexpr bool is_invalid() const noexcept {
Expand All @@ -130,12 +131,12 @@
m_value);
}

bool operator==(const barcode& rhs) const = default;
bool operator==(const identifier& rhs) const = default;

/// Comparison operators
DETRAY_HOST_DEVICE
friend constexpr auto operator<=>(const barcode lhs,
const barcode rhs) noexcept {
friend constexpr auto operator<=>(const identifier lhs,
const identifier rhs) noexcept {
const auto l{lhs.index()};
const auto r{rhs.index()};
if (l < r || (l == r && l < r)) {
Expand Down Expand Up @@ -164,15 +165,15 @@
/// The encoded value. Default: All bits set to 1 (invalid)
value_t m_value{~static_cast<value_t>(0)};

/// Print the surface barcode
/// Print the surface identifier
DETRAY_HOST
friend std::ostream& operator<<(std::ostream& os, const barcode c) {
friend std::ostream& operator<<(std::ostream& os, const identifier c) {
if (c.is_invalid()) {
os << "INVALID: ";
}

os << "vol = " << c.volume();
os << " | id = " << c.id() << "(" << static_cast<int>(c.id()) << ")";

Check warning on line 176 in core/include/detray/geometry/identifier.hpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use an intermediary "std::to_underlying" to cast an enum to an integral type that is not the underlying type.

See more on https://sonarcloud.io/project/issues?id=acts-project_detray&issues=AZ0_DjeqG4UEpUEQW6UW&open=AZ0_DjeqG4UEpUEQW6UW&pullRequest=1131
os << " | index = " << c.index();
os << " | trf = " << c.transform();
os << " | extra = " << c.extra();
Expand All @@ -185,11 +186,11 @@

namespace std {

// specialize std::hash so barcode can be used e.g. in an unordered_map
// specialize std::hash so identifier can be used e.g. in an unordered_map
template <>
struct hash<detray::geometry::barcode> {
auto operator()(detray::geometry::barcode gid) const noexcept {
return std::hash<detray::geometry::barcode::value_t>()(gid.value());
struct hash<detray::geometry::identifier> {
auto operator()(detray::geometry::identifier gid) const noexcept {
return std::hash<detray::geometry::identifier::value_t>()(gid.value());
}
};

Expand Down
Loading
Loading