Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes
G4BooleanSolid Class Reference

#include <G4BooleanSolid.hh>

Inheritance diagram for G4BooleanSolid:
G4VSolid G4IntersectionSolid G4SubtractionSolid G4UnionSolid

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)
 

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::G4BooleanSolid ( const G4String pName,
G4VSolid pSolidA,
G4VSolid pSolidB 
)

Definition at line 48 of file G4BooleanSolid.cc.

References fPtrSolidA, and fPtrSolidB.

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 * fPtrSolidB
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60
G4BooleanSolid::G4BooleanSolid ( const G4String pName,
G4VSolid pSolidA,
G4VSolid pSolidB,
G4RotationMatrix rotMatrix,
const G4ThreeVector transVector 
)

Definition at line 63 of file G4BooleanSolid.cc.

References fPtrSolidA, and fPtrSolidB.

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 }
G4VSolid * fPtrSolidB
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60
G4BooleanSolid::G4BooleanSolid ( const G4String pName,
G4VSolid pSolidA,
G4VSolid pSolidB,
const G4Transform3D transform 
)

Definition at line 80 of file G4BooleanSolid.cc.

References fPtrSolidA, and fPtrSolidB.

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 }
G4VSolid * fPtrSolidB
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60
G4BooleanSolid::~G4BooleanSolid ( )
virtual

Definition at line 109 of file G4BooleanSolid.cc.

References fPtrSolidB.

110 {
111  if(createdDisplacedSolid)
112  {
113  ((G4DisplacedSolid*)fPtrSolidB)->CleanTransformations();
114  }
115  delete fpPolyhedron;
116 }
G4VSolid * fPtrSolidB
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 }
G4VSolid * fPtrSolidB
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60
G4BooleanSolid::G4BooleanSolid ( const G4BooleanSolid rhs)

Definition at line 122 of file G4BooleanSolid.cc.

123  : G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
124  fAreaRatio(rhs.fAreaRatio),
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 }
G4VSolid * fPtrSolidB
G4VSolid * fPtrSolidA
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60

Member Function Documentation

G4double G4BooleanSolid::GetAreaAccuracy ( ) const
inline

Referenced by export_G4BooleanSolid().

G4double G4BooleanSolid::GetAreaRatio ( ) const
inlineprotected

Referenced by GetPointOnSurface().

G4int G4BooleanSolid::GetAreaStatistics ( ) const
inline

Referenced by export_G4BooleanSolid().

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

Reimplemented from G4VSolid.

Definition at line 164 of file G4BooleanSolid.cc.

References G4VSolid::DumpInfo(), FatalException, fPtrSolidA, fPtrSolidB, and G4Exception().

Referenced by G4tgbGeometryDumper::DumpBooleanVolume().

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 }
G4VSolid * fPtrSolidB
void DumpInfo() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VSolid * fPtrSolidA
G4VSolid * G4BooleanSolid::GetConstituentSolid ( G4int  no)
virtual

Reimplemented from G4VSolid.

Definition at line 187 of file G4BooleanSolid.cc.

References G4VSolid::DumpInfo(), FatalException, fPtrSolidA, fPtrSolidB, and G4Exception().

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 }
G4VSolid * fPtrSolidB
void DumpInfo() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VSolid * fPtrSolidA
G4double G4BooleanSolid::GetCubicVolume ( )
inlinevirtual

Reimplemented from G4VSolid.

G4double G4BooleanSolid::GetCubVolEpsilon ( ) const
inline

Referenced by export_G4BooleanSolid().

G4int G4BooleanSolid::GetCubVolStatistics ( ) const
inline

Referenced by export_G4BooleanSolid().

G4GeometryType G4BooleanSolid::GetEntityType ( ) const
virtual

Implements G4VSolid.

Reimplemented in G4IntersectionSolid, G4SubtractionSolid, and G4UnionSolid.

Definition at line 208 of file G4BooleanSolid.cc.

Referenced by StreamInfo().

209 {
210  return G4String("G4BooleanSolid");
211 }
G4ThreeVector G4BooleanSolid::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 238 of file G4BooleanSolid.cc.

References fPtrSolidA, fPtrSolidB, G4UniformRand, GetAreaRatio(), G4VSolid::GetPointOnSurface(), G4VSolid::Inside(), and kSurface.

Referenced by export_G4BooleanSolid().

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 }
G4VSolid * fPtrSolidB
const char * p
Definition: xmltok.h:285
#define G4UniformRand()
Definition: Randomize.hh:87
virtual EInside Inside(const G4ThreeVector &p) const =0
G4double GetAreaRatio() const
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:152
G4VSolid * fPtrSolidA
double G4double
Definition: G4Types.hh:76
G4Polyhedron * G4BooleanSolid::GetPolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 258 of file G4BooleanSolid.cc.

References G4VSolid::CreatePolyhedron(), HepPolyhedron::GetNumberOfRotationSteps(), and G4Polyhedron::GetNumberOfRotationStepsAtTimeOfCreation().

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

Reimplemented from G4VSolid.

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

Definition at line 136 of file G4BooleanSolid.cc.

References fAreaRatio, fPtrSolidA, fPtrSolidB, and G4VSolid::operator=().

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

137 {
138  // Check assignment to self
139  //
140  if (this == &rhs) { return *this; }
141 
142  // Copy base class data
143  //
144  G4VSolid::operator=(rhs);
145 
146  // Copy data
147  //
149  fAreaRatio= rhs.fAreaRatio;
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 * fPtrSolidB
G4VSolid * fPtrSolidA
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:110
void G4BooleanSolid::SetAreaAccuracy ( G4double  ep)
inline

Referenced by export_G4BooleanSolid().

void G4BooleanSolid::SetAreaStatistics ( G4int  st)
inline

Referenced by export_G4BooleanSolid().

void G4BooleanSolid::SetCubVolEpsilon ( G4double  ep)
inline

Referenced by export_G4BooleanSolid().

void G4BooleanSolid::SetCubVolStatistics ( G4int  st)
inline

Referenced by export_G4BooleanSolid().

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

Definition at line 275 of file G4BooleanSolid.cc.

References G4endl, G4Exception(), G4VSolid::GetConstituentSolid(), G4VSolid::GetEntityType(), G4VSolid::GetName(), G4VSolid::GetPolyhedron(), HepPolyhedronProcessor::INTERSECTION, JustWarning, HepPolyhedronProcessor::push_back(), HepPolyhedronProcessor::SUBTRACTION, and HepPolyhedronProcessor::UNION.

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

277 {
279  const G4String& type = solid->GetEntityType();
280  if (type == "G4UnionSolid")
281  { operation = HepPolyhedronProcessor::UNION; }
282  else if (type == "G4IntersectionSolid")
283  { operation = HepPolyhedronProcessor::INTERSECTION; }
284  else if (type == "G4SubtractionSolid")
285  { operation = HepPolyhedronProcessor::SUBTRACTION; }
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 }
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:644
G4String GetName() const
virtual G4GeometryType GetEntityType() const =0
void push_back(Operation, const HepPolyhedron &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual const G4VSolid * GetConstituentSolid(G4int no) const
Definition: G4VSolid.cc:167
#define G4endl
Definition: G4ios.hh:61
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
std::ostream & G4BooleanSolid::StreamInfo ( std::ostream &  os) const
virtual

Implements G4VSolid.

Definition at line 217 of file G4BooleanSolid.cc.

References fPtrSolidA, fPtrSolidB, GetEntityType(), G4VSolid::GetName(), and G4VSolid::StreamInfo().

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";
225  fPtrSolidA->StreamInfo(os);
226  fPtrSolidB->StreamInfo(os);
227  os << "===========================================================\n";
228 
229  return os;
230 }
G4String GetName() const
G4VSolid * fPtrSolidB
virtual G4GeometryType GetEntityType() const
virtual std::ostream & StreamInfo(std::ostream &os) const =0
G4VSolid * fPtrSolidA

Field Documentation

G4double G4BooleanSolid::fAreaRatio
mutableprotected

Definition at line 125 of file G4BooleanSolid.hh.

Referenced by operator=().

G4VSolid* G4BooleanSolid::fPtrSolidA
protected
G4VSolid* G4BooleanSolid::fPtrSolidB
protected

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