Skip to content

Commit

Permalink
Switch to using the new toy detector implementation everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
niermann999 committed Mar 20, 2024
1 parent bda3817 commit 9f5e357
Show file tree
Hide file tree
Showing 55 changed files with 720 additions and 1,988 deletions.
4 changes: 1 addition & 3 deletions core/include/detray/builders/cuboid_portal_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ class cuboid_portal_generator final

// The material will be added in a later step
constexpr auto no_material = surface_t::material_id::e_none;
material_link_t material_link{
no_material,
detail::invalid_value<typename material_link_t::index_type>()};
material_link_t material_link{no_material, 0u};

// Max distance in case of infinite bounds
constexpr scalar max_shift{0.01f * std::numeric_limits<scalar>::max()};
Expand Down
8 changes: 2 additions & 6 deletions core/include/detray/builders/cylinder_portal_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ class cylinder_portal_generator final
mask_link_t mask_link{
mask_id::e_portal_cylinder2,
masks.template size<mask_id::e_portal_cylinder2>() - 1u};
material_link_t material_link{
material_id::e_none,
detail::invalid_value<typename material_link_t::index_type>()};
material_link_t material_link{material_id::e_none, 0u};

surfaces.push_back(
{static_cast<dindex>(transforms.size(ctx) - 1u), mask_link,
Expand Down Expand Up @@ -321,9 +319,7 @@ class cylinder_portal_generator final
mask_link_t mask_link{
mask_id::e_portal_ring2,
masks.template size<mask_id::e_portal_ring2>() - 1u};
material_link_t material_link{
material_id::e_none,
detail::invalid_value<typename material_link_t::index_type>()};
material_link_t material_link{material_id::e_none, 0u};

surfaces.push_back(
{static_cast<dindex>(transforms.size(ctx) - 1u), mask_link,
Expand Down
4 changes: 1 addition & 3 deletions core/include/detray/builders/surface_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ class surface_factory : public surface_factory_interface<detector_t> {
mask_link_t mask_link{mask_id,
masks.template size<mask_id>() - 1u};
// If material is present, it is added in a later step
material_link_t material_link{
no_material, detail::invalid_value<
typename material_link_t::index_type>()};
material_link_t material_link{no_material, 0u};

// Add the surface descriptor at the position given by 'sf_idx'
this->insert_in_container(
Expand Down
6 changes: 1 addition & 5 deletions core/include/detray/builders/volume_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ struct mask_index_update;
template <typename detector_t>
class volume_builder : public volume_builder_interface<detector_t> {

using material_link_t = typename detector_t::surface_type::material_link;

public:
using scalar_type = typename detector_t::scalar_type;
using volume_type = typename detector_t::volume_type;
Expand All @@ -45,9 +43,7 @@ class volume_builder : public volume_builder_interface<detector_t> {
: m_has_accel{false}, m_volume{id} {

m_volume.set_index(idx);
m_volume.set_material(
volume_type::material_id::e_none,
detail::invalid_value<typename material_link_t::index_type>());
m_volume.set_material(volume_type::material_id::e_none, 0u);

// The first acceleration data structure in every volume is a brute
// force method that will at least contain the portals
Expand Down
6 changes: 3 additions & 3 deletions tests/benchmarks/cpu/find_volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

// Project include(s).
#include "detray/detectors/create_toy_geometry.hpp"
#include "detray/detectors/build_toy_detector.hpp"
#include "detray/test/types.hpp"

// VecMem include(s).
Expand All @@ -30,9 +30,9 @@ void BM_FIND_VOLUMES(benchmark::State &state) {

// Detector configuration
vecmem::host_memory_resource host_mr;
toy_det_config toy_cfg{};
toy_det_config<scalar> toy_cfg{};
toy_cfg.n_edc_layers(7u);
auto [d, names] = create_toy_geometry(host_mr, toy_cfg);
auto [d, names] = build_toy_detector(host_mr, toy_cfg);

static const unsigned int itest = 10000u;

Expand Down
6 changes: 3 additions & 3 deletions tests/benchmarks/cpu/intersect_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Project include(s)
#include "detray/core/detector.hpp"
#include "detray/detectors/create_toy_geometry.hpp"
#include "detray/detectors/build_toy_detector.hpp"
#include "detray/geometry/surface.hpp"
#include "detray/navigation/detail/ray.hpp"
#include "detray/navigation/intersection/ray_intersector.hpp"
Expand Down Expand Up @@ -42,9 +42,9 @@ void BM_INTERSECT_ALL(benchmark::State &state) {

// Detector configuration
vecmem::host_memory_resource host_mr;
toy_det_config toy_cfg{};
toy_det_config<scalar> toy_cfg{};
toy_cfg.n_edc_layers(7u);
auto [d, names] = create_toy_geometry(host_mr, toy_cfg);
auto [d, names] = build_toy_detector(host_mr, toy_cfg);

using detector_t = decltype(d);
using sf_desc_t = typename detector_t::surface_type;
Expand Down
8 changes: 4 additions & 4 deletions tests/benchmarks/cuda/benchmark_propagator_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Project include(s)
#include "benchmark_propagator_cuda_kernel.hpp"
#include "detray/detectors/create_toy_geometry.hpp"
#include "detray/detectors/build_toy_detector.hpp"
#include "detray/simulation/event_generator/track_generators.hpp"
#include "detray/test/types.hpp"

Expand All @@ -29,7 +29,7 @@ vecmem::cuda::device_memory_resource dev_mr;
vecmem::binary_page_memory_resource bp_mng_mr(mng_mr);

// detector configuration
toy_det_config toy_cfg{4u, 7u};
auto toy_cfg = toy_det_config<scalar>{}.n_brl_layers(4u).n_edc_layers(7u);

void fill_tracks(vecmem::vector<free_track_parameters<transform3>> &tracks,
const std::size_t theta_steps, const std::size_t phi_steps) {
Expand All @@ -47,7 +47,7 @@ template <propagate_option opt>
static void BM_PROPAGATOR_CPU(benchmark::State &state) {

// Create the toy geometry and bfield
auto [det, names] = create_toy_geometry(host_mr, toy_cfg);
auto [det, names] = build_toy_detector(host_mr, toy_cfg);
test::vector3 B{0.f, 0.f, 2.f * unit<scalar>::T};
auto bfield = bfield::create_const_field(B);

Expand Down Expand Up @@ -102,7 +102,7 @@ template <propagate_option opt>
static void BM_PROPAGATOR_CUDA(benchmark::State &state) {

// Create the toy geometry
auto [det, names] = create_toy_geometry(bp_mng_mr, toy_cfg);
auto [det, names] = build_toy_detector(bp_mng_mr, toy_cfg);
test::vector3 B{0.f, 0.f, 2.f * unit<scalar>::T};
auto bfield = bfield::create_const_field(B);

Expand Down
Loading

0 comments on commit 9f5e357

Please sign in to comment.