Back to home page

EIC code displayed by LXR

 
 

    


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

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/field/UniformZField.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/cont/Array.hh"
0011 #include "celeritas/Types.hh"
0012 
0013 namespace celeritas
0014 {
0015 //---------------------------------------------------------------------------//
0016 /*!
0017  * A uniform field along the Z axis.
0018  */
0019 class UniformZField
0020 {
0021   public:
0022     //! Construct with a scalar magnetic field value
0023     CELER_FUNCTION
0024     explicit UniformZField(real_type value) : value_(value) {}
0025 
0026     //! Return the field at the given position
0027     CELER_FUNCTION
0028     Real3 operator()(Real3 const&) const { return {0, 0, value_}; }
0029 
0030   private:
0031     real_type value_;
0032 };
0033 
0034 //---------------------------------------------------------------------------//
0035 }  // namespace celeritas