Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
pyG4TwoVector.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: pyG4TwoVector.cc 107590 2017-11-24 11:59:22Z gcosmo $
27 // ====================================================================
28 // pyG4TwoVector.cc
29 //
30 // 2007 Q
31 // ====================================================================
32 #include <boost/python.hpp>
33 #include "G4Version.hh"
34 #include "G4TwoVector.hh"
35 
36 using namespace boost::python;
37 using namespace CLHEP;
38 
39 typedef G4TwoVector XXX; // ...
40 
41 // ====================================================================
42 // thin wrappers
43 // ====================================================================
44 namespace pyG4TwoVector {
45 
46 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isNear, isNear, 1, 2)
47 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isParallel, isParallel, 1, 2)
48 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isOrthogonal, isOrthogonal, 1, 2)
49 
50 }
51 
52 using namespace pyG4TwoVector;
53 
54 // ====================================================================
55 // module definition
56 // ====================================================================
58 {
59  class_<G4TwoVector>("G4TwoVector", "general 2-vector")
60  // constructors
61  .def(init<G4double>())
62  .def(init<G4double, G4double>())
63  .def(init<const XXX&>())
64 
65  // property
66  .add_property("x", &XXX::x, &XXX::setX)
67  .add_property("y", &XXX::y, &XXX::setY)
68 
69  // methods
70  .def("set", &XXX::set)
71  .def("phi", &XXX::phi)
72  .def("mag", &XXX::mag)
73  .def("mag2", &XXX::mag2)
74  .def("r", &XXX::r)
75  .def("setPhi", &XXX::setPhi)
76  .def("setMag", &XXX::setMag)
77  .def("setR", &XXX::setR)
78  .def("setPolar", &XXX::setPolar)
79  .def("howNear", &XXX::howNear)
80  .def("isNear", &XXX::isNear, f_isNear())
81  .def("howParallel", &XXX::howParallel)
82  .def("isParallel", &XXX::isParallel, f_isParallel())
83  .def("howOrthogonal", &XXX::howOrthogonal)
84  .def("isOrthogonal", &XXX::isOrthogonal, f_isOrthogonal())
85  .def("unit", &XXX::unit)
86  .def("orthogonal", &XXX::orthogonal)
87  .def("dot", &XXX::dot)
88  .def("angle", &XXX::angle)
89  .def("rotate", &XXX::rotate)
90 
91  // operators
92  .def(self_ns::str(self))
93  .def(self == self)
94  .def(self != self)
95  .def(self += self)
96  .def(self -= self)
97  .def(self - self)
98  .def(self + self)
99  .def(self * self)
100  .def(self * G4double())
101  .def(self / G4double())
102  .def(G4double() * self)
103  .def(self *= G4double())
104  .def(self > self)
105  .def(self < self)
106  .def(self >= self)
107  .def(self <= self)
108  ;
109 }
Float_t x
Definition: compare.C:6
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateTubeVolume, CreateTubeVolume, 4, 6) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateConeVolume
ExN03DetectorConstruction XXX
Definition: pyExN03geom.cc:43
Float_t y
Definition: compare.C:6
void export_G4TwoVector()
double G4double
Definition: G4Types.hh:76