Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:52:21

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/UniformField.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.
0017  *
0018  * The values of the field should be in native units. For magnetic fields, this
0019  * unit is gauss for the CGS system.
0020  */
0021 class UniformField
0022 {
0023   public:
0024     //! Construct with a field vector
0025     explicit CELER_FUNCTION UniformField(Real3 const& value) : value_(value) {}
0026 
0027     //! Return the field at the given position
0028     CELER_FUNCTION Real3 const& operator()(Real3 const&) const
0029     {
0030         return value_;
0031     }
0032 
0033   private:
0034     Real3 value_;
0035 };
0036 
0037 //---------------------------------------------------------------------------//
0038 }  // namespace celeritas