From 561c0b87053ac48ac9e59514f9a9bbe5aa05664a Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 1 Dec 2022 13:34:10 -0500 Subject: [PATCH] Simplified swiftest_driver even further. No need to explicitly call the dealloc method on the nbody_system, all possible types have finalizers built in that do that automatically --- src/io/io.f90 | 5 ++++- src/main/swiftest_driver.f90 | 6 ++---- src/symba/symba_util.f90 | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/io/io.f90 b/src/io/io.f90 index f77278424..129f1e82d 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -283,7 +283,10 @@ module subroutine io_dump_system_storage(self, param) iloop_start = param%iloop - param%istep_out * param%dump_cadence + 1_I8B do i = 1_I8B, param%dump_cadence param%ioutput = int(iloop_start / param%istep_out, kind=I8B) + i - call self%frame(i)%system%write_frame(param) + if (allocated(self%frame(i)%system)) then + call self%frame(i)%system%write_frame(param) + deallocate(self%frame(i)%system) + end if end do return diff --git a/src/main/swiftest_driver.f90 b/src/main/swiftest_driver.f90 index 3737b4075..8845be170 100644 --- a/src/main/swiftest_driver.f90 +++ b/src/main/swiftest_driver.f90 @@ -161,12 +161,10 @@ program swiftest_driver end if end do + ! Dump any remaining history if it exists + call system_history%dump(param) if (display_style == "COMPACT") write(*,*) "SWIFTEST STOP" // trim(adjustl(param%integrator)) end associate - call nbody_system%dealloc() - call util_exit(SUCCESS) - - stop end program swiftest_driver diff --git a/src/symba/symba_util.f90 b/src/symba/symba_util.f90 index 0087c24e4..f0f300bc1 100644 --- a/src/symba/symba_util.f90 +++ b/src/symba/symba_util.f90 @@ -482,6 +482,7 @@ module subroutine symba_util_final_pl(self) return end subroutine symba_util_final_pl + module subroutine symba_util_final_system(self) !! author: David A. Minton !! @@ -495,6 +496,7 @@ module subroutine symba_util_final_system(self) return end subroutine symba_util_final_system + module subroutine symba_util_final_tp(self) !! author: David A. Minton !!