64 G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
65 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
66 fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
67 createdDisplacedSolid(false)
82 G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
83 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
84 fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
85 createdDisplacedSolid(true)
99 G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
100 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
101 fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
102 createdDisplacedSolid(true)
114 :
G4VSolid(a), fPtrSolidA(0), fPtrSolidB(0),
115 fStatistics(1000000), fCubVolEpsilon(0.001),
116 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
117 fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
118 createdDisplacedSolid(false)
128 if(createdDisplacedSolid)
132 delete fpPolyhedron; fpPolyhedron = 0;
140 :
G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
141 fStatistics(rhs.fStatistics), fCubVolEpsilon(rhs.fCubVolEpsilon),
142 fAreaAccuracy(rhs.fAreaAccuracy), fCubicVolume(rhs.fCubicVolume),
143 fSurfaceArea(rhs.fSurfaceArea), fRebuildPolyhedron(false), fpPolyhedron(0),
144 createdDisplacedSolid(rhs.createdDisplacedSolid)
146 fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
157 if (
this == &rhs) {
return *
this; }
166 fStatistics= rhs.fStatistics; fCubVolEpsilon= rhs.fCubVolEpsilon;
167 fAreaAccuracy= rhs.fAreaAccuracy; fCubicVolume= rhs.fCubicVolume;
168 fSurfaceArea= rhs.fSurfaceArea;
169 createdDisplacedSolid= rhs.createdDisplacedSolid;
170 fRebuildPolyhedron =
false;
171 delete fpPolyhedron; fpPolyhedron = 0;
172 fPrimitives.resize(0); fPrimitivesSurfaceArea = 0.;
193 G4Exception(
"G4BooleanSolid::GetConstituentSolid()",
216 G4Exception(
"G4BooleanSolid::GetConstituentSolid()",
238 os <<
"-----------------------------------------------------------\n"
239 <<
" *** Dump for Boolean solid - " <<
GetName() <<
" ***\n"
240 <<
" ===================================================\n"
242 <<
" Parameters of constituent solids: \n"
243 <<
"===========================================================\n";
246 os <<
"===========================================================\n";
256 std::vector<std::pair<G4VSolid *,G4Transform3D>>& primitives,
265 for (
G4int i=0; i<2; i++)
267 transform = curPlacement;
273 while (type ==
"G4DisplacedSolid" ||
274 type ==
"G4ReflectedSolid" ||
275 type ==
"G4ScaledSolid")
277 if (type ==
"G4DisplacedSolid")
284 else if (type ==
"G4ReflectedSolid")
289 else if (type ==
"G4ScaledSolid")
291 transform = transform * ((
G4ScaledSolid*)solid)->GetScaleTransform();
300 if (type ==
"G4UnionSolid" ||
301 type ==
"G4SubtractionSolid" ||
302 type ==
"G4IntersectionSolid" ||
303 type ==
"G4BooleanSolid")
305 ((
G4BooleanSolid *)solid)->GetListOfPrimitives(primitives,transform);
309 primitives.push_back(std::pair<G4VSolid*,G4Transform3D>(solid,transform));
321 G4int nprims = fPrimitives.size();
322 std::pair<G4VSolid *, G4Transform3D> prim;
329 nprims = fPrimitives.size();
330 fPrimitivesSurfaceArea = 0.;
331 for (
G4int i=0; i<nprims; i++)
333 fPrimitivesSurfaceArea += fPrimitives[i].first->GetSurfaceArea();
341 for (
G4int k=0; k<1000000; k++)
345 for (
G4int i=0; i<nprims; i++)
347 prim = fPrimitives[i];
348 area += prim.first->GetSurfaceArea();
349 if (rand < area)
break;
351 p = prim.first->GetPointOnSurface();
355 std::ostringstream message;
356 message <<
"Solid - " <<
GetName() <<
"\n"
357 <<
"All attempts to generate a point on the surface have failed.\n"
358 <<
"Returning point from the last unsuccessful attempt!";
371 fRebuildPolyhedron ||
378 fRebuildPolyhedron =
false;
394 if (type ==
"G4UnionSolid")
396 else if (type ==
"G4IntersectionSolid")
398 else if (type ==
"G4SubtractionSolid")
402 std::ostringstream message;
403 message <<
"Solid - " << solid->
GetName()
404 <<
" - Unrecognised composite solid" <<
G4endl
405 <<
" Returning NULL !";
423 processor.
push_back (operation, *operand);
virtual G4Polyhedron * GetPolyhedron() const
virtual G4Polyhedron * GetPolyhedron() const
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
virtual G4GeometryType GetEntityType() const
HepGeom::Point3D< G4double > G4Point3D
virtual G4GeometryType GetEntityType() const =0
#define G4MUTEX_INITIALIZER
static int operand(pchar begin, pchar end, double &result, pchar &endp, const dic_type &dictionary)
void push_back(Operation, const HepPolyhedron &)
virtual std::ostream & StreamInfo(std::ostream &os) const =0
virtual EInside Inside(const G4ThreeVector &p) const =0
void GetListOfPrimitives(std::vector< std::pair< G4VSolid *, G4Transform3D >> &, const G4Transform3D &) const
std::ostream & StreamInfo(std::ostream &os) const
virtual G4Polyhedron * CreatePolyhedron() const
virtual ~G4BooleanSolid()
virtual const G4VSolid * GetConstituentSolid(G4int no) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4int GetNumberOfRotationSteps()
virtual const G4VSolid * GetConstituentSolid(G4int no) const
G4ThreeVector GetPointOnSurface() const
G4VSolid & operator=(const G4VSolid &rhs)
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const