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

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Oct 14, 2021
2 parents 6da169f + 385b215 commit a342665
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1215,8 +1215,8 @@ module subroutine io_read_in_base(self,param)
case(NETCDF_DOUBLE_TYPE, NETCDF_FLOAT_TYPE)
select type(self)
class is (swiftest_body)
if (self%nbody == 0) return
call self%setup(self%nbody, param)
if (self%nbody == 0) return
end select

ierr = self%read_frame(param%nciu, param)
Expand Down
33 changes: 18 additions & 15 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,26 @@ module function netcdf_get_old_t_final_system(self, param) result(old_t_final)
! Result
real(DP) :: old_t_final
! Internals
class(swiftest_nbody_system), allocatable :: tmpsys
class(swiftest_parameters), allocatable :: tmpparam
Integer(I4B) :: ierr
!class(swiftest_nbody_system), allocatable :: tmpsys
!class(swiftest_parameters), allocatable :: tmpparam
!integer(I4B) :: ierr
integer(I4B) :: itmax
real(DP), dimension(:), allocatable :: tvals

old_t_final = 0.0_DP
allocate(tmpsys, source=self)
allocate(tmpparam, source=param)
ierr = 0
do
ierr = tmpsys%read_frame(param%nciu, tmpparam)
end do

if (is_iostat_end(ierr)) then
old_t_final = tmpparam%t
return
end if

call check( nf90_open(param%outfile, NF90_NOWRITE, param%nciu%ncid) )
call check( nf90_inquire_dimension(param%nciu%ncid, param%nciu%time_dimid, len=itmax) )
allocate(tvals(itmax))
call check( nf90_inq_varid(param%nciu%ncid, TIME_DIMNAME, param%nciu%time_varid) )
call check( nf90_get_var(param%nciu%ncid, param%nciu%time_varid, tvals(:)) )
call check( nf90_close(param%nciu%ncid) )

old_t_final = tvals(itmax)

deallocate(tvals)

return
end function netcdf_get_old_t_final_system


Expand Down Expand Up @@ -303,7 +306,7 @@ module subroutine netcdf_open(self, param)
class(netcdf_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters

call check( nf90_open(param%outfile, nf90_write, self%ncid) )
call check( nf90_open(param%outfile, NF90_WRITE, self%ncid) )

call check( nf90_inq_varid(self%ncid, TIME_DIMNAME, self%time_varid))
call check( nf90_inq_varid(self%ncid, ID_DIMNAME, self%id_varid))
Expand Down

0 comments on commit a342665

Please sign in to comment.