Skip to content

Commit

Permalink
fix T in const.h5 for outstart==0
Browse files Browse the repository at this point in the history
  • Loading branch information
pdziekan committed Apr 12, 2024
1 parent 5b18239 commit d262dff
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions libmpdata++/output/hdf5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,21 @@ namespace libmpdataxx

// T
{
const hsize_t
nt_out = (nt - this->outstart) / this->outfreq + 2; // incl. t=0 and t=outstart
// incl. t=0 and t=outstart
const hsize_t nt_out = this->outstart == 0 ?
(nt - this->outstart) / this->outfreq + 1 :
(nt - this->outstart) / this->outfreq + 2; // for outstart>0 we still want to store t=0

float dt = this->dt;

blitz::Array<typename solver_t::real_t, 1> coord(nt_out);
coord(blitz::Range(1,nt_out-1)) = (this->var_dt ? this->outfreq : this->outfreq * this->dt) * (blitz::firstIndex() + this->outstart/this->outfreq);
coord(0)=0;
if(this->outstart == 0)
coord(blitz::Range(0,nt_out-1)) = (this->var_dt ? this->outfreq : this->outfreq * this->dt) * (blitz::firstIndex() + this->outstart/this->outfreq);
else
{
coord(blitz::Range(1,nt_out-1)) = (this->var_dt ? this->outfreq : this->outfreq * this->dt) * (blitz::firstIndex() + this->outstart/this->outfreq);
coord(0)=0;
}

auto curr_dim = (*hdfp).createDataSet("T", flttype_output, H5::DataSpace(1, &nt_out));

Expand Down

0 comments on commit d262dff

Please sign in to comment.