12#include "detray/core/concepts.hpp"
13#include "detray/definitions/indexing.hpp"
14#include "detray/io/backend/detail/grid_writer.hpp"
15#include "detray/io/frontend/payloads.hpp"
26 using base_type = detail::grid_writer;
27 using grid_writer_t = base_type;
31 static constexpr std::string_view
tag =
"surface_grids";
37 using base_type::base_type;
44 template <detray::concepts::detector detector_t>
46 const std::string_view det_name) {
47 return grid_writer_t::header_to_payload(
tag, det.accelerator_store(),
56 template <detray::concepts::detector detector_t>
58 const detector_t& det,
const typename detector_t::name_map& ) {
59 using surface_desc_t =
typename detector_t::surface_type;
63 for (
const auto& vol_desc : det.volumes()) {
65 const auto& multi_link = vol_desc.accel_link();
69 [&vol_desc = std::as_const(vol_desc)](
const surface_desc_t& sf_desc) {
70 return vol_desc.to_local_sf_index(sf_desc.index());
75 for (
dindex i = 1u; i < multi_link.size(); ++i) {
76 const auto& acc_link = multi_link[i];
78 if (acc_link.is_invalid()) {
83 grid_writer_t::to_payload(det.accelerator_store(), acc_link,
84 vol_desc.index(), vol_desc.index(),
85 grids_data, sf_converter);
Surface grid writer backend.
Definition surface_grid_writer.hpp:25
detector_grids_payload< std::size_t, io::accel_id > payload_type
Payload type that the reader processes.
Definition surface_grid_writer.hpp:34
static constexpr std::string_view tag
Tag the writer as "surface_grids".
Definition surface_grid_writer.hpp:31
static auto header_to_payload(const detector_t &det, const std::string_view det_name)
Convert the header information into its payload.
Definition surface_grid_writer.hpp:45
static payload_type to_payload(const detector_t &det, const typename detector_t::name_map &)
Convert the grid collections of a detector det into their io payload.
Definition surface_grid_writer.hpp:57
The following enums are global for all detectors.
Definition concepts.hpp:18
unsigned int dindex
Default index type.
Definition indexing.hpp:18
A payload for the grid collections of a detector.
Definition payloads.hpp:344