59 std::map<G4String, BDSInterpolatorType> types;
60 types[
"nearest"] = BDSInterpolatorType::nearestauto;
61 types[
"nearest1d"] = BDSInterpolatorType::nearest1d;
62 types[
"nearest2d"] = BDSInterpolatorType::nearest2d;
63 types[
"nearest3d"] = BDSInterpolatorType::nearest3d;
64 types[
"nearest4d"] = BDSInterpolatorType::nearest4d;
65 types[
"linear"] = BDSInterpolatorType::linearauto;
66 types[
"linear1d"] = BDSInterpolatorType::linear1d;
67 types[
"linear2d"] = BDSInterpolatorType::linear2d;
68 types[
"linear3d"] = BDSInterpolatorType::linear3d;
69 types[
"linear4d"] = BDSInterpolatorType::linear4d;
70 types[
"linearmag"] = BDSInterpolatorType::linearmagauto;
71 types[
"linearmag1d"] = BDSInterpolatorType::linearmag1d;
72 types[
"linearmag2d"] = BDSInterpolatorType::linearmag2d;
73 types[
"linearmag3d"] = BDSInterpolatorType::linearmag3d;
74 types[
"linearmag4d"] = BDSInterpolatorType::linearmag4d;
75 types[
"cubic"] = BDSInterpolatorType::cubicauto;
76 types[
"cubic1d"] = BDSInterpolatorType::cubic1d;
77 types[
"cubic2d"] = BDSInterpolatorType::cubic2d;
78 types[
"cubic3d"] = BDSInterpolatorType::cubic3d;
79 types[
"cubic4d"] = BDSInterpolatorType::cubic4d;
83 auto result = types.find(interpolatorType);
84 if (result == types.end())
86 G4String msg =
"\"" + interpolatorType +
"\" is not a valid field type\n";
87 msg +=
"Available interpolator types are:\n";
88 for (
const auto& it : types)
89 {msg +=
"\"" + it.first +
"\"\n";}
94 G4cout << __METHOD_NAME__ <<
"determined interpolator type to be " << result->second << G4endl;
96 return result->second;
104 case BDSInterpolatorType::nearest1d:
105 case BDSInterpolatorType::linear1d:
106 case BDSInterpolatorType::linearmag1d:
107 case BDSInterpolatorType::cubic1d:
109 case BDSInterpolatorType::nearest2d:
110 case BDSInterpolatorType::linear2d:
111 case BDSInterpolatorType::linearmag2d:
112 case BDSInterpolatorType::cubic2d:
114 case BDSInterpolatorType::nearest3d:
115 case BDSInterpolatorType::linear3d:
116 case BDSInterpolatorType::linearmag3d:
117 case BDSInterpolatorType::cubic3d:
119 case BDSInterpolatorType::nearest4d:
120 case BDSInterpolatorType::linear4d:
121 case BDSInterpolatorType::linearmag4d:
122 case BDSInterpolatorType::cubic4d:
150 {std::make_pair(1, BDSInterpolatorType::nearestauto), BDSInterpolatorType::nearest1d},
151 {std::make_pair(2, BDSInterpolatorType::nearestauto), BDSInterpolatorType::nearest2d},
152 {std::make_pair(3, BDSInterpolatorType::nearestauto), BDSInterpolatorType::nearest3d},
153 {std::make_pair(4, BDSInterpolatorType::nearestauto), BDSInterpolatorType::nearest4d},
154 {std::make_pair(1, BDSInterpolatorType::linearauto), BDSInterpolatorType::linear1d},
155 {std::make_pair(2, BDSInterpolatorType::linearauto), BDSInterpolatorType::linear2d},
156 {std::make_pair(3, BDSInterpolatorType::linearauto), BDSInterpolatorType::linear3d},
157 {std::make_pair(4, BDSInterpolatorType::linearauto), BDSInterpolatorType::linear4d},
158 {std::make_pair(1, BDSInterpolatorType::linearmagauto), BDSInterpolatorType::linearmag1d},
159 {std::make_pair(2, BDSInterpolatorType::linearmagauto), BDSInterpolatorType::linearmag2d},
160 {std::make_pair(3, BDSInterpolatorType::linearmagauto), BDSInterpolatorType::linearmag3d},
161 {std::make_pair(4, BDSInterpolatorType::linearmagauto), BDSInterpolatorType::linearmag4d},
162 {std::make_pair(1, BDSInterpolatorType::cubicauto), BDSInterpolatorType::cubic1d},
163 {std::make_pair(2, BDSInterpolatorType::cubicauto), BDSInterpolatorType::cubic2d},
164 {std::make_pair(3, BDSInterpolatorType::cubicauto), BDSInterpolatorType::cubic3d},
165 {std::make_pair(4, BDSInterpolatorType::cubicauto), BDSInterpolatorType::cubic4d},
167 auto key = std::make_pair(nDimension, autoType);
168 auto search = mapping.find(key);
169 if (search != mapping.end())
170 {
return search->second;}
172 {
throw BDSException(__METHOD_NAME__,
"invalid number of dimensions in auto-mapping to interpolators.");}