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

G4SmartVoxelNode defines a node in the smart voxel hierarchy, i.e. a 'slice' of space along a given axis between given minima and maxima. The node is not aware of its position - this information being available/derivable by the node's owner(s), the voxel headers. More...

#include <G4SmartVoxelNode.hh>

Public Member Functions

 G4SmartVoxelNode (G4int pSlice=0)
 ~G4SmartVoxelNode ()=default
G4bool operator== (const G4SmartVoxelNode &v) const
G4int GetVolume (G4int pVolumeNo) const
void Insert (G4int pVolumeNo)
std::size_t GetNoContained () const
std::size_t GetCapacity () const
void Reserve (G4int noSlices)
void Shrink ()
G4int GetMaxEquivalentSliceNo () const
void SetMaxEquivalentSliceNo (G4int pMax)
G4int GetMinEquivalentSliceNo () const
void SetMinEquivalentSliceNo (G4int pMin)

Detailed Description

G4SmartVoxelNode defines a node in the smart voxel hierarchy, i.e. a 'slice' of space along a given axis between given minima and maxima. The node is not aware of its position - this information being available/derivable by the node's owner(s), the voxel headers.

Definition at line 64 of file G4SmartVoxelNode.hh.

Constructor & Destructor Documentation

◆ G4SmartVoxelNode()

G4SmartVoxelNode::G4SmartVoxelNode ( G4int pSlice = 0)
inline

Constructor for G4SmartVoxelNode. It creates an empty node with slice number 'pSlice'; this number is not stored, but used to provide defaults for the minimum and maximum equivalent node numbers.

Parameters
[in]pSliceMax & min equivalent slice numbers for the header.

Referenced by operator==(), and ~G4SmartVoxelNode().

◆ ~G4SmartVoxelNode()

G4SmartVoxelNode::~G4SmartVoxelNode ( )
default

Default destructor.

Member Function Documentation

◆ GetCapacity()

std::size_t G4SmartVoxelNode::GetCapacity ( ) const
inline

Returns the maximum capacity of the buffer.

◆ GetMaxEquivalentSliceNo()

G4int G4SmartVoxelNode::GetMaxEquivalentSliceNo ( ) const
inline

Returns the maximum slice (node/header) number with the same contents and with all intermediate slice also having the same contents.

Referenced by G4VoxelSafety::SafetyForVoxelHeader().

◆ GetMinEquivalentSliceNo()

G4int G4SmartVoxelNode::GetMinEquivalentSliceNo ( ) const
inline

Returns the minimum slice (node/header) number with the same contents and with all intermediate nodes also having the same contents.

Referenced by G4VoxelSafety::SafetyForVoxelHeader().

◆ GetNoContained()

◆ GetVolume()

G4int G4SmartVoxelNode::GetVolume ( G4int pVolumeNo) const
inline

◆ Insert()

void G4SmartVoxelNode::Insert ( G4int pVolumeNo)
inline

Adds the specified volume number 'pVolumeNo' to the contents.

◆ operator==()

G4bool G4SmartVoxelNode::operator== ( const G4SmartVoxelNode & v) const

Equality operator.

Definition at line 41 of file G4SmartVoxelNode.cc.

42{
43 std::size_t maxNode = GetNoContained();
44 if (maxNode == v.GetNoContained())
45 {
46 for (std::size_t node=0; node<maxNode; ++node)
47 {
48 if (GetVolume((G4int)node) != v.GetVolume((G4int)node))
49 {
50 return false;
51 }
52 }
53 return true;
54 }
55 return false;
56}
int G4int
Definition G4Types.hh:85
G4int GetVolume(G4int pVolumeNo) const
std::size_t GetNoContained() const

◆ Reserve()

void G4SmartVoxelNode::Reserve ( G4int noSlices)
inline

Reserves memory in the vector of slices according to the specified quantity, relative to the maximum number of slices.

◆ SetMaxEquivalentSliceNo()

void G4SmartVoxelNode::SetMaxEquivalentSliceNo ( G4int pMax)
inline

Sets the maximum slice number (as above).

◆ SetMinEquivalentSliceNo()

void G4SmartVoxelNode::SetMinEquivalentSliceNo ( G4int pMin)
inline

Sets the minimum slice number (as above).

◆ Shrink()

void G4SmartVoxelNode::Shrink ( )
inline

Shrinks the buffer capacity to the actual size to reduce wasted memory.


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