Skip to content

Commit

Permalink
correct T hdf5.hpp for window and outstart
Browse files Browse the repository at this point in the history
  • Loading branch information
pdziekan committed Sep 10, 2024
1 parent 38f01f9 commit ef5f356
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libmpdata++/output/hdf5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,18 @@ namespace libmpdataxx
// T
{
// incl. t=0 and t=outstart
const hsize_t nt_out = ((nt - this->outstart) / this->outfreq + (this->outstart == 0 ? 1 : 2)) * this->outwindow // for outstart>0 we still want to store t=0
- (this->outwindow - (nt % this->outfreq) - 1); // timsteps from outwindow that go beyond nt
const hsize_t nt_out = ((nt - this->outstart) / this->outfreq + 1) * this->outwindow
+ (this->outstart == 0 ? 0 : 1) // for outstart>0 we still want to store t=0
- std::max(0, this->outwindow - (nt % this->outfreq) - 1); // timsteps from outwindow that go beyond nt

float dt = this->dt;

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

Expand Down

0 comments on commit ef5f356

Please sign in to comment.