File indexing completed on 2025-02-22 10:31:21
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Assert.hh"
0011 #include "corecel/Macros.hh"
0012 #include "corecel/math/Algorithms.hh"
0013 #include "celeritas/Quantities.hh"
0014 #include "celeritas/geo/GeoTrackView.hh"
0015 #include "celeritas/phys/ParticleTrackView.hh"
0016
0017 #include "FieldDriver.hh"
0018 #include "FieldDriverOptions.hh"
0019 #include "FieldPropagator.hh"
0020 #include "MagFieldEquation.hh"
0021
0022 namespace celeritas
0023 {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 template<template<class EquationT> class StepperT, class FieldT>
0036 CELER_FUNCTION decltype(auto)
0037 make_mag_field_stepper(FieldT&& field, units::ElementaryCharge charge)
0038 {
0039 using Equation_t = MagFieldEquation<FieldT>;
0040 return StepperT<Equation_t>{
0041 Equation_t{::celeritas::forward<FieldT>(field), charge}};
0042 }
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 template<class StepperT, class GTV>
0060 CELER_FUNCTION decltype(auto)
0061 make_field_propagator(StepperT&& stepper,
0062 FieldDriverOptions const& options,
0063 ParticleTrackView const& particle,
0064 GTV&& geometry)
0065 {
0066 return FieldPropagator{
0067 FieldDriver{options, ::celeritas::forward<StepperT>(stepper)},
0068 particle,
0069 ::celeritas::forward<GTV>(geometry)};
0070 }
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 template<template<class EquationT> class StepperT, class FieldT, class GTV>
0088 CELER_FUNCTION decltype(auto)
0089 make_mag_field_propagator(FieldT&& field,
0090 FieldDriverOptions const& options,
0091 ParticleTrackView const& particle,
0092 GTV&& geometry)
0093 {
0094 return make_field_propagator(
0095 make_mag_field_stepper<StepperT>(::celeritas::forward<FieldT>(field),
0096 particle.charge()),
0097 options,
0098 particle,
0099 ::celeritas::forward<GTV>(geometry));
0100 }
0101
0102
0103 }