|
| 1 | +#include <pybind11/pybind11.h> |
| 2 | +#include <pybind11/stl.h> |
| 3 | +#include "pybind11/stl_bind.h" |
| 4 | + |
| 5 | +#include <G4MaterialPropertiesTable.hh> |
| 6 | + |
| 7 | +#include "typecast.hh" |
| 8 | +#include "opaques.hh" |
| 9 | + |
| 10 | +namespace py = pybind11; |
| 11 | + |
| 12 | +void export_G4MaterialPropertiesTable(py::module &m) |
| 13 | +{ |
| 14 | + py::class_<G4MaterialPropertiesTable, py::nodelete>(m, "G4MaterialPropertiesTable", |
| 15 | + "material properties table class") |
| 16 | + |
| 17 | + .def(py::init<>()) |
| 18 | + |
| 19 | + .def("AddConstProperty", |
| 20 | + py::overload_cast<const G4String &, G4double, G4bool>(&G4MaterialPropertiesTable::AddConstProperty), |
| 21 | + py::arg("key"), py::arg("propertyValue"), py::arg("createNewKey") = false) |
| 22 | + |
| 23 | + .def("AddConstProperty", |
| 24 | + py::overload_cast<const char *, G4double, G4bool>(&G4MaterialPropertiesTable::AddConstProperty), |
| 25 | + py::arg("key"), py::arg("propertyValue"), py::arg("createNewKey") = false) |
| 26 | + |
| 27 | + .def("AddEntry", py::overload_cast<const G4String &, G4double, G4double>(&G4MaterialPropertiesTable::AddEntry), |
| 28 | + py::arg("key"), py::arg("aPhotonEnergy"), py::arg("aPropertyValue")) |
| 29 | + |
| 30 | + .def("AddEntry", py::overload_cast<const char *, G4double, G4double>(&G4MaterialPropertiesTable::AddEntry), |
| 31 | + py::arg("key"), py::arg("aPhotonEnergy"), py::arg("aPropertyValue")) |
| 32 | + |
| 33 | + .def( |
| 34 | + "AddProperty", |
| 35 | + py::overload_cast<const G4String &, const std::vector<double> &, const std::vector<double> &, G4bool, G4bool>( |
| 36 | + &G4MaterialPropertiesTable::AddProperty), |
| 37 | + py::arg("key"), py::arg("photonEnergies"), py::arg("propertyValues"), py::arg("createNewKey") = false, |
| 38 | + py::arg("spline") = false, py::return_value_policy::reference) |
| 39 | + |
| 40 | + .def( |
| 41 | + "AddProperty", |
| 42 | + [](G4MaterialPropertiesTable &self, const char *key, G4double *photonEnergies, G4double *propertyValues, |
| 43 | + G4int numEntries, G4bool createNewKey, G4bool spline) { |
| 44 | + return std::make_tuple( |
| 45 | + self.AddProperty(key, photonEnergies, propertyValues, numEntries, createNewKey, spline), photonEnergies, |
| 46 | + propertyValues); |
| 47 | + }, |
| 48 | + py::arg("key"), py::arg("photonEnergies"), py::arg("propertyValues"), py::arg("numEntries"), |
| 49 | + py::arg("createNewKey") = false, py::arg("spline") = false, py::return_value_policy::automatic_reference) |
| 50 | + |
| 51 | + .def("AddProperty", |
| 52 | + py::overload_cast<const G4String &, G4MaterialPropertyVector *, G4bool>( |
| 53 | + &G4MaterialPropertiesTable::AddProperty), |
| 54 | + py::arg("key"), py::arg("opv"), py::arg("createNewKey") = false) |
| 55 | + |
| 56 | + .def("AddProperty", |
| 57 | + py::overload_cast<const char *, G4MaterialPropertyVector *, G4bool>(&G4MaterialPropertiesTable::AddProperty), |
| 58 | + py::arg("key"), py::arg("opv"), py::arg("createNewKey") = false) |
| 59 | + |
| 60 | + .def("AddProperty", |
| 61 | + py::overload_cast<const G4String &, const G4String &>(&G4MaterialPropertiesTable::AddProperty), |
| 62 | + py::arg("key"), py::arg("mat")) |
| 63 | + |
| 64 | + .def("ConstPropertyExists", |
| 65 | + py::overload_cast<const G4String &>(&G4MaterialPropertiesTable::ConstPropertyExists, py::const_), |
| 66 | + py::arg("key")) |
| 67 | + |
| 68 | + .def("ConstPropertyExists", |
| 69 | + py::overload_cast<const char *>(&G4MaterialPropertiesTable::ConstPropertyExists, py::const_), py::arg("key")) |
| 70 | + |
| 71 | + .def("ConstPropertyExists", |
| 72 | + py::overload_cast<const G4int>(&G4MaterialPropertiesTable::ConstPropertyExists, py::const_), |
| 73 | + py::arg("index")) |
| 74 | + |
| 75 | + .def("DumpTable", &G4MaterialPropertiesTable::DumpTable) |
| 76 | + .def("GetConstProperties", &G4MaterialPropertiesTable::GetConstProperties) |
| 77 | + .def("GetConstProperty", |
| 78 | + py::overload_cast<const G4String &>(&G4MaterialPropertiesTable::GetConstProperty, py::const_), |
| 79 | + py::arg("key")) |
| 80 | + |
| 81 | + .def("GetConstProperty", |
| 82 | + py::overload_cast<const char *>(&G4MaterialPropertiesTable::GetConstProperty, py::const_), py::arg("key")) |
| 83 | + |
| 84 | + .def("GetConstProperty", py::overload_cast<const G4int>(&G4MaterialPropertiesTable::GetConstProperty, py::const_), |
| 85 | + py::arg("index")) |
| 86 | + |
| 87 | + .def("GetConstPropertyIndex", &G4MaterialPropertiesTable::GetConstPropertyIndex, py::arg("key")) |
| 88 | + .def("GetMaterialConstPropertyNames", &G4MaterialPropertiesTable::GetMaterialConstPropertyNames) |
| 89 | + .def("GetMaterialPropertyNames", &G4MaterialPropertiesTable::GetMaterialPropertyNames) |
| 90 | + .def("GetProperties", &G4MaterialPropertiesTable::GetProperties) |
| 91 | + .def("GetProperty", py::overload_cast<const char *>(&G4MaterialPropertiesTable::GetProperty, py::const_), |
| 92 | + py::arg("key"), py::return_value_policy::reference) |
| 93 | + |
| 94 | + .def("GetProperty", py::overload_cast<const G4String &>(&G4MaterialPropertiesTable::GetProperty, py::const_), |
| 95 | + py::arg("key"), py::return_value_policy::reference) |
| 96 | + |
| 97 | + .def("GetProperty", py::overload_cast<const G4int>(&G4MaterialPropertiesTable::GetProperty, py::const_), |
| 98 | + py::arg("index"), py::return_value_policy::reference) |
| 99 | + |
| 100 | + .def("GetPropertyIndex", &G4MaterialPropertiesTable::GetPropertyIndex, py::arg("key")) |
| 101 | + .def("RemoveConstProperty", py::overload_cast<const G4String &>(&G4MaterialPropertiesTable::RemoveConstProperty), |
| 102 | + py::arg("key")) |
| 103 | + |
| 104 | + .def("RemoveConstProperty", py::overload_cast<const char *>(&G4MaterialPropertiesTable::RemoveConstProperty), |
| 105 | + py::arg("key")) |
| 106 | + |
| 107 | + .def("RemoveProperty", py::overload_cast<const G4String &>(&G4MaterialPropertiesTable::RemoveProperty), |
| 108 | + py::arg("key")) |
| 109 | + |
| 110 | + .def("RemoveProperty", py::overload_cast<const char *>(&G4MaterialPropertiesTable::RemoveProperty), |
| 111 | + py::arg("key")); |
| 112 | +} |
0 commit comments