Skip to content

Commit

Permalink
record_aux for 1D arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
pdziekan committed Apr 4, 2024
1 parent 55b400c commit 5b18239
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libmpdata++/output/hdf5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,22 @@ namespace libmpdataxx
aux.write(data, flttype_solver, H5::DataSpace(parent_t::n_dims, shape.data()), space, dxpl_id);
}

// for 1-D arrays
void record_aux_hlpr(const std::string &name, typename solver_t::real_t *data, hsize_t size, H5::H5File hdf)
{
assert(this->rank == 0);

auto aux = hdf.createDataSet(
name,
flttype_output,
H5::DataSpace(1, &size)
);

auto space = aux.getSpace();
space.selectHyperslab(H5S_SELECT_SET, &size, &zero);
aux.write(data, flttype_solver, H5::DataSpace(1, &size), space, dxpl_id);
}

// for discontiguous array with halos
void record_aux_dsc_hlpr(const std::string &name, const typename solver_t::arr_t &arr, H5::H5File hdf, bool srfc = false)
{
Expand Down Expand Up @@ -521,6 +537,12 @@ namespace libmpdataxx
record_aux_hlpr(name, data, hdfcp);
}

void record_aux_const(const std::string &name, typename solver_t::real_t *data, const int &size)
{
H5::H5File hdfcp(const_file, H5F_ACC_RDWR);
record_aux_hlpr(name, data, size, hdfcp);
}

void record_aux_const(const std::string &name, const std::string &group_name, typename solver_t::real_t data)
{
H5::H5File hdfcp(const_file, H5F_ACC_RDWR
Expand Down

0 comments on commit 5b18239

Please sign in to comment.