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: pyG4LogicalVolume.cc,v 1.5 2008/03/13 07:32:18 kmura Exp $ |
---|
27 | // $Name: geant4-09-04-beta-01 $ |
---|
28 | // ==================================================================== |
---|
29 | // pyG4LogicalVolume.cc |
---|
30 | // |
---|
31 | // 2005 Q |
---|
32 | // ==================================================================== |
---|
33 | #include <boost/python.hpp> |
---|
34 | #include "G4Version.hh" |
---|
35 | #include "G4LogicalVolume.hh" |
---|
36 | #include "G4Material.hh" |
---|
37 | #include "G4VSolid.hh" |
---|
38 | #include "G4FieldManager.hh" |
---|
39 | #include "G4VSensitiveDetector.hh" |
---|
40 | #include "G4UserLimits.hh" |
---|
41 | #include "G4SmartVoxelHeader.hh" |
---|
42 | #include "G4MaterialCutsCouple.hh" |
---|
43 | #include "G4FastSimulationManager.hh" |
---|
44 | #include "G4VisAttributes.hh" |
---|
45 | |
---|
46 | using namespace boost::python; |
---|
47 | |
---|
48 | // ==================================================================== |
---|
49 | // thin wrappers |
---|
50 | // ==================================================================== |
---|
51 | namespace pyG4LogicalVolume { |
---|
52 | |
---|
53 | void(G4LogicalVolume::*f1_SetVisAttributes)(const G4VisAttributes*) |
---|
54 | = &G4LogicalVolume::SetVisAttributes; |
---|
55 | |
---|
56 | void(G4LogicalVolume::*f2_SetVisAttributes)(const G4VisAttributes&) |
---|
57 | = &G4LogicalVolume::SetVisAttributes; |
---|
58 | |
---|
59 | #if G4VERSION_NUMBER <= 701 |
---|
60 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetMass, GetMass, 0, 2); |
---|
61 | #elif G4VERSION_NUMBER >=710 |
---|
62 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetMass, GetMass, 0, 3); |
---|
63 | #endif |
---|
64 | |
---|
65 | }; |
---|
66 | |
---|
67 | using namespace pyG4LogicalVolume; |
---|
68 | |
---|
69 | // ==================================================================== |
---|
70 | // module definition |
---|
71 | // ==================================================================== |
---|
72 | void export_G4LogicalVolume() |
---|
73 | { |
---|
74 | class_<G4LogicalVolume, G4LogicalVolume*, boost::noncopyable> |
---|
75 | ("G4LogicalVolume", "logical volume class", no_init) |
---|
76 | // constructors |
---|
77 | .def(init<G4VSolid*, G4Material*, const G4String& >()) |
---|
78 | .def(init<G4VSolid*, G4Material*, const G4String&, |
---|
79 | G4FieldManager* >()) |
---|
80 | .def(init<G4VSolid*, G4Material*, const G4String&, |
---|
81 | G4FieldManager*, G4VSensitiveDetector* >()) |
---|
82 | .def(init<G4VSolid*, G4Material*, const G4String&, |
---|
83 | G4FieldManager*, G4VSensitiveDetector*, |
---|
84 | G4UserLimits* >()) |
---|
85 | .def(init<G4VSolid*, G4Material*, const G4String&, |
---|
86 | G4FieldManager*, G4VSensitiveDetector*, |
---|
87 | G4UserLimits*, G4bool >()) |
---|
88 | // --- |
---|
89 | .def("GetName", &G4LogicalVolume::GetName) |
---|
90 | .def("SetName", &G4LogicalVolume::SetName) |
---|
91 | // --- |
---|
92 | .def("GetNoDaughters", &G4LogicalVolume::GetNoDaughters) |
---|
93 | .def("GetDaughter", &G4LogicalVolume::GetDaughter, |
---|
94 | return_internal_reference<>()) |
---|
95 | .def("AddDaughter", &G4LogicalVolume::AddDaughter) |
---|
96 | .def("IsDaughter", &G4LogicalVolume::IsDaughter) |
---|
97 | .def("IsAncestor", &G4LogicalVolume::IsAncestor) |
---|
98 | .def("RemoveDaughter", &G4LogicalVolume::RemoveDaughter) |
---|
99 | .def("ClearDaughters", &G4LogicalVolume::ClearDaughters) |
---|
100 | .def("TotalVolumeEntities", &G4LogicalVolume::TotalVolumeEntities) |
---|
101 | // ---- |
---|
102 | .def("GetSolid", &G4LogicalVolume::GetSolid, |
---|
103 | return_internal_reference<>()) |
---|
104 | .def("SetSolid", &G4LogicalVolume::SetSolid) |
---|
105 | .def("GetMaterial", &G4LogicalVolume::GetMaterial, |
---|
106 | return_internal_reference<>()) |
---|
107 | .def("SetMaterial", &G4LogicalVolume::SetMaterial) |
---|
108 | .def("UpdateMaterial", &G4LogicalVolume::UpdateMaterial) |
---|
109 | // --- |
---|
110 | .def("GetMass", &G4LogicalVolume::GetMass, f_GetMass()) |
---|
111 | .def("GetFieldManager", &G4LogicalVolume::GetFieldManager, |
---|
112 | return_internal_reference<>()) |
---|
113 | .def("SetFieldManager", &G4LogicalVolume::SetFieldManager) |
---|
114 | .def("GetSensitiveDetector", &G4LogicalVolume::GetSensitiveDetector, |
---|
115 | return_internal_reference<>()) |
---|
116 | .def("GetUserLimits", &G4LogicalVolume::GetUserLimits, |
---|
117 | return_internal_reference<>()) |
---|
118 | .def("SetUserLimits", &G4LogicalVolume::SetUserLimits) |
---|
119 | // --- |
---|
120 | .def("GetVoxelHeader", &G4LogicalVolume::GetVoxelHeader, |
---|
121 | return_internal_reference<>()) |
---|
122 | .def("SetVoxelHeader", &G4LogicalVolume::SetVoxelHeader) |
---|
123 | .def("GetSmartless", &G4LogicalVolume::GetSmartless) |
---|
124 | .def("SetSmartless", &G4LogicalVolume::SetSmartless) |
---|
125 | .def("IsToOptimise", &G4LogicalVolume::IsToOptimise) |
---|
126 | .def("SetOptimisation", &G4LogicalVolume::SetOptimisation) |
---|
127 | // --- |
---|
128 | .def("IsRootRegion", &G4LogicalVolume::IsRootRegion) |
---|
129 | .def("SetRegionRootFlag", &G4LogicalVolume::SetRegionRootFlag) |
---|
130 | .def("IsRegion", &G4LogicalVolume::IsRegion) |
---|
131 | .def("SetRegion", &G4LogicalVolume::SetRegion) |
---|
132 | .def("GetRegion", &G4LogicalVolume::GetRegion, |
---|
133 | return_internal_reference<>()) |
---|
134 | .def("PropagateRegion", &G4LogicalVolume::PropagateRegion) |
---|
135 | .def("GetMaterialCutsCouple", &G4LogicalVolume::GetMaterialCutsCouple, |
---|
136 | return_internal_reference<>()) |
---|
137 | .def("SetMaterialCutsCouple", &G4LogicalVolume::SetMaterialCutsCouple) |
---|
138 | // --- |
---|
139 | .def("GetVisAttributes", &G4LogicalVolume::GetVisAttributes, |
---|
140 | return_internal_reference<>()) |
---|
141 | .def("SetVisAttributes", f1_SetVisAttributes) |
---|
142 | .def("SetVisAttributes", f2_SetVisAttributes) |
---|
143 | // --- |
---|
144 | #if G4VERSION_NUMBER >= 700 && G4VERSION_NUMBER <= 711 |
---|
145 | .def("BecomeEnvelopeForFastSimulation", |
---|
146 | &G4LogicalVolume::BecomeEnvelopeForFastSimulation) |
---|
147 | .def("ClearEnvelopeForFastSimulation", |
---|
148 | &G4LogicalVolume::ClearEnvelopeForFastSimulation) |
---|
149 | #endif |
---|
150 | .def("GetFastSimulationManager", |
---|
151 | &G4LogicalVolume::GetFastSimulationManager, |
---|
152 | return_internal_reference<>()) |
---|
153 | // --- |
---|
154 | .def("SetBiasWeight", &G4LogicalVolume::SetBiasWeight) |
---|
155 | .def("GetBiasWeight", &G4LogicalVolume::GetBiasWeight) |
---|
156 | ; |
---|
157 | } |
---|