@@ -85,15 +85,16 @@ class material_map_builder final : public volume_decorator<detector_t> {
8585 material_map_factory<detector_t , axis::multi_bin<DIM>>;
8686 auto mat_factory = std::dynamic_pointer_cast<sf_factory_t >(sf_factory);
8787 if (mat_factory) {
88- DETRAY_VERBOSE_HOST (" -> found " << DETRAY_TYPENAME (sf_factory_t ));
88+ DETRAY_VERBOSE_HOST (
89+ " -> found decoration: " << DETRAY_TYPENAME (sf_factory_t ));
8990 (*mat_factory)(this ->surfaces (), m_bin_data, m_n_bins,
9091 m_axis_spans);
9192 }
9293 auto mat_generator =
9394 std::dynamic_pointer_cast<material_map_generator<detector_t >>(
9495 sf_factory);
9596 if (mat_generator) {
96- DETRAY_VERBOSE_HOST (" -> found " << DETRAY_TYPENAME (
97+ DETRAY_VERBOSE_HOST (" -> found decoration: " << DETRAY_TYPENAME (
9798 material_map_generator<detector_t >));
9899 (*mat_generator)(this ->surfaces (), this ->masks (), m_bin_data,
99100 m_n_bins);
@@ -112,30 +113,34 @@ class material_map_builder final : public volume_decorator<detector_t> {
112113 auto build (detector_t & det,
113114 typename detector_t ::geometry_context ctx = {}) ->
114115 typename detector_t::volume_type* override {
115- DETRAY_DEBUG_HOST (" Build material maps..." );
116+ DETRAY_VERBOSE_HOST (" Build material maps..." );
116117
117118 // Ensure the material links are correct BEFORE the surfaces are built
118119 // and potentially added to an acceleration data structure
119120 update_material_links (det);
120121
121- DETRAY_DEBUG_HOST (" -> defer to contained builders" );
122+ DETRAY_DEBUG_HOST (
123+ " -> Let underlying builders construct the volume using correct "
124+ " material links..." );
122125 // Construct the surfaces
123126 typename detector_t ::volume_type* vol_ptr =
124127 volume_decorator<detector_t >::build (det, ctx);
125- DETRAY_DEBUG_HOST (" -> back in build" );
128+ DETRAY_DEBUG_HOST (" -> Back in build" );
126129
127130 // Build the material grid for every surface that has material
128131 dindex sf_idx = 0u ;
129132 auto vol = tracking_volume{det, this ->vol_index ()};
133+ DETRAY_DEBUG_HOST (" Build material maps for surfaces..." );
130134 for (const auto & sf_desc : vol.surfaces ()) {
131135
132- DETRAY_DEBUG_HOST (" -> sf_desc=" << sf_desc);
133-
134136 if (!surface_has_map (sf_idx)) {
135137 sf_idx++;
136138 continue ;
137139 }
138140
141+ DETRAY_DEBUG_HOST (" -> surface #" << sf_idx
142+ << " sf_desc = " << sf_desc);
143+
139144 // Construct and append the material map for a given surface shape
140145 darray<std::vector<scalar_type>, DIM> axis_spans{};
141146 auto axis_spans_itr = m_axis_spans.find (sf_idx);
@@ -188,7 +193,7 @@ class material_map_builder final : public volume_decorator<detector_t> {
188193
189194 // / Set the correct global surface material link for this detector
190195 void update_material_links (const detector_t & det) {
191- DETRAY_DEBUG_HOST ( " 'update_material_links()' called " );
196+ DETRAY_VERBOSE_HOST ( " Precompute material links... " );
192197
193198 // The total number of surfaces that will be built by this builder
194199 const dindex n_surfaces{static_cast <dindex>(this ->surfaces ().size ())};
@@ -202,18 +207,20 @@ class material_map_builder final : public volume_decorator<detector_t> {
202207 }
203208
204209 auto & sf_desc = this ->surfaces ().at (sf_idx);
210+ const auto id{sf_desc.material ().id ()};
205211
206- DETRAY_DEBUG_HOST (" - sf_desc=" << sf_desc);
212+ DETRAY_DEBUG_HOST (" -> surface #" << sf_idx << " (mat. id = " << id
213+ << " )" );
207214
208- const auto id{sf_desc.material ().id ()};
209215 if (!mat_type_count.contains (id)) {
210216 mat_type_count.emplace (id, 0u );
211217 } else {
212218 mat_type_count.at (id)++;
213219 }
214220
215- DETRAY_DEBUG_HOST (" -> set_index (id=" << id << " ) to: "
216- << mat_type_count.at (id));
221+ DETRAY_DEBUG_HOST (
222+ " --> set mat. index to: " << mat_type_count.at (id));
223+
217224 sf_desc.material ().set_index (mat_type_count.at (id));
218225 }
219226
@@ -222,21 +229,19 @@ class material_map_builder final : public volume_decorator<detector_t> {
222229 det._materials .template apply <detail::material_coll_size>(
223230 size_map, std::make_index_sequence<materials_t ::n_types>{});
224231
225- DETRAY_DEBUG_HOST (" Update the counts with the detector offset" );
232+ DETRAY_DEBUG_HOST (" Shift material indices by detector offset... " );
226233 for (dindex sf_idx = 0u ; sf_idx < n_surfaces; ++sf_idx) {
227234 if (!surface_has_map (sf_idx)) {
228235 continue ;
229236 }
230237 auto & sf_desc = this ->surfaces ().at (sf_idx);
231- DETRAY_DEBUG_HOST (" - sf_desc=" << sf_desc);
232238
233- DETRAY_DEBUG_HOST (" sf_desc.material() = "
234- << sf_desc.material () << " ("
235- << sf_desc.material ().id () << " )" );
236239 auto coll_idx{static_cast <std::size_t >(sf_desc.material ().id ())};
237- DETRAY_DEBUG_HOST (" sf_desc.material() += size_map.at(coll_idx) --> "
238- << size_map.at (coll_idx));
239240 sf_desc.material () += size_map.at (coll_idx);
241+
242+ DETRAY_DEBUG_HOST (" (Shift = " << size_map.at (coll_idx)
243+ << " ): material link = "
244+ << sf_desc.material ());
240245 }
241246 }
242247
@@ -321,6 +326,8 @@ struct add_sf_material_map {
321326
322327 // Not every mask shape might be used for material maps
323328 if constexpr (materials_t ::template is_defined<non_owning_t >()) {
329+ DETRAY_VERBOSE_HOST (" Filling material grid..." );
330+
324331 // Add the material slabs to the grid
325332 for (const auto & bin : bin_data) {
326333 mat_grid.template populate <replace<>>(bin.local_bin_idx ,
@@ -331,10 +338,8 @@ struct add_sf_material_map {
331338 constexpr auto gid{
332339 materials_t ::template get_id<non_owning_t >()};
333340 mat_store.template push_back <gid>(mat_grid);
334- DETRAY_DEBUG_HOST (" Adding material grid with gid="
335- << gid << " mat_grid=" << mat_grid
336- << " (size is now "
337- << mat_store.template size <gid>() << " )" );
341+ DETRAY_VERBOSE_HOST (" Built material grid:" << gid << " :\n "
342+ << mat_grid.axes ());
338343
339344 // Return the index of the new material map
340345 return {gid, static_cast <dindex>(
0 commit comments