This repository was archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved io handling for restarting runs from dump files
- Loading branch information
Showing
3 changed files
with
56 additions
and
8 deletions.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| submodule (io) s_io_read_particle | ||
|
|
||
| contains | ||
| module subroutine io_read_particle_pl(swiftest_plA, param) | ||
| !! author: David A. Minton | ||
| !! | ||
| !! Writes particle information to a file. | ||
| !! | ||
| use swiftest, except_this_one => io_read_particle_pl | ||
| implicit none | ||
| ! Arguments | ||
| class(swiftest_pl), intent(inout) :: swiftest_plA !! Swiftest massive body structure | ||
| type(user_input_parameters), intent(in) :: param !! Input colleciton of user-defined parameters | ||
| ! Internals | ||
| integer(I4B), parameter :: lun = 22 | ||
| integer(I4B) :: i, ierr, id, idx | ||
| integer(I4B), save :: iu = lun | ||
|
|
||
| associate(out_form => param%out_form, out_type => param%out_type, particle_file => param%particle_file) | ||
| open(unit = iu, file = particle_file, status = 'OLD', form = 'UNFORMATTED', iostat = ierr) | ||
| if (ierr /= 0) then | ||
| write(*, *) "Swiftest error:" | ||
| write(*, *) " unable to open binary particle file for reading" | ||
| call util_exit(FAILURE) | ||
| end if | ||
|
|
||
| do | ||
| read(LUN, iostat=ierr) id | ||
| if (ierr /=0) exit | ||
| idx = findloc(swiftest_plA%id(:), id, dim=1) | ||
| read(LUN) swiftest_plA%info(idx) | ||
| end do | ||
| close(unit = iu, iostat = ierr) | ||
| if (ierr /= 0) then | ||
| write(*, *) "Swiftest error:" | ||
| write(*, *) " unable to close particle output file" | ||
| call util_exit(FAILURE) | ||
| end if | ||
| end associate | ||
| return | ||
|
|
||
| end subroutine io_read_particle_pl | ||
| end submodule s_io_read_particle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters