Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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 ([email protected])
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:
77
78 G4Polyhedra(const G4String& name,
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
87 G4Polyhedra(const G4String& name,
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 ~G4Polyhedra() override;
96
97 EInside Inside( const G4ThreeVector& p ) const override;
99 const G4ThreeVector& v ) const override;
100 G4double DistanceToIn( const G4ThreeVector& p ) const override;
101
102 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
103 G4bool CalculateExtent(const EAxis pAxis,
104 const G4VoxelLimits& pVoxelLimit,
105 const G4AffineTransform& pTransform,
106 G4double& pmin, G4double& pmax) const override;
107
109 const G4int n,
110 const G4VPhysicalVolume* pRep) override;
111
112 G4GeometryType GetEntityType() const override;
113
114 G4VSolid* Clone() const override;
115
116 G4double GetCubicVolume() override;
117 G4double GetSurfaceArea() override;
118
119 G4ThreeVector GetPointOnSurface() const override;
120
121 std::ostream& StreamInfo( std::ostream& os ) const override;
122
123 G4Polyhedron* CreatePolyhedron() const override;
124
125 G4bool Reset();
126
127 // Accessors
128
129 inline G4int GetNumSide() const;
130 inline G4double GetStartPhi() const;
131 inline G4double GetEndPhi() const;
132 inline G4double GetSinStartPhi() const;
133 inline G4double GetCosStartPhi() const;
134 inline G4double GetSinEndPhi() const;
135 inline G4double GetCosEndPhi() const;
136 inline G4bool IsOpen() const;
137 inline G4bool IsGeneric() const;
138 inline G4int GetNumRZCorner() const;
139 inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
140
142 // Returns internal scaled parameters.
144 // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
145 // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
146 // if not already scaled.
147
148 G4Polyhedra(__void__&);
149 // Fake default constructor for usage restricted to direct object
150 // persistency for clients requiring preallocation of memory for
151 // persistifiable objects.
152
153 G4Polyhedra( const G4Polyhedra& source );
154 G4Polyhedra& operator=( const G4Polyhedra& source );
155 // Copy constructor and assignment operator.
156
157 protected:
158
160 // Sets internal parameters for the generic constructor.
161
162 void Create( G4double phiStart, // initial phi starting angle
163 G4double phiTotal, // total phi angle
164 G4int numSide, // number sides
165 G4ReduciblePolygon* rz ); // rz coordinates
166 // Generates the shape and is called by each constructor, after the
167 // conversion of the arguments
168
169 void CopyStuff( const G4Polyhedra& source );
171
172 // Methods for generation of random points on surface
173
174 void SetSurfaceElements() const;
175
176 protected:
177
178 G4int numSide = 0; // Number of sides
179 G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
180 G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
181 G4bool phiIsOpen = false; // true if there is a phi segment
182 G4bool genericPgon = false; // true if created through 2nd generic ctor
183 G4int numCorner = 0; // number RZ points
184 G4PolyhedraSideRZ* corners = nullptr; // our corners
185 G4PolyhedraHistorical* original_parameters = nullptr; // original input pars
186
188
189 struct surface_element { G4double area=0.; G4int i0=0, i1=0, i2=0; };
190 mutable std::vector<surface_element>* fElements = nullptr;
191};
192
193#include "G4Polyhedra.icc"
194
195#endif
196
197#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
EInside Inside(const G4ThreeVector &p) const override
G4Polyhedra & operator=(const G4Polyhedra &source)
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
G4GeometryType GetEntityType() const override
G4PolyhedraHistorical * original_parameters
G4double GetSurfaceArea() override
G4PolyhedraSideRZ * corners
G4Polyhedra(const G4String &name, G4double phiStart, G4double phiTotal, G4int numSide, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
G4int GetNumRZCorner() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
G4bool genericPgon
G4ThreeVector GetPointOnSurface() const override
void CopyStuff(const G4Polyhedra &source)
G4double GetSinStartPhi() const
void Create(G4double phiStart, G4double phiTotal, G4int numSide, G4ReduciblePolygon *rz)
G4bool IsOpen() const
G4double endPhi
G4double GetEndPhi() const
std::vector< surface_element > * fElements
void SetOriginalParameters(G4PolyhedraHistorical *pars)
G4VSolid * Clone() const override
~G4Polyhedra() override
G4bool phiIsOpen
G4Polyhedron * CreatePolyhedron() const override
G4double startPhi
G4int GetNumSide() const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
void DeleteStuff()
G4PolyhedraHistorical * GetOriginalParameters() const
G4PolyhedraSideRZ GetCorner(const G4int index) const
std::ostream & StreamInfo(std::ostream &os) const override
G4bool Reset()
G4double GetCosEndPhi() const
G4double GetStartPhi() const
G4EnclosingCylinder * enclosingCylinder
G4double GetCosStartPhi() const
G4bool IsGeneric() const
G4double GetSinEndPhi() const
void SetSurfaceElements() const
G4double GetCubicVolume() override
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67