33 #include <boost/python.hpp>
37 using namespace boost::python;
42 namespace pyG4Material {
50 #if G4VERSION_NUMBER >= 800
58 const G4double* fracVec= material-> GetFractionVector();
59 G4int nele= material-> GetNumberOfElements();
60 for(
G4int i=0; i<nele; i++) {
61 fracList.append(fracVec[i]);
69 const G4int* atomsVec= material-> GetAtomsVector();
70 G4int nele= material-> GetNumberOfElements();
71 for(
G4int i=0; i<nele; i++) {
72 atomsList.append(atomsVec[i]);
79 list nbOfAtomsPerVolumeList;
80 const G4double* nbOfAtomsPerVolumeVec= material-> GetVecNbOfAtomsPerVolume();
81 G4int nele= material-> GetNumberOfElements();
82 for(
G4int i=0; i<nele; i++) {
83 nbOfAtomsPerVolumeList.append(nbOfAtomsPerVolumeVec[i]);
85 return nbOfAtomsPerVolumeList;
90 list atomicNumDensityList;
91 const G4double* atomicNumDensityVec= material-> GetAtomicNumDensityVector();
92 G4int nele= material-> GetNumberOfElements();
93 for(
G4int i=0; i<nele; i++) {
94 atomicNumDensityList.append(atomicNumDensityVec[i]);
96 return atomicNumDensityList;
107 using namespace pyG4Material;
114 class_<G4Material, G4Material*, boost::noncopyable>
115 (
"G4Material",
"material class", no_init)
116 .def(init<const G4String&, G4double, G4double, G4double>())
117 .def(init<const G4String&, G4double, G4int>())
122 #if G4VERSION_NUMBER >= 920
124 return_value_policy<reference_existing_object>())
126 return_value_policy<reference_existing_object>())
139 return_internal_reference<>())
141 return_value_policy<reference_existing_object>())
153 return_internal_reference<>())
155 return_internal_reference<>())
161 return_internal_reference<>())
163 return_value_policy<reference_existing_object>())
164 .staticmethod(
"GetMaterialTable")
166 .staticmethod(
"GetNumberOfMaterials")
168 #if G4VERSION_NUMBER >= 800
171 [return_value_policy<reference_existing_object>()])
174 return_value_policy<reference_existing_object>())
176 .staticmethod(
"GetMaterial")
183 enum_<G4State>(
"G4State")