File indexing completed on 2025-09-15 08:54:41
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <string>
0010 #include <G4Material.hh>
0011
0012 #include "celeritas/inp/Grid.hh"
0013 #include "celeritas/io/ImportUnits.hh"
0014
0015 #include "GeantProcessImporter.hh"
0016
0017 namespace celeritas
0018 {
0019 namespace detail
0020 {
0021
0022
0023
0024
0025 struct GeantMaterialPropertyGetter
0026 {
0027 using MPT = G4MaterialPropertiesTable;
0028
0029 MPT const& mpt;
0030
0031
0032 bool operator()(double* dst, char const* name, ImportUnits q)
0033 {
0034 if (!mpt.ConstPropertyExists(name))
0035 {
0036 return false;
0037 }
0038 *dst = mpt.GetConstProperty(name) * native_value_from_clhep(q);
0039 return true;
0040 }
0041
0042
0043 bool operator()(double* dst, std::string name, int comp, ImportUnits q)
0044 {
0045
0046 name += std::to_string(comp);
0047 return (*this)(dst, name.c_str(), q);
0048 }
0049
0050
0051 bool
0052 operator()(inp::Grid* dst, std::string const& name, Array<ImportUnits, 2> q)
0053 {
0054
0055
0056 auto const* g4vector = const_cast<MPT&>(mpt).GetProperty(name.c_str());
0057 if (!g4vector)
0058 {
0059 return false;
0060 }
0061 *dst = import_physics_vector(*g4vector, q);
0062 return true;
0063 }
0064 };
0065
0066
0067 }
0068 }