Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
+8
View File
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
------------------------------------------------------------------------------
## 2023-10-28 Stewart Boogert (geom-bool-V11-01-05)
- Fix problem with downcast in external boolean processor, could result incorrect nullptr
## 2023-09-14 Gabriele Cosmo, Evgueni Tcherniaev (geom-bool-V11-01-04)
- Define distinct statistics value in G4BooleanSolid for area and cubic volume.
- Reduce internal statistics for calculation of cubic volume in G4UnionSolid
and G4SubtractionSolid.
## 2023-05-10 Gabriele Cosmo (geom-bool-V11-01-03)
- Applied clang-tidy fixes (readability, modernization, performance, ...).
@@ -123,17 +123,19 @@ class G4BooleanSolid : public G4VSolid
G4VSolid* fPtrSolidB = nullptr;
G4double fCubicVolume = -1.0;
// Stored value of fCubicVolume
// Cached value of fCubicVolume
G4double fSurfaceArea = -1.0;
// Cached value of Surface Area
static G4VBooleanProcessor* fExternalBoolProcessor;
// External Boolean processor
private:
G4int fStatistics = 1000000;
G4int fCubVolStatistics = 1000000;
G4int fAreaStatistics = 1000000;
G4double fCubVolEpsilon = 0.001;
G4double fAreaAccuracy = -1;
G4double fSurfaceArea = -1.0;
mutable G4bool fRebuildPolyhedron = false;
mutable G4Polyhedron* fpPolyhedron = nullptr;
@@ -30,7 +30,7 @@
inline
G4int G4BooleanSolid::GetCubVolStatistics() const
{
return fStatistics;
return fCubVolStatistics;
}
inline
@@ -42,21 +42,21 @@ G4double G4BooleanSolid::GetCubVolEpsilon() const
inline
void G4BooleanSolid::SetCubVolStatistics(G4int st)
{
fCubicVolume = -1.;
fStatistics = st;
if (st != fCubVolStatistics) { fCubicVolume = -1.; }
fCubVolStatistics = st;
}
inline
void G4BooleanSolid::SetCubVolEpsilon(G4double ep)
{
fCubicVolume = -1.;
if (ep != fCubVolEpsilon) { fCubicVolume = -1.; }
fCubVolEpsilon = ep;
}
inline
G4int G4BooleanSolid::GetAreaStatistics() const
{
return fStatistics;
return fAreaStatistics;
}
inline
@@ -68,14 +68,14 @@ G4double G4BooleanSolid::GetAreaAccuracy() const
inline
void G4BooleanSolid::SetAreaStatistics(G4int st)
{
fSurfaceArea = -1.;
fStatistics = st;
if (st != fAreaStatistics) { fSurfaceArea = -1.; }
fAreaStatistics = st;
}
inline
void G4BooleanSolid::SetAreaAccuracy(G4double ep)
{
fSurfaceArea = -1.;
if (ep != fAreaAccuracy) { fSurfaceArea = -1.; }
fAreaAccuracy = ep;
}
@@ -84,7 +84,7 @@ G4double G4BooleanSolid::GetSurfaceArea()
{
if(fSurfaceArea < 0.)
{
fSurfaceArea = EstimateSurfaceArea(fStatistics,fAreaAccuracy);
fSurfaceArea = EstimateSurfaceArea(fAreaStatistics, fAreaAccuracy);
}
return fSurfaceArea;
}
@@ -116,9 +116,12 @@ G4BooleanSolid::~G4BooleanSolid()
G4BooleanSolid::G4BooleanSolid(const G4BooleanSolid& rhs)
: G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
fCubicVolume(rhs.fCubicVolume), fStatistics(rhs.fStatistics),
fCubVolEpsilon(rhs.fCubVolEpsilon), fAreaAccuracy(rhs.fAreaAccuracy),
fSurfaceArea(rhs.fSurfaceArea), createdDisplacedSolid(rhs.createdDisplacedSolid)
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
fCubVolStatistics(rhs.fCubVolStatistics),
fAreaStatistics(rhs.fAreaStatistics),
fCubVolEpsilon(rhs.fCubVolEpsilon),
fAreaAccuracy(rhs.fAreaAccuracy),
createdDisplacedSolid(rhs.createdDisplacedSolid)
{
fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
}
@@ -140,10 +143,11 @@ G4BooleanSolid& G4BooleanSolid::operator = (const G4BooleanSolid& rhs)
// Copy data
//
fPtrSolidA= rhs.fPtrSolidA; fPtrSolidB= rhs.fPtrSolidB;
fStatistics= rhs.fStatistics; fCubVolEpsilon= rhs.fCubVolEpsilon;
fAreaAccuracy= rhs.fAreaAccuracy; fCubicVolume= rhs.fCubicVolume;
fSurfaceArea= rhs.fSurfaceArea;
fCubicVolume= rhs.fCubicVolume; fSurfaceArea= rhs.fSurfaceArea;
fCubVolStatistics = rhs.fCubVolStatistics; fCubVolEpsilon = rhs.fCubVolEpsilon;
fAreaStatistics = rhs.fAreaStatistics; fAreaAccuracy = rhs.fAreaAccuracy;
createdDisplacedSolid= rhs.createdDisplacedSolid;
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron = nullptr;
fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
@@ -414,13 +418,13 @@ G4BooleanSolid::StackPolyhedron(HepPolyhedronProcessor& processor,
//////////////////////////////////////////////////////////////////////////
//
// Estimate Cubic Volume (capacity) and store it for reuse.
// Estimate Cubic Volume (capacity) and cache it for reuse.
G4double G4BooleanSolid::GetCubicVolume()
{
if(fCubicVolume < 0.)
{
fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon);
fCubicVolume = EstimateCubicVolume(fCubVolStatistics, fCubVolEpsilon);
}
return fCubicVolume;
}
@@ -1005,8 +1005,7 @@ G4Polyhedron* G4MultiUnion::CreatePolyhedron() const
else
{
G4VSolid* solidA = GetSolid(0);
auto solidAPolyhedron =
dynamic_cast<G4PolyhedronArbitrary*>(solidA->GetPolyhedron());
auto solidAPolyhedron =solidA->GetPolyhedron();
const G4Transform3D transform0 = GetTransformation(0);
G4DisplacedSolid dispSolidA("placedA", solidA, transform0);
@@ -607,8 +607,9 @@ G4double G4SubtractionSolid::GetCubicVolume()
bminB.x() < bmaxA.x() && bminB.y() < bmaxA.y() && bminB.z() < bmaxA.z();
if ( canIntersect )
{
G4IntersectionSolid intersectVol( "Temporary-Intersection-for-Union",
G4IntersectionSolid intersectVol( "Temporary-Intersection-for-Subtraction",
fPtrSolidA, fPtrSolidB );
intersectVol.SetCubVolStatistics(100000);
intersection = intersectVol.GetCubicVolume();
}
@@ -574,6 +574,7 @@ G4double G4UnionSolid::GetCubicVolume()
{
G4IntersectionSolid intersectVol( "Temporary-Intersection-for-Union",
fPtrSolidA, fPtrSolidB );
intersectVol.SetCubVolStatistics(100000);
intersection = intersectVol.GetCubicVolume();
}
+3
View File
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-07-10 Evgueni Tcherniaev (geom-specific-V11-01-06)
- Fixed bounding box calculation in G4VTwistedFaceted::BoundingLimits().
## 2023-06-16 Stephan Hageboeck (geom-specific-V11-01-05)
- Fix an uninitialised value in G4VCSGfaceted::SurfaceNormal().
@@ -288,9 +288,35 @@ void G4VTwistedFaceted::ComputeDimensions(G4VPVParameterisation* ,
void G4VTwistedFaceted::BoundingLimits(G4ThreeVector& pMin,
G4ThreeVector& pMax) const
{
G4double maxRad = std::sqrt(fDx*fDx + fDy*fDy);
pMin.set(-maxRad,-maxRad,-fDz);
pMax.set( maxRad, maxRad, fDz);
G4double cosPhi = std::cos(fPhi);
G4double sinPhi = std::sin(fPhi);
G4double tanTheta = std::tan(fTheta);
G4double tanAlpha = fTAlph;
G4double xmid1 = fDy1*tanAlpha;
G4double x1 = std::abs(xmid1 + fDx1);
G4double x2 = std::abs(xmid1 - fDx1);
G4double x3 = std::abs(xmid1 + fDx2);
G4double x4 = std::abs(xmid1 - fDx2);
G4double xmax1 = std::max(std::max(std::max(x1, x2), x3), x4);
G4double rmax1 = std::sqrt(xmax1*xmax1 + fDy1*fDy1);
G4double xmid2 = fDy2*tanAlpha;
G4double x5 = std::abs(xmid2 + fDx3);
G4double x6 = std::abs(xmid2 - fDx3);
G4double x7 = std::abs(xmid2 + fDx4);
G4double x8 = std::abs(xmid2 - fDx4);
G4double xmax2 = std::max(std::max(std::max(x5, x6), x7), x8);
G4double rmax2 = std::sqrt(xmax2*xmax2 + fDy2*fDy2);
G4double x0 = fDz*tanTheta*cosPhi;
G4double y0 = fDz*tanTheta*sinPhi;
G4double xmin = std::min(-x0 - rmax1, x0 - rmax2);
G4double ymin = std::min(-y0 - rmax1, y0 - rmax2);
G4double xmax = std::max(-x0 + rmax1, x0 + rmax2);
G4double ymax = std::max(-y0 + rmax1, y0 + rmax2);
pMin.set(xmin, ymin,-fDz);
pMax.set(xmax, ymax, fDz);
}