16 FieldstrengthBx_m(nullptr),
17 FieldstrengthBy_m(nullptr),
18 FieldstrengthBz_m(nullptr) {
20 std::string tmpString;
28 bool parsing_passed =
true;
30 parsing_passed = interpretLine<std::string>(file, tmpString);
32 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
35 if (tmpString !=
"TRUE" &&
38 "The second string on the first line of 3D field "
39 "maps has to be either TRUE or FALSE");
43 parsing_passed = (parsing_passed &&
45 parsing_passed = (parsing_passed &&
47 parsing_passed = (parsing_passed &&
51 parsing_passed = parsing_passed && interpretLine<double>(file, tmpDouble);
54 parsing_passed = parsing_passed &&
64 "Format of fieldmap '" +
Filename_m +
"' didn't pass basic test");
86 "Couldn't read fieldmap '" +
Filename_m +
"'");
98 std::string tmpString;
113 unsigned long index =
getIndex(i,0,k);
126 unsigned int centerX =
static_cast<unsigned int>(std::round(-
xbegin_m /
hx_m));
137 unsigned long index =
getIndex(i,0,k);
164 unsigned long index =
getIndex(i,j,k);
173 unsigned long index =
getIndex(i,j,k);
182 unsigned long index =
getIndex(i,j,k);
193 unsigned long index =
getIndex(i,j,k);
204 unsigned long index =
getIndex(i,j,k);
214 unsigned long index =
getIndex(i,j,k);
230 unsigned long index =
getIndex(i,j,k);
237 unsigned int index =
getIndex(i,j,k);
244 unsigned int index =
getIndex(i,j,k);
254 unsigned long index =
getIndex(i,j,k);
263 unsigned int index =
getIndex(i,j,k);
272 unsigned int index =
getIndex(i,j,k);
288 unsigned long index =
getIndex(i, j, k);
298 unsigned long index =
getIndex(i,j,k);
307 unsigned long index =
getIndex(i, j, k);
320 unsigned long index =
getIndex(i, j, k);
331 unsigned long index =
getIndex(i,j,k);
341 unsigned long index =
getIndex(i, j, k);
355 unsigned long index =
getIndex(i, j, k);
366 unsigned long index =
getIndex(i,j,k);
376 unsigned long index =
getIndex(i, j, k);
390 unsigned long index =
getIndex(i, j, k);
401 unsigned long index =
getIndex(i,j,k);
411 unsigned long index =
getIndex(i, j, k);
425 unsigned long index =
getIndex(i, j, k);
437 unsigned long index =
getIndex(i,j,k);
448 unsigned long index =
getIndex(i, j, k);
463 unsigned long index =
getIndex(i, j, k);
475 unsigned long index =
getIndex(i,j,k);
486 unsigned long index =
getIndex(i, j, k);
502 const double offWeight = 0.1, sumWeightInv = 1.0 / (1.0 + 4 * (1 + offWeight) * offWeight);
508 for (
int i2 = -1; i2 < 2; ++ i2) {
509 for (
int k2 = -1; k2 < 2; ++ k2) {
519 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
523 for (
int i2 = 0; i2 < 2; ++ i2) {
524 for (
int k2 = -1; k2 < 2; ++ k2) {
534 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
538 for (
int i2 = -1; i2 < 1; ++ i2) {
539 for (
int k2 = -1; k2 < 2; ++ k2) {
549 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
553 for (
int i2 = -1; i2 < 2; ++ i2) {
554 for (
int k2 = 0; k2 < 2; ++ k2) {
564 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
568 for (
int i2 = -1; i2 < 2; ++ i2) {
569 for (
int k2 = -1; k2 < 1; ++ k2) {
579 unsigned long index =
getIndex(0, j, 0);
580 tmp[index] = data[index];
584 tmp[index] = data[index];
588 tmp[index] = data[index];
592 tmp[index] = data[index];
597 unsigned long index =
getIndex(i, j, k);
598 data[index] = tmp[index];
607 std::ofstream out(fname);
613 unsigned long index =
getIndex(i, j, k);
614 out << std::setw(14) << x
615 << std::setw(14) << y
616 << std::setw(14) << z
676 unsigned short switchX = ((corner &
HX) >> 2), switchY = ((corner &
HY) >> 1), switchZ = (corner &
HZ);
677 double factorX = 0.5 + (1 - 2 * switchX) * (0.5 - idx.
weight(0));
678 double factorY = 0.5 + (1 - 2 * switchY) * (0.5 - idx.
weight(1));
679 double factorZ = 0.5 + (1 - 2 * switchZ) * (0.5 - idx.
weight(2));
681 unsigned long i = idx.
i + switchX, j = idx.
j + switchY, k = idx.
k + switchZ;
683 return factorX * factorY * factorZ * data[
getIndex(i, j, k)];
Tps< T > pow(const Tps< T > &x, int y)
Integer power.
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
T::PETE_Expr_t::PETE_Return_t sum(const PETE_Expr< T > &expr)
PETE_TBTree< FnCopysign, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > copysign(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
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)
void disableFieldmapWarning()
static std::string typeset_msg(const std::string &msg, const std::string &title)
void getLine(std::ifstream &in, std::string &buffer)
double * FieldstrengthBx_m
void integrateBy(unsigned j)
FM3DMagnetoStaticExtended(std::string aFilename)
Vector_t interpolateTrilinearly(const Vector_t &X) const
void smoothData(double *data, unsigned j)
double * FieldstrengthBy_m
void integrateBx(unsigned j)
double getWeightedData(double *data, const IndexTriplet &idx, unsigned short corner) const
double * FieldstrengthBz_m
virtual void getInfo(Inform *msg)
IndexTriplet getIndex(const Vector_t &X) const
virtual bool isInside(const Vector_t &r) const
unsigned int num_gridpy_m
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const
~FM3DMagnetoStaticExtended()
unsigned int num_gridpz_m
unsigned int num_gridpx_m
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
virtual void setFrequency(double freq)
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
void saveField(const std::string &fname, unsigned int j) const
virtual double getFrequency() const
void integrateBz(unsigned j)