Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes
VUSolid Class Referenceabstract

#include <VUSolid.hh>

Inheritance diagram for VUSolid:
UBox UCons UOrb UPolycone USphere UTet UTrd UTubs UVCSGfaceted

Public Types

enum  EnumInside { eInside =0, eSurface =1, eOutside =2 }
 
enum  EAxisType { eXaxis =0, eYaxis =1, eZaxis =2 }
 

Public Member Functions

 VUSolid ()
 
 VUSolid (const std::string &name)
 
virtual ~VUSolid ()
 
double GetCarTolerance () const
 
double GetRadTolerance () const
 
double GetAngTolerance () const
 
void SetCarTolerance (double eps)
 
void SetRadTolerance (double eps)
 
void SetAngTolerance (double eps)
 
virtual EnumInside Inside (const UVector3 &aPoint) const =0
 
virtual double SafetyFromInside (const UVector3 &aPoint, bool aAccurate=false) const =0
 
virtual double SafetyFromOutside (const UVector3 &aPoint, bool aAccurate=false) const =0
 
virtual double DistanceToIn (const UVector3 &aPoint, const UVector3 &aDirection, double aPstep=UUtils::kInfinity) const =0
 
virtual double DistanceToOut (const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const =0
 
virtual bool Normal (const UVector3 &aPoint, UVector3 &aNormal) const =0
 
virtual void ExtentAxis (EAxisType aAxis, double &aMin, double &aMax) const
 
virtual void Extent (UVector3 &aMin, UVector3 &aMax) const =0
 
virtual UGeometryType GetEntityType () const =0
 
const std::string & GetName () const
 
void SetName (const std::string &aName)
 
virtual double Capacity ()=0
 
virtual double SurfaceArea ()=0
 
virtual void SamplePointsInside (int, UVector3 *) const
 
virtual void SamplePointsOnSurface (int, UVector3 *) const
 
virtual void SamplePointsOnEdge (int, UVector3 *) const
 
virtual void GetParametersList (int aNumber, double *aArray) const =0
 
virtual VUSolidClone () const =0
 
virtual std::ostream & StreamInfo (std::ostream &os) const =0
 
virtual UVector3 GetPointOnSurface () const =0
 
double EstimateCubicVolume (int nStat, double epsilon) const
 
double EstimateSurfaceArea (int nStat, double ell) const
 

Static Public Member Functions

static double Tolerance ()
 

Protected Member Functions

virtual void ComputeBBox (UBBox *aBox, bool aStore=false)=0
 

Static Protected Attributes

static double fgTolerance = 1.0E-9
 
static double frTolerance = 1.0E-9
 
static double faTolerance = 1.0E-9
 

Detailed Description

Definition at line 19 of file VUSolid.hh.

Member Enumeration Documentation

Enumerator
eXaxis 
eYaxis 
eZaxis 

Definition at line 27 of file VUSolid.hh.

Enumerator
eInside 
eSurface 
eOutside 

Definition at line 23 of file VUSolid.hh.

Constructor & Destructor Documentation

VUSolid::VUSolid ( )

Definition at line 18 of file VUSolid.cc.

18  : fName()
19 {
20 
21 }
VUSolid::VUSolid ( const std::string &  name)

Definition at line 24 of file VUSolid.cc.

References SetName().

24  :
25 fName(name)
26 {
27  // Named constructor
28  SetName(name);
29 }
const XML_Char * name
void SetName(const std::string &aName)
Definition: VUSolid.hh:104
VUSolid::~VUSolid ( )
virtual

Definition at line 32 of file VUSolid.cc.

33 {
34 
35 }

Member Function Documentation

double VUSolid::Capacity ( )
pure virtual

Implemented in UPolycone, USphere, UTrd, UVCSGfaceted, UBox, UTubs, UTet, and UOrb.

Definition at line 199 of file VUSolid.cc.

References EstimateCubicVolume().

Referenced by UPolycone::Capacity(), and G4USolid::GetCubicVolume().

200 {
201  int cubVolStatistics = 1000000;
202  double cubVolEpsilon = 0.001;
203  return EstimateCubicVolume(cubVolStatistics, cubVolEpsilon);
204 }
double EstimateCubicVolume(int nStat, double epsilon) const
Definition: VUSolid.cc:214
virtual VUSolid* VUSolid::Clone ( ) const
pure virtual
virtual void VUSolid::ComputeBBox ( UBBox aBox,
bool  aStore = false 
)
protectedpure virtual
virtual double VUSolid::DistanceToIn ( const UVector3 aPoint,
const UVector3 aDirection,
double  aPstep = UUtils::kInfinity 
) const
pure virtual
virtual double VUSolid::DistanceToOut ( const UVector3 aPoint,
const UVector3 aDirection,
UVector3 aNormalVector,
bool &  aConvex,
double  aPstep = UUtils::kInfinity 
) const
pure virtual
double VUSolid::EstimateCubicVolume ( int  nStat,
double  epsilon 
) const

Definition at line 214 of file VUSolid.cc.

References eOutside, Extent(), Inside(), G4INCL::Math::max(), G4INCL::Math::min(), UUtils::Random(), UVector3::x, UVector3::y, and UVector3::z.

Referenced by UVCSGfaceted::Capacity(), and Capacity().

215 {
216  int iInside=0;
217  double px,py,pz,volume;
218  UVector3 min,max;
219  UVector3 p;
221 
222  // values needed for CalculateExtent signature
223 
224  // min max extents of pSolid along X,Y,Z
225 
226  this->Extent(min,max);
227 
228  // limits
229 
230  if(nStat < 100) nStat = 100;
231  if(epsilon > 0.01) epsilon = 0.01;
232 
233  for(int i = 0; i < nStat; i++ )
234  {
235  px = min.x+(max.x-min.x)*UUtils::Random();
236  py = min.y+(max.y-min.y)*UUtils::Random();
237  pz = min.z+(max.z-min.z)*UUtils::Random();
238  p = UVector3(px,py,pz);
239  in = this->Inside(p);
240  if(in != eOutside) iInside++;
241  }
242  volume = (max.x-min.x)*(max.y-min.y)*(max.z-min.z)*iInside/nStat;
243  return volume;
244 }
const char * p
Definition: xmltok.h:285
virtual EnumInside Inside(const UVector3 &aPoint) const =0
double x
Definition: UVector3.hh:136
EnumInside
Definition: VUSolid.hh:23
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
virtual void Extent(UVector3 &aMin, UVector3 &aMax) const =0
double z
Definition: UVector3.hh:138
double Random(double min=0.0, double max=1.0)
Definition: UUtils.cc:69
double y
Definition: UVector3.hh:137
double VUSolid::EstimateSurfaceArea ( int  nStat,
double  ell 
) const

Definition at line 268 of file VUSolid.cc.

References eOutside, Extent(), Inside(), G4INCL::Math::max(), G4INCL::Math::min(), UUtils::Random(), SafetyFromInside(), SafetyFromOutside(), UVector3::x, UVector3::y, and UVector3::z.

Referenced by UVCSGfaceted::SurfaceArea(), and SurfaceArea().

269 {
270  int inside=0;
271  double px,py,pz,surf;
272  UVector3 min,max;
273  UVector3 p;
275 
276  // values needed for CalculateExtent signature
277 
278  // min max extents of pSolid along X,Y,Z
279 
280  this->Extent(min,max);
281 
282  // limits
283 
284  if(nStat < 100) { nStat = 100; }
285 
286  double dX=max.x-min.x;
287  double dY=max.y-min.y;
288  double dZ=max.z-min.z;
289  if(ell<=0.) // Automatic definition of skin thickness
290  {
291  double minval=dX;
292  if(dY<dX) { minval=dY; }
293  if(dZ<minval) { minval=dZ; }
294  ell=.01*minval;
295  }
296 
297  double dd=2*ell;
298  min.x-=ell; min.y-=ell; min.z-=ell; dX+=dd; dY+=dd; dZ+=dd;
299 
300  for(int i = 0; i < nStat; i++ )
301  {
302  px = min.x+dX*UUtils::Random();
303  py = min.y+dY*UUtils::Random();
304  pz = min.z+dZ*UUtils::Random();
305  p = UVector3(px,py,pz);
306  in = this->Inside(p);
307  if(in != eOutside)
308  {
309  if (SafetyFromInside(p)<ell) { inside++; }
310  }
311  else if(SafetyFromOutside(p)<ell) { inside++; }
312  }
313  // @@ The conformal correction can be upgraded
314  surf = dX*dY*dZ*inside/dd/nStat;
315  return surf;
316 }
const char * p
Definition: xmltok.h:285
virtual EnumInside Inside(const UVector3 &aPoint) const =0
double x
Definition: UVector3.hh:136
EnumInside
Definition: VUSolid.hh:23
virtual double SafetyFromInside(const UVector3 &aPoint, bool aAccurate=false) const =0
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual double SafetyFromOutside(const UVector3 &aPoint, bool aAccurate=false) const =0
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
virtual void Extent(UVector3 &aMin, UVector3 &aMax) const =0
double z
Definition: UVector3.hh:138
double Random(double min=0.0, double max=1.0)
Definition: UUtils.cc:69
double y
Definition: UVector3.hh:137
virtual void VUSolid::Extent ( UVector3 aMin,
UVector3 aMax 
) const
pure virtual
void VUSolid::ExtentAxis ( EAxisType  aAxis,
double &  aMin,
double &  aMax 
) const
virtual

Definition at line 318 of file VUSolid.cc.

References G4INCL::Math::max(), and G4INCL::Math::min().

Referenced by G4USolid::CalculateExtent(), and G4USolid::CreateRotatedVertices().

320 {
321  // Returns extent of the solid along a given cartesian axis
322  if (aAxis >= 0 && aAxis <= 2)
323  {
324  UVector3 min, max;
325  Extent(min,max);
326  aMin = min[aAxis]; aMax = max[aAxis];
327  }
328 #ifdef USPECSDEBUG
329  else
330  cout << "Extent: unknown axis" << aAxis << std::endl;
331 #endif
332 }
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
virtual void Extent(UVector3 &aMin, UVector3 &aMax) const =0
double VUSolid::GetAngTolerance ( ) const
inline

Definition at line 153 of file VUSolid.hh.

References faTolerance.

153 { return faTolerance;}
static double faTolerance
Definition: VUSolid.hh:32
double VUSolid::GetCarTolerance ( ) const
inline

Definition at line 151 of file VUSolid.hh.

References fgTolerance.

151 { return fgTolerance;}
static double fgTolerance
Definition: VUSolid.hh:30
virtual UGeometryType VUSolid::GetEntityType ( ) const
pure virtual
const std::string& VUSolid::GetName ( void  ) const
inline
virtual void VUSolid::GetParametersList ( int  aNumber,
double *  aArray 
) const
pure virtual
virtual UVector3 VUSolid::GetPointOnSurface ( ) const
pure virtual
double VUSolid::GetRadTolerance ( ) const
inline

Definition at line 152 of file VUSolid.hh.

References frTolerance.

152 { return frTolerance;}
static double frTolerance
Definition: VUSolid.hh:31
virtual EnumInside VUSolid::Inside ( const UVector3 aPoint) const
pure virtual
virtual bool VUSolid::Normal ( const UVector3 aPoint,
UVector3 aNormal 
) const
pure virtual
virtual double VUSolid::SafetyFromInside ( const UVector3 aPoint,
bool  aAccurate = false 
) const
pure virtual
virtual double VUSolid::SafetyFromOutside ( const UVector3 aPoint,
bool  aAccurate = false 
) const
pure virtual
virtual void VUSolid::SamplePointsInside ( int  ,
UVector3  
) const
inlinevirtual

Definition at line 112 of file VUSolid.hh.

112 {}
virtual void VUSolid::SamplePointsOnEdge ( int  ,
UVector3  
) const
inlinevirtual

Definition at line 114 of file VUSolid.hh.

114 {}
virtual void VUSolid::SamplePointsOnSurface ( int  ,
UVector3  
) const
inlinevirtual

Definition at line 113 of file VUSolid.hh.

113 {}
void VUSolid::SetAngTolerance ( double  eps)

Definition at line 342 of file VUSolid.cc.

References faTolerance.

343 {
344  faTolerance=eps;
345 }
static double faTolerance
Definition: VUSolid.hh:32
void VUSolid::SetCarTolerance ( double  eps)

Definition at line 334 of file VUSolid.cc.

References fgTolerance.

335 {
336  fgTolerance=eps;
337 }
static double fgTolerance
Definition: VUSolid.hh:30
void VUSolid::SetName ( const std::string &  aName)
inline

Definition at line 104 of file VUSolid.hh.

Referenced by VUSolid().

104 {fName = aName;}
void VUSolid::SetRadTolerance ( double  eps)

Definition at line 338 of file VUSolid.cc.

References frTolerance.

339 {
340  frTolerance=eps;
341 }
static double frTolerance
Definition: VUSolid.hh:31
virtual std::ostream& VUSolid::StreamInfo ( std::ostream &  os) const
inlinepure virtual
double VUSolid::SurfaceArea ( )
pure virtual

Implemented in UPolycone, UVCSGfaceted, USphere, UTrd, UBox, UTubs, UTet, and UOrb.

Definition at line 255 of file VUSolid.cc.

References EstimateSurfaceArea().

Referenced by G4USolid::GetSurfaceArea().

256 {
257  int stat = 1000000;
258  double ell = -1.;
259  return EstimateSurfaceArea(stat,ell);
260 }
double EstimateSurfaceArea(int nStat, double ell) const
Definition: VUSolid.cc:268
static double VUSolid::Tolerance ( )
inlinestatic

Field Documentation

double VUSolid::faTolerance = 1.0E-9
staticprotected
double VUSolid::fgTolerance = 1.0E-9
staticprotected
double VUSolid::frTolerance = 1.0E-9
staticprotected

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