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 | // |
---|
27 | // $Id: G4VoxelNavigation.hh,v 1.8 2010/11/04 12:13:30 japost Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // class G4VoxelNavigation |
---|
32 | // |
---|
33 | // Class description: |
---|
34 | // |
---|
35 | // Utility for navigation in volumes containing only G4PVPlacement |
---|
36 | // daughter volumes for which voxels have been constructed. |
---|
37 | |
---|
38 | // History: |
---|
39 | // - Created. Paul Kent, Aug 96 |
---|
40 | // -------------------------------------------------------------------- |
---|
41 | #ifndef G4VOXELNAVIGATION_HH |
---|
42 | #define G4VOXELNAVIGATION_HH |
---|
43 | |
---|
44 | #include "geomdefs.hh" |
---|
45 | #include "G4NavigationHistory.hh" |
---|
46 | #include "G4NavigationLogger.hh" |
---|
47 | #include "G4AffineTransform.hh" |
---|
48 | #include "G4VPhysicalVolume.hh" |
---|
49 | #include "G4LogicalVolume.hh" |
---|
50 | #include "G4VSolid.hh" |
---|
51 | #include "G4ThreeVector.hh" |
---|
52 | |
---|
53 | #include "G4BlockingList.hh" |
---|
54 | |
---|
55 | class G4VoxelSafety; |
---|
56 | |
---|
57 | // Required for inline implementation |
---|
58 | // |
---|
59 | #include "G4AuxiliaryNavServices.hh" |
---|
60 | |
---|
61 | // Required for voxel handling & voxel stack |
---|
62 | // |
---|
63 | #include <vector> |
---|
64 | #include "G4SmartVoxelProxy.hh" |
---|
65 | #include "G4SmartVoxelNode.hh" |
---|
66 | #include "G4SmartVoxelHeader.hh" |
---|
67 | |
---|
68 | class G4VoxelNavigation |
---|
69 | { |
---|
70 | public: // with description |
---|
71 | |
---|
72 | G4VoxelNavigation(); |
---|
73 | virtual ~G4VoxelNavigation(); |
---|
74 | |
---|
75 | G4SmartVoxelNode* VoxelLocate( G4SmartVoxelHeader* pHead, |
---|
76 | const G4ThreeVector& localPoint ); |
---|
77 | |
---|
78 | virtual G4bool LevelLocate( G4NavigationHistory& history, |
---|
79 | const G4VPhysicalVolume* blockedVol, |
---|
80 | const G4int blockedNum, |
---|
81 | const G4ThreeVector& globalPoint, |
---|
82 | const G4ThreeVector* globalDirection, |
---|
83 | const G4bool pLocatedOnEdge, |
---|
84 | G4ThreeVector& localPoint ); |
---|
85 | |
---|
86 | virtual G4double ComputeStep( const G4ThreeVector& globalPoint, |
---|
87 | const G4ThreeVector& globalDirection, |
---|
88 | const G4double currentProposedStepLength, |
---|
89 | G4double& newSafety, |
---|
90 | G4NavigationHistory& history, |
---|
91 | G4bool& validExitNormal, |
---|
92 | G4ThreeVector& exitNormal, |
---|
93 | G4bool& exiting, |
---|
94 | G4bool& entering, |
---|
95 | G4VPhysicalVolume *(*pBlockedPhysical), |
---|
96 | G4int& blockedReplicaNo ); |
---|
97 | |
---|
98 | virtual G4double ComputeSafety( const G4ThreeVector& globalpoint, |
---|
99 | const G4NavigationHistory& history, |
---|
100 | const G4double pMaxLength=DBL_MAX ); |
---|
101 | |
---|
102 | inline G4int GetVerboseLevel() const; |
---|
103 | void SetVerboseLevel(G4int level); |
---|
104 | // Get/Set Verbose(ness) level. |
---|
105 | // [if level>0 && G4VERBOSE, printout can occur] |
---|
106 | |
---|
107 | inline void CheckMode(G4bool mode); |
---|
108 | // Run navigation in "check-mode", therefore using additional |
---|
109 | // verifications and more strict correctness conditions. |
---|
110 | // Is effective only with G4VERBOSE set. |
---|
111 | |
---|
112 | inline void EnableBestSafety( G4bool flag= false ); |
---|
113 | // Enable best-possible evaluation of isotropic safety |
---|
114 | |
---|
115 | protected: |
---|
116 | |
---|
117 | G4double ComputeVoxelSafety( const G4ThreeVector& localPoint ) const; |
---|
118 | G4bool LocateNextVoxel( const G4ThreeVector& localPoint, |
---|
119 | const G4ThreeVector& localDirection, |
---|
120 | const G4double currentStep ); |
---|
121 | |
---|
122 | G4SmartVoxelNode* VoxelLocateLight( G4SmartVoxelHeader* pHead, |
---|
123 | const G4ThreeVector& localPoint ) const; |
---|
124 | |
---|
125 | private: // Logging functions |
---|
126 | |
---|
127 | void PreComputeStepLog (const G4VPhysicalVolume* motherPhysical, |
---|
128 | G4double motherSafety, |
---|
129 | const G4ThreeVector& localPoint); |
---|
130 | void AlongComputeStepLog(const G4VSolid* sampleSolid, |
---|
131 | const G4ThreeVector& samplePoint, |
---|
132 | const G4ThreeVector& sampleDirection, |
---|
133 | const G4ThreeVector& localDirection, |
---|
134 | G4double sampleSafety, |
---|
135 | G4double sampleStep); |
---|
136 | void PostComputeStepLog (const G4VSolid* motherSolid, |
---|
137 | const G4ThreeVector& localPoint, |
---|
138 | const G4ThreeVector& localDirection, |
---|
139 | G4double motherStep, |
---|
140 | G4double motherSafety); |
---|
141 | void ComputeSafetyLog (const G4VSolid* solid, |
---|
142 | const G4ThreeVector& point, |
---|
143 | G4double safety, |
---|
144 | G4bool banner); |
---|
145 | inline void PrintDaughterLog (const G4VSolid* sampleSolid, |
---|
146 | const G4ThreeVector& samplePoint, |
---|
147 | G4double sampleSafety, |
---|
148 | G4double sampleStep); |
---|
149 | protected: |
---|
150 | |
---|
151 | G4BlockingList fBList; |
---|
152 | // Blocked volumes |
---|
153 | |
---|
154 | // |
---|
155 | // BEGIN Voxel Stack information |
---|
156 | // |
---|
157 | |
---|
158 | G4int fVoxelDepth; |
---|
159 | // Note: fVoxelDepth==0+ => fVoxelAxisStack(0+) contains axes of voxel |
---|
160 | // fVoxelDepth==-1 -> not in voxel |
---|
161 | |
---|
162 | std::vector<EAxis> fVoxelAxisStack; |
---|
163 | // Voxel axes |
---|
164 | |
---|
165 | std::vector<G4int> fVoxelNoSlicesStack; |
---|
166 | // No slices per voxel at each level |
---|
167 | |
---|
168 | std::vector<G4double> fVoxelSliceWidthStack; |
---|
169 | // Width of voxels at each level |
---|
170 | |
---|
171 | std::vector<G4int> fVoxelNodeNoStack; |
---|
172 | // Node no point is inside at each level |
---|
173 | |
---|
174 | std::vector<G4SmartVoxelHeader*> fVoxelHeaderStack; |
---|
175 | // Voxel headers at each level |
---|
176 | |
---|
177 | G4SmartVoxelNode* fVoxelNode; |
---|
178 | // Node containing last located point |
---|
179 | |
---|
180 | // |
---|
181 | // END Voxel Stack information |
---|
182 | // |
---|
183 | |
---|
184 | G4VoxelSafety *fpVoxelSafety; |
---|
185 | // Helper object for Voxel Safety |
---|
186 | |
---|
187 | G4bool fCheck; |
---|
188 | G4bool fBestSafety; |
---|
189 | |
---|
190 | G4NavigationLogger* fLogger; |
---|
191 | // Verbosity logger |
---|
192 | }; |
---|
193 | |
---|
194 | #include "G4VoxelNavigation.icc" |
---|
195 | |
---|
196 | #endif |
---|