57 :
G4VSolid(pName), fPtrSolidA(pSolidA), fPtrSolidB(pSolidB)
70 :
G4VSolid(pName), createdDisplacedSolid(true)
84 :
G4VSolid(pName), createdDisplacedSolid(true)
106 if(createdDisplacedSolid)
110 delete fpPolyhedron; fpPolyhedron =
nullptr;
118 :
G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
119 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
120 fCubVolStatistics(rhs.fCubVolStatistics),
121 fAreaStatistics(rhs.fAreaStatistics),
122 fCubVolEpsilon(rhs.fCubVolEpsilon),
123 fAreaAccuracy(rhs.fAreaAccuracy),
124 createdDisplacedSolid(rhs.createdDisplacedSolid)
126 fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
137 if (
this == &rhs) {
return *
this; }
147 fCubVolStatistics = rhs.fCubVolStatistics; fCubVolEpsilon = rhs.fCubVolEpsilon;
148 fAreaStatistics = rhs.fAreaStatistics; fAreaAccuracy = rhs.fAreaAccuracy;
149 createdDisplacedSolid= rhs.createdDisplacedSolid;
151 fRebuildPolyhedron =
false;
152 delete fpPolyhedron; fpPolyhedron =
nullptr;
153 fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
174 G4Exception(
"G4BooleanSolid::GetConstituentSolid()",
196 G4Exception(
"G4BooleanSolid::GetConstituentSolid()",
208 return {
"G4BooleanSolid"};
217 os <<
"-----------------------------------------------------------\n"
218 <<
" *** Dump for Boolean solid - " <<
GetName() <<
" ***\n"
219 <<
" ===================================================\n"
221 <<
" Parameters of constituent solids: \n"
222 <<
"===========================================================\n";
225 os <<
"===========================================================\n";
235 std::vector<std::pair<G4VSolid*,G4Transform3D>>& primitives,
244 for (
auto i=0; i<2; ++i)
246 transform = curPlacement;
252 while (type ==
"G4DisplacedSolid" ||
253 type ==
"G4ReflectedSolid" ||
254 type ==
"G4ScaledSolid")
256 if (type ==
"G4DisplacedSolid")
263 else if (type ==
"G4ReflectedSolid")
268 else if (type ==
"G4ScaledSolid")
270 transform = transform * ((
G4ScaledSolid*)solid)->GetScaleTransform();
279 if (type ==
"G4UnionSolid" ||
280 type ==
"G4SubtractionSolid" ||
281 type ==
"G4IntersectionSolid" ||
282 type ==
"G4BooleanSolid")
284 ((
G4BooleanSolid *)solid)->GetListOfPrimitives(primitives,transform);
288 primitives.emplace_back(solid,transform);
300 std::size_t nprims = fPrimitives.size();
301 std::pair<G4VSolid *, G4Transform3D> prim;
308 nprims = fPrimitives.size();
309 fPrimitivesSurfaceArea = 0.;
310 for (std::size_t i=0; i<nprims; ++i)
312 fPrimitivesSurfaceArea += fPrimitives[i].first->GetSurfaceArea();
320 for (std::size_t k=0; k<100000; ++k)
324 for (std::size_t i=0; i<nprims; ++i)
326 prim = fPrimitives[i];
327 area += prim.first->GetSurfaceArea();
328 if (rand < area)
break;
330 p = prim.first->GetPointOnSurface();
334 std::ostringstream message;
335 message <<
"Solid - " <<
GetName() <<
"\n"
336 <<
"All 100k attempts to generate a point on the surface have failed!\n"
337 <<
"The solid created may be an invalid Boolean construct!";
349 if (fpPolyhedron ==
nullptr ||
350 fRebuildPolyhedron ||
357 fRebuildPolyhedron =
false;
373 if (type ==
"G4UnionSolid")
375 else if (type ==
"G4IntersectionSolid")
377 else if (type ==
"G4SubtractionSolid")
381 std::ostringstream message;
382 message <<
"Solid - " << solid->
GetName()
383 <<
" - Unrecognised composite solid" <<
G4endl
384 <<
" Returning NULL !";
402 if (operand !=
nullptr)
404 processor.
push_back (operation, *operand);
408 std::ostringstream message;
409 message <<
"Solid - " << solid->
GetName()
410 <<
" - No G4Polyhedron for Boolean component";
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
HepGeom::Point3D< G4double > G4Point3D
#define G4MUTEX_INITIALIZER
std::recursive_mutex G4RecursiveMutex
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
G4Polyhedron * GetPolyhedron() const override
const G4VSolid * GetConstituentSolid(G4int no) const override
~G4BooleanSolid() override
void GetListOfPrimitives(std::vector< std::pair< G4VSolid *, G4Transform3D > > &, const G4Transform3D &) const
G4double GetCubicVolume() override
G4GeometryType GetEntityType() const override
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
static G4VBooleanProcessor * GetExternalBooleanProcessor()
static G4VBooleanProcessor * fExternalBoolProcessor
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
std::ostream & StreamInfo(std::ostream &os) const override
static void SetExternalBooleanProcessor(G4VBooleanProcessor *extProcessor)
G4ThreeVector GetPointOnSurface() const override
G4VSolid * GetConstituentMovedSolid() const
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
virtual const G4VSolid * GetConstituentSolid(G4int no) const
virtual std::ostream & StreamInfo(std::ostream &os) const =0
G4double EstimateCubicVolume(G4int nStat, G4double epsilon) const
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4Polyhedron * GetPolyhedron() const
virtual G4Polyhedron * CreatePolyhedron() const
G4VSolid & operator=(const G4VSolid &rhs)
virtual G4GeometryType GetEntityType() const =0
void push_back(Operation, const HepPolyhedron &)
static G4int GetNumberOfRotationSteps()