14 FieldstrengthEz_m(nullptr),
15 FieldstrengthEr_m(nullptr),
16 FieldstrengthBt_m(nullptr) {
18 std::string tmpString;
26 bool parsing_passed =
true;
28 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
30 parsing_passed = interpretLine<std::string, std::string, std::string>(
31 file, tmpString, tmpString, tmpString);
34 if (tmpString !=
"TRUE" && tmpString !=
"FALSE")
36 "FM2DDynamic::FM2DDynamic",
37 "The third string on the first line of 2D field "
38 "maps has to be either TRUE or FALSE");
43 if (tmpString ==
"ZX") {
48 parsing_passed = parsing_passed && interpretLine<double>(file,
frequency_m);
52 }
else if (tmpString ==
"XZ") {
57 parsing_passed = parsing_passed && interpretLine<double>(file,
frequency_m);
62 std::cerr <<
"unknown orientation of 2D dynamic fieldmap" <<
std::endl;
63 parsing_passed =
false;
69 parsing_passed = parsing_passed
70 && interpretLine<double, double, double, double>(
71 file, tmpDouble, tmpDouble, tmpDouble, tmpDouble);
79 if (!parsing_passed) {
83 "FM2DDynamic::FM2DDynamic",
84 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
117 std::string tmpString;
118 double tmpDouble, Ezmax = 0.0;
134 interpretLine<double, double, double, double>(
143 interpretLine<double, double, double, double>(
193 const double RR = std::sqrt(R(0) * R(0) + R(1) * R(1));
195 const int indexr = (int)std::floor(RR /
hr_m);
196 const double leverr = RR /
hr_m - indexr;
198 const int indexz = (int)std::floor((R(2) -
zbegin_m) /
hz_m);
199 const double leverz = (R(2) -
zbegin_m) /
hz_m - indexz;
225 E(0) += EfieldR * R(0) / RR;
226 E(1) += EfieldR * R(1) / RR;
227 B(0) -= BfieldT * R(1) / RR;
228 B(1) += BfieldT * R(0) / RR;
246 double& ,
double& ,
double& ,
double& ,
double& ,
Inform & endl(Inform &inf)
Inform & level3(Inform &inf)
constexpr double two_pi
The value of.
constexpr double e
The value of.
constexpr double mu_0
The permeability of vacuum in Vs/Am.
std::string toUpper(const std::string &str)
std::unique_ptr< Inform > Info
bool interpreteEOF(std::ifstream &in)
void disableFieldmapWarning()
static std::string typeset_msg(const std::string &msg, const std::string &title)
void getLine(std::ifstream &in, std::string &buffer)
double * FieldstrengthEz_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 getFieldDimensions(double &zBegin, double &zEnd) const
double hr_m
length between points in grid, r-direction, m
virtual double getFrequency() const
virtual bool getFieldDerivative(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B, const DiffDirection &dir) const
virtual void setFrequency(double freq)
double hz_m
length between points in grid, z-direction, m
virtual void getInfo(Inform *msg)
virtual bool getFieldstrength(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) const
virtual void getOnaxisEz(std::vector< std::pair< double, double > > &F)
double * FieldstrengthBt_m
2D array with Er, read in like Ez
FM2DDynamic(std::string aFilename)
int num_gridpz_m
Read in number of points after 0(not counted here) in grid, z-direction.
int num_gridpr_m
Read in number of points after 0(not counted here) in grid, r-direction.
double * FieldstrengthEr_m
2D array with Er, read in like Ez