Back to home page

EIC code displayed by LXR

 
 

    


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

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