16 std::string tmpString;
24 bool parsing_passed = true;
26 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
34 if (tmpString !=
"TRUE" &&
37 "The third string on the first line of 2D field "
38 "maps has to be either TRUE or FALSE");
43 if (tmpString ==
"ZX") {
45 parsing_passed = parsing_passed &&
47 parsing_passed = parsing_passed &&
49 }
else if (tmpString ==
"XZ") {
51 parsing_passed = parsing_passed &&
53 parsing_passed = parsing_passed &&
56 std::cerr <<
"unknown orientation of 2D electrostatic fieldmap" << std::endl;
57 parsing_passed =
false;
64 parsing_passed = parsing_passed &&
70 if (!parsing_passed) {
74 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
109 std::string tmpString;
172 const double RR = std::sqrt(R(0) * R(0) + R(1) * R(1));
174 const int indexr = (int)std::floor(RR /
hr_m);
175 const double leverr = (RR /
hr_m) - indexr;
177 const int indexz = (int)std::floor((R(2) -
zbegin_m) /
hz_m);
178 const double leverz = (R(2) -
zbegin_m) /
hz_m - indexz;
187 const double EfieldR = (1.0 - leverz) * (1.0 - leverr) *
FieldstrengthEr_m[index1]
192 const double EfieldZ = (1.0 - leverz) * (1.0 - leverr) *
FieldstrengthEz_m[index1]
198 E(0) += EfieldR * R(0) / RR;
199 E(1) += EfieldR * R(1) / RR;
std::shared_ptr< _FM2DElectroStatic > FM2DElectroStatic
Inform & endl(Inform &inf)
constexpr double MVpm2Vpm
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)
bool interpretLine(std::ifstream &in, S &value, const bool &file_length_known=true)
virtual void getInfo(Inform *msg)
_FM2DElectroStatic(const std::string &filename)
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const
virtual ~_FM2DElectroStatic()
static FM2DElectroStatic create(const std::string &filename)
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
virtual void setFrequency(double freq)
double * FieldstrengthEr_m
virtual double getFrequency() const
double * FieldstrengthEz_m
Vektor< double, 3 > Vector_t