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

Commit

Permalink
Merge branch 'debug' into IntelAdvisor
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Oct 15, 2021
2 parents f953e0b + 561c697 commit f5ecf41
Show file tree
Hide file tree
Showing 3 changed files with 330 additions and 268 deletions.
26 changes: 7 additions & 19 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1219,28 +1219,16 @@ module subroutine io_read_in_base(self,param)
! Internals
integer(I4B) :: ierr !! Error code: returns 0 if the read is successful

select case(param%in_type)
case(NETCDF_DOUBLE_TYPE, NETCDF_FLOAT_TYPE)
select type(self)
class is (swiftest_body)
call self%setup(self%nbody, param)
if (self%nbody == 0) return
end select
if ((param%in_type == NETCDF_FLOAT_TYPE) .or. (param%in_type == NETCDF_DOUBLE_TYPE)) return ! This method is not used in NetCDF mode, as reading is done for the whole system, not on individual particle types

ierr = self%read_frame(param%nciu, param)
if (ierr == 0) return
case default
select type(self)
class is (swiftest_body)
call io_read_in_body(self, param)
class is (swiftest_cb)
call io_read_in_cb(self, param)
end select
return
select type(self)
class is (swiftest_body)
call io_read_in_body(self, param)
class is (swiftest_cb)
call io_read_in_cb(self, param)
end select

667 continue
write(*,*) "Error reading body in io_read_in_base"
return
end subroutine io_read_in_base


Expand Down
29 changes: 11 additions & 18 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,8 @@ module swiftest_classes
procedure :: dump_particle_info => io_dump_particle_info_base !! Dump contents of particle information metadata to file
procedure :: read_in => io_read_in_base !! Read in body initial conditions from a file
procedure :: write_frame_netcdf => netcdf_write_frame_base !! I/O routine for writing out a single frame of time-series data for all bodies in the system in NetCDF format
procedure :: read_frame_netcdf => netcdf_read_frame_base !! I/O routine for writing out a single frame of time-series data for all bodies in the system in NetCDF format
procedure :: write_particle_info_netcdf => netcdf_write_particle_info_base !! Writes out the particle information metadata to NetCDF file
procedure :: read_particle_info => netcdf_read_particle_info_base !! Reads out the particle information metadata to NetCDF file
generic :: write_frame => write_frame_netcdf !! Set up generic procedure that will switch between NetCDF or Fortran binary depending on arguments
generic :: read_frame => read_frame_netcdf !! Set up generic procedure that will switch between NetCDF or Fortran binary depending on arguments
generic :: write_particle_info => write_particle_info_netcdf
end type swiftest_base

Expand Down Expand Up @@ -449,7 +446,8 @@ module swiftest_classes
procedure :: read_hdr_netcdf => netcdf_read_hdr_system !! Read a header for an output frame in NetCDF format
procedure :: write_hdr_netcdf => netcdf_write_hdr_system !! Write a header for an output frame in NetCDF format
procedure :: read_in => io_read_in_system !! Reads the initial conditions for an nbody system
procedure :: read_particle_info => io_read_particle_info_system !! Read in particle metadata from file
procedure :: read_particle_info_bin => io_read_particle_info_system !! Read in particle metadata from file
procedure :: read_particle_info_netcdf => netcdf_read_particle_info_system !! Read in particle metadata from file
procedure :: write_discard => io_write_discard !! Write out information about discarded test particles
procedure :: obl_pot => obl_pot_system !! Compute the contribution to the total gravitational potential due solely to the oblateness of the central body
procedure :: finalize => setup_finalize_system !! Runs any finalization subroutines when ending the simulation.
Expand All @@ -465,6 +463,7 @@ module swiftest_classes
generic :: read_hdr => read_hdr_netcdf !! Generic method call for reading headers
generic :: read_frame => read_frame_bin, read_frame_netcdf !! Generic method call for reading a frame of output data
generic :: write_frame => write_frame_bin, write_frame_netcdf !! Generic method call for writing a frame of output data
generic :: read_particle_info => read_particle_info_bin, read_particle_info_netcdf !! Genereric method call for reading in the particle information metadata
end type swiftest_nbody_system

abstract interface
Expand Down Expand Up @@ -973,25 +972,18 @@ module subroutine netcdf_initialize_output(self, param)
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
end subroutine netcdf_initialize_output

module subroutine netcdf_open(self, param)
module subroutine netcdf_open(self, param, readonly)
implicit none
class(netcdf_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
logical, optional, intent(in) :: readonly !! Logical flag indicating that this should be open read only
end subroutine netcdf_open

module subroutine netcdf_sync(self)
implicit none
class(netcdf_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset
end subroutine netcdf_sync

module function netcdf_read_frame_base(self, iu, param) result(ierr)
implicit none
class(swiftest_base), intent(inout) :: self !! Swiftest base object
class(netcdf_parameters), intent(inout) :: iu !! Parameters used to for writing a NetCDF dataset to file
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
integer(I4B) :: ierr !! Error code: returns 0 if the read is successful
end function netcdf_read_frame_base

module function netcdf_read_frame_system(self, iu, param) result(ierr)
implicit none
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object
Expand All @@ -1007,12 +999,13 @@ module subroutine netcdf_read_hdr_system(self, iu, param)
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine netcdf_read_hdr_system

module subroutine netcdf_read_particle_info_base(self, iu, ind)
module subroutine netcdf_read_particle_info_system(self, iu, plmask, tpmask)
implicit none
class(swiftest_base), intent(inout) :: self !! Swiftest particle object
class(netcdf_parameters), intent(inout) :: iu !! Parameters used to identify a particular NetCDF dataset
integer(I4B), dimension(:), intent(in) :: ind !! Index mapping from netcdf to active particles
end subroutine netcdf_read_particle_info_base
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest nbody system object
class(netcdf_parameters), intent(inout) :: iu !! Parameters used to identify a particular NetCDF dataset
logical, dimension(:), intent(in) :: plmask !! Logical array indicating which index values belong to massive bodies
logical, dimension(:), intent(in) :: tpmask !! Logical array indicating which index values belong to test particles
end subroutine netcdf_read_particle_info_system

module subroutine netcdf_write_frame_base(self, iu, param)
implicit none
Expand Down
Loading

0 comments on commit f5ecf41

Please sign in to comment.