14 std::string tmpString;
22 bool parsing_passed = true;
24 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
27 file, tmpString, tmpString, tmpString);
30 if (tmpString !=
"TRUE" && tmpString !=
"FALSE")
32 "FM2DElectroStatic::FM2DElectroStatic",
33 "The third string on the first line of 2D field "
34 "maps has to be either TRUE or FALSE");
39 if (tmpString ==
"ZX") {
47 }
else if (tmpString ==
"XZ") {
56 std::cerr <<
"unknown orientation of 2D electrostatic fieldmap" << std::endl;
57 parsing_passed =
false;
70 if (!parsing_passed) {
74 "FM2DElectroStatic::FM2DElectroStatic",
75 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
105 std::string tmpString;
171 const double RR = std::sqrt(R(0) * R(0) + R(1) * R(1));
173 const int indexr = (int)std::floor(RR /
hr_m);
174 const double leverr = (RR /
hr_m) - indexr;
176 const int indexz = (int)std::floor((R(2) -
zbegin_m) /
hz_m);
177 const double leverz = (R(2) -
zbegin_m) /
hz_m - indexz;
186 const double EfieldR = (1.0 - leverz) * (1.0 - leverr) *
FieldstrengthEr_m[index1]
191 const double EfieldZ = (1.0 - leverz) * (1.0 - leverr) *
FieldstrengthEz_m[index1]
197 E(0) += EfieldR * R(0) / RR;
198 E(1) += EfieldR * R(1) / RR;
215 double& ,
double& ,
double& ,
double& ,
double& ,
ippl::Vector< T, Dim > Vector_t
constexpr double MVpm2Vpm
std::string toUpper(const std::string &str)
bool interpreteEOF(std::ifstream &in)
void disableFieldmapWarning()
static std::string typeset_msg(const std::string &msg, const std::string &title)
bool interpretLine(std::ifstream &in, S &value, const bool &file_length_known=true)
void getLine(std::ifstream &in, std::string &buffer)
virtual bool getFieldstrength(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) const
double * FieldstrengthEr_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
FM2DElectroStatic(std::string aFilename)
double * FieldstrengthEz_m
virtual void setFrequency(double freq)
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
virtual void getInfo(Inform *msg)