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();
}