Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Polyhedra.hh
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 //
27 // $Id: G4Polyhedra.hh 100819 2016-11-02 15:17:36Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4Polyhedra.hh
35 //
36 // Class description:
37 //
38 // Class implementing a CSG-like type "PGON" Geant 3.21 volume,
39 // inherited from class G4VCSGfaceted:
40 //
41 // G4Polyhedra( const G4String& name,
42 // G4double phiStart, - initial phi starting angle
43 // G4double phiTotal, - total phi angle
44 // G4int numSide, - number sides
45 // G4int numZPlanes, - number of z planes
46 // const G4double zPlane[], - position of z planes
47 // const G4double rInner[], - tangent distance to inner surface
48 // const G4double rOuter[] ) - tangent distance to outer surface
49 //
50 // G4Polyhedra( const G4String& name,
51 // G4double phiStart, - initial phi starting angle
52 // G4double phiTotal, - total phi angle
53 // G4int numSide, - number sides
54 // G4int numRZ, - number corners in r,z space
55 // const G4double r[], - r coordinate of these corners
56 // const G4double z[] ) - z coordinate of these corners
57 
58 // Author:
59 // David C. Williams (davidw@scipp.ucsc.edu)
60 // --------------------------------------------------------------------
61 #ifndef G4Polyhedra_hh
62 #define G4Polyhedra_hh
63 
64 #if defined(G4GEOM_USE_USOLIDS)
65 #define G4GEOM_USE_UPOLYHEDRA 1
66 #endif
67 
68 #if defined(G4GEOM_USE_UPOLYHEDRA)
69  #define G4UPolyhedra G4Polyhedra
70  #include "G4UPolyhedra.hh"
71 #else
72 
73 #include "G4VCSGfaceted.hh"
74 #include "G4PolyhedraSide.hh"
75 #include "G4PolyhedraHistorical.hh"
76 #include "G4Polyhedron.hh"
77 
79 class G4ReduciblePolygon;
80 
81 class G4Polyhedra : public G4VCSGfaceted
82 {
83  public: // with description
84 
85  G4Polyhedra( const G4String& name,
86  G4double phiStart, // initial phi starting angle
87  G4double phiTotal, // total phi angle
88  G4int numSide, // number sides
89  G4int numZPlanes, // number of z planes
90  const G4double zPlane[], // position of z planes
91  const G4double rInner[], // tangent distance to inner surface
92  const G4double rOuter[] ); // tangent distance to outer surface
93 
94  G4Polyhedra( const G4String& name,
95  G4double phiStart, // initial phi starting angle
96  G4double phiTotal, // total phi angle
97  G4int numSide, // number sides
98  G4int numRZ, // number corners in r,z space
99  const G4double r[], // r coordinate of these corners
100  const G4double z[] ); // z coordinate of these corners
101 
102  virtual ~G4Polyhedra();
103 
104  // Methods for solid
105 
106  EInside Inside( const G4ThreeVector &p ) const;
108  const G4ThreeVector &v ) const;
109  G4double DistanceToIn( const G4ThreeVector &p ) const;
110 
111  void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
112  G4bool CalculateExtent(const EAxis pAxis,
113  const G4VoxelLimits& pVoxelLimit,
114  const G4AffineTransform& pTransform,
115  G4double& pmin, G4double& pmax) const;
116 
118  const G4int n,
119  const G4VPhysicalVolume* pRep);
120 
122 
123  G4VSolid* Clone() const;
124 
126 
127  std::ostream& StreamInfo( std::ostream& os ) const;
128 
130 
131  G4bool Reset();
132 
133  // Accessors
134 
135  inline G4int GetNumSide() const;
136  inline G4double GetStartPhi() const;
137  inline G4double GetEndPhi() const;
138  inline G4double GetSinStartPhi() const;
139  inline G4double GetCosStartPhi() const;
140  inline G4double GetSinEndPhi() const;
141  inline G4double GetCosEndPhi() const;
142  inline G4bool IsOpen() const;
143  inline G4bool IsGeneric() const;
144  inline G4int GetNumRZCorner() const;
145  inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
146 
148  // Returns internal scaled parameters.
149  inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
150  // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
151  // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
152  // if not already scaled.
153 
154  public: // without description
155 
156  G4Polyhedra(__void__&);
157  // Fake default constructor for usage restricted to direct object
158  // persistency for clients requiring preallocation of memory for
159  // persistifiable objects.
160 
161  G4Polyhedra( const G4Polyhedra &source );
162  G4Polyhedra &operator=( const G4Polyhedra &source );
163  // Copy constructor and assignment operator.
164 
165  protected: // without description
166 
168  // Sets internal parameters for the generic constructor.
169 
170  void Create( G4double phiStart, // initial phi starting angle
171  G4double phiTotal, // total phi angle
172  G4int numSide, // number sides
173  G4ReduciblePolygon *rz ); // rz coordinates
174  // Generates the shape and is called by each constructor, after the
175  // conversion of the arguments
176 
177  void CopyStuff( const G4Polyhedra &source );
178  void DeleteStuff();
179 
180  // Methods for generation of random points on surface
181 
183  G4ThreeVector p2, G4ThreeVector p3) const;
185  G4ThreeVector p2) const;
187 
188  protected: // without description
189 
190  G4int numSide; // Number of sides
191  G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
192  G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
193  G4bool phiIsOpen; // true if there is a phi segment
194  G4bool genericPgon; // true if created through the 2nd generic constructor
195  G4int numCorner; // number RZ points
196  G4PolyhedraSideRZ *corners; // our corners
197  G4PolyhedraHistorical *original_parameters; // original input parameters
198 
200 
201 };
202 
203 #include "G4Polyhedra.icc"
204 
205 #endif
206 
207 #endif
void CopyStuff(const G4Polyhedra &source)
Definition: G4Polyhedra.cc:437
const XML_Char * name
Definition: expat.h:151
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Polyhedra.cc:576
virtual ~G4Polyhedra()
Definition: G4Polyhedra.cc:395
G4double GetCosEndPhi() const
G4ThreeVector GetPointOnSurfaceCorners() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4Polyhedra.cc:644
G4double GetCosStartPhi() const
G4GeometryType GetEntityType() const
Definition: G4Polyhedra.cc:771
G4PolyhedraHistorical * original_parameters
Definition: G4Polyhedra.hh:197
const char * p
Definition: xmltok.h:285
G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3) const
Definition: G4Polyhedra.cc:844
G4bool genericPgon
Definition: G4Polyhedra.hh:194
G4double GetSinStartPhi() const
G4PolyhedraSideRZ * corners
Definition: G4Polyhedra.hh:196
G4bool Reset()
Definition: G4Polyhedra.cc:486
G4double GetEndPhi() const
int G4int
Definition: G4Types.hh:78
void Create(G4double phiStart, G4double phiTotal, G4int numSide, G4ReduciblePolygon *rz)
Definition: G4Polyhedra.cc:206
G4ThreeVector GetPointOnSurface() const
Definition: G4Polyhedra.cc:893
G4double endPhi
Definition: G4Polyhedra.hh:192
G4int GetNumRZCorner() const
G4EnclosingCylinder * enclosingCylinder
Definition: G4Polyhedra.hh:199
G4int GetNumSide() const
G4int numCorner
Definition: G4Polyhedra.hh:195
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Polyhedra.cc:760
bool G4bool
Definition: G4Types.hh:79
G4double startPhi
Definition: G4Polyhedra.hh:191
const G4int n
tuple v
Definition: test.py:18
G4bool IsOpen() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Polyhedra.cc:548
EInside Inside(const G4ThreeVector &p) const
Definition: G4Polyhedra.cc:528
G4bool IsGeneric() const
G4Polyhedron * CreatePolyhedron() const
EInside
Definition: geomdefs.hh:58
EAxis
Definition: geomdefs.hh:54
void DeleteStuff()
G4PolyhedraHistorical * GetOriginalParameters() const
tuple z
Definition: test.py:28
G4Polyhedra & operator=(const G4Polyhedra &source)
Definition: G4Polyhedra.cc:417
G4double GetStartPhi() const
G4PolyhedraSideRZ GetCorner(const G4int index) const
double G4double
Definition: G4Types.hh:76
void SetOriginalParameters(G4PolyhedraHistorical *pars)
G4double GetSinEndPhi() const
G4ThreeVector GetPointOnTriangle(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2) const
Definition: G4Polyhedra.cc:876
G4bool phiIsOpen
Definition: G4Polyhedra.hh:193
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Polyhedra.cc:789
G4VSolid * Clone() const
Definition: G4Polyhedra.cc:780
G4Polyhedra(const G4String &name, G4double phiStart, G4double phiTotal, G4int numSide, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
Definition: G4Polyhedra.cc:84