Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
+21 -8
View File
@@ -19,7 +19,20 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
January 28, 2021 I.Hrivnacova, E.Tcherniaev geom-bool-V10-06-01
May 6, 2021 J.Apostolakis geom-bool-V10-07-02
- Revised GetCubicVolume of UnionSolid and SubtractionSolid to use cubic volume
of constituent volume(s) and the intersection solid.
Test cases show the potential for improvement: factors of 40-3000.
Cases with small overlap will improve most. Not all cases will improve.
Need to monitor cpu cost in most difficult cases:
- Union now involves 3 calculations (a, b, a n b) - likely 2x cost.
- Subtraction involves 2 calculations (a, a n b) - 1.5x cost.
March 30, 2021 B.Morgan geom-bool-V10-07-01
- Migrate sources.cmake to modular build API
January 5, 2021 I.Hrivnacova, E.Tcherniaev geom-bool-V10-07-00
- Added protection against using invalid normal
in G4ScaledSolid::DistanceToOut(p,v, ...)
@@ -235,8 +248,8 @@ December 10, 2019 B.Morgan geom-bool-V10-06-00
- G4SubtractionSolid: improved SurfaceNormal() method, by caching the
result of the calls to fPtrSolidA->Inside() and fPtrSolidB->Inside().
Corrected debug printout to say 'Point p is *out*side' not inside.
NOTE: further improvement can be made by creating new method
Inside( point, &resultInsideA, &resultInsideB );
NOTE: further improvement can be made by creating new method
Inside( point, &resultInsideA, &resultInsideB );
which can be called by a 'bare' Inside( point ) method.
June 12, 2012 G.Cosmo geom-bool-V09-05-02
@@ -509,7 +522,7 @@ December 10, 2019 B.Morgan geom-bool-V10-06-00
argument *n. Previous fix was incomplete!
Jan 23 2001 Gabriele Cosmo geom-solid-bool-V03-00-01
- Fixed wrong labels for G4Exception calls in G4UnionSolid.cc and
G4SubtractionSolid.cc to identify the correct class.
Fixes bug report #200.
@@ -596,7 +609,7 @@ December 10, 2019 B.Morgan geom-bool-V10-06-00
Nov 24 1999 geom-solid-bool-V00-01-05
- Small fix in src/G4DisplacedSolid.cc to the return type
- Small fix in src/G4DisplacedSolid.cc to the return type
(const G4AffineTransform --> G4AffineTransform)
to conform with the specification of the class.
@@ -618,14 +631,14 @@ December 10, 2019 B.Morgan geom-bool-V10-06-00
New method: Get Object Rotation/Translation methods in Displaced Solid
Nov 9 1999 geom-solid-bool-V00-01-02-cand
- Tag with additional methods for Visualisation
G4DisplacedSolid, G4BooleanSolid
Added methods to access data members:
Get Constituent Solid (int) for Boolean Solid
Get Constituent Solid for Displaced Solid
Get Constituent Solid (int) for Boolean Solid
Get Constituent Solid for Displaced Solid
Get Frame Rotation/Translation methods in Displaced Solid
@@ -70,7 +70,7 @@ class G4BooleanSolid : public G4VSolid
// return the corresponding solid (for no=0 and 1).
// If the solid is not a "Boolean", return 0.
inline G4double GetCubicVolume();
virtual G4double GetCubicVolume();
inline G4double GetSurfaceArea();
virtual G4GeometryType GetEntityType() const;
@@ -82,12 +82,12 @@ class G4BooleanSolid : public G4VSolid
inline G4double GetCubVolEpsilon() const;
inline void SetCubVolStatistics(G4int st);
inline void SetCubVolEpsilon(G4double ep);
inline G4int GetAreaStatistics() const;
inline G4double GetAreaAccuracy() const;
inline void SetAreaStatistics(G4int st);
inline void SetAreaAccuracy(G4double ep);
G4ThreeVector GetPointOnSurface() const;
public: // without description
@@ -116,12 +116,14 @@ class G4BooleanSolid : public G4VSolid
G4VSolid* fPtrSolidA = nullptr;
G4VSolid* fPtrSolidB = nullptr;
G4double fCubicVolume = -1.0;
// Stored value of fCubicVolume
private:
G4int fStatistics = 1000000;
G4double fCubVolEpsilon = 0.001;
G4double fAreaAccuracy = -1;
G4double fCubicVolume = -1.0;
G4double fSurfaceArea = -1.0;
mutable G4bool fRebuildPolyhedron = false;
@@ -79,16 +79,6 @@ void G4BooleanSolid::SetAreaAccuracy(G4double ep)
fAreaAccuracy = ep;
}
inline
G4double G4BooleanSolid::GetCubicVolume()
{
if(fCubicVolume < 0.)
{
fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon);
}
return fCubicVolume;
}
inline
G4double G4BooleanSolid::GetSurfaceArea()
{
@@ -111,6 +111,7 @@ class G4SubtractionSolid : public G4BooleanSolid
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
G4Polyhedron* CreatePolyhedron () const ;
virtual G4double GetCubicVolume() final;
};
#endif
@@ -110,6 +110,8 @@ class G4UnionSolid : public G4BooleanSolid
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
G4Polyhedron* CreatePolyhedron () const ;
virtual G4double GetCubicVolume() final;
private:
G4ThreeVector fPMin, fPMax; // bounding box extended by half-tolerance
+7 -25
View File
@@ -1,13 +1,8 @@
#------------------------------------------------------------------------------
# Module : G4geomBoolean
# Package: Geant4.src.G4geometry.G4geomBoolean
#------------------------------------------------------------------------------
# - G4geomBoolean module build definition
#
# Define the Geant4 Module.
#
geant4_define_module(NAME G4geomBoolean
HEADERS
geant4_add_module(G4geomBoolean
PUBLIC_HEADERS
G4BooleanSolid.hh
G4BooleanSolid.icc
G4DisplacedSolid.hh
@@ -23,21 +18,8 @@ geant4_define_module(NAME G4geomBoolean
G4MultiUnion.cc
G4ScaledSolid.cc
G4SubtractionSolid.cc
G4UnionSolid.cc
GRANULAR_DEPENDENCIES
G4geometrymng
G4globman
G4graphics_reps
G4intercoms
G4volumes
G4csg
G4specsolids
GLOBAL_DEPENDENCIES
G4global
G4graphics_reps
G4intercoms
LINK_LIBRARIES
${VECGEOM_LIBRARIES}
)
G4UnionSolid.cc)
# List any source specific properties here
geant4_module_link_libraries(G4geomBoolean
PUBLIC G4geometrymng G4hepgeometry G4globman G4specsolids ${VECGEOM_LIBRARIES}
PRIVATE G4graphics_reps G4heprandom)
@@ -114,8 +114,8 @@ G4BooleanSolid::~G4BooleanSolid()
G4BooleanSolid::G4BooleanSolid(const G4BooleanSolid& rhs)
: G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
fStatistics(rhs.fStatistics), fCubVolEpsilon(rhs.fCubVolEpsilon),
fAreaAccuracy(rhs.fAreaAccuracy), fCubicVolume(rhs.fCubicVolume),
fCubicVolume(rhs.fCubicVolume), fStatistics(rhs.fStatistics),
fCubVolEpsilon(rhs.fCubVolEpsilon), fAreaAccuracy(rhs.fAreaAccuracy),
fSurfaceArea(rhs.fSurfaceArea), fRebuildPolyhedron(false),
fpPolyhedron(nullptr), createdDisplacedSolid(rhs.createdDisplacedSolid)
{
@@ -409,3 +409,17 @@ G4BooleanSolid::StackPolyhedron(HepPolyhedronProcessor& processor,
return top;
}
//////////////////////////////////////////////////////////////////////////
//
// Estimate Cubic Volume (capacity) and store it for reuse.
G4double G4BooleanSolid::GetCubicVolume()
{
if(fCubicVolume < 0.)
{
fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon);
}
return fCubicVolume;
}
@@ -41,6 +41,8 @@
#include "G4Polyhedron.hh"
#include "HepPolyhedronProcessor.h"
#include "G4IntersectionSolid.hh"
#include <sstream>
///////////////////////////////////////////////////////////////////
@@ -571,3 +573,35 @@ G4SubtractionSolid::CreatePolyhedron () const
if (processor.execute(*result)) { return result; }
else { return nullptr; }
}
////////////////////////////////////////////////////
//
// GetCubicVolume
//
G4double G4SubtractionSolid::GetCubicVolume()
{
if( fCubicVolume != -1.0 ) {
return fCubicVolume;
}
G4double cubVolumeA = fPtrSolidA->GetCubicVolume();
G4ThreeVector bminA, bmaxA, bminB, bmaxB;
fPtrSolidA->BoundingLimits(bminA, bmaxA);
fPtrSolidB->BoundingLimits(bminB, bmaxB);
G4double intersection = 0.;
G4bool canIntersect =
bminA.x() < bmaxB.x() && bminA.y() < bmaxB.y() && bminA.z() < bmaxB.z() &&
bminB.x() < bmaxA.x() && bminB.y() < bmaxA.y() && bminB.z() < bmaxA.z();
if ( canIntersect )
{
G4IntersectionSolid intersectVol( "Temporary-Intersection-for-Union",
fPtrSolidA, fPtrSolidB );
intersection = intersectVol.GetCubicVolume();
}
fCubicVolume = cubVolumeA - intersection;
return fCubicVolume;
}
@@ -43,6 +43,8 @@
#include "G4Polyhedron.hh"
#include "HepPolyhedronProcessor.h"
#include "G4IntersectionSolid.hh"
///////////////////////////////////////////////////////////////////
//
// Transfer all data members to G4BooleanSolid which is responsible
@@ -526,3 +528,36 @@ G4UnionSolid::CreatePolyhedron () const
if (processor.execute(*result)) { return result; }
else { return nullptr; }
}
////////////////////////////////////////////////////
//
// GetCubicVolume
G4double G4UnionSolid::GetCubicVolume()
{
if( fCubicVolume != -1.0 ) {
return fCubicVolume;
}
G4double cubVolumeA = fPtrSolidA->GetCubicVolume();
G4double cubVolumeB = fPtrSolidB->GetCubicVolume();
G4ThreeVector bminA, bmaxA, bminB, bmaxB;
fPtrSolidA->BoundingLimits(bminA, bmaxA);
fPtrSolidB->BoundingLimits(bminB, bmaxB);
G4double intersection = 0.;
G4bool canIntersect =
bminA.x() < bmaxB.x() && bminA.y() < bmaxB.y() && bminA.z() < bmaxB.z() &&
bminB.x() < bmaxA.x() && bminB.y() < bmaxA.y() && bminB.z() < bmaxA.z();
if ( canIntersect )
{
G4IntersectionSolid intersectVol( "Temporary-Intersection-for-Union",
fPtrSolidA, fPtrSolidB );
intersection = intersectVol.GetCubicVolume();
}
fCubicVolume = cubVolumeA + cubVolumeB - intersection;
return fCubicVolume;
}