Import Geant4 10.4.2 source tree
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
$Id: History 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
$Id: History 110069 2018-05-15 09:32:07Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -20,6 +20,29 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
April 24, 2018 E. Tcherniaev geom-bool-V10-03-05
|
||||
- G4UnionSolid: define simple bounding-box and make use of early returns
|
||||
in Inside() for points laying outside.
|
||||
|
||||
April 11, 2018 E. Tcherniaev
|
||||
- G4BooleanSolid: Use -1 instead of 0 as default initialisation value
|
||||
for area and capacity, so to distinguish cases when values are zero
|
||||
referring to NULL Boolean constructs.
|
||||
|
||||
April 11, 2018 G. Cosmo
|
||||
- G4BooleanSolid: enhanced warning message for the case of an invalid
|
||||
(NULL) Boolean construct in GetPointOnSurface() and StackPolyhedron().
|
||||
- Replaced USOLIDS_LIBRARIES with VECGEOM_LIBRARIES in sources.cmake.
|
||||
|
||||
February 28, 2018 E. Tcherniaev
|
||||
- Improved contruction of G4DiplaceSolid to combine transformations for
|
||||
nested displaced types.
|
||||
|
||||
June 13, 2017 J. Allison
|
||||
- G4BooleanSolid.cc, G4DisplacedSolid.cc, G4ScaledSolid.cc:
|
||||
Added protection and a warning message in the case of a null
|
||||
polyhedron pointer.
|
||||
|
||||
May 24, 2017 G. Cosmo geom-bool-V10-03-04
|
||||
- Renamed ambiguous name Extent() in all shapes to BoundingLimits().
|
||||
Change required in order to avoid signature conflict with VecGeom in
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4BooleanSolid.icc 96960 2016-05-18 14:59:54Z gcosmo $
|
||||
// $Id: G4BooleanSolid.icc 110069 2018-05-15 09:32:07Z gcosmo $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
@@ -49,15 +49,15 @@ G4double G4BooleanSolid::GetCubVolEpsilon() const
|
||||
inline
|
||||
void G4BooleanSolid::SetCubVolStatistics(G4int st)
|
||||
{
|
||||
fCubicVolume=0.;
|
||||
fStatistics=st;
|
||||
fCubicVolume = -1.;
|
||||
fStatistics = st;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4BooleanSolid::SetCubVolEpsilon(G4double ep)
|
||||
{
|
||||
fCubicVolume=0.;
|
||||
fCubVolEpsilon=ep;
|
||||
fCubicVolume = -1.;
|
||||
fCubVolEpsilon = ep;
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -75,29 +75,33 @@ G4double G4BooleanSolid::GetAreaAccuracy() const
|
||||
inline
|
||||
void G4BooleanSolid::SetAreaStatistics(G4int st)
|
||||
{
|
||||
fSurfaceArea=0.;
|
||||
fStatistics=st;
|
||||
fSurfaceArea = -1.;
|
||||
fStatistics = st;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4BooleanSolid::SetAreaAccuracy(G4double ep)
|
||||
{
|
||||
fSurfaceArea=0.;
|
||||
fAreaAccuracy=ep;
|
||||
fSurfaceArea = -1.;
|
||||
fAreaAccuracy = ep;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4BooleanSolid::GetCubicVolume()
|
||||
{
|
||||
if(fCubicVolume != 0.) {;}
|
||||
else { fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon); }
|
||||
if(fCubicVolume < 0.)
|
||||
{
|
||||
fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon);
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4BooleanSolid::GetSurfaceArea()
|
||||
{
|
||||
if(fSurfaceArea != 0.) {;}
|
||||
else { fSurfaceArea = EstimateSurfaceArea(fStatistics,fAreaAccuracy); }
|
||||
if(fSurfaceArea < 0.)
|
||||
{
|
||||
fSurfaceArea = EstimateSurfaceArea(fStatistics,fAreaAccuracy);
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnionSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
// $Id: G4UnionSolid.hh 110069 2018-05-15 09:32:07Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4UnionSolid
|
||||
@@ -117,6 +117,9 @@ class G4UnionSolid : public G4BooleanSolid
|
||||
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
|
||||
G4Polyhedron* CreatePolyhedron () const ;
|
||||
|
||||
private:
|
||||
|
||||
G4ThreeVector fPMin, fPMax; // bounding box extended by half-tolerance
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 103464 2017-04-11 07:24:03Z gcosmo $
|
||||
# $Id: sources.cmake 110069 2018-05-15 09:32:07Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -65,7 +65,7 @@ GEANT4_DEFINE_MODULE(NAME G4geomBoolean
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
${USOLIDS_LIBRARIES}
|
||||
${VECGEOM_LIBRARIES}
|
||||
)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4BooleanSolid.cc 97300 2016-06-01 09:27:19Z gcosmo $
|
||||
// $Id: G4BooleanSolid.cc 110069 2018-05-15 09:32:07Z gcosmo $
|
||||
//
|
||||
// Implementation for the abstract base class for solids created by boolean
|
||||
// operations between other solids
|
||||
@@ -62,7 +62,7 @@ G4BooleanSolid::G4BooleanSolid( const G4String& pName,
|
||||
G4VSolid* pSolidA ,
|
||||
G4VSolid* pSolidB ) :
|
||||
G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
|
||||
fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
|
||||
fAreaAccuracy(-1.), fCubicVolume(-1.), fSurfaceArea(-1.),
|
||||
fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
|
||||
createdDisplacedSolid(false)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ G4BooleanSolid::G4BooleanSolid( const G4String& pName,
|
||||
G4RotationMatrix* rotMatrix,
|
||||
const G4ThreeVector& transVector ) :
|
||||
G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
|
||||
fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
|
||||
fAreaAccuracy(-1.), fCubicVolume(-1.), fSurfaceArea(-1.),
|
||||
fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
|
||||
createdDisplacedSolid(true)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ G4BooleanSolid::G4BooleanSolid( const G4String& pName,
|
||||
G4VSolid* pSolidB ,
|
||||
const G4Transform3D& transform ) :
|
||||
G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
|
||||
fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
|
||||
fAreaAccuracy(-1.), fCubicVolume(-1.), fSurfaceArea(-1.),
|
||||
fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
|
||||
createdDisplacedSolid(true)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ G4BooleanSolid::G4BooleanSolid( const G4String& pName,
|
||||
G4BooleanSolid::G4BooleanSolid( __void__& a )
|
||||
: G4VSolid(a), fPtrSolidA(0), fPtrSolidB(0),
|
||||
fStatistics(1000000), fCubVolEpsilon(0.001),
|
||||
fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
|
||||
fAreaAccuracy(-1.), fCubicVolume(-1.), fSurfaceArea(-1.),
|
||||
fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
|
||||
createdDisplacedSolid(false)
|
||||
{
|
||||
@@ -354,8 +354,8 @@ G4ThreeVector G4BooleanSolid::GetPointOnSurface() const
|
||||
}
|
||||
std::ostringstream message;
|
||||
message << "Solid - " << GetName() << "\n"
|
||||
<< "All attempts to generate a point on the surface have failed.\n"
|
||||
<< "Returning point from the last unsuccessful attempt!";
|
||||
<< "All attempts to generate a point on the surface have failed!\n"
|
||||
<< "The solid created may be an invalid Boolean construct!";
|
||||
G4Exception("G4BooleanSolid::GetPointOnSurface()",
|
||||
"GeomSolids1001", JustWarning, message);
|
||||
return p;
|
||||
@@ -420,7 +420,18 @@ G4BooleanSolid::StackPolyhedron(HepPolyhedronProcessor& processor,
|
||||
top = solidA->GetPolyhedron();
|
||||
}
|
||||
G4Polyhedron* operand = solidB->GetPolyhedron();
|
||||
processor.push_back (operation, *operand);
|
||||
if (operand)
|
||||
{
|
||||
processor.push_back (operation, *operand);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Solid - " << solid->GetName()
|
||||
<< " - No G4Polyhedron for Boolean component";
|
||||
G4Exception("G4BooleanSolid::StackPolyhedron()",
|
||||
"GeomSolids2001", JustWarning, message);
|
||||
}
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DisplacedSolid.cc 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
// $Id: G4DisplacedSolid.cc 110069 2018-05-15 09:32:07Z gcosmo $
|
||||
//
|
||||
// Implementation for G4DisplacedSolid class for boolean
|
||||
// operations between other solids
|
||||
@@ -34,6 +34,7 @@
|
||||
// 28.10.98 V.Grichine: created
|
||||
// 14.11.99 V.Grichine: modifications in CalculateExtent(...) method
|
||||
// 22.11.00 V.Grichine: new set methods for matrix/vectors
|
||||
// 28.02.18 E.Tcherniaev: improved contruction from G4DisplacedSolid
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -57,10 +58,19 @@ G4DisplacedSolid::G4DisplacedSolid( const G4String& pName,
|
||||
const G4ThreeVector& transVector )
|
||||
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0)
|
||||
{
|
||||
fPtrSolid = pSolid ;
|
||||
fPtrTransform = new G4AffineTransform(rotMatrix,transVector) ;
|
||||
fPtrTransform->Invert() ;
|
||||
fDirectTransform = new G4AffineTransform(rotMatrix,transVector) ;
|
||||
if (pSolid->GetEntityType() == "G4DisplacedSolid")
|
||||
{
|
||||
fPtrSolid = ((G4DisplacedSolid*)pSolid)->GetConstituentMovedSolid();
|
||||
G4AffineTransform t1 = ((G4DisplacedSolid*)pSolid)->GetDirectTransform();
|
||||
G4AffineTransform t2 = G4AffineTransform(rotMatrix,transVector);
|
||||
fDirectTransform = new G4AffineTransform(t1*t2);
|
||||
}
|
||||
else
|
||||
{
|
||||
fPtrSolid = pSolid;
|
||||
fDirectTransform = new G4AffineTransform(rotMatrix,transVector);
|
||||
}
|
||||
fPtrTransform = new G4AffineTransform(fDirectTransform->Inverse());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -72,13 +82,21 @@ G4DisplacedSolid::G4DisplacedSolid( const G4String& pName,
|
||||
const G4Transform3D& transform )
|
||||
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0)
|
||||
{
|
||||
fPtrSolid = pSolid ;
|
||||
fDirectTransform = new G4AffineTransform(transform.getRotation().inverse(),
|
||||
transform.getTranslation()) ;
|
||||
|
||||
fPtrTransform = new G4AffineTransform(transform.getRotation().inverse(),
|
||||
transform.getTranslation()) ;
|
||||
fPtrTransform->Invert() ;
|
||||
if (pSolid->GetEntityType() == "G4DisplacedSolid")
|
||||
{
|
||||
fPtrSolid = ((G4DisplacedSolid*)pSolid)->GetConstituentMovedSolid();
|
||||
G4AffineTransform t1 = ((G4DisplacedSolid*)pSolid)->GetDirectTransform();
|
||||
G4AffineTransform t2 = G4AffineTransform(transform.getRotation().inverse(),
|
||||
transform.getTranslation());
|
||||
fDirectTransform = new G4AffineTransform(t1*t2);
|
||||
}
|
||||
else
|
||||
{
|
||||
fPtrSolid = pSolid;
|
||||
fDirectTransform = new G4AffineTransform(transform.getRotation().inverse(),
|
||||
transform.getTranslation()) ;
|
||||
}
|
||||
fPtrTransform = new G4AffineTransform(fDirectTransform->Inverse());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
@@ -91,9 +109,19 @@ G4DisplacedSolid::G4DisplacedSolid( const G4String& pName,
|
||||
const G4AffineTransform directTransform )
|
||||
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0)
|
||||
{
|
||||
fPtrSolid = pSolid ;
|
||||
fDirectTransform = new G4AffineTransform( directTransform );
|
||||
fPtrTransform = new G4AffineTransform( directTransform.Inverse() ) ;
|
||||
if (pSolid->GetEntityType() == "G4DisplacedSolid")
|
||||
{
|
||||
fPtrSolid = ((G4DisplacedSolid*)pSolid)->GetConstituentMovedSolid();
|
||||
G4AffineTransform t1 = ((G4DisplacedSolid*)pSolid)->GetDirectTransform();
|
||||
G4AffineTransform t2 = G4AffineTransform(directTransform);
|
||||
fDirectTransform = new G4AffineTransform(t1*t2);
|
||||
}
|
||||
else
|
||||
{
|
||||
fPtrSolid = pSolid;
|
||||
fDirectTransform = new G4AffineTransform(directTransform);
|
||||
}
|
||||
fPtrTransform = new G4AffineTransform(fDirectTransform->Inverse());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
@@ -491,8 +519,18 @@ G4Polyhedron*
|
||||
G4DisplacedSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
|
||||
polyhedron
|
||||
if (polyhedron)
|
||||
{
|
||||
polyhedron
|
||||
->Transform(G4Transform3D(GetObjectRotation(),GetObjectTranslation()));
|
||||
}
|
||||
else
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4DisplacedSolid::CreatePolyhedron()",
|
||||
"GeomSolids2002", JustWarning,
|
||||
"No G4Polyhedron for displaced solid");
|
||||
}
|
||||
return polyhedron;
|
||||
}
|
||||
|
||||
|
||||
@@ -404,7 +404,17 @@ G4Polyhedron*
|
||||
G4ScaledSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
|
||||
polyhedron->Transform(GetScaleTransform());
|
||||
if (polyhedron)
|
||||
{
|
||||
polyhedron->Transform(GetScaleTransform());
|
||||
}
|
||||
else
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4ScaledSolid::CreatePolyhedron()",
|
||||
"GeomSolids2003", JustWarning,
|
||||
"No G4Polyhedron for scaled solid");
|
||||
}
|
||||
return polyhedron;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnionSolid.cc 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
// $Id: G4UnionSolid.cc 110069 2018-05-15 09:32:07Z gcosmo $
|
||||
//
|
||||
// Implementation of methods for the class G4UnionSolid
|
||||
//
|
||||
@@ -35,6 +35,7 @@
|
||||
// 27.07.99 V.Grichine: modifications in DistToOut(p,v,...), while -> do-while
|
||||
// 16.03.01 V.Grichine: modifications in CalculateExtent()
|
||||
// 17.03.17 E.Tcherniaev: revision of SurfaceNormal()
|
||||
// 23.04.18 E.Tcherniaev: added extended BBox, yearly return in Inside()
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -61,6 +62,11 @@ G4UnionSolid:: G4UnionSolid( const G4String& pName,
|
||||
G4VSolid* pSolidB )
|
||||
: G4BooleanSolid(pName,pSolidA,pSolidB)
|
||||
{
|
||||
G4ThreeVector pdelta(0.5*kCarTolerance,0.5*kCarTolerance,0.5*kCarTolerance);
|
||||
G4ThreeVector pmin, pmax;
|
||||
BoundingLimits(pmin, pmax);
|
||||
fPMin = pmin - pdelta;
|
||||
fPMax = pmax + pdelta;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@@ -75,6 +81,11 @@ G4UnionSolid::G4UnionSolid( const G4String& pName,
|
||||
: G4BooleanSolid(pName,pSolidA,pSolidB,rotMatrix,transVector)
|
||||
|
||||
{
|
||||
G4ThreeVector pdelta(0.5*kCarTolerance,0.5*kCarTolerance,0.5*kCarTolerance);
|
||||
G4ThreeVector pmin, pmax;
|
||||
BoundingLimits(pmin, pmax);
|
||||
fPMin = pmin - pdelta;
|
||||
fPMax = pmax + pdelta;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@@ -87,6 +98,11 @@ G4UnionSolid::G4UnionSolid( const G4String& pName,
|
||||
const G4Transform3D& transform )
|
||||
: G4BooleanSolid(pName,pSolidA,pSolidB,transform)
|
||||
{
|
||||
G4ThreeVector pdelta(0.5*kCarTolerance,0.5*kCarTolerance,0.5*kCarTolerance);
|
||||
G4ThreeVector pmin, pmax;
|
||||
BoundingLimits(pmin, pmax);
|
||||
fPMin = pmin - pdelta;
|
||||
fPMax = pmax + pdelta;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
@@ -114,6 +130,8 @@ G4UnionSolid::~G4UnionSolid()
|
||||
G4UnionSolid::G4UnionSolid(const G4UnionSolid& rhs)
|
||||
: G4BooleanSolid (rhs)
|
||||
{
|
||||
fPMin = rhs.fPMin;
|
||||
fPMax = rhs.fPMax;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -130,6 +148,8 @@ G4UnionSolid& G4UnionSolid::operator = (const G4UnionSolid& rhs)
|
||||
//
|
||||
G4BooleanSolid::operator=(rhs);
|
||||
|
||||
fPMin = rhs.fPMin;
|
||||
fPMax = rhs.fPMax;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -208,27 +228,23 @@ G4UnionSolid::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
EInside G4UnionSolid::Inside( const G4ThreeVector& p ) const
|
||||
{
|
||||
EInside positionA = fPtrSolidA->Inside(p);
|
||||
if (positionA == kInside) { return kInside; }
|
||||
if (std::max(p.z()-fPMax.z(),fPMin.z()-p.z()) > 0) return kOutside;
|
||||
|
||||
EInside positionA = fPtrSolidA->Inside(p);
|
||||
if (positionA == kInside) { return positionA; } // inside A
|
||||
EInside positionB = fPtrSolidB->Inside(p);
|
||||
if (positionA == kOutside) { return positionB; }
|
||||
|
||||
if (positionB == kInside) { return positionB; } // inside B
|
||||
if (positionB == kOutside) { return positionA; } // surface A
|
||||
|
||||
// Both points are on surface
|
||||
//
|
||||
static const G4double rtol
|
||||
= 1000*G4GeometryTolerance::GetInstance()->GetRadialTolerance();
|
||||
EInside positionB = fPtrSolidB->Inside(p);
|
||||
|
||||
if( positionB == kInside ||
|
||||
( positionA == kSurface && positionB == kSurface &&
|
||||
( fPtrSolidA->SurfaceNormal(p) +
|
||||
fPtrSolidB->SurfaceNormal(p) ).mag2() < rtol ) )
|
||||
{
|
||||
return kInside;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( positionB == kSurface ) || ( positionA == kSurface ) )
|
||||
{ return kSurface; }
|
||||
else
|
||||
{ return kOutside; }
|
||||
}
|
||||
return ((fPtrSolidA->SurfaceNormal(p) +
|
||||
fPtrSolidB->SurfaceNormal(p)).mag2() < rtol) ? kInside : kSurface;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 108482 2018-02-15 14:34:23Z gcosmo $
|
||||
$Id: History 110070 2018-05-15 09:40:05Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,11 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
April 11, 2018 G.Cosmo geom-csg-V10-03-40
|
||||
- G4Box: simplified and optimised calculation of normal in method
|
||||
DistanceToOut(p,v,..). (E.Tcherniaev)
|
||||
- Replaced USOLIDS_LIBRARIES with VECGEOM_LIBRARIES in sources.cmake.
|
||||
|
||||
February 5, 2018 G.Cosmo geom-csg-V10-03-39
|
||||
- Correction in G4UPara::ComputeDimensions() to add explicit cast for the
|
||||
solid type to parameterise.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 105075 2017-07-11 14:22:53Z gcosmo $
|
||||
# $Id: sources.cmake 110070 2018-05-15 09:40:05Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -100,7 +100,7 @@ GEANT4_DEFINE_MODULE(NAME G4csg
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
${USOLIDS_LIBRARIES}
|
||||
${VECGEOM_LIBRARIES}
|
||||
)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Box.cc 105023 2017-07-05 09:55:35Z gcosmo $
|
||||
// $Id: G4Box.cc 110070 2018-05-15 09:40:05Z gcosmo $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -438,23 +438,9 @@ G4double G4Box::DistanceToOut( const G4ThreeVector& p,
|
||||
if (calcNorm)
|
||||
{
|
||||
*validNorm = true;
|
||||
G4double xnew = p.x() + tmax*vx;
|
||||
if (std::abs(std::abs(xnew) - fDx) <= delta)
|
||||
{
|
||||
n->set(std::copysign(1.,xnew), 0., 0.);
|
||||
return tmax;
|
||||
}
|
||||
G4double ynew = p.y() + tmax*vy;
|
||||
if (std::abs(std::abs(ynew) - fDy) <= delta)
|
||||
{
|
||||
n->set(0., std::copysign(1.,ynew), 0.);
|
||||
return tmax;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double znew = p.z() + tmax*vz;
|
||||
n->set(0., 0., std::copysign(1.,znew));
|
||||
}
|
||||
if (tmax == tx) n->set((v.x() < 0) ? -1. : 1., 0., 0.);
|
||||
else if (tmax == ty) n->set(0., (v.y() < 0) ? -1. : 1., 0.);
|
||||
else n->set(0., 0., (v.z() < 0) ? -1. : 1.);
|
||||
}
|
||||
return tmax;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 108484 2018-02-15 14:38:03Z gcosmo $
|
||||
$Id: History 110072 2018-05-15 09:59:42Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,14 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
11-April-2018 G.Cosmo (geom-specific-V10-03-27)
|
||||
- Replaced USOLIDS_LIBRARIES with VECGEOM_LIBRARIES in sources.cmake.
|
||||
|
||||
13-February-2018 G.Cosmo
|
||||
- Corrected conversion of input parameters to internal structure (used for
|
||||
caching for adoption in GDML persistency) in G4UPolycone and G4UPolyhedra
|
||||
wrappers.
|
||||
|
||||
13-December-2017 E.Tcherniaev (geom-specific-V10-03-26)
|
||||
- Removed redundant data initialistion in G4ExtrudedSolid constructors.
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Wrapper class for G4UGenericPolycone to make use of it from USolids module.
|
||||
// Wrapper class for G4GenericPolycone to make use of VecGeom GenericPolycone.
|
||||
|
||||
// History:
|
||||
// 30.10.13 G.Cosmo, CERN/PH
|
||||
// 30.10.13 G.Cosmo, CERN
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4UGENERICPOLYCONE_hh
|
||||
#define G4UGENERICPOLYCONE_hh
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Wrapper class for G4UGenericTrap to make use of it from USolids module.
|
||||
// Wrapper class for G4GenericTrap to make use of VecGeom GenericTrap.
|
||||
|
||||
// History:
|
||||
// 30.10.13 G.Cosmo, CERN/PH
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Wrapper class for UParaboloid to make use of it from USolids module.
|
||||
// Wrapper class for G4Paraboloid to make use of VecGeom Paraboloid.
|
||||
|
||||
// History:
|
||||
// 19.08.15 Guilherme Lima, FNAL
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Wrapper class for UPolycone to make use of it from USolids module.
|
||||
// Wrapper class for G4Polycone to make use of VecGeom Polycone.
|
||||
|
||||
// History:
|
||||
// 31.10.13 G.Cosmo, CERN/PH
|
||||
// 31.10.13 G.Cosmo, CERN
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4UPOLYCONE_HH
|
||||
#define G4UPOLYCONE_HH
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Wrapper class for UPolyhedra to make use of it from USolids module.
|
||||
// Wrapper class for G4Polyhedra to make use of VecGeom Polyhedron.
|
||||
|
||||
// History:
|
||||
// 31.10.13 G.Cosmo, CERN/PH
|
||||
// 31.10.13 G.Cosmo, CERN
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4UPOLYHEDRA_HH
|
||||
#define G4UPOLYHEDRA_HH
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Wrapper class for UTet to make use of UTet from USolids module.
|
||||
// Wrapper class for G4Tet to make use of VecGeom Tet.
|
||||
|
||||
// History:
|
||||
// 1.11.13 G.Cosmo, CERN/PH
|
||||
// 1.11.13 G.Cosmo, CERN
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4UTET_HH
|
||||
#define G4UTET_HH
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 106627 2017-10-17 06:23:58Z gcosmo $
|
||||
# $Id: sources.cmake 110072 2018-05-15 09:59:42Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -170,7 +170,7 @@ GEANT4_DEFINE_MODULE(NAME G4specsolids
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
${USOLIDS_LIBRARIES}
|
||||
${VECGEOM_LIBRARIES}
|
||||
)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
@@ -231,24 +231,26 @@ G4PolyconeHistorical* G4UPolycone::GetOriginalParameters() const
|
||||
}
|
||||
void G4UPolycone::SetOriginalParameters()
|
||||
{
|
||||
G4int numPlanes = GetNSections()+1;
|
||||
vecgeom::PolyconeHistorical* original_parameters = Base_t::GetOriginalParameters();
|
||||
|
||||
fOriginalParameters.Start_angle = original_parameters->fHStart_angle;
|
||||
fOriginalParameters.Opening_angle = original_parameters->fHOpening_angle;
|
||||
fOriginalParameters.Num_z_planes = original_parameters->fHNum_z_planes;
|
||||
|
||||
delete [] fOriginalParameters.Z_values;
|
||||
delete [] fOriginalParameters.Rmin;
|
||||
delete [] fOriginalParameters.Rmax;
|
||||
|
||||
G4int numPlanes = fOriginalParameters.Num_z_planes;
|
||||
fOriginalParameters.Z_values = new G4double[numPlanes];
|
||||
fOriginalParameters.Rmin = new G4double[numPlanes];
|
||||
fOriginalParameters.Rmax = new G4double[numPlanes];
|
||||
|
||||
for (G4int j=0; j<numPlanes; ++j)
|
||||
{
|
||||
fOriginalParameters.Z_values[j] = GetZAtPlane(j);
|
||||
fOriginalParameters.Rmax[j] = GetRmaxAtPlane(j);
|
||||
fOriginalParameters.Rmin[j] = GetRminAtPlane(j);
|
||||
}
|
||||
|
||||
fOriginalParameters.Start_angle = Base_t::GetStartPhi();
|
||||
fOriginalParameters.Opening_angle = Base_t::GetDeltaPhi();
|
||||
fOriginalParameters.Num_z_planes = numPlanes;
|
||||
for (G4int i=0; i<numPlanes; ++i)
|
||||
{
|
||||
fOriginalParameters.Z_values[i] = original_parameters->fHZ_values[i];
|
||||
fOriginalParameters.Rmin[i] = original_parameters->fHRmin[i];
|
||||
fOriginalParameters.Rmax[i] = original_parameters->fHRmax[i];
|
||||
}
|
||||
}
|
||||
void G4UPolycone::SetOriginalParameters(G4PolyconeHistorical* pars)
|
||||
{
|
||||
|
||||
@@ -245,7 +245,16 @@ G4PolyhedraHistorical* G4UPolyhedra::GetOriginalParameters() const
|
||||
}
|
||||
void G4UPolyhedra::SetOriginalParameters()
|
||||
{
|
||||
G4int numPlanes = GetZSegmentCount() + 1;
|
||||
G4double startPhi = GetPhiStart();
|
||||
G4double deltaPhi = GetPhiDelta();
|
||||
G4int numPlanes = GetZSegmentCount() + 1;
|
||||
G4int numSides = GetSideCount();
|
||||
|
||||
fOriginalParameters.Start_angle = startPhi;
|
||||
fOriginalParameters.Opening_angle = deltaPhi;
|
||||
fOriginalParameters.Num_z_planes = numPlanes;
|
||||
fOriginalParameters.numSide = numSides;
|
||||
|
||||
delete [] fOriginalParameters.Z_values;
|
||||
delete [] fOriginalParameters.Rmin;
|
||||
delete [] fOriginalParameters.Rmax;
|
||||
@@ -253,17 +262,13 @@ void G4UPolyhedra::SetOriginalParameters()
|
||||
fOriginalParameters.Rmin = new G4double[numPlanes];
|
||||
fOriginalParameters.Rmax = new G4double[numPlanes];
|
||||
|
||||
for (G4int j=0; j<numPlanes; ++j)
|
||||
G4double convertRad = std::cos(0.5*deltaPhi/numSides);
|
||||
for (G4int i=0; i<numPlanes; ++i)
|
||||
{
|
||||
fOriginalParameters.Z_values[j] = GetZPlanes()[j];
|
||||
fOriginalParameters.Rmax[j] = GetRMax()[j];
|
||||
fOriginalParameters.Rmin[j] = GetRMin()[j];
|
||||
fOriginalParameters.Z_values[i] = GetZPlanes()[i];
|
||||
fOriginalParameters.Rmax[i] = GetRMax()[i]/convertRad;
|
||||
fOriginalParameters.Rmin[i] = GetRMin()[i]/convertRad;
|
||||
}
|
||||
|
||||
fOriginalParameters.Start_angle = GetPhiStart();
|
||||
fOriginalParameters.Opening_angle = GetPhiDelta();
|
||||
fOriginalParameters.Num_z_planes = numPlanes;
|
||||
fOriginalParameters.numSide = GetSideCount();
|
||||
}
|
||||
void G4UPolyhedra::SetOriginalParameters(G4PolyhedraHistorical* pars)
|
||||
{
|
||||
@@ -298,18 +303,17 @@ G4bool G4UPolyhedra::Reset()
|
||||
wrDelta = twopi;
|
||||
}
|
||||
wrNumSide = fOriginalParameters.numSide;
|
||||
G4double convertRad = 1./std::cos(0.5*wrDelta/wrNumSide);
|
||||
rzcorners.resize(0);
|
||||
for (G4int i=0; i<fOriginalParameters.Num_z_planes; ++i)
|
||||
{
|
||||
G4double z = fOriginalParameters.Z_values[i];
|
||||
G4double r = fOriginalParameters.Rmax[i]*convertRad;
|
||||
G4double r = fOriginalParameters.Rmax[i];
|
||||
rzcorners.push_back(G4TwoVector(r,z));
|
||||
}
|
||||
for (G4int i=fOriginalParameters.Num_z_planes-1; i>=0; --i)
|
||||
{
|
||||
G4double z = fOriginalParameters.Z_values[i];
|
||||
G4double r = fOriginalParameters.Rmin[i]*convertRad;
|
||||
G4double r = fOriginalParameters.Rmin[i];
|
||||
rzcorners.push_back(G4TwoVector(r,z));
|
||||
}
|
||||
std::vector<G4int> iout;
|
||||
|
||||
Reference in New Issue
Block a user