Import Geant4 10.3.1 source tree
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
$Id: History 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
$Id: History 102530 2017-02-08 13:41:59Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -20,6 +20,11 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
February 2, 2017 G. Cosmo geom-bool-V10-02-12
|
||||
- Return normal from solid being subtracted, in case point is located
|
||||
outside in G4SubtractionSolid::SurfaceNormal().
|
||||
- Code formatting and minor cleanup in G4IntersectionSolid.
|
||||
|
||||
November 4, 2016 E. Tcherniaev geom-bool-V10-02-11
|
||||
- Implemented Extent() method for all shapes/constructs and use it
|
||||
in CalculateExtent().
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IntersectionSolid.cc 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
// $Id: G4IntersectionSolid.cc 102530 2017-02-08 13:41:59Z gcosmo $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -258,28 +258,22 @@ G4IntersectionSolid::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
}
|
||||
#endif
|
||||
|
||||
// OLD: if(fPtrSolidA->DistanceToOut(p) <= fPtrSolidB->DistanceToOut(p) )
|
||||
|
||||
// On the surface of both is difficult ... treat it like on A now!
|
||||
//
|
||||
// if( (insideA == kSurface) && (insideB == kSurface) )
|
||||
// normal= fPtrSolidA->SurfaceNormal(p) ;
|
||||
// else
|
||||
if( insideA == kSurface )
|
||||
{
|
||||
normal= fPtrSolidA->SurfaceNormal(p) ;
|
||||
}
|
||||
{
|
||||
normal= fPtrSolidA->SurfaceNormal(p) ;
|
||||
}
|
||||
else if( insideB == kSurface )
|
||||
{
|
||||
normal= fPtrSolidB->SurfaceNormal(p) ;
|
||||
}
|
||||
// We are on neither surface, so we should generate an exception
|
||||
else
|
||||
{
|
||||
if(fPtrSolidA->DistanceToOut(p) <= fPtrSolidB->DistanceToOut(p) )
|
||||
normal= fPtrSolidA->SurfaceNormal(p) ;
|
||||
else
|
||||
normal= fPtrSolidB->SurfaceNormal(p) ;
|
||||
{
|
||||
normal= fPtrSolidB->SurfaceNormal(p) ;
|
||||
}
|
||||
else // We are on neither surface, so we should generate an exception
|
||||
{
|
||||
if(fPtrSolidA->DistanceToOut(p) <= fPtrSolidB->DistanceToOut(p) )
|
||||
normal= fPtrSolidA->SurfaceNormal(p) ;
|
||||
else
|
||||
normal= fPtrSolidB->SurfaceNormal(p) ;
|
||||
#ifdef G4BOOLDEBUG
|
||||
G4cout << "WARNING - Invalid call in "
|
||||
<< "G4IntersectionSolid::SurfaceNormal(p)" << G4endl
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SubtractionSolid.cc 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
// $Id: G4SubtractionSolid.cc 102530 2017-02-08 13:41:59Z gcosmo $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -221,8 +221,11 @@ G4ThreeVector
|
||||
G4SubtractionSolid::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4ThreeVector normal;
|
||||
EInside insideThis= Inside(p);
|
||||
if( insideThis == kOutside )
|
||||
|
||||
EInside InsideA = fPtrSolidA->Inside(p);
|
||||
EInside InsideB = fPtrSolidB->Inside(p);
|
||||
|
||||
if( InsideA == kOutside )
|
||||
{
|
||||
#ifdef G4BOOLDEBUG
|
||||
G4cout << "WARNING - Invalid call [1] in "
|
||||
@@ -234,46 +237,41 @@ G4SubtractionSolid::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
<< " Point p is outside !" << G4endl;
|
||||
G4cerr << " p = " << p << G4endl;
|
||||
#endif
|
||||
normal = fPtrSolidA->SurfaceNormal(p) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
EInside InsideA = fPtrSolidA->Inside(p);
|
||||
EInside InsideB = fPtrSolidB->Inside(p);
|
||||
|
||||
if( InsideA == kSurface &&
|
||||
InsideB != kInside )
|
||||
else if( InsideA == kSurface &&
|
||||
InsideB != kInside )
|
||||
{
|
||||
normal = fPtrSolidA->SurfaceNormal(p) ;
|
||||
}
|
||||
else if( InsideA == kInside &&
|
||||
InsideB != kOutside )
|
||||
{
|
||||
normal = -fPtrSolidB->SurfaceNormal(p) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( fPtrSolidA->DistanceToOut(p) <= fPtrSolidB->DistanceToIn(p) )
|
||||
{
|
||||
normal = fPtrSolidA->SurfaceNormal(p) ;
|
||||
}
|
||||
else if( InsideA == kInside &&
|
||||
InsideB != kOutside )
|
||||
else
|
||||
{
|
||||
normal = -fPtrSolidB->SurfaceNormal(p) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( fPtrSolidA->DistanceToOut(p) <= fPtrSolidB->DistanceToIn(p) )
|
||||
{
|
||||
normal = fPtrSolidA->SurfaceNormal(p) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
normal = -fPtrSolidB->SurfaceNormal(p) ;
|
||||
}
|
||||
#ifdef G4BOOLDEBUG
|
||||
if(insideThis == kInside)
|
||||
{
|
||||
G4cout << "WARNING - Invalid call [2] in "
|
||||
if(Inside(p) == kInside)
|
||||
{
|
||||
G4cout << "WARNING - Invalid call [2] in "
|
||||
<< "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
|
||||
<< " Point p is inside !" << G4endl;
|
||||
G4cout << " p = " << p << G4endl;
|
||||
G4cerr << "WARNING - Invalid call [2] in "
|
||||
G4cout << " p = " << p << G4endl;
|
||||
G4cerr << "WARNING - Invalid call [2] in "
|
||||
<< "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
|
||||
<< " Point p is inside !" << G4endl;
|
||||
G4cerr << " p = " << p << G4endl;
|
||||
}
|
||||
#endif
|
||||
G4cerr << " p = " << p << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return normal;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 101519 2016-11-18 15:43:54Z gcosmo $
|
||||
$Id: History 102769 2017-02-22 09:05:45Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,17 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
February 22, 2017 E.Tcherniaev geom-csg-V10-02-21
|
||||
- Fix in GetCubicVolume() and GetSurfaceArea() for G4CutTubs, to make
|
||||
use of the cached values. Addressing problem report #1943.
|
||||
|
||||
February 2, 2017 G.Cosmo geom-csg-V10-02-20
|
||||
- Removed redundant code/checks in G4Orb::SurfaceNormal().
|
||||
|
||||
December 20, 2016 H.Burkhardt, E.Tcherniaev
|
||||
- Use radius differences and hypot to improve precision in G4Torus.
|
||||
Addressing problem report #1931.
|
||||
|
||||
November 18, 2016 E.Tcherniaev geom-csg-V10-02-19
|
||||
- Added consistency checks for extent computation in USolids wrappers.
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4CutTubs.icc 66356 2012-12-18 09:02:32Z gcosmo $
|
||||
// $Id: G4CutTubs.icc 102769 2017-02-22 09:05:45Z gcosmo $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
@@ -36,12 +36,14 @@
|
||||
|
||||
inline G4double G4CutTubs::GetCubicVolume()
|
||||
{
|
||||
return G4VSolid::GetCubicVolume();
|
||||
if (fCubicVolume == 0.) { fCubicVolume = G4VSolid::GetCubicVolume(); }
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
inline G4double G4CutTubs::GetSurfaceArea()
|
||||
{
|
||||
return G4VSolid::GetSurfaceArea();
|
||||
if (fSurfaceArea == 0.) { fSurfaceArea = G4VSolid::GetSurfaceArea(); }
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Orb.cc 101121 2016-11-07 09:18:01Z gcosmo $
|
||||
// $Id: G4Orb.cc 102528 2017-02-08 13:37:51Z gcosmo $
|
||||
//
|
||||
// class G4Orb
|
||||
//
|
||||
@@ -295,28 +295,11 @@ EInside G4Orb::Inside( const G4ThreeVector& p ) const
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Return unit normal of surface closest to p
|
||||
// - note if point on z axis, ignore phi divided sides
|
||||
// - unsafe if point close to z axis a rmin=0 - no explicit checks
|
||||
|
||||
G4ThreeVector G4Orb::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
ENorm side = kNRMax;
|
||||
G4ThreeVector norm;
|
||||
G4double radius = std::sqrt(p.x()*p.x()+p.y()*p.y()+p.z()*p.z());
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case kNRMax:
|
||||
norm = G4ThreeVector(p.x()/radius,p.y()/radius,p.z()/radius);
|
||||
break;
|
||||
default: // Should never reach this case ...
|
||||
DumpInfo();
|
||||
G4Exception("G4Orb::SurfaceNormal()", "GeomSolids1002", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
break;
|
||||
}
|
||||
|
||||
return norm;
|
||||
return G4ThreeVector(p.x()/radius,p.y()/radius,p.z()/radius);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -24,13 +24,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Torus.cc 101121 2016-11-07 09:18:01Z gcosmo $
|
||||
// $Id: G4Torus.cc 102528 2017-02-08 13:37:51Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4Torus
|
||||
//
|
||||
// Implementation
|
||||
//
|
||||
// 16.12.16 H.Burkhardt: use radius differences and hypot to improve precision
|
||||
// 28.10.16 E.Tcherniaev: reimplemented CalculateExtent(),
|
||||
// added Extent(), removed CreateRotatedVertices()
|
||||
// 05.04.12 M.Kelsey: Use sqrt(r) in GetPointOnSurface() for uniform points
|
||||
@@ -272,13 +273,13 @@ void G4Torus::TorusRootsJT( const G4ThreeVector& p,
|
||||
G4double pDotV = p.x()*v.x() + p.y()*v.y() + p.z()*v.z() ;
|
||||
G4double pRad2 = p.x()*p.x() + p.y()*p.y() + p.z()*p.z() ;
|
||||
|
||||
G4double d=pRad2 - Rtor2;
|
||||
c[0] = 1.0 ;
|
||||
c[1] = 4*pDotV ;
|
||||
c[2] = 2*(pRad2 + 2*pDotV*pDotV - Rtor2 - r2 + 2*Rtor2*v.z()*v.z()) ;
|
||||
c[3] = 4*(pDotV*(pRad2 - Rtor2 - r2) + 2*Rtor2*p.z()*v.z()) ;
|
||||
c[4] = pRad2*pRad2 - 2*pRad2*(Rtor2+r2)
|
||||
+ 4*Rtor2*p.z()*p.z() + (Rtor2-r2)*(Rtor2-r2) ;
|
||||
|
||||
c[2] = 2*( (d + 2*pDotV*pDotV - r2) + 2*Rtor2*v.z()*v.z());
|
||||
c[3] = 4*(pDotV*(d - r2) + 2*Rtor2*p.z()*v.z()) ;
|
||||
c[4] = (d-r2)*(d-r2) +4*Rtor2*(p.z()*p.z()-r2);
|
||||
|
||||
G4JTPolynomialSolver torusEq;
|
||||
|
||||
num = torusEq.FindRoots( c, 4, srd, si );
|
||||
@@ -365,10 +366,8 @@ G4double G4Torus::SolveNumericJT( const G4ThreeVector& p,
|
||||
// compute scalar product at position p : v.n
|
||||
// ( n taken from SurfaceNormal, not normalized )
|
||||
|
||||
scal = v* G4ThreeVector( p.x()*(1-fRtor/std::sqrt(p.x()*p.x()
|
||||
+ p.y()*p.y())),
|
||||
p.y()*(1-fRtor/std::sqrt(p.x()*p.x()
|
||||
+ p.y()*p.y())),
|
||||
scal = v* G4ThreeVector( p.x()*(1-fRtor/std::hypot(p.x(),p.y())),
|
||||
p.y()*(1-fRtor/std::hypot(p.x(),p.y())),
|
||||
p.z() );
|
||||
|
||||
// change sign in case of inner radius
|
||||
@@ -387,10 +386,8 @@ G4double G4Torus::SolveNumericJT( const G4ThreeVector& p,
|
||||
{
|
||||
// compute scalar product at position p : v.n
|
||||
//
|
||||
scal = v* G4ThreeVector( p.x()*(1-fRtor/std::sqrt(p.x()*p.x()
|
||||
+ p.y()*p.y())),
|
||||
p.y()*(1-fRtor/std::sqrt(p.x()*p.x()
|
||||
+ p.y()*p.y())),
|
||||
scal = v* G4ThreeVector( p.x()*(1-fRtor/std::hypot(p.x(),p.y())),
|
||||
p.y()*(1-fRtor/std::hypot(p.x(),p.y())),
|
||||
p.z() );
|
||||
|
||||
// change sign in case of inner radius
|
||||
@@ -601,14 +598,14 @@ G4bool G4Torus::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
EInside G4Torus::Inside( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4double r2, pt2, pPhi, tolRMin, tolRMax ;
|
||||
G4double r, pt2, pPhi, tolRMin, tolRMax ;
|
||||
|
||||
EInside in = kOutside ;
|
||||
|
||||
// General precals
|
||||
//
|
||||
r2 = p.x()*p.x() + p.y()*p.y() ;
|
||||
pt2 = r2 + p.z()*p.z() + fRtor*fRtor - 2*fRtor*std::sqrt(r2) ;
|
||||
r = std::hypot(p.x(),p.y());
|
||||
pt2 = p.z()*p.z() + (r-fRtor)*(r-fRtor);
|
||||
|
||||
if (fRmin) tolRMin = fRmin + fRminTolerance ;
|
||||
else tolRMin = 0 ;
|
||||
@@ -713,7 +710,7 @@ EInside G4Torus::Inside( const G4ThreeVector& p ) const
|
||||
G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4int noSurfaces = 0;
|
||||
G4double rho2, rho, pt2, pt, pPhi;
|
||||
G4double rho, pt, pPhi;
|
||||
G4double distRMin = kInfinity;
|
||||
G4double distSPhi = kInfinity, distEPhi = kInfinity;
|
||||
|
||||
@@ -726,11 +723,8 @@ G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
G4ThreeVector nR, nPs, nPe;
|
||||
G4ThreeVector norm, sumnorm(0.,0.,0.);
|
||||
|
||||
rho2 = p.x()*p.x() + p.y()*p.y();
|
||||
rho = std::sqrt(rho2);
|
||||
pt2 = rho2+p.z()*p.z() +fRtor * (fRtor-2*rho);
|
||||
pt2 = std::max(pt2, 0.0); // std::fabs(pt2);
|
||||
pt = std::sqrt(pt2) ;
|
||||
rho = std::hypot(p.x(),p.y());
|
||||
pt = std::hypot(p.z(),rho-fRtor);
|
||||
|
||||
G4double distRMax = std::fabs(pt - fRmax);
|
||||
if(fRmin) distRMin = std::fabs(pt - fRmin);
|
||||
@@ -847,13 +841,11 @@ G4ThreeVector G4Torus::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
ENorm side ;
|
||||
G4ThreeVector norm;
|
||||
G4double rho2,rho,pt2,pt,phi;
|
||||
G4double rho,pt,phi;
|
||||
G4double distRMin,distRMax,distSPhi,distEPhi,distMin;
|
||||
|
||||
rho2 = p.x()*p.x() + p.y()*p.y();
|
||||
rho = std::sqrt(rho2) ;
|
||||
pt2 = std::fabs(rho2+p.z()*p.z() +fRtor*fRtor - 2*fRtor*rho) ;
|
||||
pt = std::sqrt(pt2) ;
|
||||
rho = std::hypot(p.x(),p.y());
|
||||
pt = std::hypot(p.z(),rho-fRtor);
|
||||
|
||||
#ifdef G4CSGDEBUG
|
||||
G4cout << " G4Torus::ApproximateSurfaceNormal called for point " << p
|
||||
@@ -970,7 +962,7 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
|
||||
G4double tolORMin2; // `generous' radii squared
|
||||
G4double tolORMax2;
|
||||
|
||||
G4double Dist,xi,yi,zi,rhoi2,it2; // Intersection point variables
|
||||
G4double Dist,xi,yi,zi,rhoi,it2; // Intersection point variables
|
||||
|
||||
G4double Comp;
|
||||
G4double cosSPhi,sinSPhi; // Trig for phi start intersect
|
||||
@@ -1003,8 +995,6 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
|
||||
|
||||
// Intersection with Rmax (possible return) and Rmin (must also check phi)
|
||||
|
||||
G4double Rtor2 = fRtor*fRtor ;
|
||||
|
||||
snxt = SolveNumericJT(p,v,fRmax,true);
|
||||
|
||||
if (fRmin) // Possible Rmin intersection
|
||||
@@ -1043,8 +1033,8 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
|
||||
xi = p.x() + sphi*v.x() ;
|
||||
yi = p.y() + sphi*v.y() ;
|
||||
zi = p.z() + sphi*v.z() ;
|
||||
rhoi2 = xi*xi + yi*yi ;
|
||||
it2 = std::fabs(rhoi2 + zi*zi + Rtor2 - 2*fRtor*std::sqrt(rhoi2)) ;
|
||||
rhoi = std::hypot(xi,yi);
|
||||
it2 = zi*zi + (rhoi-fRtor)*(rhoi-fRtor);
|
||||
|
||||
if ( it2 >= tolORMin2 && it2 <= tolORMax2 )
|
||||
{
|
||||
@@ -1076,8 +1066,8 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
|
||||
xi = p.x() + sphi*v.x() ;
|
||||
yi = p.y() + sphi*v.y() ;
|
||||
zi = p.z() + sphi*v.z() ;
|
||||
rhoi2 = xi*xi + yi*yi ;
|
||||
it2 = std::fabs(rhoi2 + zi*zi + Rtor2 - 2*fRtor*std::sqrt(rhoi2)) ;
|
||||
rhoi = std::hypot(xi,yi);
|
||||
it2 = zi*zi + (rhoi-fRtor)*(rhoi-fRtor);
|
||||
|
||||
if (it2 >= tolORMin2 && it2 <= tolORMax2)
|
||||
{
|
||||
@@ -1106,13 +1096,10 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4double safe=0.0, safe1, safe2 ;
|
||||
G4double phiC, cosPhiC, sinPhiC, safePhi, ePhi, cosPsi ;
|
||||
G4double rho2, rho, pt2, pt ;
|
||||
|
||||
rho2 = p.x()*p.x() + p.y()*p.y() ;
|
||||
rho = std::sqrt(rho2) ;
|
||||
pt2 = std::fabs(rho2 + p.z()*p.z() + fRtor*fRtor - 2*fRtor*rho) ;
|
||||
pt = std::sqrt(pt2) ;
|
||||
|
||||
G4double rho, pt ;
|
||||
|
||||
rho = std::hypot(p.x(),p.y());
|
||||
pt = std::hypot(p.z(),rho-fRtor);
|
||||
safe1 = fRmin - pt ;
|
||||
safe2 = pt - fRmax ;
|
||||
|
||||
@@ -1175,18 +1162,9 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
// To be done: Check the precision of this calculation.
|
||||
// If you want return always validNorm = false, then take the version below
|
||||
|
||||
G4double rho2 = p.x()*p.x()+p.y()*p.y();
|
||||
G4double rho = std::sqrt(rho2) ;
|
||||
|
||||
G4double pt2 = rho2 + p.z()*p.z() + fRtor * (fRtor - 2.0*rho);
|
||||
// Regroup for slightly better FP accuracy
|
||||
|
||||
if( pt2 < 0.0)
|
||||
{
|
||||
pt2= std::fabs( pt2 );
|
||||
}
|
||||
|
||||
G4double pt = std::sqrt(pt2) ;
|
||||
|
||||
G4double rho = std::hypot(p.x(),p.y());
|
||||
G4double pt = hypot(p.z(),rho-fRtor);
|
||||
|
||||
G4double pDotV = p.x()*v.x() + p.y()*v.y() + p.z()*v.z() ;
|
||||
|
||||
@@ -1195,7 +1173,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
G4double vDotNmax = pDotV - fRtor*(v.x()*p.x() + v.y()*p.y())/rho ;
|
||||
G4double pDotxyNmax = (1 - fRtor/rho) ;
|
||||
|
||||
if( (pt2 > tolRMax*tolRMax) && (vDotNmax >= 0) )
|
||||
if( (pt*pt > tolRMax*tolRMax) && (vDotNmax >= 0) )
|
||||
{
|
||||
// On tolerant boundary & heading outwards (or perpendicular to) outer
|
||||
// radial surface -> leaving immediately with *n for really convex part
|
||||
@@ -1221,7 +1199,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
{
|
||||
G4double tolRMin = fRmin + fRminTolerance ;
|
||||
|
||||
if ( (pt2 < tolRMin*tolRMin) && (vDotNmax < 0) )
|
||||
if ( (pt*pt < tolRMin*tolRMin) && (vDotNmax < 0) )
|
||||
{
|
||||
if (calcNorm) { *validNorm = false ; } // Concave surface of the torus
|
||||
return snxt = 0 ; // Leaving by Rmin immediately
|
||||
@@ -1409,7 +1387,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
}
|
||||
|
||||
G4double rhoi2,rhoi,it2,it,iDotxyNmax ;
|
||||
G4double rhoi,it,iDotxyNmax ;
|
||||
// Note: by numerical computation we know where the ray hits the torus
|
||||
// So I propose to return the side where the ray hits
|
||||
|
||||
@@ -1419,12 +1397,11 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
{
|
||||
case kRMax: // n is unit vector
|
||||
xi = p.x() + snxt*v.x() ;
|
||||
yi =p.y() + snxt*v.y() ;
|
||||
yi = p.y() + snxt*v.y() ;
|
||||
zi = p.z() + snxt*v.z() ;
|
||||
rhoi2 = xi*xi + yi*yi ;
|
||||
rhoi = std::sqrt(rhoi2) ;
|
||||
it2 = std::fabs(rhoi2 + zi*zi + fRtor*fRtor - 2*fRtor*rhoi) ;
|
||||
it = std::sqrt(it2) ;
|
||||
rhoi = std::hypot(xi,yi);
|
||||
it = hypot(zi,rhoi-fRtor);
|
||||
|
||||
iDotxyNmax = (1-fRtor/rhoi) ;
|
||||
if(iDotxyNmax >= -2.*fRmaxTolerance) // really convex part of Rmax
|
||||
{
|
||||
@@ -1505,13 +1482,12 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
G4double G4Torus::DistanceToOut( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4double safe=0.0,safeR1,safeR2;
|
||||
G4double rho2,rho,pt2,pt ;
|
||||
G4double rho,pt ;
|
||||
G4double safePhi,phiC,cosPhiC,sinPhiC,ePhi;
|
||||
rho2 = p.x()*p.x() + p.y()*p.y() ;
|
||||
rho = std::sqrt(rho2) ;
|
||||
pt2 = std::fabs(rho2 + p.z()*p.z() + fRtor*fRtor - 2*fRtor*rho) ;
|
||||
pt = std::sqrt(pt2) ;
|
||||
|
||||
|
||||
rho = std::hypot(p.x(),p.y());
|
||||
pt = std::hypot(p.z(),rho-fRtor);
|
||||
|
||||
#ifdef G4CSGDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 101819 2016-12-01 08:13:36Z gcosmo $
|
||||
$Id: History 102532 2017-02-08 13:44:45Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,11 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
13-December-2016 G.Cosmo (geom-specific-V10-02-26)
|
||||
- Correction in G4UExtrudedSolid to signature for CalculateExtent().
|
||||
Fixes issue of undefined symbol if extruded-solid not included in the
|
||||
list of VecGeom wrappers to activate.
|
||||
|
||||
30-November-2016 E.Tcherniaev (geom-specific-V10-02-25)
|
||||
- Call RemoveRedundantVertices() from G4GeomTools in CalculateExtent()
|
||||
for G4Polycone, G4Polyhedra and related USolids wrappers.
|
||||
|
||||
@@ -260,10 +260,10 @@ void G4UExtrudedSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
// Calculate extent under transform and specified limit
|
||||
|
||||
G4bool
|
||||
G4ExtrudedSolid::CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const
|
||||
G4UExtrudedSolid::CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const
|
||||
{
|
||||
G4ThreeVector bmin, bmax;
|
||||
G4bool exist;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 100429 2016-10-21 13:00:52Z gcosmo $
|
||||
$Id: History 102534 2017-02-08 13:47:58Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,12 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
January 10th, 2017 G.Cosmo - geomvol-V10-02-04
|
||||
- Correction in G4NavigationHistory default constructor to use
|
||||
GetLevels() instead of GetNewLevels() from G4NavigationHistoryPool,
|
||||
to favor re-use of already allocated space.
|
||||
Thanks to M.Karamitros for spotting this.
|
||||
|
||||
October 21st, 2016 G.Cosmo - geomvol-V10-02-03
|
||||
- Moved initialisation of G4GeomSplitter thread-local data to be inline
|
||||
along with generic template type.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4NavigationHistory.cc 96346 2016-04-08 14:10:33Z gcosmo $
|
||||
// $Id: G4NavigationHistory.cc 102534 2017-02-08 13:47:58Z gcosmo $
|
||||
//
|
||||
//
|
||||
// G4NavigationHistory Implementation
|
||||
@@ -41,7 +41,7 @@ G4ThreadLocal G4Allocator<G4NavigationHistory> *aNavigHistoryAllocator = 0;
|
||||
G4NavigationHistory::G4NavigationHistory()
|
||||
: fStackDepth(0)
|
||||
{
|
||||
fNavHistory = G4NavigationHistoryPool::GetInstance()->GetNewLevels();
|
||||
fNavHistory = G4NavigationHistoryPool::GetInstance()->GetLevels();
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user