Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -45,6 +45,8 @@ namespace
|
||||
G4RecursiveMutex polyhedronMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
G4VBooleanProcessor* G4BooleanSolid::fExternalBoolProcessor = nullptr;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor
|
||||
@@ -116,8 +118,7 @@ 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), fRebuildPolyhedron(false),
|
||||
fpPolyhedron(nullptr), createdDisplacedSolid(rhs.createdDisplacedSolid)
|
||||
fSurfaceArea(rhs.fSurfaceArea), createdDisplacedSolid(rhs.createdDisplacedSolid)
|
||||
{
|
||||
fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
|
||||
}
|
||||
@@ -200,7 +201,7 @@ G4VSolid* G4BooleanSolid::GetConstituentSolid(G4int no)
|
||||
|
||||
G4GeometryType G4BooleanSolid::GetEntityType() const
|
||||
{
|
||||
return G4String("G4BooleanSolid");
|
||||
return {"G4BooleanSolid"};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -280,7 +281,7 @@ void G4BooleanSolid::GetListOfPrimitives(
|
||||
}
|
||||
else
|
||||
{
|
||||
primitives.push_back(std::pair<G4VSolid*,G4Transform3D>(solid,transform));
|
||||
primitives.emplace_back(solid,transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,3 +424,22 @@ G4double G4BooleanSolid::GetCubicVolume()
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Set external Boolean processor.
|
||||
|
||||
void
|
||||
G4BooleanSolid::SetExternalBooleanProcessor(G4VBooleanProcessor* extProcessor)
|
||||
{
|
||||
fExternalBoolProcessor = extProcessor;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get external Boolean processor.
|
||||
|
||||
G4VBooleanProcessor* G4BooleanSolid::GetExternalBooleanProcessor()
|
||||
{
|
||||
return fExternalBoolProcessor;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ G4DisplacedSolid::G4DisplacedSolid( const G4String& pName,
|
||||
{
|
||||
fPtrSolid = ((G4DisplacedSolid*)pSolid)->GetConstituentMovedSolid();
|
||||
G4AffineTransform t1 = ((G4DisplacedSolid*)pSolid)->GetDirectTransform();
|
||||
G4AffineTransform t2 = G4AffineTransform(directTransform);
|
||||
auto t2 = G4AffineTransform(directTransform);
|
||||
fDirectTransform = new G4AffineTransform(t1*t2);
|
||||
}
|
||||
else
|
||||
@@ -471,7 +471,7 @@ G4ThreeVector G4DisplacedSolid::GetPointOnSurface() const
|
||||
|
||||
G4GeometryType G4DisplacedSolid::GetEntityType() const
|
||||
{
|
||||
return G4String("G4DisplacedSolid");
|
||||
return {"G4DisplacedSolid"};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -38,9 +38,10 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4PolyhedronArbitrary.hh"
|
||||
#include "HepPolyhedronProcessor.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Transfer all data members to G4BooleanSolid which is responsible
|
||||
// for them. pName will be in turn sent to G4VSolid
|
||||
@@ -53,7 +54,7 @@ G4IntersectionSolid::G4IntersectionSolid( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4IntersectionSolid::G4IntersectionSolid( const G4String& pName,
|
||||
@@ -65,7 +66,7 @@ G4IntersectionSolid::G4IntersectionSolid( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
@@ -77,7 +78,7 @@ G4IntersectionSolid::G4IntersectionSolid( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Fake default constructor - sets only member data and allocates memory
|
||||
// for usage restricted to object persistency.
|
||||
@@ -87,24 +88,19 @@ G4IntersectionSolid::G4IntersectionSolid( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
G4IntersectionSolid::~G4IntersectionSolid()
|
||||
{
|
||||
}
|
||||
G4IntersectionSolid::~G4IntersectionSolid() = default;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4IntersectionSolid::G4IntersectionSolid(const G4IntersectionSolid& rhs)
|
||||
: G4BooleanSolid (rhs)
|
||||
{
|
||||
}
|
||||
G4IntersectionSolid::G4IntersectionSolid(const G4IntersectionSolid&) = default;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
|
||||
@@ -190,7 +186,7 @@ G4IntersectionSolid::CalculateExtent(const EAxis pAxis,
|
||||
return out; // It exists in this slice only if both exist in it.
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Touching ? Empty intersection ?
|
||||
|
||||
@@ -206,7 +202,7 @@ EInside G4IntersectionSolid::Inside(const G4ThreeVector& p) const
|
||||
return kSurface; // surface A & B
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4ThreeVector
|
||||
@@ -267,7 +263,7 @@ G4IntersectionSolid::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
return normal;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The same algorithm as in DistanceToIn(p)
|
||||
|
||||
@@ -373,7 +369,7 @@ G4IntersectionSolid::DistanceToIn( const G4ThreeVector& p,
|
||||
return dist ;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Approximate nearest distance from the point p to the intersection of
|
||||
// two solids
|
||||
@@ -417,7 +413,7 @@ G4IntersectionSolid::DistanceToIn( const G4ThreeVector& p) const
|
||||
return dist ;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The same algorithm as DistanceToOut(p)
|
||||
|
||||
@@ -425,8 +421,8 @@ G4double
|
||||
G4IntersectionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n ) const
|
||||
{
|
||||
G4bool validNormA, validNormB;
|
||||
G4ThreeVector nA, nB;
|
||||
@@ -476,7 +472,7 @@ G4IntersectionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
return dist ;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Inverted algorithm of DistanceToIn(p)
|
||||
|
||||
@@ -502,24 +498,24 @@ G4IntersectionSolid::DistanceToOut( const G4ThreeVector& p ) const
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ComputeDimensions
|
||||
|
||||
void
|
||||
G4IntersectionSolid::ComputeDimensions( G4VPVParameterisation*,
|
||||
const G4int,
|
||||
const G4int,
|
||||
const G4VPhysicalVolume* )
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetEntityType
|
||||
|
||||
G4GeometryType G4IntersectionSolid::GetEntityType() const
|
||||
{
|
||||
return G4String("G4IntersectionSolid");
|
||||
return {"G4IntersectionSolid"};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -531,7 +527,7 @@ G4VSolid* G4IntersectionSolid::Clone() const
|
||||
return new G4IntersectionSolid(*this);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DescribeYourselfTo
|
||||
|
||||
@@ -541,18 +537,33 @@ G4IntersectionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
scene.AddSolid (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CreatePolyhedron
|
||||
|
||||
G4Polyhedron*
|
||||
G4IntersectionSolid::CreatePolyhedron () const
|
||||
{
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
G4Polyhedron* result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result)) { return result; }
|
||||
else { return nullptr; }
|
||||
if (fExternalBoolProcessor == nullptr)
|
||||
{
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
auto result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return fExternalBoolProcessor
|
||||
->Intersection(GetConstituentSolid(0)->GetPolyhedron(),
|
||||
GetConstituentSolid(1)->GetPolyhedron());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,11 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4PolyhedronArbitrary.hh"
|
||||
#include "HepPolyhedronProcessor.h"
|
||||
|
||||
#include "G4BooleanSolid.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
@@ -62,8 +65,7 @@ G4MultiUnion::G4MultiUnion(const G4String& name)
|
||||
|
||||
//______________________________________________________________________________
|
||||
G4MultiUnion::~G4MultiUnion()
|
||||
{
|
||||
}
|
||||
= default;
|
||||
|
||||
//______________________________________________________________________________
|
||||
void G4MultiUnion::AddNode(G4VSolid& solid, const G4Transform3D& trans)
|
||||
@@ -125,7 +127,7 @@ G4double G4MultiUnion::GetCubicVolume()
|
||||
// Computes the cubic volume of the "G4MultiUnion" structure using
|
||||
// random points
|
||||
|
||||
if (!fCubicVolume)
|
||||
if (fCubicVolume == 0.0)
|
||||
{
|
||||
G4ThreeVector extentMin, extentMax, d, p, point;
|
||||
G4int inside = 0, generated;
|
||||
@@ -218,7 +220,7 @@ G4double G4MultiUnion::DistanceToIn(const G4ThreeVector& aPoint,
|
||||
if (shift == kInfinity) return shift;
|
||||
|
||||
G4ThreeVector currentPoint = aPoint;
|
||||
if (shift) currentPoint += direction * shift;
|
||||
if (shift != 0.0) currentPoint += direction * shift;
|
||||
|
||||
G4SurfBits exclusion(fVoxels.GetBitsPerSlice());
|
||||
std::vector<G4int> candidates, curVoxel(3);
|
||||
@@ -227,7 +229,7 @@ G4double G4MultiUnion::DistanceToIn(const G4ThreeVector& aPoint,
|
||||
do
|
||||
{
|
||||
{
|
||||
if (fVoxels.GetCandidatesVoxelArray(curVoxel, candidates, &exclusion))
|
||||
if (fVoxels.GetCandidatesVoxelArray(curVoxel, candidates, &exclusion) != 0)
|
||||
{
|
||||
G4double distance = DistanceToInCandidates(aPoint, direction,
|
||||
candidates, exclusion);
|
||||
@@ -261,7 +263,7 @@ G4double G4MultiUnion::DistanceToOutNoVoxels(const G4ThreeVector& aPoint,
|
||||
G4double resultDistToOut = 0;
|
||||
G4ThreeVector currentPoint = aPoint;
|
||||
|
||||
G4int numNodes = (G4int)fSolids.size();
|
||||
auto numNodes = (G4int)fSolids.size();
|
||||
for (auto i = 0; i < numNodes; ++i)
|
||||
{
|
||||
if (i != ignoredSolid)
|
||||
@@ -274,7 +276,7 @@ G4double G4MultiUnion::DistanceToOutNoVoxels(const G4ThreeVector& aPoint,
|
||||
if (location != EInside::kOutside)
|
||||
{
|
||||
G4double distance = solid.DistanceToOut(localPoint, localDirection,
|
||||
aNormal);
|
||||
false, nullptr, aNormal);
|
||||
if (distance < kInfinity)
|
||||
{
|
||||
if (resultDistToOut == kInfinity) resultDistToOut = 0;
|
||||
@@ -328,7 +330,7 @@ G4double G4MultiUnion::DistanceToOutVoxels(const G4ThreeVector& aPoint,
|
||||
std::size_t numNodes = 2*fSolids.size();
|
||||
std::size_t count=0;
|
||||
|
||||
if (fVoxels.GetCandidatesVoxelArray(aPoint, candidates))
|
||||
if (fVoxels.GetCandidatesVoxelArray(aPoint, candidates) != 0)
|
||||
{
|
||||
// For normal case for which we presume the point is inside
|
||||
G4ThreeVector localPoint, localDirection, localNormal;
|
||||
@@ -372,7 +374,7 @@ G4double G4MultiUnion::DistanceToOutVoxels(const G4ThreeVector& aPoint,
|
||||
|
||||
// propagate with solid.DistanceToOut
|
||||
G4double shift = solid.DistanceToOut(localPoint, localDirection,
|
||||
false, 0, &localNormal);
|
||||
false, nullptr, &localNormal);
|
||||
if (maxDistance < shift)
|
||||
{
|
||||
maxDistance = shift;
|
||||
@@ -387,7 +389,7 @@ G4double G4MultiUnion::DistanceToOutVoxels(const G4ThreeVector& aPoint,
|
||||
const G4Transform3D& transform = fTransformObjs[maxCandidate];
|
||||
|
||||
// convert from local normal
|
||||
if (aNormal) *aNormal = GetGlobalVector(transform, maxNormal);
|
||||
if (aNormal != nullptr) *aNormal = GetGlobalVector(transform, maxNormal);
|
||||
|
||||
distance += maxDistance;
|
||||
currentPoint += maxDistance * direction;
|
||||
@@ -530,7 +532,7 @@ EInside G4MultiUnion::InsideNoVoxels(const G4ThreeVector& aPoint) const
|
||||
EInside location = EInside::kOutside;
|
||||
G4int countSurface = 0;
|
||||
|
||||
G4int numNodes = (G4int)fSolids.size();
|
||||
auto numNodes = (G4int)fSolids.size();
|
||||
for (auto i = 0 ; i < numNodes ; ++i)
|
||||
{
|
||||
G4VSolid& solid = *fSolids[i];
|
||||
@@ -557,7 +559,7 @@ void G4MultiUnion::Extent(EAxis aAxis, G4double& aMin, G4double& aMax) const
|
||||
// Determines the bounding box for the considered instance of "UMultipleUnion"
|
||||
G4ThreeVector min, max;
|
||||
|
||||
G4int numNodes = (G4int)fSolids.size();
|
||||
auto numNodes = (G4int)fSolids.size();
|
||||
for (auto i = 0 ; i < numNodes ; ++i)
|
||||
{
|
||||
G4VSolid& solid = *fSolids[i];
|
||||
@@ -663,7 +665,7 @@ G4ThreeVector G4MultiUnion::SurfaceNormal(const G4ThreeVector& aPoint) const
|
||||
// on a vertice remain to be treated
|
||||
|
||||
// determine weather we are in voxel area
|
||||
if (fVoxels.GetCandidatesVoxelArray(aPoint, candidates))
|
||||
if (fVoxels.GetCandidatesVoxelArray(aPoint, candidates) != 0)
|
||||
{
|
||||
std::size_t limit = candidates.size();
|
||||
for (std::size_t i = 0 ; i < limit ; ++i)
|
||||
@@ -814,7 +816,7 @@ G4double G4MultiUnion::DistanceToIn(const G4ThreeVector& point) const
|
||||
//______________________________________________________________________________
|
||||
G4double G4MultiUnion::GetSurfaceArea()
|
||||
{
|
||||
if (!fSurfaceArea)
|
||||
if (fSurfaceArea == 0.0)
|
||||
{
|
||||
fSurfaceArea = EstimateSurfaceArea(1000000, 0.001);
|
||||
}
|
||||
@@ -971,26 +973,56 @@ G4MultiUnion::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
//______________________________________________________________________________
|
||||
G4Polyhedron* G4MultiUnion::CreatePolyhedron() const
|
||||
{
|
||||
HepPolyhedronProcessor processor;
|
||||
HepPolyhedronProcessor::Operation operation = HepPolyhedronProcessor::UNION;
|
||||
|
||||
G4VSolid* solidA = GetSolid(0);
|
||||
const G4Transform3D transform0=GetTransformation(0);
|
||||
G4DisplacedSolid dispSolidA("placedA",solidA,transform0);
|
||||
|
||||
G4Polyhedron* top = new G4Polyhedron(*dispSolidA.GetPolyhedron());
|
||||
|
||||
for(G4int i=1; i<GetNumberOfSolids(); ++i)
|
||||
if (G4BooleanSolid::GetExternalBooleanProcessor() == nullptr)
|
||||
{
|
||||
G4VSolid* solidB = GetSolid(i);
|
||||
const G4Transform3D transform=GetTransformation(i);
|
||||
G4DisplacedSolid dispSolidB("placedB",solidB,transform);
|
||||
G4Polyhedron* operand = dispSolidB.GetPolyhedron();
|
||||
processor.push_back (operation, *operand);
|
||||
HepPolyhedronProcessor processor;
|
||||
HepPolyhedronProcessor::Operation operation = HepPolyhedronProcessor::UNION;
|
||||
|
||||
G4VSolid* solidA = GetSolid(0);
|
||||
const G4Transform3D transform0 = GetTransformation(0);
|
||||
G4DisplacedSolid dispSolidA("placedA", solidA, transform0);
|
||||
|
||||
auto top = new G4Polyhedron(*dispSolidA.GetPolyhedron());
|
||||
|
||||
for (G4int i = 1; i < GetNumberOfSolids(); ++i)
|
||||
{
|
||||
G4VSolid* solidB = GetSolid(i);
|
||||
const G4Transform3D transform = GetTransformation(i);
|
||||
G4DisplacedSolid dispSolidB("placedB", solidB, transform);
|
||||
G4Polyhedron* operand = dispSolidB.GetPolyhedron();
|
||||
processor.push_back(operation, *operand);
|
||||
}
|
||||
|
||||
if (processor.execute(*top))
|
||||
{
|
||||
return top;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4VSolid* solidA = GetSolid(0);
|
||||
auto solidAPolyhedron =
|
||||
dynamic_cast<G4PolyhedronArbitrary*>(solidA->GetPolyhedron());
|
||||
|
||||
const G4Transform3D transform0 = GetTransformation(0);
|
||||
G4DisplacedSolid dispSolidA("placedA", solidA, transform0);
|
||||
|
||||
// dispSolidA.GetPolyhedron()
|
||||
for (G4int i = 1; i < GetNumberOfSolids(); ++i)
|
||||
{
|
||||
G4VSolid* solidB = GetSolid(i);
|
||||
const G4Transform3D transform = GetTransformation(i);
|
||||
G4DisplacedSolid dispSolidB("placedB", solidB, transform);
|
||||
solidAPolyhedron = G4BooleanSolid::GetExternalBooleanProcessor()
|
||||
->Union(solidAPolyhedron, dispSolidB.GetPolyhedron());
|
||||
}
|
||||
|
||||
return solidAPolyhedron;
|
||||
}
|
||||
|
||||
if (processor.execute(*top)) { return top; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
@@ -1000,12 +1032,12 @@ G4Polyhedron* G4MultiUnion::GetPolyhedron() const
|
||||
fRebuildPolyhedron ||
|
||||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
|
||||
fpPolyhedron->GetNumberOfRotationSteps())
|
||||
{
|
||||
G4AutoLock l(&polyhedronMutex);
|
||||
delete fpPolyhedron;
|
||||
fpPolyhedron = CreatePolyhedron();
|
||||
fRebuildPolyhedron = false;
|
||||
l.unlock();
|
||||
}
|
||||
{
|
||||
G4AutoLock l(&polyhedronMutex);
|
||||
delete fpPolyhedron;
|
||||
fpPolyhedron = CreatePolyhedron();
|
||||
fRebuildPolyhedron = false;
|
||||
l.unlock();
|
||||
}
|
||||
return fpPolyhedron;
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ G4ThreeVector G4ScaledSolid::GetPointOnSurface() const
|
||||
//
|
||||
G4GeometryType G4ScaledSolid::GetEntityType() const
|
||||
{
|
||||
return G4String("G4ScaledSolid");
|
||||
return {"G4ScaledSolid"};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -340,9 +340,9 @@ G4VSolid* G4ScaledSolid::Clone() const
|
||||
//
|
||||
G4Scale3D G4ScaledSolid::GetScaleTransform() const
|
||||
{
|
||||
return G4Scale3D(fScale->GetScale().x(),
|
||||
fScale->GetScale().y(),
|
||||
fScale->GetScale().z());
|
||||
return { fScale->GetScale().x(),
|
||||
fScale->GetScale().y(),
|
||||
fScale->GetScale().z() };
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -351,7 +351,7 @@ G4Scale3D G4ScaledSolid::GetScaleTransform() const
|
||||
//
|
||||
void G4ScaledSolid::SetScaleTransform(const G4Scale3D& scale)
|
||||
{
|
||||
if (fScale != nullptr) { delete fScale; }
|
||||
delete fScale;
|
||||
fScale = new G4ScaleTransform(scale);
|
||||
fRebuildPolyhedron = true;
|
||||
}
|
||||
|
||||
@@ -39,13 +39,14 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4PolyhedronArbitrary.hh"
|
||||
#include "HepPolyhedronProcessor.h"
|
||||
|
||||
#include "G4IntersectionSolid.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Transfer all data members to G4BooleanSolid which is responsible
|
||||
// for them. pName will be in turn sent to G4VSolid
|
||||
@@ -57,7 +58,7 @@ G4SubtractionSolid::G4SubtractionSolid( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor
|
||||
|
||||
@@ -70,7 +71,7 @@ G4SubtractionSolid::G4SubtractionSolid( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor
|
||||
|
||||
@@ -82,7 +83,7 @@ G4SubtractionSolid::G4SubtractionSolid( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Fake default constructor - sets only member data and allocates memory
|
||||
// for usage restricted to object persistency.
|
||||
@@ -92,24 +93,19 @@ G4SubtractionSolid::G4SubtractionSolid( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4SubtractionSolid::~G4SubtractionSolid()
|
||||
{
|
||||
}
|
||||
G4SubtractionSolid::~G4SubtractionSolid() = default;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4SubtractionSolid::G4SubtractionSolid(const G4SubtractionSolid& rhs)
|
||||
: G4BooleanSolid (rhs)
|
||||
{
|
||||
}
|
||||
G4SubtractionSolid::G4SubtractionSolid(const G4SubtractionSolid&) = default;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
|
||||
@@ -173,7 +169,7 @@ G4SubtractionSolid::CalculateExtent( const EAxis pAxis,
|
||||
pTransform, pMin, pMax );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Touching ? Empty subtraction ?
|
||||
|
||||
@@ -196,7 +192,7 @@ EInside G4SubtractionSolid::Inside( const G4ThreeVector& p ) const
|
||||
fPtrSolidB->SurfaceNormal(p)).mag2() > rtol) ? kSurface : kOutside;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SurfaceNormal
|
||||
|
||||
@@ -259,13 +255,13 @@ G4SubtractionSolid::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
return normal;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The same algorithm as in DistanceToIn(p)
|
||||
|
||||
G4double
|
||||
G4SubtractionSolid::DistanceToIn( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v ) const
|
||||
G4SubtractionSolid::DistanceToIn( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v ) const
|
||||
{
|
||||
G4double dist = 0.0, dist2 = 0.0, disTmp = 0.0;
|
||||
|
||||
@@ -397,7 +393,7 @@ G4SubtractionSolid::DistanceToIn( const G4ThreeVector& p,
|
||||
return dist ;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Approximate nearest distance from the point p to the intersection of
|
||||
// two solids. It is usually underestimated from the point of view of
|
||||
@@ -435,16 +431,16 @@ G4SubtractionSolid::DistanceToIn( const G4ThreeVector& p ) const
|
||||
return dist;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The same algorithm as DistanceToOut(p)
|
||||
|
||||
G4double
|
||||
G4SubtractionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n ) const
|
||||
{
|
||||
#ifdef G4BOOLDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
@@ -489,7 +485,7 @@ G4SubtractionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
return distout;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Inverted algorithm of DistanceToIn(p)
|
||||
|
||||
@@ -519,13 +515,13 @@ G4SubtractionSolid::DistanceToOut( const G4ThreeVector& p ) const
|
||||
return dist;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
G4GeometryType G4SubtractionSolid::GetEntityType() const
|
||||
{
|
||||
return G4String("G4SubtractionSolid");
|
||||
return {"G4SubtractionSolid"};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -537,7 +533,7 @@ G4VSolid* G4SubtractionSolid::Clone() const
|
||||
return new G4SubtractionSolid(*this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ComputeDimensions
|
||||
|
||||
@@ -548,7 +544,7 @@ G4SubtractionSolid::ComputeDimensions( G4VPVParameterisation*,
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DescribeYourselfTo
|
||||
|
||||
@@ -558,51 +554,66 @@ G4SubtractionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
scene.AddSolid (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CreatePolyhedron
|
||||
|
||||
G4Polyhedron*
|
||||
G4SubtractionSolid::CreatePolyhedron () const
|
||||
G4Polyhedron* G4SubtractionSolid::CreatePolyhedron () const
|
||||
{
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
G4Polyhedron* result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result)) { return result; }
|
||||
else { return nullptr; }
|
||||
if (fExternalBoolProcessor == nullptr)
|
||||
{
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
auto result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return fExternalBoolProcessor
|
||||
->Subtraction(GetConstituentSolid(0)->GetPolyhedron(),
|
||||
GetConstituentSolid(1)->GetPolyhedron());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetCubicVolume
|
||||
//
|
||||
|
||||
G4double G4SubtractionSolid::GetCubicVolume()
|
||||
{
|
||||
if( fCubicVolume != -1.0 ) {
|
||||
return fCubicVolume;
|
||||
}
|
||||
if( fCubicVolume != -1.0 )
|
||||
{
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
G4double cubVolumeA = fPtrSolidA->GetCubicVolume();
|
||||
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();
|
||||
}
|
||||
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;
|
||||
if (fCubicVolume < 0.01*cubVolumeA) fCubicVolume = G4VSolid::GetCubicVolume();
|
||||
fCubicVolume = cubVolumeA - intersection;
|
||||
if (fCubicVolume < 0.01*cubVolumeA) fCubicVolume = G4VSolid::GetCubicVolume();
|
||||
|
||||
return fCubicVolume;
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
@@ -41,11 +41,12 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4PolyhedronArbitrary.hh"
|
||||
#include "HepPolyhedronProcessor.h"
|
||||
|
||||
#include "G4IntersectionSolid.hh"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Transfer all data members to G4BooleanSolid which is responsible
|
||||
// for them. pName will be in turn sent to G4VSolid
|
||||
@@ -58,7 +59,7 @@ G4UnionSolid:: G4UnionSolid( const G4String& pName,
|
||||
Init();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor
|
||||
|
||||
@@ -73,7 +74,7 @@ G4UnionSolid::G4UnionSolid( const G4String& pName,
|
||||
Init();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor
|
||||
|
||||
@@ -86,7 +87,7 @@ G4UnionSolid::G4UnionSolid( const G4String& pName,
|
||||
Init();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Fake default constructor - sets only member data and allocates memory
|
||||
// for usage restricted to object persistency.
|
||||
@@ -96,15 +97,14 @@ G4UnionSolid::G4UnionSolid( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4UnionSolid::~G4UnionSolid()
|
||||
{
|
||||
}
|
||||
= default;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -116,7 +116,7 @@ G4UnionSolid::G4UnionSolid(const G4UnionSolid& rhs)
|
||||
halfCarTolerance=0.5*kCarTolerance;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
|
||||
@@ -137,7 +137,7 @@ G4UnionSolid& G4UnionSolid::operator = (const G4UnionSolid& rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Initialisation
|
||||
|
||||
@@ -218,7 +218,7 @@ G4UnionSolid::CalculateExtent( const EAxis pAxis,
|
||||
return out ; // It exists in this slice if either one does.
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Important comment: When solids A and B touch together along flat
|
||||
// surface the surface points will be considered as kSurface, while points
|
||||
@@ -245,7 +245,7 @@ EInside G4UnionSolid::Inside( const G4ThreeVector& p ) const
|
||||
fPtrSolidB->SurfaceNormal(p)).mag2() < rtol) ? kInside : kSurface;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface normal
|
||||
|
||||
@@ -285,7 +285,7 @@ G4UnionSolid::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
return fPtrSolidA->SurfaceNormal(p);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The same algorithm as in DistanceToIn(p)
|
||||
|
||||
@@ -313,13 +313,13 @@ G4UnionSolid::DistanceToIn( const G4ThreeVector& p,
|
||||
fPtrSolidB->DistanceToIn(p,v) ) ;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Approximate nearest distance from the point p to the union of
|
||||
// two solids
|
||||
|
||||
G4double
|
||||
G4UnionSolid::DistanceToIn( const G4ThreeVector& p) const
|
||||
G4UnionSolid::DistanceToIn( const G4ThreeVector& p ) const
|
||||
{
|
||||
#ifdef G4BOOLDEBUG
|
||||
if( Inside(p) == kInside )
|
||||
@@ -341,16 +341,16 @@ G4UnionSolid::DistanceToIn( const G4ThreeVector& p) const
|
||||
return safety ;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The same algorithm as DistanceToOut(p)
|
||||
|
||||
G4double
|
||||
G4UnionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n ) const
|
||||
{
|
||||
G4double dist = 0.0, disTmp = 0.0 ;
|
||||
G4ThreeVector normTmp;
|
||||
@@ -428,7 +428,7 @@ G4UnionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
return dist ;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Inverted algorithm of DistanceToIn(p)
|
||||
|
||||
@@ -479,13 +479,13 @@ G4UnionSolid::DistanceToOut( const G4ThreeVector& p ) const
|
||||
return distout;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetEntityType
|
||||
|
||||
G4GeometryType G4UnionSolid::GetEntityType() const
|
||||
{
|
||||
return G4String("G4UnionSolid");
|
||||
return {"G4UnionSolid"};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -497,7 +497,7 @@ G4VSolid* G4UnionSolid::Clone() const
|
||||
return new G4UnionSolid(*this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ComputeDimensions
|
||||
|
||||
@@ -508,7 +508,7 @@ G4UnionSolid::ComputeDimensions( G4VPVParameterisation*,
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DescribeYourselfTo
|
||||
|
||||
@@ -518,51 +518,66 @@ G4UnionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
scene.AddSolid (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CreatePolyhedron
|
||||
|
||||
G4Polyhedron*
|
||||
G4UnionSolid::CreatePolyhedron () const
|
||||
G4UnionSolid::CreatePolyhedron () const
|
||||
{
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
G4Polyhedron* result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result)) { return result; }
|
||||
else { return nullptr; }
|
||||
if (fExternalBoolProcessor == nullptr)
|
||||
{
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
auto result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return fExternalBoolProcessor
|
||||
->Union(GetConstituentSolid(0)->GetPolyhedron(),
|
||||
GetConstituentSolid(1)->GetPolyhedron());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetCubicVolume
|
||||
|
||||
G4double G4UnionSolid::GetCubicVolume()
|
||||
{
|
||||
if( fCubicVolume != -1.0 ) {
|
||||
return fCubicVolume;
|
||||
}
|
||||
G4double cubVolumeA = fPtrSolidA->GetCubicVolume();
|
||||
G4double cubVolumeB = fPtrSolidB->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);
|
||||
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();
|
||||
}
|
||||
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;
|
||||
fCubicVolume = cubVolumeA + cubVolumeB - intersection;
|
||||
|
||||
return fCubicVolume;
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user