File indexing completed on 2025-02-22 10:31:21
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Macros.hh"
0011 #include "corecel/Types.hh"
0012 #include "celeritas/Units.hh"
0013
0014 namespace celeritas
0015 {
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 struct FieldDriverOptions
0027 {
0028
0029 real_type minimum_step = 1.0e-5 * units::millimeter;
0030
0031
0032 real_type delta_chord = 0.25 * units::millimeter;
0033
0034
0035 real_type delta_intersection = 1.0e-4 * units::millimeter;
0036
0037
0038 real_type epsilon_step = 1.0e-5;
0039
0040
0041 real_type epsilon_rel_max = 1.0e-3;
0042
0043
0044 real_type errcon = 1.0e-4;
0045
0046
0047 real_type pgrow = -0.20;
0048
0049
0050 real_type pshrink = -0.25;
0051
0052
0053 real_type safety = 0.9;
0054
0055
0056 real_type max_stepping_increase = 5;
0057
0058
0059 real_type max_stepping_decrease = 0.1;
0060
0061
0062 short int max_nsteps = 100;
0063
0064
0065 short int max_substeps = 10;
0066
0067
0068 static constexpr inline real_type initial_step_tol = 1e-6;
0069
0070
0071 static constexpr inline real_type dchord_tol = 1e-5 * units::millimeter;
0072
0073
0074 static constexpr inline real_type min_chord_shrink = 0.5;
0075
0076
0077 explicit CELER_FUNCTION operator bool() const
0078 {
0079
0080 return (minimum_step > 0)
0081 && (delta_chord > 0)
0082 && (delta_intersection > minimum_step)
0083 && (epsilon_step > 0 && epsilon_step < 1)
0084 && (epsilon_rel_max > 0)
0085 && (pgrow < 0)
0086 && (pshrink < 0)
0087 && (safety > 0 && safety < 1)
0088 && (max_stepping_increase > 1)
0089 && (max_stepping_decrease > 0 && max_stepping_decrease < 1)
0090 && (max_nsteps > 0) && (max_substeps > 0);
0091
0092 }
0093 };
0094
0095
0096
0097 constexpr bool
0098 operator==(FieldDriverOptions const& a, FieldDriverOptions const& b)
0099 {
0100
0101 return a.minimum_step == b.minimum_step
0102 && a.delta_chord == b.delta_chord
0103 && a.delta_intersection == b.delta_intersection
0104 && a.epsilon_step == b.epsilon_step
0105 && a.epsilon_rel_max == b.epsilon_rel_max
0106 && a.errcon == b.errcon
0107 && a.pgrow == b.pgrow
0108 && a.pshrink == b.pshrink
0109 && a.safety == b.safety
0110 && a.max_stepping_increase == b.max_stepping_increase
0111 && a.max_stepping_decrease == b.max_stepping_decrease
0112 && a.max_nsteps == b.max_nsteps
0113 && a.max_substeps == b.max_substeps
0114 && a.initial_step_tol == b.initial_step_tol
0115 && a.dchord_tol == b.dchord_tol
0116 && a.min_chord_shrink == b.min_chord_shrink;
0117
0118 }
0119
0120
0121
0122 void validate_input(FieldDriverOptions const&);
0123
0124
0125 }