G4BooleanSolid Class Reference

#include <G4BooleanSolid.hh>

Inheritance diagram for G4BooleanSolid:

G4VSolid G4IntersectionSolid G4SubtractionSolid G4UnionSolid G4BREPSolidOpenPCone

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)

Protected Member Functions

G4PolyhedronStackPolyhedron (HepPolyhedronProcessor &, const G4VSolid *) const
G4double GetAreaRatio () const

Protected Attributes

G4VSolidfPtrSolidA
G4VSolidfPtrSolidB
G4double fAreaRatio

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.

00050                                                       :
00051   G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
00052   fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
00053   fpPolyhedron(0), createdDisplacedSolid(false)
00054 {
00055   fPtrSolidA = pSolidA ;
00056   fPtrSolidB = pSolidB ;
00057 }

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.

00067                                                                       :
00068   G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
00069   fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
00070   fpPolyhedron(0), createdDisplacedSolid(true)
00071 {
00072   fPtrSolidA = pSolidA ;
00073   fPtrSolidB = new G4DisplacedSolid("placedB",pSolidB,rotMatrix,transVector) ;
00074 }

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

Definition at line 80 of file G4BooleanSolid.cc.

References fPtrSolidA, and fPtrSolidB.

00083                                                                     :
00084   G4VSolid(pName), fAreaRatio(0.), fStatistics(1000000), fCubVolEpsilon(0.001),
00085   fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
00086   fpPolyhedron(0), createdDisplacedSolid(true)
00087 {
00088   fPtrSolidA = pSolidA ;
00089   fPtrSolidB = new G4DisplacedSolid("placedB",pSolidB,transform) ;
00090 }

G4BooleanSolid::~G4BooleanSolid (  )  [virtual]

Definition at line 109 of file G4BooleanSolid.cc.

References fPtrSolidB.

00110 {
00111   if(createdDisplacedSolid)
00112   {
00113     ((G4DisplacedSolid*)fPtrSolidB)->CleanTransformations();
00114   }
00115   delete fpPolyhedron;
00116 }

G4BooleanSolid::G4BooleanSolid ( __void__ &   ) 

Definition at line 97 of file G4BooleanSolid.cc.

00098   : G4VSolid(a), fPtrSolidA(0), fPtrSolidB(0), fAreaRatio(0.),
00099     fStatistics(1000000), fCubVolEpsilon(0.001), 
00100     fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
00101     fpPolyhedron(0), createdDisplacedSolid(false)
00102 {
00103 }

G4BooleanSolid::G4BooleanSolid ( const G4BooleanSolid rhs  ) 

Definition at line 122 of file G4BooleanSolid.cc.

00123   : G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
00124     fAreaRatio(rhs.fAreaRatio),
00125     fStatistics(rhs.fStatistics), fCubVolEpsilon(rhs.fCubVolEpsilon),
00126     fAreaAccuracy(rhs.fAreaAccuracy), fCubicVolume(rhs.fCubicVolume),
00127     fSurfaceArea(rhs.fSurfaceArea), fpPolyhedron(0),
00128     createdDisplacedSolid(rhs.createdDisplacedSolid)
00129 {
00130 }


Member Function Documentation

G4double G4BooleanSolid::GetAreaAccuracy (  )  const [inline]

Definition at line 70 of file G4BooleanSolid.icc.

00071 {
00072   return fAreaAccuracy;
00073 }

G4double G4BooleanSolid::GetAreaRatio (  )  const [inline, protected]

Definition at line 106 of file G4BooleanSolid.icc.

References fAreaRatio, fPtrSolidA, fPtrSolidB, and G4VSolid::GetSurfaceArea().

Referenced by GetPointOnSurface().

00107 {
00108   if (fAreaRatio <= 0.)
00109   {
00110     fAreaRatio = fPtrSolidA->GetSurfaceArea() /
00111       (fPtrSolidA->GetSurfaceArea()+fPtrSolidB->GetSurfaceArea());
00112   }
00113   return fAreaRatio;
00114 }

G4int G4BooleanSolid::GetAreaStatistics (  )  const [inline]

Definition at line 64 of file G4BooleanSolid.icc.

00065 {
00066   return fStatistics;
00067 }

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().

00188 {
00189   G4VSolid*  subSolid=0;
00190   if( no == 0 )  
00191     subSolid = fPtrSolidA;
00192   else if( no == 1 ) 
00193     subSolid = fPtrSolidB;
00194   else
00195   {
00196     DumpInfo();
00197     G4Exception("G4BooleanSolid::GetConstituentSolid()",
00198                 "GeomSolids0002", FatalException, "Invalid solid index.");
00199   }
00200 
00201   return subSolid;
00202 }

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().

00165 {
00166   const G4VSolid*  subSolid=0;
00167   if( no == 0 )  
00168     subSolid = fPtrSolidA;
00169   else if( no == 1 ) 
00170     subSolid = fPtrSolidB;
00171   else
00172   {
00173     DumpInfo();
00174     G4Exception("G4BooleanSolid::GetConstituentSolid()",
00175                 "GeomSolids0002", FatalException, "Invalid solid index.");
00176   }
00177 
00178   return subSolid;
00179 }

G4double G4BooleanSolid::GetCubicVolume (  )  [inline, virtual]

Reimplemented from G4VSolid.

Definition at line 90 of file G4BooleanSolid.icc.

References G4VSolid::EstimateCubicVolume().

00091 {
00092   if(fCubicVolume != 0.) {;}
00093   else   { fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon); }
00094   return fCubicVolume;
00095 }

G4double G4BooleanSolid::GetCubVolEpsilon (  )  const [inline]

Definition at line 44 of file G4BooleanSolid.icc.

00045 {
00046   return fCubVolEpsilon;
00047 }

G4int G4BooleanSolid::GetCubVolStatistics (  )  const [inline]

Definition at line 38 of file G4BooleanSolid.icc.

00039 {
00040   return fStatistics;
00041 }

G4GeometryType G4BooleanSolid::GetEntityType (  )  const [virtual]

Implements G4VSolid.

Reimplemented in G4IntersectionSolid, G4SubtractionSolid, and G4UnionSolid.

Definition at line 208 of file G4BooleanSolid.cc.

Referenced by StreamInfo().

00209 {
00210   return G4String("G4BooleanSolid");
00211 }

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.

00239 {
00240   G4double rand;
00241   G4ThreeVector p;
00242 
00243   do
00244   {
00245     rand = G4UniformRand();
00246 
00247     if (rand < GetAreaRatio()) { p = fPtrSolidA->GetPointOnSurface(); }
00248     else                       { p = fPtrSolidB->GetPointOnSurface(); }
00249   } while (Inside(p) != kSurface);
00250 
00251   return p;
00252 }

G4Polyhedron * G4BooleanSolid::GetPolyhedron (  )  const [virtual]

Reimplemented from G4VSolid.

Definition at line 258 of file G4BooleanSolid.cc.

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

00259 {
00260   if (!fpPolyhedron ||
00261       fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
00262       fpPolyhedron->GetNumberOfRotationSteps())
00263     {
00264       delete fpPolyhedron;
00265       fpPolyhedron = CreatePolyhedron();
00266     }
00267   return fpPolyhedron;
00268 }

G4double G4BooleanSolid::GetSurfaceArea (  )  [inline, virtual]

Reimplemented from G4VSolid.

Definition at line 98 of file G4BooleanSolid.icc.

References G4VSolid::EstimateSurfaceArea().

00099 {
00100   if(fSurfaceArea != 0.) {;}
00101   else   { fSurfaceArea = EstimateSurfaceArea(fStatistics,fAreaAccuracy); }
00102   return fSurfaceArea;
00103 }

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

Definition at line 136 of file G4BooleanSolid.cc.

References createdDisplacedSolid, fAreaAccuracy, fAreaRatio, fCubicVolume, fCubVolEpsilon, fPtrSolidA, fPtrSolidB, fStatistics, fSurfaceArea, and G4VSolid::operator=().

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

00137 {
00138   // Check assignment to self
00139   //
00140   if (this == &rhs)  { return *this; }
00141 
00142   // Copy base class data
00143   //
00144   G4VSolid::operator=(rhs);
00145 
00146   // Copy data
00147   //
00148   fPtrSolidA= rhs.fPtrSolidA; fPtrSolidB= rhs.fPtrSolidB;
00149   fAreaRatio= rhs.fAreaRatio;
00150   fStatistics= rhs.fStatistics; fCubVolEpsilon= rhs.fCubVolEpsilon;
00151   fAreaAccuracy= rhs.fAreaAccuracy; fCubicVolume= rhs.fCubicVolume;
00152   fSurfaceArea= rhs.fSurfaceArea; fpPolyhedron= 0;
00153   createdDisplacedSolid= rhs.createdDisplacedSolid;
00154 
00155   return *this;
00156 }  

void G4BooleanSolid::SetAreaAccuracy ( G4double  ep  )  [inline]

Definition at line 83 of file G4BooleanSolid.icc.

00084 {
00085   fSurfaceArea=0.;
00086   fAreaAccuracy=ep;
00087 }

void G4BooleanSolid::SetAreaStatistics ( G4int  st  )  [inline]

Definition at line 76 of file G4BooleanSolid.icc.

00077 {
00078   fSurfaceArea=0.;
00079   fStatistics=st;
00080 }

void G4BooleanSolid::SetCubVolEpsilon ( G4double  ep  )  [inline]

Definition at line 57 of file G4BooleanSolid.icc.

00058 {
00059   fCubicVolume=0.;
00060   fCubVolEpsilon=ep;
00061 }

void G4BooleanSolid::SetCubVolStatistics ( G4int  st  )  [inline]

Definition at line 50 of file G4BooleanSolid.icc.

00051 {
00052   fCubicVolume=0.;
00053   fStatistics=st;
00054 }

G4Polyhedron * G4BooleanSolid::StackPolyhedron ( HepPolyhedronProcessor &  ,
const G4VSolid  
) const [protected]

Definition at line 275 of file G4BooleanSolid.cc.

References G4endl, G4Exception(), G4VSolid::GetConstituentSolid(), G4VSolid::GetEntityType(), G4VSolid::GetName(), G4VSolid::GetPolyhedron(), and JustWarning.

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

00277 {
00278   HepPolyhedronProcessor::Operation operation;
00279   const G4String& type = solid->GetEntityType();
00280   if (type == "G4UnionSolid")
00281     { operation = HepPolyhedronProcessor::UNION; }
00282   else if (type == "G4IntersectionSolid")
00283     { operation = HepPolyhedronProcessor::INTERSECTION; }
00284   else if (type == "G4SubtractionSolid")
00285     { operation = HepPolyhedronProcessor::SUBTRACTION; }
00286   else
00287   {
00288     std::ostringstream message;
00289     message << "Solid - " << solid->GetName()
00290             << " - Unrecognised composite solid" << G4endl
00291             << " Returning NULL !";
00292     G4Exception("StackPolyhedron()", "GeomSolids1001", JustWarning, message);
00293     return 0;
00294   }
00295 
00296   G4Polyhedron* top = 0;
00297   const G4VSolid* solidA = solid->GetConstituentSolid(0);
00298   const G4VSolid* solidB = solid->GetConstituentSolid(1);
00299 
00300   if (solidA->GetConstituentSolid(0))
00301   {
00302     top = StackPolyhedron(processor, solidA);
00303   }
00304   else
00305   {
00306     top = solidA->GetPolyhedron();
00307   }
00308   G4Polyhedron* operand = solidB->GetPolyhedron();
00309   processor.push_back (operation, *operand);
00310 
00311   return top;
00312 }

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

Implements G4VSolid.

Reimplemented in G4BREPSolidOpenPCone.

Definition at line 217 of file G4BooleanSolid.cc.

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

Referenced by G4BREPSolidOpenPCone::StreamInfo().

00218 {
00219   os << "-----------------------------------------------------------\n"
00220      << "    *** Dump for Boolean solid - " << GetName() << " ***\n"
00221      << "    ===================================================\n"
00222      << " Solid type: " << GetEntityType() << "\n"
00223      << " Parameters of constituent solids: \n"
00224      << "===========================================================\n";
00225   fPtrSolidA->StreamInfo(os);
00226   fPtrSolidB->StreamInfo(os);
00227   os << "===========================================================\n";
00228 
00229   return os;
00230 }


Field Documentation

G4double G4BooleanSolid::fAreaRatio [mutable, protected]

Definition at line 125 of file G4BooleanSolid.hh.

Referenced by GetAreaRatio(), and operator=().

G4VSolid* G4BooleanSolid::fPtrSolidA [protected]

Definition at line 122 of file G4BooleanSolid.hh.

Referenced by G4UnionSolid::CalculateExtent(), G4SubtractionSolid::CalculateExtent(), G4IntersectionSolid::CalculateExtent(), G4UnionSolid::DistanceToIn(), G4SubtractionSolid::DistanceToIn(), G4IntersectionSolid::DistanceToIn(), G4UnionSolid::DistanceToOut(), G4SubtractionSolid::DistanceToOut(), G4IntersectionSolid::DistanceToOut(), G4BooleanSolid(), GetAreaRatio(), GetConstituentSolid(), GetPointOnSurface(), G4UnionSolid::Inside(), G4SubtractionSolid::Inside(), G4IntersectionSolid::Inside(), operator=(), StreamInfo(), G4UnionSolid::SurfaceNormal(), G4SubtractionSolid::SurfaceNormal(), and G4IntersectionSolid::SurfaceNormal().

G4VSolid* G4BooleanSolid::fPtrSolidB [protected]

Definition at line 123 of file G4BooleanSolid.hh.

Referenced by G4UnionSolid::CalculateExtent(), G4IntersectionSolid::CalculateExtent(), G4UnionSolid::DistanceToIn(), G4SubtractionSolid::DistanceToIn(), G4IntersectionSolid::DistanceToIn(), G4UnionSolid::DistanceToOut(), G4SubtractionSolid::DistanceToOut(), G4IntersectionSolid::DistanceToOut(), G4BooleanSolid(), GetAreaRatio(), GetConstituentSolid(), GetPointOnSurface(), G4UnionSolid::Inside(), G4SubtractionSolid::Inside(), G4IntersectionSolid::Inside(), operator=(), StreamInfo(), G4UnionSolid::SurfaceNormal(), G4SubtractionSolid::SurfaceNormal(), G4IntersectionSolid::SurfaceNormal(), and ~G4BooleanSolid().


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:33 2013 for Geant4 by  doxygen 1.4.7