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

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Dec 18, 2022
1 parent 199b288 commit 4336100
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/setup/setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ module subroutine setup_construct_system(system, param)
! Arguments
class(swiftest_nbody_system), allocatable, intent(inout) :: system !! Swiftest system object
class(swiftest_parameters), intent(inout) :: param !! Swiftest parameters
! Internals
type(encounter_storage) :: encounter_history
type(collision_storage) :: collision_history

allocate(swiftest_storage(param%dump_cadence) :: param%system_history)
allocate(netcdf_parameters :: param%system_history%nc)
Expand Down Expand Up @@ -85,26 +88,22 @@ module subroutine setup_construct_system(system, param)
end if

if (param%lenc_save_trajectory .or. param%lenc_save_closest) then
allocate(encounter_storage :: param%encounter_history)
associate (encounter_history => param%encounter_history)
allocate(encounter_io_parameters :: encounter_history%nc)
call encounter_history%reset()
select type(nc => encounter_history%nc)
class is (encounter_io_parameters)
nc%file_number = param%iloop / param%dump_cadence
end select
end associate
end if

allocate(collision_storage :: param%collision_history)
associate (collision_history => param%collision_history)
allocate(collision_io_parameters :: collision_history%nc)
call collision_history%reset()
select type(nc => collision_history%nc)
class is (collision_io_parameters)
allocate(encounter_io_parameters :: encounter_history%nc)
call encounter_history%reset()
select type(nc => encounter_history%nc)
class is (encounter_io_parameters)
nc%file_number = param%iloop / param%dump_cadence
end select
end associate
allocate(param%encounter_history, source=encounter_history)
end if

allocate(collision_io_parameters :: collision_history%nc)
call collision_history%reset()
select type(nc => collision_history%nc)
class is (collision_io_parameters)
nc%file_number = param%iloop / param%dump_cadence
end select
allocate(param%collision_history, source=collision_history)
end select


Expand Down

0 comments on commit 4336100

Please sign in to comment.