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

G4SolidExtentList is utility class designed for calculating the extent of a CSG-like solid for a voxel. More...

#include <G4SolidExtentList.hh>

Public Member Functions

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

Detailed Description

G4SolidExtentList is utility class designed for calculating the extent of a CSG-like solid for a voxel.

Definition at line 50 of file G4SolidExtentList.hh.

Constructor & Destructor Documentation

◆ G4SolidExtentList() [1/2]

G4SolidExtentList::G4SolidExtentList ( )

Default Constructor.

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 )

Constructor provided axis and limits.

Parameters
[in]targetAxisAxis along which compute the extent.
[in]voxelLimitsThe limiting space dictated by voxels.

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

Default Destructor.

Member Function Documentation

◆ AddSurface()

void G4SolidExtentList::AddSurface ( const G4ClippablePolygon & surface)

Categorises polygon surfaces.

Definition at line 67 of file G4SolidExtentList.cc.

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

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

◆ GetExtent()

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

Returns extent after processing all surfaces.

Parameters
[out]minThe minimum extent
[out]maxThe maximum extent
Returns
false if no surfaces within limits or facing inwards.

Definition at line 104 of file G4SolidExtentList.cc.

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

Referenced by G4VCSGfaceted::CalculateExtent().


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