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;
302 B(0) += BfieldR *
R(0) / RR;
303 B(1) += BfieldR *
R(1) / RR;
std::shared_ptr< _FM2DMagnetoStatic > FM2DMagnetoStatic
Tps< T > sqrt(const Tps< T > &x)
Square root.
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Inform & endl(Inform &inf)
Inform & level3(Inform &inf)
constexpr double e
The value of.
std::string toUpper(const std::string &str)
bool interpreteEOF(std::ifstream &in)
static std::string typeset_msg(const std::string &msg, const std::string &title)
void disableFieldmapWarning()
void getLine(std::ifstream &in, std::string &buffer)
virtual void setFrequency(double freq)
_FM2DMagnetoStatic(const std::string &filename)
double * FieldstrengthBz_m
2D array with Ez, read in first along z0 - r0 to rN then z1 - r0 to rN until zN - r0 to rN
virtual void getInfo(Inform *msg)
int num_gridpz_m
Read in number of points after 0(not counted here) in grid, z-direction.
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
double * FieldstrengthBr_m
2D array with Er, read in like Ez
static FM2DMagnetoStatic create(const std::string &filename)
double hr_m
length between points in grid, r-direction, m
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
virtual double getFrequency() const
double hz_m
length between points in grid, z-direction, m
virtual ~_FM2DMagnetoStatic()
int num_gridpr_m
Read in number of points after 0(not counted here) in grid, r-direction.
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const