Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:39

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/field/UniformFieldParams.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/data/CollectionMirror.hh"
0010 #include "corecel/data/ParamsDataInterface.hh"
0011 #include "celeritas/geo/GeoFwd.hh"
0012 #include "celeritas/geo/GeoParams.hh"
0013 #include "celeritas/inp/Field.hh"
0014 
0015 #include "UniformFieldData.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Construct and store data for a uniform magnetic field.
0022  */
0023 class UniformFieldParams final
0024     : public ParamsDataInterface<UniformFieldParamsData>
0025 {
0026   public:
0027     //@{
0028     //! \name Type aliases
0029     using Input = inp::UniformField;
0030     //@}
0031 
0032   public:
0033     // Construct with a uniform magnetic field
0034     UniformFieldParams(GeoParams const& geo, Input const& inp);
0035 
0036     //! Access field data on the host
0037     HostRef const& host_ref() const final { return data_.host_ref(); }
0038 
0039     //! Access field data on the device
0040     DeviceRef const& device_ref() const final { return data_.device_ref(); }
0041 
0042     //! Whether the field is present everywhere
0043     bool in_all_volumes() const { return data_.host_ref().has_field.empty(); }
0044 
0045   private:
0046     CollectionMirror<UniformFieldParamsData> data_;
0047 };
0048 
0049 //---------------------------------------------------------------------------//
0050 }  // namespace celeritas