Geant4  10.02.p01
pyG4TwoVector.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: pyG4TwoVector.cc 76884 2013-11-18 12:54:03Z gcosmo $
27 // ====================================================================
28 // pyG4TwoVector.cc
29 //
30 // 2007 Q
31 // ====================================================================
32 #include <boost/python.hpp>
33 #include "G4Version.hh"
34 
35 #if G4VERSION_NUMBER >= 830
36 #include "G4TwoVector.hh"
37 
38 using namespace boost::python;
39 using namespace CLHEP;
40 
41 typedef G4TwoVector XXX; // ...
42 
43 // ====================================================================
44 // thin wrappers
45 // ====================================================================
46 namespace pyG4TwoVector {
47 
48 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isNear, isNear, 1, 2)
49 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isParallel, isParallel, 1, 2)
50 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isOrthogonal, isOrthogonal, 1, 2)
51 
52 }
53 
54 using namespace pyG4TwoVector;
55 
56 #endif
57 
58 // ====================================================================
59 // module definition
60 // ====================================================================
62 {
63 #if G4VERSION_NUMBER >= 830
64 
65  class_<G4TwoVector>("G4TwoVector", "general 2-vector")
66  // constructors
67  .def(init<G4double>())
68  .def(init<G4double, G4double>())
69  .def(init<const XXX&>())
70 
71  // property
72  .add_property("x", &XXX::x, &XXX::setX)
73  .add_property("y", &XXX::y, &XXX::setY)
74 
75  // methods
76  .def("set", &XXX::set)
77  .def("phi", &XXX::phi)
78  .def("mag", &XXX::mag)
79  .def("mag2", &XXX::mag2)
80  .def("r", &XXX::r)
81  .def("setPhi", &XXX::setPhi)
82  .def("setMag", &XXX::setMag)
83  .def("setR", &XXX::setR)
84  .def("setPolar", &XXX::setPolar)
85  .def("howNear", &XXX::howNear)
86  .def("isNear", &XXX::isNear, f_isNear())
87  .def("howParallel", &XXX::howParallel)
88  .def("isParallel", &XXX::isParallel, f_isParallel())
89  .def("howOrthogonal", &XXX::howOrthogonal)
90  .def("isOrthogonal", &XXX::isOrthogonal, f_isOrthogonal())
91  .def("unit", &XXX::unit)
92  .def("orthogonal", &XXX::orthogonal)
93  .def("dot", &XXX::dot)
94  .def("angle", &XXX::angle)
95  .def("rotate", &XXX::rotate)
96 
97  // operators
98  .def(self_ns::str(self))
99  .def(self == self)
100  .def(self != self)
101  .def(self += self)
102  .def(self -= self)
103  .def(self - self)
104  .def(self + self)
105  .def(self * self)
106  .def(self * G4double())
107  .def(self / G4double())
108  .def(G4double() * self)
109  .def(self *= G4double())
110  .def(self > self)
111  .def(self < self)
112  .def(self >= self)
113  .def(self <= self)
114  ;
115 #endif
116 
117 }
118 
119 
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateTubeVolume, CreateTubeVolume, 4, 6) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateConeVolume
static G4double angle[DIM]
void export_G4TwoVector()
const G4double x[NPOINTSGL]
CLHEP::Hep2Vector G4TwoVector
Definition: G4TwoVector.hh:42
double G4double
Definition: G4Types.hh:76
ExN03DetectorConstruction XXX
Definition: pyExN03geom.cc:43