13 FieldstrengthBz_m(nullptr),
14 FieldstrengthBr_m(nullptr) {
16 std::string tmpString;
24 bool parsing_passed =
true;
26 parsing_passed = interpretLine<std::string, std::string>(file,
30 parsing_passed = interpretLine<std::string, std::string, std::string>(file,
36 if (tmpString !=
"TRUE" &&
39 "The third string on the first line of 2D field "
40 "maps has to be either TRUE or FALSE");
45 if(tmpString ==
"ZX") {
47 parsing_passed = parsing_passed &&
49 parsing_passed = parsing_passed &&
51 }
else if(tmpString ==
"XZ") {
53 parsing_passed = parsing_passed &&
55 parsing_passed = parsing_passed &&
58 std::cerr <<
"unknown orientation of 2D magnetostatic fieldmap" <<
std::endl;
59 parsing_passed =
false;
63 parsing_passed = parsing_passed && interpretLine<double, double>(file, tmpDouble, tmpDouble);
66 parsing_passed = parsing_passed &&
76 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
111 std::string tmpString;
125 interpretLine<double, double>(in,
133 interpretLine<double, double>(in,
176 const double leverr = (RR /
hr_m) - indexr;
189 const double BfieldR = (1.0 - leverz) * (1.0 - leverr) *
FieldstrengthBr_m[index1]
194 const double BfieldZ = (1.0 - leverz) * (1.0 - leverr) *
FieldstrengthBz_m[index1]
200 B(0) += BfieldR *
R(0) / RR;
201 B(1) += BfieldR *
R(1) / RR;
209 double BfieldR, BfieldZ;
214 const double leverr = (RR /
hr_m) - indexr;
217 const double leverz = (
R(2) /
hz_m) - indexz;
229 if(indexz < num_gridpz_m - 1) {
302 B(0) += BfieldR *
R(0) / RR;
303 B(1) += BfieldR *
R(1) / RR;
Tps< T > sqrt(const Tps< T > &x)
Square root.
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
virtual void setFrequency(double freq)
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
virtual double getFrequency() const
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
std::shared_ptr< _FM2DMagnetoStatic > FM2DMagnetoStatic
double * FieldstrengthBr_m
static std::string typeset_msg(const std::string &msg, const std::string &title)
std::string toUpper(const std::string &str)
Inform & endl(Inform &inf)
virtual ~_FM2DMagnetoStatic()
bool interpreteEOF(std::ifstream &in)
double * FieldstrengthBz_m
static FM2DMagnetoStatic create(const std::string &filename)
virtual void getInfo(Inform *msg)
void disableFieldmapWarning()
void getLine(std::ifstream &in, std::string &buffer)
Inform & level3(Inform &inf)
constexpr double e
The value of .
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const
_FM2DMagnetoStatic(const std::string &filename)
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)