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

Commit

Permalink
fixed masking and indexing in netcdf_read_particle_info_base
Browse files Browse the repository at this point in the history
  • Loading branch information
cwishard committed Sep 29, 2021
1 parent 898d20d commit ef0bbba
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,17 @@ module subroutine netcdf_read_particle_info_base(self, iu, ind)
class is (swiftest_body)
associate(n => self%nbody)
if (n == 0) return
!allocate(ind(n))
!call util_sort(self%id(1:n), ind)

self%status(:) = ACTIVE
self%lmask(:) = .true.
do i = 1, n
!self%id(i) = i
!j = ind(i) + 1
idslot = i + 1
!call check( nf90_get_var(iu%ncid, iu%id_varid, self%id(j), start=[idslot]) )
call check( nf90_put_var(iu%ncid, iu%id_varid, i, start=[idslot]))
call self%info(i)%set_value(status="ACTIVE")
end do

do i = 1, n
idslot = ind(i)

call check( nf90_get_var(iu%ncid, iu%id_varid, self%id(i), start=[idslot]) )

call check( nf90_get_var(iu%ncid, iu%name_varid, self%info(i)%name, start=[1, idslot], count=[NAMELEN, 1]) )
strlen = len(trim(adjustl(self%info(i)%name)))
Expand Down Expand Up @@ -578,10 +580,8 @@ module subroutine netcdf_read_particle_info_base(self, iu, ind)
end associate

class is (swiftest_cb)
self%id = 0
idslot = self%id + 1
!call check( nf90_get_var(iu%ncid, iu%id_varid, self%id, start=[idslot]) )
call check( nf90_put_var(iu%ncid, iu%id_varid, self%id, start=[idslot]))
idslot = 1
call check( nf90_get_var(iu%ncid, iu%id_varid, self%id, start=[idslot]) )

call check( nf90_get_var(iu%ncid, iu%name_varid, self%info%name, start=[1, idslot], count=[NAMELEN, 1]) )
strlen = len(trim(adjustl(self%info%name)))
Expand Down

0 comments on commit ef0bbba

Please sign in to comment.