Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:31

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2022-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/random/XorwowRngParams.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Types.hh"
0011 #include "corecel/cont/Array.hh"
0012 #include "corecel/data/CollectionMirror.hh"
0013 #include "corecel/data/ParamsDataInterface.hh"
0014 
0015 #include "XorwowRngData.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Shared data for XORWOW pseudo-random number generator.
0022  */
0023 class XorwowRngParams final : public ParamsDataInterface<XorwowRngParamsData>
0024 {
0025   public:
0026     // Construct with a low-entropy seed
0027     explicit XorwowRngParams(unsigned int seed);
0028 
0029     //! \todo Construct with a seed of 256 bytes (16-byte hex) or shasum string
0030     // explicit XorwowRngParams(const std::string& hexstring);
0031 
0032     //! Access material properties on the host
0033     HostRef const& host_ref() const final { return data_.host_ref(); }
0034 
0035     //! Access material properties on the device
0036     DeviceRef const& device_ref() const final { return data_.device_ref(); }
0037 
0038   private:
0039     //// DATA ////
0040 
0041     // Host/device storage and reference
0042     CollectionMirror<XorwowRngParamsData> data_;
0043 
0044     //// TYPES ////
0045 
0046     using JumpPoly = Array<unsigned int, 5>;
0047     using ArrayJumpPoly = Array<JumpPoly, 32>;
0048 
0049     //// HELPER FUNCTIONS ////
0050 
0051     ArrayJumpPoly const& get_jump_poly();
0052     ArrayJumpPoly const& get_jump_subsequence_poly();
0053 };
0054 
0055 //---------------------------------------------------------------------------//
0056 }  // namespace celeritas