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
64class G4LogicalVolume;
65class G4VoxelLimits;
67
68// Aliases
69using G4ProxyVector = std::vector<G4SmartVoxelProxy*>;
70using G4NodeVector = std::vector<G4SmartVoxelNode*>;
71using G4VolumeNosVector = std::vector<G4int>;
72using G4VolumeExtentVector = std::vector<G4double>;
73
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
85 // Delete all referenced nodes [but *not* referenced physical volumes].
86
91 // Access functions for min/max equivalent slices (nodes & headers).
92
93 EAxis GetAxis() const;
94 // Return the current division axis.
96 // Return suggested division axis for parameterised volume.
97
99 // Return the maximum coordinate limit along the current axis.
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
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
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
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
153 // Calculate and Store the minimum and maximum equivalent neighbour
154 // values for all slices.
155
157 // Collect common nodes, deleting all but one to save memory,
158 // and adjusting stored slice ptrs appropriately.
159
161 // Collect common headers, deleting all but one to save memory,
162 // and adjusting stored slice ptrs appropriately.
163
164
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
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
185 // Min and max equivalent slice nos for previous level.
186
188 // Axis for slices.
189
192 // Max and min coordinate along faxis.
193
195 // Slices along axis.
196};
197
198#include "G4SmartVoxelHeader.icc"
199
200#endif
std::vector< G4SmartVoxelProxy * > G4ProxyVector
std::vector< G4SmartVoxelNode * > G4NodeVector
std::vector< G4double > G4VolumeExtentVector
std::vector< G4int > G4VolumeNosVector
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4ProxyVector * BuildNodes(G4LogicalVolume *pVolume, G4VoxelLimits pLimits, const G4VolumeNosVector *pCandidates, EAxis pAxis)
G4int GetMaxEquivalentSliceNo() const
friend std::ostream & operator<<(std::ostream &s, const G4SmartVoxelHeader &h)
G4double GetMaxExtent() const
void SetMinEquivalentSliceNo(G4int pMin)
G4double GetMinExtent() const
void BuildVoxelsWithinLimits(G4LogicalVolume *pVolume, G4VoxelLimits pLimits, const G4VolumeNosVector *pCandidates)
G4double CalculateQuality(G4ProxyVector *pSlice)
EAxis GetAxis() const
void BuildReplicaVoxels(G4LogicalVolume *pVolume)
G4bool operator==(const G4SmartVoxelHeader &pHead) const
G4SmartVoxelProxy * GetSlice(G4int n) const
void BuildConsumedNodes(G4int nReplicas)
EAxis GetParamAxis() const
G4bool AllSlicesEqual() const
size_t GetNoSlices() const
void BuildVoxels(G4LogicalVolume *pVolume)
G4int GetMinEquivalentSliceNo() const
void SetMaxEquivalentSliceNo(G4int pMax)
void RefineNodes(G4LogicalVolume *pVolume, G4VoxelLimits pLimits)
EAxis
Definition: geomdefs.hh:54