Skip to content

Commit faff45b

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 0dade4a commit faff45b

12 files changed

+71
-59
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

+8-7
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ 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"), ctx);
5960

6061
// Navigation link consistency, discovered by ray intersection
6162
test::ray_scan<tel_detector_t>::config cfg_ray_scan{};
@@ -67,7 +68,7 @@ int main(int argc, char **argv) {
6768
cfg_ray_scan.track_generator().theta_range(0.f,
6869
0.25f * constant<scalar>::pi_4);
6970

70-
detail::register_checks<test::ray_scan>(tel_det, tel_names, cfg_ray_scan);
71+
detail::register_checks<test::ray_scan>(tel_det, tel_names, cfg_ray_scan, ctx);
7172

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

8283
detail::register_checks<test::straight_line_navigation>(tel_det, tel_names,
83-
cfg_str_nav);
84+
cfg_str_nav, ctx);
8485

8586
// Navigation link consistency, discovered by helix intersection
8687
test::helix_scan<tel_detector_t>::config cfg_hel_scan{};
@@ -95,7 +96,7 @@ int main(int argc, char **argv) {
9596
cfg_hel_scan.track_generator().theta_range(0.f,
9697
0.25f * constant<scalar>::pi_4);
9798

98-
detail::register_checks<test::helix_scan>(tel_det, tel_names, cfg_hel_scan);
99+
detail::register_checks<test::helix_scan>(tel_det, tel_names, cfg_hel_scan, ctx);
99100

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

107108
detail::register_checks<test::helix_navigation>(tel_det, tel_names,
108-
cfg_hel_nav);
109+
cfg_hel_nav, ctx);
109110

110111
// Run the material validation
111112
test::material_scan<tel_detector_t>::config mat_scan_cfg{};
@@ -117,7 +118,7 @@ int main(int argc, char **argv) {
117118

118119
// Record the material using a ray scan
119120
detail::register_checks<test::material_scan>(tel_det, tel_names,
120-
mat_scan_cfg);
121+
mat_scan_cfg, ctx);
121122

122123
// Now trace the material during navigation and compare
123124
test::material_validation<tel_detector_t>::config mat_val_cfg{};
@@ -126,7 +127,7 @@ int main(int argc, char **argv) {
126127
mat_val_cfg.propagation() = cfg_str_nav.propagation();
127128

128129
detail::register_checks<test::material_validation>(tel_det, tel_names,
129-
mat_val_cfg);
130+
mat_val_cfg, ctx);
130131

131132
// Run the checks
132133
return RUN_ALL_TESTS();

tests/integration_tests/cpu/detectors/toy_detector_navigation.cpp

+11-10
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,20 @@ 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, ctx);
6768

6869
// Comparison of straight line navigation with ray scan
6970
test::straight_line_navigation<toy_detector_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>(toy_det, toy_names,
80-
cfg_str_nav);
81+
cfg_str_nav, ctx);
8182

8283
// Navigation link consistency, discovered by helix intersection
8384
test::helix_scan<toy_detector_t>::config cfg_hel_scan{};
@@ -91,7 +92,7 @@ int main(int argc, char **argv) {
9192
cfg_hel_scan.track_generator().eta_range(-4.f, 4.f);
9293
cfg_hel_scan.track_generator().p_T(1.f * unit<scalar>::GeV);
9394

94-
detail::register_checks<test::helix_scan>(toy_det, toy_names, cfg_hel_scan);
95+
detail::register_checks<test::helix_scan>(toy_det, toy_names, cfg_hel_scan, ctx);
9596

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

102103
detail::register_checks<test::helix_navigation>(toy_det, toy_names,
103-
cfg_hel_nav);
104+
cfg_hel_nav, ctx);
104105

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

112113
// Record the material using a ray scan
113114
detail::register_checks<test::material_scan>(toy_det, toy_names,
114-
mat_scan_cfg);
115+
mat_scan_cfg, ctx);
115116

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

126127
// @TODO: Put material maps on all portals
127128
detail::register_checks<test::material_validation>(toy_det, toy_names,
128-
mat_val_cfg);
129+
mat_val_cfg, ctx);
129130

130131
// Run the material validation - Homogeneous material
131132
toy_cfg.use_material_maps(false);
@@ -139,17 +140,17 @@ int main(int argc, char **argv) {
139140
// Check that the detector was built correctly
140141
detail::register_checks<test::consistency_check>(
141142
toy_det_hom_mat, toy_names_hom_mat,
142-
cfg_cons.name("toy_detector_consistency_hom_mat"));
143+
cfg_cons.name("toy_detector_consistency_hom_mat"), ctx);
143144

144145
// Record the material using a ray scan
145146
mat_scan_cfg.name("toy_detector_hom_material_scan");
146147
detail::register_checks<test::material_scan>(
147-
toy_det_hom_mat, toy_names_hom_mat, mat_scan_cfg);
148+
toy_det_hom_mat, toy_names_hom_mat, mat_scan_cfg, ctx);
148149

149150
// Now trace the material during navigation and compare
150151
mat_val_cfg.name("toy_detector_hom_material_validaiton");
151152
detail::register_checks<test::material_validation>(
152-
toy_det_hom_mat, toy_names_hom_mat, mat_val_cfg);
153+
toy_det_hom_mat, toy_names_hom_mat, mat_val_cfg, ctx);
153154

154155
// Run the checks
155156
return RUN_ALL_TESTS();

tests/integration_tests/cpu/detectors/wire_chamber_navigation.cpp

+8-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,7 @@ 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, ctx);
105106

106107
// Run the material validation
107108
test::material_scan<wire_chamber_t>::config mat_scan_cfg{};
@@ -111,7 +112,7 @@ int main(int argc, char **argv) {
111112
mat_scan_cfg.track_generator().phi_steps(100).eta_steps(100);
112113

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

116117
// Now trace the material during navigation and compare
117118
test::material_validation<wire_chamber_t>::config mat_val_cfg{};
@@ -123,7 +124,7 @@ int main(int argc, char **argv) {
123124
}
124125
mat_val_cfg.propagation() = cfg_str_nav.propagation();
125126

126-
detail::register_checks<test::material_validation>(det, names, mat_val_cfg);
127+
detail::register_checks<test::material_validation>(det, names, mat_val_cfg, ctx);
127128

128129
// Run the checks
129130
return RUN_ALL_TESTS();

tests/integration_tests/device/cuda/telescope_navigation_validation.cpp

+7-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,7 @@ 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, ctx);
7576

7677
// Comparison of straight line navigation with ray scan
7778
detray::cuda::straight_line_navigation<tel_detector_t>::config
@@ -85,7 +86,7 @@ int main(int argc, char **argv) {
8586
static_cast<float>(mask_tolerance[1]);
8687

8788
detail::register_checks<detray::cuda::straight_line_navigation>(
88-
tel_det, tel_names, cfg_str_nav);
89+
tel_det, tel_names, cfg_str_nav, ctx);
8990

9091
// Navigation link consistency, discovered by helix intersection
9192
test::helix_scan<tel_detector_t>::config cfg_hel_scan{};
@@ -100,7 +101,7 @@ int main(int argc, char **argv) {
100101
cfg_hel_scan.track_generator().theta_range(0.f,
101102
0.25f * constant<scalar>::pi_4);
102103

103-
detail::register_checks<test::helix_scan>(tel_det, tel_names, cfg_hel_scan);
104+
detail::register_checks<test::helix_scan>(tel_det, tel_names, cfg_hel_scan, ctx);
104105

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

112113
detail::register_checks<detray::cuda::helix_navigation>(tel_det, tel_names,
113-
cfg_hel_nav);
114+
cfg_hel_nav, ctx);
114115

115116
// Run the material validation
116117
test::material_scan<tel_detector_t>::config mat_scan_cfg{};
@@ -122,7 +123,7 @@ int main(int argc, char **argv) {
122123

123124
// Record the material using a ray scan
124125
detail::register_checks<test::material_scan>(tel_det, tel_names,
125-
mat_scan_cfg);
126+
mat_scan_cfg, ctx);
126127

127128
// Now trace the material during navigation and compare
128129
detray::cuda::material_validation<tel_detector_t>::config mat_val_cfg{};
@@ -132,7 +133,7 @@ int main(int argc, char **argv) {
132133
mat_val_cfg.propagation() = cfg_str_nav.propagation();
133134

134135
detail::register_checks<detray::cuda::material_validation>(
135-
tel_det, tel_names, mat_val_cfg);
136+
tel_det, tel_names, mat_val_cfg, ctx);
136137

137138
// Run the checks
138139
return RUN_ALL_TESTS();

tests/integration_tests/device/cuda/toy_detector_navigation_validation.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@ 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, ctx);
6869

6970
// Comparison of straight line navigation with ray scan
7071
detray::cuda::straight_line_navigation<toy_detector_t>::config
@@ -79,7 +80,7 @@ int main(int argc, char **argv) {
7980
static_cast<float>(mask_tolerance[1]);
8081

8182
detail::register_checks<detray::cuda::straight_line_navigation>(
82-
toy_det, toy_names, cfg_str_nav);
83+
toy_det, toy_names, cfg_str_nav, ctx);
8384

8485
// Navigation link consistency, discovered by helix intersection
8586
test::helix_scan<toy_detector_t>::config cfg_hel_scan{};
@@ -92,7 +93,7 @@ int main(int argc, char **argv) {
9293
cfg_hel_scan.track_generator().eta_range(-4.f, 4.f);
9394
cfg_hel_scan.track_generator().p_T(1.f * unit<scalar>::GeV);
9495

95-
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, ctx);
9697

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

103104
detail::register_checks<detray::cuda::helix_navigation>(toy_det, toy_names,
104-
cfg_hel_nav);
105+
cfg_hel_nav, ctx);
105106

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

113114
// Record the material using a ray scan
114115
detail::register_checks<test::material_scan>(toy_det, toy_names,
115-
mat_scan_cfg);
116+
mat_scan_cfg, ctx);
116117

117118
// Now trace the material during navigation and compare
118119
detray::cuda::material_validation<toy_detector_t>::config mat_val_cfg{};
@@ -123,7 +124,7 @@ int main(int argc, char **argv) {
123124
mat_val_cfg.propagation() = cfg_str_nav.propagation();
124125

125126
detail::register_checks<detray::cuda::material_validation>(
126-
toy_det, toy_names, mat_val_cfg);
127+
toy_det, toy_names, mat_val_cfg, ctx);
127128

128129
// Run the material validation - Homogeneous material
129130
toy_cfg.use_material_maps(false);
@@ -135,12 +136,12 @@ int main(int argc, char **argv) {
135136
// Record the material using a ray scan
136137
mat_scan_cfg.name("toy_detector_hom_material_scan_for_cuda");
137138
detail::register_checks<test::material_scan>(
138-
toy_det_hom_mat, toy_names_hom_mat, mat_scan_cfg);
139+
toy_det_hom_mat, toy_names_hom_mat, mat_scan_cfg, ctx);
139140

140141
// Now trace the material during navigation and compare
141142
mat_val_cfg.name("toy_detector_hom_material_validaiton_cuda");
142143
detail::register_checks<detray::cuda::material_validation>(
143-
toy_det_hom_mat, toy_names_hom_mat, mat_val_cfg);
144+
toy_det_hom_mat, toy_names_hom_mat, mat_val_cfg, ctx);
144145

145146
// Run the checks
146147
return RUN_ALL_TESTS();

0 commit comments

Comments
 (0)