42#ifndef G4SurfaceVoxelizer_HH
43#define G4SurfaceVoxelizer_HH
77 void Voxelize(std::vector<G4VFacet *> &facets);
91 std::vector<G4int> &list,
97 std::vector<G4int> &list,
100 std::vector<G4int> &list,
103 inline const std::vector<G4VoxelBox> &
GetBoxes()
const;
111 std::vector<G4int> &curVoxel)
const;
122 const std::vector<G4int> &curVoxel)
const;
146 inline long long CountVoxels(std::vector<G4double> boundaries[])
const;
149 std::vector<G4int> *&candidates,
150 std::vector<G4int> &space)
const;
151 inline const std::vector<G4int> &
169 class G4VoxelComparator
173 std::vector<G4VoxelInfo> &fVoxels;
175 G4VoxelComparator(std::vector<G4VoxelInfo> &voxels) : fVoxels(voxels) {}
181 G4int right = rv.count + fVoxels[rv.next].count;
182 return (left == right) ? l < r : left < right;
188 static int fDefaultVoxelsCount;
194 void CreateSortedBoundary(std::vector<G4double> &boundaryRaw,
G4int axis);
196 void BuildBoundaries();
198 void BuildReduceVoxels(std::vector<G4double> fBoundaries[],
200 void BuildReduceVoxels2(std::vector<G4double> fBoundaries[],
203 void BuildVoxelLimits(std::vector<G4VFacet *> &facets);
207 void BuildBitmasks(std::vector<G4double> fBoundaries[],
210 void BuildBoundingBox();
214 void CreateMiniVoxels(std::vector<G4double> fBoundaries[],
216 static void FindComponentsFastest(
unsigned int mask,
217 std::vector<G4int> &list,
G4int i);
221 std::vector<G4VoxelBox> fVoxelBoxes;
222 std::vector<std::vector<G4int> > fVoxelBoxesCandidates;
223 mutable std::map<G4int, std::vector<G4int> > fCandidates;
225 const std::vector<G4int> fNoCandidates;
227 long long fCountOfVoxels;
231 std::vector<G4VoxelBox> fBoxes;
234 std::vector<G4double> fBoundaries[3];
237 std::vector<G4int> fCandidatesCounts[3];
239 G4int fTotalCandidates;
258#include "G4SurfaceVoxelizer.icc"
const std::vector< G4int > & GetCandidates(std::vector< G4int > &curVoxel) const
G4int GetMaxVoxels(G4ThreeVector &ratioOfReduction)
G4bool Contains(const G4ThreeVector &point) const
G4int GetVoxelsIndex(const std::vector< G4int > &voxels) const
G4int GetCandidates(std::vector< G4int > &curVoxel, std::vector< G4int > *&candidates, std::vector< G4int > &space) const
G4bool UpdateCurrentVoxel(const G4ThreeVector &point, const G4ThreeVector &direction, std::vector< G4int > &curVoxel) const
G4int GetPointIndex(const G4ThreeVector &p) const
void DisplayVoxelLimits()
long long GetCountOfVoxels() const
G4double DistanceToBoundingBox(const G4ThreeVector &point) const
void SetMaxVoxels(G4int max)
G4double DistanceToNext(const G4ThreeVector &point, const G4ThreeVector &direction, const std::vector< G4int > &curVoxel) const
const G4VoxelBox & GetVoxelBox(G4int i) const
G4int GetCandidatesVoxelArray(const G4ThreeVector &point, std::vector< G4int > &list, G4SurfBits *crossed=0) const
G4int GetVoxelsIndex(G4int x, G4int y, G4int z) const
static G4double MinDistanceToBox(const G4ThreeVector &aPoint, const G4ThreeVector &f)
G4double DistanceToFirst(const G4ThreeVector &point, const G4ThreeVector &direction) const
static G4int SetDefaultVoxelsCount(G4int count)
void Voxelize(std::vector< G4VFacet * > &facets)
void GetVoxel(std::vector< G4int > &curVoxel, const G4ThreeVector &point) const
G4int GetBitsPerSlice() const
const std::vector< G4VoxelBox > & GetBoxes() const
G4int GetVoxelBoxesSize() const
G4bool IsEmpty(G4int index) const
long long CountVoxels(std::vector< G4double > boundaries[]) const
const std::vector< G4double > & GetBoundary(G4int index) const
static G4int BinarySearch(const std::vector< T > &vec, T value)
const G4SurfBits & Empty() const
void GetCandidatesVoxel(std::vector< G4int > &voxels)
static G4int GetDefaultVoxelsCount()
const std::vector< G4int > & GetVoxelBoxCandidates(G4int i) const
friend class G4VoxelCandidatesIterator