Geant4-11
Data Structures | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4Polycone Class Reference

#include <G4Polycone.hh>

Inheritance diagram for G4Polycone:
G4VCSGfaceted G4VSolid

Data Structures

struct  surface_element
 

Public Member Functions

void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
 
G4VSolidClone () const
 
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
G4PolyhedronCreatePolyhedron () const
 
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4double DistanceToIn (const G4ThreeVector &p) const
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 
virtual G4double DistanceToOut (const G4ThreeVector &p) const
 
virtual G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const
 
void DumpInfo () const
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 
 G4Polycone (__void__ &)
 
 G4Polycone (const G4Polycone &source)
 
 G4Polycone (const G4String &name, G4double phiStart, G4double phiTotal, G4int numRZ, const G4double r[], const G4double z[])
 
 G4Polycone (const G4String &name, G4double phiStart, G4double phiTotal, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
 
G4double GetAreaAccuracy () const
 
G4int GetAreaStatistics () const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
G4PolyconeSideRZ GetCorner (G4int index) const
 
G4double GetCosEndPhi () const
 
G4double GetCosStartPhi () const
 
G4double GetCubicVolume ()
 
G4double GetCubVolEpsilon () const
 
G4int GetCubVolStatistics () const
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
G4double GetEndPhi () const
 
G4GeometryType GetEntityType () const
 
virtual G4VisExtent GetExtent () const
 
G4String GetName () const
 
G4int GetNumRZCorner () const
 
G4PolyconeHistoricalGetOriginalParameters () const
 
G4ThreeVector GetPointOnSurface () const
 
virtual G4PolyhedronGetPolyhedron () const
 
G4double GetSinEndPhi () const
 
G4double GetSinStartPhi () const
 
G4double GetStartPhi () const
 
G4double GetSurfaceArea ()
 
G4double GetTolerance () const
 
EInside Inside (const G4ThreeVector &p) const
 
G4bool IsOpen () const
 
G4Polyconeoperator= (const G4Polycone &source)
 
G4bool operator== (const G4VSolid &s) const
 
G4bool Reset ()
 
void SetAreaAccuracy (G4double ep)
 
void SetAreaStatistics (G4int st)
 
void SetCubVolEpsilon (G4double ep)
 
void SetCubVolStatistics (G4int st)
 
void SetName (const G4String &name)
 
void SetOriginalParameters (G4PolyconeHistorical *pars)
 
std::ostream & StreamInfo (std::ostream &os) const
 
virtual G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 
virtual ~G4Polycone ()
 

Protected Member Functions

void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, 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 ClipCrossSection (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
 
void CopyStuff (const G4Polycone &source)
 
void CopyStuff (const G4VCSGfaceted &source)
 
void Create (G4double phiStart, G4double phiTotal, G4ReduciblePolygon *rz)
 
void DeleteStuff ()
 
virtual G4double DistanceTo (const G4ThreeVector &p, const G4bool outgoing) const
 
G4ThreeVector GetPointOnSurfaceGeneric () const
 
G4bool SetOriginalParameters (G4ReduciblePolygon *rz)
 
void SetSurfaceElements () const
 

Protected Attributes

G4PolyconeSideRZcorners = nullptr
 
G4EnclosingCylinderenclosingCylinder = nullptr
 
G4double endPhi
 
G4VCSGface ** faces = nullptr
 
G4double fCubicVolume = 0.0
 
std::vector< surface_element > * fElements = nullptr
 
G4PolyhedronfpPolyhedron = nullptr
 
G4bool fRebuildPolyhedron = false
 
G4double fSurfaceArea = 0.0
 
G4double kCarTolerance
 
G4int numCorner
 
G4int numFace = 0
 
G4PolyconeHistoricaloriginal_parameters = nullptr
 
G4bool phiIsOpen = false
 
G4double startPhi
 

Private Member Functions

void ClipPolygonToSimpleLimits (G4ThreeVectorList &pPolygon, G4ThreeVectorList &outputPolygon, const G4VoxelLimits &pVoxelLimit) const
 

Private Attributes

G4double fAreaAccuracy
 
G4double fCubVolEpsilon
 
G4String fshapeName
 
G4int fStatistics
 

Detailed Description

Definition at line 75 of file G4Polycone.hh.

Constructor & Destructor Documentation

◆ G4Polycone() [1/4]

G4Polycone::G4Polycone ( const G4String name,
G4double  phiStart,
G4double  phiTotal,
G4int  numZPlanes,
const G4double  zPlane[],
const G4double  rInner[],
const G4double  rOuter[] 
)

Definition at line 58 of file G4Polycone.cc.

66{
67 //
68 // Some historical ugliness
69 //
71
75 original_parameters->Z_values = new G4double[numZPlanes];
76 original_parameters->Rmin = new G4double[numZPlanes];
77 original_parameters->Rmax = new G4double[numZPlanes];
78
79 for (G4int i=0; i<numZPlanes; ++i)
80 {
81 if(rInner[i]>rOuter[i])
82 {
83 DumpInfo();
84 std::ostringstream message;
85 message << "Cannot create a Polycone with rInner > rOuter for the same Z"
86 << G4endl
87 << " rInner > rOuter for the same Z !" << G4endl
88 << " rMin[" << i << "] = " << rInner[i]
89 << " -- rMax[" << i << "] = " << rOuter[i];
90 G4Exception("G4Polycone::G4Polycone()", "GeomSolids0002",
91 FatalErrorInArgument, message);
92 }
93 if (( i < numZPlanes-1) && ( zPlane[i] == zPlane[i+1] ))
94 {
95 if( (rInner[i] > rOuter[i+1])
96 ||(rInner[i+1] > rOuter[i]) )
97 {
98 DumpInfo();
99 std::ostringstream message;
100 message << "Cannot create a Polycone with no contiguous segments."
101 << G4endl
102 << " Segments are not contiguous !" << G4endl
103 << " rMin[" << i << "] = " << rInner[i]
104 << " -- rMax[" << i+1 << "] = " << rOuter[i+1] << G4endl
105 << " rMin[" << i+1 << "] = " << rInner[i+1]
106 << " -- rMax[" << i << "] = " << rOuter[i];
107 G4Exception("G4Polycone::G4Polycone()", "GeomSolids0002",
108 FatalErrorInArgument, message);
109 }
110 }
111 original_parameters->Z_values[i] = zPlane[i];
112 original_parameters->Rmin[i] = rInner[i];
113 original_parameters->Rmax[i] = rOuter[i];
114 }
115
116 //
117 // Build RZ polygon using special PCON/PGON GEANT3 constructor
118 //
120 new G4ReduciblePolygon( rInner, rOuter, zPlane, numZPlanes );
121
122 //
123 // Do the real work
124 //
125 Create( phiStart, phiTotal, rz );
126
127 delete rz;
128}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
void Create(G4double phiStart, G4double phiTotal, G4ReduciblePolygon *rz)
Definition: G4Polycone.cc:172
G4PolyconeHistorical * original_parameters
Definition: G4Polycone.hh:178
G4VCSGfaceted(const G4String &name)
void DumpInfo() const
const char * name(G4int ptype)

References Create(), G4VSolid::DumpInfo(), FatalErrorInArgument, G4endl, G4Exception(), G4PolyconeHistorical::Num_z_planes, G4PolyconeHistorical::Opening_angle, original_parameters, G4PolyconeHistorical::Rmax, G4PolyconeHistorical::Rmin, G4PolyconeHistorical::Start_angle, and G4PolyconeHistorical::Z_values.

Referenced by Clone().

◆ G4Polycone() [2/4]

G4Polycone::G4Polycone ( const G4String name,
G4double  phiStart,
G4double  phiTotal,
G4int  numRZ,
const G4double  r[],
const G4double  z[] 
)

Definition at line 132 of file G4Polycone.cc.

139{
140
141 G4ReduciblePolygon* rz = new G4ReduciblePolygon( r, z, numRZ );
142
143 Create( phiStart, phiTotal, rz );
144
145 // Set original_parameters struct for consistency
146 //
147
148 G4bool convertible = SetOriginalParameters(rz);
149
150 if(!convertible)
151 {
152 std::ostringstream message;
153 message << "Polycone " << GetName() << "cannot be converted" << G4endl
154 << "to Polycone with (Rmin,Rmaz,Z) parameters!";
155 G4Exception("G4Polycone::G4Polycone()", "GeomSolids0002",
156 FatalException, message, "Use G4GenericPolycone instead!");
157 }
158 else
159 {
160 G4cout << "INFO: Converting polycone " << GetName() << G4endl
161 << "to optimized polycone with (Rmin,Rmaz,Z) parameters !"
162 << G4endl;
163 }
164 delete rz;
165}
@ FatalException
bool G4bool
Definition: G4Types.hh:86
G4GLOB_DLL std::ostream G4cout
void SetOriginalParameters(G4PolyconeHistorical *pars)
G4String GetName() const

References Create(), FatalException, G4cout, G4endl, G4Exception(), G4VSolid::GetName(), and SetOriginalParameters().

◆ ~G4Polycone()

G4Polycone::~G4Polycone ( )
virtual

Definition at line 342 of file G4Polycone.cc.

343{
344 delete [] corners;
345 delete original_parameters;
346 delete enclosingCylinder;
347 delete fElements;
348 delete fpPolyhedron;
349 corners = nullptr;
350 original_parameters = nullptr;
351 enclosingCylinder = nullptr;
352 fElements = nullptr;
353 fpPolyhedron = nullptr;
354}
G4EnclosingCylinder * enclosingCylinder
Definition: G4Polycone.hh:180
G4PolyconeSideRZ * corners
Definition: G4Polycone.hh:177
std::vector< surface_element > * fElements
Definition: G4Polycone.hh:183
G4Polyhedron * fpPolyhedron

References corners, enclosingCylinder, fElements, G4VCSGfaceted::fpPolyhedron, and original_parameters.

◆ G4Polycone() [3/4]

G4Polycone::G4Polycone ( __void__ &  a)

Definition at line 333 of file G4Polycone.cc.

334 : G4VCSGfaceted(a), startPhi(0.), endPhi(0.), numCorner(0)
335{
336}
G4double endPhi
Definition: G4Polycone.hh:174
G4int numCorner
Definition: G4Polycone.hh:176
G4double startPhi
Definition: G4Polycone.hh:173

◆ G4Polycone() [4/4]

G4Polycone::G4Polycone ( const G4Polycone source)

Definition at line 358 of file G4Polycone.cc.

360{
361 CopyStuff( source );
362}
void CopyStuff(const G4Polycone &source)
Definition: G4Polycone.cc:384

References CopyStuff().

Member Function Documentation

◆ BoundingLimits()

void G4Polycone::BoundingLimits ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 511 of file G4Polycone.cc.

513{
514 G4double rmin = kInfinity, rmax = -kInfinity;
515 G4double zmin = kInfinity, zmax = -kInfinity;
516
517 for (G4int i=0; i<GetNumRZCorner(); ++i)
518 {
519 G4PolyconeSideRZ corner = GetCorner(i);
520 if (corner.r < rmin) rmin = corner.r;
521 if (corner.r > rmax) rmax = corner.r;
522 if (corner.z < zmin) zmin = corner.z;
523 if (corner.z > zmax) zmax = corner.z;
524 }
525
526 if (IsOpen())
527 {
528 G4TwoVector vmin,vmax;
529 G4GeomTools::DiskExtent(rmin,rmax,
532 vmin,vmax);
533 pMin.set(vmin.x(),vmin.y(),zmin);
534 pMax.set(vmax.x(),vmax.y(),zmax);
535 }
536 else
537 {
538 pMin.set(-rmax,-rmax, zmin);
539 pMax.set( rmax, rmax, zmax);
540 }
541
542 // Check correctness of the bounding box
543 //
544 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
545 {
546 std::ostringstream message;
547 message << "Bad bounding box (min >= max) for solid: "
548 << GetName() << " !"
549 << "\npMin = " << pMin
550 << "\npMax = " << pMax;
551 G4Exception("G4Polycone::BoundingLimits()", "GeomMgt0001",
552 JustWarning, message);
553 DumpInfo();
554 }
555}
@ JustWarning
static const G4double pMax
static const G4double pMin
double x() const
double y() const
static G4bool DiskExtent(G4double rmin, G4double rmax, G4double startPhi, G4double delPhi, G4TwoVector &pmin, G4TwoVector &pmax)
Definition: G4GeomTools.cc:390
G4double GetCosEndPhi() const
G4double GetSinEndPhi() const
G4double GetCosStartPhi() const
G4bool IsOpen() const
G4double GetSinStartPhi() const
G4int GetNumRZCorner() const
G4PolyconeSideRZ GetCorner(G4int index) const
static const G4double kInfinity
Definition: geomdefs.hh:41

References G4GeomTools::DiskExtent(), G4VSolid::DumpInfo(), G4Exception(), GetCorner(), GetCosEndPhi(), GetCosStartPhi(), G4VSolid::GetName(), GetNumRZCorner(), GetSinEndPhi(), GetSinStartPhi(), IsOpen(), JustWarning, kInfinity, pMax, pMin, G4PolyconeSideRZ::r, CLHEP::Hep2Vector::x(), CLHEP::Hep2Vector::y(), and G4PolyconeSideRZ::z.

Referenced by CalculateExtent().

◆ CalculateClippedPolygonExtent()

void G4VSolid::CalculateClippedPolygonExtent ( G4ThreeVectorList pPolygon,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 489 of file G4VSolid.cc.

494{
495 G4int noLeft,i;
496 G4double component;
497
498 ClipPolygon(pPolygon,pVoxelLimit,pAxis);
499 noLeft = pPolygon.size();
500
501 if ( noLeft )
502 {
503 for (i=0; i<noLeft; ++i)
504 {
505 component = pPolygon[i].operator()(pAxis);
506
507 if (component < pMin)
508 {
509 pMin = component;
510 }
511 if (component > pMax)
512 {
513 pMax = component;
514 }
515 }
516 }
517}
void ClipPolygon(G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
Definition: G4VSolid.cc:539

References G4VSolid::ClipPolygon(), pMax, and pMin.

Referenced by G4VSolid::ClipBetweenSections(), and G4VSolid::ClipCrossSection().

◆ CalculateExtent()

G4bool G4Polycone::CalculateExtent ( const EAxis  pAxis,
const G4VoxelLimits pVoxelLimit,
const G4AffineTransform pTransform,
G4double pmin,
G4double pmax 
) const
virtual

Reimplemented from G4VCSGfaceted.

Definition at line 559 of file G4Polycone.cc.

563{
564 G4ThreeVector bmin, bmax;
565 G4bool exist;
566
567 // Check bounding box (bbox)
568 //
569 BoundingLimits(bmin,bmax);
570 G4BoundingEnvelope bbox(bmin,bmax);
571#ifdef G4BBOX_EXTENT
572 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
573#endif
574 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
575 {
576 return exist = (pMin < pMax) ? true : false;
577 }
578
579 // To find the extent, RZ contour of the polycone is subdivided
580 // in triangles. The extent is calculated as cumulative extent of
581 // all sub-polycones formed by rotation of triangles around Z
582 //
583 G4TwoVectorList contourRZ;
584 G4TwoVectorList triangles;
585 std::vector<G4int> iout;
586 G4double eminlim = pVoxelLimit.GetMinExtent(pAxis);
587 G4double emaxlim = pVoxelLimit.GetMaxExtent(pAxis);
588
589 // get RZ contour, ensure anticlockwise order of corners
590 for (G4int i=0; i<GetNumRZCorner(); ++i)
591 {
592 G4PolyconeSideRZ corner = GetCorner(i);
593 contourRZ.push_back(G4TwoVector(corner.r,corner.z));
594 }
596 G4double area = G4GeomTools::PolygonArea(contourRZ);
597 if (area < 0.) std::reverse(contourRZ.begin(),contourRZ.end());
598
599 // triangulate RZ countour
600 if (!G4GeomTools::TriangulatePolygon(contourRZ,triangles))
601 {
602 std::ostringstream message;
603 message << "Triangulation of RZ contour has failed for solid: "
604 << GetName() << " !"
605 << "\nExtent has been calculated using boundary box";
606 G4Exception("G4Polycone::CalculateExtent()",
607 "GeomMgt1002", JustWarning, message);
608 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
609 }
610
611 // set trigonometric values
612 const G4int NSTEPS = 24; // number of steps for whole circle
613 G4double astep = twopi/NSTEPS; // max angle for one step
614
615 G4double sphi = GetStartPhi();
616 G4double ephi = GetEndPhi();
617 G4double dphi = IsOpen() ? ephi-sphi : twopi;
618 G4int ksteps = (dphi <= astep) ? 1 : (G4int)((dphi-deg)/astep) + 1;
619 G4double ang = dphi/ksteps;
620
621 G4double sinHalf = std::sin(0.5*ang);
622 G4double cosHalf = std::cos(0.5*ang);
623 G4double sinStep = 2.*sinHalf*cosHalf;
624 G4double cosStep = 1. - 2.*sinHalf*sinHalf;
625
626 G4double sinStart = GetSinStartPhi();
627 G4double cosStart = GetCosStartPhi();
628 G4double sinEnd = GetSinEndPhi();
629 G4double cosEnd = GetCosEndPhi();
630
631 // define vectors and arrays
632 std::vector<const G4ThreeVectorList *> polygons;
633 polygons.resize(ksteps+2);
634 G4ThreeVectorList pols[NSTEPS+2];
635 for (G4int k=0; k<ksteps+2; ++k) pols[k].resize(6);
636 for (G4int k=0; k<ksteps+2; ++k) polygons[k] = &pols[k];
637 G4double r0[6],z0[6]; // contour with original edges of triangle
638 G4double r1[6]; // shifted radii of external edges of triangle
639
640 // main loop along triangles
641 pMin = kInfinity;
642 pMax =-kInfinity;
643 G4int ntria = triangles.size()/3;
644 for (G4int i=0; i<ntria; ++i)
645 {
646 G4int i3 = i*3;
647 for (G4int k=0; k<3; ++k)
648 {
649 G4int e0 = i3+k, e1 = (k<2) ? e0+1 : i3;
650 G4int k2 = k*2;
651 // set contour with original edges of triangle
652 r0[k2+0] = triangles[e0].x(); z0[k2+0] = triangles[e0].y();
653 r0[k2+1] = triangles[e1].x(); z0[k2+1] = triangles[e1].y();
654 // set shifted radii
655 r1[k2+0] = r0[k2+0];
656 r1[k2+1] = r0[k2+1];
657 if (z0[k2+1] - z0[k2+0] <= 0) continue;
658 r1[k2+0] /= cosHalf;
659 r1[k2+1] /= cosHalf;
660 }
661
662 // rotate countour, set sequence of 6-sided polygons
663 G4double sinCur = sinStart*cosHalf + cosStart*sinHalf;
664 G4double cosCur = cosStart*cosHalf - sinStart*sinHalf;
665 for (G4int j=0; j<6; ++j) pols[0][j].set(r0[j]*cosStart,r0[j]*sinStart,z0[j]);
666 for (G4int k=1; k<ksteps+1; ++k)
667 {
668 for (G4int j=0; j<6; ++j) pols[k][j].set(r1[j]*cosCur,r1[j]*sinCur,z0[j]);
669 G4double sinTmp = sinCur;
670 sinCur = sinCur*cosStep + cosCur*sinStep;
671 cosCur = cosCur*cosStep - sinTmp*sinStep;
672 }
673 for (G4int j=0; j<6; ++j) pols[ksteps+1][j].set(r0[j]*cosEnd,r0[j]*sinEnd,z0[j]);
674
675 // set sub-envelope and adjust extent
676 G4double emin,emax;
677 G4BoundingEnvelope benv(polygons);
678 if (!benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,emin,emax)) continue;
679 if (emin < pMin) pMin = emin;
680 if (emax > pMax) pMax = emax;
681 if (eminlim > pMin && emaxlim < pMax) return true; // max possible extent
682 }
683 return (pMin < pMax);
684}
static const G4double e1[44]
std::vector< G4ThreeVector > G4ThreeVectorList
static const G4double emax
std::vector< G4TwoVector > G4TwoVectorList
Definition: G4GeomTools.hh:42
static constexpr double twopi
Definition: G4SIunits.hh:56
static constexpr double deg
Definition: G4SIunits.hh:132
CLHEP::Hep2Vector G4TwoVector
Definition: G4TwoVector.hh:36
static G4bool TriangulatePolygon(const G4TwoVectorList &polygon, G4TwoVectorList &result)
Definition: G4GeomTools.cc:193
static void RemoveRedundantVertices(G4TwoVectorList &polygon, std::vector< G4int > &iout, G4double tolerance=0.0)
Definition: G4GeomTools.cc:305
static G4double PolygonArea(const G4TwoVectorList &polygon)
Definition: G4GeomTools.cc:76
G4double GetEndPhi() const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Polycone.cc:511
G4double GetStartPhi() const
G4double kCarTolerance
Definition: G4VSolid.hh:299
G4double GetMinExtent(const EAxis pAxis) const
G4double GetMaxExtent(const EAxis pAxis) const

References G4BoundingEnvelope::BoundingBoxVsVoxelLimits(), BoundingLimits(), G4BoundingEnvelope::CalculateExtent(), deg, e1, emax, G4Exception(), GetCorner(), GetCosEndPhi(), GetCosStartPhi(), GetEndPhi(), G4VoxelLimits::GetMaxExtent(), G4VoxelLimits::GetMinExtent(), G4VSolid::GetName(), GetNumRZCorner(), GetSinEndPhi(), GetSinStartPhi(), GetStartPhi(), IsOpen(), JustWarning, G4VSolid::kCarTolerance, kInfinity, pMax, pMin, G4GeomTools::PolygonArea(), G4PolyconeSideRZ::r, G4GeomTools::RemoveRedundantVertices(), G4GeomTools::TriangulatePolygon(), twopi, G4PolyconeSideRZ::z, and G4InuclParticleNames::z0.

◆ ClipBetweenSections()

void G4VSolid::ClipBetweenSections ( G4ThreeVectorList pVertices,
const G4int  pSectionIndex,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 444 of file G4VSolid.cc.

449{
450 G4ThreeVectorList polygon;
451 polygon.reserve(4);
452 polygon.push_back((*pVertices)[pSectionIndex]);
453 polygon.push_back((*pVertices)[pSectionIndex+4]);
454 polygon.push_back((*pVertices)[pSectionIndex+5]);
455 polygon.push_back((*pVertices)[pSectionIndex+1]);
456 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
457 polygon.clear();
458
459 polygon.push_back((*pVertices)[pSectionIndex+1]);
460 polygon.push_back((*pVertices)[pSectionIndex+5]);
461 polygon.push_back((*pVertices)[pSectionIndex+6]);
462 polygon.push_back((*pVertices)[pSectionIndex+2]);
463 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
464 polygon.clear();
465
466 polygon.push_back((*pVertices)[pSectionIndex+2]);
467 polygon.push_back((*pVertices)[pSectionIndex+6]);
468 polygon.push_back((*pVertices)[pSectionIndex+7]);
469 polygon.push_back((*pVertices)[pSectionIndex+3]);
470 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
471 polygon.clear();
472
473 polygon.push_back((*pVertices)[pSectionIndex+3]);
474 polygon.push_back((*pVertices)[pSectionIndex+7]);
475 polygon.push_back((*pVertices)[pSectionIndex+4]);
476 polygon.push_back((*pVertices)[pSectionIndex]);
477 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
478 return;
479}
void CalculateClippedPolygonExtent(G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
Definition: G4VSolid.cc:489

References G4VSolid::CalculateClippedPolygonExtent(), pMax, and pMin.

◆ ClipCrossSection()

void G4VSolid::ClipCrossSection ( G4ThreeVectorList pVertices,
const G4int  pSectionIndex,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 414 of file G4VSolid.cc.

419{
420
421 G4ThreeVectorList polygon;
422 polygon.reserve(4);
423 polygon.push_back((*pVertices)[pSectionIndex]);
424 polygon.push_back((*pVertices)[pSectionIndex+1]);
425 polygon.push_back((*pVertices)[pSectionIndex+2]);
426 polygon.push_back((*pVertices)[pSectionIndex+3]);
427 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
428 return;
429}

References G4VSolid::CalculateClippedPolygonExtent(), pMax, and pMin.

◆ ClipPolygon()

void G4VSolid::ClipPolygon ( G4ThreeVectorList pPolygon,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis 
) const
protectedinherited

Definition at line 539 of file G4VSolid.cc.

542{
543 G4ThreeVectorList outputPolygon;
544
545 if ( pVoxelLimit.IsLimited() )
546 {
547 if (pVoxelLimit.IsXLimited() ) // && pAxis != kXAxis)
548 {
549 G4VoxelLimits simpleLimit1;
550 simpleLimit1.AddLimit(kXAxis,pVoxelLimit.GetMinXExtent(),kInfinity);
551 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
552
553 pPolygon.clear();
554
555 if ( !outputPolygon.size() ) return;
556
557 G4VoxelLimits simpleLimit2;
558 simpleLimit2.AddLimit(kXAxis,-kInfinity,pVoxelLimit.GetMaxXExtent());
559 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
560
561 if ( !pPolygon.size() ) return;
562 else outputPolygon.clear();
563 }
564 if ( pVoxelLimit.IsYLimited() ) // && pAxis != kYAxis)
565 {
566 G4VoxelLimits simpleLimit1;
567 simpleLimit1.AddLimit(kYAxis,pVoxelLimit.GetMinYExtent(),kInfinity);
568 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
569
570 // Must always clear pPolygon - for clip to simpleLimit2 and in case of
571 // early exit
572
573 pPolygon.clear();
574
575 if ( !outputPolygon.size() ) return;
576
577 G4VoxelLimits simpleLimit2;
578 simpleLimit2.AddLimit(kYAxis,-kInfinity,pVoxelLimit.GetMaxYExtent());
579 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
580
581 if ( !pPolygon.size() ) return;
582 else outputPolygon.clear();
583 }
584 if ( pVoxelLimit.IsZLimited() ) // && pAxis != kZAxis)
585 {
586 G4VoxelLimits simpleLimit1;
587 simpleLimit1.AddLimit(kZAxis,pVoxelLimit.GetMinZExtent(),kInfinity);
588 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
589
590 // Must always clear pPolygon - for clip to simpleLimit2 and in case of
591 // early exit
592
593 pPolygon.clear();
594
595 if ( !outputPolygon.size() ) return;
596
597 G4VoxelLimits simpleLimit2;
598 simpleLimit2.AddLimit(kZAxis,-kInfinity,pVoxelLimit.GetMaxZExtent());
599 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
600
601 // Return after final clip - no cleanup
602 }
603 }
604}
void ClipPolygonToSimpleLimits(G4ThreeVectorList &pPolygon, G4ThreeVectorList &outputPolygon, const G4VoxelLimits &pVoxelLimit) const
Definition: G4VSolid.cc:612
G4bool IsYLimited() const
G4double GetMinZExtent() const
void AddLimit(const EAxis pAxis, const G4double pMin, const G4double pMax)
G4bool IsXLimited() const
G4double GetMaxYExtent() const
G4double GetMaxZExtent() const
G4double GetMinYExtent() const
G4double GetMinXExtent() const
G4bool IsZLimited() const
G4bool IsLimited() const
G4double GetMaxXExtent() const
@ kYAxis
Definition: geomdefs.hh:56
@ kXAxis
Definition: geomdefs.hh:55
@ kZAxis
Definition: geomdefs.hh:57

References G4VoxelLimits::AddLimit(), G4VSolid::ClipPolygonToSimpleLimits(), G4VoxelLimits::GetMaxXExtent(), G4VoxelLimits::GetMaxYExtent(), G4VoxelLimits::GetMaxZExtent(), G4VoxelLimits::GetMinXExtent(), G4VoxelLimits::GetMinYExtent(), G4VoxelLimits::GetMinZExtent(), G4VoxelLimits::IsLimited(), G4VoxelLimits::IsXLimited(), G4VoxelLimits::IsYLimited(), G4VoxelLimits::IsZLimited(), kInfinity, kXAxis, kYAxis, and kZAxis.

Referenced by G4VSolid::CalculateClippedPolygonExtent().

◆ ClipPolygonToSimpleLimits()

void G4VSolid::ClipPolygonToSimpleLimits ( G4ThreeVectorList pPolygon,
G4ThreeVectorList outputPolygon,
const G4VoxelLimits pVoxelLimit 
) const
privateinherited

Definition at line 612 of file G4VSolid.cc.

615{
616 G4int i;
617 G4int noVertices=pPolygon.size();
618 G4ThreeVector vEnd,vStart;
619
620 for (i = 0 ; i < noVertices ; ++i )
621 {
622 vStart = pPolygon[i];
623 if ( i == noVertices-1 ) vEnd = pPolygon[0];
624 else vEnd = pPolygon[i+1];
625
626 if ( pVoxelLimit.Inside(vStart) )
627 {
628 if (pVoxelLimit.Inside(vEnd))
629 {
630 // vStart and vEnd inside -> output end point
631 //
632 outputPolygon.push_back(vEnd);
633 }
634 else
635 {
636 // vStart inside, vEnd outside -> output crossing point
637 //
638 pVoxelLimit.ClipToLimits(vStart,vEnd);
639 outputPolygon.push_back(vEnd);
640 }
641 }
642 else
643 {
644 if (pVoxelLimit.Inside(vEnd))
645 {
646 // vStart outside, vEnd inside -> output inside section
647 //
648 pVoxelLimit.ClipToLimits(vStart,vEnd);
649 outputPolygon.push_back(vStart);
650 outputPolygon.push_back(vEnd);
651 }
652 else // Both point outside -> no output
653 {
654 // outputPolygon.push_back(vStart);
655 // outputPolygon.push_back(vEnd);
656 }
657 }
658 }
659}
G4bool ClipToLimits(G4ThreeVector &pStart, G4ThreeVector &pEnd) const
G4bool Inside(const G4ThreeVector &pVec) const

References G4VoxelLimits::ClipToLimits(), and G4VoxelLimits::Inside().

Referenced by G4VSolid::ClipPolygon().

◆ Clone()

G4VSolid * G4Polycone::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 704 of file G4Polycone.cc.

705{
706 return new G4Polycone(*this);
707}
G4Polycone(const G4String &name, G4double phiStart, G4double phiTotal, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
Definition: G4Polycone.cc:58

References G4Polycone().

◆ ComputeDimensions()

void G4Polycone::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtual

Reimplemented from G4VSolid.

Definition at line 688 of file G4Polycone.cc.

691{
692 p->ComputeDimensions(*this,n,pRep);
693}
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const

References G4VPVParameterisation::ComputeDimensions(), and CLHEP::detail::n.

◆ CopyStuff() [1/2]

void G4Polycone::CopyStuff ( const G4Polycone source)
protected

Definition at line 384 of file G4Polycone.cc.

385{
386 //
387 // Simple stuff
388 //
389 startPhi = source.startPhi;
390 endPhi = source.endPhi;
391 phiIsOpen = source.phiIsOpen;
392 numCorner = source.numCorner;
393
394 //
395 // The corner array
396 //
398
400 * sourceCorn = source.corners;
401 do // Loop checking, 13.08.2015, G.Cosmo
402 {
403 *corn = *sourceCorn;
404 } while( ++sourceCorn, ++corn < corners+numCorner );
405
406 //
407 // Original parameters
408 //
409 if (source.original_parameters)
410 {
412 new G4PolyconeHistorical( *source.original_parameters );
413 }
414
415 //
416 // Enclosing cylinder
417 //
418 enclosingCylinder = new G4EnclosingCylinder( *source.enclosingCylinder );
419
420 //
421 // Surface elements
422 //
423 delete fElements;
424 fElements = nullptr;
425
426 //
427 // Polyhedron
428 //
429 fRebuildPolyhedron = false;
430 delete fpPolyhedron;
431 fpPolyhedron = nullptr;
432}
G4bool phiIsOpen
Definition: G4Polycone.hh:175
G4bool fRebuildPolyhedron

References corners, enclosingCylinder, endPhi, fElements, G4VCSGfaceted::fpPolyhedron, G4VCSGfaceted::fRebuildPolyhedron, numCorner, original_parameters, phiIsOpen, and startPhi.

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

◆ CopyStuff() [2/2]

void G4VCSGfaceted::CopyStuff ( const G4VCSGfaceted source)
protectedinherited

Definition at line 125 of file G4VCSGfaceted.cc.

126{
127 numFace = source.numFace;
128 if (numFace == 0) { return; } // odd, but permissable?
129
130 faces = new G4VCSGface*[numFace];
131
132 G4VCSGface **face = faces,
133 **sourceFace = source.faces;
134 do // Loop checking, 13.08.2015, G.Cosmo
135 {
136 *face = (*sourceFace)->Clone();
137 } while( ++sourceFace, ++face < faces+numFace );
138 fCubicVolume = source.fCubicVolume;
139 fSurfaceArea = source.fSurfaceArea;
140 fRebuildPolyhedron = false;
141 fpPolyhedron = nullptr;
142}
virtual G4VCSGface * Clone()=0
G4double fCubicVolume
G4VCSGface ** faces
G4double fSurfaceArea

References G4VCSGface::Clone(), G4VCSGfaceted::faces, G4VCSGfaceted::fCubicVolume, G4VCSGfaceted::fpPolyhedron, G4VCSGfaceted::fRebuildPolyhedron, G4VCSGfaceted::fSurfaceArea, and G4VCSGfaceted::numFace.

Referenced by G4VCSGfaceted::G4VCSGfaceted(), and G4VCSGfaceted::operator=().

◆ Create()

void G4Polycone::Create ( G4double  phiStart,
G4double  phiTotal,
G4ReduciblePolygon rz 
)
protected

Definition at line 172 of file G4Polycone.cc.

175{
176 //
177 // Perform checks of rz values
178 //
179 if (rz->Amin() < 0.0)
180 {
181 std::ostringstream message;
182 message << "Illegal input parameters - " << GetName() << G4endl
183 << " All R values must be >= 0 !";
184 G4Exception("G4Polycone::Create()", "GeomSolids0002",
185 FatalErrorInArgument, message);
186 }
187
188 G4double rzArea = rz->Area();
189 if (rzArea < -kCarTolerance)
190 {
191 rz->ReverseOrder();
192 }
193 else if (rzArea < kCarTolerance)
194 {
195 std::ostringstream message;
196 message << "Illegal input parameters - " << GetName() << G4endl
197 << " R/Z cross section is zero or near zero: " << rzArea;
198 G4Exception("G4Polycone::Create()", "GeomSolids0002",
199 FatalErrorInArgument, message);
200 }
201
204 {
205 std::ostringstream message;
206 message << "Illegal input parameters - " << GetName() << G4endl
207 << " Too few unique R/Z values !";
208 G4Exception("G4Polycone::Create()", "GeomSolids0002",
209 FatalErrorInArgument, message);
210 }
211
212 if (rz->CrossesItself(1/kInfinity))
213 {
214 std::ostringstream message;
215 message << "Illegal input parameters - " << GetName() << G4endl
216 << " R/Z segments cross !";
217 G4Exception("G4Polycone::Create()", "GeomSolids0002",
218 FatalErrorInArgument, message);
219 }
220
221 numCorner = rz->NumVertices();
222
223 startPhi = phiStart;
224 while( startPhi < 0. ) // Loop checking, 13.08.2015, G.Cosmo
225 startPhi += twopi;
226 //
227 // Phi opening? Account for some possible roundoff, and interpret
228 // nonsense value as representing no phi opening
229 //
230 if ( (phiTotal <= 0) || (phiTotal > twopi*(1-DBL_EPSILON)) )
231 {
232 phiIsOpen = false;
233 startPhi = 0.;
234 endPhi = twopi;
235 }
236 else
237 {
238 phiIsOpen = true;
239 endPhi = startPhi + phiTotal;
240 }
241
242 //
243 // Allocate corner array.
244 //
246
247 //
248 // Copy corners
249 //
251
253 iterRZ.Begin();
254 do // Loop checking, 13.08.2015, G.Cosmo
255 {
256 next->r = iterRZ.GetA();
257 next->z = iterRZ.GetB();
258 } while( ++next, iterRZ.Next() );
259
260 //
261 // Allocate face pointer array
262 //
264 faces = new G4VCSGface*[numFace];
265
266 //
267 // Construct conical faces
268 //
269 // But! Don't construct a face if both points are at zero radius!
270 //
271 G4PolyconeSideRZ* corner = corners,
272 * prev = corners + numCorner-1,
273 * nextNext;
274 G4VCSGface **face = faces;
275 do // Loop checking, 13.08.2015, G.Cosmo
276 {
277 next = corner+1;
278 if (next >= corners+numCorner) next = corners;
279 nextNext = next+1;
280 if (nextNext >= corners+numCorner) nextNext = corners;
281
282 if (corner->r < 1/kInfinity && next->r < 1/kInfinity) continue;
283
284 //
285 // We must decide here if we can dare declare one of our faces
286 // as having a "valid" normal (i.e. allBehind = true). This
287 // is never possible if the face faces "inward" in r.
288 //
289 G4bool allBehind;
290 if (corner->z > next->z)
291 {
292 allBehind = false;
293 }
294 else
295 {
296 //
297 // Otherwise, it is only true if the line passing
298 // through the two points of the segment do not
299 // split the r/z cross section
300 //
301 allBehind = !rz->BisectedBy( corner->r, corner->z,
302 next->r, next->z, kCarTolerance );
303 }
304
305 *face++ = new G4PolyconeSide( prev, corner, next, nextNext,
306 startPhi, endPhi-startPhi, phiIsOpen, allBehind );
307 } while( prev=corner, corner=next, corner > corners );
308
309 if (phiIsOpen)
310 {
311 //
312 // Construct phi open edges
313 //
314 *face++ = new G4PolyPhiFace( rz, startPhi, 0, endPhi );
315 *face++ = new G4PolyPhiFace( rz, endPhi, 0, startPhi );
316 }
317
318 //
319 // We might have dropped a face or two: recalculate numFace
320 //
321 numFace = face-faces;
322
323 //
324 // Make enclosingCylinder
325 //
327 new G4EnclosingCylinder( rz, phiIsOpen, phiStart, phiTotal );
328}
G4bool BisectedBy(G4double a1, G4double b1, G4double a2, G4double b2, G4double tolerance)
G4double Amin() const
G4bool RemoveDuplicateVertices(G4double tolerance)
G4int NumVertices() const
G4bool RemoveRedundantVertices(G4double tolerance)
G4bool CrossesItself(G4double tolerance)
#define DBL_EPSILON
Definition: templates.hh:66

References G4ReduciblePolygon::Amin(), G4ReduciblePolygon::Area(), G4ReduciblePolygonIterator::Begin(), G4ReduciblePolygon::BisectedBy(), corners, G4ReduciblePolygon::CrossesItself(), DBL_EPSILON, enclosingCylinder, endPhi, G4VCSGfaceted::faces, FatalErrorInArgument, G4endl, G4Exception(), G4ReduciblePolygonIterator::GetA(), G4ReduciblePolygonIterator::GetB(), G4VSolid::GetName(), G4VSolid::kCarTolerance, kInfinity, G4ReduciblePolygonIterator::Next(), numCorner, G4VCSGfaceted::numFace, G4ReduciblePolygon::NumVertices(), phiIsOpen, G4PolyconeSideRZ::r, G4ReduciblePolygon::RemoveDuplicateVertices(), G4ReduciblePolygon::RemoveRedundantVertices(), G4ReduciblePolygon::ReverseOrder(), startPhi, twopi, and G4PolyconeSideRZ::z.

Referenced by G4Polycone(), and Reset().

◆ CreatePolyhedron()

G4Polyhedron * G4Polycone::CreatePolyhedron ( ) const
virtual

Implements G4VCSGfaceted.

Definition at line 951 of file G4Polycone.cc.

952{
953 std::vector<G4TwoVector> rz(numCorner);
954 for (G4int i = 0; i < numCorner; ++i)
955 rz[i].set(corners[i].r, corners[i].z);
956 return new G4PolyhedronPcon(startPhi, endPhi - startPhi, rz);
957}

References corners, endPhi, numCorner, and startPhi.

◆ DeleteStuff()

void G4VCSGfaceted::DeleteStuff ( )
protectedinherited

Definition at line 150 of file G4VCSGfaceted.cc.

151{
152 if (numFace)
153 {
154 G4VCSGface **face = faces;
155 do // Loop checking, 13.08.2015, G.Cosmo
156 {
157 delete *face;
158 } while( ++face < faces + numFace );
159
160 delete [] faces;
161 }
162 delete fpPolyhedron; fpPolyhedron = nullptr;
163}

References G4VCSGfaceted::faces, G4VCSGfaceted::fpPolyhedron, and G4VCSGfaceted::numFace.

Referenced by G4VCSGfaceted::operator=(), Reset(), G4Polyhedra::Reset(), and G4VCSGfaceted::~G4VCSGfaceted().

◆ DescribeYourselfTo()

void G4VCSGfaceted::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtualinherited

Implements G4VSolid.

Definition at line 396 of file G4VCSGfaceted.cc.

397{
398 scene.AddSolid( *this );
399}
virtual void AddSolid(const G4Box &)=0

References G4VGraphicsScene::AddSolid().

◆ DistanceTo()

G4double G4VCSGfaceted::DistanceTo ( const G4ThreeVector p,
const G4bool  outgoing 
) const
protectedvirtualinherited

Definition at line 378 of file G4VCSGfaceted.cc.

380{
381 G4VCSGface **face = faces;
382 G4double best = kInfinity;
383 do // Loop checking, 13.08.2015, G.Cosmo
384 {
385 G4double distance = (*face)->Distance( p, outgoing );
386 if (distance < best) { best = distance; }
387 } while( ++face < faces + numFace );
388
389 return (best < 0.5*kCarTolerance) ? 0. : best;
390}

References G4VCSGfaceted::faces, G4VSolid::kCarTolerance, kInfinity, and G4VCSGfaceted::numFace.

Referenced by G4VCSGfaceted::DistanceToIn(), and G4VCSGfaceted::DistanceToOut().

◆ DistanceToIn() [1/2]

G4double G4Polycone::DistanceToIn ( const G4ThreeVector p) const
virtual

Reimplemented from G4VCSGfaceted.

Definition at line 504 of file G4Polycone.cc.

505{
507}
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const

References G4VCSGfaceted::DistanceToIn().

◆ DistanceToIn() [2/2]

G4double G4Polycone::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const
virtual

Reimplemented from G4VCSGfaceted.

Definition at line 487 of file G4Polycone.cc.

489{
490 //
491 // Quick test
492 //
494 return kInfinity;
495
496 //
497 // Long answer
498 //
499 return G4VCSGfaceted::DistanceToIn( p, v );
500}
G4bool ShouldMiss(const G4ThreeVector &p, const G4ThreeVector &v) const

References G4VCSGfaceted::DistanceToIn(), enclosingCylinder, kInfinity, and G4EnclosingCylinder::ShouldMiss().

◆ DistanceToOut() [1/2]

G4double G4VCSGfaceted::DistanceToOut ( const G4ThreeVector p) const
virtualinherited

Implements G4VSolid.

Definition at line 367 of file G4VCSGfaceted.cc.

368{
369 return DistanceTo( p, true );
370}
virtual G4double DistanceTo(const G4ThreeVector &p, const G4bool outgoing) const

References G4VCSGfaceted::DistanceTo().

◆ DistanceToOut() [2/2]

G4double G4VCSGfaceted::DistanceToOut ( const G4ThreeVector p,
const G4ThreeVector v,
const G4bool  calcNorm = false,
G4bool validNorm = nullptr,
G4ThreeVector n = nullptr 
) const
virtualinherited

Implements G4VSolid.

Definition at line 299 of file G4VCSGfaceted.cc.

304{
305 G4bool allBehind = true;
306 G4double distance = kInfinity;
307 G4double distFromSurface = kInfinity;
309
310 G4VCSGface **face = faces;
311 G4VCSGface *bestFace = *face;
312 do // Loop checking, 13.08.2015, G.Cosmo
313 {
314 G4double faceDistance,
315 faceDistFromSurface;
316 G4ThreeVector faceNormal;
317 G4bool faceAllBehind;
318 if ((*face)->Intersect( p, v, true, kCarTolerance/2,
319 faceDistance, faceDistFromSurface,
320 faceNormal, faceAllBehind ) )
321 {
322 //
323 // Intersecting face
324 //
325 if ( (distance < kInfinity) || (!faceAllBehind) ) { allBehind = false; }
326 if (faceDistance < distance)
327 {
328 distance = faceDistance;
329 distFromSurface = faceDistFromSurface;
330 normal = faceNormal;
331 bestFace = *face;
332 if (distFromSurface <= 0.) { break; }
333 }
334 }
335 } while( ++face < faces + numFace );
336
337 if (distance < kInfinity)
338 {
339 if (distFromSurface <= 0.)
340 {
341 distance = 0.;
342 }
343 else if (distFromSurface<kCarTolerance/2)
344 {
345 if (bestFace->Distance(p,true) < kCarTolerance/2) { distance = 0.; }
346 }
347
348 if (calcNorm)
349 {
350 *validNorm = allBehind;
351 *n = normal;
352 }
353 }
354 else
355 {
356 if (Inside(p) == kSurface) { distance = 0.; }
357 if (calcNorm) { *validNorm = false; }
358 }
359
360 return distance;
361}
virtual G4double Distance(const G4ThreeVector &p, G4bool outgoing)=0
virtual EInside Inside(const G4ThreeVector &p) const
@ kSurface
Definition: geomdefs.hh:69
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:79

References G4VCSGface::Distance(), G4VCSGfaceted::faces, G4VCSGfaceted::Inside(), G4VSolid::kCarTolerance, kInfinity, kSurface, CLHEP::detail::n, CLHEP::normal(), and G4VCSGfaceted::numFace.

◆ DumpInfo()

void G4VSolid::DumpInfo ( ) const
inlineinherited

Referenced by G4Cons::ApproxSurfaceNormal(), G4CutTubs::ApproxSurfaceNormal(), G4Sphere::ApproxSurfaceNormal(), G4Torus::ApproxSurfaceNormal(), G4Tubs::ApproxSurfaceNormal(), G4ReflectedSolid::BoundingLimits(), G4DisplacedSolid::BoundingLimits(), G4IntersectionSolid::BoundingLimits(), G4ScaledSolid::BoundingLimits(), G4SubtractionSolid::BoundingLimits(), G4UnionSolid::BoundingLimits(), G4Box::BoundingLimits(), G4Cons::BoundingLimits(), G4CutTubs::BoundingLimits(), G4Orb::BoundingLimits(), G4Para::BoundingLimits(), G4Sphere::BoundingLimits(), G4Torus::BoundingLimits(), G4Trap::BoundingLimits(), G4Trd::BoundingLimits(), G4Tubs::BoundingLimits(), G4EllipticalCone::BoundingLimits(), G4ExtrudedSolid::BoundingLimits(), G4GenericPolycone::BoundingLimits(), G4GenericTrap::BoundingLimits(), G4Hype::BoundingLimits(), G4Paraboloid::BoundingLimits(), BoundingLimits(), G4Polyhedra::BoundingLimits(), G4TessellatedSolid::BoundingLimits(), G4TwistedTubs::BoundingLimits(), G4ParameterisationBoxX::ComputeDimensions(), G4ParameterisationBoxY::ComputeDimensions(), G4ParameterisationBoxZ::ComputeDimensions(), G4ParameterisationConsRho::ComputeDimensions(), G4ParameterisationConsPhi::ComputeDimensions(), G4ParameterisationConsZ::ComputeDimensions(), G4ParameterisationParaX::ComputeDimensions(), G4ParameterisationParaY::ComputeDimensions(), G4ParameterisationParaZ::ComputeDimensions(), G4ParameterisationPolyconeRho::ComputeDimensions(), G4ParameterisationPolyconePhi::ComputeDimensions(), G4ParameterisationPolyconeZ::ComputeDimensions(), G4ParameterisationPolyhedraRho::ComputeDimensions(), G4ParameterisationPolyhedraPhi::ComputeDimensions(), G4ParameterisationPolyhedraZ::ComputeDimensions(), G4ParameterisationTrdX::ComputeDimensions(), G4ParameterisationTrdY::ComputeDimensions(), G4ParameterisationTrdZ::ComputeDimensions(), G4ParameterisationTubsRho::ComputeDimensions(), G4ParameterisationTubsPhi::ComputeDimensions(), G4ParameterisationTubsZ::ComputeDimensions(), G4ReflectedSolid::ComputeDimensions(), G4DisplacedSolid::ComputeDimensions(), G4ScaledSolid::ComputeDimensions(), G4ParameterisedNavigation::ComputeStep(), G4ReplicaNavigation::ComputeStep(), G4DisplacedSolid::CreatePolyhedron(), G4ScaledSolid::CreatePolyhedron(), G4SubtractionSolid::DistanceToIn(), G4Box::DistanceToOut(), G4Orb::DistanceToOut(), G4Para::DistanceToOut(), G4Trap::DistanceToOut(), G4Trd::DistanceToOut(), G4Paraboloid::DistanceToOut(), G4VTwistedFaceted::DistanceToOut(), G4Cons::DistanceToOut(), G4CutTubs::DistanceToOut(), G4Sphere::DistanceToOut(), G4Torus::DistanceToOut(), G4Tubs::DistanceToOut(), G4Ellipsoid::DistanceToOut(), G4EllipticalCone::DistanceToOut(), G4EllipticalTube::DistanceToOut(), G4GenericTrap::DistanceToOut(), export_G4VSolid(), G4Polycone(), G4Polyhedra::G4Polyhedra(), G4BooleanSolid::GetConstituentSolid(), G4NavigationLogger::PostComputeStepLog(), G4Box::SurfaceNormal(), G4Para::SurfaceNormal(), G4Trap::SurfaceNormal(), G4Trd::SurfaceNormal(), G4Ellipsoid::SurfaceNormal(), G4EllipticalCone::SurfaceNormal(), G4EllipticalTube::SurfaceNormal(), G4ExtrudedSolid::SurfaceNormal(), and G4Tet::SurfaceNormal().

◆ EstimateCubicVolume()

G4double G4VSolid::EstimateCubicVolume ( G4int  nStat,
G4double  epsilon 
) const
inherited

Definition at line 203 of file G4VSolid.cc.

204{
205 G4int iInside=0;
206 G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume,halfepsilon;
208 EInside in;
209
210 // values needed for CalculateExtent signature
211
212 G4VoxelLimits limit; // Unlimited
213 G4AffineTransform origin;
214
215 // min max extents of pSolid along X,Y,Z
216
217 CalculateExtent(kXAxis,limit,origin,minX,maxX);
218 CalculateExtent(kYAxis,limit,origin,minY,maxY);
219 CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
220
221 // limits
222
223 if(nStat < 100) nStat = 100;
224 if(epsilon > 0.01) epsilon = 0.01;
225 halfepsilon = 0.5*epsilon;
226
227 for(auto i = 0; i < nStat; ++i )
228 {
229 px = minX-halfepsilon+(maxX-minX+epsilon)*G4QuickRand();
230 py = minY-halfepsilon+(maxY-minY+epsilon)*G4QuickRand();
231 pz = minZ-halfepsilon+(maxZ-minZ+epsilon)*G4QuickRand();
232 p = G4ThreeVector(px,py,pz);
233 in = Inside(p);
234 if(in != kOutside) ++iInside;
235 }
236 volume = (maxX-minX+epsilon)*(maxY-minY+epsilon)
237 * (maxZ-minZ+epsilon)*iInside/nStat;
238 return volume;
239}
G4double epsilon(G4double density, G4double temperature)
static const G4int maxZ
G4double G4QuickRand()
Definition: G4QuickRand.hh:34
CLHEP::Hep3Vector G4ThreeVector
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
EInside
Definition: geomdefs.hh:67
@ kOutside
Definition: geomdefs.hh:68

References G4VSolid::CalculateExtent(), epsilon(), G4QuickRand(), G4VSolid::Inside(), kOutside, kXAxis, kYAxis, kZAxis, and maxZ.

Referenced by G4VSolid::GetCubicVolume(), G4BooleanSolid::GetCubicVolume(), and G4VCSGfaceted::GetCubicVolume().

◆ EstimateSurfaceArea()

G4double G4VSolid::EstimateSurfaceArea ( G4int  nStat,
G4double  ell 
) const
inherited

Definition at line 265 of file G4VSolid.cc.

266{
267 static const G4double s2 = 1./std::sqrt(2.);
268 static const G4double s3 = 1./std::sqrt(3.);
269 static const G4ThreeVector directions[64] =
270 {
271 G4ThreeVector( 0, 0, 0), G4ThreeVector( -1, 0, 0), // ( , , ) ( -, , )
272 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +, , ) (-+, , )
273 G4ThreeVector( 0, -1, 0), G4ThreeVector(-s2,-s2, 0), // ( , -, ) ( -, -, )
274 G4ThreeVector( s2, -s2, 0), G4ThreeVector( 0, -1, 0), // ( +, -, ) (-+, -, )
275
276 G4ThreeVector( 0, 1, 0), G4ThreeVector( -s2, s2, 0), // ( , +, ) ( -, +, )
277 G4ThreeVector( s2, s2, 0), G4ThreeVector( 0, 1, 0), // ( +, +, ) (-+, +, )
278 G4ThreeVector( 0, -1, 0), G4ThreeVector( -1, 0, 0), // ( ,-+, ) ( -,-+, )
279 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +,-+, ) (-+,-+, )
280
281 G4ThreeVector( 0, 0, -1), G4ThreeVector(-s2, 0,-s2), // ( , , -) ( -, , -)
282 G4ThreeVector( s2, 0,-s2), G4ThreeVector( 0, 0, -1), // ( +, , -) (-+, , -)
283 G4ThreeVector( 0,-s2,-s2), G4ThreeVector(-s3,-s3,-s3), // ( , -, -) ( -, -, -)
284 G4ThreeVector( s3,-s3,-s3), G4ThreeVector( 0,-s2,-s2), // ( +, -, -) (-+, -, -)
285
286 G4ThreeVector( 0, s2,-s2), G4ThreeVector(-s3, s3,-s3), // ( , +, -) ( -, +, -)
287 G4ThreeVector( s3, s3,-s3), G4ThreeVector( 0, s2,-s2), // ( +, +, -) (-+, +, -)
288 G4ThreeVector( 0, 0, -1), G4ThreeVector(-s2, 0,-s2), // ( ,-+, -) ( -,-+, -)
289 G4ThreeVector( s2, 0,-s2), G4ThreeVector( 0, 0, -1), // ( +,-+, -) (-+,-+, -)
290
291 G4ThreeVector( 0, 0, 1), G4ThreeVector(-s2, 0, s2), // ( , , +) ( -, , +)
292 G4ThreeVector( s2, 0, s2), G4ThreeVector( 0, 0, 1), // ( +, , +) (-+, , +)
293 G4ThreeVector( 0,-s2, s2), G4ThreeVector(-s3,-s3, s3), // ( , -, +) ( -, -, +)
294 G4ThreeVector( s3,-s3, s3), G4ThreeVector( 0,-s2, s2), // ( +, -, +) (-+, -, +)
295
296 G4ThreeVector( 0, s2, s2), G4ThreeVector(-s3, s3, s3), // ( , +, +) ( -, +, +)
297 G4ThreeVector( s3, s3, s3), G4ThreeVector( 0, s2, s2), // ( +, +, +) (-+, +, +)
298 G4ThreeVector( 0, 0, 1), G4ThreeVector(-s2, 0, s2), // ( ,-+, +) ( -,-+, +)
299 G4ThreeVector( s2, 0, s2), G4ThreeVector( 0, 0, 1), // ( +,-+, +) (-+,-+, +)
300
301 G4ThreeVector( 0, 0, -1), G4ThreeVector( -1, 0, 0), // ( , ,-+) ( -, ,-+)
302 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +, ,-+) (-+, ,-+)
303 G4ThreeVector( 0, -1, 0), G4ThreeVector(-s2,-s2, 0), // ( , -,-+) ( -, -,-+)
304 G4ThreeVector( s2, -s2, 0), G4ThreeVector( 0, -1, 0), // ( +, -,-+) (-+, -,-+)
305
306 G4ThreeVector( 0, 1, 0), G4ThreeVector( -s2, s2, 0), // ( , +,-+) ( -, +,-+)
307 G4ThreeVector( s2, s2, 0), G4ThreeVector( 0, 1, 0), // ( +, +,-+) (-+, +,-+)
308 G4ThreeVector( 0, -1, 0), G4ThreeVector( -1, 0, 0), // ( ,-+,-+) ( -,-+,-+)
309 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +,-+,-+) (-+,-+,-+)
310 };
311
312 G4ThreeVector bmin, bmax;
313 BoundingLimits(bmin, bmax);
314
315 G4double dX = bmax.x() - bmin.x();
316 G4double dY = bmax.y() - bmin.y();
317 G4double dZ = bmax.z() - bmin.z();
318
319 // Define statistics and shell thickness
320 //
321 G4int npoints = (nstat < 1000) ? 1000 : nstat;
322 G4double coeff = 0.5 / std::cbrt(G4double(npoints));
323 G4double eps = (ell > 0) ? ell : coeff * std::min(std::min(dX, dY), dZ);
324 G4double del = 1.8 * eps; // shold be more than sqrt(3.)
325
326 G4double minX = bmin.x() - eps;
327 G4double minY = bmin.y() - eps;
328 G4double minZ = bmin.z() - eps;
329
330 G4double dd = 2. * eps;
331 dX += dd;
332 dY += dd;
333 dZ += dd;
334
335 // Calculate surface area
336 //
337 G4int icount = 0;
338 for(auto i = 0; i < npoints; ++i)
339 {
340 G4double px = minX + dX*G4QuickRand();
341 G4double py = minY + dY*G4QuickRand();
342 G4double pz = minZ + dZ*G4QuickRand();
343 G4ThreeVector p = G4ThreeVector(px, py, pz);
344 EInside in = Inside(p);
345 G4double dist = 0;
346 if (in == kInside)
347 {
348 if (DistanceToOut(p) >= eps) continue;
349 G4int icase = 0;
350 if (Inside(G4ThreeVector(px-del, py, pz)) != kInside) icase += 1;
351 if (Inside(G4ThreeVector(px+del, py, pz)) != kInside) icase += 2;
352 if (Inside(G4ThreeVector(px, py-del, pz)) != kInside) icase += 4;
353 if (Inside(G4ThreeVector(px, py+del, pz)) != kInside) icase += 8;
354 if (Inside(G4ThreeVector(px, py, pz-del)) != kInside) icase += 16;
355 if (Inside(G4ThreeVector(px, py, pz+del)) != kInside) icase += 32;
356 if (icase == 0) continue;
357 G4ThreeVector v = directions[icase];
358 dist = DistanceToOut(p, v);
359 G4ThreeVector n = SurfaceNormal(p + v*dist);
360 dist *= v.dot(n);
361 }
362 else if (in == kOutside)
363 {
364 if (DistanceToIn(p) >= eps) continue;
365 G4int icase = 0;
366 if (Inside(G4ThreeVector(px-del, py, pz)) != kOutside) icase += 1;
367 if (Inside(G4ThreeVector(px+del, py, pz)) != kOutside) icase += 2;
368 if (Inside(G4ThreeVector(px, py-del, pz)) != kOutside) icase += 4;
369 if (Inside(G4ThreeVector(px, py+del, pz)) != kOutside) icase += 8;
370 if (Inside(G4ThreeVector(px, py, pz-del)) != kOutside) icase += 16;
371 if (Inside(G4ThreeVector(px, py, pz+del)) != kOutside) icase += 32;
372 if (icase == 0) continue;
373 G4ThreeVector v = directions[icase];
374 dist = DistanceToIn(p, v);
375 if (dist == kInfinity) continue;
376 G4ThreeVector n = SurfaceNormal(p + v*dist);
377 dist *= -(v.dot(n));
378 }
379 if (dist < eps) ++icount;
380 }
381 return dX*dY*dZ*icount/npoints/dd;
382}
static const G4double eps
double z() const
double x() const
double y() const
double dot(const Hep3Vector &) const
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:665
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
@ kInside
Definition: geomdefs.hh:70
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

References G4VSolid::BoundingLimits(), G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), CLHEP::Hep3Vector::dot(), eps, G4QuickRand(), G4VSolid::Inside(), kInfinity, kInside, kOutside, G4INCL::Math::min(), CLHEP::detail::n, G4VSolid::SurfaceNormal(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4VSolid::GetSurfaceArea(), G4MultiUnion::GetSurfaceArea(), and G4VCSGfaceted::GetSurfaceArea().

◆ GetAreaAccuracy()

G4double G4VCSGfaceted::GetAreaAccuracy ( ) const
inherited

Definition at line 514 of file G4VCSGfaceted.cc.

515{
516 return fAreaAccuracy;
517}
G4double fAreaAccuracy

References G4VCSGfaceted::fAreaAccuracy.

◆ GetAreaStatistics()

G4int G4VCSGfaceted::GetAreaStatistics ( ) const
inherited

Definition at line 505 of file G4VCSGfaceted.cc.

506{
507 return fStatistics;
508}

References G4VCSGfaceted::fStatistics.

◆ GetConstituentSolid() [1/2]

G4VSolid * G4VSolid::GetConstituentSolid ( G4int  no)
virtualinherited

Reimplemented in G4BooleanSolid.

Definition at line 170 of file G4VSolid.cc.

171{ return nullptr; }

◆ GetConstituentSolid() [2/2]

const G4VSolid * G4VSolid::GetConstituentSolid ( G4int  no) const
virtualinherited

Reimplemented in G4BooleanSolid.

Definition at line 167 of file G4VSolid.cc.

168{ return nullptr; }

Referenced by G4BooleanSolid::StackPolyhedron().

◆ GetCorner()

G4PolyconeSideRZ G4Polycone::GetCorner ( G4int  index) const
inline

◆ GetCosEndPhi()

G4double G4Polycone::GetCosEndPhi ( ) const
inline

Referenced by BoundingLimits(), and CalculateExtent().

◆ GetCosStartPhi()

G4double G4Polycone::GetCosStartPhi ( ) const
inline

Referenced by BoundingLimits(), and CalculateExtent().

◆ GetCubicVolume()

G4double G4Polycone::GetCubicVolume ( )
virtual

Reimplemented from G4VCSGfaceted.

Definition at line 762 of file G4Polycone.cc.

763{
764 if (fCubicVolume == 0.)
765 {
766 G4double total = 0.;
767 G4int nrz = GetNumRZCorner();
768 G4PolyconeSideRZ a = GetCorner(nrz - 1);
769 for (G4int i=0; i<nrz; ++i)
770 {
772 total += (b.r*b.r + b.r*a.r + a.r*a.r)*(b.z - a.z);
773 a = b;
774 }
775 fCubicVolume = std::abs(total)*(GetEndPhi() - GetStartPhi())/6.;
776 }
777 return fCubicVolume;
778}
G4double total(Particle const *const p1, Particle const *const p2)

References G4VCSGfaceted::fCubicVolume, GetCorner(), GetEndPhi(), GetNumRZCorner(), GetStartPhi(), G4PolyconeSideRZ::r, G4INCL::CrossSections::total(), and G4PolyconeSideRZ::z.

◆ GetCubVolEpsilon()

G4double G4VCSGfaceted::GetCubVolEpsilon ( ) const
inherited

Definition at line 476 of file G4VCSGfaceted.cc.

477{
478 return fCubVolEpsilon;
479}
G4double fCubVolEpsilon

References G4VCSGfaceted::fCubVolEpsilon.

◆ GetCubVolStatistics()

G4int G4VCSGfaceted::GetCubVolStatistics ( ) const
inherited

Definition at line 467 of file G4VCSGfaceted.cc.

468{
469 return fStatistics;
470}

References G4VCSGfaceted::fStatistics.

◆ GetDisplacedSolidPtr() [1/2]

G4DisplacedSolid * G4VSolid::GetDisplacedSolidPtr ( )
virtualinherited

Reimplemented in G4DisplacedSolid.

Definition at line 176 of file G4VSolid.cc.

177{ return nullptr; }

◆ GetDisplacedSolidPtr() [2/2]

const G4DisplacedSolid * G4VSolid::GetDisplacedSolidPtr ( ) const
virtualinherited

Reimplemented in G4DisplacedSolid.

Definition at line 173 of file G4VSolid.cc.

174{ return nullptr; }

◆ GetEndPhi()

G4double G4Polycone::GetEndPhi ( ) const
inline

◆ GetEntityType()

G4GeometryType G4Polycone::GetEntityType ( ) const
virtual

Reimplemented from G4VCSGfaceted.

Definition at line 697 of file G4Polycone.cc.

698{
699 return G4String("G4Polycone");
700}

◆ GetExtent()

G4VisExtent G4VCSGfaceted::GetExtent ( ) const
virtualinherited

Reimplemented from G4VSolid.

Definition at line 407 of file G4VCSGfaceted.cc.

408{
409 static const G4ThreeVector xMax(1,0,0), xMin(-1,0,0),
410 yMax(0,1,0), yMin(0,-1,0),
411 zMax(0,0,1), zMin(0,0,-1);
412 static const G4ThreeVector *axes[6] =
413 { &xMin, &xMax, &yMin, &yMax, &zMin, &zMax };
414
415 G4double answers[6] =
417
418 G4VCSGface **face = faces;
419 do // Loop checking, 13.08.2015, G.Cosmo
420 {
421 const G4ThreeVector **axis = axes+5 ;
422 G4double* answer = answers+5;
423 do // Loop checking, 13.08.2015, G.Cosmo
424 {
425 G4double testFace = (*face)->Extent( **axis );
426 if (testFace > *answer) { *answer = testFace; }
427 }
428 while( --axis, --answer >= answers );
429
430 } while( ++face < faces + numFace );
431
432 return G4VisExtent( -answers[0], answers[1],
433 -answers[2], answers[3],
434 -answers[4], answers[5] );
435}

References G4VCSGfaceted::faces, kInfinity, and G4VCSGfaceted::numFace.

◆ GetName()

G4String G4VSolid::GetName ( ) const
inlineinherited

Referenced by G4GMocrenFileSceneHandler::AddDetector(), G4HepRepFileSceneHandler::AddHepRepInstance(), G4GMocrenFileSceneHandler::AddPrimitive(), G4HepRepFileSceneHandler::AddSolid(), G4GMocrenFileSceneHandler::AddSolid(), G4VtkSceneHandler::AddSolid(), G4GDMLWriteSolids::AddSolid(), G4NavigationLogger::AlongComputeStepLog(), G4GDMLWriteSolids::BooleanWrite(), G4ReflectedSolid::BoundingLimits(), G4DisplacedSolid::BoundingLimits(), G4IntersectionSolid::BoundingLimits(), G4ScaledSolid::BoundingLimits(), G4SubtractionSolid::BoundingLimits(), G4UnionSolid::BoundingLimits(), G4Box::BoundingLimits(), G4Cons::BoundingLimits(), G4CutTubs::BoundingLimits(), G4Orb::BoundingLimits(), G4Para::BoundingLimits(), G4Sphere::BoundingLimits(), G4Torus::BoundingLimits(), G4Trap::BoundingLimits(), G4Trd::BoundingLimits(), G4Tubs::BoundingLimits(), G4EllipticalCone::BoundingLimits(), G4ExtrudedSolid::BoundingLimits(), G4GenericPolycone::BoundingLimits(), G4GenericTrap::BoundingLimits(), G4Hype::BoundingLimits(), G4Paraboloid::BoundingLimits(), BoundingLimits(), G4Polyhedra::BoundingLimits(), G4TessellatedSolid::BoundingLimits(), G4TwistedTubs::BoundingLimits(), G4GDMLWriteSolids::BoxWrite(), G4ExtrudedSolid::CalculateExtent(), G4GenericPolycone::CalculateExtent(), CalculateExtent(), G4Polyhedra::CalculateExtent(), G4NavigationLogger::CheckDaughterEntryPoint(), G4VDivisionParameterisation::CheckNDivAndWidth(), G4VDivisionParameterisation::CheckOffset(), G4GenericTrap::CheckOrder(), G4Para::CheckParameters(), G4Trap::CheckParameters(), G4Trd::CheckParameters(), G4Ellipsoid::CheckParameters(), G4EllipticalTube::CheckParameters(), G4ParameterisationPolyconeRho::CheckParametersValidity(), G4ParameterisationPolyconeZ::CheckParametersValidity(), G4ParameterisationPolyhedraRho::CheckParametersValidity(), G4ParameterisationPolyhedraPhi::CheckParametersValidity(), G4ParameterisationPolyhedraZ::CheckParametersValidity(), G4PhantomParameterisation::CheckVoxelsFillContainer(), G4GenericTrap::ComputeIsTwisted(), G4VoxelNavigation::ComputeSafety(), G4VoxelSafety::ComputeSafety(), G4NavigationLogger::ComputeSafetyLog(), G4ParameterisedNavigation::ComputeStep(), G4ReplicaNavigation::ComputeStep(), G4GDMLWriteSolids::ConeWrite(), G4Polyhedra::Create(), G4GenericPolycone::Create(), Create(), G4PhysicalVolumeModel::CreateCurrentAttValues(), G4ReflectedSolid::CreatePolyhedron(), G4ReflectionFactory::CreateReflectedLV(), G4GenericTrap::CreateTessellatedSolid(), G4GDMLWriteSolids::CutTubeWrite(), G4SolidStore::DeRegister(), G4PhysicalVolumeModel::DescribeSolid(), G4SubtractionSolid::DistanceToIn(), G4Paraboloid::DistanceToIn(), G4TessellatedSolid::DistanceToIn(), G4Box::DistanceToOut(), G4Orb::DistanceToOut(), G4Para::DistanceToOut(), G4Trap::DistanceToOut(), G4Trd::DistanceToOut(), G4EllipticalCone::DistanceToOut(), G4TessellatedSolid::DistanceToOut(), G4Ellipsoid::DistanceToOut(), G4EllipticalTube::DistanceToOut(), G4tgbGeometryDumper::DumpMultiUnionVolume(), G4tgbGeometryDumper::DumpScaledVolume(), G4tgbGeometryDumper::DumpSolid(), G4GDMLWriteSolids::ElconeWrite(), G4GDMLWriteSolids::EllipsoidWrite(), G4GDMLWriteSolids::EltubeWrite(), G4PVDivision::ErrorInAxis(), G4ReplicatedSlice::ErrorInAxis(), export_G4VSolid(), G4Box::G4Box(), G4Cons::G4Cons(), G4CutTubs::G4CutTubs(), G4EllipticalCone::G4EllipticalCone(), G4Hype::G4Hype(), G4Para::G4Para(), G4Paraboloid::G4Paraboloid(), G4Polycone(), G4Polyhedra::G4Polyhedra(), G4Sphere::G4Sphere(), G4Tet::G4Tet(), G4Trap::G4Trap(), G4Tubs::G4Tubs(), G4VParameterisationCons::G4VParameterisationCons(), G4VParameterisationPara::G4VParameterisationPara(), G4VParameterisationPolycone::G4VParameterisationPolycone(), G4VParameterisationPolyhedra::G4VParameterisationPolyhedra(), G4VParameterisationTrd::G4VParameterisationTrd(), G4VTwistedFaceted::G4VTwistedFaceted(), G4GDMLWriteSolids::GenericPolyconeWrite(), G4GDMLWriteSolids::GenTrapWrite(), G4Navigator::GetGlobalExitNormal(), G4Navigator::GetLocalExitNormal(), G4ITNavigator1::GetLocalExitNormal(), G4ITNavigator2::GetLocalExitNormal(), G4BooleanSolid::GetPointOnSurface(), G4PhantomParameterisation::GetReplicaNo(), G4GDMLWriteSolids::HypeWrite(), G4TessellatedSolid::InsideNoVoxels(), G4TessellatedSolid::InsideVoxels(), G4ITNavigator1::LocateGlobalPointAndSetup(), G4ITNavigator2::LocateGlobalPointAndSetup(), G4Navigator::LocateGlobalPointAndSetup(), G4GenericTrap::MakeDownFacet(), G4Trap::MakePlanes(), G4GenericTrap::MakeUpFacet(), G4GDMLWriteSolids::MultiUnionWrite(), G4GDMLWriteSolids::OrbWrite(), G4GDMLWriteSolids::ParaboloidWrite(), G4GDMLWriteParamvol::ParametersWrite(), G4GDMLWriteSolids::ParaWrite(), G4GDMLWriteSolids::PolyconeWrite(), G4GDMLWriteSolids::PolyhedraWrite(), G4NavigationLogger::PostComputeStepLog(), G4NavigationLogger::PreComputeStepLog(), G4NavigationLogger::PrintDaughterLog(), G4PseudoScene::ProcessVolume(), G4SolidStore::Register(), G4tgbVolumeMgr::RegisterMe(), G4NavigationLogger::ReportOutsideMother(), G4ASCIITreeSceneHandler::RequestPrimitives(), G4VSceneHandler::RequestPrimitives(), G4GenericPolycone::Reset(), G4Polyhedra::Reset(), G4VoxelSafety::SafetyForVoxelNode(), G4GDMLWriteSolids::ScaledWrite(), G4Torus::SetAllParameters(), G4Tet::SetBoundingLimits(), SetOriginalParameters(), G4Polyhedra::SetOriginalParameters(), G4TessellatedSolid::SetSolidClosed(), G4Tet::SetVertices(), G4Box::SetXHalfLength(), G4Box::SetYHalfLength(), G4Box::SetZHalfLength(), G4GDMLWriteSolids::SphereWrite(), G4BooleanSolid::StackPolyhedron(), G4ReflectedSolid::StreamInfo(), G4BooleanSolid::StreamInfo(), G4DisplacedSolid::StreamInfo(), G4MultiUnion::StreamInfo(), G4ScaledSolid::StreamInfo(), G4Box::StreamInfo(), G4Cons::StreamInfo(), G4CSGSolid::StreamInfo(), G4CutTubs::StreamInfo(), G4Orb::StreamInfo(), G4Para::StreamInfo(), G4Sphere::StreamInfo(), G4Torus::StreamInfo(), G4Trap::StreamInfo(), G4Trd::StreamInfo(), G4Tubs::StreamInfo(), G4Ellipsoid::StreamInfo(), G4EllipticalCone::StreamInfo(), G4EllipticalTube::StreamInfo(), G4ExtrudedSolid::StreamInfo(), G4GenericPolycone::StreamInfo(), G4GenericTrap::StreamInfo(), G4Hype::StreamInfo(), G4Paraboloid::StreamInfo(), StreamInfo(), G4Polyhedra::StreamInfo(), G4TessellatedSolid::StreamInfo(), G4Tet::StreamInfo(), G4TwistedBox::StreamInfo(), G4TwistedTrap::StreamInfo(), G4TwistedTrd::StreamInfo(), G4TwistedTubs::StreamInfo(), G4VCSGfaceted::StreamInfo(), G4VTwistedFaceted::StreamInfo(), G4GDMLRead::StripNames(), SubstractSolids(), G4UnionSolid::SurfaceNormal(), G4Box::SurfaceNormal(), G4Para::SurfaceNormal(), G4Trap::SurfaceNormal(), G4Trd::SurfaceNormal(), G4Ellipsoid::SurfaceNormal(), G4EllipticalCone::SurfaceNormal(), G4EllipticalTube::SurfaceNormal(), G4ExtrudedSolid::SurfaceNormal(), G4Tet::SurfaceNormal(), G4GDMLWriteSolids::TessellatedWrite(), G4GDMLWriteSolids::TetWrite(), G4GDMLWriteSolids::TorusWrite(), G4GDMLWriteSolids::TrapWrite(), G4GDMLWriteStructure::TraverseVolumeTree(), G4GDMLWriteSolids::TrdWrite(), G4GDMLWriteSolids::TubeWrite(), G4GDMLWriteSolids::TwistedboxWrite(), G4GDMLWriteSolids::TwistedtrapWrite(), G4GDMLWriteSolids::TwistedtrdWrite(), G4GDMLWriteSolids::TwistedtubsWrite(), G4PhysicalVolumeModel::VisitGeometryAndGetVisReps(), and G4GDMLWriteSolids::XtruWrite().

◆ GetNumRZCorner()

G4int G4Polycone::GetNumRZCorner ( ) const
inline

◆ GetOriginalParameters()

G4PolyconeHistorical * G4Polycone::GetOriginalParameters ( ) const
inline

◆ GetPointOnSurface()

G4ThreeVector G4Polycone::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 886 of file G4Polycone.cc.

887{
888 // Set surface elements
889 if (!fElements)
890 {
893 l.unlock();
894 }
895
896 // Select surface element
898 selem = fElements->back();
899 G4double select = selem.area*G4QuickRand();
900 auto it = std::lower_bound(fElements->begin(), fElements->end(), select,
901 [](const G4Polycone::surface_element& x, G4double val)
902 -> G4bool { return x.area < val; });
903
904 // Generate random point
905 G4double r = 0, z = 0, phi = 0;
906 G4double u = G4QuickRand();
907 G4double v = G4QuickRand();
908 G4int i0 = (*it).i0;
909 G4int i1 = (*it).i1;
910 G4int i2 = (*it).i2;
911 if (i2 < 0) // lateral surface
912 {
915 if (p1.r < p0.r)
916 {
917 p0 = GetCorner(i1);
918 p1 = GetCorner(i0);
919 }
920 if (p1.r - p0.r < kCarTolerance) // cylindrical surface
921 {
922 r = (p1.r - p0.r)*u + p0.r;
923 z = (p1.z - p0.z)*u + p0.z;
924 }
925 else // conical surface
926 {
927 r = std::sqrt(p1.r*p1.r*u + p0.r*p0.r*(1. - u));
928 z = p0.z + (p1.z - p0.z)*(r - p0.r)/(p1.r - p0.r);
929 }
930 phi = (GetEndPhi() - GetStartPhi())*v + GetStartPhi();
931 }
932 else // phi cut
933 {
934 G4int nrz = GetNumRZCorner();
935 phi = (i0 < nrz) ? GetStartPhi() : GetEndPhi();
936 if (i0 >= nrz) { i0 -= nrz; }
940 if (u + v > 1.) { u = 1. - u; v = 1. - v; }
941 r = (p1.r - p0.r)*u + (p2.r - p0.r)*v + p0.r;
942 z = (p1.z - p0.z)*u + (p2.z - p0.z)*v + p0.z;
943 }
944 return G4ThreeVector(r*std::cos(phi), r*std::sin(phi), z);
945}
void SetSurfaceElements() const
Definition: G4Polycone.cc:823

References G4Polycone::surface_element::area, fElements, G4QuickRand(), GetCorner(), GetEndPhi(), GetNumRZCorner(), GetStartPhi(), G4VSolid::kCarTolerance, G4PolyconeSideRZ::r, SetSurfaceElements(), anonymous_namespace{G4Polycone.cc}::surface_elementsMutex, G4TemplateAutoLock< _Mutex_t >::unlock(), and G4PolyconeSideRZ::z.

◆ GetPointOnSurfaceGeneric()

G4ThreeVector G4VCSGfaceted::GetPointOnSurfaceGeneric ( ) const
protectedinherited

Definition at line 586 of file G4VCSGfaceted.cc.

587{
588 // Preparing variables
589 //
590 G4ThreeVector answer=G4ThreeVector(0.,0.,0.);
591 G4VCSGface **face = faces;
592 G4double area = 0.;
593 G4int i;
594 std::vector<G4double> areas;
595
596 // First step: calculate surface areas
597 //
598 do // Loop checking, 13.08.2015, G.Cosmo
599 {
600 G4double result = (*face)->SurfaceArea( );
601 areas.push_back(result);
602 area=area+result;
603 } while( ++face < faces + numFace );
604
605 // Second Step: choose randomly one surface
606 //
607 G4VCSGface **face1 = faces;
608 G4double chose = area*G4UniformRand();
609 G4double Achose1, Achose2;
610 Achose1=0.; Achose2=0.;
611 i=0;
612
613 do
614 {
615 Achose2+=areas[i];
616 if(chose>=Achose1 && chose<Achose2)
617 {
618 G4ThreeVector point;
619 point= (*face1)->GetPointOnFace();
620 return point;
621 }
622 ++i;
623 Achose1=Achose2;
624 } while( ++face1 < faces + numFace );
625
626 return answer;
627}
#define G4UniformRand()
Definition: Randomize.hh:52
virtual G4double SurfaceArea()=0

References G4VCSGfaceted::faces, G4UniformRand, G4VCSGfaceted::numFace, and G4VCSGface::SurfaceArea().

◆ GetPolyhedron()

G4Polyhedron * G4VCSGfaceted::GetPolyhedron ( ) const
virtualinherited

◆ GetSinEndPhi()

G4double G4Polycone::GetSinEndPhi ( ) const
inline

Referenced by BoundingLimits(), and CalculateExtent().

◆ GetSinStartPhi()

G4double G4Polycone::GetSinStartPhi ( ) const
inline

Referenced by BoundingLimits(), and CalculateExtent().

◆ GetStartPhi()

G4double G4Polycone::GetStartPhi ( ) const
inline

◆ GetSurfaceArea()

G4double G4Polycone::GetSurfaceArea ( )
virtual

Reimplemented from G4VCSGfaceted.

Definition at line 784 of file G4Polycone.cc.

785{
786 if (fSurfaceArea == 0.)
787 {
788 // phi cut area
789 G4int nrz = GetNumRZCorner();
790 G4double scut = 0.;
791 if (IsOpen())
792 {
793 G4PolyconeSideRZ a = GetCorner(nrz - 1);
794 for (G4int i=0; i<nrz; ++i)
795 {
797 scut += a.r*b.z - a.z*b.r;
798 a = b;
799 }
800 scut = std::abs(scut);
801 }
802 // lateral surface area
803 G4double slat = 0;
804 G4PolyconeSideRZ a = GetCorner(nrz - 1);
805 for (G4int i=0; i<nrz; ++i)
806 {
808 G4double h = std::sqrt((b.r - a.r)*(b.r - a.r) + (b.z - a.z)*(b.z - a.z));
809 slat += (b.r + a.r)*h;
810 a = b;
811 }
812 slat *= (GetEndPhi() - GetStartPhi())/2.;
813 fSurfaceArea = scut + slat;
814 }
815 return fSurfaceArea;
816}

References G4VCSGfaceted::fSurfaceArea, GetCorner(), GetEndPhi(), GetNumRZCorner(), GetStartPhi(), IsOpen(), G4PolyconeSideRZ::r, and G4PolyconeSideRZ::z.

◆ GetTolerance()

G4double G4VSolid::GetTolerance ( ) const
inlineinherited

◆ Inside()

EInside G4Polycone::Inside ( const G4ThreeVector p) const
virtual

Reimplemented from G4VCSGfaceted.

Definition at line 469 of file G4Polycone.cc.

470{
471 //
472 // Quick test
473 //
475
476 //
477 // Long answer
478 //
479 return G4VCSGfaceted::Inside(p);
480}
G4bool MustBeOutside(const G4ThreeVector &p) const

References enclosingCylinder, G4VCSGfaceted::Inside(), kOutside, and G4EnclosingCylinder::MustBeOutside().

◆ IsOpen()

G4bool G4Polycone::IsOpen ( ) const
inline

◆ operator=()

G4Polycone & G4Polycone::operator= ( const G4Polycone source)

Definition at line 366 of file G4Polycone.cc.

367{
368 if (this == &source) return *this;
369
371
372 delete [] corners;
374
375 delete enclosingCylinder;
376
377 CopyStuff( source );
378
379 return *this;
380}
G4VCSGfaceted & operator=(const G4VCSGfaceted &source)

References CopyStuff(), corners, enclosingCylinder, G4VCSGfaceted::operator=(), and original_parameters.

◆ operator==()

G4bool G4VSolid::operator== ( const G4VSolid s) const
inlineinherited

◆ Reset()

G4bool G4Polycone::Reset ( )

◆ SetAreaAccuracy()

void G4VCSGfaceted::SetAreaAccuracy ( G4double  ep)
inherited

Definition at line 533 of file G4VCSGfaceted.cc.

534{
535 fSurfaceArea=0.;
536 fAreaAccuracy=ep;
537}

References G4VCSGfaceted::fAreaAccuracy, and G4VCSGfaceted::fSurfaceArea.

◆ SetAreaStatistics()

void G4VCSGfaceted::SetAreaStatistics ( G4int  st)
inherited

Definition at line 523 of file G4VCSGfaceted.cc.

524{
525 fSurfaceArea=0.;
526 fStatistics=st;
527}

References G4VCSGfaceted::fStatistics, and G4VCSGfaceted::fSurfaceArea.

◆ SetCubVolEpsilon()

void G4VCSGfaceted::SetCubVolEpsilon ( G4double  ep)
inherited

Definition at line 495 of file G4VCSGfaceted.cc.

496{
497 fCubicVolume=0.;
499}

References G4VCSGfaceted::fCubicVolume, and G4VCSGfaceted::fCubVolEpsilon.

◆ SetCubVolStatistics()

void G4VCSGfaceted::SetCubVolStatistics ( G4int  st)
inherited

Definition at line 485 of file G4VCSGfaceted.cc.

486{
487 fCubicVolume=0.;
488 fStatistics=st;
489}

References G4VCSGfaceted::fCubicVolume, and G4VCSGfaceted::fStatistics.

◆ SetName()

void G4VSolid::SetName ( const G4String name)
inherited

◆ SetOriginalParameters() [1/2]

void G4Polycone::SetOriginalParameters ( G4PolyconeHistorical pars)
inline

◆ SetOriginalParameters() [2/2]

G4bool G4Polycone::SetOriginalParameters ( G4ReduciblePolygon rz)
protected

Definition at line 961 of file G4Polycone.cc.

962{
963 G4int numPlanes = numCorner;
964 G4bool isConvertible = true;
965 G4double Zmax=rz->Bmax();
966 rz->StartWithZMin();
967
968 // Prepare vectors for storage
969 //
970 std::vector<G4double> Z;
971 std::vector<G4double> Rmin;
972 std::vector<G4double> Rmax;
973
974 G4int countPlanes=1;
975 G4int icurr=0;
976 G4int icurl=0;
977
978 // first plane Z=Z[0]
979 //
980 Z.push_back(corners[0].z);
981 G4double Zprev=Z[0];
982 if (Zprev == corners[1].z)
983 {
984 Rmin.push_back(corners[0].r);
985 Rmax.push_back (corners[1].r);icurr=1;
986 }
987 else if (Zprev == corners[numPlanes-1].z)
988 {
989 Rmin.push_back(corners[numPlanes-1].r);
990 Rmax.push_back (corners[0].r);
991 icurl=numPlanes-1;
992 }
993 else
994 {
995 Rmin.push_back(corners[0].r);
996 Rmax.push_back (corners[0].r);
997 }
998
999 // next planes until last
1000 //
1001 G4int inextr=0, inextl=0;
1002 for (G4int i=0; i < numPlanes-2; ++i)
1003 {
1004 inextr=1+icurr;
1005 inextl=(icurl <= 0)? numPlanes-1 : icurl-1;
1006
1007 if((corners[inextr].z >= Zmax) & (corners[inextl].z >= Zmax)) { break; }
1008
1009 G4double Zleft = corners[inextl].z;
1010 G4double Zright = corners[inextr].z;
1011 if(Zright > Zleft) // Next plane will be Zleft
1012 {
1013 Z.push_back(Zleft);
1014 countPlanes++;
1015 G4double difZr=corners[inextr].z - corners[icurr].z;
1016 G4double difZl=corners[inextl].z - corners[icurl].z;
1017
1018 if(std::fabs(difZl) < kCarTolerance)
1019 {
1020 if(std::fabs(difZr) < kCarTolerance)
1021 {
1022 Rmin.push_back(corners[inextl].r);
1023 Rmax.push_back(corners[icurr].r);
1024 }
1025 else
1026 {
1027 Rmin.push_back(corners[inextl].r);
1028 Rmax.push_back(corners[icurr].r + (Zleft-corners[icurr].z)/difZr
1029 *(corners[inextr].r - corners[icurr].r));
1030 }
1031 }
1032 else if (difZl >= kCarTolerance)
1033 {
1034 if(std::fabs(difZr) < kCarTolerance)
1035 {
1036 Rmin.push_back(corners[icurl].r);
1037 Rmax.push_back(corners[icurr].r);
1038 }
1039 else
1040 {
1041 Rmin.push_back(corners[icurl].r);
1042 Rmax.push_back(corners[icurr].r + (Zleft-corners[icurr].z)/difZr
1043 *(corners[inextr].r - corners[icurr].r));
1044 }
1045 }
1046 else
1047 {
1048 isConvertible=false; break;
1049 }
1050 icurl=(icurl == 0)? numPlanes-1 : icurl-1;
1051 }
1052 else if(std::fabs(Zright-Zleft)<kCarTolerance) // Zright=Zleft
1053 {
1054 Z.push_back(Zleft);
1055 ++countPlanes;
1056 ++icurr;
1057
1058 icurl=(icurl == 0)? numPlanes-1 : icurl-1;
1059
1060 Rmin.push_back(corners[inextl].r);
1061 Rmax.push_back(corners[inextr].r);
1062 }
1063 else // Zright<Zleft
1064 {
1065 Z.push_back(Zright);
1066 ++countPlanes;
1067
1068 G4double difZr=corners[inextr].z - corners[icurr].z;
1069 G4double difZl=corners[inextl].z - corners[icurl].z;
1070 if(std::fabs(difZr) < kCarTolerance)
1071 {
1072 if(std::fabs(difZl) < kCarTolerance)
1073 {
1074 Rmax.push_back(corners[inextr].r);
1075 Rmin.push_back(corners[icurr].r);
1076 }
1077 else
1078 {
1079 Rmin.push_back(corners[icurl].r + (Zright-corners[icurl].z)/difZl
1080 *(corners[inextl].r - corners[icurl].r));
1081 Rmax.push_back(corners[inextr].r);
1082 }
1083 ++icurr;
1084 } // plate
1085 else if (difZr >= kCarTolerance)
1086 {
1087 if(std::fabs(difZl) < kCarTolerance)
1088 {
1089 Rmax.push_back(corners[inextr].r);
1090 Rmin.push_back (corners[icurr].r);
1091 }
1092 else
1093 {
1094 Rmax.push_back(corners[inextr].r);
1095 Rmin.push_back (corners[icurl].r+(Zright-corners[icurl].z)/difZl
1096 * (corners[inextl].r - corners[icurl].r));
1097 }
1098 ++icurr;
1099 }
1100 else
1101 {
1102 isConvertible=false; break;
1103 }
1104 }
1105 } // end for loop
1106
1107 // last plane Z=Zmax
1108 //
1109 Z.push_back(Zmax);
1110 ++countPlanes;
1111 inextr=1+icurr;
1112 inextl=(icurl <= 0)? numPlanes-1 : icurl-1;
1113
1114 Rmax.push_back(corners[inextr].r);
1115 Rmin.push_back(corners[inextl].r);
1116
1117 // Set original parameters Rmin,Rmax,Z
1118 //
1119 if(isConvertible)
1120 {
1122 original_parameters->Z_values = new G4double[countPlanes];
1123 original_parameters->Rmin = new G4double[countPlanes];
1124 original_parameters->Rmax = new G4double[countPlanes];
1125
1126 for(G4int j=0; j < countPlanes; ++j)
1127 {
1129 original_parameters->Rmax[j] = Rmax[j];
1130 original_parameters->Rmin[j] = Rmin[j];
1131 }
1134 original_parameters->Num_z_planes = countPlanes;
1135
1136 }
1137 else // Set parameters(r,z) with Rmin==0 as convention
1138 {
1139#ifdef G4SPECSDEBUG
1140 std::ostringstream message;
1141 message << "Polycone " << GetName() << G4endl
1142 << "cannot be converted to Polycone with (Rmin,Rmaz,Z) parameters!";
1143 G4Exception("G4Polycone::SetOriginalParameters()", "GeomSolids0002",
1144 JustWarning, message);
1145#endif
1147 original_parameters->Z_values = new G4double[numPlanes];
1148 original_parameters->Rmin = new G4double[numPlanes];
1149 original_parameters->Rmax = new G4double[numPlanes];
1150
1151 for(G4int j=0; j < numPlanes; ++j)
1152 {
1155 original_parameters->Rmin[j] = 0.0;
1156 }
1159 original_parameters->Num_z_planes = numPlanes;
1160 }
1161 return isConvertible;
1162}
const G4int Z[17]
G4double Bmax() const

References G4ReduciblePolygon::Bmax(), corners, endPhi, G4endl, G4Exception(), G4VSolid::GetName(), JustWarning, G4VSolid::kCarTolerance, G4PolyconeHistorical::Num_z_planes, numCorner, G4PolyconeHistorical::Opening_angle, original_parameters, G4PolyconeSideRZ::r, G4PolyconeHistorical::Rmax, G4PolyconeHistorical::Rmin, G4PolyconeHistorical::Start_angle, startPhi, G4ReduciblePolygon::StartWithZMin(), G4PolyconeSideRZ::z, Z, and G4PolyconeHistorical::Z_values.

◆ SetSurfaceElements()

void G4Polycone::SetSurfaceElements ( ) const
protected

Definition at line 823 of file G4Polycone.cc.

824{
825 fElements = new std::vector<G4Polycone::surface_element>;
826 G4double total = 0.;
827 G4int nrz = GetNumRZCorner();
828
829 // set lateral surface elements
830 G4double dphi = GetEndPhi() - GetStartPhi();
831 G4int ia = nrz - 1;
832 for (G4int ib=0; ib<nrz; ++ib)
833 {
837 selem.i0 = ia;
838 selem.i1 = ib;
839 selem.i2 = -1;
840 ia = ib;
841 if (a.r == 0. && b.r == 0.) continue;
842 G4double h = std::sqrt((b.r - a.r)*(b.r - a.r) + (b.z - a.z)*(b.z - a.z));
843 total += 0.5*dphi*(b.r + a.r)*h;
844 selem.area = total;
845 fElements->push_back(selem);
846 }
847
848 // set elements for phi cuts
849 if (IsOpen())
850 {
851 G4TwoVectorList contourRZ;
852 std::vector<G4int> triangles;
853 for (G4int i=0; i<nrz; ++i)
854 {
855 G4PolyconeSideRZ corner = GetCorner(i);
856 contourRZ.push_back(G4TwoVector(corner.r, corner.z));
857 }
858 G4GeomTools::TriangulatePolygon(contourRZ, triangles);
859 G4int ntria = triangles.size();
860 for (G4int i=0; i<ntria; i+=3)
861 {
863 selem.i0 = triangles[i];
864 selem.i1 = triangles[i+1];
865 selem.i2 = triangles[i+2];
866 G4PolyconeSideRZ a = GetCorner(selem.i0);
867 G4PolyconeSideRZ b = GetCorner(selem.i1);
868 G4PolyconeSideRZ c = GetCorner(selem.i2);
869 G4double stria =
870 std::abs(G4GeomTools::TriangleArea(a.r, a.z, b.r, b.z, c.r, c.z));
871 total += stria;
872 selem.area = total;
873 fElements->push_back(selem); // start phi
874 total += stria;
875 selem.area = total;
876 selem.i0 += nrz;
877 fElements->push_back(selem); // end phi
878 }
879 }
880}
static G4double TriangleArea(G4double Ax, G4double Ay, G4double Bx, G4double By, G4double Cx, G4double Cy)
Definition: G4GeomTools.cc:41

References G4Polycone::surface_element::area, fElements, GetCorner(), GetEndPhi(), GetNumRZCorner(), GetStartPhi(), G4Polycone::surface_element::i0, G4Polycone::surface_element::i1, G4Polycone::surface_element::i2, IsOpen(), G4PolyconeSideRZ::r, G4INCL::CrossSections::total(), G4GeomTools::TriangleArea(), G4GeomTools::TriangulatePolygon(), and G4PolyconeSideRZ::z.

Referenced by GetPointOnSurface().

◆ StreamInfo()

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

Reimplemented from G4VCSGfaceted.

Definition at line 712 of file G4Polycone.cc.

713{
714 G4int oldprc = os.precision(16);
715 os << "-----------------------------------------------------------\n"
716 << " *** Dump for solid - " << GetName() << " ***\n"
717 << " ===================================================\n"
718 << " Solid type: G4Polycone\n"
719 << " Parameters: \n"
720 << " starting phi angle : " << startPhi/degree << " degrees \n"
721 << " ending phi angle : " << endPhi/degree << " degrees \n";
722 G4int i=0;
723
725 os << " number of Z planes: " << numPlanes << "\n"
726 << " Z values: \n";
727 for (i=0; i<numPlanes; ++i)
728 {
729 os << " Z plane " << i << ": "
730 << original_parameters->Z_values[i] << "\n";
731 }
732 os << " Tangent distances to inner surface (Rmin): \n";
733 for (i=0; i<numPlanes; ++i)
734 {
735 os << " Z plane " << i << ": "
736 << original_parameters->Rmin[i] << "\n";
737 }
738 os << " Tangent distances to outer surface (Rmax): \n";
739 for (i=0; i<numPlanes; ++i)
740 {
741 os << " Z plane " << i << ": "
742 << original_parameters->Rmax[i] << "\n";
743 }
744
745 os << " number of RZ points: " << numCorner << "\n"
746 << " RZ values (corners): \n";
747 for (i=0; i<numCorner; ++i)
748 {
749 os << " "
750 << corners[i].r << ", " << corners[i].z << "\n";
751 }
752 os << "-----------------------------------------------------------\n";
753 os.precision(oldprc);
754
755 return os;
756}
static constexpr double degree
Definition: G4SIunits.hh:124

References corners, degree, endPhi, G4VSolid::GetName(), G4PolyconeHistorical::Num_z_planes, numCorner, original_parameters, G4PolyconeSideRZ::r, G4PolyconeHistorical::Rmax, G4PolyconeHistorical::Rmin, startPhi, G4PolyconeSideRZ::z, and G4PolyconeHistorical::Z_values.

◆ SurfaceNormal()

G4ThreeVector G4VCSGfaceted::SurfaceNormal ( const G4ThreeVector p) const
virtualinherited

Implements G4VSolid.

Definition at line 225 of file G4VCSGfaceted.cc.

226{
227 G4ThreeVector answer;
228 G4VCSGface **face = faces;
229 G4double best = kInfinity;
230 do // Loop checking, 13.08.2015, G.Cosmo
231 {
232 G4double distance;
233 G4ThreeVector normal = (*face)->Normal( p, &distance );
234 if (distance < best)
235 {
236 best = distance;
237 answer = normal;
238 }
239 } while( ++face < faces + numFace );
240
241 return answer;
242}

References G4VCSGfaceted::faces, kInfinity, CLHEP::normal(), and G4VCSGfaceted::numFace.

Field Documentation

◆ corners

G4PolyconeSideRZ* G4Polycone::corners = nullptr
protected

◆ enclosingCylinder

G4EnclosingCylinder* G4Polycone::enclosingCylinder = nullptr
protected

Definition at line 180 of file G4Polycone.hh.

Referenced by CopyStuff(), Create(), DistanceToIn(), Inside(), operator=(), Reset(), and ~G4Polycone().

◆ endPhi

G4double G4Polycone::endPhi
protected

Definition at line 174 of file G4Polycone.hh.

Referenced by CopyStuff(), Create(), CreatePolyhedron(), SetOriginalParameters(), and StreamInfo().

◆ faces

G4VCSGface** G4VCSGfaceted::faces = nullptr
protectedinherited

◆ fAreaAccuracy

G4double G4VCSGfaceted::fAreaAccuracy
privateinherited

◆ fCubicVolume

G4double G4VCSGfaceted::fCubicVolume = 0.0
protectedinherited

◆ fCubVolEpsilon

G4double G4VCSGfaceted::fCubVolEpsilon
privateinherited

◆ fElements

std::vector<surface_element>* G4Polycone::fElements = nullptr
mutableprotected

Definition at line 183 of file G4Polycone.hh.

Referenced by CopyStuff(), GetPointOnSurface(), Reset(), SetSurfaceElements(), and ~G4Polycone().

◆ fpPolyhedron

G4Polyhedron* G4VCSGfaceted::fpPolyhedron = nullptr
mutableprotectedinherited

◆ fRebuildPolyhedron

G4bool G4VCSGfaceted::fRebuildPolyhedron = false
mutableprotectedinherited

◆ fshapeName

G4String G4VSolid::fshapeName
privateinherited

Definition at line 312 of file G4VSolid.hh.

Referenced by G4VSolid::operator=(), and G4VSolid::SetName().

◆ fStatistics

G4int G4VCSGfaceted::fStatistics
privateinherited

◆ fSurfaceArea

G4double G4VCSGfaceted::fSurfaceArea = 0.0
protectedinherited

◆ kCarTolerance

G4double G4VSolid::kCarTolerance
protectedinherited

Definition at line 299 of file G4VSolid.hh.

Referenced by G4TessellatedSolid::AddFacet(), CalculateExtent(), G4Polyhedra::CalculateExtent(), G4Tet::CheckDegeneracy(), G4Para::CheckParameters(), G4Trd::CheckParameters(), G4Ellipsoid::CheckParameters(), G4EllipticalTube::CheckParameters(), G4GenericTrap::ComputeIsTwisted(), G4Polyhedra::Create(), G4GenericPolycone::Create(), Create(), G4CutTubs::CreatePolyhedron(), G4TessellatedSolid::CreateVertexList(), G4VCSGfaceted::DistanceTo(), G4Sphere::DistanceToIn(), G4Ellipsoid::DistanceToIn(), G4Hype::DistanceToIn(), G4Paraboloid::DistanceToIn(), G4VCSGfaceted::DistanceToIn(), G4TessellatedSolid::DistanceToInCore(), G4Cons::DistanceToOut(), G4CutTubs::DistanceToOut(), G4Sphere::DistanceToOut(), G4Torus::DistanceToOut(), G4Tubs::DistanceToOut(), G4GenericTrap::DistanceToOut(), G4Hype::DistanceToOut(), G4Paraboloid::DistanceToOut(), G4VCSGfaceted::DistanceToOut(), G4TessellatedSolid::DistanceToOutCandidates(), G4TessellatedSolid::DistanceToOutCore(), G4TessellatedSolid::DistanceToOutNoVoxels(), G4GenericTrap::DistToPlane(), G4GenericTrap::DistToTriangle(), G4Box::G4Box(), G4Cons::G4Cons(), G4CutTubs::G4CutTubs(), G4EllipticalCone::G4EllipticalCone(), G4ExtrudedSolid::G4ExtrudedSolid(), G4GenericTrap::G4GenericTrap(), G4Hype::G4Hype(), G4Para::G4Para(), G4Sphere::G4Sphere(), G4Tet::G4Tet(), G4Trap::G4Trap(), G4Tubs::G4Tubs(), G4UnionSolid::G4UnionSolid(), G4VSolid::G4VSolid(), G4VTwistedFaceted::G4VTwistedFaceted(), G4GenericPolycone::GetPointOnSurface(), GetPointOnSurface(), G4UnionSolid::Init(), G4Orb::Initialize(), G4TessellatedSolid::Initialize(), G4SubtractionSolid::Inside(), G4Hype::Inside(), G4Paraboloid::Inside(), G4VCSGfaceted::Inside(), G4VTwistedFaceted::Inside(), G4TessellatedSolid::InsideNoVoxels(), G4GenericTrap::InsidePolygone(), G4TessellatedSolid::InsideVoxels(), G4CutTubs::IsCrossingCutPlanes(), G4GenericTrap::IsSegCrossingZ(), G4Trap::MakePlane(), G4GenericTrap::NormalToPlane(), G4VSolid::operator=(), G4TessellatedSolid::SafetyFromInside(), G4TessellatedSolid::SafetyFromOutside(), G4Torus::SetAllParameters(), SetOriginalParameters(), G4Polyhedra::SetOriginalParameters(), G4Box::SetXHalfLength(), G4Box::SetYHalfLength(), G4Box::SetZHalfLength(), G4Torus::SurfaceNormal(), G4GenericTrap::SurfaceNormal(), and G4Paraboloid::SurfaceNormal().

◆ numCorner

G4int G4Polycone::numCorner
protected

Definition at line 176 of file G4Polycone.hh.

Referenced by CopyStuff(), Create(), CreatePolyhedron(), SetOriginalParameters(), and StreamInfo().

◆ numFace

G4int G4VCSGfaceted::numFace = 0
protectedinherited

◆ original_parameters

G4PolyconeHistorical* G4Polycone::original_parameters = nullptr
protected

◆ phiIsOpen

G4bool G4Polycone::phiIsOpen = false
protected

Definition at line 175 of file G4Polycone.hh.

Referenced by CopyStuff(), and Create().

◆ startPhi

G4double G4Polycone::startPhi
protected

Definition at line 173 of file G4Polycone.hh.

Referenced by CopyStuff(), Create(), CreatePolyhedron(), SetOriginalParameters(), and StreamInfo().


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