Warning, file /include/Geant4/G4VoxelNavigation.icc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 inline
0035 G4SmartVoxelNode*
0036 G4VoxelNavigation::VoxelLocate( G4SmartVoxelHeader* pHead,
0037 const G4ThreeVector& localPoint )
0038 {
0039 G4SmartVoxelHeader* targetVoxelHeader = pHead;
0040 G4SmartVoxelNode* targetVoxelNode = nullptr;
0041 G4SmartVoxelProxy* sampleProxy;
0042 EAxis targetHeaderAxis;
0043 G4double targetHeaderMin, targetHeaderNodeWidth;
0044 G4int targetHeaderNoSlices, targetNodeNo;
0045
0046 fVoxelDepth = 0;
0047
0048 while ( targetVoxelNode == nullptr )
0049 {
0050 targetHeaderAxis = targetVoxelHeader->GetAxis();
0051 targetHeaderNoSlices = G4int(targetVoxelHeader->GetNoSlices());
0052 targetHeaderMin = targetVoxelHeader->GetMinExtent();
0053 targetHeaderNodeWidth = (targetVoxelHeader->GetMaxExtent()-targetHeaderMin)
0054 / targetHeaderNoSlices;
0055 targetNodeNo = G4int( (localPoint(targetHeaderAxis)-targetHeaderMin)
0056 / targetHeaderNodeWidth);
0057
0058
0059 if ( targetNodeNo<0 )
0060 {
0061 targetNodeNo = 0;
0062 }
0063 else if ( targetNodeNo>=targetHeaderNoSlices )
0064 {
0065 targetNodeNo = targetHeaderNoSlices-1;
0066 }
0067
0068
0069 fVoxelAxisStack[fVoxelDepth] = targetHeaderAxis;
0070 fVoxelNoSlicesStack[fVoxelDepth] = targetHeaderNoSlices;
0071 fVoxelSliceWidthStack[fVoxelDepth] = targetHeaderNodeWidth;
0072 fVoxelNodeNoStack[fVoxelDepth] = targetNodeNo;
0073 fVoxelHeaderStack[fVoxelDepth] = targetVoxelHeader;
0074 sampleProxy = targetVoxelHeader->GetSlice(targetNodeNo);
0075
0076 if ( sampleProxy->IsNode() )
0077 {
0078 targetVoxelNode = sampleProxy->GetNode();
0079 }
0080 else
0081 {
0082 targetVoxelHeader = sampleProxy->GetHeader();
0083 ++fVoxelDepth;
0084 }
0085 }
0086 fVoxelNode = targetVoxelNode;
0087 return targetVoxelNode;
0088 }
0089
0090
0091
0092
0093
0094 inline
0095 G4bool
0096 G4VoxelNavigation::LevelLocate( G4NavigationHistory& history,
0097 const G4VPhysicalVolume* blockedVol,
0098 const G4int,
0099 const G4ThreeVector& globalPoint,
0100 const G4ThreeVector* globalDirection,
0101 const G4bool pLocatedOnEdge,
0102 G4ThreeVector& localPoint )
0103 {
0104 G4SmartVoxelHeader *targetVoxelHeader;
0105 G4SmartVoxelNode *targetVoxelNode;
0106 G4VPhysicalVolume *targetPhysical, *samplePhysical;
0107 G4LogicalVolume *targetLogical;
0108 G4VSolid *sampleSolid;
0109 G4ThreeVector samplePoint;
0110 G4int targetNoDaughters;
0111
0112 targetPhysical = history.GetTopVolume();
0113 targetLogical = targetPhysical->GetLogicalVolume();
0114 targetVoxelHeader = targetLogical->GetVoxelHeader();
0115
0116
0117
0118 targetVoxelNode = VoxelLocate(targetVoxelHeader,localPoint);
0119
0120 targetNoDaughters = G4int(targetVoxelNode->GetNoContained());
0121 if ( targetNoDaughters==0 ) { return false; }
0122
0123
0124
0125
0126
0127 for ( auto sampleNo=targetNoDaughters-1; sampleNo>=0; sampleNo-- )
0128 {
0129 samplePhysical = targetLogical->
0130 GetDaughter(targetVoxelNode->GetVolume(sampleNo));
0131 if ( samplePhysical!=blockedVol )
0132 {
0133
0134
0135 history.NewLevel(samplePhysical, kNormal, samplePhysical->GetCopyNo());
0136 sampleSolid = samplePhysical->GetLogicalVolume()->GetSolid();
0137 samplePoint = history.GetTopTransform().TransformPoint(globalPoint);
0138
0139 if( G4AuxiliaryNavServices::CheckPointOnSurface(sampleSolid,
0140 samplePoint,
0141 globalDirection,
0142 history.GetTopTransform(),
0143 pLocatedOnEdge) )
0144 {
0145
0146
0147 localPoint = samplePoint;
0148 return true;
0149 }
0150 history.BackLevel();
0151 }
0152 }
0153 return false;
0154 }
0155
0156
0157
0158
0159
0160 inline
0161 G4int G4VoxelNavigation::GetVerboseLevel() const
0162 {
0163 return fLogger->GetVerboseLevel();
0164 }
0165
0166
0167
0168
0169
0170 inline
0171 void G4VoxelNavigation::EnableBestSafety(G4bool flag)
0172 {
0173 fBestSafety = flag;
0174 }