Skip to content

Commit

Permalink
Merge pull request #495 from pdziekan/outwindow_T
Browse files Browse the repository at this point in the history
Outwindow t
  • Loading branch information
pdziekan authored Sep 11, 2024
2 parents 5dbea9b + 1582f06 commit bb68ecf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libmpdata++/output/detail/output_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace libmpdataxx
record_time = this->time;
for (int t = 0; t < outwindow; ++t)
{
if ((this->timestep - t) % static_cast<int>(outfreq) == 0 && this->timestep >= static_cast<int>(outstart)) record_all();
if ((this->timestep - t) % static_cast<int>(outfreq) == 0 && (this->timestep - t) >= static_cast<int>(outstart)) record_all();
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions libmpdata++/output/hdf5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,18 @@ namespace libmpdataxx
// T
{
// 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
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 - int(std::fmod(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) * (blitz::firstIndex() + 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) * (blitz::firstIndex() + 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 bb68ecf

Please sign in to comment.