|
|
|||
File indexing completed on 2026-09-18 09:14:39
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 // G4TwistTubsFlatSide 0027 // 0028 // Class description: 0029 // 0030 // Class describing a flat boundary surface for a cylinder. 0031 0032 // Author: Kotoyo Hoshina (Chiba University), 01.08.2002 - Created. 0033 // Oliver Link (CERN), 13.11.2003 - Integration in Geant4 0034 // from original version in Jupiter-2.5.02 application. 0035 // -------------------------------------------------------------------- 0036 #ifndef G4TWISTTUBSFLATSIDE_HH 0037 #define G4TWISTTUBSFLATSIDE_HH 0038 0039 #include "G4VTwistSurface.hh" 0040 0041 /** 0042 * @brief G4TwistTubsFlatSide describes a flat boundary surface for a cylinder. 0043 */ 0044 0045 class G4TwistTubsFlatSide : public G4VTwistSurface 0046 { 0047 public: 0048 0049 /** 0050 * Constructs a cylinder flat boundary surface, given its parameters. 0051 * @param[in] name The surface name. 0052 * @param[in] rot Rotation. 0053 * @param[in] tlate Translation. 0054 * @param[in] n Normal vector. 0055 * @param[in] axis0 Rho axis. 0056 * @param[in] axis1 Phi axis. 0057 * @param[in] axis0min Minimum in Rho. 0058 * @param[in] axis1min Minimum in Phi. 0059 * @param[in] axis0max Maximum in Rho. 0060 * @param[in] axis1max Maximum in Phi. 0061 */ 0062 G4TwistTubsFlatSide(const G4String& name, 0063 const G4RotationMatrix& rot, 0064 const G4ThreeVector& tlate, 0065 const G4ThreeVector& n, 0066 const EAxis axis0 = kRho, // RHO axis ! 0067 const EAxis axis1 = kPhi, // PHI axis ! 0068 G4double axis0min = -kInfinity, 0069 G4double axis1min = -kInfinity, 0070 G4double axis0max = kInfinity, 0071 G4double axis1max = kInfinity); 0072 0073 /** 0074 * Alternative Construct for a cylinder flat boundary surface. 0075 * @param[in] name The surface name. 0076 * @param[in] EndInnerRadius Inner-hype radius at z=0. 0077 * @param[in] EndOuterRadius Outer-hype radius at z=0. 0078 * @param[in] DPhi Phi angle. 0079 * @param[in] EndPhi Total Phi. 0080 * @param[in] EndZ Z length. 0081 * @param[in] handedness Orientation: +z = +ve, -z = -ve. 0082 */ 0083 G4TwistTubsFlatSide(const G4String& name, 0084 G4double EndInnerRadius[2], 0085 G4double EndOuterRadius[2], 0086 G4double DPhi, 0087 G4double EndPhi[2], 0088 G4double EndZ[2], 0089 G4int handedness); 0090 0091 /** 0092 * Default destructor. 0093 */ 0094 ~G4TwistTubsFlatSide() override = default; 0095 0096 /** 0097 * Returns a normal vector at a surface (or very close to the surface) 0098 * point at 'p'. 0099 * @param[in] p Not used. Using current normal. 0100 * @param[in] isGlobal If true, it returns the normal in global coordinates. 0101 * @returns The current normal vector. 0102 */ 0103 G4ThreeVector GetNormal(const G4ThreeVector& /* p */ , 0104 G4bool isGlobal = false) override; 0105 0106 /** 0107 * Returns the distance to surface, given point 'gp' and direction 'gv'. 0108 * @param[in] gp The point from where computing the distance. 0109 * @param[in] gv The direction along which computing the distance. 0110 * @param[out] gxx Vector of global points based on number of solutions. 0111 * @param[out] distance The distance vector based on number of solutions. 0112 * @param[out] areacode The location vector based on number of solutions. 0113 * @param[out] isvalid Validity vector based on number of solutions. 0114 * @param[in] validate Adopted validation criteria. 0115 * @returns The number of solutions. 0116 */ 0117 G4int DistanceToSurface(const G4ThreeVector& gp, 0118 const G4ThreeVector& gv, 0119 G4ThreeVector gxx[], 0120 G4double distance[], 0121 G4int areacode[], 0122 G4bool isvalid[], 0123 EValidate validate = kValidateWithTol) override; 0124 0125 /** 0126 * Returns the safety distance to surface, given point 'gp'. 0127 * @param[in] gp The point from where computing the safety distance. 0128 * @param[out] gxx Vector of global points based on number of solutions. 0129 * @param[out] distance The distance vector based on number of solutions. 0130 * @param[out] areacode The location vector based on number of solutions. 0131 * @returns The number of solutions. 0132 */ 0133 G4int DistanceToSurface(const G4ThreeVector& gp, 0134 G4ThreeVector gxx[], 0135 G4double distance[], 0136 G4int areacode[]) override; 0137 0138 /** 0139 * Fake default constructor for usage restricted to direct object 0140 * persistency for clients requiring preallocation of memory for 0141 * persistifiable objects. 0142 */ 0143 G4TwistTubsFlatSide(__void__&); 0144 0145 private: 0146 0147 /** 0148 * Returns point on surface given 'phi' and 'u'. 0149 */ 0150 inline G4ThreeVector SurfacePoint(G4double, G4double, 0151 G4bool isGlobal = false) override; 0152 0153 /** 0154 * Internal accessors. 0155 */ 0156 inline G4double GetBoundaryMin(G4double phi) override; 0157 inline G4double GetBoundaryMax(G4double phi) override; 0158 inline G4double GetSurfaceArea() override { return fSurfaceArea ; } 0159 void GetFacets( G4int m, G4int n, G4double xyz[][3], 0160 G4int faces[][4], G4int iside ) override; 0161 0162 /** 0163 * Returns the area code for point 'xx' using or not surface tolerance. 0164 */ 0165 G4int GetAreaCode(const G4ThreeVector& xx, 0166 G4bool withTol = true) override ; 0167 0168 /** 0169 * Setters. 0170 */ 0171 void SetCorners() override; 0172 void SetBoundaries() override; 0173 0174 private: 0175 0176 G4double fSurfaceArea = 0.0; 0177 }; 0178 0179 //======================================================== 0180 // inline functions 0181 //======================================================== 0182 0183 inline G4ThreeVector G4TwistTubsFlatSide:: 0184 SurfacePoint(G4double phi , G4double rho , G4bool isGlobal ) 0185 { 0186 G4ThreeVector SurfPoint (rho*std::cos(phi) , rho*std::sin(phi) , 0); 0187 0188 if (isGlobal) { return (fRot * SurfPoint + fTrans); } 0189 return SurfPoint; 0190 } 0191 0192 inline 0193 G4double G4TwistTubsFlatSide::GetBoundaryMin(G4double) 0194 { 0195 G4ThreeVector dphimin = GetCorner(sC0Max1Min); 0196 return std::atan2( dphimin.y(), dphimin.x() ); 0197 } 0198 0199 inline 0200 G4double G4TwistTubsFlatSide::GetBoundaryMax(G4double) 0201 { 0202 G4ThreeVector dphimax = GetCorner(sC0Max1Max); 0203 return std::atan2( dphimax.y(), dphimax.x() ); 0204 } 0205 0206 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|