|
|
|||
File indexing completed on 2026-09-11 09:11:02
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 // G4EllipticalTube 0027 // 0028 // Class description: 0029 // 0030 // A tube with elliptical cross section: 0031 // 0032 // G4EllipticalTube( const G4String& name, 0033 // G4double Dx, 0034 // G4double Dy, 0035 // G4double Dz ) 0036 // 0037 // The equation of the lateral surface is: (x/dx)^2 + (y/dy)^2 = 1 0038 0039 // Author: David C. Williams (UCSC), 29.03.2000 - First implementation 0040 // Evgueni Tcherniaev (CERN), 23.12.2019 - Revised 0041 // -------------------------------------------------------------------- 0042 #ifndef G4ELLIPTICALTUBE_HH 0043 #define G4ELLIPTICALTUBE_HH 0044 0045 #include "G4GeomTypes.hh" 0046 0047 #if defined(G4GEOM_USE_USOLIDS) 0048 #define G4GEOM_USE_UELLIPTICALTUBE 1 0049 #endif 0050 0051 #if (defined(G4GEOM_USE_UELLIPTICALTUBE) && defined(G4GEOM_USE_SYS_USOLIDS)) 0052 #define G4UEllipticalTube G4EllipticalTube 0053 #include "G4UEllipticalTube.hh" 0054 #else 0055 0056 #include "G4VSolid.hh" 0057 #include "G4Polyhedron.hh" 0058 0059 /** 0060 * @brief G4EllipticalTube is a tube with elliptical cross section. 0061 * The equation of the lateral surface is: (x/dx)^2 + (y/dy)^2 = 1. 0062 */ 0063 0064 class G4EllipticalTube : public G4VSolid 0065 { 0066 public: 0067 0068 /** 0069 * Constructs an elliptical tube, given its parameters. 0070 * @param[in] name The solid name. 0071 * @param[in] Dx Half length of axis along X. 0072 * @param[in] Dy Half length of axis along Y. 0073 * @param[in] Dz Half length in Z. 0074 */ 0075 G4EllipticalTube( const G4String& name, 0076 G4double Dx, 0077 G4double Dy, 0078 G4double Dz ); 0079 0080 /** 0081 * Destructor. 0082 */ 0083 ~G4EllipticalTube() override; 0084 0085 /** 0086 * Accessors. 0087 */ 0088 inline G4double GetDx() const; 0089 inline G4double GetDy() const; 0090 inline G4double GetDz() const; 0091 0092 /** 0093 * Modifiers. 0094 */ 0095 inline void SetDx( G4double Dx ); 0096 inline void SetDy( G4double Dy ); 0097 inline void SetDz( G4double Dz ); 0098 0099 /** 0100 * Computes the bounding limits of the solid. 0101 * @param[out] pMin The minimum bounding limit point. 0102 * @param[out] pMax The maximum bounding limit point. 0103 */ 0104 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override; 0105 0106 /** 0107 * Calculates the minimum and maximum extent of the solid, when under the 0108 * specified transform, and within the specified limits. 0109 * @param[in] pAxis The axis along which compute the extent. 0110 * @param[in] pVoxelLimit The limiting space dictated by voxels. 0111 * @param[in] pTransform The internal transformation applied to the solid. 0112 * @param[out] pMin The minimum extent value. 0113 * @param[out] pMax The maximum extent value. 0114 * @returns True if the solid is intersected by the extent region. 0115 */ 0116 G4bool CalculateExtent(const EAxis pAxis, 0117 const G4VoxelLimits& pVoxelLimit, 0118 const G4AffineTransform& pTransform, 0119 G4double& pmin, G4double& pmax) const override; 0120 0121 /** 0122 * Concrete implementations of the expected query interfaces for 0123 * solids, as defined in the base class G4VSolid. 0124 */ 0125 EInside Inside( const G4ThreeVector& p ) const override; 0126 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override; 0127 G4double DistanceToIn( const G4ThreeVector& p, 0128 const G4ThreeVector& v ) const override; 0129 G4double DistanceToIn( const G4ThreeVector& p ) const override; 0130 G4double DistanceToOut( const G4ThreeVector& p, 0131 const G4ThreeVector& v, 0132 const G4bool calcNorm = false, 0133 G4bool* validNorm = nullptr, 0134 G4ThreeVector* n = nullptr ) const override; 0135 G4double DistanceToOut( const G4ThreeVector& p ) const override; 0136 0137 /** 0138 * Returns the type ID, "G4EllipticalTube" of the solid. 0139 */ 0140 G4GeometryType GetEntityType() const override; 0141 0142 /** 0143 * Makes a clone of the object for use in multi-treading. 0144 * @returns A pointer to the new cloned allocated solid. 0145 */ 0146 G4VSolid* Clone() const override; 0147 0148 /** 0149 * Streams the object contents to an output stream. 0150 */ 0151 std::ostream& StreamInfo(std::ostream& os) const override; 0152 0153 /** 0154 * Returning an estimation of the solid volume (capacity) and 0155 * surface area, in internal units. 0156 */ 0157 G4double GetCubicVolume() override; 0158 G4double GetSurfaceArea() override; 0159 0160 /** 0161 * Returns a random point located and uniformly distributed on the 0162 * surface of the solid. 0163 */ 0164 G4ThreeVector GetPointOnSurface() const override; 0165 0166 /** 0167 * Methods for creating graphical representations (i.e. for visualisation). 0168 */ 0169 G4Polyhedron* CreatePolyhedron() const override; 0170 G4Polyhedron* GetPolyhedron() const override; 0171 void DescribeYourselfTo( G4VGraphicsScene& scene ) const override; 0172 G4VisExtent GetExtent() const override; 0173 0174 /** 0175 * Fake default constructor for usage restricted to direct object 0176 * persistency for clients requiring preallocation of memory for 0177 * persistifiable objects. 0178 */ 0179 G4EllipticalTube(__void__&); 0180 0181 /** 0182 * Copy constructor and assignment operator. 0183 */ 0184 G4EllipticalTube(const G4EllipticalTube& rhs); 0185 G4EllipticalTube& operator=(const G4EllipticalTube& rhs); 0186 0187 private: 0188 0189 /** 0190 * Checks parameters and sets pre-calculated values. 0191 */ 0192 void CheckParameters(); 0193 0194 /** 0195 * Algorithm for SurfaceNormal() following the original 0196 * specification for points not on the surface. 0197 */ 0198 G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const; 0199 0200 /** 0201 * Calculates the surface area and caches it. 0202 */ 0203 G4double GetCachedSurfaceArea() const; 0204 0205 private: 0206 0207 G4double halfTolerance; 0208 0209 G4double fDx; // semi-axis in X 0210 G4double fDy; // semi-axis in Y 0211 G4double fDz; // half length in Z 0212 0213 G4double fCubicVolume = 0.0; // volume 0214 G4double fSurfaceArea = 0.0; // surface area 0215 0216 /** Cached pre-calculated values. */ 0217 G4double fRsph; // R of bounding sphere 0218 G4double fDDx; // Dx squared 0219 G4double fDDy; // Dy squared 0220 G4double fSx; // X scale factor 0221 G4double fSy; // Y scale factor 0222 G4double fR; // resulting Radius, after scaling elipse to circle 0223 G4double fQ1; // distance approximation : dist = Q1*(x^2 + y^2) - Q2 0224 G4double fQ2; // distance approximation : dist = Q1*(x^2 + y^2) - Q2 0225 G4double fScratch; // half length of scratching segment squared 0226 0227 mutable G4bool fRebuildPolyhedron = false; 0228 mutable G4Polyhedron* fpPolyhedron = nullptr; 0229 }; 0230 0231 #include "G4EllipticalTube.icc" 0232 0233 #endif // defined(G4GEOM_USE_UELLIPTICALTUBE) && defined(G4GEOM_USE_SYS_USOLIDS) 0234 0235 #endif // G4ELLIPTICALTUBE_HH
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|