Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:52:27

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/track/SimParams.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <unordered_map>
0010 
0011 #include "corecel/Types.hh"
0012 #include "corecel/data/CollectionMirror.hh"
0013 #include "corecel/data/ParamsDataInterface.hh"
0014 #include "corecel/math/NumericLimits.hh"
0015 #include "celeritas/phys/PDGNumber.hh"
0016 
0017 #include "SimData.hh"
0018 
0019 namespace celeritas
0020 {
0021 class ParticleParams;
0022 struct ImportData;
0023 
0024 //---------------------------------------------------------------------------//
0025 /*!
0026  * Manage persistent simulation data.
0027  */
0028 class SimParams final : public ParamsDataInterface<SimParamsData>
0029 {
0030   public:
0031     //!@{
0032     //! \name Type aliases
0033     using SPConstParticles = std::shared_ptr<ParticleParams const>;
0034     //!@}
0035 
0036     //! Input data to construct this class
0037     struct Input
0038     {
0039         // Construct with imported data and default max field substeps
0040         static Input from_import(ImportData const&, SPConstParticles);
0041 
0042         // Construct with imported data and max field substeps
0043         static Input from_import(ImportData const&,
0044                                  SPConstParticles,
0045                                  size_type max_field_substeps);
0046 
0047         //// DATA ////
0048 
0049         SPConstParticles particles;
0050         std::unordered_map<PDGNumber, LoopingThreshold> looping;
0051         size_type max_steps = numeric_limits<size_type>::max();
0052     };
0053 
0054   public:
0055     // Construct with simulation input data
0056     explicit SimParams(Input const&);
0057 
0058     //! Access data on host
0059     HostRef const& host_ref() const final { return data_.host_ref(); }
0060 
0061     //! Access data on device
0062     DeviceRef const& device_ref() const final { return data_.device_ref(); }
0063 
0064   private:
0065     // Host/device storage and reference
0066     CollectionMirror<SimParamsData> data_;
0067 };
0068 
0069 //---------------------------------------------------------------------------//
0070 }  // namespace celeritas