25 const std::string aFilename
27 h5_prop_t props = H5CreateFileProp ();
29 if (H5SetPropFileMPIOCollective (props, &comm) == H5_ERR) {
31 "FM3DH5BlockBase::openFileMPIOCollective () ",
32 "Cannot set MPIO collective!");
34 file_m = H5OpenFile (aFilename.c_str(), H5_O_RDONLY, props);
35 if (
file_m == (h5_file_t)H5_ERR) {
37 "FM3DH5BlockBase::openFileMPIOCollective () ",
38 "Cannot open file '" + aFilename +
"'!");
44 long long num_steps = H5GetNumSteps(
file_m);
48 "FM3DH5BlockBase::getNumSteps () ",
49 "Number of time-steps in file '" +
Filename_m +
"' is zero!");
52 "FM3DH5BlockBase::getNumSteps () ",
53 "Query number of time-steps in file '" +
Filename_m +
"' failed!");
60 if (H5SetStep(
file_m, step) == H5_ERR) {
62 "FM3DH5BlockBase::setStep () ",
63 "Cannot set time-step to " + std::to_string (step) +
72 h5_size_t grid_dims[3];
75 if (H5BlockGetFieldInfoByName (
77 &grid_rank, grid_dims, &field_dims, &ftype
80 "FM3DH5BlockBase::GetFieldInfo () ",
81 "Query of field info for " + std::string (
name) +
82 " in time-step " + std::to_string (last_step) +
89 if (H5Block3dGetFieldSpacing (
93 "FM3DH5BlockBase::GetFieldInfo () ",
94 "Query of field spacing"
95 " in time-step " + std::to_string (last_step) +
99 if (H5Block3dGetFieldOrigin(
102 "FM3DH5BlockBase::GetFieldInfo () ",
103 "Query of field origin"
104 " in time-step " + std::to_string (last_step) +
113 if (H5ReadFileAttribFloat64 (
117 "FM3DH5BlockBase::GetResonanceFrequency () ",
118 "Cannot read file attribute 'Resonance Frequency(Hz)'"
130 if (H5Block3dSetView(
file_m,
135 "FM3DH5BlockBase::ReadField () ",
142 if (H5Block3dReadVector3dFieldFloat64 (
145 x, y, z) == H5_ERR) {
147 "FM3DH5BlockBase::ReadField () ",
148 "Cannot read field " + std::string (
name) +
154 if (H5CloseFile (
file_m) == H5_ERR) {
156 "FM3DH5BlockBase::closeFile () ",
162 const std::vector<double>& data,
164 unsigned short corner
166 unsigned short switchX = ((corner &
HX) >> 2);
167 unsigned short switchY = ((corner &
HY) >> 1);
168 unsigned short switchZ = (corner &
HZ);
169 double factorX = 0.5 + (1 - 2 * switchX) * (0.5 - idx.
weight(0));
170 double factorY = 0.5 + (1 - 2 * switchY) * (0.5 - idx.
weight(1));
171 double factorZ = 0.5 + (1 - 2 * switchZ) * (0.5 - idx.
weight(2));
173 unsigned long i = idx.
i + switchX, j = idx.
j + switchY, k = idx.
k + switchZ;
175 return factorX * factorY * factorZ * data[
getIndex(i, j, k)];
179 const std::vector<double>& field_strength_x,
180 const std::vector<double>& field_strength_y,
181 const std::vector<double>& field_strength_z,
222 (*msg) <<
" hx= " <<
hx_m <<
" hy= " <<
hy_m <<
" hz= " <<
hz_m <<
" [mm] " <<
endl;
234 std::vector<std::pair<double, double>>& F
257 if(
std::abs(F[i].second) > Ez_max) {
260 F[i].second /= Ez_max;
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)
constexpr double two_pi
The value of.
virtual void setFrequency(double freq)
void getFieldInfo(const char *)
long long getNumSteps(void)
void openFileMPIOCollective(const std::string aFilename)
unsigned long getIndex(unsigned int i, unsigned int j, unsigned int k) const
std::vector< double > FieldstrengthEz_m
virtual double getFrequency() const
void setStep(const long long)
virtual void getOnaxisEz(std::vector< std::pair< double, double > > &F)
Vector_t interpolateTrilinearly(const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, const Vector_t &X) const
double getWeightedData(const std::vector< double > &data, const IndexTriplet &idx, unsigned short corner) const
void getResonanceFrequency(void)
void readField(const char *name, double *x, double *y, double *z)
virtual void getInfo(Inform *msg)
static MPI_Comm getComm()