16 std::string tmpString;
23 bool parsing_passed =
true;
30 if (tmpString !=
"TRUE" && tmpString !=
"FALSE")
32 "FM3DMagnetoStatic::FM3DMagnetoStatic",
33 "The second string on the first line of 3D field "
34 "maps has to be either TRUE or FALSE");
49 for (
unsigned long i = 0;
60 if (!parsing_passed) {
62 "FM3DMagnetoStatic::FM3DMagnetoStatic",
63 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
82 "FM3DMagnetoStatic::FM3DMagnetoStatic",
83 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
94 std::string tmpString;
121 unsigned int centerX =
static_cast<unsigned int>(std::round(-
xbegin_m /
hx_m));
122 unsigned int centerY =
static_cast<unsigned int>(std::round(-
ybegin_m /
hy_m));
125 if (std::abs(By) > Bymax) {
126 Bymax = std::abs(By);
131 for (
size_t i = 0; i < totalSize; ++i) {
208 double* data,
const IndexTriplet& idx,
unsigned short corner)
const {
209 unsigned short switchX = ((corner &
HX) >> 2), switchY = ((corner &
HY) >> 1),
210 switchZ = (corner &
HZ);
211 double factorX = 0.5 + (1 - 2 * switchX) * (0.5 - idx.
weight(0));
212 double factorY = 0.5 + (1 - 2 * switchY) * (0.5 - idx.
weight(1));
213 double factorZ = 0.5 + (1 - 2 * switchZ) * (0.5 - idx.
weight(2));
215 unsigned long i = idx.
i + switchX, j = idx.
j + switchY, k = idx.
k + switchZ;
217 return factorX * factorY * factorZ * data[
getIndex(i, j, k)];
231 double& ,
double& ,
double& ,
double& ,
double& ,
239 (*msg) <<
Filename_m <<
" (3D magnetostatic) "
ippl::Vector< T, Dim > Vector_t
std::string toUpper(const std::string &str)
bool interpreteEOF(std::ifstream &in)
static std::string typeset_msg(const std::string &msg, const std::string &title)
bool interpretLine(std::ifstream &in, S &value, const bool &file_length_known=true)
void getLine(std::ifstream &in, std::string &buffer)
virtual bool getFieldstrength(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) const
virtual bool isInside(const Vector_t< double, 3 > &r) const
double * FieldstrengthBz_m
unsigned int num_gridpz_m
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
double * FieldstrengthBy_m
IndexTriplet getIndex(const Vector_t< double, 3 > &X) const
double getWeightedData(double *data, const IndexTriplet &idx, unsigned short corner) const
double * FieldstrengthBx_m
unsigned int num_gridpx_m
Vector_t< double, 3 > interpolateTrilinearly(const Vector_t< double, 3 > &X) const
virtual bool getFieldDerivative(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B, const DiffDirection &dir) const
virtual void getInfo(Inform *msg)
FM3DMagnetoStatic(std::string aFilename)
unsigned int num_gridpy_m
Vector_t< double, 3 > weight