Finalizing a restart object
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_restart_type), | intent(inout) | :: | me | the restart type to close |
subroutine tem_restart_finalize( me )
! -------------------------------------------------------------------- !
!> the restart type to close
type( tem_restart_type ), intent(inout) :: me
! -------------------------------------------------------------------- !
integer :: iError
logical :: nUnitOpened
! -------------------------------------------------------------------- !
! close solverspecific scratch unit
if (me%comm%rank == 0 .and. me%controller%writeRestart) then
if (me%solSpec_unit>0) then
inquire(unit=me%solSpec_unit, opened=nUnitOpened)
if (nUnitOpened) close(me%solSpec_unit)
end if
end if
! free the contiguous type
if (me%controller%writeRestart .or. me%controller%readRestart) then
call MPI_Type_free(me%write_file%ftype, iError)
call check_mpi_error( iError,'Free write-ftype in restart_finalize')
call MPI_Type_free(me%write_file%vectype, iError)
call check_mpi_error( iError,'Free write-vectype in restart_finalize')
if (me%read_file%ndofs /= me%write_file%ndofs) then
call MPI_Type_free(me%read_file%ftype, iError)
call check_mpi_error( iError,'Free read-ftype in restart_finalize')
call MPI_Type_free(me%read_file%vectype, iError)
call check_mpi_error( iError,'Free read-vectype in restart_finalize')
end if
end if
end subroutine tem_restart_finalize