12#include "detray/definitions/detail/qualifiers.hpp"
13#include "detray/geometry/surface.hpp"
14#include "detray/geometry/tracking_volume.hpp"
21namespace detray::utils {
32 template <
typename accel_coll_t,
typename index_t>
33 DETRAY_HOST
void operator()(
const accel_coll_t &accel_coll,
const index_t idx,
34 std::stringstream &os)
const {
35 os << accel_coll[idx];
46 template <
typename material_coll_t,
typename index_t>
47 DETRAY_HOST
void operator()(
const material_coll_t &material_coll,
48 const index_t idx, std::stringstream &os)
const {
49 os << material_coll[idx] << std::endl;
59template <concepts::detector detector_t>
60DETRAY_HOST
inline std::string print_detector(
61 const detector_t &det,
const typename detector_t::name_map &names = {}) {
63 std::stringstream debug_stream{};
65 debug_stream << std::left <<
"[>] Detector " << det.name(names) <<
" has "
66 << det.volumes().size() <<
" volumes." << std::endl;
68 for (
const auto [i, v_desc] : detray::views::enumerate(det.volumes())) {
69 tracking_volume v{det, v_desc};
71 debug_stream <<
"[>>] Volume " << v.name(names) << std::endl;
72 debug_stream << v << std::endl;
74 debug_stream <<
"[>>>] Acceleration Structures:" << std::endl;
75 const auto acc_link = v_desc.accel_link();
76 for (std::size_t j = 0u; j < acc_link.size(); ++j) {
78 if (!acc_link[j].is_invalid_id() && !acc_link[j].is_invalid_index()) {
79 debug_stream <<
"Surfaces registered in '" << acc_link[j].id()
81 det.accelerator_store().template visit<detail::accelerator_printer>(
82 acc_link[j], debug_stream);
86 debug_stream <<
"[>>>] Surfaces:" << std::endl;
87 for (
const auto sf_desc : v.template surfaces<>()) {
88 geometry::surface sf{det, sf_desc};
89 debug_stream << sf << std::endl;
92 if (sf.has_material()) {
93 debug_stream <<
"[>>>>] Surface material: ";
94 sf.template visit_material<detail::material_printer>(debug_stream);
98 debug_stream << std::endl;
101 return debug_stream.str();
A functor that retrieves an acceleration struct and prints it.
Definition print_detector.hpp:26
void operator()(const accel_coll_t &accel_coll, const index_t idx, std::stringstream &os) const
Print an acceleration structure.
Definition print_detector.hpp:33
A functor that retrieves material and prints it.
Definition print_detector.hpp:40
void operator()(const material_coll_t &material_coll, const index_t idx, std::stringstream &os) const
Print material.
Definition print_detector.hpp:47