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/TrackInitParams.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/CollectionMirror.hh"
0012 #include "corecel/data/ParamsDataInterface.hh"
0013 
0014 #include "TrackInitData.hh"
0015 
0016 namespace celeritas
0017 {
0018 //---------------------------------------------------------------------------//
0019 /*!
0020  * Manage persistent track initializer data.
0021  */
0022 class TrackInitParams final : public ParamsDataInterface<TrackInitParamsData>
0023 {
0024   public:
0025     //! Track initializer construction arguments
0026     struct Input
0027     {
0028         size_type capacity{};  //!< Max number of initializers
0029         size_type max_events{};  //!< Max number of events that can be run
0030         TrackOrder track_order{TrackOrder::none};  //!< How to sort tracks
0031     };
0032 
0033   public:
0034     // Construct with capacity and number of events
0035     explicit TrackInitParams(Input const&);
0036 
0037     //! Maximum number of initializers
0038     size_type capacity() const { return host_ref().capacity; }
0039 
0040     //! Event number cannot exceed this value
0041     size_type max_events() const { return host_ref().max_events; }
0042 
0043     //! Track sorting strategy
0044     TrackOrder track_order() const { return host_ref().track_order; }
0045 
0046     //! Access primaries for contructing track initializer states
0047     HostRef const& host_ref() const final { return data_.host_ref(); }
0048 
0049     //! Access data on device
0050     DeviceRef const& device_ref() const final { return data_.device_ref(); }
0051 
0052   private:
0053     // Host/device storage and reference
0054     CollectionMirror<TrackInitParamsData> data_;
0055 };
0056 
0057 //---------------------------------------------------------------------------//
0058 }  // namespace celeritas