|
|
|||
File indexing completed on 2026-08-02 09:17:31
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4UPolyhedra 0027 // 0028 // Class description: 0029 // 0030 // Wrapper class for G4Polyhedra to make use of VecGeom Polyhedron. 0031 0032 // Author: Gabriele Cosmo (CERN), 31.10.2013 0033 // -------------------------------------------------------------------- 0034 #ifndef G4UPOLYHEDRA_HH 0035 #define G4UPOLYHEDRA_HH 0036 0037 #include "G4UAdapter.hh" 0038 0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) ) 0040 0041 #include <VecGeom/volumes/UnplacedPolyhedron.h> 0042 0043 #include "G4TwoVector.hh" 0044 #include "G4PolyhedraSide.hh" 0045 #include "G4PolyhedraHistorical.hh" 0046 #include "G4Polyhedron.hh" 0047 0048 class G4EnclosingCylinder; 0049 class G4ReduciblePolygon; 0050 0051 /** 0052 * @brief G4UPolyhedra is a wrapper class for G4Polyhedra to make use 0053 * of VecGeom Polyhedron. 0054 */ 0055 0056 class G4UPolyhedra : public G4UAdapter<vecgeom::UnplacedPolyhedron> 0057 { 0058 using Shape_t = vecgeom::UnplacedPolyhedron; 0059 using Base_t = G4UAdapter<vecgeom::UnplacedPolyhedron>; 0060 0061 public: 0062 0063 /** 0064 * Constructs a polyhedra, given its parameters. 0065 * @param[in] name The solid name. 0066 * @param[in] phiStart Initial Phi starting angle. 0067 * @param[in] phiTotal Total Phi angle. 0068 * @param[in] numSide Number of sides. 0069 * @param[in] numZPlanes Number of Z planes. 0070 * @param[in] zPlane Position of Z planes. 0071 * @param[in] rInner Tangent distance to inner surface. 0072 * @param[in] rOuter Tangent distance to outer surface. 0073 */ 0074 G4UPolyhedra( const G4String& name, 0075 G4double phiStart, // initial phi starting angle 0076 G4double phiTotal, // total phi angle 0077 G4int numSide, // number sides 0078 G4int numZPlanes, // number of z planes 0079 const G4double zPlane[], // position of z planes 0080 const G4double rInner[], // tangent distance to inner surface 0081 const G4double rOuter[] ); // tangent distance to outer surface 0082 0083 /** 0084 * Alternative constructor of a polyhedra, given corners coordinates. 0085 * @param[in] name The solid name. 0086 * @param[in] phiStart Initial Phi starting angle. 0087 * @param[in] phiTotal Total Phi angle. 0088 * @param[in] numSide Number of sides. 0089 * @param[in] numRZ Number of corners in r,Z space. 0090 * @param[in] r r coordinates of corners. 0091 * @param[in] z Z coordinates of corners. 0092 */ 0093 G4UPolyhedra( const G4String& name, 0094 G4double phiStart, // initial phi starting angle 0095 G4double phiTotal, // total phi angle 0096 G4int numSide, // number sides 0097 G4int numRZ, // number corners in r,z space 0098 const G4double r[], // r coordinate of these corners 0099 const G4double z[] ); // z coordinate of these corners 0100 0101 /** 0102 * Default destructor. 0103 */ 0104 ~G4UPolyhedra() override = default; 0105 0106 /** 0107 * Dispatch method for parameterisation replication mechanism and 0108 * dimension computation. 0109 */ 0110 void ComputeDimensions(G4VPVParameterisation* p, 0111 const G4int n, 0112 const G4VPhysicalVolume* pRep) override; 0113 0114 /** 0115 * Makes a clone of the object for use in multi-treading. 0116 * @returns A pointer to the new cloned allocated solid. 0117 */ 0118 G4VSolid* Clone() const override; 0119 0120 /** 0121 * Accessors. 0122 */ 0123 G4int GetNumSide() const; 0124 G4double GetStartPhi() const; 0125 G4double GetEndPhi() const; 0126 G4double GetSinStartPhi() const; 0127 G4double GetCosStartPhi() const; 0128 G4double GetSinEndPhi() const; 0129 G4double GetCosEndPhi() const; 0130 G4bool IsOpen() const; 0131 G4bool IsGeneric() const; 0132 G4int GetNumRZCorner() const; 0133 G4PolyhedraSideRZ GetCorner( const G4int index ) const; 0134 G4PolyhedraHistorical* GetOriginalParameters() const; 0135 0136 /** 0137 * Modifier. 0138 */ 0139 void SetOriginalParameters(G4PolyhedraHistorical* pars); 0140 0141 /** 0142 * Clears all parameters and rebuild the shape, for use in divisions. 0143 */ 0144 G4bool Reset(); 0145 0146 /** 0147 * Returns the type ID, "G4Polyhedra" of the solid. 0148 */ 0149 inline G4GeometryType GetEntityType() const override; 0150 0151 /** 0152 * Returns true as the solid has only planar faces. 0153 */ 0154 inline G4bool IsFaceted() const override; 0155 0156 /** 0157 * Computes the bounding limits of the solid. 0158 * @param[out] pMin The minimum bounding limit point. 0159 * @param[out] pMax The maximum bounding limit point. 0160 */ 0161 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override; 0162 0163 /** 0164 * Calculates the minimum and maximum extent of the solid, when under the 0165 * specified transform, and within the specified limits. 0166 * @param[in] pAxis The axis along which compute the extent. 0167 * @param[in] pVoxelLimit The limiting space dictated by voxels. 0168 * @param[in] pTransform The internal transformation applied to the solid. 0169 * @param[out] pMin The minimum extent value. 0170 * @param[out] pMax The maximum extent value. 0171 * @returns True if the solid is intersected by the extent region. 0172 */ 0173 G4bool CalculateExtent(const EAxis pAxis, 0174 const G4VoxelLimits& pVoxelLimit, 0175 const G4AffineTransform& pTransform, 0176 G4double& pMin, G4double& pMax) const override; 0177 0178 /** 0179 * Returns a generated polyhedron as graphical representations. 0180 */ 0181 G4Polyhedron* CreatePolyhedron() const override; 0182 0183 /** 0184 * Copy constructor and assignment operator. 0185 */ 0186 G4UPolyhedra( const G4UPolyhedra& source ); 0187 G4UPolyhedra& operator=( const G4UPolyhedra& source ); 0188 0189 private: 0190 0191 /** 0192 * Sets internal parameters for the generic constructor. 0193 */ 0194 void SetOriginalParameters(); 0195 0196 private: 0197 0198 G4bool fGenericPgon; // true if created through the 2nd generic constructor 0199 G4PolyhedraHistorical fOriginalParameters; // original input parameters 0200 0201 G4double wrStart; 0202 G4double wrDelta; 0203 G4int wrNumSide; 0204 std::vector<G4TwoVector> rzcorners; 0205 }; 0206 0207 // -------------------------------------------------------------------- 0208 // Inline methods 0209 // -------------------------------------------------------------------- 0210 0211 inline G4GeometryType G4UPolyhedra::GetEntityType() const 0212 { 0213 return "G4Polyhedra"; 0214 } 0215 0216 inline G4bool G4UPolyhedra::IsFaceted() const 0217 { 0218 return true; 0219 } 0220 0221 #endif // G4GEOM_USE_USOLIDS 0222 0223 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|