Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //---------------------------------*-CUDA-*----------------------------------//
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/Types.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/cont/Array.hh"
0011 #include "corecel/math/ArrayUtils.hh"
0012 #include "celeritas/Quantities.hh"
0013 #include "celeritas/Types.hh"
0014 
0015 namespace celeritas
0016 {
0017 //---------------------------------------------------------------------------//
0018 // STRUCTS
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * A utility array of the equation of motion based on \ref celeritas::Array .
0022  */
0023 struct OdeState
0024 {
0025     using MomentumUnits = units::MevMomentum;
0026     using Real3 = Array<real_type, 3>;
0027 
0028     Real3 pos;  //!< Particle position
0029     Real3 mom;  //!< Particle momentum
0030 };
0031 
0032 //---------------------------------------------------------------------------//
0033 /*!
0034  * The result of the integration stepper.
0035  */
0036 struct FieldStepperResult
0037 {
0038     OdeState mid_state;  //!< OdeState at the middle
0039     OdeState end_state;  //!< OdeState at the end
0040     OdeState err_state;  //!< Delta between one full step and two half steps
0041 };
0042 
0043 //---------------------------------------------------------------------------//
0044 /*!
0045  * The result of moving up to a certain distance along a step.
0046  */
0047 struct DriverResult
0048 {
0049     OdeState state;  //!< Post-step state
0050     real_type step;  //!< Actual curved step
0051 };
0052 
0053 //! \cond (CELERITAS_DOC_DEV)
0054 //---------------------------------------------------------------------------//
0055 // FUNCTIONS
0056 //---------------------------------------------------------------------------//
0057 /*!
0058  * Perform y <- ax + y for OdeState.
0059  */
0060 inline CELER_FUNCTION void axpy(real_type a, OdeState const& x, OdeState* y)
0061 {
0062     axpy(a, x.pos, &y->pos);
0063     axpy(a, x.mom, &y->mom);
0064 }
0065 //! \endcond
0066 
0067 }  // namespace celeritas