19#include "BDSIntegratorType.hh"
21#include "BDSException.hh"
22#include "BDSUtilities.hh"
33 new std::map<BDSIntegratorType, std::string> ({
34 {BDSIntegratorType::none,
"none"},
35 {BDSIntegratorType::teleporter,
"teleporter"},
36 {BDSIntegratorType::solenoid,
"solenoid"},
37 {BDSIntegratorType::dipolerodrigues,
"dipolerodrigues"},
38 {BDSIntegratorType::dipolerodrigues2,
"dipolerodrigues2"},
39 {BDSIntegratorType::dipolematrix,
"dipolematrix"},
40 {BDSIntegratorType::quadrupole,
"quadrupole"},
41 {BDSIntegratorType::sextupole,
"sextupole"},
42 {BDSIntegratorType::multipolethin,
"multipolethin"},
43 {BDSIntegratorType::octupole,
"octupole"},
44 {BDSIntegratorType::decapole,
"decapole"},
45 {BDSIntegratorType::dipolefringe,
"dipolefringe"},
46 {BDSIntegratorType::dipolefringescaling,
"dipolefringescaling"},
47 {BDSIntegratorType::euler,
"euler"},
48 {BDSIntegratorType::kickerthin,
"kickerthin"},
49 {BDSIntegratorType::rmatrixthin,
"rmatrixthin"},
50 {BDSIntegratorType::g4rk4minimumstep,
"g4rk4minimumstep"},
51 {BDSIntegratorType::g4cashkarprkf45,
"g4cashkarprkf45"},
52 {BDSIntegratorType::g4classicalrk4,
"g4classicalrk4"},
53 {BDSIntegratorType::g4constrk4,
"g4constrk4"},
54 {BDSIntegratorType::g4expliciteuler,
"g4expliciteuler"},
55 {BDSIntegratorType::g4impliciteuler,
"g4impliciteuler"},
56 {BDSIntegratorType::g4simpleheum,
"g4simpleheum"},
57 {BDSIntegratorType::g4simplerunge,
"g4simplerunge"},
58 {BDSIntegratorType::g4exacthelixstepper,
"g4exacthelixstepper"},
59 {BDSIntegratorType::g4helixexpliciteuler,
"g4helixexpliciteuler"},
60 {BDSIntegratorType::g4helixheum,
"g4helixheum"},
61 {BDSIntegratorType::g4heliximpliciteuler,
"g4heliximpliciteuler"},
62 {BDSIntegratorType::g4helixmixedstepper,
"g4helixmixedstepper"},
63 {BDSIntegratorType::g4helixsimplerunge,
"g4helixsimplerunge"},
64 {BDSIntegratorType::g4nystromrk4,
"g4nystromrk4"},
65 {BDSIntegratorType::g4rkg3stepper,
"g4rkg3stepper"},
66 {BDSIntegratorType::rmatrixthin,
"rmatrixthin"},
67 {BDSIntegratorType::paralleltransport,
"paralleltransport"},
68 {BDSIntegratorType::cavityfringe,
"cavityfringe"}
69#if G4VERSION_NUMBER > 1029
72 {BDSIntegratorType::g4bogackishampine23,
"g4bogackishampine23"},
73 {BDSIntegratorType::g4bogackishampine45,
"g4bogackishampine45"},
74 {BDSIntegratorType::g4dolomcprirk34,
"g4dolomcprirk34"},
75 {BDSIntegratorType::g4dormandprince745,
"g4dormandprince745"},
76 {BDSIntegratorType::g4dormandprincerk56,
"g4dormandprincerk56"},
77 {BDSIntegratorType::g4tsitourasrk45,
"g4tsitourasrk45"}
79#if G4VERSION_NUMBER > 1039
83 {BDSIntegratorType::g4dormandprincerk78,
"g4dormandprincerk78"},
84 {BDSIntegratorType::g4rk547feq1,
"g4rk547feq1"},
85 {BDSIntegratorType::g4rk547feq2,
"g4rk547feq2"},
86 {BDSIntegratorType::g4rk547feq3,
"g4rk547feq3"}
92 std::map<G4String, BDSIntegratorType> types;
93 types[
"none"] = BDSIntegratorType::none;
94 types[
"teleporter"] = BDSIntegratorType::teleporter;
95 types[
"solenoid"] = BDSIntegratorType::solenoid;
96 types[
"dipolerodrigues"] = BDSIntegratorType::dipolerodrigues;
97 types[
"dipolerodrigues2"] = BDSIntegratorType::dipolerodrigues2;
98 types[
"dipolematrix"] = BDSIntegratorType::dipolematrix;
99 types[
"quadrupole"] = BDSIntegratorType::quadrupole;
100 types[
"sextupole"] = BDSIntegratorType::sextupole;
101 types[
"multipolethin"] = BDSIntegratorType::multipolethin;
102 types[
"octupole"] = BDSIntegratorType::octupole;
103 types[
"decapole"] = BDSIntegratorType::decapole;
104 types[
"dipolefringe"] = BDSIntegratorType::dipolefringe;
105 types[
"dipolefringescaling"] = BDSIntegratorType::dipolefringescaling;
106 types[
"euler"] = BDSIntegratorType::euler;
107 types[
"kickerthin"] = BDSIntegratorType::kickerthin;
108 types[
"g4rk4minimumstep"] = BDSIntegratorType::g4rk4minimumstep;
109 types[
"g4cashkarprkf45"] = BDSIntegratorType::g4cashkarprkf45;
110 types[
"g4classicalrk4"] = BDSIntegratorType::g4classicalrk4;
111 types[
"g4constrk4"] = BDSIntegratorType::g4constrk4;
112 types[
"g4expliciteuler"] = BDSIntegratorType::g4expliciteuler;
113 types[
"g4impliciteuler"] = BDSIntegratorType::g4impliciteuler;
114 types[
"g4simpleheum"] = BDSIntegratorType::g4simpleheum;
115 types[
"g4simplerunge"] = BDSIntegratorType::g4simplerunge;
116 types[
"g4exacthelixstepper"] = BDSIntegratorType::g4exacthelixstepper;
117 types[
"g4helixexpliciteuler"] = BDSIntegratorType::g4helixexpliciteuler;
118 types[
"g4helixheum"] = BDSIntegratorType::g4helixheum;
119 types[
"g4heliximpliciteuler"] = BDSIntegratorType::g4heliximpliciteuler;
120 types[
"g4helixmixedstepper"] = BDSIntegratorType::g4helixmixedstepper;
121 types[
"g4helixsimplerunge"] = BDSIntegratorType::g4helixsimplerunge;
122 types[
"g4nystromrk4"] = BDSIntegratorType::g4nystromrk4;
123 types[
"g4rkg3stepper"] = BDSIntegratorType::g4rkg3stepper;
124 types[
"rmatrixthin"] = BDSIntegratorType::rmatrixthin;
125 types[
"paralleltransport"] = BDSIntegratorType::paralleltransport;
126 types[
"cavityfringe"] = BDSIntegratorType::cavityfringe;
127#if G4VERSION_NUMBER > 1029
129 types[
"g4bogackishampine23"] = BDSIntegratorType::g4bogackishampine23;
130 types[
"g4bogackishampine45"] = BDSIntegratorType::g4bogackishampine45;
131 types[
"g4dolomcprirk34"] = BDSIntegratorType::g4dolomcprirk34;
132 types[
"g4dormandprince745"] = BDSIntegratorType::g4dormandprince745;
133 types[
"g4dormandprincerk56"] = BDSIntegratorType::g4dormandprincerk56;
134 types[
"g4tsitourasrk45"] = BDSIntegratorType::g4tsitourasrk45;
136#if G4VERSION_NUMBER > 1039
138 types[
"g4dormandprincerk78"] = BDSIntegratorType::g4dormandprincerk78;
139 types[
"g4rk547feq1"] = BDSIntegratorType::g4rk547feq1;
140 types[
"g4rk547feq2"] = BDSIntegratorType::g4rk547feq2;
141 types[
"g4rk547feq3"] = BDSIntegratorType::g4rk547feq3;
146 auto result = types.find(integratorType);
147 if (result == types.end())
149 G4String msg =
"\"" + integratorType +
"\" is not a valid integrator type\n";
150 msg +=
"Available integrator types are:\n";
151 for (
const auto& it : types)
152 {msg +=
"\"" + it.first +
"\"\n";}
157 G4cout << __METHOD_NAME__ <<
"determined integrator type to be " << result->second << G4endl;
159 return result->second;
General exception with possible name of object and message.
static std::map< BDSTypeSafeEnum< integratortypes_def, int >, std::string > * dictionary
G4String LowerCase(const G4String &str)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
BDSIntegratorType DetermineIntegratorType(G4String integratorType)
Function that determines enum from string (case-insensitive).