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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // G4Polycone
 27 //
 28 // Class description:
 29 //
 30 //   Class implementing a CSG-like type "PCON" Geant 3.21 volume,
 31 //   inherited from  class G4VCSGfaceted:
 32 //
 33 //   G4Polycone( const G4String& name,
 34 //               G4double phiStart,     // initial phi starting angle
 35 //               G4double phiTotal,     // total phi angle
 36 //               G4int numZPlanes,      // number of z planes
 37 //               const G4double zPlane[],  // position of z planes
 38 //               const G4double rInner[],  // tangent distance to inner surface
 39 //               const G4double rOuter[])  // tangent distance to outer surface
 40 //
 41 //   Alternative constructor, but limited to increasing-only Z sections:
 42 //
 43 //   G4Polycone( const G4String& name,
 44 //               G4double phiStart,   // initial phi starting angle
 45 //               G4double phiTotal,   // total phi angle
 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 G4POLYCONE_HH
 53 #define G4POLYCONE_HH
 54 
 55 #include "G4GeomTypes.hh"
 56 
 57 #if defined(G4GEOM_USE_USOLIDS)
 58 #define G4GEOM_USE_UPOLYCONE 1
 59 #endif
 60 
 61 #if defined(G4GEOM_USE_UPOLYCONE)
 62   #define G4UPolycone G4Polycone
 63   #include "G4UPolycone.hh"
 64 #else
 65 
 66 #include "G4VCSGfaceted.hh"
 67 #include "G4PolyconeSide.hh"
 68 #include "G4PolyconeHistorical.hh"
 69 #include "G4Polyhedron.hh"
 70 
 71 class G4EnclosingCylinder;
 72 class G4ReduciblePolygon;
 73 class G4VCSGface;
 74 
 75 class G4Polycone : public G4VCSGfaceted
 76 {
 77   public:
 78 
 79     G4Polycone( const G4String& name,
 80                       G4double phiStart,    // initial phi starting angle
 81                       G4double phiTotal,    // total phi angle
 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     G4Polycone( const G4String& name,
 88                       G4double phiStart,    // initial phi starting angle
 89                       G4double phiTotal,    // total phi angle
 90                       G4int    numRZ,       // number corners in r,z space
 91                 const G4double r[],         // r coordinate of these corners
 92                 const G4double z[]       ); // z coordinate of these corners
 93 
 94     ~G4Polycone() override;
 95 
 96     EInside Inside( const G4ThreeVector& p ) const override;
 97     G4double DistanceToIn( const G4ThreeVector& p,
 98                            const G4ThreeVector& v ) const override;
 99     G4double DistanceToIn( const G4ThreeVector& p ) const override;
100 
101     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
102     G4bool CalculateExtent(const EAxis pAxis,
103                            const G4VoxelLimits& pVoxelLimit,
104                            const G4AffineTransform& pTransform,
105                                  G4double& pmin, G4double& pmax) const override;
106 
107     G4double GetCubicVolume() override;
108     G4double GetSurfaceArea() override;
109 
110     G4ThreeVector GetPointOnSurface() const override;
111 
112     void ComputeDimensions(       G4VPVParameterisation* p,
113                             const G4int n,
114                             const G4VPhysicalVolume* pRep ) override;
115 
116     G4GeometryType GetEntityType() const override;
117 
118     G4VSolid* Clone() const override;
119 
120     std::ostream& StreamInfo(std::ostream& os) const override;
121 
122     G4Polyhedron* CreatePolyhedron() const override;
123 
124     G4bool Reset();
125 
126     // Accessors
127 
128     inline G4double GetStartPhi()    const;
129     inline G4double GetEndPhi()      const;
130     inline G4double GetSinStartPhi() const;
131     inline G4double GetCosStartPhi() const;
132     inline G4double GetSinEndPhi()   const;
133     inline G4double GetCosEndPhi()   const;
134     inline G4bool IsOpen()           const;
135     inline G4int  GetNumRZCorner()   const;
136     inline G4PolyconeSideRZ GetCorner(G4int index) const;
137     inline G4PolyconeHistorical* GetOriginalParameters() const;
138     inline void SetOriginalParameters(G4PolyconeHistorical* pars);
139 
140     G4Polycone(__void__&);
141       // Fake default constructor for usage restricted to direct object
142       // persistency for clients requiring preallocation of memory for
143       // persistifiable objects.
144 
145     G4Polycone( const G4Polycone& source );
146     G4Polycone &operator=( const G4Polycone& source );
147       // Copy constructor and assignment operator.
148 
149   protected:
150 
151     // Generic initializer, called by all constructors
152 
153     G4bool SetOriginalParameters(G4ReduciblePolygon* rz);
154 
155     void Create( G4double phiStart,        // initial phi starting angle
156                  G4double phiTotal,        // total phi angle
157                  G4ReduciblePolygon* rz ); // r/z coordinate of these corners
158 
159     void CopyStuff( const G4Polycone& source );
160 
161     // Methods for random point generation
162 
163     void SetSurfaceElements() const;
164 
165   protected:
166 
167     // Here are our parameters
168 
169     G4double startPhi;        // Starting phi value (0 < phiStart < 2pi)
170     G4double endPhi;          // End phi value (0 < endPhi-phiStart < 2pi)
171     G4bool phiIsOpen = false; // True if there is a phi segment
172     G4int numCorner;          // Number RZ points
173     G4PolyconeSideRZ* corners = nullptr; // Corner r,z points
174     G4PolyconeHistorical* original_parameters = nullptr; // Original input pars
175 
176     G4EnclosingCylinder* enclosingCylinder = nullptr; // Our quick test
177 
178     struct surface_element { G4double area = 0.; G4int i0 = 0, i1 = 0, i2 = 0; };
179     mutable std::vector<surface_element>* fElements = nullptr;
180 };
181 
182 #include "G4Polycone.icc"
183 
184 #endif
185 
186 #endif
187