Skip to content

Commit 368f00b

Browse files
authored
Merge pull request #479 from pdziekan/record_prof_const_vctr
hdf5: record_prof_vctr_const
2 parents a862426 + ea3b2f5 commit 368f00b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

libmpdata++/output/hdf5.hpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,12 @@ namespace libmpdataxx
471471
}
472472

473473
// see above, also assumes that z is the last dimension
474-
void record_prof_const(const std::string &name, typename solver_t::real_t *data)
474+
void record_prof_const_hlpr(const std::string &name, typename solver_t::real_t *data, const bool vctr)
475475
{
476476
assert(this->rank == 0);
477477

478+
auto &_shape(vctr ? cshape : shape);
479+
478480
H5::H5File hdfcp(const_file, H5F_ACC_RDWR
479481
#if defined(USE_MPI)
480482
, H5P_DEFAULT, fapl_id
@@ -484,19 +486,28 @@ namespace libmpdataxx
484486
auto aux = hdfcp.createDataSet(
485487
name,
486488
flttype_output,
487-
H5::DataSpace(1, &shape[parent_t::n_dims - 1])
489+
H5::DataSpace(1, &_shape[parent_t::n_dims - 1])
488490
);
489491

490492
#if defined(USE_MPI)
491493
if (this->mem->distmem.rank() == 0)
492494
#endif
493495
{
494496
auto space = aux.getSpace();
495-
space.selectHyperslab(H5S_SELECT_SET, &shape[parent_t::n_dims - 1], &offst[parent_t::n_dims - 1]);
496-
aux.write(data, flttype_solver, H5::DataSpace(1, &shape[parent_t::n_dims - 1]), space);
497+
space.selectHyperslab(H5S_SELECT_SET, &_shape[parent_t::n_dims - 1], &offst[parent_t::n_dims - 1]);
498+
aux.write(data, flttype_solver, H5::DataSpace(1, &_shape[parent_t::n_dims - 1]), space);
497499
}
498500
}
499501

502+
void record_prof_const(const std::string &name, typename solver_t::real_t *data)
503+
{
504+
record_prof_const_hlpr(name, data, false);
505+
}
506+
507+
void record_prof_vctr_const(const std::string &name, typename solver_t::real_t *data)
508+
{
509+
record_prof_const_hlpr(name, data, true);
510+
}
500511

501512
// ---- recording libmpdata++ parameters ----
502513

0 commit comments

Comments
 (0)