Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BooleanSolid Class Reference

#include <G4BooleanSolid.hh>

+ Inheritance diagram for G4BooleanSolid:

Public Member Functions

 G4BooleanSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
 
 G4BooleanSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB, G4RotationMatrix *rotMatrix, const G4ThreeVector &transVector)
 
 G4BooleanSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB, const G4Transform3D &transform)
 
virtual ~G4BooleanSolid ()
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
G4double GetCubicVolume ()
 
G4double GetSurfaceArea ()
 
virtual G4GeometryType GetEntityType () const
 
virtual G4PolyhedronGetPolyhedron () const
 
std::ostream & StreamInfo (std::ostream &os) const
 
G4int GetCubVolStatistics () const
 
G4double GetCubVolEpsilon () const
 
void SetCubVolStatistics (G4int st)
 
void SetCubVolEpsilon (G4double ep)
 
G4int GetAreaStatistics () const
 
G4double GetAreaAccuracy () const
 
void SetAreaStatistics (G4int st)
 
void SetAreaAccuracy (G4double ep)
 
G4ThreeVector GetPointOnSurface () const
 
 G4BooleanSolid (__void__ &)
 
 G4BooleanSolid (const G4BooleanSolid &rhs)
 
G4BooleanSolidoperator= (const G4BooleanSolid &rhs)
 
- Public Member Functions inherited from G4VSolid
 G4VSolid (const G4String &name)
 
virtual ~G4VSolid ()
 
G4bool operator== (const G4VSolid &s) const
 
G4String GetName () const
 
void SetName (const G4String &name)
 
G4double GetTolerance () const
 
virtual G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
 
virtual EInside Inside (const G4ThreeVector &p) const =0
 
virtual G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const =0
 
virtual G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const =0
 
virtual G4double DistanceToIn (const G4ThreeVector &p) const =0
 
virtual G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
 
virtual G4double DistanceToOut (const G4ThreeVector &p) const =0
 
virtual void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
virtual G4double GetCubicVolume ()
 
virtual G4double GetSurfaceArea ()
 
virtual G4GeometryType GetEntityType () const =0
 
virtual G4ThreeVector GetPointOnSurface () const
 
virtual G4VSolidClone () const
 
virtual std::ostream & StreamInfo (std::ostream &os) const =0
 
void DumpInfo () const
 
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const =0
 
virtual G4VisExtent GetExtent () const
 
virtual G4PolyhedronCreatePolyhedron () const
 
virtual G4NURBSCreateNURBS () const
 
virtual G4PolyhedronGetPolyhedron () const
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
 G4VSolid (__void__ &)
 
 G4VSolid (const G4VSolid &rhs)
 
G4VSolidoperator= (const G4VSolid &rhs)
 

Protected Member Functions

G4PolyhedronStackPolyhedron (HepPolyhedronProcessor &, const G4VSolid *) const
 
G4double GetAreaRatio () const
 
- Protected Member Functions inherited from G4VSolid
void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipCrossSection (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipBetweenSections (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipPolygon (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 

Protected Attributes

G4VSolidfPtrSolidA
 
G4VSolidfPtrSolidB
 
G4double fAreaRatio
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Detailed Description

Definition at line 53 of file G4BooleanSolid.hh.

Constructor & Destructor Documentation

◆ G4BooleanSolid() [1/5]

G4BooleanSolid::G4BooleanSolid ( const G4String pName,
G4VSolid pSolidA,
G4VSolid pSolidB 
)

Definition at line 48 of file G4BooleanSolid.cc.

50 :
51 G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
52 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
53 fpPolyhedron(0), createdDisplacedSolid(false)
54{
55 fPtrSolidA = pSolidA ;
56 fPtrSolidB = pSolidB ;
57}
G4VSolid * fPtrSolidA
G4VSolid * fPtrSolidB

◆ G4BooleanSolid() [2/5]

G4BooleanSolid::G4BooleanSolid ( const G4String pName,
G4VSolid pSolidA,
G4VSolid pSolidB,
G4RotationMatrix rotMatrix,
const G4ThreeVector transVector 
)

Definition at line 63 of file G4BooleanSolid.cc.

67 :
68 G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
69 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
70 fpPolyhedron(0), createdDisplacedSolid(true)
71{
72 fPtrSolidA = pSolidA ;
73 fPtrSolidB = new G4DisplacedSolid("placedB",pSolidB,rotMatrix,transVector) ;
74}

◆ G4BooleanSolid() [3/5]

G4BooleanSolid::G4BooleanSolid ( const G4String pName,
G4VSolid pSolidA,
G4VSolid pSolidB,
const G4Transform3D transform 
)

Definition at line 80 of file G4BooleanSolid.cc.

83 :
84 G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
85 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
86 fpPolyhedron(0), createdDisplacedSolid(true)
87{
88 fPtrSolidA = pSolidA ;
89 fPtrSolidB = new G4DisplacedSolid("placedB",pSolidB,transform) ;
90}

◆ ~G4BooleanSolid()

G4BooleanSolid::~G4BooleanSolid ( )
virtual

Definition at line 109 of file G4BooleanSolid.cc.

110{
111 if(createdDisplacedSolid)
112 {
113 ((G4DisplacedSolid*)fPtrSolidB)->CleanTransformations();
114 }
115 delete fpPolyhedron;
116}

◆ G4BooleanSolid() [4/5]

G4BooleanSolid::G4BooleanSolid ( __void__ &  a)

Definition at line 97 of file G4BooleanSolid.cc.

98 : G4VSolid(a), fPtrSolidA(0), fPtrSolidB(0), fAreaRatio(0.),
99 fStatistics(1000000), fCubVolEpsilon(0.001),
100 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
101 fpPolyhedron(0), createdDisplacedSolid(false)
102{
103}

◆ G4BooleanSolid() [5/5]

G4BooleanSolid::G4BooleanSolid ( const G4BooleanSolid rhs)

Definition at line 122 of file G4BooleanSolid.cc.

125 fStatistics(rhs.fStatistics), fCubVolEpsilon(rhs.fCubVolEpsilon),
126 fAreaAccuracy(rhs.fAreaAccuracy), fCubicVolume(rhs.fCubicVolume),
127 fSurfaceArea(rhs.fSurfaceArea), fpPolyhedron(0),
128 createdDisplacedSolid(rhs.createdDisplacedSolid)
129{
130}

Member Function Documentation

◆ GetAreaAccuracy()

G4double G4BooleanSolid::GetAreaAccuracy ( ) const
inline

◆ GetAreaRatio()

G4double G4BooleanSolid::GetAreaRatio ( ) const
inlineprotected

Referenced by GetPointOnSurface().

◆ GetAreaStatistics()

G4int G4BooleanSolid::GetAreaStatistics ( ) const
inline

◆ GetConstituentSolid() [1/2]

G4VSolid * G4BooleanSolid::GetConstituentSolid ( G4int  no)
virtual

Reimplemented from G4VSolid.

Definition at line 187 of file G4BooleanSolid.cc.

188{
189 G4VSolid* subSolid=0;
190 if( no == 0 )
191 subSolid = fPtrSolidA;
192 else if( no == 1 )
193 subSolid = fPtrSolidB;
194 else
195 {
196 DumpInfo();
197 G4Exception("G4BooleanSolid::GetConstituentSolid()",
198 "GeomSolids0002", FatalException, "Invalid solid index.");
199 }
200
201 return subSolid;
202}
@ FatalException
void DumpInfo() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ GetConstituentSolid() [2/2]

const G4VSolid * G4BooleanSolid::GetConstituentSolid ( G4int  no) const
virtual

Reimplemented from G4VSolid.

Definition at line 164 of file G4BooleanSolid.cc.

165{
166 const G4VSolid* subSolid=0;
167 if( no == 0 )
168 subSolid = fPtrSolidA;
169 else if( no == 1 )
170 subSolid = fPtrSolidB;
171 else
172 {
173 DumpInfo();
174 G4Exception("G4BooleanSolid::GetConstituentSolid()",
175 "GeomSolids0002", FatalException, "Invalid solid index.");
176 }
177
178 return subSolid;
179}

Referenced by G4tgbGeometryDumper::DumpBooleanVolume().

◆ GetCubicVolume()

G4double G4BooleanSolid::GetCubicVolume ( )
inlinevirtual

Reimplemented from G4VSolid.

◆ GetCubVolEpsilon()

G4double G4BooleanSolid::GetCubVolEpsilon ( ) const
inline

◆ GetCubVolStatistics()

G4int G4BooleanSolid::GetCubVolStatistics ( ) const
inline

◆ GetEntityType()

G4GeometryType G4BooleanSolid::GetEntityType ( ) const
virtual

Implements G4VSolid.

Reimplemented in G4IntersectionSolid, G4SubtractionSolid, and G4UnionSolid.

Definition at line 208 of file G4BooleanSolid.cc.

209{
210 return G4String("G4BooleanSolid");
211}

Referenced by StreamInfo().

◆ GetPointOnSurface()

G4ThreeVector G4BooleanSolid::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 238 of file G4BooleanSolid.cc.

239{
240 G4double rand;
242
243 do
244 {
245 rand = G4UniformRand();
246
247 if (rand < GetAreaRatio()) { p = fPtrSolidA->GetPointOnSurface(); }
248 else { p = fPtrSolidB->GetPointOnSurface(); }
249 } while (Inside(p) != kSurface);
250
251 return p;
252}
double G4double
Definition: G4Types.hh:64
#define G4UniformRand()
Definition: Randomize.hh:53
G4double GetAreaRatio() const
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:152
@ kSurface
Definition: geomdefs.hh:58

◆ GetPolyhedron()

G4Polyhedron * G4BooleanSolid::GetPolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 258 of file G4BooleanSolid.cc.

259{
260 if (!fpPolyhedron ||
262 fpPolyhedron->GetNumberOfRotationSteps())
263 {
264 delete fpPolyhedron;
265 fpPolyhedron = CreatePolyhedron();
266 }
267 return fpPolyhedron;
268}
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
virtual G4Polyhedron * CreatePolyhedron() const
Definition: G4VSolid.cc:637
static G4int GetNumberOfRotationSteps()

◆ GetSurfaceArea()

G4double G4BooleanSolid::GetSurfaceArea ( )
inlinevirtual

Reimplemented from G4VSolid.

◆ operator=()

G4BooleanSolid & G4BooleanSolid::operator= ( const G4BooleanSolid rhs)

Definition at line 136 of file G4BooleanSolid.cc.

137{
138 // Check assignment to self
139 //
140 if (this == &rhs) { return *this; }
141
142 // Copy base class data
143 //
145
146 // Copy data
147 //
150 fStatistics= rhs.fStatistics; fCubVolEpsilon= rhs.fCubVolEpsilon;
151 fAreaAccuracy= rhs.fAreaAccuracy; fCubicVolume= rhs.fCubicVolume;
152 fSurfaceArea= rhs.fSurfaceArea; fpPolyhedron= 0;
153 createdDisplacedSolid= rhs.createdDisplacedSolid;
154
155 return *this;
156}
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:110

Referenced by G4IntersectionSolid::operator=(), G4SubtractionSolid::operator=(), and G4UnionSolid::operator=().

◆ SetAreaAccuracy()

void G4BooleanSolid::SetAreaAccuracy ( G4double  ep)
inline

◆ SetAreaStatistics()

void G4BooleanSolid::SetAreaStatistics ( G4int  st)
inline

◆ SetCubVolEpsilon()

void G4BooleanSolid::SetCubVolEpsilon ( G4double  ep)
inline

◆ SetCubVolStatistics()

void G4BooleanSolid::SetCubVolStatistics ( G4int  st)
inline

◆ StackPolyhedron()

G4Polyhedron * G4BooleanSolid::StackPolyhedron ( HepPolyhedronProcessor processor,
const G4VSolid solid 
) const
protected

Definition at line 275 of file G4BooleanSolid.cc.

277{
279 const G4String& type = solid->GetEntityType();
280 if (type == "G4UnionSolid")
281 { operation = HepPolyhedronProcessor::UNION; }
282 else if (type == "G4IntersectionSolid")
284 else if (type == "G4SubtractionSolid")
286 else
287 {
288 std::ostringstream message;
289 message << "Solid - " << solid->GetName()
290 << " - Unrecognised composite solid" << G4endl
291 << " Returning NULL !";
292 G4Exception("StackPolyhedron()", "GeomSolids1001", JustWarning, message);
293 return 0;
294 }
295
296 G4Polyhedron* top = 0;
297 const G4VSolid* solidA = solid->GetConstituentSolid(0);
298 const G4VSolid* solidB = solid->GetConstituentSolid(1);
299
300 if (solidA->GetConstituentSolid(0))
301 {
302 top = StackPolyhedron(processor, solidA);
303 }
304 else
305 {
306 top = solidA->GetPolyhedron();
307 }
308 G4Polyhedron* operand = solidB->GetPolyhedron();
309 processor.push_back (operation, *operand);
310
311 return top;
312}
@ JustWarning
#define G4endl
Definition: G4ios.hh:52
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
G4String GetName() const
virtual const G4VSolid * GetConstituentSolid(G4int no) const
Definition: G4VSolid.cc:167
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:647
virtual G4GeometryType GetEntityType() const =0
#define processor
Definition: xmlparse.cc:600

Referenced by G4IntersectionSolid::CreatePolyhedron(), G4SubtractionSolid::CreatePolyhedron(), G4UnionSolid::CreatePolyhedron(), and StackPolyhedron().

◆ StreamInfo()

std::ostream & G4BooleanSolid::StreamInfo ( std::ostream &  os) const
virtual

Implements G4VSolid.

Reimplemented in G4BREPSolidOpenPCone.

Definition at line 217 of file G4BooleanSolid.cc.

218{
219 os << "-----------------------------------------------------------\n"
220 << " *** Dump for Boolean solid - " << GetName() << " ***\n"
221 << " ===================================================\n"
222 << " Solid type: " << GetEntityType() << "\n"
223 << " Parameters of constituent solids: \n"
224 << "===========================================================\n";
227 os << "===========================================================\n";
228
229 return os;
230}
virtual G4GeometryType GetEntityType() const
virtual std::ostream & StreamInfo(std::ostream &os) const =0

Member Data Documentation

◆ fAreaRatio

G4double G4BooleanSolid::fAreaRatio
mutableprotected

Definition at line 125 of file G4BooleanSolid.hh.

Referenced by operator=().

◆ fPtrSolidA

◆ fPtrSolidB


The documentation for this class was generated from the following files: