14 FieldstrengthBz_m(nullptr),
15 FieldstrengthBx_m(nullptr),
16 FieldstrengthBy_m(nullptr) {
18 std::string tmpString;
25 bool parsing_passed =
true;
27 interpretLine<std::string>(file, tmpString);
29 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
32 if (tmpString !=
"TRUE" &&
35 "The second string on the first line of 3D field "
36 "maps has to be either TRUE or FALSE");
41 parsing_passed = parsing_passed &&
43 parsing_passed = parsing_passed &&
45 parsing_passed = parsing_passed &&
49 parsing_passed = parsing_passed &&
50 interpretLine<double>(file,
56 parsing_passed = parsing_passed &&
63 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
83 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
96 std::string tmpString;
112 interpretLine<double>(in,
125 unsigned int centerX =
static_cast<unsigned int>(std::round(-
xbegin_m /
hx_m));
126 unsigned int centerY =
static_cast<unsigned int>(std::round(-
ybegin_m /
hy_m));
135 for(
size_t i = 0; i < totalSize; ++ i) {
207 unsigned short switchX = ((corner &
HX) >> 2), switchY = ((corner &
HY) >> 1), switchZ = (corner &
HZ);
208 double factorX = 0.5 + (1 - 2 * switchX) * (0.5 - idx.
weight(0));
209 double factorY = 0.5 + (1 - 2 * switchY) * (0.5 - idx.
weight(1));
210 double factorZ = 0.5 + (1 - 2 * switchZ) * (0.5 - idx.
weight(2));
212 unsigned long i = idx.
i + switchX, j = idx.
j + switchY, k = idx.
k + switchZ;
214 return factorX * factorY * factorZ * data[
getIndex(i, j, k)];
230 (*msg) <<
Filename_m <<
" (3D magnetostatic) "
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 getLine(std::ifstream &in, std::string &buffer)
double * FieldstrengthBz_m
unsigned int num_gridpz_m
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
double * FieldstrengthBy_m
IndexTriplet getIndex(const Vector_t &X) const
virtual bool isInside(const Vector_t &r) const
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
double getWeightedData(double *data, const IndexTriplet &idx, unsigned short corner) const
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const
double * FieldstrengthBx_m
unsigned int num_gridpx_m
Vector_t interpolateTrilinearly(const Vector_t &X) const
virtual void getInfo(Inform *msg)
FM3DMagnetoStatic(std::string aFilename)
unsigned int num_gridpy_m