Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2021-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/track/SimParams.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <unordered_map>
0011 
0012 #include "corecel/Types.hh"
0013 #include "corecel/data/CollectionMirror.hh"
0014 #include "corecel/data/ParamsDataInterface.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         SPConstParticles particles;
0040         std::unordered_map<PDGNumber, LoopingThreshold> looping;
0041     };
0042 
0043   public:
0044     // Construct with imported data and default max field substeps
0045     static std::shared_ptr<SimParams>
0046     from_import(ImportData const&, SPConstParticles);
0047 
0048     // Construct with imported data
0049     static std::shared_ptr<SimParams> from_import(ImportData const&,
0050                                                   SPConstParticles,
0051                                                   short int max_field_substeps);
0052 
0053     // Construct with simulation input data
0054     explicit SimParams(Input const&);
0055 
0056     // Construct without loop counters (for neutral-only simulations)
0057     SimParams();
0058 
0059     //! Access data on host
0060     HostRef const& host_ref() const final { return data_.host_ref(); }
0061 
0062     //! Access data on device
0063     DeviceRef const& device_ref() const final { return data_.device_ref(); }
0064 
0065   private:
0066     // Host/device storage and reference
0067     CollectionMirror<SimParamsData> data_;
0068 };
0069 
0070 //---------------------------------------------------------------------------//
0071 }  // namespace celeritas