1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // $Id: pyG4NistManager.cc,v 1.6 2007/11/07 08:49:31 kmura Exp $ |
---|
27 | // $Name: geant4-09-04-beta-01 $ |
---|
28 | // ==================================================================== |
---|
29 | // pyG4NistManager.cc |
---|
30 | // |
---|
31 | // 2005 Q |
---|
32 | // =================================================================== |
---|
33 | #include <boost/python.hpp> |
---|
34 | #include "G4Version.hh" |
---|
35 | #if G4VERSION_NUMBER >= 710 |
---|
36 | #include "G4NistManager.hh" |
---|
37 | |
---|
38 | using namespace boost::python; |
---|
39 | |
---|
40 | // ==================================================================== |
---|
41 | // thin wrappers |
---|
42 | // ==================================================================== |
---|
43 | namespace pyG4NistManager { |
---|
44 | |
---|
45 | // FindOrBuildElement |
---|
46 | G4Element*(G4NistManager::*f1_FindOrBuildElement)(G4int, G4bool) |
---|
47 | = &G4NistManager::FindOrBuildElement; |
---|
48 | |
---|
49 | G4Element*(G4NistManager::*f2_FindOrBuildElement)(const G4String&, G4bool) |
---|
50 | = &G4NistManager::FindOrBuildElement; |
---|
51 | |
---|
52 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_FindOrBuildElement, |
---|
53 | FindOrBuildElement, 1, 2); |
---|
54 | |
---|
55 | // PrintElement |
---|
56 | void(G4NistManager::*f1_PrintElement)(const G4String&) |
---|
57 | = &G4NistManager::PrintElement; |
---|
58 | void(G4NistManager::*f2_PrintElement)(G4int) |
---|
59 | = &G4NistManager::PrintElement; |
---|
60 | |
---|
61 | // FindOrBuildMaterial |
---|
62 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_FindOrBuildMaterial, |
---|
63 | FindOrBuildMaterial, 1, 2); |
---|
64 | |
---|
65 | // ConstructNewMaterial |
---|
66 | #if G4VERSION_NUMBER >= 910 |
---|
67 | G4Material*(G4NistManager::*f1_ConstructNewMaterial) |
---|
68 | (const G4String&, const std::vector<G4String>&, |
---|
69 | const std::vector<G4int>&, G4double, G4bool, |
---|
70 | G4State, G4double, G4double) |
---|
71 | = &G4NistManager::ConstructNewMaterial; |
---|
72 | |
---|
73 | G4Material*(G4NistManager::*f2_ConstructNewMaterial) |
---|
74 | (const G4String&, const std::vector<G4String>&, |
---|
75 | const std::vector<G4double>&, G4double, G4bool, |
---|
76 | G4State, G4double, G4double) |
---|
77 | = &G4NistManager::ConstructNewMaterial; |
---|
78 | |
---|
79 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ConstructNewMaterial, |
---|
80 | ConstructNewMaterial, 4, 8); |
---|
81 | |
---|
82 | #else |
---|
83 | G4Material*(G4NistManager::*f1_ConstructNewMaterial) |
---|
84 | (const G4String&, const std::vector<G4String>&, |
---|
85 | const std::vector<G4int>&, G4double, G4bool) |
---|
86 | = &G4NistManager::ConstructNewMaterial; |
---|
87 | |
---|
88 | G4Material*(G4NistManager::*f2_ConstructNewMaterial) |
---|
89 | (const G4String&, const std::vector<G4String>&, |
---|
90 | const std::vector<G4double>&, G4double, G4bool) |
---|
91 | = &G4NistManager::ConstructNewMaterial; |
---|
92 | |
---|
93 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ConstructNewMaterial, |
---|
94 | ConstructNewMaterial, 4, 5); |
---|
95 | |
---|
96 | #endif |
---|
97 | |
---|
98 | #if G4VERSION_NUMBER >= 910 |
---|
99 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ConstructNewGasMaterial, |
---|
100 | ConstructNewGasMaterial, 4, 5); |
---|
101 | #endif |
---|
102 | |
---|
103 | }; |
---|
104 | |
---|
105 | using namespace pyG4NistManager; |
---|
106 | |
---|
107 | #endif |
---|
108 | |
---|
109 | // ==================================================================== |
---|
110 | // module definition |
---|
111 | // ==================================================================== |
---|
112 | void export_G4NistManager() |
---|
113 | { |
---|
114 | #if G4VERSION_NUMBER >= 710 |
---|
115 | |
---|
116 | class_<G4NistManager, boost::noncopyable> |
---|
117 | ("G4NistManager", "manager class for NIST materials", no_init) |
---|
118 | // --- |
---|
119 | .def("Instance", &G4NistManager::Instance, |
---|
120 | return_value_policy<reference_existing_object>()) |
---|
121 | .staticmethod("Instance") |
---|
122 | // --- |
---|
123 | .def("SetVerbose", &G4NistManager::SetVerbose) |
---|
124 | .def("GetVerbose", &G4NistManager::GetVerbose) |
---|
125 | // --- |
---|
126 | #if G4VERSION_NUMBER < 910 |
---|
127 | .def("RegisterElement", &G4NistManager::RegisterElement) |
---|
128 | .def("DeRegisterElement", &G4NistManager::DeRegisterElement) |
---|
129 | #endif |
---|
130 | .def("GetElement", &G4NistManager::GetElement, |
---|
131 | return_internal_reference<>()) |
---|
132 | .def("FindOrBuildElement", f1_FindOrBuildElement, |
---|
133 | f_FindOrBuildElement() |
---|
134 | [return_value_policy<reference_existing_object>()]) |
---|
135 | .def("FindOrBuildElement", f2_FindOrBuildElement, |
---|
136 | f_FindOrBuildElement() |
---|
137 | [return_value_policy<reference_existing_object>()]) |
---|
138 | .def("GetNumberOfElements", &G4NistManager::GetNumberOfElements) |
---|
139 | .def("GetZ", &G4NistManager::GetZ) |
---|
140 | .def("GetIsotopeMass", &G4NistManager::GetIsotopeMass) |
---|
141 | .def("PrintElement", f1_PrintElement) |
---|
142 | .def("PrintElement", f2_PrintElement) |
---|
143 | .def("PrintG4Element", &G4NistManager::PrintG4Element) |
---|
144 | // --- |
---|
145 | #if G4VERSION_NUMBER < 910 |
---|
146 | .def("RegisterMaterial", &G4NistManager::RegisterMaterial) |
---|
147 | .def("DeRegisterMaterial", &G4NistManager::DeRegisterMaterial) |
---|
148 | #endif |
---|
149 | .def("GetMaterial", &G4NistManager::GetMaterial, |
---|
150 | return_value_policy<reference_existing_object>()) |
---|
151 | .def("FindOrBuildMaterial", &G4NistManager::FindOrBuildMaterial, |
---|
152 | f_FindOrBuildMaterial() |
---|
153 | [return_value_policy<reference_existing_object>()]) |
---|
154 | .def("ConstructNewMaterial", f1_ConstructNewMaterial, |
---|
155 | f_ConstructNewMaterial() |
---|
156 | [return_value_policy<reference_existing_object>()]) |
---|
157 | .def("ConstructNewMaterial", f2_ConstructNewMaterial, |
---|
158 | f_ConstructNewMaterial() |
---|
159 | [return_value_policy<reference_existing_object>()]) |
---|
160 | #if G4VERSION_NUMBER >= 910 |
---|
161 | .def("ConstructNewGasMaterial", &G4NistManager::ConstructNewGasMaterial, |
---|
162 | f_ConstructNewGasMaterial() |
---|
163 | [return_value_policy<reference_existing_object>()]) |
---|
164 | #endif |
---|
165 | .def("GetNumberOfMaterials", &G4NistManager::GetNumberOfMaterials) |
---|
166 | .def("ListMaterials", &G4NistManager::ListMaterials) |
---|
167 | .def("PrintG4Material", &G4NistManager::PrintG4Material) |
---|
168 | ; |
---|
169 | #endif |
---|
170 | } |
---|
171 | |
---|