17 FieldstrengthEz_m(nullptr),
18 FieldstrengthEx_m(nullptr),
19 FieldstrengthEy_m(nullptr),
20 FieldstrengthBz_m(nullptr),
21 FieldstrengthBx_m(nullptr),
22 FieldstrengthBy_m(nullptr)
25 std::string tmpString;
32 bool parsing_passed =
true;
34 parsing_passed = interpretLine<std::string>(file, tmpString);
36 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
39 if (tmpString !=
"TRUE" &&
42 "The second string on the first line of 3D field "
43 "maps has to be either TRUE or FALSE");
48 parsing_passed = parsing_passed &&
50 parsing_passed = parsing_passed &&
52 parsing_passed = parsing_passed &&
54 parsing_passed = parsing_passed &&
58 parsing_passed = parsing_passed &&
59 interpretLine<double>(file,
68 parsing_passed = parsing_passed &&
77 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
113 std::string tmpString;
133 interpretLine<double>(in,
164 ii = index_x * deltaX + index_y * deltaY;
175 for(
unsigned long i = 0; i < totalSize; ++ i) {
190 std::vector<Vector_t> bf(ef);
193 const unsigned long index_z = k;
195 const unsigned long index_y = j * deltaY;
197 const unsigned long index = i * deltaX + index_y + index_z;
260 const unsigned int deltaZ = 1;
262 const unsigned long index1 = index_x * deltaX + index_y * deltaY + index_z * deltaZ;
264 E(0) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEx_m[index1 ]
265 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEx_m[index1 + deltaX ]
266 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthEx_m[index1 + deltaY ]
267 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthEx_m[index1 + deltaX + deltaY ]
268 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthEx_m[index1 + deltaZ]
269 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthEx_m[index1 + deltaX + deltaZ]
270 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthEx_m[index1 + deltaY + deltaZ]
271 + lever_x * lever_y * lever_z *
FieldstrengthEx_m[index1 + deltaX + deltaY + deltaZ];
273 E(1) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEy_m[index1 ]
274 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEy_m[index1 + deltaX ]
275 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthEy_m[index1 + deltaY ]
276 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthEy_m[index1 + deltaX + deltaY ]
277 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthEy_m[index1 + deltaZ]
278 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthEy_m[index1 + deltaX + deltaZ]
279 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthEy_m[index1 + deltaY + deltaZ]
280 + lever_x * lever_y * lever_z *
FieldstrengthEy_m[index1 + deltaX + deltaY + deltaZ];
282 E(2) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEz_m[index1 ]
283 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEz_m[index1 + deltaX ]
284 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthEz_m[index1 + deltaY ]
285 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthEz_m[index1 + deltaX + deltaY ]
286 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthEz_m[index1 + deltaZ]
287 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthEz_m[index1 + deltaX + deltaZ]
288 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthEz_m[index1 + deltaY + deltaZ]
289 + lever_x * lever_y * lever_z *
FieldstrengthEz_m[index1 + deltaX + deltaY + deltaZ];
291 B(0) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBx_m[index1 ]
292 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBx_m[index1 + deltaX ]
293 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthBx_m[index1 + deltaY ]
294 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthBx_m[index1 + deltaX + deltaY ]
295 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthBx_m[index1 + deltaZ]
296 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthBx_m[index1 + deltaX + deltaZ]
297 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthBx_m[index1 + deltaY + deltaZ]
298 + lever_x * lever_y * lever_z *
FieldstrengthBx_m[index1 + deltaX + deltaY + deltaZ];
300 B(1) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBy_m[index1 ]
301 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBy_m[index1 + deltaX ]
302 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthBy_m[index1 + deltaY ]
303 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthBy_m[index1 + deltaX + deltaY ]
304 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthBy_m[index1 + deltaZ]
305 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthBy_m[index1 + deltaX + deltaZ]
306 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthBy_m[index1 + deltaY + deltaZ]
307 + lever_x * lever_y * lever_z *
FieldstrengthBy_m[index1 + deltaX + deltaY + deltaZ];
309 B(2) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBz_m[index1 ]
310 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBz_m[index1 + deltaX ]
311 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthBz_m[index1 + deltaY ]
312 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthBz_m[index1 + deltaX + deltaY ]
313 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthBz_m[index1 + deltaZ]
314 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthBz_m[index1 + deltaX + deltaZ]
315 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthBz_m[index1 + deltaY + deltaZ]
316 + lever_x * lever_y * lever_z *
FieldstrengthBz_m[index1 + deltaX + deltaY + deltaZ];
365 F[i].first =
hz_m * i;
370 if (opal->isOptimizerRun())
return;
373 opal->getAuxiliaryOutputDirectory(),
376 std::ofstream out(fname);
380 out << std::setw(16) << std::setprecision(8) << F[i].first
381 << std::setw(16) << std::setprecision(8) << E(0)
382 << std::setw(16) << std::setprecision(8) << E(1)
383 << std::setw(16) << std::setprecision(8) << E(2)
384 << std::setw(16) << std::setprecision(8) << B(0)
385 << std::setw(16) << std::setprecision(8) << B(1)
386 << std::setw(16) << std::setprecision(8) << B(2) <<
"\n";
PETE_TUTree< FnCeil, typename T::PETE_Expr_t > ceil(const PETE_Expr< T > &l)
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Inform & endl(Inform &inf)
Inform & level3(Inform &inf)
constexpr double two_pi
The value of.
constexpr double e
The value of.
constexpr double mu_0
The permeability of vacuum in Vs/Am.
constexpr double MVpm2Vpm
std::string combineFilePath(std::initializer_list< std::string > ilist)
std::string toUpper(const std::string &str)
static OpalData * getInstance()
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)
void write3DField(unsigned int nx, unsigned int ny, unsigned int nz, const std::pair< double, double > &xrange, const std::pair< double, double > &yrange, const std::pair< double, double > &zrange, const std::vector< Vector_t > &ef, const std::vector< Vector_t > &bf)
virtual void getInfo(Inform *msg)
double * FieldstrengthEx_m
double * FieldstrengthBx_m
unsigned int num_gridpz_m
unsigned int num_gridpy_m
double * FieldstrengthEz_m
unsigned int num_gridpx_m
virtual void getOnaxisEz(std::vector< std::pair< double, double > > &F)
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
double * FieldstrengthBy_m
virtual void setFrequency(double freq)
FM3DDynamic(std::string aFilename)
double * FieldstrengthBz_m
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const
virtual double getFrequency() const
double * FieldstrengthEy_m
Vektor< double, 3 > Vector_t