Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SolidExtentList Class Reference

#include <G4SolidExtentList.hh>

Public Member Functions

 G4SolidExtentList ()
 
 G4SolidExtentList (const EAxis targetAxis, const G4VoxelLimits &voxelLimits)
 
 ~G4SolidExtentList ()
 
void AddSurface (const G4ClippablePolygon &surface)
 
G4bool GetExtent (G4double &min, G4double &max) const
 

Protected Attributes

EAxis axis
 
G4bool limited = false
 
G4double minLimit
 
G4double maxLimit
 
G4ClippablePolygon minSurface
 
G4ClippablePolygon maxSurface
 
G4ClippablePolygon minAbove
 
G4ClippablePolygon maxBelow
 

Detailed Description

Definition at line 45 of file G4SolidExtentList.hh.

Constructor & Destructor Documentation

◆ G4SolidExtentList() [1/2]

G4SolidExtentList::G4SolidExtentList ( )

Definition at line 37 of file G4SolidExtentList.cc.

38{
39 axis = kZAxis;
40 minLimit = -INT_MAX/2;
41 maxLimit = INT_MAX/2;
42}
@ kZAxis
Definition geomdefs.hh:57
#define INT_MAX
Definition templates.hh:90

◆ G4SolidExtentList() [2/2]

G4SolidExtentList::G4SolidExtentList ( const EAxis targetAxis,
const G4VoxelLimits & voxelLimits )

Definition at line 46 of file G4SolidExtentList.cc.

48{
49 axis = targetAxis;
50
51 limited = voxelLimits.IsLimited( axis );
52 if (limited)
53 {
54 minLimit = voxelLimits.GetMinExtent( axis );
55 maxLimit = voxelLimits.GetMaxExtent( axis );
56 }
57 else
58 {
59 minLimit = -INT_MAX/2;
60 maxLimit = INT_MAX/2;
61 }
62}
G4double GetMinExtent(const EAxis pAxis) const
G4double GetMaxExtent(const EAxis pAxis) const
G4bool IsLimited() const

◆ ~G4SolidExtentList()

G4SolidExtentList::~G4SolidExtentList ( )
default

Member Function Documentation

◆ AddSurface()

void G4SolidExtentList::AddSurface ( const G4ClippablePolygon & surface)

Definition at line 71 of file G4SolidExtentList.cc.

72{
73 //
74 // Keep track of four surfaces
75 //
76 G4double smin=.0, smax=0.;
77
78 surface.GetExtent( axis, smin, smax );
79
80 if (smin > maxLimit)
81 {
82 //
83 // Nearest surface beyond maximum limit
84 //
85 if (surface.InFrontOf(minAbove,axis)) minAbove = surface;
86 }
87 else if (smax < minLimit)
88 {
89 //
90 // Nearest surface below minimum limit
91 //
92 if (surface.BehindOf(maxBelow,axis)) maxBelow = surface;
93 }
94 else
95 {
96 //
97 // Max and min surfaces inside
98 //
99 if (surface.BehindOf(maxSurface,axis)) maxSurface = surface;
100 if (surface.InFrontOf(minSurface,axis)) minSurface = surface;
101 }
102}
double G4double
Definition G4Types.hh:83
virtual G4bool GetExtent(const EAxis axis, G4double &min, G4double &max) const
virtual G4bool InFrontOf(const G4ClippablePolygon &other, EAxis axis) const
virtual G4bool BehindOf(const G4ClippablePolygon &other, EAxis axis) const
G4ClippablePolygon minAbove
G4ClippablePolygon maxBelow
G4ClippablePolygon minSurface
G4ClippablePolygon maxSurface

Referenced by G4PolyconeSide::CalculateExtent(), G4PolyhedraSide::CalculateExtent(), and G4PolyPhiFace::CalculateExtent().

◆ GetExtent()

G4bool G4SolidExtentList::GetExtent ( G4double & min,
G4double & max ) const

Definition at line 108 of file G4SolidExtentList.cc.

109{
112 //
113 // Did we have any surfaces within the limits?
114 //
115 if (minSurface.Empty())
116 {
117 //
118 // Nothing! Do we have anything above?
119 //
120 if (minAbove.Empty()) return false;
121
122 //
123 // Yup. Is it facing inwards?
124 //
125 if (minAbove.GetNormal().operator()(axis) < 0) return false;
126
127 //
128 // No. We must be entirely within the solid
129 //
130 emax = maxLimit + kCarTolerance;
131 emin = minLimit - kCarTolerance;
132 return true;
133 }
134
135 //
136 // Check max surface
137 //
138 if (maxSurface.GetNormal().operator()(axis) < 0)
139 {
140 //
141 // Inward facing: max limit must be embedded within solid
142 //
143 emax = maxLimit + kCarTolerance;
144 }
145 else
146 {
147 G4double sMin=0., sMax=0.;
148 maxSurface.GetExtent( axis, sMin, sMax );
149 emax = ( (sMax > maxLimit) ? maxLimit : sMax ) + kCarTolerance;
150 }
151
152 //
153 // Check min surface
154 //
155 if (minSurface.GetNormal().operator()(axis) > 0)
156 {
157 //
158 // Inward facing: max limit must be embedded within solid
159 //
160 emin = minLimit - kCarTolerance;
161 }
162 else
163 {
164 G4double sMin=0., sMax=0.;
165 minSurface.GetExtent( axis, sMin, sMax );
166 emin = ( (sMin < minLimit) ? minLimit : sMin ) - kCarTolerance;
167 }
168
169 return true;
170}
const G4double kCarTolerance
G4bool Empty() const
const G4ThreeVector GetNormal() const
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()

Referenced by G4VCSGfaceted::CalculateExtent().

Member Data Documentation

◆ axis

EAxis G4SolidExtentList::axis
protected

Definition at line 60 of file G4SolidExtentList.hh.

Referenced by AddSurface(), G4SolidExtentList(), G4SolidExtentList(), and GetExtent().

◆ limited

G4bool G4SolidExtentList::limited = false
protected

Definition at line 61 of file G4SolidExtentList.hh.

Referenced by G4SolidExtentList().

◆ maxBelow

G4ClippablePolygon G4SolidExtentList::maxBelow
protected

Definition at line 68 of file G4SolidExtentList.hh.

Referenced by AddSurface().

◆ maxLimit

G4double G4SolidExtentList::maxLimit
protected

Definition at line 63 of file G4SolidExtentList.hh.

Referenced by AddSurface(), G4SolidExtentList(), G4SolidExtentList(), and GetExtent().

◆ maxSurface

G4ClippablePolygon G4SolidExtentList::maxSurface
protected

Definition at line 66 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().

◆ minAbove

G4ClippablePolygon G4SolidExtentList::minAbove
protected

Definition at line 67 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().

◆ minLimit

G4double G4SolidExtentList::minLimit
protected

Definition at line 62 of file G4SolidExtentList.hh.

Referenced by AddSurface(), G4SolidExtentList(), G4SolidExtentList(), and GetExtent().

◆ minSurface

G4ClippablePolygon G4SolidExtentList::minSurface
protected

Definition at line 65 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().


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