16 FieldstrengthEz_m(NULL),
17 FieldstrengthEx_m(NULL),
18 FieldstrengthEy_m(NULL),
19 FieldstrengthBz_m(NULL),
20 FieldstrengthBx_m(NULL),
21 FieldstrengthBy_m(NULL)
24 std::string tmpString;
31 bool parsing_passed =
true;
33 parsing_passed = interpretLine<std::string>(file, tmpString);
35 parsing_passed = interpretLine<std::string, std::string>(file, tmpString, tmpString);
38 if (tmpString !=
"TRUE" &&
41 "The second string on the first line of 3D field "
42 "maps has to be either TRUE or FALSE");
47 parsing_passed = parsing_passed &&
49 parsing_passed = parsing_passed &&
51 parsing_passed = parsing_passed &&
53 parsing_passed = parsing_passed &&
57 parsing_passed = parsing_passed &&
58 interpretLine<double>(file,
67 parsing_passed = parsing_passed &&
76 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
112 std::string tmpString;
132 interpretLine<double>(in,
163 ii = index_x * deltaX + index_y * deltaY;
174 for(
unsigned long i = 0; i < totalSize; ++ i) {
189 std::vector<Vector_t> bf(ef);
192 const unsigned long index_z = k;
194 const unsigned long index_y = j * deltaY;
196 const unsigned long index = i * deltaX + index_y + index_z;
259 const unsigned int deltaZ = 1;
261 const unsigned long index1 = index_x * deltaX + index_y * deltaY + index_z * deltaZ;
263 E(0) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEx_m[index1 ]
264 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEx_m[index1 + deltaX ]
265 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthEx_m[index1 + deltaY ]
266 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthEx_m[index1 + deltaX + deltaY ]
267 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthEx_m[index1 + deltaZ]
268 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthEx_m[index1 + deltaX + deltaZ]
269 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthEx_m[index1 + deltaY + deltaZ]
270 + lever_x * lever_y * lever_z *
FieldstrengthEx_m[index1 + deltaX + deltaY + deltaZ];
272 E(1) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEy_m[index1 ]
273 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEy_m[index1 + deltaX ]
274 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthEy_m[index1 + deltaY ]
275 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthEy_m[index1 + deltaX + deltaY ]
276 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthEy_m[index1 + deltaZ]
277 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthEy_m[index1 + deltaX + deltaZ]
278 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthEy_m[index1 + deltaY + deltaZ]
279 + lever_x * lever_y * lever_z *
FieldstrengthEy_m[index1 + deltaX + deltaY + deltaZ];
281 E(2) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEz_m[index1 ]
282 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthEz_m[index1 + deltaX ]
283 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthEz_m[index1 + deltaY ]
284 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthEz_m[index1 + deltaX + deltaY ]
285 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthEz_m[index1 + deltaZ]
286 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthEz_m[index1 + deltaX + deltaZ]
287 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthEz_m[index1 + deltaY + deltaZ]
288 + lever_x * lever_y * lever_z *
FieldstrengthEz_m[index1 + deltaX + deltaY + deltaZ];
290 B(0) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBx_m[index1 ]
291 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBx_m[index1 + deltaX ]
292 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthBx_m[index1 + deltaY ]
293 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthBx_m[index1 + deltaX + deltaY ]
294 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthBx_m[index1 + deltaZ]
295 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthBx_m[index1 + deltaX + deltaZ]
296 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthBx_m[index1 + deltaY + deltaZ]
297 + lever_x * lever_y * lever_z *
FieldstrengthBx_m[index1 + deltaX + deltaY + deltaZ];
299 B(1) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBy_m[index1 ]
300 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBy_m[index1 + deltaX ]
301 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthBy_m[index1 + deltaY ]
302 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthBy_m[index1 + deltaX + deltaY ]
303 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthBy_m[index1 + deltaZ]
304 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthBy_m[index1 + deltaX + deltaZ]
305 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthBy_m[index1 + deltaY + deltaZ]
306 + lever_x * lever_y * lever_z *
FieldstrengthBy_m[index1 + deltaX + deltaY + deltaZ];
308 B(2) += (1.0 - lever_x) * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBz_m[index1 ]
309 + lever_x * (1.0 - lever_y) * (1.0 - lever_z) *
FieldstrengthBz_m[index1 + deltaX ]
310 + (1.0 - lever_x) * lever_y * (1.0 - lever_z) *
FieldstrengthBz_m[index1 + deltaY ]
311 + lever_x * lever_y * (1.0 - lever_z) *
FieldstrengthBz_m[index1 + deltaX + deltaY ]
312 + (1.0 - lever_x) * (1.0 - lever_y) * lever_z *
FieldstrengthBz_m[index1 + deltaZ]
313 + lever_x * (1.0 - lever_y) * lever_z *
FieldstrengthBz_m[index1 + deltaX + deltaZ]
314 + (1.0 - lever_x) * lever_y * lever_z *
FieldstrengthBz_m[index1 + deltaY + deltaZ]
315 + lever_x * lever_y * lever_z *
FieldstrengthBz_m[index1 + deltaX + deltaY + deltaZ];
364 F[i].first =
hz_m * i;
369 if (opal->isOptimizerRun())
return;
372 opal->getAuxiliaryOutputDirectory(),
375 std::ofstream out(fname);
379 out << std::setw(16) << std::setprecision(8) << F[i].first
380 << std::setw(16) << std::setprecision(8) << E(0)
381 << std::setw(16) << std::setprecision(8) << E(1)
382 << std::setw(16) << std::setprecision(8) << E(2)
383 << std::setw(16) << std::setprecision(8) << B(0)
384 << std::setw(16) << std::setprecision(8) << B(1)
385 << std::setw(16) << std::setprecision(8) << B(2) <<
"\n";
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
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)
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.
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