Geant4  10.00.p03
pyG4NistManager.cc
Go to the documentation of this file.
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 76884 2013-11-18 12:54:03Z gcosmo $
27 // ====================================================================
28 // pyG4NistManager.cc
29 //
30 // 2005 Q
31 // ===================================================================
32 #include <boost/python.hpp>
33 #include "G4Version.hh"
34 #if G4VERSION_NUMBER >= 710
35 #include "G4NistManager.hh"
36 
37 using namespace boost::python;
38 
39 // ====================================================================
40 // thin wrappers
41 // ====================================================================
42 namespace pyG4NistManager {
43 
44 // FindOrBuildElement
45 G4Element*(G4NistManager::*f1_FindOrBuildElement)(G4int, G4bool)
47 
48 G4Element*(G4NistManager::*f2_FindOrBuildElement)(const G4String&, G4bool)
50 
51 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_FindOrBuildElement,
52  FindOrBuildElement, 1, 2)
53 
54 // PrintElement
55 void(G4NistManager::*f1_PrintElement)(const G4String&)
56  = &G4NistManager::PrintElement;
57 void(G4NistManager::*f2_PrintElement)(G4int)
58  = &G4NistManager::PrintElement;
59 
60 // FindOrBuildMaterial
61 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_FindOrBuildMaterial,
62  FindOrBuildMaterial, 1, 2)
63 
64 // ConstructNewMaterial
65 G4Material*(G4NistManager::*f1_ConstructNewMaterial)
66  (const G4String&, const std::vector<G4String>&,
67  const std::vector<G4int>&, G4double, G4bool,
68  G4State, G4double, G4double)
69  = &G4NistManager::ConstructNewMaterial;
70 
71 G4Material*(G4NistManager::*f2_ConstructNewMaterial)
72  (const G4String&, const std::vector<G4String>&,
73  const std::vector<G4double>&, G4double, G4bool,
74  G4State, G4double, G4double)
75  = &G4NistManager::ConstructNewMaterial;
76 
77 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ConstructNewMaterial,
78  ConstructNewMaterial, 4, 8)
79 
80 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ConstructNewGasMaterial,
81  ConstructNewGasMaterial, 4, 5)
82 
83 }
84 
85 using namespace pyG4NistManager;
86 
87 #endif
88 
89 // ====================================================================
90 // module definition
91 // ====================================================================
93 {
94 #if G4VERSION_NUMBER >= 710
95 
96  class_<G4NistManager, boost::noncopyable>
97  ("G4NistManager", "manager class for NIST materials", no_init)
98  // ---
99  .def("Instance", &G4NistManager::Instance,
100  return_value_policy<reference_existing_object>())
101  .staticmethod("Instance")
102  // ---
103  .def("SetVerbose", &G4NistManager::SetVerbose)
104  .def("GetVerbose", &G4NistManager::GetVerbose)
105  // ---
106 #if G4VERSION_NUMBER < 910
107  .def("RegisterElement", &G4NistManager::RegisterElement)
108  .def("DeRegisterElement", &G4NistManager::DeRegisterElement)
109 #endif
110  .def("GetElement", &G4NistManager::GetElement,
111  return_internal_reference<>())
112  .def("FindOrBuildElement", f1_FindOrBuildElement,
113  f_FindOrBuildElement()
114  [return_value_policy<reference_existing_object>()])
115  .def("FindOrBuildElement", f2_FindOrBuildElement,
116  f_FindOrBuildElement()
117  [return_value_policy<reference_existing_object>()])
118  .def("GetNumberOfElements", &G4NistManager::GetNumberOfElements)
119  .def("GetZ", &G4NistManager::GetZ)
120  .def("GetIsotopeMass", &G4NistManager::GetIsotopeMass)
121  .def("PrintElement", f1_PrintElement)
122  .def("PrintElement", f2_PrintElement)
123  .def("PrintG4Element", &G4NistManager::PrintG4Element)
124  // ---
125 #if G4VERSION_NUMBER < 910
126  .def("RegisterMaterial", &G4NistManager::RegisterMaterial)
127  .def("DeRegisterMaterial", &G4NistManager::DeRegisterMaterial)
128 #endif
129  .def("GetMaterial", &G4NistManager::GetMaterial,
130  return_value_policy<reference_existing_object>())
131  .def("FindOrBuildMaterial", &G4NistManager::FindOrBuildMaterial,
132  f_FindOrBuildMaterial()
133  [return_value_policy<reference_existing_object>()])
134  .def("ConstructNewMaterial", f1_ConstructNewMaterial,
135  f_ConstructNewMaterial()
136  [return_value_policy<reference_existing_object>()])
137  .def("ConstructNewMaterial", f2_ConstructNewMaterial,
138  f_ConstructNewMaterial()
139  [return_value_policy<reference_existing_object>()])
140 #if G4VERSION_NUMBER >= 910
141  .def("ConstructNewGasMaterial", &G4NistManager::ConstructNewGasMaterial,
142  f_ConstructNewGasMaterial()
143  [return_value_policy<reference_existing_object>()])
144 #endif
145  .def("GetNumberOfMaterials", &G4NistManager::GetNumberOfMaterials)
146  .def("ListMaterials", &G4NistManager::ListMaterials)
147  .def("PrintG4Material", &G4NistManager::PrintG4Material)
148  ;
149 #endif
150 }
151 
G4Material * GetMaterial(size_t index)
size_t GetNumberOfElements() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4int GetVerbose()
G4State
Definition: G4Material.hh:114
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateTubeVolume, CreateTubeVolume, 4, 6) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateConeVolume
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
void PrintG4Material(const G4String &)
size_t GetNumberOfMaterials()
void SetVerbose(G4int)
bool G4bool
Definition: G4Types.hh:79
void PrintG4Element(const G4String &)
G4int GetZ(const G4String &symb) const
void ListMaterials(const G4String &)
G4Element * GetElement(size_t index)
void export_G4NistManager()
G4Material * ConstructNewGasMaterial(const G4String &name, const G4String &nameNist, G4double temp, G4double pres, G4bool isotopes=true)
double G4double
Definition: G4Types.hh:76
G4double GetIsotopeMass(G4int Z, G4int N) const
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)