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

#include <LUPI_dataBuffer.hpp>

Public Types

enum class  Mode {
  Count , Pack , Unpack , Reset ,
  Memory
}

Public Member Functions

LUPI_HOST_DEVICE DataBuffer (void)
LUPI_HOST_DEVICE DataBuffer (DataBuffer const &rhs)
LUPI_HOST_DEVICE ~DataBuffer ()
LUPI_HOST_DEVICE void zeroIndexes (void)
LUPI_HOST_DEVICE void copyIndexes (DataBuffer const &a_input)
LUPI_HOST_DEVICE void simpleCopy (DataBuffer const &a_input)
LUPI_HOST_DEVICE void nullOutPointers (void)
LUPI_HOST_DEVICE void allocateBuffers (void)
LUPI_HOST_DEVICE void freeMemory (void)
LUPI_HOST_DEVICE bool compareIndexes (LUPI_maybeUnused char const *a_file, LUPI_maybeUnused int a_line, DataBuffer const &a_input)
LUPI_HOST_DEVICE void incrementPlacement (std::size_t a_delta)
LUPI_HOST_DEVICE void incrementSharedPlacement (std::size_t a_delta)
LUPI_HOST_DEVICE bool validate ()

Public Attributes

std::size_t m_intIndex
std::size_t m_floatIndex
std::size_t m_doubleIndex
std::size_t m_charIndex
std::size_t m_longIndex
std::size_t m_size_tIndex
int * m_intData
float * m_floatData
double * m_doubleData
char * m_charData
std::uint64_t * m_longData
std::size_t * m_size_tData
char * m_placementStart
char * m_placement
std::size_t m_maxPlacementSize
char * m_sharedPlacementStart
char * m_sharedPlacement
std::size_t m_sharedMaxPlacementSize

Detailed Description

Definition at line 25 of file LUPI_dataBuffer.hpp.

Member Enumeration Documentation

◆ Mode

enum class LUPI::DataBuffer::Mode
strong
Enumerator
Count 
Pack 
Unpack 
Reset 
Memory 

Definition at line 53 of file LUPI_dataBuffer.hpp.

53{ Count, Pack, Unpack, Reset, Memory };

Constructor & Destructor Documentation

◆ DataBuffer() [1/2]

LUPI_HOST_DEVICE LUPI::DataBuffer::DataBuffer ( void )
inline

Definition at line 55 of file LUPI_dataBuffer.hpp.

55 :
56 m_intIndex( 0 ),
57 m_floatIndex( 0 ),
58 m_doubleIndex( 0 ),
59 m_charIndex( 0 ),
60 m_longIndex( 0 ),
61 m_size_tIndex( 0 ),
62
63 m_intData( nullptr ),
64 m_floatData( nullptr ),
65 m_doubleData( nullptr ),
66 m_charData( nullptr ),
67 m_longData( nullptr ),
68 m_size_tData( nullptr ),
69
70 m_placementStart( nullptr ),
71 m_placement( nullptr ),
73 m_sharedPlacementStart( nullptr ),
74 m_sharedPlacement( nullptr ),
76 }
std::size_t * m_size_tData
std::size_t m_sharedMaxPlacementSize
std::size_t m_longIndex
std::uint64_t * m_longData
std::size_t m_size_tIndex
std::size_t m_maxPlacementSize
std::size_t m_doubleIndex
std::size_t m_floatIndex
std::size_t m_charIndex

Referenced by compareIndexes(), copyIndexes(), DataBuffer(), and simpleCopy().

◆ DataBuffer() [2/2]

LUPI_HOST_DEVICE LUPI::DataBuffer::DataBuffer ( DataBuffer const & rhs)
inline

Definition at line 78 of file LUPI_dataBuffer.hpp.

78 :
79 m_intIndex( 0 ),
80 m_floatIndex( 0 ),
81 m_doubleIndex( 0 ),
82 m_charIndex( 0 ),
83 m_longIndex( 0 ),
84 m_size_tIndex( 0 ),
85
86 m_intData( nullptr ),
87 m_floatData( nullptr ),
88 m_doubleData( nullptr ),
89 m_charData( nullptr ),
90 m_longData( nullptr ),
91 m_size_tData( nullptr ),
92
93 m_placementStart( nullptr ),
94 m_placement( nullptr ),
96 m_sharedPlacementStart( nullptr ),
97 m_sharedPlacement( nullptr ),
99
100 if( rhs.m_placementStart == nullptr ) m_placementStart = rhs.m_placementStart; // Only to stop compiler warning of unused variable as cannot get [[maybe_unused]] to work.
101
102 }

◆ ~DataBuffer()

LUPI_HOST_DEVICE LUPI::DataBuffer::~DataBuffer ( )
inline

Definition at line 104 of file LUPI_dataBuffer.hpp.

104 {
105
106 delete [] m_intData;
107 delete [] m_floatData;
108 delete [] m_doubleData;
109 delete [] m_charData;
110 delete [] m_longData;
111 delete [] m_size_tData;
112 }

Member Function Documentation

◆ allocateBuffers()

LUPI_HOST_DEVICE void LUPI::DataBuffer::allocateBuffers ( void )
inline

Definition at line 164 of file LUPI_dataBuffer.hpp.

164 {
165
166 m_intData = new int[m_intIndex];
167 m_floatData = new float[m_floatIndex];
168 m_doubleData = new double[m_doubleIndex];
169 m_charData = new char[m_charIndex];
170 m_longData = new std::uint64_t[m_longIndex];
171 m_size_tData = new std::size_t[m_size_tIndex];
172 }

◆ compareIndexes()

LUPI_HOST_DEVICE bool LUPI::DataBuffer::compareIndexes ( LUPI_maybeUnused char const * a_file,
LUPI_maybeUnused int a_line,
DataBuffer const & a_input )
inline

Definition at line 187 of file LUPI_dataBuffer.hpp.

187 {
188
189 return( ( a_input.m_intIndex == m_intIndex ) && ( a_input.m_floatIndex == m_floatIndex ) &&
190 ( a_input.m_doubleIndex == m_doubleIndex ) &&
191 ( a_input.m_charIndex == m_charIndex ) && ( a_input.m_longIndex == m_longIndex ) &&
192 ( a_input.m_size_tIndex == m_size_tIndex ) );
193 }

◆ copyIndexes()

LUPI_HOST_DEVICE void LUPI::DataBuffer::copyIndexes ( DataBuffer const & a_input)
inline

Definition at line 119 of file LUPI_dataBuffer.hpp.

119 {
120
121 m_intIndex = a_input.m_intIndex;
122 m_floatIndex = a_input.m_floatIndex;
123 m_doubleIndex = a_input.m_doubleIndex;
124 m_charIndex = a_input.m_charIndex;
125 m_longIndex = a_input.m_longIndex;
126 m_size_tIndex = a_input.m_size_tIndex;
127 }

◆ freeMemory()

LUPI_HOST_DEVICE void LUPI::DataBuffer::freeMemory ( void )
inline

Definition at line 174 of file LUPI_dataBuffer.hpp.

174 {
175
176 delete [] m_intData;
177 delete [] m_floatData;
178 delete [] m_doubleData;
179 delete [] m_charData;
180 delete [] m_longData;
181 delete [] m_size_tData;
182
183 zeroIndexes( );
185 }
LUPI_HOST_DEVICE void nullOutPointers(void)
LUPI_HOST_DEVICE void zeroIndexes(void)

◆ incrementPlacement()

◆ incrementSharedPlacement()

LUPI_HOST_DEVICE void LUPI::DataBuffer::incrementSharedPlacement ( std::size_t a_delta)
inline

Definition at line 202 of file LUPI_dataBuffer.hpp.

202 {
203
204 std::size_t sub = a_delta % 8;
205 if (sub != 0) a_delta += (8-sub);
206 m_sharedPlacement += a_delta;
207 }

◆ nullOutPointers()

LUPI_HOST_DEVICE void LUPI::DataBuffer::nullOutPointers ( void )
inline

Definition at line 154 of file LUPI_dataBuffer.hpp.

154 {
155
156 m_intData = nullptr;
157 m_floatData = nullptr;
158 m_doubleData = nullptr;
159 m_charData = nullptr;
160 m_longData = nullptr;
161 m_size_tData = nullptr;
162 }

Referenced by freeMemory().

◆ simpleCopy()

LUPI_HOST_DEVICE void LUPI::DataBuffer::simpleCopy ( DataBuffer const & a_input)
inline

Definition at line 129 of file LUPI_dataBuffer.hpp.

129 {
130
131 m_intIndex = a_input.m_intIndex;
132 m_floatIndex = a_input.m_floatIndex;
133 m_doubleIndex = a_input.m_doubleIndex;
134 m_charIndex = a_input.m_charIndex;
135 m_longIndex = a_input.m_longIndex;
136 m_size_tIndex = a_input.m_size_tIndex;
137
138 m_intData = a_input.m_intData;
139 m_floatData = a_input.m_floatData;
140 m_doubleData = a_input.m_doubleData;
141 m_charData = a_input.m_charData;
142 m_longData = a_input.m_longData;
143 m_size_tData = a_input.m_size_tData;
144
145 m_placementStart = a_input.m_placementStart;
146 m_placement = a_input.m_placement;
147 m_maxPlacementSize = a_input.m_maxPlacementSize;
148 m_sharedPlacementStart = a_input.m_sharedPlacementStart;
149 m_sharedPlacement = a_input.m_sharedPlacement;
150 m_sharedMaxPlacementSize = a_input.m_sharedMaxPlacementSize;
151 }

◆ validate()

LUPI_HOST_DEVICE bool LUPI::DataBuffer::validate ( )
inline

Definition at line 210 of file LUPI_dataBuffer.hpp.

210 {
211
212 if (m_placementStart == 0 && m_sharedPlacementStart == 0) return true;
213 if (m_placement > m_maxPlacementSize + m_placementStart) return false;
215 return true;
216 }

◆ zeroIndexes()

LUPI_HOST_DEVICE void LUPI::DataBuffer::zeroIndexes ( void )
inline

Definition at line 114 of file LUPI_dataBuffer.hpp.

Referenced by freeMemory().

Member Data Documentation

◆ m_charData

char* LUPI::DataBuffer::m_charData

◆ m_charIndex

std::size_t LUPI::DataBuffer::m_charIndex

◆ m_doubleData

double* LUPI::DataBuffer::m_doubleData

◆ m_doubleIndex

std::size_t LUPI::DataBuffer::m_doubleIndex

◆ m_floatData

float* LUPI::DataBuffer::m_floatData

◆ m_floatIndex

std::size_t LUPI::DataBuffer::m_floatIndex

◆ m_intData

int* LUPI::DataBuffer::m_intData

◆ m_intIndex

std::size_t LUPI::DataBuffer::m_intIndex

◆ m_longData

std::uint64_t* LUPI::DataBuffer::m_longData

◆ m_longIndex

std::size_t LUPI::DataBuffer::m_longIndex

◆ m_maxPlacementSize

std::size_t LUPI::DataBuffer::m_maxPlacementSize

Definition at line 45 of file LUPI_dataBuffer.hpp.

Referenced by DataBuffer(), DataBuffer(), simpleCopy(), and validate().

◆ m_placement

char* LUPI::DataBuffer::m_placement

Definition at line 44 of file LUPI_dataBuffer.hpp.

Referenced by DataBuffer(), DataBuffer(), MCGIDI::Protare::incrementMemorySize(), incrementPlacement(), MCGIDI::Protare::memorySize(), MCGIDI::ACE_URR_probabilityTables::serialize(), MCGIDI::Functions::Regions1d::serialize(), MCGIDI::Functions::XYs2d::serialize(), MCGIDI::GRIN_capture::serialize(), MCGIDI::GRIN_captureLevelProbability::serialize(), MCGIDI::GRIN_inelastic::serialize(), MCGIDI::HeatedCrossSectionContinuousEnergy::serialize(), MCGIDI::HeatedCrossSectionMultiGroup::serialize(), MCGIDI::HeatedCrossSectionsContinuousEnergy::serialize(), MCGIDI::HeatedCrossSectionsMultiGroup::serialize(), MCGIDI::Probabilities::Regions2d::serialize(), MCGIDI::Probabilities::WeightedFunctionals2d::serialize(), MCGIDI::Probabilities::XYs2d::serialize(), MCGIDI::Probabilities::XYs3d::serialize(), MCGIDI::Product::serialize(), MCGIDI::Reaction::serialize(), MCGIDI::URR_protareInfos::serialize(), MCGIDI::ProtareComposite::serialize2(), MCGIDI::ProtareSingle::serialize2(), MCGIDI::ProtareTNSL::serialize2(), MCGIDI::serializeACE_URR_probabilityTables(), MCGIDI::serializeDelayedNeutrons(), MCGIDI::serializeDistribution(), MCGIDI::serializeFunction1d(), MCGIDI::serializeFunction1d_d1(), MCGIDI::serializeFunction1d_d2(), MCGIDI::serializeFunction2d(), MCGIDI::Sampling::Upscatter::serializeModelDBRC_data(), MCGIDI::serializeProbability1d(), MCGIDI::serializeProbability2d(), MCGIDI::serializeProbability2d_d1(), MCGIDI::serializeProbability2d_d2(), MCGIDI::serializeProbability3d(), MCGIDI::serializeProducts(), MCGIDI::serializeQs(), simpleCopy(), and validate().

◆ m_placementStart

char* LUPI::DataBuffer::m_placementStart

◆ m_sharedMaxPlacementSize

std::size_t LUPI::DataBuffer::m_sharedMaxPlacementSize

Definition at line 51 of file LUPI_dataBuffer.hpp.

Referenced by DataBuffer(), DataBuffer(), simpleCopy(), and validate().

◆ m_sharedPlacement

◆ m_sharedPlacementStart

char* LUPI::DataBuffer::m_sharedPlacementStart

◆ m_size_tData

std::size_t* LUPI::DataBuffer::m_size_tData

◆ m_size_tIndex

std::size_t LUPI::DataBuffer::m_size_tIndex

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