Skip to content

Commit

Permalink
Merge pull request #481 from pdziekan/hdf_attr_flttype
Browse files Browse the repository at this point in the history
hdf5: 32bit precision of attribute output
  • Loading branch information
pdziekan committed Feb 14, 2023
2 parents d9f0fe7 + ecebfa7 commit cb21362
Show file tree
Hide file tree
Showing 18 changed files with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions libmpdata++/output/hdf5.hpp
Expand Up @@ -583,12 +583,11 @@ namespace libmpdataxx
group.createAttribute("opts", type, H5::DataSpace(1, &one)).write(type, opts_str.data());
}
{
const auto type = flttype_solver;
group.createAttribute("dt", type, H5::DataSpace(1, &one)).write(type, &this->dt);
group.createAttribute("dt", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->dt);
const auto names = std::vector<std::string>{"di", "dj", "dk"};
for (int d = 0; d < parent_t::n_dims; ++d)
{
group.createAttribute(names[d], type, H5::DataSpace(1, &one)).write(type, &this->dijk[d]);
group.createAttribute(names[d], flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->dijk[d]);
}
}
{
Expand All @@ -598,8 +597,7 @@ namespace libmpdataxx
}
if (parent_t::ct_params_t_::var_dt)
{
const auto type = flttype_solver;
group.createAttribute("max_courant", type, H5::DataSpace(1, &one)).write(type, &this->max_courant);
group.createAttribute("max_courant", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->max_courant);
}
{
const auto type = H5::PredType::NATIVE_INT;
Expand Down Expand Up @@ -645,8 +643,7 @@ namespace libmpdataxx
group.createAttribute("prs_scheme", type, H5::DataSpace(1, &one)).write(type, prs_scheme_str.data());
}
{
const auto type = flttype_solver;
group.createAttribute("prs_tol", type, H5::DataSpace(1, &one)).write(type, &this->prs_tol);
group.createAttribute("prs_tol", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->prs_tol);
}
}

Expand All @@ -668,8 +665,7 @@ namespace libmpdataxx
group.createAttribute("stress_diff", type, H5::DataSpace(1, &one)).write(type, sdiff_str.data());
}
{
const auto type = flttype_solver;
group.createAttribute("cdrag", type, H5::DataSpace(1, &one)).write(type, &this->cdrag);
group.createAttribute("cdrag", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->cdrag);
}
}

Expand All @@ -680,8 +676,7 @@ namespace libmpdataxx

const auto &group = hdfcp.openGroup("sgs");
{
const auto type = flttype_solver;
group.createAttribute("eta", type, H5::DataSpace(1, &one)).write(type, &this->eta);
group.createAttribute("eta", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->eta);
}
}

Expand All @@ -692,9 +687,8 @@ namespace libmpdataxx

const auto &group = hdfcp.openGroup("sgs");
{
const auto type = flttype_solver;
group.createAttribute("smg_c", type, H5::DataSpace(1, &one)).write(type, &this->smg_c);
group.createAttribute("c_m", type, H5::DataSpace(1, &one)).write(type, &this->c_m);
group.createAttribute("smg_c", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->smg_c);
group.createAttribute("c_m", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->c_m);
}
}

Expand All @@ -708,10 +702,9 @@ namespace libmpdataxx
hdfcp.createGroup("boussinesq");
const auto &group = hdfcp.openGroup("boussinesq");
{
const auto type = flttype_solver;
group.createAttribute("g", type, H5::DataSpace(1, &one)).write(type, &this->g);
group.createAttribute("Tht_ref", type, H5::DataSpace(1, &one)).write(type, &this->Tht_ref);
group.createAttribute("hflux_const", type, H5::DataSpace(1, &one)).write(type, &this->hflux_const);
group.createAttribute("g", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->g);
group.createAttribute("Tht_ref", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->Tht_ref);
group.createAttribute("hflux_const", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->hflux_const);
}
{
auto dset = group.createDataSet("tht_e", flttype_output, sspace);
Expand All @@ -726,8 +719,7 @@ namespace libmpdataxx

const auto &group = hdfcp.openGroup("boussinesq");
{
const auto type = flttype_solver;
group.createAttribute("prandtl_num", type, H5::DataSpace(1, &one)).write(type, &this->prandtl_num);
group.createAttribute("prandtl_num", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->prandtl_num);
}
{
auto dset = group.createDataSet("mix_len", flttype_output, sspace);
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/paper_2015_GMD/4_revolving_sphere_3d/refdata/basic/const.h5
Binary file not shown.
Binary file modified tests/paper_2015_GMD/4_revolving_sphere_3d/refdata/fct/const.h5
Binary file not shown.
Binary file modified tests/paper_2015_GMD/4_revolving_sphere_3d/refdata/iga/const.h5
Binary file not shown.
Binary file modified tests/paper_2015_GMD/4_revolving_sphere_3d/refdata/iga_fct/const.h5
Binary file not shown.
Binary file modified tests/paper_2015_GMD/4_revolving_sphere_3d/refdata/upwind/const.h5
Binary file not shown.
Binary file modified tests/paper_2015_GMD/7_shallow_water/refdata/1d_fct_abs/const.h5
Binary file not shown.
Binary file not shown.
Binary file modified tests/paper_2015_GMD/7_shallow_water/refdata/1d_fct_iga/const.h5
Binary file not shown.
Binary file not shown.
Binary file modified tests/paper_2015_GMD/7_shallow_water/refdata/2d_fct_abs/const.h5
Binary file not shown.
Binary file modified tests/paper_2015_GMD/7_shallow_water/refdata/2d_fct_iga/const.h5
Binary file not shown.
Binary file modified tests/sandbox/pbl/refdata/out_pbl_iles_short/const.h5
Binary file not shown.
Binary file modified tests/sandbox/pbl/refdata/out_pbl_smg_short/const.h5
Binary file not shown.

0 comments on commit cb21362

Please sign in to comment.