From 5daefbb76371da36a10d8c919745e9de4373d123 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Wed, 30 Nov 2022 19:55:23 -0500 Subject: [PATCH] Rearranged the definition of the swiftest_storage class a bit. Now using a parameterized derived type of an abstract class wrapper. --- src/modules/swiftest_classes.f90 | 38 +++++++++++++++----------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index 53aef6a78..086b00676 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -156,26 +156,6 @@ module swiftest_classes procedure :: write_particle_info => netcdf_write_particle_info_base !! Dump contents of particle information metadata to file end type swiftest_base - type, abstract, extends(swiftest_base) :: swiftest_storage - !! An abstract superclass for a generic Swiftest object that is used to store simulation history data between file I/O - contains - procedure(abstract_store), deferred :: store !! Stores the state of the simulation in memory - procedure(abstract_dump_storage), deferred :: dump !! Dumps contents of the variable to file - end type swiftest_storage - - abstract interface - subroutine abstract_store(self) - import swiftest_storage - class(swiftest_storage), intent(inout) :: self - end subroutine abstract_store - - subroutine abstract_dump_storage(self) - import swiftest_storage - class(swiftest_storage), intent(inout) :: self - end subroutine abstract_dump_storage - end interface - - !******************************************************************************************************************************** ! swiftest_cb class definitions and methods !******************************************************************************************************************************** @@ -436,6 +416,18 @@ end subroutine abstract_dump_storage generic :: write_frame => write_frame_system, write_frame_netcdf !! Generic method call for reading a frame of output data end type swiftest_nbody_system + type system_storage_frame + class(swiftest_nbody_system), allocatable :: system + end type + + type, extends(swiftest_base) :: swiftest_storage(nframes) + integer(I4B), len :: nframes + !! A class that that is used to store simulation history data between file output + type(system_storage_frame), dimension(nframes) :: frame + contains + procedure :: initialize => setup_initialize_storage + end type swiftest_storage + abstract interface @@ -1052,6 +1044,12 @@ module subroutine setup_initialize_particle_info_system(self, param) class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters end subroutine setup_initialize_particle_info_system + module subroutine setup_initialize_storage(self, param) + implicit none + class(swiftest_storage(*)), intent(inout) :: self !! Swiftest storage object + class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters + end subroutine setup_initialize_storage + module subroutine setup_initialize_system(self, param) implicit none class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object