55 :
G4VSolid(pName), fPtrSolidA(pSolidA), fPtrSolidB(pSolidB)
68 :
G4VSolid(pName), createdDisplacedSolid(true)
82 :
G4VSolid(pName), createdDisplacedSolid(true)
104 if(createdDisplacedSolid)
108 delete fpPolyhedron; fpPolyhedron =
nullptr;
116 :
G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
117 fCubicVolume(rhs.fCubicVolume), fStatistics(rhs.fStatistics),
118 fCubVolEpsilon(rhs.fCubVolEpsilon), fAreaAccuracy(rhs.fAreaAccuracy),
119 fSurfaceArea(rhs.fSurfaceArea), fRebuildPolyhedron(false),
120 fpPolyhedron(nullptr), createdDisplacedSolid(rhs.createdDisplacedSolid)
122 fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
133 if (
this == &rhs) {
return *
this; }
142 fStatistics= rhs.fStatistics; fCubVolEpsilon= rhs.fCubVolEpsilon;
144 fSurfaceArea= rhs.fSurfaceArea;
145 createdDisplacedSolid= rhs.createdDisplacedSolid;
146 fRebuildPolyhedron =
false;
147 delete fpPolyhedron; fpPolyhedron =
nullptr;
148 fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
169 G4Exception(
"G4BooleanSolid::GetConstituentSolid()",
191 G4Exception(
"G4BooleanSolid::GetConstituentSolid()",
212 os <<
"-----------------------------------------------------------\n"
213 <<
" *** Dump for Boolean solid - " <<
GetName() <<
" ***\n"
214 <<
" ===================================================\n"
216 <<
" Parameters of constituent solids: \n"
217 <<
"===========================================================\n";
220 os <<
"===========================================================\n";
230 std::vector<std::pair<G4VSolid*,G4Transform3D>>& primitives,
239 for (
auto i=0; i<2; ++i)
241 transform = curPlacement;
247 while (type ==
"G4DisplacedSolid" ||
248 type ==
"G4ReflectedSolid" ||
249 type ==
"G4ScaledSolid")
251 if (type ==
"G4DisplacedSolid")
258 else if (type ==
"G4ReflectedSolid")
263 else if (type ==
"G4ScaledSolid")
265 transform = transform * ((
G4ScaledSolid*)solid)->GetScaleTransform();
274 if (type ==
"G4UnionSolid" ||
275 type ==
"G4SubtractionSolid" ||
276 type ==
"G4IntersectionSolid" ||
277 type ==
"G4BooleanSolid")
279 ((
G4BooleanSolid *)solid)->GetListOfPrimitives(primitives,transform);
283 primitives.push_back(std::pair<G4VSolid*,G4Transform3D>(solid,transform));
295 std::size_t nprims = fPrimitives.size();
296 std::pair<G4VSolid *, G4Transform3D> prim;
303 nprims = fPrimitives.size();
304 fPrimitivesSurfaceArea = 0.;
305 for (std::size_t i=0; i<nprims; ++i)
307 fPrimitivesSurfaceArea += fPrimitives[i].first->GetSurfaceArea();
315 for (std::size_t k=0; k<100000; ++k)
319 for (std::size_t i=0; i<nprims; ++i)
321 prim = fPrimitives[i];
322 area += prim.first->GetSurfaceArea();
323 if (rand < area)
break;
325 p = prim.first->GetPointOnSurface();
329 std::ostringstream message;
330 message <<
"Solid - " <<
GetName() <<
"\n"
331 <<
"All 100k attempts to generate a point on the surface have failed!\n"
332 <<
"The solid created may be an invalid Boolean construct!";
344 if (fpPolyhedron ==
nullptr ||
345 fRebuildPolyhedron ||
352 fRebuildPolyhedron =
false;
368 if (type ==
"G4UnionSolid")
370 else if (type ==
"G4IntersectionSolid")
372 else if (type ==
"G4SubtractionSolid")
376 std::ostringstream message;
377 message <<
"Solid - " << solid->
GetName()
378 <<
" - Unrecognised composite solid" <<
G4endl
379 <<
" Returning NULL !";
397 if (operand !=
nullptr)
399 processor.
push_back (operation, *operand);
403 std::ostringstream message;
404 message <<
"Solid - " << solid->
GetName()
405 <<
" - 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
virtual G4Polyhedron * GetPolyhedron() const
std::ostream & StreamInfo(std::ostream &os) const
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
virtual G4GeometryType GetEntityType() const
virtual ~G4BooleanSolid()
G4ThreeVector GetPointOnSurface() const
void GetListOfPrimitives(std::vector< std::pair< G4VSolid *, G4Transform3D > > &, const G4Transform3D &) const
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
virtual const G4VSolid * GetConstituentSolid(G4int no) const
virtual G4double GetCubicVolume()
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()