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 2947fef + de04c00 commit 6da169f
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 73 deletions.
21 changes: 14 additions & 7 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ module subroutine io_dump_particle_info_base(self, param, idx)
integer(I4B) :: i
character(STRMAX) :: errmsg

!if ((param%out_type == REAL4_TYPE) .or. (param%out_type == REAL8_TYPE)) then
if ((param%out_type == REAL4_TYPE) .or. (param%out_type == REAL8_TYPE)) then
if (lfirst) then
select case(param%out_stat)
case('APPEND')
Expand Down Expand Up @@ -200,15 +200,14 @@ module subroutine io_dump_particle_info_base(self, param, idx)
end select

close(unit = LUN, err = 667, iomsg = errmsg)
!else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then
if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then
else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then
call self%write_particle_info(param%nciu)
end if

return

667 continue
write(*,*) "Error reading central body file: " // trim(adjustl(errmsg))
write(*,*) "Error writing particle information file: " // trim(adjustl(errmsg))
call util_exit(FAILURE)
end subroutine io_dump_particle_info_base

Expand Down Expand Up @@ -286,6 +285,8 @@ module subroutine io_dump_system(self, param)
else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then
dump_param%outfile = trim(adjustl(DUMP_NC_FILE(idx)))
dump_param%in_type = NETCDF_DOUBLE_TYPE
dump_param%nciu%id_chunk = self%pl%nbody + self%tp%nbody
dump_param%nciu%time_chunk = 1
end if
dump_param%T0 = param%t
dump_param%ioutput = 0
Expand Down Expand Up @@ -734,7 +735,7 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg)
iostat = -1
return
end if
if ((param%in_type /= REAL8_TYPE) .and. (param%in_type /= "ASCII")) then
if ((param%in_type /= REAL8_TYPE) .and. (param%in_type /= "ASCII") .and. (param%in_type /= NETCDF_FLOAT_TYPE) .and. (param%in_type /= NETCDF_DOUBLE_TYPE)) then
write(iomsg,*) 'Invalid input file type:',trim(adjustl(param%in_type))
iostat = -1
return
Expand Down Expand Up @@ -947,7 +948,9 @@ module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg)
call io_param_writer_one("OUT_FORM", param%out_form, unit)
call io_param_writer_one("OUT_STAT", "APPEND", unit)
end if
call io_param_writer_one("PARTICLE_OUT", param%particle_out, unit)
if ((param%out_type /= REAL4_TYPE) .and. (param%out_type /= REAL8_TYPE)) then
call io_param_writer_one("PARTICLE_OUT", param%particle_out, unit)
end if
if (param%enc_out /= "") then
call io_param_writer_one("ENC_OUT", param%enc_out, unit)
end if
Expand Down Expand Up @@ -1625,7 +1628,7 @@ module function io_read_frame_cb(self, iu, param) result(ierr)
return

667 continue
write(*,*) "Error reading central body file: " // trim(adjustl(errmsg))
write(*,*) "Error reading central body frame: " // trim(adjustl(errmsg))
call util_exit(FAILURE)
end function io_read_frame_cb

Expand Down Expand Up @@ -1796,6 +1799,8 @@ module subroutine io_read_particle_info_system(self, param)
character(STRMAX) :: errmsg
type(swiftest_particle_info), allocatable :: tmpinfo

if (.not.((param%out_type == REAL4_TYPE) .or. (param%out_type == REAL8_TYPE))) return ! This subroutine is only necessary for classic binary input files

open(unit = LUN, file = param%particle_out, status = 'OLD', form = 'UNFORMATTED', err = 667, iomsg = errmsg)

allocate(tmpinfo, mold=self%cb%info)
Expand Down Expand Up @@ -2109,6 +2114,8 @@ module subroutine io_write_frame_system(self, param)
end if
else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then

param%nciu%id_chunk = pl%nbody + tp%nbody
param%nciu%time_chunk = param%istep_out / param%istep_dump
if (lfirst) then
inquire(file=param%outfile, exist=fileExists)

Expand Down
2 changes: 2 additions & 0 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ module swiftest_classes
integer(I4B) :: discard_vhy_varid !! NetCDF ID for the heliocentric velocity of the body at the time of discard y variable
integer(I4B) :: discard_vhz_varid !! NetCDF ID for the heliocentric velocity of the body at the time of discard z variable
integer(I4B) :: discard_body_id_varid !! NetCDF ID for the id of the other body involved in the discard
integer(I4B) :: id_chunk !! Chunk size for the id dimension variables
integer(I4B) :: time_chunk !! Chunk size for the time dimension variables
contains
procedure :: close => netcdf_close !! Closes an open NetCDF file
procedure :: flush => netcdf_flush !! Flushes the current buffer to disk by closing and re-opening the file.
Expand Down
Loading

0 comments on commit 6da169f

Please sign in to comment.