Skip to content
Draft
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/include/detray/builders/cuboid_portal_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class cuboid_portal_generator final
auto surfaces_offset{static_cast<dindex>(n_surfaces)};

// Fetch the position in the mask tuple for the rectangle portals
constexpr auto rectangle_id{detector_t::masks::id::e_portal_rectangle2};
constexpr auto rectangle_id{detector_t::masks::id::e_rectangle2D};

// The material will be added in a later step
constexpr auto no_material = surface_t::material_id::e_none;
Expand Down
16 changes: 8 additions & 8 deletions core/include/detray/builders/cylinder_portal_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ class cylinder_portal_generator final

// Add transform and mask data
transforms.emplace_back(ctx, tsl);
masks.template emplace_back<mask_id::e_portal_cylinder2>(
masks.template emplace_back<mask_id::e_concentric_cylinder2D>(
empty_context{}, vol_link, r, min_z, max_z);

// Add surface links
mask_link_t mask_link{};
const auto mask_idx{static_cast<dindex>(
masks.template size<mask_id::e_portal_cylinder2>() - 1u)};
set_mask_link(mask_link, mask_id::e_portal_cylinder2, mask_idx);
masks.template size<mask_id::e_concentric_cylinder2D>() - 1u)};
set_mask_link(mask_link, mask_id::e_concentric_cylinder2D, mask_idx);

material_link_t material_link{material_id::e_none, dindex_invalid};

Expand Down Expand Up @@ -341,14 +341,14 @@ class cylinder_portal_generator final

// Add transform and mask data
transforms.emplace_back(ctx, tsl);
masks.template emplace_back<mask_id::e_portal_ring2>(
empty_context{}, vol_link, min_r, max_r);
masks.template emplace_back<mask_id::e_ring2D>(empty_context{},
vol_link, min_r, max_r);

// Add surface links
mask_link_t mask_link{};
const auto mask_idx{static_cast<dindex>(
masks.template size<mask_id::e_portal_ring2>() - 1u)};
set_mask_link(mask_link, mask_id::e_portal_ring2, mask_idx);
const auto mask_idx{
static_cast<dindex>(masks.template size<mask_id::e_ring2D>() - 1u)};
set_mask_link(mask_link, mask_id::e_ring2D, mask_idx);

material_link_t material_link{material_id::e_none, dindex_invalid};

Expand Down
8 changes: 5 additions & 3 deletions core/include/detray/builders/detail/volume_connector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ void connect_cylindrical_volumes(
0., 0., volume_bounds[bound_index]};

// Get the mask context group and fill it
constexpr auto disc_id = detector_t::masks::id::e_portal_ring2;
constexpr auto slab_id = detector_t::materials::id::e_slab;
constexpr auto disc_id = detector_t::masks::id::e_ring2D;
constexpr auto slab_id =
detector_t::materials::id::e_material_slab;
typename portal_t::mask_link mask_index = {
disc_id, portal_masks.template size<disc_id>()};
typename portal_t::material_link material_index = {
Expand Down Expand Up @@ -298,7 +299,8 @@ void connect_cylindrical_volumes(
detector_t::masks::id::e_portal_cylinder3;
typename portal_t::mask_link mask_index = {
cylinder_id, portal_masks.template size<cylinder_id>()};
constexpr auto slab_id = detector_t::materials::id::e_slab;
constexpr auto slab_id =
detector_t::materials::id::e_material_slab;

for (auto &info_ : portals_info) {
// Add new mask to container
Expand Down
26 changes: 15 additions & 11 deletions core/include/detray/builders/homogeneous_material_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,34 +97,38 @@ class homogeneous_material_builder final : public volume_decorator<detector_t> {
for (auto &sf : this->surfaces()) {
DETRAY_DEBUG_HOST("-> sf=" << sf);
DETRAY_DEBUG_HOST(" -> material_id=" << sf.material().id());
if (sf.material().id() == material_id::e_slab) {
dindex offset = material.template size<material_id::e_slab>();
if (sf.material().id() == material_id::e_material_slab) {
dindex offset =
material.template size<material_id::e_material_slab>();
DETRAY_DEBUG_HOST("-> update material slab offset: " << offset);
sf.update_material(offset);
DETRAY_DEBUG_HOST("-> material now: " << sf.material());
}
if constexpr (types::contains<typename detector_t::materials,
material_rod<scalar_type>>) {
if (sf.material().id() == material_id::e_rod) {
if (sf.material().id() == material_id::e_material_rod) {
DETRAY_DEBUG_HOST(
"-> update material rod offset: "
<< material.template size<material_id::e_rod>());
<< material
.template size<material_id::e_material_rod>());
sf.update_material(
material.template size<material_id::e_rod>());
material.template size<material_id::e_material_rod>());
}
}
}

// Add material to the detector
DETRAY_DEBUG_HOST("-> Appending "
<< m_materials.template size<material_id::e_slab>()
<< " slabs into detector materials");
DETRAY_DEBUG_HOST(
"-> Appending "
<< m_materials.template size<material_id::e_material_slab>()
<< " slabs into detector materials");

if constexpr (types::contains<typename detector_t::materials,
material_rod<scalar_type>>) {
DETRAY_DEBUG_HOST("-> Appending "
<< m_materials.template size<material_id::e_rod>()
<< " rods into detector materials");
DETRAY_DEBUG_HOST(
"-> Appending "
<< m_materials.template size<material_id::e_material_rod>()
<< " rods into detector materials");
}
det._materials.append(std::move(m_materials));
m_materials.clear_all();
Expand Down
9 changes: 5 additions & 4 deletions core/include/detray/builders/homogeneous_material_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,19 @@ class homogeneous_material_factory final
DETRAY_DEBUG_HOST(" mat=" << mat << " thickness=" << t);

dindex mat_idx{0u};
if (m_links.at(sf_idx).first == material_id::e_slab) {
auto &mat_coll = materials.template get<material_id::e_slab>();
if (m_links.at(sf_idx).first == material_id::e_material_slab) {
auto &mat_coll =
materials.template get<material_id::e_material_slab>();

material_slab<scalar_type> mat_slab{mat, t};
mat_idx = this->insert_in_container(mat_coll, mat_slab,
m_links.at(sf_idx).second);
}
if constexpr (types::contains<typename detector_t::materials,
material_rod<scalar_type>>) {
if (m_links.at(sf_idx).first == material_id::e_rod) {
if (m_links.at(sf_idx).first == material_id::e_material_rod) {
auto &mat_coll =
materials.template get<material_id::e_rod>();
materials.template get<material_id::e_material_rod>();

material_rod<scalar_type> mat_rod{mat, t};
mat_idx = this->insert_in_container(mat_coll, mat_rod,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,21 @@ class homogeneous_material_generator final
is_line = true;

auto &mat_coll =
materials.template get<material_id::e_rod>();
materials.template get<material_id::e_material_rod>();
mat_coll.emplace_back(*mat_ptr, m_cfg.thickness());

mat_link = {material_id::e_rod,
mat_link = {material_id::e_material_rod,
static_cast<dindex>(mat_coll.size() - 1u)};
}
}

// For all surfaces that are not lines, generate a material slab
if (!is_line) {
auto &mat_coll = materials.template get<material_id::e_slab>();
auto &mat_coll =
materials.template get<material_id::e_material_slab>();
mat_coll.emplace_back(*mat_ptr, m_cfg.thickness());

mat_link = {material_id::e_slab,
mat_link = {material_id::e_material_slab,
static_cast<dindex>(mat_coll.size() - 1u)};
}

Expand Down
4 changes: 2 additions & 2 deletions core/include/detray/builders/volume_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class volume_builder : public volume_builder_interface<detector_t> {
// force method that will at least contain the portals
m_volume.template set_accel_link<
static_cast<typename volume_type::object_id>(0)>(
detector_t::accel::id::e_default, 0);
detector_t::accel::id::e_surface_default, 0);

DETRAY_VERBOSE_HOST("Created builder for volume: " << idx);
};
Expand Down Expand Up @@ -253,7 +253,7 @@ class volume_builder : public volume_builder_interface<detector_t> {
}

// Place the appropriate surfaces in the brute force search method.
constexpr auto default_acc_id{detector_t::accel::id::e_default};
constexpr auto default_acc_id{detector_t::accel::id::e_surface_default};

// Strip the source link from the lookup data structure
typename detector_t::surface_container descriptors;
Expand Down
5 changes: 3 additions & 2 deletions core/include/detray/core/detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class detector {
// TODO: Add volume accelerator builder
volume_type v_desc{};
v_desc.template set_accel_link<geo_obj_ids::e_volume>(
accel::id::e_default_volume_searcher, 0u);
accel::id::e_volume_default, 0u);
tracking_volume world{*this, v_desc};

dindex volume_index{0u};
Expand All @@ -248,7 +248,8 @@ class detector {
DETRAY_HOST_DEVICE
inline const auto &portals() const {
// All portals are registered with the brute force search
return _accelerators.template get<accel::id::e_brute_force>().all();
return _accelerators.template get<accel::id::e_surface_brute_force>()
.all();
}

/// @returns the sub-volumes of the detector - const access
Expand Down
4 changes: 2 additions & 2 deletions core/include/detray/utils/detector_statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ DETRAY_HOST_DEVICE inline std::size_t n_material_maps(const detector_t& det) {
template <typename detector_t>
DETRAY_HOST_DEVICE inline std::size_t n_material_slabs(const detector_t& det) {
if constexpr (detray::concepts::has_material_slabs<detector_t>) {
constexpr auto slab_id{detector_t::materials::id::e_slab};
constexpr auto slab_id{detector_t::materials::id::e_material_slab};
return det.material_store().template size<slab_id>();
} else {
return 0u;
Expand All @@ -100,7 +100,7 @@ DETRAY_HOST_DEVICE inline std::size_t n_material_slabs(const detector_t& det) {
template <typename detector_t>
DETRAY_HOST_DEVICE inline std::size_t n_material_rods(const detector_t& det) {
if constexpr (detray::concepts::has_material_rods<detector_t>) {
constexpr auto rod_id{detector_t::materials::id::e_rod};
constexpr auto rod_id{detector_t::materials::id::e_material_rod};
return det.material_store().template size<rod_id>();
} else {
return 0u;
Expand Down
Loading
Loading