source: trunk/environments/g4py/source/geometry/pyG4Polyhedra.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

File size: 4.4 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: pyG4Polyhedra.cc,v 1.2 2007/07/11 10:02:22 kmura Exp $
27// $Name: geant4-09-04-beta-01 $
28// ====================================================================
29//   pyG4Polyhedra.cc
30//
31//                                         2007 Q
32// ====================================================================
33#include <boost/python.hpp>
34#include "G4Polyhedra.hh"
35
36using namespace boost::python;
37
38// ====================================================================
39// thin wrappers
40// ====================================================================
41namespace pyG4Polyhedra {
42
43// create solid methods
44
45G4Polyhedra* f1_CreatePolyhedra(const G4String& name, 
46                                G4double phiStart, G4double phiTotal, 
47                                G4int numSide, G4int numZPlanes,
48                                const std::vector<G4double>& zPlane,
49                                const std::vector<G4double>& rInner,
50                                const std::vector<G4double>& rOuter)
51{
52  G4double zlist[numZPlanes];
53  G4double r0list[numZPlanes];
54  G4double r1list[numZPlanes];
55
56  for (G4int i=0; i< numZPlanes; i++) {
57    zlist[i]= zPlane[i];
58    r0list[i]= rInner[i];
59    r1list[i]= rOuter[i];
60  }
61
62  return new G4Polyhedra(name, phiStart, phiTotal, numSide, numZPlanes,
63                        zlist, r0list, r1list);
64}
65
66
67G4Polyhedra* f2_CreatePolyhedra(const G4String& name,
68                                G4double phiStart, G4double phiTotal,
69                                G4int numSide, G4int numRZ,
70                                const std::vector<G4double>& r, 
71                                const std::vector<G4double>& z)
72{
73  G4double zlist[numRZ];
74  G4double rlist[numRZ];
75
76  for (G4int i=0; i< numRZ; i++) {
77    zlist[i]= z[i];
78    rlist[i]= r[i];
79  }
80
81  return new G4Polyhedra(name, phiStart, phiTotal, numSide, numRZ, 
82                         rlist, zlist);
83
84}
85
86}
87
88using namespace pyG4Polyhedra;
89
90// ====================================================================
91// module definition
92// ====================================================================
93void export_G4Polyhedra()
94{
95  class_<G4Polyhedra, G4Polyhedra*, bases<G4VSolid> >
96    ("G4Polyhedra", "Polyhedra solid class", no_init)
97    // ---
98    .def("GetStartPhi",    &G4Polyhedra::GetStartPhi)
99    .def("GetEndPhi",      &G4Polyhedra::GetEndPhi)
100    .def("GetNumSide",     &G4Polyhedra::GetNumSide)
101    .def("GetNumRZCorner", &G4Polyhedra::GetNumRZCorner)
102    .def("IsOpen",         &G4Polyhedra::IsOpen)
103    .def("IsGeneric",      &G4Polyhedra::IsGeneric)
104
105    // operators
106    .def(self_ns::str(self))
107    ;
108
109  // Create solid
110  def("CreatePolyhedra", f1_CreatePolyhedra,
111      return_value_policy<manage_new_object>());
112  def("CreatePolyhedra", f2_CreatePolyhedra,
113      return_value_policy<manage_new_object>());
114}
115
Note: See TracBrowser for help on using the repository browser.