source: trunk/environments/g4py/source/processes/pyG4ProcessTable.cc@ 1344

Last change on this file since 1344 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 7.1 KB
Line 
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: pyG4ProcessTable.cc,v 1.4 2006/06/29 15:34:58 gunter Exp $
27// $Name: geant4-09-04-beta-01 $
28// ====================================================================
29// pyG4ProcessTable.cc
30//
31// 2005 Q
32// ====================================================================
33#include <boost/python.hpp>
34class G4UImessenger;
35#include "G4ProcessTable.hh"
36
37using namespace boost::python;
38
39// ====================================================================
40// thin wrappers
41// ====================================================================
42namespace pyG4ProcessTable {
43
44// FindProcess
45G4VProcess*(G4ProcessTable::*f1_FindProcess)
46 (const G4String&, const G4String&) const = &G4ProcessTable::FindProcess;
47
48G4VProcess*(G4ProcessTable::*f2_FindProcess)
49 (const G4String&, const G4ParticleDefinition*) const
50 = &G4ProcessTable::FindProcess;
51
52G4VProcess*(G4ProcessTable::*f3_FindProcess)
53 (const G4String&, const G4ProcessManager*) const
54 = &G4ProcessTable::FindProcess;
55
56// FindProcesses
57// raw vector pointer -> Python list conversion
58list f1_FindProcesses(G4ProcessTable* procTable)
59{
60 list procList;
61 G4ProcessVector* procVec= procTable-> FindProcesses();
62 G4int nproc= procVec-> size();
63 for(G4int i=0; i< nproc; i++) {
64 procList.append(&(*procVec)[i]);
65 }
66 return procList;
67}
68
69list f2_FindProcesses(G4ProcessTable* procTable,
70 const G4ProcessManager* procManager)
71{
72 list procList;
73 G4ProcessVector* procVec= procTable-> FindProcesses(procManager);
74 G4int nproc= procVec-> size();
75 for(G4int i=0; i< nproc; i++) {
76 procList.append(&(*procVec)[i]);
77 }
78 return procList;
79}
80
81list f3_FindProcesses(G4ProcessTable* procTable,
82 const G4String& pname)
83{
84 list procList;
85 G4ProcessVector* procVec= procTable-> FindProcesses(pname);
86 G4int nproc= procVec-> size();
87 for(G4int i=0; i< nproc; i++) {
88 procList.append(&(*procVec)[i]);
89 }
90 return procList;
91}
92
93list f4_FindProcesses(G4ProcessTable* procTable,
94 G4ProcessType ptype)
95{
96 list procList;
97 G4ProcessVector* procVec= procTable-> FindProcesses(ptype);
98 G4int nproc= procVec-> size();
99 for(G4int i=0; i< nproc; i++) {
100 procList.append(&(*procVec)[i]);
101 }
102 return procList;
103}
104
105// SetProcessActivation
106void(G4ProcessTable::*f1_SetProcessActivation)
107 (const G4String&, G4bool)= &G4ProcessTable::SetProcessActivation;
108
109void(G4ProcessTable::*f2_SetProcessActivation)
110 (const G4String&, const G4String&, G4bool)
111 = &G4ProcessTable::SetProcessActivation;
112
113void(G4ProcessTable::*f3_SetProcessActivation)
114 (const G4String&, G4ParticleDefinition*, G4bool)
115 = &G4ProcessTable::SetProcessActivation;
116
117void(G4ProcessTable::*f4_SetProcessActivation)
118 (const G4String&, G4ProcessManager*, G4bool)
119 = &G4ProcessTable::SetProcessActivation;
120
121void(G4ProcessTable::*f5_SetProcessActivation)
122 (G4ProcessType, G4bool)= &G4ProcessTable::SetProcessActivation;
123
124void(G4ProcessTable::*f6_SetProcessActivation)
125 (G4ProcessType, const G4String&, G4bool)
126 = &G4ProcessTable::SetProcessActivation;
127
128void(G4ProcessTable::*f7_SetProcessActivation)
129 (G4ProcessType, G4ParticleDefinition*, G4bool)
130 = &G4ProcessTable::SetProcessActivation;
131
132void(G4ProcessTable::*f8_SetProcessActivation)
133 (G4ProcessType, G4ProcessManager*, G4bool)
134 = &G4ProcessTable::SetProcessActivation;
135
136BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_DumpInfo, DumpInfo, 1, 2);
137
138};
139
140using namespace pyG4ProcessTable;
141
142// ====================================================================
143// module definition
144// ====================================================================
145void export_G4ProcessTable()
146{
147 class_<G4ProcessTable, G4ProcessTable*, boost::noncopyable>
148 ("G4ProcessTable", "process table")
149 // ---
150 .def("GetProcessTable", &G4ProcessTable::GetProcessTable,
151 return_value_policy<reference_existing_object>())
152 .staticmethod("GetProcessTable")
153 .def("Length", &G4ProcessTable::Length)
154 //.def("Insert", &G4ProcessTable::Insert) // protected
155 //.def("Remove", &G4ProcessTable::Remove) // protected
156 // ---
157 .def("FindProcess", f1_FindProcess,
158 return_value_policy<reference_existing_object>())
159 .def("FindProcess", f2_FindProcess,
160 return_value_policy<reference_existing_object>())
161 .def("FindProcess", f3_FindProcess,
162 return_value_policy<reference_existing_object>())
163 .def("FindProcess", f3_FindProcess,
164 return_value_policy<reference_existing_object>())
165 // ---
166 .def("FindProcesses", f1_FindProcesses)
167 .def("FindProcesses", f2_FindProcesses)
168 .def("FindProcesses", f3_FindProcesses)
169 .def("FindProcesses", f4_FindProcesses)
170 // ---
171 .def("SetProcessActivation", f1_SetProcessActivation)
172 .def("SetProcessActivation", f2_SetProcessActivation)
173 .def("SetProcessActivation", f3_SetProcessActivation)
174 .def("SetProcessActivation", f4_SetProcessActivation)
175 .def("SetProcessActivation", f5_SetProcessActivation)
176 .def("SetProcessActivation", f6_SetProcessActivation)
177 .def("SetProcessActivation", f7_SetProcessActivation)
178 .def("SetProcessActivation", f8_SetProcessActivation)
179 // ---
180 .def("GetNameList", &G4ProcessTable::GetNameList,
181 return_internal_reference<>())
182 .def("DumpInfo", &G4ProcessTable::DumpInfo, f_DumpInfo())
183 .def("SetVerboseLevel", &G4ProcessTable::SetVerboseLevel)
184 .def("GetVerboseLevel", &G4ProcessTable::GetVerboseLevel)
185 ;
186}
Note: See TracBrowser for help on using the repository browser.