Geant4  10.02.p03
G4BooleanSolid Class Reference

#include <G4BooleanSolid.hh>

Inheritance diagram for G4BooleanSolid:
Collaboration 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 G4VSolidClone () const
 
void DumpInfo () const
 
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const =0
 
virtual G4VisExtent GetExtent () const
 
virtual G4PolyhedronCreatePolyhedron () const
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
 G4VSolid (__void__ &)
 
 G4VSolid (const G4VSolid &rhs)
 
G4VSolidoperator= (const G4VSolid &rhs)
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 

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
 

Protected Attributes

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

Private Attributes

G4int fStatistics
 
G4double fCubVolEpsilon
 
G4double fAreaAccuracy
 
G4double fCubicVolume
 
G4double fSurfaceArea
 
G4bool fRebuildPolyhedron
 
G4PolyhedronfpPolyhedron
 
G4bool createdDisplacedSolid
 

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 55 of file G4BooleanSolid.cc.

57  :
58  G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
61 {
62  fPtrSolidA = pSolidA ;
63  fPtrSolidB = pSolidB ;
64 }
G4VSolid * fPtrSolidB
G4double fCubicVolume
G4bool createdDisplacedSolid
G4double fAreaAccuracy
G4double fCubVolEpsilon
G4double fSurfaceArea
G4Polyhedron * fpPolyhedron
G4bool fRebuildPolyhedron
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60

◆ G4BooleanSolid() [2/5]

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

Definition at line 70 of file G4BooleanSolid.cc.

74  :
75  G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
78 {
79  fPtrSolidA = pSolidA ;
80  fPtrSolidB = new G4DisplacedSolid("placedB",pSolidB,rotMatrix,transVector) ;
81 }
G4VSolid * fPtrSolidB
G4double fCubicVolume
G4bool createdDisplacedSolid
G4double fAreaAccuracy
G4double fCubVolEpsilon
G4double fSurfaceArea
G4Polyhedron * fpPolyhedron
G4bool fRebuildPolyhedron
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60

◆ G4BooleanSolid() [3/5]

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

Definition at line 87 of file G4BooleanSolid.cc.

90  :
91  G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
94 {
95  fPtrSolidA = pSolidA ;
96  fPtrSolidB = new G4DisplacedSolid("placedB",pSolidB,transform) ;
97 }
G4VSolid * fPtrSolidB
G4double fCubicVolume
G4bool createdDisplacedSolid
G4double fAreaAccuracy
G4double fCubVolEpsilon
G4double fSurfaceArea
G4Polyhedron * fpPolyhedron
G4bool fRebuildPolyhedron
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60

◆ ~G4BooleanSolid()

G4BooleanSolid::~G4BooleanSolid ( )
virtual

Definition at line 116 of file G4BooleanSolid.cc.

117 {
119  {
120  ((G4DisplacedSolid*)fPtrSolidB)->CleanTransformations();
121  }
122  delete fpPolyhedron; fpPolyhedron = 0;
123 }
G4VSolid * fPtrSolidB
G4bool createdDisplacedSolid
G4Polyhedron * fpPolyhedron

◆ G4BooleanSolid() [4/5]

G4BooleanSolid::G4BooleanSolid ( __void__ &  a)

Definition at line 104 of file G4BooleanSolid.cc.

105  : G4VSolid(a), fPtrSolidA(0), fPtrSolidB(0), fAreaRatio(0.),
106  fStatistics(1000000), fCubVolEpsilon(0.001),
107  fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
109 {
110 }
G4VSolid * fPtrSolidB
G4double fCubicVolume
G4bool createdDisplacedSolid
G4double fAreaAccuracy
G4double fCubVolEpsilon
G4double fSurfaceArea
G4Polyhedron * fpPolyhedron
G4bool fRebuildPolyhedron
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60

◆ G4BooleanSolid() [5/5]

G4BooleanSolid::G4BooleanSolid ( const G4BooleanSolid rhs)

Definition at line 129 of file G4BooleanSolid.cc.

130  : G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
131  fAreaRatio(rhs.fAreaRatio),
136 {
137 }
G4VSolid * fPtrSolidB
G4double fCubicVolume
G4bool createdDisplacedSolid
G4double fAreaAccuracy
G4double fCubVolEpsilon
G4double fSurfaceArea
G4Polyhedron * fpPolyhedron
G4bool fRebuildPolyhedron
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60

Member Function Documentation

◆ GetAreaAccuracy()

G4double G4BooleanSolid::GetAreaAccuracy ( ) const
inline
Here is the caller graph for this function:

◆ GetAreaRatio()

G4double G4BooleanSolid::GetAreaRatio ( ) const
inlineprotected
Here is the caller graph for this function:

◆ GetAreaStatistics()

G4int G4BooleanSolid::GetAreaStatistics ( ) const
inline
Here is the caller graph for this function:

◆ GetConstituentSolid() [1/2]

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

Reimplemented from G4VSolid.

Definition at line 173 of file G4BooleanSolid.cc.

174 {
175  const G4VSolid* subSolid=0;
176  if( no == 0 )
177  subSolid = fPtrSolidA;
178  else if( no == 1 )
179  subSolid = fPtrSolidB;
180  else
181  {
182  DumpInfo();
183  G4Exception("G4BooleanSolid::GetConstituentSolid()",
184  "GeomSolids0002", FatalException, "Invalid solid index.");
185  }
186 
187  return subSolid;
188 }
G4VSolid * fPtrSolidB
void DumpInfo() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VSolid * fPtrSolidA
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetConstituentSolid() [2/2]

G4VSolid * G4BooleanSolid::GetConstituentSolid ( G4int  no)
virtual

Reimplemented from G4VSolid.

Definition at line 196 of file G4BooleanSolid.cc.

197 {
198  G4VSolid* subSolid=0;
199  if( no == 0 )
200  subSolid = fPtrSolidA;
201  else if( no == 1 )
202  subSolid = fPtrSolidB;
203  else
204  {
205  DumpInfo();
206  G4Exception("G4BooleanSolid::GetConstituentSolid()",
207  "GeomSolids0002", FatalException, "Invalid solid index.");
208  }
209 
210  return subSolid;
211 }
G4VSolid * fPtrSolidB
void DumpInfo() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VSolid * fPtrSolidA
Here is the call graph for this function:

◆ GetCubicVolume()

G4double G4BooleanSolid::GetCubicVolume ( )
inlinevirtual

Reimplemented from G4VSolid.

◆ GetCubVolEpsilon()

G4double G4BooleanSolid::GetCubVolEpsilon ( ) const
inline
Here is the caller graph for this function:

◆ GetCubVolStatistics()

G4int G4BooleanSolid::GetCubVolStatistics ( ) const
inline
Here is the caller graph for this function:

◆ GetEntityType()

G4GeometryType G4BooleanSolid::GetEntityType ( ) const
virtual

Implements G4VSolid.

Reimplemented in G4IntersectionSolid, G4SubtractionSolid, and G4UnionSolid.

Definition at line 217 of file G4BooleanSolid.cc.

218 {
219  return G4String("G4BooleanSolid");
220 }
Here is the caller graph for this function:

◆ GetPointOnSurface()

G4ThreeVector G4BooleanSolid::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 247 of file G4BooleanSolid.cc.

248 {
249  G4double rand;
250  G4ThreeVector p;
251 
252  do // Loop checking, 13.08.2015, G.Cosmo
253  {
254  rand = G4UniformRand();
255 
256  if (rand < GetAreaRatio()) { p = fPtrSolidA->GetPointOnSurface(); }
257  else { p = fPtrSolidB->GetPointOnSurface(); }
258  } while (Inside(p) != kSurface);
259 
260  return p;
261 }
G4double GetAreaRatio() const
G4VSolid * fPtrSolidB
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:152
#define G4UniformRand()
Definition: Randomize.hh:97
virtual EInside Inside(const G4ThreeVector &p) const =0
G4VSolid * fPtrSolidA
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPolyhedron()

G4Polyhedron * G4BooleanSolid::GetPolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 267 of file G4BooleanSolid.cc.

268 {
269  if (!fpPolyhedron ||
273  {
274  G4AutoLock l(&polyhedronMutex);
275  delete fpPolyhedron;
277  fRebuildPolyhedron = false;
278  l.unlock();
279  }
280  return fpPolyhedron;
281 }
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4Polyhedron * fpPolyhedron
static G4int GetNumberOfRotationSteps()
G4bool fRebuildPolyhedron
virtual G4Polyhedron * CreatePolyhedron() const
Definition: G4VSolid.cc:639
Here is the call graph for this function:

◆ GetSurfaceArea()

G4double G4BooleanSolid::GetSurfaceArea ( )
inlinevirtual

Reimplemented from G4VSolid.

◆ operator=()

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

Definition at line 143 of file G4BooleanSolid.cc.

144 {
145  // Check assignment to self
146  //
147  if (this == &rhs) { return *this; }
148 
149  // Copy base class data
150  //
151  G4VSolid::operator=(rhs);
152 
153  // Copy data
154  //
156  fAreaRatio= rhs.fAreaRatio;
161  fRebuildPolyhedron = false;
162  delete fpPolyhedron; fpPolyhedron = 0;
163 
164  return *this;
165 }
G4VSolid * fPtrSolidB
G4double fCubicVolume
G4bool createdDisplacedSolid
G4double fAreaAccuracy
G4double fCubVolEpsilon
G4double fSurfaceArea
G4Polyhedron * fpPolyhedron
G4bool fRebuildPolyhedron
G4VSolid * fPtrSolidA
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAreaAccuracy()

void G4BooleanSolid::SetAreaAccuracy ( G4double  ep)
inline
Here is the caller graph for this function:

◆ SetAreaStatistics()

void G4BooleanSolid::SetAreaStatistics ( G4int  st)
inline
Here is the caller graph for this function:

◆ SetCubVolEpsilon()

void G4BooleanSolid::SetCubVolEpsilon ( G4double  ep)
inline
Here is the caller graph for this function:

◆ SetCubVolStatistics()

void G4BooleanSolid::SetCubVolStatistics ( G4int  st)
inline
Here is the caller graph for this function:

◆ StackPolyhedron()

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

Definition at line 288 of file G4BooleanSolid.cc.

290 {
292  const G4String& type = solid->GetEntityType();
293  if (type == "G4UnionSolid")
294  { operation = HepPolyhedronProcessor::UNION; }
295  else if (type == "G4IntersectionSolid")
296  { operation = HepPolyhedronProcessor::INTERSECTION; }
297  else if (type == "G4SubtractionSolid")
298  { operation = HepPolyhedronProcessor::SUBTRACTION; }
299  else
300  {
301  std::ostringstream message;
302  message << "Solid - " << solid->GetName()
303  << " - Unrecognised composite solid" << G4endl
304  << " Returning NULL !";
305  G4Exception("StackPolyhedron()", "GeomSolids1001", JustWarning, message);
306  return 0;
307  }
308 
309  G4Polyhedron* top = 0;
310  const G4VSolid* solidA = solid->GetConstituentSolid(0);
311  const G4VSolid* solidB = solid->GetConstituentSolid(1);
312 
313  if (solidA->GetConstituentSolid(0))
314  {
315  top = StackPolyhedron(processor, solidA);
316  }
317  else
318  {
319  top = solidA->GetPolyhedron();
320  }
321  G4Polyhedron* operand = solidB->GetPolyhedron();
322  processor.push_back (operation, *operand);
323 
324  return top;
325 }
virtual const G4VSolid * GetConstituentSolid(G4int no) const
Definition: G4VSolid.cc:167
virtual G4GeometryType GetEntityType() const =0
G4String GetName() const
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:644
static int operand(pchar begin, pchar end, double &result, pchar &endp, const dic_type &dictionary)
Definition: Evaluator.cc:162
void push_back(Operation, const HepPolyhedron &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StreamInfo()

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

Implements G4VSolid.

Definition at line 226 of file G4BooleanSolid.cc.

227 {
228  os << "-----------------------------------------------------------\n"
229  << " *** Dump for Boolean solid - " << GetName() << " ***\n"
230  << " ===================================================\n"
231  << " Solid type: " << GetEntityType() << "\n"
232  << " Parameters of constituent solids: \n"
233  << "===========================================================\n";
234  fPtrSolidA->StreamInfo(os);
235  fPtrSolidB->StreamInfo(os);
236  os << "===========================================================\n";
237 
238  return os;
239 }
G4VSolid * fPtrSolidB
virtual G4GeometryType GetEntityType() const
G4String GetName() const
virtual std::ostream & StreamInfo(std::ostream &os) const =0
G4VSolid * fPtrSolidA
Here is the call graph for this function:

Member Data Documentation

◆ createdDisplacedSolid

G4bool G4BooleanSolid::createdDisplacedSolid
private

Definition at line 138 of file G4BooleanSolid.hh.

◆ fAreaAccuracy

G4double G4BooleanSolid::fAreaAccuracy
private

Definition at line 131 of file G4BooleanSolid.hh.

◆ fAreaRatio

G4double G4BooleanSolid::fAreaRatio
mutableprotected

Definition at line 125 of file G4BooleanSolid.hh.

◆ fCubicVolume

G4double G4BooleanSolid::fCubicVolume
private

Definition at line 132 of file G4BooleanSolid.hh.

◆ fCubVolEpsilon

G4double G4BooleanSolid::fCubVolEpsilon
private

Definition at line 130 of file G4BooleanSolid.hh.

◆ fpPolyhedron

G4Polyhedron* G4BooleanSolid::fpPolyhedron
mutableprivate

Definition at line 136 of file G4BooleanSolid.hh.

◆ fPtrSolidA

G4VSolid* G4BooleanSolid::fPtrSolidA
protected

Definition at line 122 of file G4BooleanSolid.hh.

◆ fPtrSolidB

G4VSolid* G4BooleanSolid::fPtrSolidB
protected

Definition at line 123 of file G4BooleanSolid.hh.

◆ fRebuildPolyhedron

G4bool G4BooleanSolid::fRebuildPolyhedron
mutableprivate

Definition at line 135 of file G4BooleanSolid.hh.

◆ fStatistics

G4int G4BooleanSolid::fStatistics
private

Definition at line 129 of file G4BooleanSolid.hh.

◆ fSurfaceArea

G4double G4BooleanSolid::fSurfaceArea
private

Definition at line 133 of file G4BooleanSolid.hh.


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