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

Commit

Permalink
Rearranged the definition of the swiftest_storage class a bit. Now us…
Browse files Browse the repository at this point in the history
…ing a parameterized derived type of an abstract class wrapper.
  • Loading branch information
daminton committed Dec 1, 2022
1 parent 875e4c5 commit 5daefbb
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
!********************************************************************************************************************************
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5daefbb

Please sign in to comment.