Geant4 Cross Reference |
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 // G4Paraboloid 27 // 28 // Class description: 29 // 30 // A G4Paraboloid represents a solid with parabolic profile with possible 31 // cuts along the Z axis. 32 // 33 // Member Data: 34 // 35 // dz z half lenght 36 // r1 radius at -dz 37 // r2 radius at dz 38 // r2 > r1 39 // 40 // Equation for the solid: 41 // rho^2 <= k1 * z + k2; 42 // -dz <= z <= dz 43 // r1^2 = k1 * (-dz) + k2 44 // r2^2 = k1 * ( dz) + k2 45 46 // 10.07.2007, L.Lindroos (CERN) - First implementation 47 // -------------------------------------------------------------------- 48 #ifndef G4PARABOLOID_HH 49 #define G4PARABOLOID_HH 50 51 #include "G4GeomTypes.hh" 52 53 #if defined(G4GEOM_USE_USOLIDS) 54 #define G4GEOM_USE_UPARABOLOID 1 55 #endif 56 57 #if (defined(G4GEOM_USE_UPARABOLOID) && defined(G4GEOM_USE_SYS_USOLIDS)) 58 #define G4UParaboloid G4Paraboloid 59 #include "G4UParaboloid.hh" 60 #else 61 62 #include <CLHEP/Units/PhysicalConstants.h> 63 64 #include "G4VSolid.hh" 65 #include "G4Polyhedron.hh" 66 67 class G4Paraboloid : public G4VSolid 68 { 69 public: 70 71 G4Paraboloid(const G4String& pName, 72 G4double pDz, 73 G4double pR1, 74 G4double pR2); 75 76 ~G4Paraboloid() override; 77 78 // Access functions 79 80 inline G4double GetZHalfLength() const; 81 inline G4double GetRadiusMinusZ() const; 82 inline G4double GetRadiusPlusZ() const; 83 84 inline G4double GetCubicVolume() override; 85 inline G4double GetSurfaceArea() override; 86 inline G4double CalculateSurfaceArea() const; 87 88 // Modifiers functions 89 90 inline void SetZHalfLength(G4double dz); 91 inline void SetRadiusMinusZ(G4double R1); 92 inline void SetRadiusPlusZ(G4double R2); 93 94 // Solid standard methods 95 96 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override; 97 G4bool CalculateExtent(const EAxis pAxis, 98 const G4VoxelLimits& pVoxelLimit, 99 const G4AffineTransform& pTransform, 100 G4double& pmin, G4double& pmax) const override; 101 EInside Inside(const G4ThreeVector& p) const override; 102 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override; 103 G4double DistanceToIn(const G4ThreeVector& p, 104 const G4ThreeVector& v) const override; 105 G4double DistanceToIn(const G4ThreeVector& p) const override; 106 G4double DistanceToOut(const G4ThreeVector& p, 107 const G4ThreeVector& v, 108 const G4bool calcNorm = false, 109 G4bool* validNorm = nullptr, 110 G4ThreeVector* n = nullptr) const override; 111 G4double DistanceToOut(const G4ThreeVector& p) const override; 112 113 G4GeometryType GetEntityType() const override; 114 115 G4VSolid* Clone() const override; 116 117 std::ostream& StreamInfo(std::ostream& os) const override; 118 119 G4ThreeVector GetPointOnSurface() const override; 120 121 // Visualisation functions 122 123 void DescribeYourselfTo(G4VGraphicsScene& scene) const override; 124 G4Polyhedron* CreatePolyhedron() const override; 125 G4Polyhedron* GetPolyhedron () const override; 126 127 G4Paraboloid(__void__&); 128 // Fake default constructor for usage restricted to direct object 129 // persistency for clients requiring preallocation of memory for 130 // persistifiable objects. 131 132 G4Paraboloid(const G4Paraboloid& rhs); 133 G4Paraboloid& operator=(const G4Paraboloid& rhs); 134 // Copy constructor and assignment operator. 135 136 protected: 137 138 mutable G4bool fRebuildPolyhedron = false; 139 mutable G4Polyhedron* fpPolyhedron = nullptr; 140 141 private: 142 143 // Making this mutable to allow GetPointOnSurface to have access to 144 // area function. 145 mutable G4double fSurfaceArea = 0.0; 146 G4double fCubicVolume = 0.0; 147 148 G4double dz, r1, r2; 149 G4double k1, k2; 150 // Defined to make some calculations easier to follow 151 }; 152 153 #include "G4Paraboloid.icc" 154 155 #endif // defined(G4GEOM_USE_UPARABOLOID) && defined(G4GEOM_USE_SYS_USOLIDS) 156 157 #endif // G4Paraboloid_HH 158