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 +
"'");
507 const double offWeight = 0.1, sumWeightInv = 1.0 / (1.0 + 4 * (1 + offWeight) * offWeight);
513 for (
int i2 = -1; i2 < 2; ++ i2) {
514 for (
int k2 = -1; k2 < 2; ++ k2) {
515 double weight = std::pow(offWeight, std::abs(i2) + std::abs(k2));
524 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
528 for (
int i2 = 0; i2 < 2; ++ i2) {
529 for (
int k2 = -1; k2 < 2; ++ k2) {
530 double weight = std::pow(offWeight, std::abs(i2) + std::abs(k2));
539 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
543 for (
int i2 = -1; i2 < 1; ++ i2) {
544 for (
int k2 = -1; k2 < 2; ++ k2) {
545 double weight = std::pow(offWeight, std::abs(i2) + std::abs(k2));
554 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
558 for (
int i2 = -1; i2 < 2; ++ i2) {
559 for (
int k2 = 0; k2 < 2; ++ k2) {
560 double weight = std::pow(offWeight, std::abs(i2) + std::abs(k2));
569 const double sumWeightInv = 1.0 / (1.0 + (3 + 2 * offWeight) * offWeight);
573 for (
int i2 = -1; i2 < 2; ++ i2) {
574 for (
int k2 = -1; k2 < 1; ++ k2) {
575 double weight = std::pow(offWeight, std::abs(i2) + std::abs(k2));
584 unsigned long index =
getIndex(0, j, 0);
585 tmp[index] = data[index];
589 tmp[index] = data[index];
593 tmp[index] = data[index];
597 tmp[index] = data[index];
602 unsigned long index =
getIndex(i, j, k);
603 data[index] = tmp[index];
679 unsigned short switchX = ((corner &
HX) >> 2), switchY = ((corner &
HY) >> 1), switchZ = (corner &
HZ);
680 double factorX = 0.5 + (1 - 2 * switchX) * (0.5 - idx.
weight(0));
681 double factorY = 0.5 + (1 - 2 * switchY) * (0.5 - idx.
weight(1));
682 double factorZ = 0.5 + (1 - 2 * switchZ) * (0.5 - idx.
weight(2));
684 unsigned long i = idx.
i + switchX, j = idx.
j + switchY, k = idx.
k + switchZ;
686 return factorX * factorY * factorZ * data[
getIndex(i, j, k)];