added functions for reading values of integer data type to binary file, corrected comment on old versions which are for real (pReal) only

This commit is contained in:
Martin Diehl 2012-08-16 11:57:15 +00:00
parent b2aacf9ca4
commit 453c6031a7
1 changed files with 66 additions and 2 deletions

View File

@ -38,7 +38,9 @@ module IO
IO_open_jobFile, & IO_open_jobFile, &
IO_write_jobFile, & IO_write_jobFile, &
IO_write_jobBinaryFile, & IO_write_jobBinaryFile, &
IO_write_jobBinaryIntFile, &
IO_read_jobBinaryFile, & IO_read_jobBinaryFile, &
IO_read_jobBinaryIntFile, &
IO_hybridIA, & IO_hybridIA, &
IO_isBlank, & IO_isBlank, &
IO_getTag, & IO_getTag, &
@ -285,7 +287,8 @@ end subroutine IO_write_jobFile
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief open (write) binary file related to current job with given extension to given unit !> @brief open (write) binary file of pReal array related to current job with given extension to
!> given unit
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine IO_write_jobBinaryFile(myUnit,newExt,recMultiplier) subroutine IO_write_jobBinaryFile(myUnit,newExt,recMultiplier)
@ -315,7 +318,39 @@ end subroutine IO_write_jobBinaryFile
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief open (read) binary file related to restored job with given extension to given unit !> @brief open (write) binary file of pInt array related to current job with given extension to
!> given unit
!--------------------------------------------------------------------------------------------------
subroutine IO_write_jobBinaryIntFile(myUnit,newExt,recMultiplier)
use DAMASK_interface, only: getSolverWorkingDirectoryName, &
getSolverJobName
implicit none
integer(pInt), intent(in) :: myUnit
integer(pInt), intent(in), optional :: recMultiplier
character(len=*), intent(in) :: newExt
integer(pInt) :: myStat
character(len=1024) :: path
path = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.'//newExt
if (present(recMultiplier)) then
open(myUnit,status='replace',form='unformatted',access='direct', &
recl=pInt*recMultiplier,iostat=myStat,file=path)
else
open(myUnit,status='replace',form='unformatted',access='direct', &
recl=pInt,iostat=myStat,file=path)
endif
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
end subroutine IO_write_jobBinaryIntFile
!--------------------------------------------------------------------------------------------------
!> @brief open (read) binary file of pReal array related to restored job with given extension to
!> given unit
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine IO_read_jobBinaryFile(myUnit,newExt,jobName,recMultiplier) subroutine IO_read_jobBinaryFile(myUnit,newExt,jobName,recMultiplier)
@ -342,6 +377,35 @@ subroutine IO_read_jobBinaryFile(myUnit,newExt,jobName,recMultiplier)
end subroutine IO_read_jobBinaryFile end subroutine IO_read_jobBinaryFile
!--------------------------------------------------------------------------------------------------
!> @brief open (read) binary file of pInt array related to restored job with given extension to
!> given unit
!--------------------------------------------------------------------------------------------------
subroutine IO_read_jobBinaryIntFile(myUnit,newExt,jobName,recMultiplier)
use DAMASK_interface, only: getSolverWorkingDirectoryName
implicit none
integer(pInt), intent(in) :: myUnit
integer(pInt), intent(in), optional :: recMultiplier
character(len=*), intent(in) :: newExt, jobName
integer(pInt) :: myStat
character(len=1024) :: path
path = trim(getSolverWorkingDirectoryName())//trim(jobName)//'.'//newExt
if (present(recMultiplier)) then
open(myUnit,status='old',form='unformatted',access='direct', &
recl=pInt*recMultiplier,iostat=myStat,file=path)
else
open(myUnit,status='old',form='unformatted',access='direct', &
recl=pInt,iostat=myStat,file=path)
endif
if (myStat /= 0) call IO_error(100_pInt,ext_msg=path)
end subroutine IO_read_jobBinaryIntFile
#ifdef Abaqus #ifdef Abaqus
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief check if the input file for Abaqus contains part info !> @brief check if the input file for Abaqus contains part info