25 const std::string& filename
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 (filename.c_str(), H5_O_RDONLY, props);
35 if (
file_m == (h5_file_t)H5_ERR) {
37 "_FM3DH5BlockBase::openFileMPIOCollective () ",
38 "Cannot open file '" + filename +
"'!");
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
246 for (
unsigned long int i = 0;
257 if(
std::abs(F[i].second) > Ez_max) {
260 F[i].second /= Ez_max;
constexpr double two_pi
The value of .
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
unsigned long getIndex(unsigned int i, unsigned int j, unsigned int k) const
void getFieldInfo(const char *)
static MPI_Comm getComm()
unsigned int num_gridpz_m
void getResonanceFrequency(void)
Inform & endl(Inform &inf)
void readField(const char *name, double *x, double *y, double *z)
long long getNumSteps(void)
unsigned int num_gridpy_m
void openFileMPIOCollective(const std::string &filename)
void setStep(const long long)
double getWeightedData(const std::vector< double > &data, const IndexTriplet &idx, unsigned short corner) const
virtual void getOnaxisEz(std::vector< std::pair< double, double > > &F)
virtual void setFrequency(double freq)
virtual double getFrequency() const
unsigned int num_gridpx_m
virtual void getInfo(Inform *msg)
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
Vector_t interpolateTrilinearly(const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, const Vector_t &X) const
std::vector< double > FieldstrengthEz_m