|
|
|||
File indexing completed on 2026-09-23 09:12:04
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 // G4VoxelSafety 0027 // 0028 // Class description: 0029 // 0030 // Utility for isotropic safety in volumes containing only G4PVPlacement 0031 // daughter volumes for which voxels have been constructed. 0032 // Implementation extracted and modified/adapted from G4VoxelNavigation class. 0033 0034 // Author: John Apostolakis (CERN), 30 April 2010 0035 // -------------------------------------------------------------------- 0036 #ifndef G4VOXELSAFETY_HH 0037 #define G4VOXELSAFETY_HH 1 0038 0039 #include "geomdefs.hh" 0040 #include "G4NavigationHistory.hh" 0041 #include "G4AffineTransform.hh" 0042 #include "G4VPhysicalVolume.hh" 0043 #include "G4LogicalVolume.hh" 0044 #include "G4VSolid.hh" 0045 #include "G4ThreeVector.hh" 0046 0047 #include "G4BlockingList.hh" 0048 0049 #include <vector> // Required for voxel handling & voxel stack 0050 0051 class G4SmartVoxelNode; 0052 class G4SmartVoxelHeader; 0053 0054 /** 0055 * @brief G4VoxelSafety is an utility class for the handling isotropic safety 0056 * in volumes containing only G4PVPlacement daughter volumes for which voxels 0057 * have been constructed. 0058 */ 0059 0060 class G4VoxelSafety 0061 { 0062 public: 0063 0064 /** 0065 * Constructor and Destructor. 0066 */ 0067 G4VoxelSafety(); 0068 ~G4VoxelSafety(); 0069 0070 /** 0071 * Calculates the isotropic distance to the nearest boundary from the 0072 * specified point in the local coordinate system. 0073 * The localpoint utilised must be within the current volume. 0074 * @param[in] localPoint Local point. 0075 * @param[in] currentPhysical Current physical volume. 0076 * @param[in] maxLength Maximum length beyond which volumes are not checked. 0077 * @returns Isotropic distance of given point to closest surface. 0078 */ 0079 G4double ComputeSafety( const G4ThreeVector& localPoint, 0080 const G4VPhysicalVolume& currentPhysical, 0081 G4double maxLength = DBL_MAX ); 0082 0083 /** 0084 * Verbosity control. 0085 * @note If level>0 && G4VERBOSE, printout can occur. 0086 */ 0087 inline G4int GetVerboseLevel() const { return fVerbose; } 0088 inline void SetVerboseLevel(G4int level) { fVerbose = level; } 0089 0090 protected: 0091 0092 /** 0093 * Cycles through levels of headers to process each node level. 0094 * @param[in] pHead Voxel header. 0095 * @param[in] localPoint Local point. 0096 * @param[in] maxLength Maximum length beyond which volumes are not checked. 0097 * @param[in] currentPhysical Current volume (used for debug printout). 0098 * @param[in] distUpperDepth Upper square distance from voxel. 0099 * @param[in] previousMinSafety Minimum distance beyond which not to look. 0100 * @returns Isotropic distance of the point to closest volume in all nodes. 0101 */ 0102 G4double SafetyForVoxelHeader( const G4SmartVoxelHeader* pHead, 0103 const G4ThreeVector& localPoint, 0104 G4double maxLength, 0105 const G4VPhysicalVolume& currentPhysical, 0106 G4double distUpperDepth = 0.0, 0107 G4double previousMinSafety = DBL_MAX ); 0108 0109 /** 0110 * Calculates the safety for volumes included in current Voxel Node. 0111 * @param[in] curVoxelNode Voxel node. 0112 * @param[in] localPoint Local point. 0113 * @returns Isotropic distance of given point to closest volume in node. 0114 */ 0115 G4double SafetyForVoxelNode( const G4SmartVoxelNode* curVoxelNode, 0116 const G4ThreeVector& localPoint ); 0117 0118 private: 0119 0120 // ---- BEGIN State - values used during computation of Safety ------------ 0121 0122 /** Blocked volumes */ 0123 G4BlockingList fBlockList; 0124 0125 /** Cached pointer to mother logical volume */ 0126 G4LogicalVolume* fpMotherLogical = nullptr; 0127 0128 // ---- BEGIN Voxel Stack information ------------------------------------- 0129 0130 /** Voxel depth 0131 * @note fVoxelDepth==0+ => fVoxelAxisStack(0+) contains axes of voxel 0132 * fVoxelDepth==-1 -> not in voxel. 0133 */ 0134 G4int fVoxelDepth = -1; 0135 0136 /** Voxel axes */ 0137 std::vector<EAxis> fVoxelAxisStack; 0138 0139 /** No slices per voxel at each level */ 0140 std::vector<G4int> fVoxelNoSlicesStack; 0141 0142 /** Width of voxels at each level */ 0143 std::vector<G4double> fVoxelSliceWidthStack; 0144 0145 /** Node no point is inside at each level */ 0146 std::vector<G4int> fVoxelNodeNoStack; 0147 0148 /** Voxel headers at each level */ 0149 std::vector<const G4SmartVoxelHeader*> fVoxelHeaderStack; 0150 0151 // ----- END Voxel Stack information -------------------------------------- 0152 0153 G4bool fCheck = false; 0154 G4int fVerbose = 0; 0155 G4double kCarTolerance; 0156 }; 0157 0158 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|