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

#include <G4MultiUnion.hh>

Inheritance diagram for G4MultiUnion:
G4VSolid

Data Structures

struct  G4MultiUnionSurface
 

Public Member Functions

void AddNode (G4VSolid &solid, const G4Transform3D &trans)
 
void AddNode (G4VSolid *solid, const G4Transform3D &trans)
 
void BoundingLimits (G4ThreeVector &aMin, G4ThreeVector &aMax) const
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
 
G4VSolidClone () const
 
virtual void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
G4PolyhedronCreatePolyhedron () const
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4double DistanceToIn (const G4ThreeVector &aPoint) const
 
G4double DistanceToIn (const G4ThreeVector &aPoint, const G4ThreeVector &aDirection) const
 
G4double DistanceToInNoVoxels (const G4ThreeVector &aPoint, const G4ThreeVector &aDirection) const
 
G4double DistanceToOut (const G4ThreeVector &aPoint) const
 
G4double DistanceToOut (const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *aNormalVector=nullptr) const
 
G4double DistanceToOutNoVoxels (const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, G4ThreeVector *aNormalVector) const
 
G4double DistanceToOutVoxels (const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, G4ThreeVector *aNormalVector) const
 
G4double DistanceToOutVoxelsCore (const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, G4ThreeVector *aNormalVector, G4bool &aConvex, std::vector< G4int > &candidates) const
 
void DumpInfo () const
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 
void Extent (EAxis aAxis, G4double &aMin, G4double &aMax) const
 
 G4MultiUnion ()
 
 G4MultiUnion (__void__ &)
 
 G4MultiUnion (const G4MultiUnion &rhs)
 
 G4MultiUnion (const G4String &name)
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
G4double GetCubicVolume ()
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
G4GeometryType GetEntityType () const
 
virtual G4VisExtent GetExtent () const
 
G4String GetName () const
 
G4int GetNumberOfSolids () const
 
G4ThreeVector GetPointOnSurface () const
 
G4PolyhedronGetPolyhedron () const
 
G4VSolidGetSolid (G4int index) const
 
G4double GetSurfaceArea ()
 
G4double GetTolerance () const
 
const G4Transform3DGetTransformation (G4int index) const
 
G4VoxelizerGetVoxels () const
 
EInside Inside (const G4ThreeVector &aPoint) const
 
EInside InsideIterator (const G4ThreeVector &aPoint) const
 
EInside InsideNoVoxels (const G4ThreeVector &aPoint) const
 
G4MultiUnionoperator= (const G4MultiUnion &rhs)
 
G4bool operator== (const G4VSolid &s) const
 
void SetAccurateSafety (G4bool flag)
 
void SetName (const G4String &name)
 
std::ostream & StreamInfo (std::ostream &os) const
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &aPoint) const
 
void Voxelize ()
 
 ~G4MultiUnion ()
 

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
 

Protected Attributes

G4double kCarTolerance
 

Private Member Functions

void ClipPolygonToSimpleLimits (G4ThreeVectorList &pPolygon, G4ThreeVectorList &outputPolygon, const G4VoxelLimits &pVoxelLimit) const
 
G4double DistanceToInCandidates (const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, std::vector< G4int > &candidates, G4SurfBits &bits) const
 
G4ThreeVector GetGlobalPoint (const G4Transform3D &trans, const G4ThreeVector &lpoint) const
 
G4ThreeVector GetGlobalVector (const G4Transform3D &trans, const G4ThreeVector &lvec) const
 
G4ThreeVector GetLocalPoint (const G4Transform3D &trans, const G4ThreeVector &gpoint) const
 
G4ThreeVector GetLocalVector (const G4Transform3D &trans, const G4ThreeVector &gvec) const
 
EInside InsideWithExclusion (const G4ThreeVector &aPoint, G4SurfBits *bits=0) const
 
G4int SafetyFromOutsideNumberNode (const G4ThreeVector &aPoint, G4double &safety) const
 
void TransformLimits (G4ThreeVector &min, G4ThreeVector &max, const G4Transform3D &transformation) const
 

Private Attributes

G4bool fAccurate = false
 
G4double fCubicVolume = 0.0
 
G4PolyhedronfpPolyhedron = nullptr
 
G4bool fRebuildPolyhedron = false
 
G4String fshapeName
 
std::vector< G4VSolid * > fSolids
 
G4double fSurfaceArea = 0.0
 
std::vector< G4Transform3DfTransformObjs
 
G4Voxelizer fVoxels
 
G4double kRadTolerance
 

Friends

class G4Voxelizer
 

Detailed Description

Definition at line 53 of file G4MultiUnion.hh.

Constructor & Destructor Documentation

◆ G4MultiUnion() [1/4]

G4MultiUnion::G4MultiUnion ( )
inline

Definition at line 59 of file G4MultiUnion.hh.

59: G4VSolid("") {}
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:57

Referenced by Clone().

◆ G4MultiUnion() [2/4]

G4MultiUnion::G4MultiUnion ( const G4String name)

Definition at line 54 of file G4MultiUnion.cc.

55 : G4VSolid(name)
56{
58 fSolids.clear();
59 fTransformObjs.clear();
61}
G4double GetRadialTolerance() const
static G4GeometryTolerance * GetInstance()
G4double kRadTolerance
std::vector< G4Transform3D > fTransformObjs
std::vector< G4VSolid * > fSolids
void SetName(const G4String &name)
Definition: G4VSolid.cc:127
const char * name(G4int ptype)

References fSolids, fTransformObjs, G4GeometryTolerance::GetInstance(), G4GeometryTolerance::GetRadialTolerance(), kRadTolerance, G4InuclParticleNames::name(), and G4VSolid::SetName().

◆ ~G4MultiUnion()

G4MultiUnion::~G4MultiUnion ( )

Definition at line 64 of file G4MultiUnion.cc.

65{
66}

◆ G4MultiUnion() [3/4]

G4MultiUnion::G4MultiUnion ( const G4MultiUnion rhs)

Definition at line 90 of file G4MultiUnion.cc.

94{
95}
G4double fSurfaceArea
G4bool fAccurate
G4double fCubicVolume

◆ G4MultiUnion() [4/4]

G4MultiUnion::G4MultiUnion ( __void__ &  a)

Definition at line 99 of file G4MultiUnion.cc.

100 : G4VSolid(a)
101{
102}

Member Function Documentation

◆ AddNode() [1/2]

void G4MultiUnion::AddNode ( G4VSolid solid,
const G4Transform3D trans 
)

Definition at line 69 of file G4MultiUnion.cc.

70{
71 fSolids.push_back(&solid);
72 fTransformObjs.push_back(trans); // Store a local copy of transformations
73}

References fSolids, and fTransformObjs.

Referenced by G4tgbVolume::FindOrConstructG4Solid(), and G4GDMLReadSolids::MultiUnionNodeRead().

◆ AddNode() [2/2]

void G4MultiUnion::AddNode ( G4VSolid solid,
const G4Transform3D trans 
)

Definition at line 76 of file G4MultiUnion.cc.

77{
78 fSolids.push_back(solid);
79 fTransformObjs.push_back(trans); // Store a local copy of transformations
80}

References fSolids, and fTransformObjs.

◆ BoundingLimits()

void G4MultiUnion::BoundingLimits ( G4ThreeVector aMin,
G4ThreeVector aMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 616 of file G4MultiUnion.cc.

618{
619 Extent(kXAxis, aMin[0], aMax[0]);
620 Extent(kYAxis, aMin[1], aMax[1]);
621 Extent(kZAxis, aMin[2], aMax[2]);
622}
void Extent(EAxis aAxis, G4double &aMin, G4double &aMax) const
@ kYAxis
Definition: geomdefs.hh:56
@ kXAxis
Definition: geomdefs.hh:55
@ kZAxis
Definition: geomdefs.hh:57

References Extent(), kXAxis, kYAxis, and kZAxis.

Referenced by CalculateExtent(), and GetCubicVolume().

◆ 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}
static const G4double pMax
static const G4double pMin
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
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 G4MultiUnion::CalculateExtent ( const EAxis  pAxis,
const G4VoxelLimits pVoxelLimit,
const G4AffineTransform pTransform,
G4double pMin,
G4double pMax 
) const
virtual

Implements G4VSolid.

Definition at line 626 of file G4MultiUnion.cc.

630{
631 G4ThreeVector bmin, bmax;
632
633 // Get bounding box
634 BoundingLimits(bmin,bmax);
635
636 // Find extent
637 G4BoundingEnvelope bbox(bmin,bmax);
638 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
639}
void BoundingLimits(G4ThreeVector &aMin, G4ThreeVector &aMax) const

References BoundingLimits(), G4BoundingEnvelope::CalculateExtent(), pMax, and pMin.

◆ 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}
std::vector< G4ThreeVector > G4ThreeVectorList
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
static const G4double kInfinity
Definition: geomdefs.hh:41

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 * G4MultiUnion::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 83 of file G4MultiUnion.cc.

84{
85 return new G4MultiUnion(*this);
86}

References G4MultiUnion().

◆ ComputeDimensions()

void G4VSolid::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtualinherited

Reimplemented in G4TwistedTubs, G4VTwistedFaceted, G4ReflectedSolid, G4DisplacedSolid, G4IntersectionSolid, G4ScaledSolid, G4SubtractionSolid, G4UnionSolid, G4Box, G4Cons, G4Orb, G4Para, G4Sphere, G4Torus, G4Trap, G4Trd, G4Tubs, G4Ellipsoid, G4Hype, G4Polycone, G4Polyhedra, and G4Tet.

Definition at line 137 of file G4VSolid.cc.

140{
141 std::ostringstream message;
142 message << "Illegal call to G4VSolid::ComputeDimensions()" << G4endl
143 << "Method not overloaded by derived class !";
144 G4Exception("G4VSolid::ComputeDimensions()", "GeomMgt0003",
145 FatalException, message);
146}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define G4endl
Definition: G4ios.hh:57

References FatalException, G4endl, and G4Exception().

Referenced by G4SmartVoxelHeader::BuildNodes(), G4PVParameterised::CheckOverlaps(), G4VPrimitiveScorer::ComputeSolid(), G4ScoreSplittingProcess::CreateTouchableForSubStep(), G4LogicalVolumeModel::DescribeYourselfTo(), G4VFieldModel::DescribeYourselfTo(), G4LogicalVolume::GetMass(), G4Navigator::GetMotherToDaughterTransform(), G4ITNavigator1::GetMotherToDaughterTransform(), G4ITNavigator2::GetMotherToDaughterTransform(), G4ITNavigator1::LocateGlobalPointAndSetup(), G4ITNavigator2::LocateGlobalPointAndSetup(), G4Navigator::LocateGlobalPointAndSetup(), G4PSFlatSurfaceCurrent::ProcessHits(), G4PSFlatSurfaceFlux::ProcessHits(), G4PSSphereSurfaceFlux::ProcessHits(), G4PSVolumeFlux::ProcessHits(), G4Navigator::SetupHierarchy(), G4ITNavigator1::SetupHierarchy(), and G4ITNavigator2::SetupHierarchy().

◆ CreatePolyhedron()

G4Polyhedron * G4MultiUnion::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 968 of file G4MultiUnion.cc.

969{
972
973 G4VSolid* solidA = GetSolid(0);
974 const G4Transform3D transform0=GetTransformation(0);
975 G4DisplacedSolid dispSolidA("placedA",solidA,transform0);
976
977 G4Polyhedron* top = new G4Polyhedron(*dispSolidA.GetPolyhedron());
978
979 for(G4int i=1; i<GetNumberOfSolids(); ++i)
980 {
981 G4VSolid* solidB = GetSolid(i);
983 G4DisplacedSolid dispSolidB("placedB",solidB,transform);
984 G4Polyhedron* operand = dispSolidB.GetPolyhedron();
985 processor.push_back (operation, *operand);
986 }
987
988 if (processor.execute(*top)) { return top; }
989 else { return 0; }
990}
static int operand(pchar begin, pchar end, double &result, pchar &endp, const dic_type &dictionary)
Definition: Evaluator.cc:163
const G4Transform3D & GetTransformation(G4int index) const
G4int GetNumberOfSolids() const
G4VSolid * GetSolid(G4int index) const
G4bool transform(G4String &input, const G4String &type)
#define processor
Definition: xmlparse.cc:617

References GetNumberOfSolids(), G4DisplacedSolid::GetPolyhedron(), GetSolid(), GetTransformation(), operand(), processor, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and HepPolyhedronProcessor::UNION.

Referenced by GetPolyhedron().

◆ DescribeYourselfTo()

void G4MultiUnion::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 962 of file G4MultiUnion.cc.

963{
964 scene.AddSolid (*this);
965}
virtual void AddSolid(const G4Box &)=0

References G4VGraphicsScene::AddSolid().

◆ DistanceToIn() [1/2]

G4double G4MultiUnion::DistanceToIn ( const G4ThreeVector aPoint) const
virtual

Implements G4VSolid.

Definition at line 760 of file G4MultiUnion.cc.

761{
762 // Estimates the isotropic safety from a point outside the current solid to
763 // any of its surfaces. The algorithm may be accurate or should provide a fast
764 // underestimate.
765
766 if (!fAccurate) { return fVoxels.DistanceToBoundingBox(point); }
767
768 const std::vector<G4VoxelBox>& boxes = fVoxels.GetBoxes();
769 G4double safetyMin = kInfinity;
770 G4ThreeVector localPoint;
771
772 G4int numNodes = fSolids.size();
773 for (G4int j = 0; j < numNodes; ++j)
774 {
775 G4ThreeVector dxyz;
776 if (j > 0)
777 {
778 const G4ThreeVector& pos = boxes[j].pos;
779 const G4ThreeVector& hlen = boxes[j].hlen;
780 for (auto i = 0; i <= 2; ++i)
781 // distance to middle point - hlength => distance from point to border
782 // of x,y,z
783 if ((dxyz[i] = std::abs(point[i] - pos[i]) - hlen[i]) > safetyMin)
784 continue;
785
786 G4double d2xyz = 0.;
787 for (auto i = 0; i <= 2; ++i)
788 if (dxyz[i] > 0) d2xyz += dxyz[i] * dxyz[i];
789
790 // minimal distance is at least this, but could be even higher. therefore,
791 // we can stop if previous was already lower, let us check if it does any
792 // chance to be better tha previous values...
793 if (d2xyz >= safetyMin * safetyMin)
794 {
795 continue;
796 }
797 }
799 localPoint = GetLocalPoint(transform, point);
800 G4VSolid& solid = *fSolids[j];
801
802 G4double safety = solid.DistanceToIn(localPoint);
803 if (safety <= 0) return safety;
804 // it was detected, that the point is not located outside
805 if (safetyMin > safety) safetyMin = safety;
806 }
807 return safetyMin;
808}
static const G4double pos
G4Voxelizer fVoxels
G4ThreeVector GetLocalPoint(const G4Transform3D &trans, const G4ThreeVector &gpoint) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4double DistanceToBoundingBox(const G4ThreeVector &point) const
const std::vector< G4VoxelBox > & GetBoxes() const

References G4Voxelizer::DistanceToBoundingBox(), G4VSolid::DistanceToIn(), fAccurate, fSolids, fTransformObjs, fVoxels, G4Voxelizer::GetBoxes(), GetLocalPoint(), kInfinity, pos, and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

◆ DistanceToIn() [2/2]

G4double G4MultiUnion::DistanceToIn ( const G4ThreeVector aPoint,
const G4ThreeVector aDirection 
) const
virtual

Implements G4VSolid.

Definition at line 212 of file G4MultiUnion.cc.

214{
215 G4double minDistance = kInfinity;
216 G4ThreeVector direction = aDirection.unit();
217 G4double shift = fVoxels.DistanceToFirst(aPoint, direction);
218 if (shift == kInfinity) return shift;
219
220 G4ThreeVector currentPoint = aPoint;
221 if (shift) currentPoint += direction * shift;
222
224 std::vector<G4int> candidates, curVoxel(3);
225 fVoxels.GetVoxel(curVoxel, currentPoint);
226
227 do
228 {
229 {
230 if (fVoxels.GetCandidatesVoxelArray(curVoxel, candidates, &exclusion))
231 {
232 G4double distance = DistanceToInCandidates(aPoint, direction,
233 candidates, exclusion);
234 if (minDistance > distance) minDistance = distance;
235 if (distance < shift) break;
236 }
237 }
238 shift = fVoxels.DistanceToNext(aPoint, direction, curVoxel);
239 }
240 while (minDistance > shift);
241
242 return minDistance;
243}
Hep3Vector unit() const
G4double DistanceToInCandidates(const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, std::vector< G4int > &candidates, G4SurfBits &bits) const
void GetVoxel(std::vector< G4int > &curVoxel, const G4ThreeVector &point) const
G4int GetBitsPerSlice() const
G4double DistanceToFirst(const G4ThreeVector &point, const G4ThreeVector &direction) const
G4int GetCandidatesVoxelArray(const G4ThreeVector &point, std::vector< G4int > &list, G4SurfBits *crossed=nullptr) const
Definition: G4Voxelizer.cc:973
G4double DistanceToNext(const G4ThreeVector &point, const G4ThreeVector &direction, std::vector< G4int > &curVoxel) const

References G4Voxelizer::DistanceToFirst(), DistanceToInCandidates(), G4Voxelizer::DistanceToNext(), fVoxels, G4Voxelizer::GetBitsPerSlice(), G4Voxelizer::GetCandidatesVoxelArray(), G4Voxelizer::GetVoxel(), kInfinity, and CLHEP::Hep3Vector::unit().

◆ DistanceToInCandidates()

G4double G4MultiUnion::DistanceToInCandidates ( const G4ThreeVector aPoint,
const G4ThreeVector aDirection,
std::vector< G4int > &  candidates,
G4SurfBits bits 
) const
private

Definition at line 176 of file G4MultiUnion.cc.

180{
181 G4int candidatesCount = candidates.size();
182 G4ThreeVector localPoint, localDirection;
183
184 G4double minDistance = kInfinity;
185 for (G4int i = 0 ; i < candidatesCount; ++i)
186 {
187 G4int candidate = candidates[i];
188 G4VSolid& solid = *fSolids[candidate];
189 const G4Transform3D& transform = fTransformObjs[candidate];
190
191 localPoint = GetLocalPoint(transform, aPoint);
192 localDirection = GetLocalVector(transform, direction);
193 G4double distance = solid.DistanceToIn(localPoint, localDirection);
194 if (minDistance > distance) minDistance = distance;
195 bits.SetBitNumber(candidate);
196 if (minDistance == 0) break;
197 }
198 return minDistance;
199}
G4ThreeVector GetLocalVector(const G4Transform3D &trans, const G4ThreeVector &gvec) const
void SetBitNumber(unsigned int bitnumber, G4bool value=true)
Definition: G4SurfBits.hh:114

References G4VSolid::DistanceToIn(), fSolids, fTransformObjs, GetLocalPoint(), GetLocalVector(), kInfinity, G4SurfBits::SetBitNumber(), and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

Referenced by DistanceToIn().

◆ DistanceToInNoVoxels()

G4double G4MultiUnion::DistanceToInNoVoxels ( const G4ThreeVector aPoint,
const G4ThreeVector aDirection 
) const

Definition at line 153 of file G4MultiUnion.cc.

155{
156 G4ThreeVector direction = aDirection.unit();
157 G4ThreeVector localPoint, localDirection;
158 G4double minDistance = kInfinity;
159
160 G4int numNodes = fSolids.size();
161 for (G4int i = 0 ; i < numNodes ; ++i)
162 {
163 G4VSolid& solid = *fSolids[i];
165
166 localPoint = GetLocalPoint(transform, aPoint);
167 localDirection = GetLocalVector(transform, direction);
168
169 G4double distance = solid.DistanceToIn(localPoint, localDirection);
170 if (minDistance > distance) minDistance = distance;
171 }
172 return minDistance;
173}

References G4VSolid::DistanceToIn(), fSolids, fTransformObjs, GetLocalPoint(), GetLocalVector(), kInfinity, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and CLHEP::Hep3Vector::unit().

◆ DistanceToOut() [1/2]

G4double G4MultiUnion::DistanceToOut ( const G4ThreeVector aPoint) const
virtual

Implements G4VSolid.

Definition at line 723 of file G4MultiUnion.cc.

724{
725 // Estimates isotropic distance to the surface of the solid. This must
726 // be either accurate or an underestimate.
727 // Two modes: - default/fast mode, sacrificing accuracy for speed
728 // - "precise" mode, requests accurate value if available.
729
730 std::vector<G4int> candidates;
731 G4ThreeVector localPoint;
732 G4double safetyMin = kInfinity;
733
734 // In general, the value return by DistanceToIn(p) will not be the exact
735 // but only an undervalue (cf. overlaps)
736 fVoxels.GetCandidatesVoxelArray(point, candidates);
737
738 G4int limit = candidates.size();
739 for (G4int i = 0; i < limit; ++i)
740 {
741 G4int candidate = candidates[i];
742
743 // The coordinates of the point are modified so as to fit the intrinsic
744 // solid local frame:
745 const G4Transform3D& transform = fTransformObjs[candidate];
746 localPoint = GetLocalPoint(transform, point);
747 G4VSolid& solid = *fSolids[candidate];
748 if (solid.Inside(localPoint) == EInside::kInside)
749 {
750 G4double safety = solid.DistanceToOut(localPoint);
751 if (safetyMin > safety) safetyMin = safety;
752 }
753 }
754 if (safetyMin == kInfinity) safetyMin = 0; // we are not inside
755
756 return safetyMin;
757}
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
@ kInside
Definition: geomdefs.hh:70

References G4VSolid::DistanceToOut(), fSolids, fTransformObjs, fVoxels, G4Voxelizer::GetCandidatesVoxelArray(), GetLocalPoint(), G4VSolid::Inside(), kInfinity, kInside, and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

◆ DistanceToOut() [2/2]

G4double G4MultiUnion::DistanceToOut ( const G4ThreeVector aPoint,
const G4ThreeVector aDirection,
const G4bool  calcNorm = false,
G4bool validNorm = nullptr,
G4ThreeVector aNormalVector = nullptr 
) const
virtual

Implements G4VSolid.

Definition at line 297 of file G4MultiUnion.cc.

302{
303 return DistanceToOutVoxels(aPoint, aDirection, aNormal);
304}
G4double DistanceToOutVoxels(const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, G4ThreeVector *aNormalVector) const

References DistanceToOutVoxels().

◆ DistanceToOutNoVoxels()

G4double G4MultiUnion::DistanceToOutNoVoxels ( const G4ThreeVector aPoint,
const G4ThreeVector aDirection,
G4ThreeVector aNormalVector 
) const

Definition at line 246 of file G4MultiUnion.cc.

249{
250 // Computes distance from a point presumably outside the solid to the solid
251 // surface. Ignores first surface if the point is actually inside.
252 // Early return infinity in case the safety to any surface is found greater
253 // than the proposed step aPstep.
254 // The normal vector to the crossed surface is filled only in case the box
255 // is crossed, otherwise aNormal->IsNull() is true.
256
257 // algorithm:
258 G4ThreeVector direction = aDirection.unit();
259 G4ThreeVector localPoint, localDirection;
260 G4int ignoredSolid = -1;
261 G4double resultDistToOut = 0;
262 G4ThreeVector currentPoint = aPoint;
263
264 G4int numNodes = fSolids.size();
265 for (G4int i = 0; i < numNodes; ++i)
266 {
267 if (i != ignoredSolid)
268 {
269 G4VSolid& solid = *fSolids[i];
271 localPoint = GetLocalPoint(transform, currentPoint);
272 localDirection = GetLocalVector(transform, direction);
273 EInside location = solid.Inside(localPoint);
274 if (location != EInside::kOutside)
275 {
276 G4double distance = solid.DistanceToOut(localPoint, localDirection,
277 aNormal);
278 if (distance < kInfinity)
279 {
280 if (resultDistToOut == kInfinity) resultDistToOut = 0;
281 if (distance > 0)
282 {
283 currentPoint = GetGlobalPoint(transform, localPoint
284 + distance*localDirection);
285 resultDistToOut += distance;
286 ignoredSolid = i; // skip the solid which we have just left
287 i = -1; // force the loop to continue from 0
288 }
289 }
290 }
291 }
292 }
293 return resultDistToOut;
294}
G4ThreeVector GetGlobalPoint(const G4Transform3D &trans, const G4ThreeVector &lpoint) const
EInside
Definition: geomdefs.hh:67
@ kOutside
Definition: geomdefs.hh:68

References G4VSolid::DistanceToOut(), fSolids, fTransformObjs, GetGlobalPoint(), GetLocalPoint(), GetLocalVector(), G4VSolid::Inside(), kInfinity, kOutside, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and CLHEP::Hep3Vector::unit().

◆ DistanceToOutVoxels()

G4double G4MultiUnion::DistanceToOutVoxels ( const G4ThreeVector aPoint,
const G4ThreeVector aDirection,
G4ThreeVector aNormalVector 
) const

Definition at line 307 of file G4MultiUnion.cc.

310{
311 // Computes distance from a point presumably inside the solid to the solid
312 // surface. Ignores first surface along each axis systematically (for points
313 // inside or outside. Early returns zero in case the second surface is behind
314 // the starting point.
315 // o The proposed step is ignored.
316 // o The normal vector to the crossed surface is always filled.
317
318 // In the case the considered point is located inside the G4MultiUnion
319 // structure, the treatments are as follows:
320 // - investigation of the candidates for the passed point
321 // - progressive moving of the point towards the surface, along the
322 // passed direction
323 // - processing of the normal
324
325 G4ThreeVector direction = aDirection.unit();
326 std::vector<G4int> candidates;
327 G4double distance = 0;
328 G4int numNodes = 2*fSolids.size();
329 G4int count=0;
330
331 if (fVoxels.GetCandidatesVoxelArray(aPoint, candidates))
332 {
333 // For normal case for which we presume the point is inside
334 G4ThreeVector localPoint, localDirection, localNormal;
335 G4ThreeVector currentPoint = aPoint;
337 G4bool notOutside;
338 G4ThreeVector maxNormal;
339
340 do
341 {
342 notOutside = false;
343
344 G4double maxDistance = -kInfinity;
345 G4int maxCandidate = 0;
346 G4ThreeVector maxLocalPoint;
347
348 G4int limit = candidates.size();
349 for (G4int i = 0 ; i < limit ; ++i)
350 {
351 G4int candidate = candidates[i];
352 // ignore the current component (that you just got out of) since
353 // numerically the propagated point will be on its surface
354
355 G4VSolid& solid = *fSolids[candidate];
356 const G4Transform3D& transform = fTransformObjs[candidate];
357
358 // The coordinates of the point are modified so as to fit the
359 // intrinsic solid local frame:
360 localPoint = GetLocalPoint(transform, currentPoint);
361
362 // DistanceToOut at least for Trd sometimes return non-zero value
363 // even from points that are outside. Therefore, this condition
364 // must currently be here, otherwise it would not work.
365 // But it means it would be slower.
366
367 if (solid.Inside(localPoint) != EInside::kOutside)
368 {
369 notOutside = true;
370
371 localDirection = GetLocalVector(transform, direction);
372
373 // propagate with solid.DistanceToOut
374 G4double shift = solid.DistanceToOut(localPoint, localDirection,
375 false, 0, &localNormal);
376 if (maxDistance < shift)
377 {
378 maxDistance = shift;
379 maxCandidate = candidate;
380 maxNormal = localNormal;
381 }
382 }
383 }
384
385 if (notOutside)
386 {
387 const G4Transform3D& transform = fTransformObjs[maxCandidate];
388
389 // convert from local normal
390 if (aNormal) *aNormal = GetGlobalVector(transform, maxNormal);
391
392 distance += maxDistance;
393 currentPoint += maxDistance * direction;
394 if(maxDistance == 0.) ++count;
395
396 // the current component will be ignored
397 exclusion.SetBitNumber(maxCandidate);
398 EInside location = InsideWithExclusion(currentPoint, &exclusion);
399
400 // perform a Inside
401 // it should be excluded current solid from checking
402 // we have to collect the maximum distance from all given candidates.
403 // such "maximum" candidate should be then used for finding next
404 // candidates
405 if (location == EInside::kOutside)
406 {
407 // else return cumulated distances to outside of the traversed
408 // components
409 break;
410 }
411 // if inside another component, redo 1 to 3 but add the next
412 // DistanceToOut on top of the previous.
413
414 // and fill the candidates for the corresponding voxel (just
415 // exiting current component along direction)
416 candidates.clear();
417
418 fVoxels.GetCandidatesVoxelArray(currentPoint, candidates, &exclusion);
419 exclusion.ResetBitNumber(maxCandidate);
420 }
421 }
422 while ((notOutside) && (count < numNodes));
423 }
424
425 return distance;
426}
bool G4bool
Definition: G4Types.hh:86
G4ThreeVector GetGlobalVector(const G4Transform3D &trans, const G4ThreeVector &lvec) const
EInside InsideWithExclusion(const G4ThreeVector &aPoint, G4SurfBits *bits=0) const

References G4VSolid::DistanceToOut(), fSolids, fTransformObjs, fVoxels, G4Voxelizer::GetBitsPerSlice(), G4Voxelizer::GetCandidatesVoxelArray(), GetGlobalVector(), GetLocalPoint(), GetLocalVector(), G4VSolid::Inside(), InsideWithExclusion(), kInfinity, kOutside, G4SurfBits::ResetBitNumber(), G4SurfBits::SetBitNumber(), G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and CLHEP::Hep3Vector::unit().

Referenced by DistanceToOut().

◆ DistanceToOutVoxelsCore()

G4double G4MultiUnion::DistanceToOutVoxelsCore ( const G4ThreeVector aPoint,
const G4ThreeVector aDirection,
G4ThreeVector aNormalVector,
G4bool aConvex,
std::vector< G4int > &  candidates 
) const

◆ 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(), G4Polycone::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::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

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 G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:665
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(), GetSurfaceArea(), and G4VCSGfaceted::GetSurfaceArea().

◆ Extent()

void G4MultiUnion::Extent ( EAxis  aAxis,
G4double aMin,
G4double aMax 
) const

Definition at line 551 of file G4MultiUnion.cc.

552{
553 // Determines the bounding box for the considered instance of "UMultipleUnion"
555
556 G4int numNodes = fSolids.size();
557 for (G4int i = 0 ; i < numNodes ; ++i)
558 {
559 G4VSolid& solid = *fSolids[i];
561 solid.BoundingLimits(min, max);
562
564
565 if (i == 0)
566 {
567 switch (aAxis)
568 {
569 case kXAxis:
570 aMin = min.x();
571 aMax = max.x();
572 break;
573 case kYAxis:
574 aMin = min.y();
575 aMax = max.y();
576 break;
577 case kZAxis:
578 aMin = min.z();
579 aMax = max.z();
580 break;
581 default:
582 break;
583 }
584 }
585 else
586 {
587 // Determine the min/max on the considered axis:
588 switch (aAxis)
589 {
590 case kXAxis:
591 if (min.x() < aMin)
592 aMin = min.x();
593 if (max.x() > aMax)
594 aMax = max.x();
595 break;
596 case kYAxis:
597 if (min.y() < aMin)
598 aMin = min.y();
599 if (max.y() > aMax)
600 aMax = max.y();
601 break;
602 case kZAxis:
603 if (min.z() < aMin)
604 aMin = min.z();
605 if (max.z() > aMax)
606 aMax = max.z();
607 break;
608 default:
609 break;
610 }
611 }
612 }
613}
void TransformLimits(G4ThreeVector &min, G4ThreeVector &max, const G4Transform3D &transformation) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments

References G4VSolid::BoundingLimits(), fSolids, GetTransformation(), kXAxis, kYAxis, kZAxis, G4INCL::Math::max(), G4INCL::Math::min(), G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and TransformLimits().

Referenced by BoundingLimits().

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

◆ GetCubicVolume()

G4double G4MultiUnion::GetCubicVolume ( )
virtual

Reimplemented from G4VSolid.

Definition at line 123 of file G4MultiUnion.cc.

124{
125 // Computes the cubic volume of the "G4MultiUnion" structure using
126 // random points
127
128 if (!fCubicVolume)
129 {
130 G4ThreeVector extentMin, extentMax, d, p, point;
131 G4int inside = 0, generated;
132 BoundingLimits(extentMin, extentMax);
133 d = (extentMax - extentMin) / 2.;
134 p = (extentMax + extentMin) / 2.;
135 G4ThreeVector left = p - d;
136 G4ThreeVector length = d * 2;
137 for (generated = 0; generated < 10000; ++generated)
138 {
140 point = left + G4ThreeVector(length.x()*rvec.x(),
141 length.y()*rvec.y(),
142 length.z()*rvec.z());
143 if (Inside(point) != EInside::kOutside) ++inside;
144 }
145 G4double vbox = (2 * d.x()) * (2 * d.y()) * (2 * d.z());
146 fCubicVolume = inside * vbox / generated;
147 }
148 return fCubicVolume;
149}
#define G4UniformRand()
Definition: Randomize.hh:52
EInside Inside(const G4ThreeVector &aPoint) const

References BoundingLimits(), fCubicVolume, G4UniformRand, Inside(), kOutside, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ 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; }

◆ GetEntityType()

G4GeometryType G4MultiUnion::GetEntityType ( ) const
inlinevirtual

Implements G4VSolid.

Definition at line 121 of file G4MultiUnion.hh.

121{ return "G4MultiUnion"; }

◆ GetExtent()

G4VisExtent G4VSolid::GetExtent ( ) const
virtualinherited

Reimplemented in G4Box, G4Orb, G4Sphere, G4Ellipsoid, G4EllipticalCone, G4EllipticalTube, G4GenericTrap, G4Hype, G4TessellatedSolid, G4Tet, G4TwistedTubs, G4VCSGfaceted, and G4VTwistedFaceted.

Definition at line 682 of file G4VSolid.cc.

683{
684 G4VisExtent extent;
685 G4VoxelLimits voxelLimits; // Defaults to "infinite" limits.
686 G4AffineTransform affineTransform;
687 G4double vmin, vmax;
688 CalculateExtent(kXAxis,voxelLimits,affineTransform,vmin,vmax);
689 extent.SetXmin (vmin);
690 extent.SetXmax (vmax);
691 CalculateExtent(kYAxis,voxelLimits,affineTransform,vmin,vmax);
692 extent.SetYmin (vmin);
693 extent.SetYmax (vmax);
694 CalculateExtent(kZAxis,voxelLimits,affineTransform,vmin,vmax);
695 extent.SetZmin (vmin);
696 extent.SetZmax (vmax);
697 return extent;
698}
void SetYmin(G4double ymin)
Definition: G4VisExtent.hh:114
void SetYmax(G4double ymax)
Definition: G4VisExtent.hh:116
void SetXmax(G4double xmax)
Definition: G4VisExtent.hh:112
void SetXmin(G4double xmin)
Definition: G4VisExtent.hh:110
void SetZmax(G4double zmax)
Definition: G4VisExtent.hh:120
void SetZmin(G4double zmin)
Definition: G4VisExtent.hh:118

References G4VSolid::CalculateExtent(), kXAxis, kYAxis, kZAxis, G4VisExtent::SetXmax(), G4VisExtent::SetXmin(), G4VisExtent::SetYmax(), G4VisExtent::SetYmin(), G4VisExtent::SetZmax(), and G4VisExtent::SetZmin().

Referenced by G4tgbVolume::BuildSolidForDivision(), G4BoundingExtentScene::ProcessVolume(), G4BoundingSphereScene::ProcessVolume(), and G4VisCommandsTouchable::SetNewValue().

◆ GetGlobalPoint()

G4ThreeVector G4MultiUnion::GetGlobalPoint ( const G4Transform3D trans,
const G4ThreeVector lpoint 
) const
inlineprivate

Definition at line 246 of file G4MultiUnion.hh.

248{
249 // Returns global point coordinates converted from the local frame defined
250 // by the transformation. This is defined by multiplying this transformation
251 // with the local vector.
252
253 return trans*G4Point3D(local);
254}
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
#define local
Definition: gzguts.h:114

References local.

Referenced by DistanceToOutNoVoxels(), GetPointOnSurface(), and TransformLimits().

◆ GetGlobalVector()

G4ThreeVector G4MultiUnion::GetGlobalVector ( const G4Transform3D trans,
const G4ThreeVector lvec 
) const
inlineprivate

Definition at line 258 of file G4MultiUnion.hh.

260{
261 // Returns vector components converted from the local frame defined by the
262 // transformation to the global one. This is defined by multiplying this
263 // transformation with the local vector while ignoring the translation.
264
265 G4Rotate3D rot;
266 G4Translate3D transl ;
267 G4Scale3D scale;
268
269 trans.getDecomposition(scale,rot,transl);
270 return rot*G4Vector3D(local);
271}
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:34
void getDecomposition(Scale3D &scale, Rotate3D &rotation, Translate3D &translation) const
Definition: Transform3D.cc:173

References HepGeom::Transform3D::getDecomposition(), and local.

Referenced by DistanceToOutVoxels(), and SurfaceNormal().

◆ GetLocalPoint()

G4ThreeVector G4MultiUnion::GetLocalPoint ( const G4Transform3D trans,
const G4ThreeVector gpoint 
) const
inlineprivate

Definition at line 217 of file G4MultiUnion.hh.

219{
220 // Returns local point coordinates converted from the global frame defined
221 // by the transformation. This is defined by multiplying the inverse
222 // transformation with the global vector.
223
224 return trans.inverse()*G4Point3D(global);
225}
Transform3D inverse() const
Definition: Transform3D.cc:141

References HepGeom::Transform3D::inverse().

Referenced by DistanceToIn(), DistanceToInCandidates(), DistanceToInNoVoxels(), DistanceToOut(), DistanceToOutNoVoxels(), DistanceToOutVoxels(), InsideNoVoxels(), InsideWithExclusion(), SafetyFromOutsideNumberNode(), and SurfaceNormal().

◆ GetLocalVector()

G4ThreeVector G4MultiUnion::GetLocalVector ( const G4Transform3D trans,
const G4ThreeVector gvec 
) const
inlineprivate

Definition at line 229 of file G4MultiUnion.hh.

231{
232 // Returns local point coordinates converted from the global frame defined
233 // by the transformation. This is defined by multiplying the inverse
234 // transformation with the global vector.
235
236 G4Rotate3D rot;
237 G4Translate3D transl ;
238 G4Scale3D scale;
239
240 trans.getDecomposition(scale,rot,transl);
241 return rot.inverse()*G4Vector3D(global);
242}

References HepGeom::Transform3D::getDecomposition(), and HepGeom::Transform3D::inverse().

Referenced by DistanceToInCandidates(), DistanceToInNoVoxels(), DistanceToOutNoVoxels(), and DistanceToOutVoxels().

◆ 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(), G4Polycone::BoundingLimits(), G4Polyhedra::BoundingLimits(), G4TessellatedSolid::BoundingLimits(), G4TwistedTubs::BoundingLimits(), G4GDMLWriteSolids::BoxWrite(), G4ExtrudedSolid::CalculateExtent(), G4GenericPolycone::CalculateExtent(), G4Polycone::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(), G4Polycone::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::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(), G4Polycone::SetOriginalParameters(), G4Polyhedra::SetOriginalParameters(), G4TessellatedSolid::SetSolidClosed(), G4Tet::SetVertices(), G4Box::SetXHalfLength(), G4Box::SetYHalfLength(), G4Box::SetZHalfLength(), G4GDMLWriteSolids::SphereWrite(), G4BooleanSolid::StackPolyhedron(), G4ReflectedSolid::StreamInfo(), G4BooleanSolid::StreamInfo(), G4DisplacedSolid::StreamInfo(), 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(), G4Polycone::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().

◆ GetNumberOfSolids()

G4int G4MultiUnion::GetNumberOfSolids ( ) const
inline

Definition at line 204 of file G4MultiUnion.hh.

205{
206 return G4int(fSolids.size());
207}

References fSolids.

Referenced by CreatePolyhedron(), G4tgbGeometryDumper::DumpMultiUnionVolume(), and G4GDMLWriteSolids::MultiUnionWrite().

◆ GetPointOnSurface()

G4ThreeVector G4MultiUnion::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 941 of file G4MultiUnion.cc.

942{
943 G4ThreeVector point;
944
945 G4long size = fSolids.size();
946
947 do
948 {
949 G4long rnd = G4RandFlat::shootInt(G4long(0), size);
950 G4VSolid& solid = *fSolids[rnd];
951 point = solid.GetPointOnSurface();
953 point = GetGlobalPoint(transform, point);
954 }
955 while (Inside(point) != EInside::kSurface);
956
957 return point;
958}
long G4long
Definition: G4Types.hh:87
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:152
@ kSurface
Definition: geomdefs.hh:69

References fSolids, fTransformObjs, GetGlobalPoint(), G4VSolid::GetPointOnSurface(), Inside(), kSurface, and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

◆ GetPolyhedron()

G4Polyhedron * G4MultiUnion::GetPolyhedron ( ) const
virtual

◆ GetSolid()

G4VSolid * G4MultiUnion::GetSolid ( G4int  index) const
inline

Definition at line 198 of file G4MultiUnion.hh.

199{
200 return fSolids[index];
201}

References fSolids.

Referenced by CreatePolyhedron(), G4tgbGeometryDumper::DumpMultiUnionVolume(), and G4GDMLWriteSolids::MultiUnionWrite().

◆ GetSurfaceArea()

G4double G4MultiUnion::GetSurfaceArea ( )
virtual

Reimplemented from G4VSolid.

Definition at line 811 of file G4MultiUnion.cc.

812{
813 if (!fSurfaceArea)
814 {
815 fSurfaceArea = EstimateSurfaceArea(1000000, 0.001);
816 }
817 return fSurfaceArea;
818}
G4double EstimateSurfaceArea(G4int nStat, G4double ell) const
Definition: G4VSolid.cc:265

References G4VSolid::EstimateSurfaceArea(), and fSurfaceArea.

◆ GetTolerance()

G4double G4VSolid::GetTolerance ( ) const
inlineinherited

◆ GetTransformation()

const G4Transform3D & G4MultiUnion::GetTransformation ( G4int  index) const
inline

◆ GetVoxels()

G4Voxelizer & G4MultiUnion::GetVoxels ( ) const
inline

Definition at line 186 of file G4MultiUnion.hh.

187{
188 return (G4Voxelizer&)fVoxels;
189}

References fVoxels.

◆ Inside()

EInside G4MultiUnion::Inside ( const G4ThreeVector aPoint) const
virtual

Implements G4VSolid.

Definition at line 503 of file G4MultiUnion.cc.

504{
505 // Classify point location with respect to solid:
506 // o eInside - inside the solid
507 // o eSurface - close to surface within tolerance
508 // o eOutside - outside the solid
509
510 // Hitherto, it is considered that only parallelepipedic nodes can be
511 // added to the container
512
513 // Implementation using voxelisation techniques:
514 // ---------------------------------------------
515
516 // return InsideIterator(aPoint);
517
518 EInside location = InsideWithExclusion(aPoint);
519 return location;
520}

References InsideWithExclusion().

Referenced by GetCubicVolume(), and GetPointOnSurface().

◆ InsideIterator()

EInside G4MultiUnion::InsideIterator ( const G4ThreeVector aPoint) const

◆ InsideNoVoxels()

EInside G4MultiUnion::InsideNoVoxels ( const G4ThreeVector aPoint) const

Definition at line 523 of file G4MultiUnion.cc.

524{
525 G4ThreeVector localPoint;
526 EInside location = EInside::kOutside;
527 G4int countSurface = 0;
528
529 G4int numNodes = fSolids.size();
530 for (G4int i = 0 ; i < numNodes ; ++i)
531 {
532 G4VSolid& solid = *fSolids[i];
534
535 // The coordinates of the point are modified so as to fit the
536 // intrinsic solid local frame:
537 localPoint = GetLocalPoint(transform, aPoint);
538
539 location = solid.Inside(localPoint);
540
541 if (location == EInside::kSurface)
542 ++countSurface;
543
544 if (location == EInside::kInside) return EInside::kInside;
545 }
546 if (countSurface != 0) return EInside::kSurface;
547 return EInside::kOutside;
548}

References fSolids, GetLocalPoint(), GetTransformation(), G4VSolid::Inside(), kInside, kOutside, kSurface, and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

◆ InsideWithExclusion()

EInside G4MultiUnion::InsideWithExclusion ( const G4ThreeVector aPoint,
G4SurfBits bits = 0 
) const
private

Definition at line 429 of file G4MultiUnion.cc.

431{
432 // Classify point location with respect to solid:
433 // o eInside - inside the solid
434 // o eSurface - close to surface within tolerance
435 // o eOutside - outside the solid
436
437 // Hitherto, it is considered that only parallelepipedic nodes
438 // can be added to the container
439
440 // Implementation using voxelisation techniques:
441 // ---------------------------------------------
442
443 G4ThreeVector localPoint;
444 EInside location = EInside::kOutside;
445
446 std::vector<G4int> candidates;
447 std::vector<G4MultiUnionSurface> surfaces;
448
449 // TODO: test if it works well and if so measure performance
450 // TODO: getPointIndex should not be used, instead GetVoxel + GetVoxelsIndex
451 // should be used
452 // TODO: than pass result to GetVoxel further to GetCandidatesVoxelArray
453 // TODO: eventually GetVoxel should be inlined here, early exit if any
454 // binary search is -1
455
456 G4int limit = fVoxels.GetCandidatesVoxelArray(aPoint, candidates, exclusion);
457 for (G4int i = 0 ; i < limit ; ++i)
458 {
459 G4int candidate = candidates[i];
460 G4VSolid& solid = *fSolids[candidate];
461 const G4Transform3D& transform = fTransformObjs[candidate];
462
463 // The coordinates of the point are modified so as to fit the intrinsic
464 // solid local frame:
465 localPoint = GetLocalPoint(transform, aPoint);
466 location = solid.Inside(localPoint);
467 if (location == EInside::kInside) return EInside::kInside;
468 else if (location == EInside::kSurface)
469 {
470 G4MultiUnionSurface surface;
471 surface.point = localPoint;
472 surface.solid = &solid;
473 surfaces.push_back(surface);
474 }
475 }
476
478 // Important comment: When two solids touch each other along a flat
479 // surface, the surface points will be considered as kSurface, while points
480 // located around will correspond to kInside (cf. G4UnionSolid)
481
482 G4int size = surfaces.size();
483 for (G4int i = 0; i < size - 1; ++i)
484 {
485 G4MultiUnionSurface& left = surfaces[i];
486 for (G4int j = i + 1; j < size; ++j)
487 {
488 G4MultiUnionSurface& right = surfaces[j];
489 G4ThreeVector n, n2;
490 n = left.solid->SurfaceNormal(left.point);
491 n2 = right.solid->SurfaceNormal(right.point);
492 if ((n + n2).mag2() < 1000 * kRadTolerance)
493 return EInside::kInside;
494 }
495 }
496
497 location = size ? EInside::kSurface : EInside::kOutside;
498
499 return location;
500}

References fSolids, fTransformObjs, fVoxels, G4Voxelizer::GetCandidatesVoxelArray(), GetLocalPoint(), G4VSolid::Inside(), kInside, kOutside, kRadTolerance, kSurface, CLHEP::detail::n, G4MultiUnion::G4MultiUnionSurface::point, G4MultiUnion::G4MultiUnionSurface::solid, G4VSolid::SurfaceNormal(), and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

Referenced by DistanceToOutVoxels(), and Inside().

◆ operator=()

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

Definition at line 106 of file G4MultiUnion.cc.

107{
108 // Check assignment to self
109 //
110 if (this == &rhs)
111 {
112 return *this;
113 }
114
115 // Copy base class data
116 //
118
119 return *this;
120}
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:107

References G4VSolid::operator=().

◆ operator==()

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

◆ SafetyFromOutsideNumberNode()

G4int G4MultiUnion::SafetyFromOutsideNumberNode ( const G4ThreeVector aPoint,
G4double safety 
) const
private

Definition at line 827 of file G4MultiUnion.cc.

829{
830 // Method returning the closest node from a point located outside a
831 // G4MultiUnion.
832 // This is used to compute the normal in the case no candidate has been found.
833
834 const std::vector<G4VoxelBox>& boxes = fVoxels.GetBoxes();
835 safetyMin = kInfinity;
836 G4int safetyNode = 0;
837 G4ThreeVector localPoint;
838
839 G4int numNodes = fSolids.size();
840 for (G4int i = 0; i < numNodes; ++i)
841 {
842 G4double d2xyz = 0.;
843 G4double dxyz0 = std::abs(aPoint.x() - boxes[i].pos.x()) - boxes[i].hlen.x();
844 if (dxyz0 > safetyMin) continue;
845 G4double dxyz1 = std::abs(aPoint.y() - boxes[i].pos.y()) - boxes[i].hlen.y();
846 if (dxyz1 > safetyMin) continue;
847 G4double dxyz2 = std::abs(aPoint.z() - boxes[i].pos.z()) - boxes[i].hlen.z();
848 if (dxyz2 > safetyMin) continue;
849
850 if (dxyz0 > 0) d2xyz += dxyz0 * dxyz0;
851 if (dxyz1 > 0) d2xyz += dxyz1 * dxyz1;
852 if (dxyz2 > 0) d2xyz += dxyz2 * dxyz2;
853 if (d2xyz >= safetyMin * safetyMin) continue;
854
855 G4VSolid& solid = *fSolids[i];
857 localPoint = GetLocalPoint(transform, aPoint);
858 fAccurate = true;
859 G4double safety = solid.DistanceToIn(localPoint);
860 fAccurate = false;
861 if (safetyMin > safety)
862 {
863 safetyMin = safety;
864 safetyNode = i;
865 }
866 }
867 return safetyNode;
868}

References G4VSolid::DistanceToIn(), fAccurate, fSolids, fTransformObjs, fVoxels, G4Voxelizer::GetBoxes(), GetLocalPoint(), kInfinity, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by SurfaceNormal().

◆ SetAccurateSafety()

void G4MultiUnion::SetAccurateSafety ( G4bool  flag)
inline

Definition at line 210 of file G4MultiUnion.hh.

211{
212 fAccurate = flag;
213}

References fAccurate.

◆ SetName()

void G4VSolid::SetName ( const G4String name)
inherited

Definition at line 127 of file G4VSolid.cc.

128{
131}
void SetMapValid(G4bool val)
Definition: G4SolidStore.hh:76
static G4SolidStore * GetInstance()
G4String fshapeName
Definition: G4VSolid.hh:312

References G4VSolid::fshapeName, G4SolidStore::GetInstance(), G4InuclParticleNames::name(), and G4SolidStore::SetMapValid().

Referenced by export_G4VSolid(), G4MultiUnion(), and G4GDMLRead::StripNames().

◆ StreamInfo()

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

Implements G4VSolid.

Definition at line 915 of file G4MultiUnion.cc.

916{
917 G4int oldprc = os.precision(16);
918 os << "-----------------------------------------------------------\n"
919 << " *** Dump for solid - " << GetName() << " ***\n"
920 << " ===================================================\n"
921 << " Solid type: G4MultiUnion\n"
922 << " Parameters: \n";
923 G4int numNodes = fSolids.size();
924 for (G4int i = 0 ; i < numNodes ; ++i)
925 {
926 G4VSolid& solid = *fSolids[i];
927 solid.StreamInfo(os);
929 os << " Translation is " << transform.getTranslation() << " \n";
930 os << " Rotation is :" << " \n";
931 os << " " << transform.getRotation() << "\n";
932 }
933 os << " \n"
934 << "-----------------------------------------------------------\n";
935 os.precision(oldprc);
936
937 return os;
938}
G4String GetName() const
virtual std::ostream & StreamInfo(std::ostream &os) const =0

References fSolids, fTransformObjs, G4VSolid::GetName(), G4VSolid::StreamInfo(), and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

◆ SurfaceNormal()

G4ThreeVector G4MultiUnion::SurfaceNormal ( const G4ThreeVector aPoint) const
virtual

Implements G4VSolid.

Definition at line 642 of file G4MultiUnion.cc.

643{
644 // Computes the localNormal on a surface and returns it as a unit vector.
645 // Must return a valid vector. (even if the point is not on the surface).
646 //
647 // On an edge or corner, provide an average localNormal of all facets within
648 // tolerance
649 // NOTE: the tolerance value used in here is not yet the global surface
650 // tolerance - we will have to revise this value - TODO
651
652 std::vector<G4int> candidates;
653 G4ThreeVector localPoint, normal, localNormal;
654 G4double safety = kInfinity;
655 G4int node = 0;
656
658 // Important comment: Cases for which the point is located on an edge or
659 // on a vertice remain to be treated
660
661 // determine weather we are in voxel area
662 if (fVoxels.GetCandidatesVoxelArray(aPoint, candidates))
663 {
664 G4int limit = candidates.size();
665 for (G4int i = 0 ; i < limit ; ++i)
666 {
667 G4int candidate = candidates[i];
668 const G4Transform3D& transform = fTransformObjs[candidate];
669
670 // The coordinates of the point are modified so as to fit the intrinsic
671 // solid local frame:
672 localPoint = GetLocalPoint(transform, aPoint);
673 G4VSolid& solid = *fSolids[candidate];
674 EInside location = solid.Inside(localPoint);
675
676 if (location == EInside::kSurface)
677 {
678 // normal case when point is on surface, we pick first solid
679 normal = GetGlobalVector(transform, solid.SurfaceNormal(localPoint));
680 return normal.unit();
681 }
682 else
683 {
684 // collect the smallest safety and remember solid node
685 G4double s = (location == EInside::kInside)
686 ? solid.DistanceToOut(localPoint)
687 : solid.DistanceToIn(localPoint);
688 if (s < safety)
689 {
690 safety = s;
691 node = candidate;
692 }
693 }
694 }
695 // on none of the solids, the point was not on the surface
696 G4VSolid& solid = *fSolids[node];
698 localPoint = GetLocalPoint(transform, aPoint);
699
700 normal = GetGlobalVector(transform, solid.SurfaceNormal(localPoint));
701 return normal.unit();
702 }
703 else
704 {
705 // for the case when point is certainly outside:
706
707 // find a solid in union with the smallest safety
708 node = SafetyFromOutsideNumberNode(aPoint, safety);
709 G4VSolid& solid = *fSolids[node];
710
712 localPoint = GetLocalPoint(transform, aPoint);
713
714 // evaluate normal for point at this found solid
715 // and transform multi-union coordinates
716 normal = GetGlobalVector(transform, solid.SurfaceNormal(localPoint));
717
718 return normal.unit();
719 }
720}
static constexpr double s
Definition: G4SIunits.hh:154
G4int SafetyFromOutsideNumberNode(const G4ThreeVector &aPoint, G4double &safety) const
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:79

References G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), fSolids, fTransformObjs, fVoxels, G4Voxelizer::GetCandidatesVoxelArray(), GetGlobalVector(), GetLocalPoint(), G4VSolid::Inside(), kInfinity, kInside, kSurface, CLHEP::normal(), s, SafetyFromOutsideNumberNode(), G4VSolid::SurfaceNormal(), and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

◆ TransformLimits()

void G4MultiUnion::TransformLimits ( G4ThreeVector min,
G4ThreeVector max,
const G4Transform3D transformation 
) const
private

Definition at line 871 of file G4MultiUnion.cc.

873{
874 // The goal of this method is to convert the quantities min and max
875 // (representing the bounding box of a given solid in its local frame)
876 // to the main frame, using "transformation"
877
878 G4ThreeVector vertices[8] = // Detemination of the vertices thanks to
879 { // the extension of each solid:
880 G4ThreeVector(min.x(), min.y(), min.z()), // 1st vertice:
881 G4ThreeVector(min.x(), max.y(), min.z()), // 2nd vertice:
882 G4ThreeVector(max.x(), max.y(), min.z()),
883 G4ThreeVector(max.x(), min.y(), min.z()),
884 G4ThreeVector(min.x(), min.y(), max.z()),
885 G4ThreeVector(min.x(), max.y(), max.z()),
886 G4ThreeVector(max.x(), max.y(), max.z()),
887 G4ThreeVector(max.x(), min.y(), max.z())
888 };
889
892
893 // Loop on th vertices
894 G4int limit = sizeof(vertices) / sizeof(G4ThreeVector);
895 for (G4int i = 0 ; i < limit; ++i)
896 {
897 // From local frame to the global one:
898 // Current positions on the three axis:
899 G4ThreeVector current = GetGlobalPoint(transformation, vertices[i]);
900
901 // If need be, replacement of the min & max values:
902 if (current.x() > max.x()) max.setX(current.x());
903 if (current.x() < min.x()) min.setX(current.x());
904
905 if (current.y() > max.y()) max.setY(current.y());
906 if (current.y() < min.y()) min.setY(current.y());
907
908 if (current.z() > max.z()) max.setZ(current.z());
909 if (current.z() < min.z()) min.setZ(current.z());
910 }
911}

References GetGlobalPoint(), kInfinity, G4INCL::Math::max(), G4INCL::Math::min(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by Extent().

◆ Voxelize()

void G4MultiUnion::Voxelize ( )

Definition at line 821 of file G4MultiUnion.cc.

822{
824}
void Voxelize(std::vector< G4VSolid * > &solids, std::vector< G4Transform3D > &transforms)
Definition: G4Voxelizer.cc:713

References fSolids, fTransformObjs, fVoxels, and G4Voxelizer::Voxelize().

Referenced by G4tgbVolume::FindOrConstructG4Solid(), and G4GDMLReadSolids::MultiUnionRead().

Friends And Related Function Documentation

◆ G4Voxelizer

friend class G4Voxelizer
friend

Definition at line 55 of file G4MultiUnion.hh.

Field Documentation

◆ fAccurate

G4bool G4MultiUnion::fAccurate = false
mutableprivate

Definition at line 179 of file G4MultiUnion.hh.

Referenced by DistanceToIn(), SafetyFromOutsideNumberNode(), and SetAccurateSafety().

◆ fCubicVolume

G4double G4MultiUnion::fCubicVolume = 0.0
private

Definition at line 176 of file G4MultiUnion.hh.

Referenced by GetCubicVolume().

◆ fpPolyhedron

G4Polyhedron* G4MultiUnion::fpPolyhedron = nullptr
mutableprivate

Definition at line 182 of file G4MultiUnion.hh.

Referenced by GetPolyhedron().

◆ fRebuildPolyhedron

G4bool G4MultiUnion::fRebuildPolyhedron = false
mutableprivate

Definition at line 181 of file G4MultiUnion.hh.

Referenced by GetPolyhedron().

◆ fshapeName

G4String G4VSolid::fshapeName
privateinherited

Definition at line 312 of file G4VSolid.hh.

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

◆ fSolids

std::vector<G4VSolid*> G4MultiUnion::fSolids
private

◆ fSurfaceArea

G4double G4MultiUnion::fSurfaceArea = 0.0
private

Definition at line 177 of file G4MultiUnion.hh.

Referenced by GetSurfaceArea().

◆ fTransformObjs

std::vector<G4Transform3D> G4MultiUnion::fTransformObjs
private

◆ fVoxels

G4Voxelizer G4MultiUnion::fVoxels
private

◆ kCarTolerance

G4double G4VSolid::kCarTolerance
protectedinherited

Definition at line 299 of file G4VSolid.hh.

Referenced by G4TessellatedSolid::AddFacet(), G4Polycone::CalculateExtent(), G4Polyhedra::CalculateExtent(), G4Tet::CheckDegeneracy(), G4Para::CheckParameters(), G4Trd::CheckParameters(), G4Ellipsoid::CheckParameters(), G4EllipticalTube::CheckParameters(), G4GenericTrap::ComputeIsTwisted(), G4Polyhedra::Create(), G4GenericPolycone::Create(), G4Polycone::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(), G4Polycone::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(), G4Polycone::SetOriginalParameters(), G4Polyhedra::SetOriginalParameters(), G4Box::SetXHalfLength(), G4Box::SetYHalfLength(), G4Box::SetZHalfLength(), G4Torus::SurfaceNormal(), G4GenericTrap::SurfaceNormal(), and G4Paraboloid::SurfaceNormal().

◆ kRadTolerance

G4double G4MultiUnion::kRadTolerance
private

Definition at line 178 of file G4MultiUnion.hh.

Referenced by G4MultiUnion(), and InsideWithExclusion().


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