15 FieldstrengthBx_m(NULL),
16 FieldstrengthBy_m(NULL),
17 FieldstrengthBz_m(NULL) {
19 std::string tmpString;
27 bool parsing_passed =
true;
29 parsing_passed = interpretLine<std::string>(file, tmpString);
31 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
34 if (tmpString !=
"TRUE" &&
37 "The second string on the first line of 3D field "
38 "maps has to be either TRUE or FALSE");
42 parsing_passed = (parsing_passed &&
44 parsing_passed = (parsing_passed &&
46 parsing_passed = (parsing_passed &&
50 parsing_passed = parsing_passed && interpretLine<double>(file, tmpDouble);
53 parsing_passed = parsing_passed &&
63 "Format of fieldmap '" +
Filename_m +
"' didn't pass basic test");
85 "Couldn't read fieldmap '" +
Filename_m +
"'");
97 std::string tmpString;
112 unsigned long index =
getIndex(i,0,k);
125 unsigned int centerX =
static_cast<unsigned int>(std::round(-
xbegin_m /
hx_m));
136 unsigned long index =
getIndex(i,0,k);
163 unsigned long index =
getIndex(i,j,k);
172 unsigned long index =
getIndex(i,j,k);
181 unsigned long index =
getIndex(i,j,k);
192 unsigned long index =
getIndex(i,j,k);
203 unsigned long index =
getIndex(i,j,k);
213 unsigned long index =
getIndex(i,j,k);
229 unsigned long index =
getIndex(i,j,k);
236 unsigned int index =
getIndex(i,j,k);
243 unsigned int index =
getIndex(i,j,k);
253 unsigned long index =
getIndex(i,j,k);
262 unsigned int index =
getIndex(i,j,k);
271 unsigned int index =
getIndex(i,j,k);
287 unsigned long index =
getIndex(i, j, k);
297 unsigned long index =
getIndex(i,j,k);
306 unsigned long index =
getIndex(i, j, k);
319 unsigned long index =
getIndex(i, j, k);
330 unsigned long index =
getIndex(i,j,k);
340 unsigned long index =
getIndex(i, j, k);
354 unsigned long index =
getIndex(i, j, k);
365 unsigned long index =
getIndex(i,j,k);
375 unsigned long index =
getIndex(i, j, k);
389 unsigned long index =
getIndex(i, j, k);
400 unsigned long index =
getIndex(i,j,k);
410 unsigned long index =
getIndex(i, j, k);
424 unsigned long index =
getIndex(i, j, k);
436 unsigned long index =
getIndex(i,j,k);
447 unsigned long index =
getIndex(i, j, k);
462 unsigned long index =
getIndex(i, j, k);
474 unsigned long index =
getIndex(i,j,k);
485 unsigned long index =
getIndex(i, j, k);
501 const double offWeight = 0.1, sumWeightInv = 1.0 / (1.0 + 4 * (1 + offWeight) * offWeight);
507 for (
int i2 = -1; i2 < 2; ++ i2) {
508 for (
int k2 = -1; k2 < 2; ++ k2) {
518 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
522 for (
int i2 = 0; i2 < 2; ++ i2) {
523 for (
int k2 = -1; k2 < 2; ++ k2) {
533 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
537 for (
int i2 = -1; i2 < 1; ++ i2) {
538 for (
int k2 = -1; k2 < 2; ++ k2) {
548 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
552 for (
int i2 = -1; i2 < 2; ++ i2) {
553 for (
int k2 = 0; k2 < 2; ++ k2) {
563 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
567 for (
int i2 = -1; i2 < 2; ++ i2) {
568 for (
int k2 = -1; k2 < 1; ++ k2) {
578 unsigned long index =
getIndex(0, j, 0);
579 tmp[index] = data[index];
583 tmp[index] = data[index];
587 tmp[index] = data[index];
591 tmp[index] = data[index];
596 unsigned long index =
getIndex(i, j, k);
597 data[index] = tmp[index];
606 std::ofstream out(fname);
612 unsigned long index =
getIndex(i, j, k);
613 out << std::setw(14) << x
614 << std::setw(14) << y
615 << std::setw(14) << z
675 unsigned short switchX = ((corner &
HX) >> 2), switchY = ((corner &
HY) >> 1), switchZ = (corner &
HZ);
676 double factorX = 0.5 + (1 - 2 * switchX) * (0.5 - idx.
weight(0));
677 double factorY = 0.5 + (1 - 2 * switchY) * (0.5 - idx.
weight(1));
678 double factorZ = 0.5 + (1 - 2 * switchZ) * (0.5 - idx.
weight(2));
680 unsigned long i = idx.
i + switchX, j = idx.
j + switchY, k = idx.
k + switchZ;
682 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)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
PETE_TBTree< FnCopysign, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > copysign(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
T::PETE_Expr_t::PETE_Return_t sum(const PETE_Expr< T > &expr)
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)