Geant4
10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SmartVoxelHeader.hh
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
// G4SmartVoxelHeader
27
//
28
// Class description:
29
//
30
// Represents a set of voxels, created by a single axis of virtual division.
31
// Contains the individual voxels, which are potentially further divided
32
// along different axes.
33
//
34
// Member data:
35
//
36
// EAxis faxis
37
// - The (cartesian) slicing/division axis
38
// G4double fmaxExtent
39
// G4double fminExtent
40
// - Minimum and maximum coordiantes along the axis
41
// std::vector<G4SmartVoxelProxy*> fslices
42
// - The slices along the axis
43
//
44
// G4int fminEquivalent
45
// G4int fmaxEquivalent
46
// - Minimum and maximum equivalent slice nos.
47
// [Applies to the level of the header, not its nodes]
48
49
// 18.04.01, G.Cosmo - Migrated to STL vector
50
// 13.07.95, P.Kent - Initial version
51
// --------------------------------------------------------------------
52
#ifndef G4SMARTVOXELHEADER_HH
53
#define G4SMARTVOXELHEADER_HH
54
55
#include "
G4Types.hh
"
56
#include "
geomdefs.hh
"
57
58
#include "
G4SmartVoxelProxy.hh
"
59
#include "
G4SmartVoxelNode.hh
"
60
61
#include <vector>
62
63
// Forward declarations
64
class
G4LogicalVolume
;
65
class
G4VoxelLimits
;
66
class
G4VPhysicalVolume
;
67
68
// Aliases
69
using
G4ProxyVector
= std::vector<G4SmartVoxelProxy*>;
70
using
G4NodeVector
= std::vector<G4SmartVoxelNode*>;
71
using
G4VolumeNosVector
= std::vector<G4int>;
72
using
G4VolumeExtentVector
= std::vector<G4double>;
73
74
class
G4SmartVoxelHeader
75
{
76
public
:
// with description
77
78
G4SmartVoxelHeader
(
G4LogicalVolume
* pVolume,
G4int
pSlice = 0);
79
// Constructor for topmost header, to begin voxel construction at a
80
// given logical volume. pSlice is used to set max and min equivalent
81
// slice nos for the header - they apply to the level of the header,
82
// not its nodes.
83
84
~G4SmartVoxelHeader
();
85
// Delete all referenced nodes [but *not* referenced physical volumes].
86
87
G4int
GetMaxEquivalentSliceNo
()
const
;
88
void
SetMaxEquivalentSliceNo
(
G4int
pMax);
89
G4int
GetMinEquivalentSliceNo
()
const
;
90
void
SetMinEquivalentSliceNo
(
G4int
pMin);
91
// Access functions for min/max equivalent slices (nodes & headers).
92
93
EAxis
GetAxis
()
const
;
94
// Return the current division axis.
95
EAxis
GetParamAxis
()
const
;
96
// Return suggested division axis for parameterised volume.
97
98
G4double
GetMaxExtent
()
const
;
99
// Return the maximum coordinate limit along the current axis.
100
G4double
GetMinExtent
()
const
;
101
// Return the minimum coordinate limit along the current axis.
102
103
size_t
GetNoSlices
()
const
;
104
// Return the no of slices along the current axis.
105
106
G4SmartVoxelProxy
*
GetSlice
(
G4int
n)
const
;
107
// Return ptr to the proxy for the nth slice (numbering from 0,
108
// no bounds checking performed).
109
110
G4bool
AllSlicesEqual
()
const
;
111
// True if all slices equal (after collection).
112
113
public
:
// without description
114
115
G4bool
operator ==
(
const
G4SmartVoxelHeader
& pHead)
const
;
116
117
friend
std::ostream&
118
operator <<
(std::ostream&s,
const
G4SmartVoxelHeader
& h);
119
120
G4SmartVoxelHeader
(
G4LogicalVolume
* pVolume,
121
const
G4VoxelLimits
& pLimits,
122
const
G4VolumeNosVector
* pCandidates,
123
G4int
pSlice = 0);
124
// Build and refine voxels between specified limits, considering only
125
// the physical volumes numbered `pCandidates'. pSlice is used to set max
126
// and min equivalent slice nos for the header - they apply to the level
127
// of the header, not its nodes.
128
129
protected
:
130
131
// `Worker' / operation functions:
132
133
void
BuildVoxels
(
G4LogicalVolume
* pVolume);
134
// Build and refine voxels for daughters of specified volume which
135
// DOES NOT contain a REPLICATED daughter.
136
137
void
BuildReplicaVoxels
(
G4LogicalVolume
* pVolume);
138
// Build voxels for specified volume containing a single
139
// replicated volume.
140
141
void
BuildConsumedNodes
(
G4int
nReplicas);
142
// Construct nodes in simple consuming case.
143
144
void
BuildVoxelsWithinLimits
(
G4LogicalVolume
* pVolume,
145
G4VoxelLimits
pLimits,
146
const
G4VolumeNosVector
* pCandidates);
147
// Build and refine voxels between specified limits, considering only
148
// the physical volumes `pCandidates'. Main entry point for "construction".
149
// Hardwired to stop at third level of refinement, using the xyz cartesian
150
// axes in any order.
151
152
void
BuildEquivalentSliceNos
();
153
// Calculate and Store the minimum and maximum equivalent neighbour
154
// values for all slices.
155
156
void
CollectEquivalentNodes
();
157
// Collect common nodes, deleting all but one to save memory,
158
// and adjusting stored slice ptrs appropriately.
159
160
void
CollectEquivalentHeaders
();
161
// Collect common headers, deleting all but one to save memory,
162
// and adjusting stored slice ptrs appropriately.
163
164
165
G4ProxyVector
*
BuildNodes
(
G4LogicalVolume
* pVolume,
166
G4VoxelLimits
pLimits,
167
const
G4VolumeNosVector
* pCandidates,
168
EAxis
pAxis);
169
// Build the nodes corresponding to the specified axis, within
170
// the specified limits, considering the daughters numbered pCandidates
171
// of the logical volume.
172
173
G4double
CalculateQuality
(
G4ProxyVector
*pSlice);
174
// Calculate a "quality value" for the specified vector of voxels
175
// The value returned should be >0 and such that the smaller the
176
// number the higher the quality of the slice.
177
// pSlice must consist of smartvoxelnodeproxies only.
178
179
void
RefineNodes
(
G4LogicalVolume
* pVolume,
G4VoxelLimits
pLimits);
180
// Examined each contained node, refine (create a replacement additional
181
// dimension of voxels) when there is more than one voxel in the slice.
182
183
G4int
fminEquivalent
;
184
G4int
fmaxEquivalent
;
185
// Min and max equivalent slice nos for previous level.
186
187
EAxis
faxis
,
fparamAxis
;
188
// Axis for slices.
189
190
G4double
fmaxExtent
;
191
G4double
fminExtent
;
192
// Max and min coordinate along faxis.
193
194
G4ProxyVector
fslices
;
195
// Slices along axis.
196
};
197
198
#include "G4SmartVoxelHeader.icc"
199
200
#endif
G4ProxyVector
std::vector< G4SmartVoxelProxy * > G4ProxyVector
Definition:
G4SmartVoxelHeader.hh:69
G4NodeVector
std::vector< G4SmartVoxelNode * > G4NodeVector
Definition:
G4SmartVoxelHeader.hh:70
G4VolumeExtentVector
std::vector< G4double > G4VolumeExtentVector
Definition:
G4SmartVoxelHeader.hh:72
G4VolumeNosVector
std::vector< G4int > G4VolumeNosVector
Definition:
G4SmartVoxelHeader.hh:71
G4SmartVoxelNode.hh
G4SmartVoxelProxy.hh
G4Types.hh
G4double
double G4double
Definition:
G4Types.hh:83
G4bool
bool G4bool
Definition:
G4Types.hh:86
G4int
int G4int
Definition:
G4Types.hh:85
G4LogicalVolume
Definition:
G4LogicalVolume.hh:183
G4SmartVoxelHeader
Definition:
G4SmartVoxelHeader.hh:75
G4SmartVoxelHeader::BuildNodes
G4ProxyVector * BuildNodes(G4LogicalVolume *pVolume, G4VoxelLimits pLimits, const G4VolumeNosVector *pCandidates, EAxis pAxis)
Definition:
G4SmartVoxelHeader.cc:742
G4SmartVoxelHeader::GetMaxEquivalentSliceNo
G4int GetMaxEquivalentSliceNo() const
G4SmartVoxelHeader::BuildEquivalentSliceNos
void BuildEquivalentSliceNos()
Definition:
G4SmartVoxelHeader.cc:575
G4SmartVoxelHeader::operator<<
friend std::ostream & operator<<(std::ostream &s, const G4SmartVoxelHeader &h)
Definition:
G4SmartVoxelHeader.cc:1296
G4SmartVoxelHeader::GetMaxExtent
G4double GetMaxExtent() const
G4SmartVoxelHeader::fminEquivalent
G4int fminEquivalent
Definition:
G4SmartVoxelHeader.hh:183
G4SmartVoxelHeader::SetMinEquivalentSliceNo
void SetMinEquivalentSliceNo(G4int pMin)
G4SmartVoxelHeader::GetMinExtent
G4double GetMinExtent() const
G4SmartVoxelHeader::CollectEquivalentNodes
void CollectEquivalentNodes()
Definition:
G4SmartVoxelHeader.cc:622
G4SmartVoxelHeader::BuildVoxelsWithinLimits
void BuildVoxelsWithinLimits(G4LogicalVolume *pVolume, G4VoxelLimits pLimits, const G4VolumeNosVector *pCandidates)
Definition:
G4SmartVoxelHeader.cc:436
G4SmartVoxelHeader::CalculateQuality
G4double CalculateQuality(G4ProxyVector *pSlice)
Definition:
G4SmartVoxelHeader.cc:1065
G4SmartVoxelHeader::GetAxis
EAxis GetAxis() const
G4SmartVoxelHeader::BuildReplicaVoxels
void BuildReplicaVoxels(G4LogicalVolume *pVolume)
Definition:
G4SmartVoxelHeader.cc:260
G4SmartVoxelHeader::~G4SmartVoxelHeader
~G4SmartVoxelHeader()
Definition:
G4SmartVoxelHeader.cc:120
G4SmartVoxelHeader::fmaxEquivalent
G4int fmaxEquivalent
Definition:
G4SmartVoxelHeader.hh:184
G4SmartVoxelHeader::fparamAxis
EAxis fparamAxis
Definition:
G4SmartVoxelHeader.hh:187
G4SmartVoxelHeader::operator==
G4bool operator==(const G4SmartVoxelHeader &pHead) const
Definition:
G4SmartVoxelHeader.cc:176
G4SmartVoxelHeader::GetSlice
G4SmartVoxelProxy * GetSlice(G4int n) const
G4SmartVoxelHeader::fmaxExtent
G4double fmaxExtent
Definition:
G4SmartVoxelHeader.hh:190
G4SmartVoxelHeader::fslices
G4ProxyVector fslices
Definition:
G4SmartVoxelHeader.hh:194
G4SmartVoxelHeader::BuildConsumedNodes
void BuildConsumedNodes(G4int nReplicas)
Definition:
G4SmartVoxelHeader.cc:388
G4SmartVoxelHeader::faxis
EAxis faxis
Definition:
G4SmartVoxelHeader.hh:187
G4SmartVoxelHeader::GetParamAxis
EAxis GetParamAxis() const
G4SmartVoxelHeader::AllSlicesEqual
G4bool AllSlicesEqual() const
Definition:
G4SmartVoxelHeader.cc:1273
G4SmartVoxelHeader::GetNoSlices
size_t GetNoSlices() const
G4SmartVoxelHeader::BuildVoxels
void BuildVoxels(G4LogicalVolume *pVolume)
Definition:
G4SmartVoxelHeader.cc:240
G4SmartVoxelHeader::GetMinEquivalentSliceNo
G4int GetMinEquivalentSliceNo() const
G4SmartVoxelHeader::SetMaxEquivalentSliceNo
void SetMaxEquivalentSliceNo(G4int pMax)
G4SmartVoxelHeader::fminExtent
G4double fminExtent
Definition:
G4SmartVoxelHeader.hh:191
G4SmartVoxelHeader::CollectEquivalentHeaders
void CollectEquivalentHeaders()
Definition:
G4SmartVoxelHeader.cc:669
G4SmartVoxelHeader::RefineNodes
void RefineNodes(G4LogicalVolume *pVolume, G4VoxelLimits pLimits)
Definition:
G4SmartVoxelHeader.cc:1131
G4SmartVoxelProxy
Definition:
G4SmartVoxelProxy.hh:49
G4VPhysicalVolume
Definition:
G4VPhysicalVolume.hh:79
G4VoxelLimits
Definition:
G4VoxelLimits.hh:53
geomdefs.hh
EAxis
EAxis
Definition:
geomdefs.hh:54
geant4-v10.7.0
source
geometry
management
include
G4SmartVoxelHeader.hh
Generated by
1.9.6