Geant4
9.6.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
//
27
// $Id$
28
//
29
// class G4SmartVoxelHeader
30
//
31
// Class description:
32
//
33
// Represents a set of voxels, created by a single axis of virtual division.
34
// Contains the individual voxels, which are potentially further divided
35
// along different axes.
36
//
37
// Member data:
38
//
39
// EAxis faxis
40
// - The (cartesian) slicing/division axis
41
// G4double fmaxExtent
42
// G4double fminExtent
43
// - Minimum and maximum coordiantes along the axis
44
// std::vector<G4SmartVoxelProxy*> fslices
45
// - The slices along the axis
46
//
47
// G4int fminEquivalent
48
// G4int fmaxEquivalent
49
// - Minimum and maximum equivalent slice nos.
50
// [Applies to the level of the header, not its nodes]
51
52
// History:
53
// 18.04.01 G.Cosmo Migrated to STL vector
54
// 13.07.95 P.Kent Initial version
55
// --------------------------------------------------------------------
56
#ifndef G4SMARTVOXELHEADER_HH
57
#define G4SMARTVOXELHEADER_HH
58
59
#include "
G4Types.hh
"
60
#include "
geomdefs.hh
"
61
62
#include "
G4SmartVoxelProxy.hh
"
63
#include "
G4SmartVoxelNode.hh
"
64
65
#include <vector>
66
67
// Forward declarations
68
class
G4LogicalVolume
;
69
class
G4VoxelLimits
;
70
class
G4VPhysicalVolume
;
71
72
// Typedefs
73
typedef
std::vector<G4SmartVoxelProxy*>
G4ProxyVector
;
74
typedef
std::vector<G4SmartVoxelNode*>
G4NodeVector
;
75
typedef
std::vector<G4int>
G4VolumeNosVector
;
76
typedef
std::vector<G4double>
G4VolumeExtentVector
;
77
78
class
G4SmartVoxelHeader
79
{
80
public
:
// with description
81
82
G4SmartVoxelHeader
(
G4LogicalVolume
* pVolume,
G4int
pSlice=0);
83
// Constructor for topmost header, to begin voxel construction at a
84
// given logical volume. pSlice is used to set max and min equivalent
85
// slice nos for the header - they apply to the level of the header,
86
// not its nodes.
87
88
~G4SmartVoxelHeader
();
89
// Delete all referenced nodes [but *not* referenced physical volumes].
90
91
G4int
GetMaxEquivalentSliceNo
()
const
;
92
void
SetMaxEquivalentSliceNo
(
G4int
pMax);
93
G4int
GetMinEquivalentSliceNo
()
const
;
94
void
SetMinEquivalentSliceNo
(
G4int
pMin);
95
// Access functions for min/max equivalent slices (nodes & headers).
96
97
EAxis
GetAxis
()
const
;
98
// Return the current division axis.
99
EAxis
GetParamAxis
()
const
;
100
// Return suggested division axis for parameterised volume.
101
102
G4double
GetMaxExtent
()
const
;
103
// Return the maximum coordinate limit along the current axis.
104
G4double
GetMinExtent
()
const
;
105
// Return the minimum coordinate limit along the current axis.
106
107
G4int
GetNoSlices
()
const
;
108
// Return the no of slices along the current axis.
109
110
G4SmartVoxelProxy
*
GetSlice
(
G4int
n)
const
;
111
// Return ptr to the proxy for the nth slice (numbering from 0,
112
// no bounds checking performed).
113
114
G4bool
AllSlicesEqual
()
const
;
115
// True if all slices equal (after collection).
116
117
public
:
// without description
118
119
G4bool
operator ==
(
const
G4SmartVoxelHeader
& pHead)
const
;
120
121
friend
std::ostream&
122
operator <<
(std::ostream&s,
const
G4SmartVoxelHeader
& h);
123
124
protected
:
125
126
G4SmartVoxelHeader
(
G4LogicalVolume
* pVolume,
127
const
G4VoxelLimits
& pLimits,
128
const
G4VolumeNosVector
* pCandidates,
129
G4int
pSlice=0);
130
// Build and refine voxels between specified limits, considering only
131
// the physical volumes numbered `pCandidates'. pSlice is used to set max
132
// and min equivalent slice nos for the header - they apply to the level
133
// of the header, not its nodes.
134
135
// `Worker' / operation functions:
136
137
void
BuildVoxels
(
G4LogicalVolume
* pVolume);
138
// Build and refine voxels for daughters of specified volume which
139
// DOES NOT contain a REPLICATED daughter.
140
141
void
BuildReplicaVoxels
(
G4LogicalVolume
* pVolume);
142
// Build voxels for specified volume containing a single
143
// replicated volume.
144
145
void
BuildConsumedNodes
(
G4int
nReplicas);
146
// Construct nodes in simple consuming case.
147
148
void
BuildVoxelsWithinLimits
(
G4LogicalVolume
* pVolume,
149
G4VoxelLimits
pLimits,
150
const
G4VolumeNosVector
* pCandidates);
151
// Build and refine voxels between specified limits, considering only
152
// the physical volumes `pCandidates'. Main entry point for "construction".
153
// Hardwired to stop at third level of refinement, using the xyz cartesian
154
// axes in any order.
155
156
void
BuildEquivalentSliceNos
();
157
// Calculate and Store the minimum and maximum equivalent neighbour
158
// values for all slices.
159
160
void
CollectEquivalentNodes
();
161
// Collect common nodes, deleting all but one to save memory,
162
// and adjusting stored slice ptrs appropriately.
163
164
void
CollectEquivalentHeaders
();
165
// Collect common headers, deleting all but one to save memory,
166
// and adjusting stored slice ptrs appropriately.
167
168
169
G4ProxyVector
*
BuildNodes
(
G4LogicalVolume
* pVolume,
170
G4VoxelLimits
pLimits,
171
const
G4VolumeNosVector
* pCandidates,
172
EAxis
pAxis);
173
// Build the nodes corresponding to the specified axis, within
174
// the specified limits, considering the daughters numbered pCandidates
175
// of the logical volume.
176
177
G4double
CalculateQuality
(
G4ProxyVector
*pSlice);
178
// Calculate a "quality value" for the specified vector of voxels
179
// The value returned should be >0 and such that the smaller the
180
// number the higher the quality of the slice.
181
// pSlice must consist of smartvoxelnodeproxies only.
182
183
void
RefineNodes
(
G4LogicalVolume
* pVolume,
G4VoxelLimits
pLimits);
184
// Examined each contained node, refine (create a replacement additional
185
// dimension of voxels) when there is more than one voxel in the slice.
186
187
G4int
fminEquivalent
;
188
G4int
fmaxEquivalent
;
189
// Min and max equivalent slice nos for previous level.
190
191
EAxis
faxis
,
fparamAxis
;
192
// Axis for slices.
193
194
G4double
fmaxExtent
;
195
G4double
fminExtent
;
196
// Max and min coordinate along faxis.
197
198
G4ProxyVector
fslices
;
199
// Slices along axis.
200
};
201
202
#include "G4SmartVoxelHeader.icc"
203
204
#endif
G4NodeVector
std::vector< G4SmartVoxelNode * > G4NodeVector
Definition:
G4SmartVoxelHeader.hh:74
G4VolumeNosVector
std::vector< G4int > G4VolumeNosVector
Definition:
G4SmartVoxelHeader.hh:75
G4ProxyVector
std::vector< G4SmartVoxelProxy * > G4ProxyVector
Definition:
G4SmartVoxelHeader.hh:73
G4VolumeExtentVector
std::vector< G4double > G4VolumeExtentVector
Definition:
G4SmartVoxelHeader.hh:76
G4SmartVoxelNode.hh
G4SmartVoxelProxy.hh
G4Types.hh
G4double
double G4double
Definition:
G4Types.hh:64
G4int
int G4int
Definition:
G4Types.hh:66
G4bool
bool G4bool
Definition:
G4Types.hh:67
G4LogicalVolume
Definition:
G4LogicalVolume.hh:134
G4SmartVoxelHeader
Definition:
G4SmartVoxelHeader.hh:79
G4SmartVoxelHeader::BuildNodes
G4ProxyVector * BuildNodes(G4LogicalVolume *pVolume, G4VoxelLimits pLimits, const G4VolumeNosVector *pCandidates, EAxis pAxis)
Definition:
G4SmartVoxelHeader.cc:750
G4SmartVoxelHeader::GetMaxEquivalentSliceNo
G4int GetMaxEquivalentSliceNo() const
G4SmartVoxelHeader::BuildEquivalentSliceNos
void BuildEquivalentSliceNos()
Definition:
G4SmartVoxelHeader.cc:583
G4SmartVoxelHeader::operator<<
friend std::ostream & operator<<(std::ostream &s, const G4SmartVoxelHeader &h)
Definition:
G4SmartVoxelHeader.cc:1304
G4SmartVoxelHeader::GetMaxExtent
G4double GetMaxExtent() const
G4SmartVoxelHeader::fminEquivalent
G4int fminEquivalent
Definition:
G4SmartVoxelHeader.hh:187
G4SmartVoxelHeader::SetMinEquivalentSliceNo
void SetMinEquivalentSliceNo(G4int pMin)
G4SmartVoxelHeader::GetMinExtent
G4double GetMinExtent() const
G4SmartVoxelHeader::CollectEquivalentNodes
void CollectEquivalentNodes()
Definition:
G4SmartVoxelHeader.cc:630
G4SmartVoxelHeader::BuildVoxelsWithinLimits
void BuildVoxelsWithinLimits(G4LogicalVolume *pVolume, G4VoxelLimits pLimits, const G4VolumeNosVector *pCandidates)
Definition:
G4SmartVoxelHeader.cc:443
G4SmartVoxelHeader::CalculateQuality
G4double CalculateQuality(G4ProxyVector *pSlice)
Definition:
G4SmartVoxelHeader.cc:1073
G4SmartVoxelHeader::GetAxis
EAxis GetAxis() const
G4SmartVoxelHeader::BuildReplicaVoxels
void BuildReplicaVoxels(G4LogicalVolume *pVolume)
Definition:
G4SmartVoxelHeader.cc:267
G4SmartVoxelHeader::~G4SmartVoxelHeader
~G4SmartVoxelHeader()
Definition:
G4SmartVoxelHeader.cc:127
G4SmartVoxelHeader::fmaxEquivalent
G4int fmaxEquivalent
Definition:
G4SmartVoxelHeader.hh:188
G4SmartVoxelHeader::fparamAxis
EAxis fparamAxis
Definition:
G4SmartVoxelHeader.hh:191
G4SmartVoxelHeader::operator==
G4bool operator==(const G4SmartVoxelHeader &pHead) const
Definition:
G4SmartVoxelHeader.cc:183
G4SmartVoxelHeader::GetSlice
G4SmartVoxelProxy * GetSlice(G4int n) const
G4SmartVoxelHeader::fmaxExtent
G4double fmaxExtent
Definition:
G4SmartVoxelHeader.hh:194
G4SmartVoxelHeader::fslices
G4ProxyVector fslices
Definition:
G4SmartVoxelHeader.hh:198
G4SmartVoxelHeader::BuildConsumedNodes
void BuildConsumedNodes(G4int nReplicas)
Definition:
G4SmartVoxelHeader.cc:395
G4SmartVoxelHeader::faxis
EAxis faxis
Definition:
G4SmartVoxelHeader.hh:191
G4SmartVoxelHeader::GetParamAxis
EAxis GetParamAxis() const
G4SmartVoxelHeader::GetNoSlices
G4int GetNoSlices() const
G4SmartVoxelHeader::AllSlicesEqual
G4bool AllSlicesEqual() const
Definition:
G4SmartVoxelHeader.cc:1281
G4SmartVoxelHeader::BuildVoxels
void BuildVoxels(G4LogicalVolume *pVolume)
Definition:
G4SmartVoxelHeader.cc:247
G4SmartVoxelHeader::GetMinEquivalentSliceNo
G4int GetMinEquivalentSliceNo() const
G4SmartVoxelHeader::SetMaxEquivalentSliceNo
void SetMaxEquivalentSliceNo(G4int pMax)
G4SmartVoxelHeader::fminExtent
G4double fminExtent
Definition:
G4SmartVoxelHeader.hh:195
G4SmartVoxelHeader::CollectEquivalentHeaders
void CollectEquivalentHeaders()
Definition:
G4SmartVoxelHeader.cc:677
G4SmartVoxelHeader::RefineNodes
void RefineNodes(G4LogicalVolume *pVolume, G4VoxelLimits pLimits)
Definition:
G4SmartVoxelHeader.cc:1139
G4SmartVoxelProxy
Definition:
G4SmartVoxelProxy.hh:55
G4VPhysicalVolume
Definition:
G4VPhysicalVolume.hh:60
G4VoxelLimits
Definition:
G4VoxelLimits.hh:63
geomdefs.hh
EAxis
EAxis
Definition:
geomdefs.hh:54
geant4-v9.6.0
source
geometry
management
include
G4SmartVoxelHeader.hh
Generated by
1.9.6