Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
pyG4Element.cc
이 파일의 문서화 페이지로 가기
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: pyG4Element.cc 101514 2016-11-18 15:30:57Z gcosmo $
27 // ====================================================================
28 // pyG4Element.cc
29 //
30 // 2005 Q
31 // ====================================================================
32 #include <boost/python.hpp>
33 #include "G4Version.hh"
34 #include "G4Element.hh"
35 
36 using namespace boost::python;
37 
38 // ====================================================================
39 // thin wrappers
40 // ====================================================================
41 namespace pyG4Element {
42 
43 // raw pointer -> Python list conversion
45 {
46  list aList;
47  const G4double* aVec= element-> GetRelativeAbundanceVector();
48  G4int niso= element-> GetNumberOfIsotopes();
49  for(G4int i=0; i<niso; i++) {
50  aList.append(aVec[i]);
51  }
52  return aList;
53 }
54 
55 // copy constructor is private, so ...
57 {
58  std::cout << ele; // problem with G4cout. (delayed message)
59 }
60 
61 }
62 
63 using namespace pyG4Element;
64 
65 // ====================================================================
66 // module definition
67 // ====================================================================
69 {
70  class_<G4Element, G4Element*, boost::noncopyable>
71  ("G4Element", "element class", no_init)
72  // constructors
73  .def(init<const G4String&, const G4String&, G4double, G4double>())
74  .def(init<const G4String&, const G4String&, G4int>())
75  // ---
76  .def("AddIsotope", &G4Element::AddIsotope)
77  .def("GetName", &G4Element::GetName,
78  return_value_policy<reference_existing_object>())
79  .def("GetSymbol", &G4Element::GetSymbol,
80  return_value_policy<reference_existing_object>())
81  .def("SetName", &G4Element::SetName)
82  .def("GetZ", &G4Element::GetZ)
83  .def("GetN", &G4Element::GetN)
84  .def("GetA", &G4Element::GetA)
85  .def("GetNbOfAtomicShells", &G4Element::GetNbOfAtomicShells)
86  .def("GetAtomicShell", &G4Element::GetAtomicShell)
87  .def("GetNumberOfIsotopes", &G4Element::GetNumberOfIsotopes)
88  .def("GetIsotopeVector", &G4Element::GetIsotopeVector,
89  return_internal_reference<>())
90  .def("GetRelativeAbundanceVector", f_GetRelativeAbundanceVector)
91  .def("GetIsotope", &G4Element::GetIsotope,
92  return_value_policy<reference_existing_object>())
93  .def("GetElementTable", &G4Element::GetElementTable,
94  return_value_policy<reference_existing_object>())
95  .staticmethod("GetElementTable")
96  .def("GetNumberOfElements", &G4Element::GetNumberOfElements)
97  .staticmethod("GetNumberOfElements")
98  .def("GetIndex", &G4Element::GetIndex)
99  .def("GetElement", &G4Element::GetElement,
100  return_value_policy<reference_existing_object>())
101  .staticmethod("GetElement")
102  .def("GetfCoulomb", &G4Element::GetfCoulomb)
103  .def("GetfRadTsai", &G4Element::GetfRadTsai)
104  .def("GetIonisation", &G4Element::GetIonisation,
105  return_internal_reference<>())
106  // ---
107  .def("Print", Print)
108  ;
109 }
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:163
void SetName(const G4String &name)
Definition: G4Element.hh:214
G4double GetAtomicShell(G4int index) const
Definition: G4Element.cc:367
G4int GetNbOfAtomicShells() const
Definition: G4Element.hh:147
const G4String & GetName() const
Definition: G4Element.hh:127
static G4Element * GetElement(G4String name, G4bool warning=true)
Definition: G4Element.cc:412
G4double GetfRadTsai() const
Definition: G4Element.hh:195
size_t GetIndex() const
Definition: G4Element.hh:182
G4double GetN() const
Definition: G4Element.hh:135
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
Definition: G4Element.cc:152
double G4double
Definition: G4Types.hh:76
void export_G4Element()
Definition: pyG4Element.cc:68
void Print(G4Element &ele)
Definition: pyG4Element.cc:56
int G4int
Definition: G4Types.hh:78
G4double GetA() const
Definition: G4Element.hh:139
G4IonisParamElm * GetIonisation() const
Definition: G4Element.hh:199
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:170
G4double GetZ() const
Definition: G4Element.hh:131
static size_t GetNumberOfElements()
Definition: G4Element.cc:405
list f_GetRelativeAbundanceVector(const G4Element *element)
Definition: pyG4Element.cc:44
G4double GetfCoulomb() const
Definition: G4Element.hh:191
const G4String & GetSymbol() const
Definition: G4Element.hh:128
static const G4double ele
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:398
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:159