Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:09:04

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