program test_restart use sph_precision, only: rk use sph_error, only: SPH_SUCCESS use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, sph_build_model, & sph_run_explicit, sph_get_current_time, sph_write_restart, sph_read_restart, & sph_advance_explicit implicit none integer :: ierr integer :: step real(rk) :: time call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed') call sph_read_inp('tests/data/minimal_particles_011.inp', ierr) call assert_ok(ierr, 'read input failed') call sph_build_model(ierr) call assert_ok(ierr, 'build model failed') call sph_run_explicit(ierr) call assert_ok(ierr, 'run explicit failed') call sph_write_restart('build-codex-unix/restart_test.tmp', ierr) call assert_ok(ierr, 'write restart failed') call sph_read_restart('build-codex-unix/restart_test.tmp', ierr) call assert_ok(ierr, 'read restart failed') call sph_get_current_time(time, step, ierr) call assert_ok(ierr, 'time after restart failed') if (step /= 1) call fail('restart did not restore step') call sph_advance_explicit(1.0e-6_rk, ierr) call assert_ok(ierr, 'advance after restart failed') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed') contains subroutine assert_ok(ierr_value, message) integer, intent(in) :: ierr_value character(len=*), intent(in) :: message if (ierr_value /= SPH_SUCCESS) call fail(message) end subroutine assert_ok subroutine fail(message) character(len=*), intent(in) :: message write(*, '(A)') trim(message) stop 1 end subroutine fail end program test_restart