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