Skip to content

Commit 6524bd0

Browse files
author
Vakho Tsulaia
committed
register_checks: removed default values for the configuration and context arguments
This was done to prevent passing around arguments in invalid state. Also temporarily disabled the part of the multicontext_transform_store test until the issue with EXPECT_POINT3_NEAR() in smatrix has been fixed
1 parent 1f8daf1 commit 6524bd0

12 files changed

+87
-64
lines changed

tests/include/detray/test/common/detail/register_checks.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ template <template <typename> class check_t, typename detector_t,
1919
typename config_t = typename check_t<detector_t>::config>
2020
void register_checks(const detector_t &det,
2121
const typename detector_t::name_map &vol_names,
22-
const config_t &cfg = {},
23-
const typename detector_t::geometry_context &gctx = {}) {
22+
const config_t &cfg,
23+
const typename detector_t::geometry_context &gctx) {
2424

2525
const char *test_name = cfg.name().c_str();
2626
if (!test_name) {

tests/integration_tests/cpu/detectors/telescope_detector_navigation.cpp

+11-7
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ int main(int argc, char **argv) {
5151
build_telescope_detector<test_algebra>(host_mr, tel_cfg);
5252

5353
auto white_board = std::make_shared<test::whiteboard>();
54+
tel_detector_t::geometry_context ctx{};
5455

5556
// General data consistency of the detector
5657
test::consistency_check<tel_detector_t>::config cfg_cons{};
5758
detail::register_checks<test::consistency_check>(
58-
tel_det, tel_names, cfg_cons.name("telescope_detector_consistency"));
59+
tel_det, tel_names, cfg_cons.name("telescope_detector_consistency"),
60+
ctx);
5961

6062
// Navigation link consistency, discovered by ray intersection
6163
test::ray_scan<tel_detector_t>::config cfg_ray_scan{};
@@ -67,7 +69,8 @@ int main(int argc, char **argv) {
6769
cfg_ray_scan.track_generator().theta_range(0.f,
6870
0.25f * constant<scalar>::pi_4);
6971

70-
detail::register_checks<test::ray_scan>(tel_det, tel_names, cfg_ray_scan);
72+
detail::register_checks<test::ray_scan>(tel_det, tel_names, cfg_ray_scan,
73+
ctx);
7174

7275
// Comparison of straight line navigation with ray scan
7376
test::straight_line_navigation<tel_detector_t>::config cfg_str_nav{};
@@ -80,7 +83,7 @@ int main(int argc, char **argv) {
8083
static_cast<float>(mask_tolerance[1]);
8184

8285
detail::register_checks<test::straight_line_navigation>(tel_det, tel_names,
83-
cfg_str_nav);
86+
cfg_str_nav, ctx);
8487

8588
// Navigation link consistency, discovered by helix intersection
8689
test::helix_scan<tel_detector_t>::config cfg_hel_scan{};
@@ -95,7 +98,8 @@ int main(int argc, char **argv) {
9598
cfg_hel_scan.track_generator().theta_range(0.f,
9699
0.25f * constant<scalar>::pi_4);
97100

98-
detail::register_checks<test::helix_scan>(tel_det, tel_names, cfg_hel_scan);
101+
detail::register_checks<test::helix_scan>(tel_det, tel_names, cfg_hel_scan,
102+
ctx);
99103

100104
// Comparison of navigation in a constant B-field with helix
101105
test::helix_navigation<tel_detector_t>::config cfg_hel_nav{};
@@ -105,7 +109,7 @@ int main(int argc, char **argv) {
105109
-100.f * unit<float>::um;
106110

107111
detail::register_checks<test::helix_navigation>(tel_det, tel_names,
108-
cfg_hel_nav);
112+
cfg_hel_nav, ctx);
109113

110114
// Run the material validation
111115
test::material_scan<tel_detector_t>::config mat_scan_cfg{};
@@ -117,7 +121,7 @@ int main(int argc, char **argv) {
117121

118122
// Record the material using a ray scan
119123
detail::register_checks<test::material_scan>(tel_det, tel_names,
120-
mat_scan_cfg);
124+
mat_scan_cfg, ctx);
121125

122126
// Now trace the material during navigation and compare
123127
test::material_validation<tel_detector_t>::config mat_val_cfg{};
@@ -126,7 +130,7 @@ int main(int argc, char **argv) {
126130
mat_val_cfg.propagation() = cfg_str_nav.propagation();
127131

128132
detail::register_checks<test::material_validation>(tel_det, tel_names,
129-
mat_val_cfg);
133+
mat_val_cfg, ctx);
130134

131135
// Run the checks
132136
return RUN_ALL_TESTS();

tests/integration_tests/cpu/detectors/toy_detector_navigation.cpp

+13-10
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,21 @@ int main(int argc, char **argv) {
5151
build_toy_detector<test_algebra>(host_mr, toy_cfg);
5252

5353
auto white_board = std::make_shared<test::whiteboard>();
54+
toy_detector_t::geometry_context ctx{};
5455

5556
// General data consistency of the detector
5657
test::consistency_check<toy_detector_t>::config cfg_cons{};
5758
detail::register_checks<test::consistency_check>(
58-
toy_det, toy_names, cfg_cons.name("toy_detector_consistency"));
59+
toy_det, toy_names, cfg_cons.name("toy_detector_consistency"), ctx);
5960

6061
// Navigation link consistency, discovered by ray intersection
6162
test::ray_scan<toy_detector_t>::config cfg_ray_scan{};
6263
cfg_ray_scan.name("toy_detector_ray_scan");
6364
cfg_ray_scan.whiteboard(white_board);
6465
cfg_ray_scan.track_generator().n_tracks(10000u);
6566

66-
detail::register_checks<test::ray_scan>(toy_det, toy_names, cfg_ray_scan);
67+
detail::register_checks<test::ray_scan>(toy_det, toy_names, cfg_ray_scan,
68+
ctx);
6769

6870
// Comparison of straight line navigation with ray scan
6971
test::straight_line_navigation<toy_detector_t>::config cfg_str_nav{};
@@ -77,7 +79,7 @@ int main(int argc, char **argv) {
7779
static_cast<float>(mask_tolerance[1]);
7880

7981
detail::register_checks<test::straight_line_navigation>(toy_det, toy_names,
80-
cfg_str_nav);
82+
cfg_str_nav, ctx);
8183

8284
// Navigation link consistency, discovered by helix intersection
8385
test::helix_scan<toy_detector_t>::config cfg_hel_scan{};
@@ -91,7 +93,8 @@ int main(int argc, char **argv) {
9193
cfg_hel_scan.track_generator().eta_range(-4.f, 4.f);
9294
cfg_hel_scan.track_generator().p_T(1.f * unit<scalar>::GeV);
9395

94-
detail::register_checks<test::helix_scan>(toy_det, toy_names, cfg_hel_scan);
96+
detail::register_checks<test::helix_scan>(toy_det, toy_names, cfg_hel_scan,
97+
ctx);
9598

9699
// Comparison of navigation in a constant B-field with helix
97100
test::helix_navigation<toy_detector_t>::config cfg_hel_nav{};
@@ -100,7 +103,7 @@ int main(int argc, char **argv) {
100103
cfg_hel_nav.propagation().navigation.search_window = {3u, 3u};
101104

102105
detail::register_checks<test::helix_navigation>(toy_det, toy_names,
103-
cfg_hel_nav);
106+
cfg_hel_nav, ctx);
104107

105108
// Run the material validation - Material Maps
106109
test::material_scan<toy_detector_t>::config mat_scan_cfg{};
@@ -111,7 +114,7 @@ int main(int argc, char **argv) {
111114

112115
// Record the material using a ray scan
113116
detail::register_checks<test::material_scan>(toy_det, toy_names,
114-
mat_scan_cfg);
117+
mat_scan_cfg, ctx);
115118

116119
// Now trace the material during navigation and compare
117120
test::material_validation<toy_detector_t>::config mat_val_cfg{};
@@ -125,7 +128,7 @@ int main(int argc, char **argv) {
125128

126129
// @TODO: Put material maps on all portals
127130
detail::register_checks<test::material_validation>(toy_det, toy_names,
128-
mat_val_cfg);
131+
mat_val_cfg, ctx);
129132

130133
// Run the material validation - Homogeneous material
131134
toy_cfg.use_material_maps(false);
@@ -139,17 +142,17 @@ int main(int argc, char **argv) {
139142
// Check that the detector was built correctly
140143
detail::register_checks<test::consistency_check>(
141144
toy_det_hom_mat, toy_names_hom_mat,
142-
cfg_cons.name("toy_detector_consistency_hom_mat"));
145+
cfg_cons.name("toy_detector_consistency_hom_mat"), ctx);
143146

144147
// Record the material using a ray scan
145148
mat_scan_cfg.name("toy_detector_hom_material_scan");
146149
detail::register_checks<test::material_scan>(
147-
toy_det_hom_mat, toy_names_hom_mat, mat_scan_cfg);
150+
toy_det_hom_mat, toy_names_hom_mat, mat_scan_cfg, ctx);
148151

149152
// Now trace the material during navigation and compare
150153
mat_val_cfg.name("toy_detector_hom_material_validaiton");
151154
detail::register_checks<test::material_validation>(
152-
toy_det_hom_mat, toy_names_hom_mat, mat_val_cfg);
155+
toy_det_hom_mat, toy_names_hom_mat, mat_val_cfg, ctx);
153156

154157
// Run the checks
155158
return RUN_ALL_TESTS();

tests/integration_tests/cpu/detectors/wire_chamber_navigation.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@ int main(int argc, char **argv) {
5050
build_wire_chamber<test_algebra>(host_mr, wire_chamber_cfg);
5151

5252
auto white_board = std::make_shared<test::whiteboard>();
53+
wire_chamber_t::geometry_context ctx{};
5354

5455
// General data consistency of the detector
5556
test::consistency_check<wire_chamber_t>::config cfg_cons{};
5657
detail::register_checks<test::consistency_check>(
57-
det, names, cfg_cons.name("wire_chamber_consistency"));
58+
det, names, cfg_cons.name("wire_chamber_consistency"), ctx);
5859

5960
// Navigation link consistency, discovered by ray intersection
6061
test::ray_scan<wire_chamber_t>::config cfg_ray_scan{};
@@ -63,7 +64,7 @@ int main(int argc, char **argv) {
6364
cfg_ray_scan.track_generator().seed(42u);
6465
cfg_ray_scan.track_generator().n_tracks(10000u);
6566

66-
detail::register_checks<test::ray_scan>(det, names, cfg_ray_scan);
67+
detail::register_checks<test::ray_scan>(det, names, cfg_ray_scan, ctx);
6768

6869
// Comparison of straight line navigation with ray scan
6970
test::straight_line_navigation<wire_chamber_t>::config cfg_str_nav{};
@@ -77,7 +78,7 @@ int main(int argc, char **argv) {
7778
static_cast<float>(mask_tolerance[1]);
7879

7980
detail::register_checks<test::straight_line_navigation>(det, names,
80-
cfg_str_nav);
81+
cfg_str_nav, ctx);
8182

8283
// Navigation link consistency, discovered by helix intersection
8384
test::helix_scan<wire_chamber_t>::config cfg_hel_scan{};
@@ -92,7 +93,7 @@ int main(int argc, char **argv) {
9293
// TODO: Fails for smaller momenta
9394
cfg_hel_scan.track_generator().p_T(4.f * unit<scalar>::GeV);
9495

95-
detail::register_checks<test::helix_scan>(det, names, cfg_hel_scan);
96+
detail::register_checks<test::helix_scan>(det, names, cfg_hel_scan, ctx);
9697

9798
// Comparison of navigation in a constant B-field with helix
9899
test::helix_navigation<wire_chamber_t>::config cfg_hel_nav{};
@@ -101,7 +102,8 @@ int main(int argc, char **argv) {
101102
cfg_hel_nav.propagation().navigation.min_mask_tolerance *= 12.f;
102103
cfg_hel_nav.propagation().navigation.search_window = {3u, 3u};
103104

104-
detail::register_checks<test::helix_navigation>(det, names, cfg_hel_nav);
105+
detail::register_checks<test::helix_navigation>(det, names, cfg_hel_nav,
106+
ctx);
105107

106108
// Run the material validation
107109
test::material_scan<wire_chamber_t>::config mat_scan_cfg{};
@@ -111,7 +113,7 @@ int main(int argc, char **argv) {
111113
mat_scan_cfg.track_generator().phi_steps(100).eta_steps(100);
112114

113115
// Record the material using a ray scan
114-
detail::register_checks<test::material_scan>(det, names, mat_scan_cfg);
116+
detail::register_checks<test::material_scan>(det, names, mat_scan_cfg, ctx);
115117

116118
// Now trace the material during navigation and compare
117119
test::material_validation<wire_chamber_t>::config mat_val_cfg{};
@@ -123,7 +125,8 @@ int main(int argc, char **argv) {
123125
}
124126
mat_val_cfg.propagation() = cfg_str_nav.propagation();
125127

126-
detail::register_checks<test::material_validation>(det, names, mat_val_cfg);
128+
detail::register_checks<test::material_validation>(det, names, mat_val_cfg,
129+
ctx);
127130

128131
// Run the checks
129132
return RUN_ALL_TESTS();

tests/integration_tests/device/cuda/telescope_navigation_validation.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ int main(int argc, char **argv) {
6060
build_telescope_detector<test_algebra>(host_mr, tel_cfg);
6161

6262
auto white_board = std::make_shared<test::whiteboard>();
63+
tel_detector_t::geometry_context ctx{};
6364

6465
// Navigation link consistency, discovered by ray intersection
6566
test::ray_scan<tel_detector_t>::config cfg_ray_scan{};
@@ -71,7 +72,8 @@ int main(int argc, char **argv) {
7172
cfg_ray_scan.track_generator().theta_range(0.f,
7273
0.25f * constant<scalar>::pi_4);
7374

74-
detail::register_checks<test::ray_scan>(tel_det, tel_names, cfg_ray_scan);
75+
detail::register_checks<test::ray_scan>(tel_det, tel_names, cfg_ray_scan,
76+
ctx);
7577

7678
// Comparison of straight line navigation with ray scan
7779
detray::cuda::straight_line_navigation<tel_detector_t>::config
@@ -85,7 +87,7 @@ int main(int argc, char **argv) {
8587
static_cast<float>(mask_tolerance[1]);
8688

8789
detail::register_checks<detray::cuda::straight_line_navigation>(
88-
tel_det, tel_names, cfg_str_nav);
90+
tel_det, tel_names, cfg_str_nav, ctx);
8991

9092
// Navigation link consistency, discovered by helix intersection
9193
test::helix_scan<tel_detector_t>::config cfg_hel_scan{};
@@ -100,7 +102,8 @@ int main(int argc, char **argv) {
100102
cfg_hel_scan.track_generator().theta_range(0.f,
101103
0.25f * constant<scalar>::pi_4);
102104

103-
detail::register_checks<test::helix_scan>(tel_det, tel_names, cfg_hel_scan);
105+
detail::register_checks<test::helix_scan>(tel_det, tel_names, cfg_hel_scan,
106+
ctx);
104107

105108
// Comparison of navigation in a constant B-field with helix
106109
detray::cuda::helix_navigation<tel_detector_t>::config cfg_hel_nav{};
@@ -110,7 +113,7 @@ int main(int argc, char **argv) {
110113
-100.f * unit<float>::um;
111114

112115
detail::register_checks<detray::cuda::helix_navigation>(tel_det, tel_names,
113-
cfg_hel_nav);
116+
cfg_hel_nav, ctx);
114117

115118
// Run the material validation
116119
test::material_scan<tel_detector_t>::config mat_scan_cfg{};
@@ -122,7 +125,7 @@ int main(int argc, char **argv) {
122125

123126
// Record the material using a ray scan
124127
detail::register_checks<test::material_scan>(tel_det, tel_names,
125-
mat_scan_cfg);
128+
mat_scan_cfg, ctx);
126129

127130
// Now trace the material during navigation and compare
128131
detray::cuda::material_validation<tel_detector_t>::config mat_val_cfg{};
@@ -132,7 +135,7 @@ int main(int argc, char **argv) {
132135
mat_val_cfg.propagation() = cfg_str_nav.propagation();
133136

134137
detail::register_checks<detray::cuda::material_validation>(
135-
tel_det, tel_names, mat_val_cfg);
138+
tel_det, tel_names, mat_val_cfg, ctx);
136139

137140
// Run the checks
138141
return RUN_ALL_TESTS();

tests/integration_tests/device/cuda/toy_detector_navigation_validation.cpp

+11-8
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,16 @@ int main(int argc, char **argv) {
5757
build_toy_detector<test_algebra>(host_mr, toy_cfg);
5858

5959
auto white_board = std::make_shared<test::whiteboard>();
60+
toy_detector_t::geometry_context ctx{};
6061

6162
// Navigation link consistency, discovered by ray intersection
6263
test::ray_scan<toy_detector_t>::config cfg_ray_scan{};
6364
cfg_ray_scan.name("toy_detector_ray_scan_for_cuda");
6465
cfg_ray_scan.whiteboard(white_board);
6566
cfg_ray_scan.track_generator().n_tracks(1000u);
6667

67-
detail::register_checks<test::ray_scan>(toy_det, toy_names, cfg_ray_scan);
68+
detail::register_checks<test::ray_scan>(toy_det, toy_names, cfg_ray_scan,
69+
ctx);
6870

6971
// Comparison of straight line navigation with ray scan
7072
detray::cuda::straight_line_navigation<toy_detector_t>::config
@@ -79,7 +81,7 @@ int main(int argc, char **argv) {
7981
static_cast<float>(mask_tolerance[1]);
8082

8183
detail::register_checks<detray::cuda::straight_line_navigation>(
82-
toy_det, toy_names, cfg_str_nav);
84+
toy_det, toy_names, cfg_str_nav, ctx);
8385

8486
// Navigation link consistency, discovered by helix intersection
8587
test::helix_scan<toy_detector_t>::config cfg_hel_scan{};
@@ -92,7 +94,8 @@ int main(int argc, char **argv) {
9294
cfg_hel_scan.track_generator().eta_range(-4.f, 4.f);
9395
cfg_hel_scan.track_generator().p_T(1.f * unit<scalar>::GeV);
9496

95-
detail::register_checks<test::helix_scan>(toy_det, toy_names, cfg_hel_scan);
97+
detail::register_checks<test::helix_scan>(toy_det, toy_names, cfg_hel_scan,
98+
ctx);
9699

97100
// Comparison of navigation in a constant B-field with helix
98101
detray::cuda::helix_navigation<toy_detector_t>::config cfg_hel_nav{};
@@ -101,7 +104,7 @@ int main(int argc, char **argv) {
101104
cfg_hel_nav.propagation().navigation.search_window = {3u, 3u};
102105

103106
detail::register_checks<detray::cuda::helix_navigation>(toy_det, toy_names,
104-
cfg_hel_nav);
107+
cfg_hel_nav, ctx);
105108

106109
// Run the material validation - Material Maps
107110
test::material_scan<toy_detector_t>::config mat_scan_cfg{};
@@ -112,7 +115,7 @@ int main(int argc, char **argv) {
112115

113116
// Record the material using a ray scan
114117
detail::register_checks<test::material_scan>(toy_det, toy_names,
115-
mat_scan_cfg);
118+
mat_scan_cfg, ctx);
116119

117120
// Now trace the material during navigation and compare
118121
detray::cuda::material_validation<toy_detector_t>::config mat_val_cfg{};
@@ -123,7 +126,7 @@ int main(int argc, char **argv) {
123126
mat_val_cfg.propagation() = cfg_str_nav.propagation();
124127

125128
detail::register_checks<detray::cuda::material_validation>(
126-
toy_det, toy_names, mat_val_cfg);
129+
toy_det, toy_names, mat_val_cfg, ctx);
127130

128131
// Run the material validation - Homogeneous material
129132
toy_cfg.use_material_maps(false);
@@ -135,12 +138,12 @@ int main(int argc, char **argv) {
135138
// Record the material using a ray scan
136139
mat_scan_cfg.name("toy_detector_hom_material_scan_for_cuda");
137140
detail::register_checks<test::material_scan>(
138-
toy_det_hom_mat, toy_names_hom_mat, mat_scan_cfg);
141+
toy_det_hom_mat, toy_names_hom_mat, mat_scan_cfg, ctx);
139142

140143
// Now trace the material during navigation and compare
141144
mat_val_cfg.name("toy_detector_hom_material_validaiton_cuda");
142145
detail::register_checks<detray::cuda::material_validation>(
143-
toy_det_hom_mat, toy_names_hom_mat, mat_val_cfg);
146+
toy_det_hom_mat, toy_names_hom_mat, mat_val_cfg, ctx);
144147

145148
// Run the checks
146149
return RUN_ALL_TESTS();

0 commit comments

Comments
 (0)