GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSPseudoRandomGenerator.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_RANDOMS_GGEMSPSEUDORANDOMGENERATOR_HH
2 #define GUARD_GGEMS_RANDOMS_GGEMSPSEUDORANDOMGENERATOR_HH
3 
4 // ************************************************************************
5 // * This file is part of GGEMS. *
6 // * *
7 // * GGEMS is free software: you can redistribute it and/or modify *
8 // * it under the terms of the GNU General Public License as published by *
9 // * the Free Software Foundation, either version 3 of the License, or *
10 // * (at your option) any later version. *
11 // * *
12 // * GGEMS is distributed in the hope that it will be useful, *
13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 // * GNU General Public License for more details. *
16 // * *
17 // * You should have received a copy of the GNU General Public License *
18 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
19 // * *
20 // ************************************************************************
21 
34 #include "GGEMS/global/GGEMSConfiguration.hh"
36 
41 class GGEMS_EXPORT GGEMSPseudoRandomGenerator
42 {
43  public:
48 
53 
54  public:
61 
68 
75 
82 
88  void Initialize(GGuint const& seed);
89 
95  void SetSeed(GGuint const& seed);
96 
101  void PrintInfos(void) const;
102 
109  inline cl::Buffer* GetPseudoRandomNumbers(GGsize const& thread_index) const {return pseudo_random_numbers_[thread_index];};
110 
111  private:
116  void AllocateRandom(void);
117 
122  void InitializeSeeds(void);
123 
129  GGuint GenerateSeed(void) const;
130 
131  private:
132  cl::Buffer** pseudo_random_numbers_;
135 };
136 
137 #endif // End of GUARD_GGEMS_RANDOMS_PSEUDO_RANDOM_GENERATOR_HH
GGEMSPseudoRandomGenerator::GGEMSPseudoRandomGenerator
GGEMSPseudoRandomGenerator(GGEMSPseudoRandomGenerator const &random)=delete
Avoid copy of the class by reference.
GGEMSPseudoRandomGenerator
Class managing the random number in GGEMS.
Definition: GGEMSPseudoRandomGenerator.hh:42
GGEMSPseudoRandomGenerator::SetSeed
void SetSeed(GGuint const &seed)
set the initial seed
GGEMSPseudoRandomGenerator::seed_
GGuint seed_
Definition: GGEMSPseudoRandomGenerator.hh:134
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
GGEMSPseudoRandomGenerator::number_activated_devices_
GGsize number_activated_devices_
Definition: GGEMSPseudoRandomGenerator.hh:133
GGEMSOpenCLManager.hh
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
GGEMSPseudoRandomGenerator::operator=
GGEMSPseudoRandomGenerator & operator=(GGEMSPseudoRandomGenerator const &&random)=delete
Avoid copy of the class by rvalue reference.
GGEMSPseudoRandomGenerator::operator=
GGEMSPseudoRandomGenerator & operator=(GGEMSPseudoRandomGenerator const &random)=delete
Avoid assignement of the class by reference.
GGEMSPseudoRandomGenerator::GetPseudoRandomNumbers
cl::Buffer * GetPseudoRandomNumbers(GGsize const &thread_index) const
return the pointer to OpenCL buffer storing random numbers
Definition: GGEMSPseudoRandomGenerator.hh:109
GGEMSPseudoRandomGenerator::pseudo_random_numbers_
cl::Buffer ** pseudo_random_numbers_
Definition: GGEMSPseudoRandomGenerator.hh:132
GGuint
#define GGuint
Definition: GGEMSTypes.hh:231
GGEMSPseudoRandomGenerator::GGEMSPseudoRandomGenerator
GGEMSPseudoRandomGenerator(GGEMSPseudoRandomGenerator const &&random)=delete
Avoid copy of the class by rvalue reference.