75 const G4double currentProposedStepLength,
83 G4int& blockedReplicaNo)
90 G4double ourStep=currentProposedStepLength, ourSafety;
92 G4bool motherValidExitNormal =
false;
97 G4bool initialNode, noStep;
99 G4int curNoVolumes, contentNo;
111 motherSolid = motherLogical->
GetSolid();
118 ourSafety = motherSafety;
123 if( motherSafety < 0.0 )
127 message <<
"Negative Safety In Voxel Navigation !" <<
G4endl
128 <<
" Current solid " << motherSolid->
GetName()
129 <<
" gave negative safety: " << motherSafety <<
G4endl
130 <<
" for the current (local) point " << localPoint;
131 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
137 message <<
"Point is outside Current Volume !" <<
G4endl
138 <<
" Point " << localPoint
139 <<
" is outside current volume " << motherPhysical->
GetName()
142 G4cout <<
" Estimated isotropic distance to solid (distToIn)= "
144 if( estDistToSolid > 100.0 * motherSolid->
GetTolerance() )
147 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
149 "Point is far outside Current Volume !");
153 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
155 "Point is a little outside Current Volume.");
167 &motherValidExitNormal,
170 if( (motherStep >=
kInfinity) || (motherStep < 0.0) )
176 ourStep = motherStep = 0.0;
181 validExitNormal = motherValidExitNormal;
182 exitNormal = motherExitNormal;
184 *pBlockedPhysical =
nullptr;
185 blockedReplicaNo = 0;
206 if (exiting && (*pBlockedPhysical==samplePhysical) && validExitNormal)
228 for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
230 sampleNo = curVoxelNode->
GetVolume(contentNo);
243 const G4ThreeVector samplePoint = sampleTf.TransformPoint(localPoint);
245 if ( sampleSafety<ourSafety )
247 ourSafety = sampleSafety;
249 if ( sampleSafety<=ourStep )
251 sampleDirection = sampleTf.TransformAxis(localDirection);
253 sampleSolid->
DistanceToIn(samplePoint, sampleDirection);
254 if ( sampleStep<=ourStep )
256 ourStep = sampleStep;
259 *pBlockedPhysical = samplePhysical;
260 blockedReplicaNo = sampleNo;
269 intersectionPoint = samplePoint + sampleStep * sampleDirection;
270 EInside insideIntPt = sampleSolid->
Inside(intersectionPoint);
275 message <<
"Navigator gets conflicting response from Solid."
277 <<
" Inaccurate solid DistanceToIn"
279 <<
" Solid gave DistanceToIn = "
280 << sampleStep <<
" yet returns " ;
282 message <<
"-kInside-";
284 message <<
"-kOutside-";
286 message <<
"-kSurface-";
287 message <<
" for this point !" <<
G4endl
288 <<
" Point = " << intersectionPoint
291 message <<
" DistanceToIn(p) = "
294 message <<
" DistanceToOut(p) = "
296 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
298 G4cout.precision(oldcoutPrec);
311 if ( voxelSafety<ourSafety )
313 ourSafety = voxelSafety;
315 if ( currentProposedStepLength<ourSafety )
322 *pBlockedPhysical =
nullptr;
329 if ( motherSafety<=ourStep )
336 &motherValidExitNormal,
340 if( ( motherStep < 0.0 ) || ( motherStep >=
kInfinity) )
346 ourStep = motherStep = 0.0;
352 if( motherValidExitNormal && (
fCheck || (motherStep<=ourStep)) )
355 localPoint, localDirection,
356 motherStep, motherSolid,
357 "From motherSolid::DistanceToOut");
360 if ( motherStep<=ourStep )
362 ourStep = motherStep;
365 if ( validExitNormal )
376 validExitNormal =
false;
380 newSafety = ourSafety;
403 G4VSolid *motherSolid, *sampleSolid;
405 G4int sampleNo, curVoxelNodeNo;
408 G4int curNoVolumes, contentNo;
420 motherSolid = motherLogical->
GetSolid();
427 ourSafety = motherSafety;
438 width, offset, consuming);
457 for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
459 sampleNo = curVoxelNode->
GetVolume(contentNo);
468 const G4ThreeVector samplePoint = sampleTf.TransformPoint(localPoint);
470 if ( sampleSafety<ourSafety )
472 ourSafety = sampleSafety;
477 if ( voxelSafety<ourSafety )
479 ourSafety=voxelSafety;
494 const EAxis pAxis)
const
504 G4double voxelSafety, plusVoxelSafety, minusVoxelSafety;
505 G4double curNodeOffset, minCurCommonDelta, maxCurCommonDelta;
506 G4int minCurNodeNoDelta, maxCurNodeNoDelta;
516 maxCurCommonDelta = fVoxelSliceWidth-minCurCommonDelta;
517 plusVoxelSafety = minCurNodeNoDelta*fVoxelSliceWidth+minCurCommonDelta;
518 minusVoxelSafety = maxCurNodeNoDelta*fVoxelSliceWidth+maxCurCommonDelta;
519 voxelSafety =
std::min(plusVoxelSafety,minusVoxelSafety);
558 G4double minVal, maxVal, curMinExtent, curCoord;
565 if ( minVal<=curCoord )
567 maxVal = curMinExtent
569 if ( maxVal<curCoord )
604 const G4int blockedNum,
607 const G4bool pLocatedOnEdge,
617 G4int voxelNoDaughters, replicaNo;
628 if ( voxelNoDaughters==0 ) {
return false; }
640 for (
auto sampleNo=voxelNoDaughters-1; sampleNo>=0; sampleNo-- )
642 replicaNo = motherVoxelNode->
GetVolume(sampleNo);
643 if ( (replicaNo!=blockedNum) || (pPhysical!=blockedVol) )
662 localPoint = samplePoint;
673 pPhysical, &parentTouchable) );