Geant4-11
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// G4Polyhedra
27//
28// Class description:
29//
30// Class implementing a CSG-like type "PGON" Geant 3.21 volume,
31// inherited from class G4VCSGfaceted:
32//
33// G4Polyhedra( const G4String& name,
34// G4double phiStart, - initial phi starting angle
35// G4double phiTotal, - total phi angle
36// G4int numSide, - number sides
37// G4int numZPlanes, - number of z planes
38// const G4double zPlane[], - position of z planes
39// const G4double rInner[], - tangent distance to inner surface
40// const G4double rOuter[] ) - tangent distance to outer surface
41//
42// G4Polyhedra( const G4String& name,
43// G4double phiStart, - initial phi starting angle
44// G4double phiTotal, - total phi angle
45// G4int numSide, - number sides
46// G4int numRZ, - number corners in r,z space
47// const G4double r[], - r coordinate of these corners
48// const G4double z[] ) - z coordinate of these corners
49
50// Author: David C. Williams (davidw@scipp.ucsc.edu)
51// --------------------------------------------------------------------
52#ifndef G4POLYHEDRA_HH
53#define G4POLYHEDRA_HH
54
55#include "G4GeomTypes.hh"
56
57#if defined(G4GEOM_USE_USOLIDS)
58#define G4GEOM_USE_UPOLYHEDRA 1
59#endif
60
61#if defined(G4GEOM_USE_UPOLYHEDRA)
62 #define G4UPolyhedra G4Polyhedra
63 #include "G4UPolyhedra.hh"
64#else
65
66#include "G4VCSGfaceted.hh"
67#include "G4PolyhedraSide.hh"
69#include "G4Polyhedron.hh"
70
73
75{
76 public: // with description
77
79 G4double phiStart, // initial phi starting angle
80 G4double phiTotal, // total phi angle
81 G4int numSide, // number sides
82 G4int numZPlanes, // number of z planes
83 const G4double zPlane[], // position of z planes
84 const G4double rInner[], // tangent distance to inner surface
85 const G4double rOuter[] ); // tangent distance to outer surface
86
88 G4double phiStart, // initial phi starting angle
89 G4double phiTotal, // total phi angle
90 G4int numSide, // number sides
91 G4int numRZ, // number corners in r,z space
92 const G4double r[], // r coordinate of these corners
93 const G4double z[] ); // z coordinate of these corners
94
95 virtual ~G4Polyhedra();
96
97 // Methods for solid
98
99 EInside Inside( const G4ThreeVector& p ) const;
101 const G4ThreeVector& v ) const;
102 G4double DistanceToIn( const G4ThreeVector& p ) const;
103
105 G4bool CalculateExtent(const EAxis pAxis,
106 const G4VoxelLimits& pVoxelLimit,
107 const G4AffineTransform& pTransform,
108 G4double& pmin, G4double& pmax) const;
109
111 const G4int n,
112 const G4VPhysicalVolume* pRep);
113
115
116 G4VSolid* Clone() const;
117
120
122
123 std::ostream& StreamInfo( std::ostream& os ) const;
124
126
127 G4bool Reset();
128
129 // Accessors
130
131 inline G4int GetNumSide() const;
132 inline G4double GetStartPhi() const;
133 inline G4double GetEndPhi() const;
134 inline G4double GetSinStartPhi() const;
135 inline G4double GetCosStartPhi() const;
136 inline G4double GetSinEndPhi() const;
137 inline G4double GetCosEndPhi() const;
138 inline G4bool IsOpen() const;
139 inline G4bool IsGeneric() const;
140 inline G4int GetNumRZCorner() const;
141 inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
142
144 // Returns internal scaled parameters.
146 // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
147 // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
148 // if not already scaled.
149
150 public: // without description
151
152 G4Polyhedra(__void__&);
153 // Fake default constructor for usage restricted to direct object
154 // persistency for clients requiring preallocation of memory for
155 // persistifiable objects.
156
159 // Copy constructor and assignment operator.
160
161 protected: // without description
162
164 // Sets internal parameters for the generic constructor.
165
166 void Create( G4double phiStart, // initial phi starting angle
167 G4double phiTotal, // total phi angle
168 G4int numSide, // number sides
169 G4ReduciblePolygon* rz ); // rz coordinates
170 // Generates the shape and is called by each constructor, after the
171 // conversion of the arguments
172
173 void CopyStuff( const G4Polyhedra& source );
175
176 // Methods for generation of random points on surface
177
178 void SetSurfaceElements() const;
179
180 protected: // without description
181
182 G4int numSide = 0; // Number of sides
183 G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
184 G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
185 G4bool phiIsOpen = false; // true if there is a phi segment
186 G4bool genericPgon = false; // true if created through 2nd generic constructor
187 G4int numCorner = 0; // number RZ points
188 G4PolyhedraSideRZ* corners = nullptr; // our corners
189 G4PolyhedraHistorical* original_parameters = nullptr; // original input params
190
192
193 struct surface_element { G4double area = 0.; G4int i0 = 0, i1 = 0, i2 = 0; };
194 mutable std::vector<surface_element>* fElements = nullptr;
195};
196
197#include "G4Polyhedra.icc"
198
199#endif
200
201#endif
static const G4double pMax
static const G4double pMin
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4ThreeVector GetPointOnSurface() const
Definition: G4Polyhedra.cc:950
G4Polyhedra & operator=(const G4Polyhedra &source)
Definition: G4Polyhedra.cc:389
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Polyhedra.cc:756
G4PolyhedraHistorical * original_parameters
Definition: G4Polyhedra.hh:189
G4double GetCubicVolume()
Definition: G4Polyhedra.cc:808
G4PolyhedraSideRZ * corners
Definition: G4Polyhedra.hh:188
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4Polyhedra.cc:617
G4Polyhedra(const G4String &name, G4double phiStart, G4double phiTotal, G4int numSide, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
Definition: G4Polyhedra.cc:71
G4int GetNumRZCorner() const
G4bool genericPgon
Definition: G4Polyhedra.hh:186
void CopyStuff(const G4Polyhedra &source)
Definition: G4Polyhedra.cc:406
G4double GetSinStartPhi() const
G4VSolid * Clone() const
Definition: G4Polyhedra.cc:749
void Create(G4double phiStart, G4double phiTotal, G4int numSide, G4ReduciblePolygon *rz)
Definition: G4Polyhedra.cc:188
G4bool IsOpen() const
G4GeometryType GetEntityType() const
Definition: G4Polyhedra.cc:742
G4double endPhi
Definition: G4Polyhedra.hh:184
G4double GetSurfaceArea()
Definition: G4Polyhedra.cc:831
G4double GetEndPhi() const
std::vector< surface_element > * fElements
Definition: G4Polyhedra.hh:194
void SetOriginalParameters(G4PolyhedraHistorical *pars)
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Polyhedra.cc:733
G4bool phiIsOpen
Definition: G4Polyhedra.hh:185
G4double startPhi
Definition: G4Polyhedra.hh:183
G4int GetNumSide() const
G4int numCorner
Definition: G4Polyhedra.hh:187
virtual ~G4Polyhedra()
Definition: G4Polyhedra.cc:365
void DeleteStuff()
G4PolyhedraHistorical * GetOriginalParameters() const
G4PolyhedraSideRZ GetCorner(const G4int index) const
G4bool Reset()
Definition: G4Polyhedra.cc:463
G4double GetCosEndPhi() const
G4double GetStartPhi() const
G4EnclosingCylinder * enclosingCylinder
Definition: G4Polyhedra.hh:191
G4double GetCosStartPhi() const
G4bool IsGeneric() const
G4double GetSinEndPhi() const
void SetSurfaceElements() const
Definition: G4Polyhedra.cc:872
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Polyhedra.cc:525
EInside Inside(const G4ThreeVector &p) const
Definition: G4Polyhedra.cc:507
G4Polyhedron * CreatePolyhedron() const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Polyhedra.cc:549
EAxis
Definition: geomdefs.hh:54
EInside
Definition: geomdefs.hh:67
const char * name(G4int ptype)