Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Ensure that tslot is set correctly by not using a local variable, but…
Browse files Browse the repository at this point in the history
… the one inside the nc object.
  • Loading branch information
daminton committed Feb 24, 2023
1 parent 6787781 commit 89305ee
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1034,20 +1034,20 @@ module function swiftest_io_netcdf_read_frame_system(self, nc, param) result(ier
! Return
integer(I4B) :: ierr !! Error code: returns 0 if the read is successful
! Internals
integer(I4B) :: i, idmax, npl_check, ntp_check, str_max, status, npl, ntp, tslot
integer(I4B) :: i, idmax, npl_check, ntp_check, str_max, status, npl, ntp
real(DP), dimension(:), allocatable :: rtemp
real(DP), dimension(:,:), allocatable :: vectemp
integer(I4B), dimension(:), allocatable :: itemp
logical, dimension(:), allocatable :: tpmask, plmask

call nc%open(param, readonly=.true.)
call nc%find_tslot(self%t, tslot)
call netcdf_io_check( nf90_inquire_dimension(nc%id, nc%time_dimid, len=nc%max_tslot), "netcdf_io_read_frame_system nf90_inquire_dimension time_dimid" )
tslot = min(tslot, nc%max_tslot)
associate(cb => self%cb, pl => self%pl, tp => self%tp, tslot => nc%tslot)
call nc%open(param, readonly=.true.)
call nc%find_tslot(self%t, tslot)
call netcdf_io_check( nf90_inquire_dimension(nc%id, nc%time_dimid, len=nc%max_tslot), "netcdf_io_read_frame_system nf90_inquire_dimension time_dimid" )
tslot = min(tslot, nc%max_tslot)

call self%read_hdr(nc, param)
call self%read_hdr(nc, param)

associate(cb => self%cb, pl => self%pl, tp => self%tp)
! Save these values as variables as they get reset by the setup method
npl = pl%nbody
ntp = tp%nbody
Expand Down

0 comments on commit 89305ee

Please sign in to comment.