@@ -130,19 +130,31 @@ TEST(detector_cuda, detector_alignment) {
130
130
// and shift them by the same translation
131
131
typename detector_host_t ::transform_container tf_store_aligned_host;
132
132
133
- point3 shift{.100000f * unit<scalar>::mm, .200000f * unit<scalar>::mm,
134
- .300000f * unit<scalar>::mm};
133
+ point3 shift{.1f * unit<scalar>::mm, .2f * unit<scalar>::mm,
134
+ .3f * unit<scalar>::mm};
135
135
136
136
tf_store_aligned_host.reserve (
137
137
det_host.transform_store ().size (),
138
138
typename decltype (det_host)::transform_container::context_type{});
139
139
140
140
for (const auto & tf : det_host.transform_store ()) {
141
- point3 shifted = tf.translation () + shift;
141
+ point3 shifted{tf.translation ()[0 ] + shift[0 ],
142
+ tf.translation ()[1 ] + shift[1 ],
143
+ tf.translation ()[2 ] + shift[2 ]};
142
144
tf_store_aligned_host.push_back (
143
145
transform_t {shifted, tf.x (), tf.y (), tf.z ()});
144
146
}
145
147
148
+ std::cout << " Comparing translations STEP1" << std::endl;
149
+ typename decltype (det_host)::transform_container::context_type ctx{};
150
+ for (unsigned int i = 0u ; i < 20 ; i++) {
151
+ auto trstatic = det_host.transform_store ().at (i,ctx).translation ();
152
+ auto traligned = tf_store_aligned_host.at (i,ctx).translation ();
153
+ auto trdiff = traligned - trstatic;
154
+ EXPECT_POINT3_NEAR (trdiff, shift, 1e-6 );
155
+ }
156
+
157
+
146
158
// copy the vector of aligned transforms to the device
147
159
// again, use synchronous copy and fixed size buffers
148
160
auto tf_buff_aligned =
@@ -173,10 +185,11 @@ TEST(detector_cuda, detector_alignment) {
173
185
surfacexf_data_static, surfacexf_data_aligned);
174
186
175
187
// check that the relevant transforms have been properly shifted
176
- for (unsigned int i = 0u ; i < surfacexf_device_static.size (); i++) {
188
+ std::cout << " Comparing translations STEP3" << std::endl;
189
+ for (unsigned int i = 0u ; i < 20 ; i++) {
177
190
auto translation_static = surfacexf_device_static[i].translation ();
178
191
auto translation_aligned = surfacexf_device_aligned[i].translation ();
179
192
auto translation_diff = translation_aligned - translation_static;
180
- EXPECT_POINT3_NEAR (translation_diff, shift, 1e-5 );
193
+ EXPECT_POINT3_NEAR (translation_diff, shift, 1e-6 );
181
194
}
182
195
}
0 commit comments