Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UniformRandPool.cc File Reference
#include "G4UniformRandPool.hh"
#include "G4AutoDelete.hh"
#include "G4Threading.hh"
#include "globals.hh"
#include <algorithm>
#include <climits>
#include <cstdlib>
#include <cstring>

Go to the source code of this file.

Functions

void create_pool (G4double *&buffer, G4int ps)
 
void destroy_pool (G4double *&buffer)
 
void create_pool_align (G4double *&buffer, G4int ps)
 
void destroy_pool_align (G4double *&buffer)
 

Function Documentation

◆ create_pool()

void create_pool ( G4double *& buffer,
G4int ps )

Definition at line 46 of file G4UniformRandPool.cc.

46{ buffer = new G4double[ps]; }
double G4double
Definition G4Types.hh:83

Referenced by G4UniformRandPool::G4UniformRandPool(), G4UniformRandPool::G4UniformRandPool(), and G4UniformRandPool::Resize().

◆ create_pool_align()

void create_pool_align ( G4double *& buffer,
G4int ps )

Definition at line 60 of file G4UniformRandPool.cc.

61{
62 // POSIX standard way
63 G4int errcode = posix_memalign((void**) &buffer, sizeof(G4double) * CHAR_BIT,
64 ps * sizeof(G4double));
65 if(errcode != 0)
66 {
67 G4Exception("G4UniformRandPool::create_pool_align()", "InvalidCondition",
68 FatalException, "Cannot allocate aligned buffer");
69 return;
70 }
71 return;
72}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
int G4int
Definition G4Types.hh:85

Referenced by G4UniformRandPool::G4UniformRandPool(), and G4UniformRandPool::G4UniformRandPool().

◆ destroy_pool()

void destroy_pool ( G4double *& buffer)

Definition at line 48 of file G4UniformRandPool.cc.

48{ delete[] buffer; }

Referenced by G4UniformRandPool::Resize(), and G4UniformRandPool::~G4UniformRandPool().

◆ destroy_pool_align()

void destroy_pool_align ( G4double *& buffer)

Definition at line 74 of file G4UniformRandPool.cc.

74{ free(buffer); }

Referenced by G4UniformRandPool::~G4UniformRandPool().