File indexing completed on 2026-05-27 07:24:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "detray/definitions/units.hpp"
0011
0012
0013 #include "detray/io/frontend/detector_writer.hpp"
0014
0015
0016 #include "detray/options/detector_io_options.hpp"
0017 #include "detray/options/parse_options.hpp"
0018 #include "detray/options/toy_detector_options.hpp"
0019 #include "detray/test/common/build_toy_detector.hpp"
0020 #include "detray/test/framework/types.hpp"
0021
0022
0023 #include <vecmem/memory/host_memory_resource.hpp>
0024
0025
0026 #include "detray/options/boost_program_options.hpp"
0027
0028 namespace po = boost::program_options;
0029
0030 using namespace detray;
0031
0032 int main(int argc, char **argv) {
0033
0034 detray::toy_det_config<test::scalar> toy_cfg{};
0035 detray::io::detector_writer_config writer_cfg{};
0036 writer_cfg.format(detray::io::format::json).replace_files(false);
0037
0038 writer_cfg.path("./toy_detector/");
0039
0040
0041 po::options_description desc("\nToy detector generation options");
0042
0043 desc.add_options()("write_volume_graph", "Write the volume graph to file");
0044
0045 po::variables_map vm =
0046 detray::options::parse_options(desc, argc, argv, toy_cfg, writer_cfg);
0047
0048
0049 writer_cfg.write_material(vm.count("homogeneous_material") != 0u ||
0050 vm.count("material_maps") != 0u ||
0051 vm.count("write_material") != 0u);
0052
0053
0054 vecmem::host_memory_resource host_mr;
0055 auto [toy_det, toy_names] =
0056 build_toy_detector<test::algebra>(host_mr, toy_cfg);
0057
0058
0059 detray::io::write_detector(toy_det, toy_names, writer_cfg);
0060
0061
0062 if (vm.count("write_volume_graph") != 0u) {
0063 throw std::invalid_argument("Writing of volume graph not implemented");
0064 }
0065 }