Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-26 07:50:30

0001 #include <curand_kernel.h>
0002 
0003 #include "srng.h"
0004 #include "storch.h"
0005 #include "torch.h"
0006 
0007 using namespace std;
0008 
0009 vector<sphoton> generate_photons(const storch& torch, unsigned int num_photons, unsigned int seed)
0010 {
0011     curandStatePhilox4_32_10 rng;
0012     curand_init(seed, 0, 0, &rng);
0013 
0014     if (num_photons == 0)
0015     {
0016         num_photons = torch.numphoton;
0017     }
0018 
0019     vector<sphoton> photons;
0020     int             unused = -1;
0021     qtorch          qt{.t = torch};
0022 
0023     for (unsigned int i = 0; i < num_photons; i++)
0024     {
0025         sphoton photon;
0026         storch::generate(photon, rng, qt.q, unused, unused);
0027         photons.push_back(photon);
0028     }
0029 
0030     return photons;
0031 }