Skip to content

Commit cb21362

Browse files
authored
Merge pull request #481 from pdziekan/hdf_attr_flttype
hdf5: 32bit precision of attribute output
2 parents d9f0fe7 + ecebfa7 commit cb21362

File tree

18 files changed

+12
-20
lines changed

18 files changed

+12
-20
lines changed

libmpdata++/output/hdf5.hpp

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,11 @@ namespace libmpdataxx
583583
group.createAttribute("opts", type, H5::DataSpace(1, &one)).write(type, opts_str.data());
584584
}
585585
{
586-
const auto type = flttype_solver;
587-
group.createAttribute("dt", type, H5::DataSpace(1, &one)).write(type, &this->dt);
586+
group.createAttribute("dt", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->dt);
588587
const auto names = std::vector<std::string>{"di", "dj", "dk"};
589588
for (int d = 0; d < parent_t::n_dims; ++d)
590589
{
591-
group.createAttribute(names[d], type, H5::DataSpace(1, &one)).write(type, &this->dijk[d]);
590+
group.createAttribute(names[d], flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->dijk[d]);
592591
}
593592
}
594593
{
@@ -598,8 +597,7 @@ namespace libmpdataxx
598597
}
599598
if (parent_t::ct_params_t_::var_dt)
600599
{
601-
const auto type = flttype_solver;
602-
group.createAttribute("max_courant", type, H5::DataSpace(1, &one)).write(type, &this->max_courant);
600+
group.createAttribute("max_courant", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->max_courant);
603601
}
604602
{
605603
const auto type = H5::PredType::NATIVE_INT;
@@ -645,8 +643,7 @@ namespace libmpdataxx
645643
group.createAttribute("prs_scheme", type, H5::DataSpace(1, &one)).write(type, prs_scheme_str.data());
646644
}
647645
{
648-
const auto type = flttype_solver;
649-
group.createAttribute("prs_tol", type, H5::DataSpace(1, &one)).write(type, &this->prs_tol);
646+
group.createAttribute("prs_tol", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->prs_tol);
650647
}
651648
}
652649

@@ -668,8 +665,7 @@ namespace libmpdataxx
668665
group.createAttribute("stress_diff", type, H5::DataSpace(1, &one)).write(type, sdiff_str.data());
669666
}
670667
{
671-
const auto type = flttype_solver;
672-
group.createAttribute("cdrag", type, H5::DataSpace(1, &one)).write(type, &this->cdrag);
668+
group.createAttribute("cdrag", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->cdrag);
673669
}
674670
}
675671

@@ -680,8 +676,7 @@ namespace libmpdataxx
680676

681677
const auto &group = hdfcp.openGroup("sgs");
682678
{
683-
const auto type = flttype_solver;
684-
group.createAttribute("eta", type, H5::DataSpace(1, &one)).write(type, &this->eta);
679+
group.createAttribute("eta", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->eta);
685680
}
686681
}
687682

@@ -692,9 +687,8 @@ namespace libmpdataxx
692687

693688
const auto &group = hdfcp.openGroup("sgs");
694689
{
695-
const auto type = flttype_solver;
696-
group.createAttribute("smg_c", type, H5::DataSpace(1, &one)).write(type, &this->smg_c);
697-
group.createAttribute("c_m", type, H5::DataSpace(1, &one)).write(type, &this->c_m);
690+
group.createAttribute("smg_c", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->smg_c);
691+
group.createAttribute("c_m", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->c_m);
698692
}
699693
}
700694

@@ -708,10 +702,9 @@ namespace libmpdataxx
708702
hdfcp.createGroup("boussinesq");
709703
const auto &group = hdfcp.openGroup("boussinesq");
710704
{
711-
const auto type = flttype_solver;
712-
group.createAttribute("g", type, H5::DataSpace(1, &one)).write(type, &this->g);
713-
group.createAttribute("Tht_ref", type, H5::DataSpace(1, &one)).write(type, &this->Tht_ref);
714-
group.createAttribute("hflux_const", type, H5::DataSpace(1, &one)).write(type, &this->hflux_const);
705+
group.createAttribute("g", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->g);
706+
group.createAttribute("Tht_ref", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->Tht_ref);
707+
group.createAttribute("hflux_const", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->hflux_const);
715708
}
716709
{
717710
auto dset = group.createDataSet("tht_e", flttype_output, sspace);
@@ -726,8 +719,7 @@ namespace libmpdataxx
726719

727720
const auto &group = hdfcp.openGroup("boussinesq");
728721
{
729-
const auto type = flttype_solver;
730-
group.createAttribute("prandtl_num", type, H5::DataSpace(1, &one)).write(type, &this->prandtl_num);
722+
group.createAttribute("prandtl_num", flttype_output, H5::DataSpace(1, &one)).write(flttype_solver, &this->prandtl_num);
731723
}
732724
{
733725
auto dset = group.createDataSet("mix_len", flttype_output, sspace);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-608 Bytes
Binary file not shown.
-608 Bytes
Binary file not shown.
-608 Bytes
Binary file not shown.
-608 Bytes
Binary file not shown.
-608 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)