13 FieldstrengthBz_m(NULL),
14 FieldstrengthBx_m(NULL),
15 FieldstrengthBy_m(NULL) {
17 std::string tmpString;
24 bool parsing_passed =
true;
26 interpretLine<std::string>(file, tmpString);
28 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
31 if (tmpString !=
"TRUE" &&
34 "The second string on the first line of 3D field "
35 "maps has to be either TRUE or FALSE");
40 parsing_passed = parsing_passed &&
42 parsing_passed = parsing_passed &&
44 parsing_passed = parsing_passed &&
48 parsing_passed = parsing_passed &&
49 interpretLine<double>(file,
55 parsing_passed = parsing_passed &&
62 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
82 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
95 std::string tmpString;
111 interpretLine<double>(in,
124 unsigned int centerX =
static_cast<unsigned int>(std::round(-
xbegin_m /
hx_m));
125 unsigned int centerY =
static_cast<unsigned int>(std::round(-
ybegin_m /
hy_m));
134 for(
size_t i = 0; i < totalSize; ++ i) {
206 unsigned short switchX = ((corner &
HX) >> 2), switchY = ((corner &
HY) >> 1), switchZ = (corner &
HZ);
207 double factorX = 0.5 + (1 - 2 * switchX) * (0.5 - idx.
weight(0));
208 double factorY = 0.5 + (1 - 2 * switchY) * (0.5 - idx.
weight(1));
209 double factorZ = 0.5 + (1 - 2 * switchZ) * (0.5 - idx.
weight(2));
211 unsigned long i = idx.
i + switchX, j = idx.
j + switchY, k = idx.
k + switchZ;
213 return factorX * factorY * factorZ * data[
getIndex(i, j, k)];
229 (*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