2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
|
|
|
|
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
|
|
|
!> @author Christoph Kords, Max-Planck-Institut für Eisenforschung GmbH
|
|
|
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief input/output functions, partly depending on chosen solver
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2014-03-12 13:03:51 +05:30
|
|
|
module IO
|
2013-02-11 15:14:17 +05:30
|
|
|
use prec, only: &
|
|
|
|
pInt, &
|
|
|
|
pReal
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
|
|
|
private
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=5), parameter, public :: &
|
|
|
|
IO_EOF = '#EOF#' !< end of file string
|
2017-05-16 01:23:25 +05:30
|
|
|
character(len=207), parameter, private :: &
|
|
|
|
IO_DIVIDER = '───────────────────'//&
|
2017-05-01 07:18:06 +05:30
|
|
|
'───────────────────'//&
|
2017-05-16 01:23:25 +05:30
|
|
|
'───────────────────'//&
|
|
|
|
'────────────'
|
2013-02-11 15:14:17 +05:30
|
|
|
public :: &
|
|
|
|
IO_init, &
|
2013-06-27 00:49:00 +05:30
|
|
|
IO_read, &
|
2018-07-16 15:10:42 +05:30
|
|
|
IO_recursiveRead, &
|
2013-02-11 15:14:17 +05:30
|
|
|
IO_checkAndRewind, &
|
|
|
|
IO_open_file_stat, &
|
|
|
|
IO_open_jobFile_stat, &
|
|
|
|
IO_open_file, &
|
|
|
|
IO_open_jobFile, &
|
|
|
|
IO_write_jobFile, &
|
2013-09-18 19:37:55 +05:30
|
|
|
IO_write_jobRealFile, &
|
|
|
|
IO_read_realFile, &
|
|
|
|
IO_read_intFile, &
|
2013-02-11 15:14:17 +05:30
|
|
|
IO_isBlank, &
|
|
|
|
IO_getTag, &
|
|
|
|
IO_stringPos, &
|
|
|
|
IO_stringValue, &
|
|
|
|
IO_floatValue, &
|
|
|
|
IO_intValue, &
|
|
|
|
IO_lc, &
|
|
|
|
IO_error, &
|
|
|
|
IO_warning, &
|
2013-02-25 22:04:59 +05:30
|
|
|
IO_intOut, &
|
|
|
|
IO_timeStamp
|
2014-11-06 17:17:27 +05:30
|
|
|
#if defined(Marc4DAMASK) || defined(Abaqus)
|
2013-02-11 15:14:17 +05:30
|
|
|
public :: &
|
2019-02-03 12:36:53 +05:30
|
|
|
#ifdef Abaqus
|
2019-02-03 12:48:38 +05:30
|
|
|
IO_extractValue, &
|
2019-02-03 12:36:53 +05:30
|
|
|
IO_countDataLines, &
|
|
|
|
#endif
|
|
|
|
#ifdef Marc4DAMASK
|
2019-02-03 12:48:38 +05:30
|
|
|
IO_skipChunks, &
|
|
|
|
IO_fixedNoEFloatValue, &
|
|
|
|
IO_fixedIntValue, &
|
2019-02-03 12:36:53 +05:30
|
|
|
IO_countNumericalDataLines, &
|
|
|
|
#endif
|
2013-02-11 15:14:17 +05:30
|
|
|
IO_open_inputFile, &
|
2019-02-03 12:36:53 +05:30
|
|
|
IO_open_logFile, &
|
|
|
|
IO_countContinuousIntValues, &
|
|
|
|
IO_continuousIntValues
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2013-02-11 15:14:17 +05:30
|
|
|
private :: &
|
2013-02-13 00:30:41 +05:30
|
|
|
IO_verifyFloatValue, &
|
2015-05-11 02:25:36 +05:30
|
|
|
IO_verifyIntValue
|
2014-04-15 15:13:35 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
contains
|
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief only outputs revision number
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_init
|
2018-02-02 17:06:09 +05:30
|
|
|
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
2017-10-05 20:05:34 +05:30
|
|
|
use, intrinsic :: iso_fortran_env, only: &
|
|
|
|
compiler_version, &
|
|
|
|
compiler_options
|
|
|
|
#endif
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2014-10-10 18:38:34 +05:30
|
|
|
implicit none
|
2014-10-10 21:28:18 +05:30
|
|
|
|
2016-06-29 20:05:49 +05:30
|
|
|
write(6,'(/,a)') ' <<<+- IO init -+>>>'
|
|
|
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
2012-02-01 00:48:55 +05:30
|
|
|
#include "compilation_info.f90"
|
2014-03-12 13:03:51 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_init
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
|
2013-06-27 00:49:00 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief recursively reads a line from a text file.
|
|
|
|
!! Recursion is triggered by "{path/to/inputfile}" in a line
|
2018-07-16 15:10:42 +05:30
|
|
|
!> @details unstable and buggy
|
2013-06-27 00:49:00 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
recursive function IO_read(fileUnit,reset) result(line)
|
2019-02-03 12:48:38 +05:30
|
|
|
!ToDo: remove recursion once material.config handling is done fully via config module
|
2013-06-27 00:49:00 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2013-12-11 22:19:20 +05:30
|
|
|
logical, intent(in), optional :: reset
|
2013-09-18 19:37:55 +05:30
|
|
|
|
|
|
|
integer(pInt), dimension(10) :: unitOn = 0_pInt ! save the stack of recursive file units
|
|
|
|
integer(pInt) :: stack = 1_pInt ! current stack position
|
2013-06-27 00:49:00 +05:30
|
|
|
character(len=8192), dimension(10) :: pathOn = ''
|
|
|
|
character(len=512) :: path,input
|
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=65536) :: line
|
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), parameter :: SEP = achar(47)//achar(92) ! forward and backward slash ("/", "\")
|
2013-06-27 00:49:00 +05:30
|
|
|
|
2013-12-11 22:19:20 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! reset case
|
2014-05-21 15:33:57 +05:30
|
|
|
if(present(reset)) then; if (reset) then ! do not short circuit here
|
2013-12-12 03:33:09 +05:30
|
|
|
do while (stack > 1_pInt) ! can go back to former file
|
2013-12-11 22:19:20 +05:30
|
|
|
close(unitOn(stack))
|
|
|
|
stack = stack-1_pInt
|
|
|
|
enddo
|
|
|
|
return
|
|
|
|
endif; endif
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! read from file
|
|
|
|
unitOn(1) = fileUnit
|
2013-06-27 00:49:00 +05:30
|
|
|
|
|
|
|
read(unitOn(stack),'(a65536)',END=100) line
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-06-27 00:49:00 +05:30
|
|
|
input = IO_getTag(line,'{','}')
|
|
|
|
|
2013-12-11 22:19:20 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! normal case
|
2013-09-18 19:37:55 +05:30
|
|
|
if (input == '') return ! regular line
|
2016-08-20 10:44:18 +05:30
|
|
|
|
2013-12-11 22:19:20 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
! recursion case
|
2013-09-18 19:37:55 +05:30
|
|
|
if (stack >= 10_pInt) call IO_error(104_pInt,ext_msg=input) ! recursion limit reached
|
2013-06-27 00:49:00 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
inquire(UNIT=unitOn(stack),NAME=path) ! path of current file
|
2013-06-27 00:49:00 +05:30
|
|
|
stack = stack+1_pInt
|
2014-05-15 15:10:43 +05:30
|
|
|
if(scan(input,SEP) == 1) then ! absolut path given (UNIX only)
|
|
|
|
pathOn(stack) = input
|
|
|
|
else
|
|
|
|
pathOn(stack) = path(1:scan(path,SEP,.true.))//input ! glue include to current file's dir
|
|
|
|
endif
|
2013-06-27 00:49:00 +05:30
|
|
|
|
2018-08-21 02:06:55 +05:30
|
|
|
open(newunit=unitOn(stack),iostat=myStat,file=pathOn(stack),action='read',status='old',position='rewind') ! open included file
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=pathOn(stack))
|
2013-06-27 00:49:00 +05:30
|
|
|
|
2013-12-11 22:19:20 +05:30
|
|
|
line = IO_read(fileUnit)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-06-27 00:49:00 +05:30
|
|
|
return
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-12-11 22:19:20 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! end of file case
|
2013-09-18 19:37:55 +05:30
|
|
|
100 if (stack > 1_pInt) then ! can go back to former file
|
2013-06-27 00:49:00 +05:30
|
|
|
close(unitOn(stack))
|
|
|
|
stack = stack-1_pInt
|
2013-12-11 22:19:20 +05:30
|
|
|
line = IO_read(fileUnit)
|
2013-09-18 19:37:55 +05:30
|
|
|
else ! top-most file reached
|
|
|
|
line = IO_EOF
|
2013-06-27 00:49:00 +05:30
|
|
|
endif
|
2014-05-21 15:33:57 +05:30
|
|
|
|
2013-06-27 00:49:00 +05:30
|
|
|
end function IO_read
|
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
|
2018-07-16 15:10:42 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief recursively reads a text file.
|
|
|
|
!! Recursion is triggered by "{path/to/inputfile}" in a line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-08-04 17:28:01 +05:30
|
|
|
recursive function IO_recursiveRead(fileName,cnt) result(fileContent)
|
2018-07-16 15:10:42 +05:30
|
|
|
|
|
|
|
implicit none
|
2018-08-04 17:28:01 +05:30
|
|
|
character(len=*), intent(in) :: fileName
|
|
|
|
integer(pInt), intent(in), optional :: cnt !< recursion counter
|
|
|
|
character(len=256), dimension(:), allocatable :: fileContent !< file content, separated per lines
|
2018-07-16 15:38:22 +05:30
|
|
|
character(len=256), dimension(:), allocatable :: includedContent
|
2018-08-04 17:28:01 +05:30
|
|
|
character(len=256) :: line
|
|
|
|
character(len=256), parameter :: dummy = 'https://damask.mpie.de' !< to fill up remaining array
|
|
|
|
character(len=:), allocatable :: rawData
|
|
|
|
integer(pInt) :: &
|
|
|
|
fileLength, &
|
|
|
|
fileUnit, &
|
|
|
|
startPos, endPos, &
|
|
|
|
myTotalLines, & !< # lines read from file without include statements
|
2018-08-21 02:06:55 +05:30
|
|
|
l,i, &
|
|
|
|
myStat
|
2019-01-29 23:01:16 +05:30
|
|
|
logical :: warned
|
|
|
|
|
2018-12-06 05:41:41 +05:30
|
|
|
if (present(cnt)) then
|
|
|
|
if (cnt>10_pInt) call IO_error(106_pInt,ext_msg=trim(fileName))
|
|
|
|
endif
|
2018-08-04 17:28:01 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! read data as stream
|
2018-07-16 15:10:42 +05:30
|
|
|
inquire(file = fileName, size=fileLength)
|
2018-08-21 02:06:55 +05:30
|
|
|
open(newunit=fileUnit, file=fileName, access='stream',&
|
|
|
|
status='old', position='rewind', action='read',iostat=myStat)
|
|
|
|
if(myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=trim(fileName))
|
2018-07-16 15:10:42 +05:30
|
|
|
allocate(character(len=fileLength)::rawData)
|
|
|
|
read(fileUnit) rawData
|
|
|
|
close(fileUnit)
|
|
|
|
|
2018-08-04 17:28:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! count lines to allocate string array
|
2019-01-29 23:01:16 +05:30
|
|
|
myTotalLines = 1_pInt
|
2018-08-04 17:28:01 +05:30
|
|
|
do l=1_pInt, len(rawData)
|
2019-01-29 23:01:16 +05:30
|
|
|
if (rawData(l:l) == new_line('')) myTotalLines = myTotalLines+1
|
2018-07-16 15:10:42 +05:30
|
|
|
enddo
|
|
|
|
allocate(fileContent(myTotalLines))
|
|
|
|
|
2018-08-04 17:28:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! split raw data at end of line and handle includes
|
2019-01-29 23:01:16 +05:30
|
|
|
warned = .false.
|
2018-08-04 17:28:01 +05:30
|
|
|
startPos = 1_pInt
|
2019-01-29 23:01:16 +05:30
|
|
|
l = 1_pInt
|
|
|
|
do while (l <= myTotalLines)
|
|
|
|
endPos = merge(startPos + scan(rawData(startPos:),new_line('')) - 2_pInt,len(rawData),l /= myTotalLines)
|
|
|
|
if (endPos - startPos > 255_pInt) then
|
|
|
|
line = rawData(startPos:startPos+255_pInt)
|
|
|
|
if (.not. warned) then
|
|
|
|
call IO_warning(207_pInt,ext_msg=trim(fileName),el=l)
|
|
|
|
warned = .true.
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
line = rawData(startPos:endpos)
|
|
|
|
endif
|
|
|
|
startPos = endPos + 2_pInt ! jump to next line start
|
|
|
|
|
|
|
|
recursion: if (scan(trim(adjustl(line)),'{') == 1 .and. scan(trim(line),'}') > 2) then
|
2018-08-04 17:28:01 +05:30
|
|
|
includedContent = IO_recursiveRead(trim(line(scan(line,'{')+1_pInt:scan(line,'}')-1_pInt)), &
|
2019-01-29 23:01:16 +05:30
|
|
|
merge(cnt,1_pInt,present(cnt))) ! to track recursion depth
|
|
|
|
fileContent = [ fileContent(1:l-1_pInt), includedContent, [(dummy,i=1,myTotalLines-l)] ] ! add content and grow array
|
|
|
|
myTotalLines = myTotalLines - 1_pInt + size(includedContent)
|
|
|
|
l = l - 1_pInt + size(includedContent)
|
2018-07-16 15:10:42 +05:30
|
|
|
else recursion
|
|
|
|
fileContent(l) = line
|
2019-01-29 23:01:16 +05:30
|
|
|
l = l + 1_pInt
|
2018-07-16 15:10:42 +05:30
|
|
|
endif recursion
|
|
|
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
end function IO_recursiveRead
|
2013-06-27 00:49:00 +05:30
|
|
|
|
2018-08-04 17:28:01 +05:30
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief checks if unit is opened for reading, if true rewinds. Otherwise stops with
|
|
|
|
!! error message
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_checkAndRewind(fileUnit)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
implicit none
|
2018-08-04 17:28:01 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2013-09-18 19:37:55 +05:30
|
|
|
logical :: fileOpened
|
|
|
|
character(len=15) :: fileRead
|
|
|
|
|
2018-01-10 21:43:25 +05:30
|
|
|
inquire(unit=fileUnit, opened=fileOpened, read=fileRead)
|
2014-12-03 06:12:35 +05:30
|
|
|
if (.not. fileOpened .or. trim(fileRead)/='YES') call IO_error(102_pInt)
|
2013-12-11 22:19:20 +05:30
|
|
|
rewind(fileUnit)
|
2012-04-20 17:28:41 +05:30
|
|
|
|
|
|
|
end subroutine IO_checkAndRewind
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2011-07-18 14:45:20 +05:30
|
|
|
|
2013-06-27 00:49:00 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens existing file for reading to given unit. Path to file is relative to working
|
2013-09-18 19:37:55 +05:30
|
|
|
!! directory
|
|
|
|
!> @details like IO_open_file_stat, but error is handled via call to IO_error and not via return
|
|
|
|
!! value
|
2013-06-27 00:49:00 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-07-10 11:54:45 +05:30
|
|
|
subroutine IO_open_file(fileUnit,path)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-06-27 00:49:00 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2018-07-10 11:54:45 +05:30
|
|
|
character(len=*), intent(in) :: path !< relative path from working directory
|
2013-06-27 00:49:00 +05:30
|
|
|
|
|
|
|
integer(pInt) :: myStat
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2018-08-21 02:06:55 +05:30
|
|
|
open(fileUnit,status='old',iostat=myStat,file=path,action='read',position='rewind')
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-06-27 00:49:00 +05:30
|
|
|
end subroutine IO_open_file
|
|
|
|
|
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens existing file for reading to given unit. Path to file is relative to working
|
2013-09-18 19:37:55 +05:30
|
|
|
!! directory
|
|
|
|
!> @details Like IO_open_file, but error is handled via return value and not via call to IO_error
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-07-10 11:54:45 +05:30
|
|
|
logical function IO_open_file_stat(fileUnit,path)
|
2019-02-03 12:48:38 +05:30
|
|
|
!ToDo: DEPRECATED once material.config handling is done fully via config module
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2018-07-10 11:54:45 +05:30
|
|
|
character(len=*), intent(in) :: path !< relative path from working directory
|
2011-07-18 14:45:20 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2018-08-21 02:06:55 +05:30
|
|
|
open(fileUnit,status='old',iostat=myStat,file=path,action='read',position='rewind')
|
|
|
|
if (myStat /= 0_pInt) close(fileUnit)
|
2012-03-06 20:22:48 +05:30
|
|
|
IO_open_file_stat = (myStat == 0_pInt)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_open_file_stat
|
2011-09-13 21:24:06 +05:30
|
|
|
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens existing file for reading to given unit. File is named after solver job name
|
|
|
|
!! plus given extension and located in current working directory
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @details like IO_open_jobFile_stat, but error is handled via call to IO_error and not via return
|
|
|
|
!! value
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_open_jobFile(fileUnit,ext)
|
2012-06-18 20:57:01 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverJobName
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2010-07-13 15:56:07 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), intent(in) :: ext !< extension of file
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
|
|
|
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(getSolverJobName())//'.'//ext
|
2018-08-21 02:06:55 +05:30
|
|
|
open(fileUnit,status='old',iostat=myStat,file=path,action='read',position='rewind')
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-06-27 00:49:00 +05:30
|
|
|
end subroutine IO_open_jobFile
|
2012-02-13 23:11:27 +05:30
|
|
|
|
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens existing file for reading to given unit. File is named after solver job name
|
|
|
|
!! plus given extension and located in current working directory
|
|
|
|
!> @details Like IO_open_jobFile, but error is handled via return value and not via call to
|
2013-09-18 19:37:55 +05:30
|
|
|
!! IO_error
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
logical function IO_open_jobFile_stat(fileUnit,ext)
|
2013-02-11 15:14:17 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverJobName
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), intent(in) :: ext !< extension of file
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
|
|
|
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(getSolverJobName())//'.'//ext
|
2018-08-21 02:06:55 +05:30
|
|
|
open(fileUnit,status='old',iostat=myStat,file=path,action='read',position='rewind')
|
|
|
|
if (myStat /= 0_pInt) close(fileUnit)
|
2013-06-27 00:49:00 +05:30
|
|
|
IO_open_jobFile_stat = (myStat == 0_pInt)
|
|
|
|
|
|
|
|
end function IO_open_JobFile_stat
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
|
2014-11-06 17:17:27 +05:30
|
|
|
#if defined(Marc4DAMASK) || defined(Abaqus)
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief opens FEM input file for reading located in current working directory to given unit
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_open_inputFile(fileUnit,modelName)
|
2012-06-15 21:40:21 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverJobName, &
|
|
|
|
inputFileExtension
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), intent(in) :: modelName !< model name, in case of restart not solver job name
|
2010-05-10 20:32:59 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifdef Abaqus
|
2013-02-13 16:26:50 +05:30
|
|
|
integer(pInt) :: fileType
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-02-13 16:26:50 +05:30
|
|
|
fileType = 1_pInt ! assume .pes
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(modelName)//inputFileExtension(fileType) ! attempt .pes, if it exists: it should be used
|
2018-08-21 02:06:55 +05:30
|
|
|
open(fileUnit+1,status='old',iostat=myStat,file=path,action='read',position='rewind')
|
2013-02-13 16:26:50 +05:30
|
|
|
if(myStat /= 0_pInt) then ! if .pes does not work / exist; use conventional extension, i.e.".inp"
|
|
|
|
fileType = 2_pInt
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(modelName)//inputFileExtension(fileType)
|
2018-08-21 02:06:55 +05:30
|
|
|
open(fileUnit+1,status='old',iostat=myStat,file=path,action='read',position='rewind')
|
2013-02-04 13:59:58 +05:30
|
|
|
endif
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(modelName)//inputFileExtension(fileType)//'_assembly'
|
2013-12-11 22:19:20 +05:30
|
|
|
open(fileUnit,iostat=myStat,file=path)
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2013-12-13 03:59:40 +05:30
|
|
|
if (.not.abaqus_assembleInputFile(fileUnit,fileUnit+1_pInt)) call IO_error(103_pInt) ! strip comments and concatenate any "include"s
|
2018-01-10 21:43:25 +05:30
|
|
|
close(fileUnit+1_pInt)
|
2019-01-31 15:59:56 +05:30
|
|
|
|
|
|
|
contains
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief create a new input file for abaqus simulations by removing all comment lines and
|
|
|
|
!> including "include"s
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
recursive function abaqus_assembleInputFile(unit1,unit2) result(createSuccess)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: unit1, &
|
|
|
|
unit2
|
|
|
|
|
|
|
|
|
|
|
|
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
|
|
character(len=65536) :: line,fname
|
|
|
|
logical :: createSuccess,fexist
|
|
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
read(unit2,'(A65536)',END=220) line
|
|
|
|
chunkPos = IO_stringPos(line)
|
|
|
|
|
|
|
|
if (IO_lc(IO_StringValue(line,chunkPos,1_pInt))=='*include') then
|
|
|
|
fname = trim(line(9+scan(line(9:),'='):))
|
|
|
|
inquire(file=fname, exist=fexist)
|
|
|
|
if (.not.(fexist)) then
|
|
|
|
!$OMP CRITICAL (write2out)
|
|
|
|
write(6,*)'ERROR: file does not exist error in abaqus_assembleInputFile'
|
|
|
|
write(6,*)'filename: ', trim(fname)
|
|
|
|
!$OMP END CRITICAL (write2out)
|
|
|
|
createSuccess = .false.
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
open(unit2+1,err=200,status='old',file=fname)
|
|
|
|
if (abaqus_assembleInputFile(unit1,unit2+1_pInt)) then
|
|
|
|
createSuccess=.true.
|
|
|
|
close(unit2+1)
|
|
|
|
else
|
|
|
|
createSuccess=.false.
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
else if (line(1:2) /= '**' .OR. line(1:8)=='**damask') then
|
|
|
|
write(unit1,'(A)') trim(line)
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
|
|
|
220 createSuccess = .true.
|
|
|
|
return
|
|
|
|
|
|
|
|
200 createSuccess =.false.
|
|
|
|
|
|
|
|
end function abaqus_assembleInputFile
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2013-04-30 15:19:30 +05:30
|
|
|
#ifdef Marc4DAMASK
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(modelName)//inputFileExtension
|
2013-12-11 22:19:20 +05:30
|
|
|
open(fileUnit,status='old',iostat=myStat,file=path)
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_open_inputFile
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens existing FEM log file for reading to given unit. File is named after solver job
|
|
|
|
!! name and located in current working directory
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_open_logFile(fileUnit)
|
2012-06-15 21:40:21 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverJobName, &
|
|
|
|
LogFileExtension
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2009-07-22 21:37:19 +05:30
|
|
|
implicit none
|
2013-12-11 22:19:20 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2009-07-22 21:37:19 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2011-08-02 15:44:16 +05:30
|
|
|
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(getSolverJobName())//LogFileExtension
|
2018-08-21 02:06:55 +05:30
|
|
|
open(fileUnit,status='old',iostat=myStat,file=path,action='read',position='rewind')
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2011-08-02 15:44:16 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_open_logFile
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens ASCII file to given unit for writing. File is named after solver job name plus
|
2013-12-28 01:33:28 +05:30
|
|
|
!! given extension and located in current working directory
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_write_jobFile(fileUnit,ext)
|
2013-09-18 19:37:55 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverJobName
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), intent(in) :: ext !< extension of file
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(getSolverJobName())//'.'//ext
|
2013-12-11 22:19:20 +05:30
|
|
|
open(fileUnit,status='replace',iostat=myStat,file=path)
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_write_jobFile
|
2011-08-02 15:44:16 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens binary file containing array of pReal numbers to given unit for writing. File is
|
2013-09-18 19:37:55 +05:30
|
|
|
!! named after solver job name plus given extension and located in current working directory
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_write_jobRealFile(fileUnit,ext,recMultiplier)
|
2018-01-10 21:43:25 +05:30
|
|
|
use DAMASK_interface, only: &
|
2013-09-18 19:37:55 +05:30
|
|
|
getSolverJobName
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2010-11-03 20:09:18 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), intent(in) :: ext !< extension of file
|
|
|
|
integer(pInt), intent(in), optional :: recMultiplier !< record length (multiple of pReal Numbers, if not given set to one)
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(getSolverJobName())//'.'//ext
|
2010-11-03 20:09:18 +05:30
|
|
|
if (present(recMultiplier)) then
|
2013-12-11 22:19:20 +05:30
|
|
|
open(fileUnit,status='replace',form='unformatted',access='direct', &
|
2012-03-06 20:22:48 +05:30
|
|
|
recl=pReal*recMultiplier,iostat=myStat,file=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
else
|
2013-12-11 22:19:20 +05:30
|
|
|
open(fileUnit,status='replace',form='unformatted',access='direct', &
|
2012-03-06 20:22:48 +05:30
|
|
|
recl=pReal,iostat=myStat,file=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
endif
|
2012-04-24 22:29:38 +05:30
|
|
|
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
end subroutine IO_write_jobRealFile
|
2010-11-03 20:09:18 +05:30
|
|
|
|
|
|
|
|
2012-08-16 17:27:15 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens binary file containing array of pReal numbers to given unit for reading. File is
|
2013-09-18 19:37:55 +05:30
|
|
|
!! located in current working directory
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_read_realFile(fileUnit,ext,modelName,recMultiplier)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2010-11-03 20:09:18 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2018-01-10 21:43:25 +05:30
|
|
|
character(len=*), intent(in) :: ext, & !< extension of file
|
2013-09-18 19:37:55 +05:30
|
|
|
modelName !< model name, in case of restart not solver job name
|
|
|
|
integer(pInt), intent(in), optional :: recMultiplier !< record length (multiple of pReal Numbers, if not given set to one)
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(modelName)//'.'//ext
|
2010-11-03 20:09:18 +05:30
|
|
|
if (present(recMultiplier)) then
|
2018-01-10 21:43:25 +05:30
|
|
|
open(fileUnit,status='old',form='unformatted',access='direct', &
|
2014-05-15 18:38:02 +05:30
|
|
|
recl=pReal*recMultiplier,iostat=myStat,file=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
else
|
2013-12-11 22:19:20 +05:30
|
|
|
open(fileUnit,status='old',form='unformatted',access='direct', &
|
2014-05-15 18:38:02 +05:30
|
|
|
recl=pReal,iostat=myStat,file=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
endif
|
2014-05-15 18:38:02 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
end subroutine IO_read_realFile
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
|
2012-08-16 17:27:15 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief opens binary file containing array of pInt numbers to given unit for reading. File is
|
2013-09-18 19:37:55 +05:30
|
|
|
!! located in current working directory
|
2012-08-16 17:27:15 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_read_intFile(fileUnit,ext,modelName,recMultiplier)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-08-16 17:27:15 +05:30
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit !< file unit
|
2018-01-10 21:43:25 +05:30
|
|
|
character(len=*), intent(in) :: ext, & !< extension of file
|
2013-09-18 19:37:55 +05:30
|
|
|
modelName !< model name, in case of restart not solver job name
|
|
|
|
integer(pInt), intent(in), optional :: recMultiplier !< record length (multiple of pReal Numbers, if not given set to one)
|
2012-08-16 17:27:15 +05:30
|
|
|
|
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
|
|
|
|
2018-07-10 11:54:45 +05:30
|
|
|
path = trim(modelName)//'.'//ext
|
2012-08-16 17:27:15 +05:30
|
|
|
if (present(recMultiplier)) then
|
2018-01-10 21:43:25 +05:30
|
|
|
open(fileUnit,status='old',form='unformatted',access='direct', &
|
2014-05-15 18:38:02 +05:30
|
|
|
recl=pInt*recMultiplier,iostat=myStat,file=path)
|
2012-08-16 17:27:15 +05:30
|
|
|
else
|
2013-12-11 22:19:20 +05:30
|
|
|
open(fileUnit,status='old',form='unformatted',access='direct', &
|
2014-05-15 18:38:02 +05:30
|
|
|
recl=pInt,iostat=myStat,file=path)
|
2012-08-16 17:27:15 +05:30
|
|
|
endif
|
|
|
|
if (myStat /= 0) call IO_error(100_pInt,ext_msg=path)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
end subroutine IO_read_intFile
|
2012-08-16 17:27:15 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief identifies strings without content
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
logical pure function IO_isBlank(string)
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
implicit none
|
2013-12-13 03:59:40 +05:30
|
|
|
character(len=*), intent(in) :: string !< string to check for content
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
character(len=*), parameter :: blankChar = achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
|
|
|
|
character(len=*), parameter :: comment = achar(35) ! comment id '#'
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
integer :: posNonBlank, posComment ! no pInt
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
posNonBlank = verify(string,blankChar)
|
|
|
|
posComment = scan(string,comment)
|
2009-03-04 17:18:54 +05:30
|
|
|
IO_isBlank = posNonBlank == 0 .or. posNonBlank == posComment
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_isBlank
|
|
|
|
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief get tagged content of string
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
pure function IO_getTag(string,openChar,closeChar)
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
implicit none
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), intent(in) :: string !< string to check for tag
|
|
|
|
character(len=len_trim(string)) :: IO_getTag
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2018-08-22 16:40:59 +05:30
|
|
|
character, intent(in) :: openChar, & !< indicates beginning of tag
|
|
|
|
closeChar !< indicates end of tag
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), parameter :: SEP=achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
|
2013-02-11 15:14:17 +05:30
|
|
|
integer :: left,right ! no pInt
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
IO_getTag = ''
|
2018-08-22 17:27:43 +05:30
|
|
|
|
|
|
|
|
|
|
|
if (openChar /= closeChar) then
|
|
|
|
left = scan(string,openChar)
|
|
|
|
right = scan(string,closeChar)
|
|
|
|
else
|
|
|
|
left = scan(string,openChar)
|
|
|
|
right = left + merge(scan(string(left+1:),openChar),0_pInt,len(string) > left)
|
|
|
|
endif
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-12-13 03:59:40 +05:30
|
|
|
if (left == verify(string,SEP) .and. right > left) & ! openChar is first and closeChar occurs
|
2013-09-18 19:37:55 +05:30
|
|
|
IO_getTag = string(left+1:right-1)
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_getTag
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
|
2013-02-13 00:30:41 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
!> @brief locates all space-separated chunks in given string and returns array containing number
|
2015-08-28 13:08:48 +05:30
|
|
|
!! them and the left/right position to be used by IO_xxxVal
|
|
|
|
!! Array size is dynamically adjusted to number of chunks found in string
|
2013-09-18 19:37:55 +05:30
|
|
|
!! IMPORTANT: first element contains number of chunks!
|
2013-02-13 00:30:41 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2015-08-28 13:08:48 +05:30
|
|
|
pure function IO_stringPos(string)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2015-08-28 13:08:48 +05:30
|
|
|
integer(pInt), dimension(:), allocatable :: IO_stringPos
|
|
|
|
character(len=*), intent(in) :: string !< string in which chunk positions are searched for
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), parameter :: SEP=achar(44)//achar(32)//achar(9)//achar(10)//achar(13) ! comma and whitespaces
|
2013-02-06 22:11:09 +05:30
|
|
|
integer :: left, right ! no pInt (verify and scan return default integer)
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2015-08-28 13:08:48 +05:30
|
|
|
allocate(IO_stringPos(1), source=0_pInt)
|
2009-12-15 21:33:53 +05:30
|
|
|
right = 0
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
do while (verify(string(right+1:),SEP)>0)
|
|
|
|
left = right + verify(string(right+1:),SEP)
|
|
|
|
right = left + scan(string(left:),SEP) - 2
|
2015-08-06 14:54:56 +05:30
|
|
|
if ( string(left:left) == '#' ) exit
|
2015-08-28 13:08:48 +05:30
|
|
|
IO_stringPos = [IO_stringPos,int(left, pInt), int(right, pInt)]
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_stringPos(1) = IO_stringPos(1)+1_pInt
|
2018-06-10 14:33:34 +05:30
|
|
|
endOfString: if (right < left) then
|
|
|
|
IO_stringPos(IO_stringPos(1)*2+1) = len_trim(string)
|
|
|
|
exit
|
|
|
|
endif endOfString
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2009-12-15 21:33:53 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_stringPos
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2015-08-13 20:24:34 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2015-08-28 13:08:48 +05:30
|
|
|
!> @brief reads string value at myChunk from string
|
2015-08-13 20:24:34 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2015-08-28 13:08:48 +05:30
|
|
|
function IO_stringValue(string,chunkPos,myChunk,silent)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
implicit none
|
2015-08-28 13:08:48 +05:30
|
|
|
integer(pInt), dimension(:), intent(in) :: chunkPos !< positions of start and end of each tag/chunk in given string
|
|
|
|
integer(pInt), intent(in) :: myChunk !< position number of desired chunk
|
|
|
|
character(len=*), intent(in) :: string !< raw input with known start and end of each chunk
|
|
|
|
character(len=:), allocatable :: IO_stringValue
|
|
|
|
|
|
|
|
logical, optional,intent(in) :: silent !< switch to trigger verbosity
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=16), parameter :: MYNAME = 'IO_stringValue: '
|
|
|
|
|
2013-02-08 21:25:53 +05:30
|
|
|
logical :: warn
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2018-12-06 05:12:28 +05:30
|
|
|
if (present(silent)) then
|
|
|
|
warn = silent
|
|
|
|
else
|
|
|
|
warn = .false.
|
|
|
|
endif
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-02-08 21:25:53 +05:30
|
|
|
IO_stringValue = ''
|
2015-08-28 13:08:48 +05:30
|
|
|
valuePresent: if (myChunk > chunkPos(1) .or. myChunk < 1_pInt) then
|
|
|
|
if (warn) call IO_warning(201,el=myChunk,ext_msg=MYNAME//trim(string))
|
|
|
|
else valuePresent
|
|
|
|
IO_stringValue = string(chunkPos(myChunk*2):chunkPos(myChunk*2+1))
|
|
|
|
endif valuePresent
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_stringValue
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2015-08-28 13:08:48 +05:30
|
|
|
!> @brief reads float value at myChunk from string
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2015-08-28 13:08:48 +05:30
|
|
|
real(pReal) function IO_floatValue (string,chunkPos,myChunk)
|
2013-02-06 22:11:09 +05:30
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
implicit none
|
2015-08-28 13:08:48 +05:30
|
|
|
integer(pInt), dimension(:), intent(in) :: chunkPos !< positions of start and end of each tag/chunk in given string
|
|
|
|
integer(pInt), intent(in) :: myChunk !< position number of desired chunk
|
|
|
|
character(len=*), intent(in) :: string !< raw input with known start and end of each chunk
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=15), parameter :: MYNAME = 'IO_floatValue: '
|
|
|
|
character(len=17), parameter :: VALIDCHARACTERS = '0123456789eEdD.+-'
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2013-02-06 22:11:09 +05:30
|
|
|
IO_floatValue = 0.0_pReal
|
2013-02-13 00:30:41 +05:30
|
|
|
|
2015-08-28 13:08:48 +05:30
|
|
|
valuePresent: if (myChunk > chunkPos(1) .or. myChunk < 1_pInt) then
|
|
|
|
call IO_warning(201,el=myChunk,ext_msg=MYNAME//trim(string))
|
|
|
|
else valuePresent
|
2014-02-06 23:18:01 +05:30
|
|
|
IO_floatValue = &
|
2015-08-28 13:08:48 +05:30
|
|
|
IO_verifyFloatValue(trim(adjustl(string(chunkPos(myChunk*2):chunkPos(myChunk*2+1)))),&
|
2013-09-18 19:37:55 +05:30
|
|
|
VALIDCHARACTERS,MYNAME)
|
2015-08-28 13:08:48 +05:30
|
|
|
endif valuePresent
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_floatValue
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief reads integer value at myChunk from string
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
integer(pInt) function IO_intValue(string,chunkPos,myChunk)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
character(len=*), intent(in) :: string !< raw input with known start and end of each chunk
|
|
|
|
integer(pInt), intent(in) :: myChunk !< position number of desired chunk
|
|
|
|
integer(pInt), dimension(:), intent(in) :: chunkPos !< positions of start and end of each tag/chunk in given string
|
|
|
|
character(len=13), parameter :: MYNAME = 'IO_intValue: '
|
|
|
|
character(len=12), parameter :: VALIDCHARACTERS = '0123456789+-'
|
|
|
|
|
|
|
|
IO_intValue = 0_pInt
|
|
|
|
|
|
|
|
valuePresent: if (myChunk > chunkPos(1) .or. myChunk < 1_pInt) then
|
|
|
|
call IO_warning(201,el=myChunk,ext_msg=MYNAME//trim(string))
|
|
|
|
else valuePresent
|
|
|
|
IO_intValue = IO_verifyIntValue(trim(adjustl(string(chunkPos(myChunk*2):chunkPos(myChunk*2+1)))),&
|
|
|
|
VALIDCHARACTERS,MYNAME)
|
|
|
|
endif valuePresent
|
|
|
|
|
|
|
|
end function IO_intValue
|
|
|
|
|
|
|
|
|
2019-02-03 12:41:19 +05:30
|
|
|
#ifdef Marc4DAMASK
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2015-08-28 13:08:48 +05:30
|
|
|
!> @brief reads float x.y+z value at myChunk from format string
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2015-08-28 13:08:48 +05:30
|
|
|
real(pReal) function IO_fixedNoEFloatValue (string,ends,myChunk)
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2007-03-21 20:15:03 +05:30
|
|
|
implicit none
|
2015-08-28 13:08:48 +05:30
|
|
|
character(len=*), intent(in) :: string !< raw input with known ends of each chunk
|
|
|
|
integer(pInt), intent(in) :: myChunk !< position number of desired chunk
|
|
|
|
integer(pInt), dimension(:), intent(in) :: ends !< positions of end of each tag/chunk in given string
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=22), parameter :: MYNAME = 'IO_fixedNoEFloatValue '
|
|
|
|
character(len=13), parameter :: VALIDBASE = '0123456789.+-'
|
|
|
|
character(len=12), parameter :: VALIDEXP = '0123456789+-'
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-02-13 00:30:41 +05:30
|
|
|
real(pReal) :: base
|
|
|
|
integer(pInt) :: expon
|
|
|
|
integer :: pos_exp
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2015-08-28 13:08:48 +05:30
|
|
|
pos_exp = scan(string(ends(myChunk)+1:ends(myChunk+1)),'+-',back=.true.)
|
|
|
|
hasExponent: if (pos_exp > 1) then
|
|
|
|
base = IO_verifyFloatValue(trim(adjustl(string(ends(myChunk)+1_pInt:ends(myChunk)+pos_exp-1_pInt))),&
|
2013-09-18 19:37:55 +05:30
|
|
|
VALIDBASE,MYNAME//'(base): ')
|
2015-08-28 13:08:48 +05:30
|
|
|
expon = IO_verifyIntValue(trim(adjustl(string(ends(myChunk)+pos_exp:ends(myChunk+1_pInt)))),&
|
2014-02-06 23:18:01 +05:30
|
|
|
VALIDEXP,MYNAME//'(exp): ')
|
2015-08-28 13:08:48 +05:30
|
|
|
else hasExponent
|
|
|
|
base = IO_verifyFloatValue(trim(adjustl(string(ends(myChunk)+1_pInt:ends(myChunk+1_pInt)))),&
|
2013-09-18 19:37:55 +05:30
|
|
|
VALIDBASE,MYNAME//'(base): ')
|
2013-02-13 00:30:41 +05:30
|
|
|
expon = 0_pInt
|
2015-08-28 13:08:48 +05:30
|
|
|
endif hasExponent
|
2013-02-13 00:30:41 +05:30
|
|
|
IO_fixedNoEFloatValue = base*10.0_pReal**real(expon,pReal)
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_fixedNoEFloatValue
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
|
2019-02-03 12:41:19 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief reads integer value at myChunk from fixed format string
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
integer(pInt) function IO_fixedIntValue(string,ends,myChunk)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
character(len=*), intent(in) :: string !< raw input with known ends of each chunk
|
|
|
|
integer(pInt), intent(in) :: myChunk !< position number of desired chunk
|
|
|
|
integer(pInt), dimension(:), intent(in) :: ends !< positions of end of each tag/chunk in given string
|
|
|
|
character(len=20), parameter :: MYNAME = 'IO_fixedIntValue: '
|
|
|
|
character(len=12), parameter :: VALIDCHARACTERS = '0123456789+-'
|
|
|
|
|
|
|
|
IO_fixedIntValue = IO_verifyIntValue(trim(adjustl(string(ends(myChunk)+1_pInt:ends(myChunk+1_pInt)))),&
|
|
|
|
VALIDCHARACTERS,MYNAME)
|
|
|
|
|
|
|
|
end function IO_fixedIntValue
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief changes characters in string to lower case
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
pure function IO_lc(string)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), intent(in) :: string !< string to convert
|
|
|
|
character(len=len(string)) :: IO_lc
|
|
|
|
|
|
|
|
character(26), parameter :: LOWER = 'abcdefghijklmnopqrstuvwxyz'
|
2018-01-10 21:43:25 +05:30
|
|
|
character(26), parameter :: UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|
|
|
|
2013-02-06 22:11:09 +05:30
|
|
|
integer :: i,n ! no pInt (len returns default integer)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
IO_lc = string
|
|
|
|
do i=1,len(string)
|
|
|
|
n = index(UPPER,IO_lc(i:i))
|
|
|
|
if (n/=0) IO_lc(i:i) = LOWER(n:n)
|
2007-04-25 20:08:22 +05:30
|
|
|
enddo
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_lc
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
#ifdef Marc4DAMASK
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief reads file to skip (at least) N chunks (may be over multiple lines)
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-12-11 22:19:20 +05:30
|
|
|
subroutine IO_skipChunks(fileUnit,N)
|
2009-04-03 12:34:31 +05:30
|
|
|
|
|
|
|
implicit none
|
2018-01-10 21:43:25 +05:30
|
|
|
integer(pInt), intent(in) :: fileUnit, & !< file handle
|
|
|
|
N !< minimum number of chunks to skip
|
2012-03-07 15:37:29 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: remainingChunks
|
2013-06-24 19:03:30 +05:30
|
|
|
character(len=65536) :: line
|
2009-04-03 12:34:31 +05:30
|
|
|
|
2013-09-19 20:58:55 +05:30
|
|
|
line = ''
|
2009-04-03 12:34:31 +05:30
|
|
|
remainingChunks = N
|
2013-09-19 20:58:55 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
do while (trim(line) /= IO_EOF .and. remainingChunks > 0)
|
2013-12-11 22:19:20 +05:30
|
|
|
line = IO_read(fileUnit)
|
2015-08-28 13:08:48 +05:30
|
|
|
remainingChunks = remainingChunks - (size(IO_stringPos(line))-1_pInt)/2_pInt
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2013-09-18 19:37:55 +05:30
|
|
|
end subroutine IO_skipChunks
|
2019-02-03 12:48:38 +05:30
|
|
|
#endif
|
2009-04-03 12:34:31 +05:30
|
|
|
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
#ifdef Abaqus
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief extracts string value from key=value pair and check whether key matches
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=300) pure function IO_extractValue(pair,key)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2009-10-12 21:31:49 +05:30
|
|
|
implicit none
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), intent(in) :: pair, & !< key=value pair
|
|
|
|
key !< key to be expected
|
2012-03-07 15:37:29 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
character(len=*), parameter :: SEP = achar(61) ! '='
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2015-08-28 13:08:48 +05:30
|
|
|
integer :: myChunk !< position number of desired chunk
|
2009-10-12 21:31:49 +05:30
|
|
|
|
|
|
|
IO_extractValue = ''
|
|
|
|
|
2015-08-28 13:08:48 +05:30
|
|
|
myChunk = scan(pair,SEP)
|
2016-03-09 20:06:11 +05:30
|
|
|
if (myChunk > 0 .and. pair(:myChunk-1) == key) IO_extractValue = pair(myChunk+1:) ! extract value if key matches
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_extractValue
|
2019-02-03 12:48:38 +05:30
|
|
|
# endif
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-03 12:48:38 +05:30
|
|
|
!> @brief returns format string for integer values without leading zeros
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-03 12:48:38 +05:30
|
|
|
pure function IO_intOut(intToPrint)
|
2007-10-15 19:25:52 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: intToPrint
|
|
|
|
character(len=41) :: IO_intOut
|
|
|
|
integer(pInt) :: N_digits
|
|
|
|
character(len=19) :: width ! maximum digits for 64 bit integer
|
|
|
|
character(len=20) :: min_width ! longer for negative values
|
2012-03-09 20:52:52 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
N_digits = 1_pInt + int(log10(real(max(abs(intToPrint),1_pInt))),pInt)
|
|
|
|
write(width, '(I19.19)') N_digits
|
|
|
|
write(min_width, '(I20.20)') N_digits + merge(1_pInt,0_pInt,intToPrint < 0_pInt)
|
|
|
|
IO_intOut = 'I'//trim(min_width)//'.'//trim(width)
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
end function IO_intOut
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2018-01-10 21:43:25 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-03 12:48:38 +05:30
|
|
|
!> @brief returns time stamp
|
2018-01-10 21:43:25 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-03 12:48:38 +05:30
|
|
|
function IO_timeStamp()
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
implicit none
|
|
|
|
character(len=10) :: IO_timeStamp
|
|
|
|
integer(pInt), dimension(8) :: values
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
call DATE_AND_TIME(VALUES=values)
|
|
|
|
write(IO_timeStamp,'(i2.2,a1,i2.2,a1,i2.2)') values(5),':',values(6),':',values(7)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
end function IO_timeStamp
|
2019-02-03 12:36:53 +05:30
|
|
|
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-03 12:48:38 +05:30
|
|
|
!> @brief write error statements to standard out and terminate the Marc/spectral run with exit #9xxx
|
|
|
|
!> in ABAQUS either time step is reduced or execution terminated
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-03 12:48:38 +05:30
|
|
|
subroutine IO_error(error_ID,el,ip,g,instance,ext_msg)
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
2019-02-03 12:48:38 +05:30
|
|
|
integer(pInt), intent(in) :: error_ID
|
|
|
|
integer(pInt), optional, intent(in) :: el,ip,g,instance
|
|
|
|
character(len=*), optional, intent(in) :: ext_msg
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
external :: quit
|
|
|
|
character(len=1024) :: msg
|
|
|
|
character(len=1024) :: formatString
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
select case (error_ID)
|
2007-10-15 19:25:52 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! internal errors
|
|
|
|
case (0_pInt)
|
|
|
|
msg = 'internal check failed:'
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-03 12:48:38 +05:30
|
|
|
! file handling errors
|
|
|
|
case (100_pInt)
|
|
|
|
msg = 'could not open file:'
|
|
|
|
case (101_pInt)
|
|
|
|
msg = 'write error for file:'
|
|
|
|
case (102_pInt)
|
|
|
|
msg = 'could not read file:'
|
|
|
|
case (103_pInt)
|
|
|
|
msg = 'could not assemble input files'
|
|
|
|
case (104_pInt)
|
|
|
|
msg = '{input} recursion limit reached'
|
|
|
|
case (105_pInt)
|
|
|
|
msg = 'unknown output:'
|
|
|
|
case (106_pInt)
|
|
|
|
msg = 'working directory does not exist:'
|
|
|
|
case (107_pInt)
|
|
|
|
msg = 'line length exceeds limit of 256'
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-03 12:48:38 +05:30
|
|
|
! lattice error messages
|
|
|
|
case (130_pInt)
|
|
|
|
msg = 'unknown lattice structure encountered'
|
|
|
|
case (131_pInt)
|
|
|
|
msg = 'hex lattice structure with invalid c/a ratio'
|
|
|
|
case (132_pInt)
|
|
|
|
msg = 'trans_lattice_structure not possible'
|
|
|
|
case (133_pInt)
|
|
|
|
msg = 'transformed hex lattice structure with invalid c/a ratio'
|
|
|
|
case (135_pInt)
|
|
|
|
msg = 'zero entry on stiffness diagonal'
|
|
|
|
case (136_pInt)
|
|
|
|
msg = 'zero entry on stiffness diagonal for transformed phase'
|
|
|
|
case (137_pInt)
|
|
|
|
msg = 'not defined for lattice structure'
|
|
|
|
case (138_pInt)
|
|
|
|
msg = 'not enough interaction parameters given'
|
2014-12-03 06:12:35 +05:30
|
|
|
|
2018-06-11 03:08:16 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! errors related to the parsing of material.config
|
|
|
|
case (140_pInt)
|
|
|
|
msg = 'key not found'
|
|
|
|
case (141_pInt)
|
|
|
|
msg = 'number of chunks in string differs'
|
|
|
|
case (142_pInt)
|
|
|
|
msg = 'empty list'
|
|
|
|
case (143_pInt)
|
|
|
|
msg = 'no value found for key'
|
2018-09-12 17:33:45 +05:30
|
|
|
case (144_pInt)
|
2018-10-10 11:12:07 +05:30
|
|
|
msg = 'negative number systems requested'
|
2018-09-12 17:33:45 +05:30
|
|
|
case (145_pInt)
|
2018-10-09 20:14:47 +05:30
|
|
|
msg = 'too many systems requested'
|
2018-12-21 16:22:23 +05:30
|
|
|
case (146_pInt)
|
|
|
|
msg = 'number of values does not match'
|
2018-06-11 03:08:16 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! material error messages and related messages in mesh
|
2012-02-02 18:49:02 +05:30
|
|
|
case (150_pInt)
|
2013-10-23 16:51:48 +05:30
|
|
|
msg = 'index out of bounds'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (151_pInt)
|
2013-10-23 16:51:48 +05:30
|
|
|
msg = 'microstructure has no constituents'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (153_pInt)
|
2011-08-02 15:44:16 +05:30
|
|
|
msg = 'sum of phase fractions differs from 1'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (154_pInt)
|
|
|
|
msg = 'homogenization index out of bounds'
|
|
|
|
case (155_pInt)
|
|
|
|
msg = 'microstructure index out of bounds'
|
|
|
|
case (156_pInt)
|
|
|
|
msg = 'reading from ODF file'
|
2013-05-02 14:05:37 +05:30
|
|
|
case (157_pInt)
|
2013-07-24 16:39:39 +05:30
|
|
|
msg = 'illegal texture transformation specified'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (160_pInt)
|
|
|
|
msg = 'no entries in config part'
|
2018-08-30 13:12:45 +05:30
|
|
|
case (161_pInt)
|
|
|
|
msg = 'config part found twice'
|
2014-05-15 18:38:02 +05:30
|
|
|
case (165_pInt)
|
|
|
|
msg = 'homogenization configuration'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (170_pInt)
|
|
|
|
msg = 'no homogenization specified via State Variable 2'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (180_pInt)
|
2012-02-13 23:11:27 +05:30
|
|
|
msg = 'no microstructure specified via State Variable 3'
|
2013-04-10 15:08:40 +05:30
|
|
|
case (190_pInt)
|
|
|
|
msg = 'unknown element type:'
|
2018-09-23 18:49:47 +05:30
|
|
|
case (191_pInt)
|
|
|
|
msg = 'mesh consists of more than one element type'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! plasticity error messages
|
2012-02-02 18:49:02 +05:30
|
|
|
case (200_pInt)
|
2018-01-10 21:43:25 +05:30
|
|
|
msg = 'unknown elasticity specified:'
|
2012-06-02 19:53:28 +05:30
|
|
|
case (201_pInt)
|
2013-11-27 13:34:05 +05:30
|
|
|
msg = 'unknown plasticity specified:'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-02-14 14:52:37 +05:30
|
|
|
case (210_pInt)
|
2012-07-17 23:06:24 +05:30
|
|
|
msg = 'unknown material parameter:'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (211_pInt)
|
2012-07-17 23:06:24 +05:30
|
|
|
msg = 'material parameter out of bounds:'
|
2009-10-16 01:32:52 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
! numerics error messages
|
2012-02-13 23:11:27 +05:30
|
|
|
case (300_pInt)
|
|
|
|
msg = 'unknown numerics parameter:'
|
|
|
|
case (301_pInt)
|
|
|
|
msg = 'numerics parameter out of bounds:'
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! math errors
|
2012-02-13 23:11:27 +05:30
|
|
|
case (400_pInt)
|
|
|
|
msg = 'matrix inversion error'
|
|
|
|
case (401_pInt)
|
2017-09-15 00:55:22 +05:30
|
|
|
msg = 'math_check failed'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (405_pInt)
|
2013-06-30 05:47:58 +05:30
|
|
|
msg = 'I_TO_HALTON-error: an input base BASE is <= 1'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (406_pInt)
|
|
|
|
msg = 'Prime-error: N must be between 0 and PRIME_MAX'
|
2012-05-08 18:46:59 +05:30
|
|
|
case (407_pInt)
|
2012-06-02 19:53:28 +05:30
|
|
|
msg = 'Polar decomposition error'
|
2013-06-06 00:40:37 +05:30
|
|
|
case (409_pInt)
|
|
|
|
msg = 'math_check: R*v == q*v failed'
|
2015-12-15 01:34:59 +05:30
|
|
|
case (410_pInt)
|
|
|
|
msg = 'eigenvalues computation error'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! homogenization errors
|
2012-02-13 23:11:27 +05:30
|
|
|
case (500_pInt)
|
|
|
|
msg = 'unknown homogenization specified'
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-02-28 02:11:14 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! user errors
|
|
|
|
case (600_pInt)
|
2013-04-16 22:37:27 +05:30
|
|
|
msg = 'Ping-Pong not possible when using non-DAMASK elements'
|
2013-02-28 02:11:14 +05:30
|
|
|
case (601_pInt)
|
2013-04-16 22:37:27 +05:30
|
|
|
msg = 'Ping-Pong needed when using non-local plasticity'
|
2013-10-16 18:08:00 +05:30
|
|
|
case (602_pInt)
|
2017-09-19 17:36:44 +05:30
|
|
|
msg = 'invalid selection for debug'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! DAMASK_marc errors
|
2012-02-02 18:49:02 +05:30
|
|
|
case (700_pInt)
|
2012-02-13 23:11:27 +05:30
|
|
|
msg = 'invalid materialpoint result requested'
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
2019-02-02 19:40:35 +05:30
|
|
|
! errors related to the grid solver
|
2012-02-13 23:11:27 +05:30
|
|
|
case (809_pInt)
|
|
|
|
msg = 'initializing FFTW'
|
2015-07-09 19:08:21 +05:30
|
|
|
case (810_pInt)
|
|
|
|
msg = 'FFTW plan creation'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (831_pInt)
|
|
|
|
msg = 'mask consistency violated in spectral loadcase'
|
|
|
|
case (832_pInt)
|
2015-07-09 19:08:21 +05:30
|
|
|
msg = 'ill-defined L (line partly defined) in spectral loadcase'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (834_pInt)
|
|
|
|
msg = 'negative time increment in spectral loadcase'
|
|
|
|
case (835_pInt)
|
|
|
|
msg = 'non-positive increments in spectral loadcase'
|
|
|
|
case (836_pInt)
|
|
|
|
msg = 'non-positive result frequency in spectral loadcase'
|
|
|
|
case (837_pInt)
|
|
|
|
msg = 'incomplete loadcase'
|
|
|
|
case (838_pInt)
|
|
|
|
msg = 'mixed boundary conditions allow rotation'
|
2012-05-21 14:36:02 +05:30
|
|
|
case (841_pInt)
|
|
|
|
msg = 'missing header length info in spectral mesh'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (842_pInt)
|
|
|
|
msg = 'incomplete information in spectral mesh header'
|
2019-02-02 19:40:35 +05:30
|
|
|
case (843_pInt)
|
|
|
|
msg = 'microstructure count mismatch'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (846_pInt)
|
2018-08-30 13:12:45 +05:30
|
|
|
msg = 'rotation for load case rotation ill-defined (R:RT != I)'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (847_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'update of gamma operator not possible when pre-calculated'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (880_pInt)
|
|
|
|
msg = 'mismatch of microstructure count and a*b*c in geom file'
|
2012-08-29 00:49:47 +05:30
|
|
|
case (891_pInt)
|
|
|
|
msg = 'unknown solver type selected'
|
|
|
|
case (892_pInt)
|
|
|
|
msg = 'unknown filter type selected'
|
2015-12-15 01:34:59 +05:30
|
|
|
case (893_pInt)
|
|
|
|
msg = 'PETSc: SNES_DIVERGED_FNORM_NAN'
|
2016-03-27 00:25:44 +05:30
|
|
|
case (894_pInt)
|
|
|
|
msg = 'MPI error'
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! error messages related to parsing of Abaqus input file
|
2012-02-02 18:49:02 +05:30
|
|
|
case (900_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'improper definition of nodes in input file (Nnodes < 2)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (901_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no elements defined in input file (Nelems = 0)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (902_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no element sets defined in input file (No *Elset exists)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (903_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no materials defined in input file (Look into section assigments)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (904_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no elements could be assigned for Elset: '
|
2012-02-02 18:49:02 +05:30
|
|
|
case (905_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'error in mesh_abaqus_map_materials'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (906_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'error in mesh_abaqus_count_cpElements'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (907_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'size of mesh_mapFEtoCPelem in mesh_abaqus_map_elements'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (908_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'size of mesh_mapFEtoCPnode in mesh_abaqus_map_nodes'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (909_pInt)
|
2018-01-10 21:43:25 +05:30
|
|
|
msg = 'size of mesh_node in mesh_abaqus_build_nodes not equal to mesh_Nnodes'
|
|
|
|
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! general error messages
|
2012-02-13 23:11:27 +05:30
|
|
|
case (666_pInt)
|
|
|
|
msg = 'memory leak detected'
|
2007-03-20 19:25:22 +05:30
|
|
|
case default
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'unknown error number...'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
end select
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2008-05-26 18:41:25 +05:30
|
|
|
!$OMP CRITICAL (write2out)
|
2017-05-16 01:23:25 +05:30
|
|
|
write(0,'(/,a)') ' ┌'//IO_DIVIDER//'┐'
|
|
|
|
write(0,'(a,24x,a,40x,a)') ' │','error', '│'
|
|
|
|
write(0,'(a,24x,i3,42x,a)') ' │',error_ID, '│'
|
|
|
|
write(0,'(a)') ' ├'//IO_DIVIDER//'┤'
|
2017-05-01 07:18:06 +05:30
|
|
|
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a4,a',max(1,len(trim(msg))),',',&
|
2017-05-16 01:23:25 +05:30
|
|
|
max(1,72-len(trim(msg))-4),'x,a)'
|
|
|
|
write(0,formatString) '│ ',trim(msg), '│'
|
2013-01-10 03:49:32 +05:30
|
|
|
if (present(ext_msg)) then
|
2017-05-01 07:18:06 +05:30
|
|
|
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a4,a',max(1,len(trim(ext_msg))),',',&
|
2017-05-16 01:23:25 +05:30
|
|
|
max(1,72-len(trim(ext_msg))-4),'x,a)'
|
|
|
|
write(0,formatString) '│ ',trim(ext_msg), '│'
|
2009-03-04 17:18:54 +05:30
|
|
|
endif
|
2017-05-16 01:23:25 +05:30
|
|
|
if (present(el)) &
|
|
|
|
write(0,'(a19,1x,i9,44x,a3)') ' │ at element ',el, '│'
|
|
|
|
if (present(ip)) &
|
|
|
|
write(0,'(a19,1x,i9,44x,a3)') ' │ at IP ',ip, '│'
|
|
|
|
if (present(g)) &
|
|
|
|
write(0,'(a19,1x,i9,44x,a3)') ' │ at constituent',g, '│'
|
|
|
|
if (present(instance)) &
|
|
|
|
write(0,'(a19,1x,i9,44x,a3)') ' │ at instance ',instance, '│'
|
|
|
|
write(0,'(a,69x,a)') ' │', '│'
|
|
|
|
write(0,'(a)') ' └'//IO_DIVIDER//'┘'
|
2017-02-13 03:29:14 +05:30
|
|
|
flush(0)
|
2012-02-10 16:54:53 +05:30
|
|
|
call quit(9000_pInt+error_ID)
|
2010-02-18 15:42:45 +05:30
|
|
|
!$OMP END CRITICAL (write2out)
|
2009-01-20 00:40:58 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_error
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
!> @brief writes warning statement to standard out
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-09-18 19:37:55 +05:30
|
|
|
subroutine IO_warning(warning_ID,el,ip,g,ext_msg)
|
2009-03-31 14:51:57 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: warning_ID
|
2013-09-18 19:37:55 +05:30
|
|
|
integer(pInt), optional, intent(in) :: el,ip,g
|
2009-03-31 14:51:57 +05:30
|
|
|
character(len=*), optional, intent(in) :: ext_msg
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=1024) :: msg
|
2013-01-10 03:49:32 +05:30
|
|
|
character(len=1024) :: formatString
|
2009-03-31 14:51:57 +05:30
|
|
|
|
2011-11-02 20:08:42 +05:30
|
|
|
select case (warning_ID)
|
2014-12-03 06:12:35 +05:30
|
|
|
case (1_pInt)
|
|
|
|
msg = 'unknown key'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (34_pInt)
|
2011-12-06 22:28:17 +05:30
|
|
|
msg = 'invalid restart increment given'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (35_pInt)
|
2012-01-30 19:22:41 +05:30
|
|
|
msg = 'could not get $DAMASK_NUM_THREADS'
|
2012-06-15 21:40:21 +05:30
|
|
|
case (40_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'found spectral solver parameter'
|
2012-10-11 20:19:12 +05:30
|
|
|
case (42_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'parameter has no effect'
|
2014-06-18 14:40:16 +05:30
|
|
|
case (43_pInt)
|
|
|
|
msg = 'main diagonal of C66 close to zero'
|
2011-11-15 23:24:18 +05:30
|
|
|
case (47_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no valid parameter for FFTW, using FFTW_PATIENT'
|
2013-09-12 20:17:09 +05:30
|
|
|
case (50_pInt)
|
2013-10-11 14:47:03 +05:30
|
|
|
msg = 'not all available slip system families are defined'
|
2013-09-12 20:17:09 +05:30
|
|
|
case (51_pInt)
|
2013-10-11 14:47:03 +05:30
|
|
|
msg = 'not all available twin system families are defined'
|
|
|
|
case (52_pInt)
|
|
|
|
msg = 'not all available parameters are defined'
|
2014-07-22 13:13:03 +05:30
|
|
|
case (53_pInt)
|
|
|
|
msg = 'not all available transformation system families are defined'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (101_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'crystallite debugging off'
|
2013-02-06 22:11:09 +05:30
|
|
|
case (201_pInt)
|
|
|
|
msg = 'position not found when parsing line'
|
|
|
|
case (202_pInt)
|
|
|
|
msg = 'invalid character in string chunk'
|
|
|
|
case (203_pInt)
|
|
|
|
msg = 'interpretation of string chunk failed'
|
2019-01-29 23:01:16 +05:30
|
|
|
case (207_pInt)
|
|
|
|
msg = 'line truncated'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (600_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'crystallite responds elastically'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (601_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'stiffness close to zero'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (650_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'polar decomposition failed'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (700_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'unknown crystal symmetry'
|
2014-03-31 15:34:11 +05:30
|
|
|
case (850_pInt)
|
|
|
|
msg = 'max number of cut back exceeded, terminating'
|
2009-03-31 14:51:57 +05:30
|
|
|
case default
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'unknown warning number'
|
2009-03-31 14:51:57 +05:30
|
|
|
end select
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2009-03-31 14:51:57 +05:30
|
|
|
!$OMP CRITICAL (write2out)
|
2017-05-16 01:23:25 +05:30
|
|
|
write(6,'(/,a)') ' ┌'//IO_DIVIDER//'┐'
|
|
|
|
write(6,'(a,24x,a,38x,a)') ' │','warning', '│'
|
|
|
|
write(6,'(a,24x,i3,42x,a)') ' │',warning_ID, '│'
|
|
|
|
write(6,'(a)') ' ├'//IO_DIVIDER//'┤'
|
|
|
|
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a4,a',max(1,len(trim(msg))),',',&
|
|
|
|
max(1,72-len(trim(msg))-4),'x,a)'
|
|
|
|
write(6,formatString) '│ ',trim(msg), '│'
|
2013-01-10 03:49:32 +05:30
|
|
|
if (present(ext_msg)) then
|
2017-05-16 01:23:25 +05:30
|
|
|
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a4,a',max(1,len(trim(ext_msg))),',',&
|
|
|
|
max(1,72-len(trim(ext_msg))-4),'x,a)'
|
|
|
|
write(6,formatString) '│ ',trim(ext_msg), '│'
|
2009-03-31 14:51:57 +05:30
|
|
|
endif
|
2017-05-16 01:23:25 +05:30
|
|
|
if (present(el)) &
|
|
|
|
write(6,'(a19,1x,i9,44x,a3)') ' │ at element ',el, '│'
|
|
|
|
if (present(ip)) &
|
|
|
|
write(6,'(a19,1x,i9,44x,a3)') ' │ at IP ',ip, '│'
|
|
|
|
if (present(g)) &
|
|
|
|
write(6,'(a19,1x,i9,44x,a3)') ' │ at constituent',g, '│'
|
|
|
|
write(6,'(a,69x,a)') ' │', '│'
|
|
|
|
write(6,'(a)') ' └'//IO_DIVIDER//'┘'
|
2012-03-06 20:22:48 +05:30
|
|
|
flush(6)
|
2010-04-06 12:17:15 +05:30
|
|
|
!$OMP END CRITICAL (write2out)
|
2009-03-31 14:51:57 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_warning
|
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
|
2019-02-03 12:48:38 +05:30
|
|
|
#ifdef Abaqus
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief count lines containig data up to next *keyword
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
integer(pInt) function IO_countDataLines(fileUnit)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: fileUnit !< file handle
|
|
|
|
|
|
|
|
|
|
|
|
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
|
|
character(len=65536) :: line, &
|
|
|
|
tmp
|
|
|
|
|
|
|
|
IO_countDataLines = 0_pInt
|
|
|
|
line = ''
|
|
|
|
|
|
|
|
do while (trim(line) /= IO_EOF)
|
|
|
|
line = IO_read(fileUnit)
|
|
|
|
chunkPos = IO_stringPos(line)
|
|
|
|
tmp = IO_lc(IO_stringValue(line,chunkPos,1_pInt))
|
|
|
|
if (tmp(1:1) == '*' .and. tmp(2:2) /= '*') then ! found keyword
|
|
|
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
if (tmp(2:2) /= '*') IO_countDataLines = IO_countDataLines + 1_pInt
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
backspace(fileUnit)
|
|
|
|
|
|
|
|
end function IO_countDataLines
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Marc4DAMASK
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief count lines containig data up to next *keyword
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
integer(pInt) function IO_countNumericalDataLines(fileUnit)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: fileUnit !< file handle
|
|
|
|
|
|
|
|
|
|
|
|
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
|
|
character(len=65536) :: line, &
|
|
|
|
tmp
|
|
|
|
|
|
|
|
IO_countNumericalDataLines = 0_pInt
|
|
|
|
line = ''
|
|
|
|
|
|
|
|
do while (trim(line) /= IO_EOF)
|
|
|
|
line = IO_read(fileUnit)
|
|
|
|
chunkPos = IO_stringPos(line)
|
|
|
|
tmp = IO_lc(IO_stringValue(line,chunkPos,1_pInt))
|
|
|
|
if (verify(trim(tmp),'0123456789') == 0) then ! numerical values
|
|
|
|
IO_countNumericalDataLines = IO_countNumericalDataLines + 1_pInt
|
|
|
|
else
|
|
|
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
|
|
exit
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
backspace(fileUnit)
|
|
|
|
|
|
|
|
end function IO_countNumericalDataLines
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(Abaqus) || defined(Marc4DAMASK)
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief count items in consecutive lines depending on lines
|
|
|
|
!> @details Marc: ints concatenated by "c" as last char or range of values a "to" b
|
|
|
|
!> Abaqus: triplet of start,stop,inc
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
integer(pInt) function IO_countContinuousIntValues(fileUnit)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: fileUnit
|
|
|
|
|
|
|
|
#ifdef Abaqus
|
|
|
|
integer(pInt) :: l,c
|
|
|
|
#endif
|
|
|
|
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
|
|
character(len=65536) :: line
|
|
|
|
|
|
|
|
IO_countContinuousIntValues = 0_pInt
|
|
|
|
line = ''
|
|
|
|
|
|
|
|
#if defined(Marc4DAMASK)
|
|
|
|
do while (trim(line) /= IO_EOF)
|
|
|
|
line = IO_read(fileUnit)
|
|
|
|
chunkPos = IO_stringPos(line)
|
|
|
|
if (chunkPos(1) < 1_pInt) then ! empty line
|
|
|
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
|
|
exit
|
|
|
|
elseif (IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'to' ) then ! found range indicator
|
|
|
|
IO_countContinuousIntValues = 1_pInt + abs( IO_intValue(line,chunkPos,3_pInt) &
|
|
|
|
- IO_intValue(line,chunkPos,1_pInt))
|
|
|
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
|
|
exit ! only one single range indicator allowed
|
|
|
|
else
|
|
|
|
IO_countContinuousIntValues = IO_countContinuousIntValues+chunkPos(1)-1_pInt ! add line's count when assuming 'c'
|
|
|
|
if ( IO_lc(IO_stringValue(line,chunkPos,chunkPos(1))) /= 'c' ) then ! line finished, read last value
|
|
|
|
IO_countContinuousIntValues = IO_countContinuousIntValues+1_pInt
|
|
|
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
|
|
exit ! data ended
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
#elif defined(Abaqus)
|
|
|
|
c = IO_countDataLines(fileUnit)
|
|
|
|
do l = 1_pInt,c
|
|
|
|
backspace(fileUnit)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
l = 1_pInt
|
|
|
|
do while (trim(line) /= IO_EOF .and. l <= c) ! ToDo: is this correct?
|
|
|
|
l = l + 1_pInt
|
|
|
|
line = IO_read(fileUnit)
|
|
|
|
chunkPos = IO_stringPos(line)
|
|
|
|
IO_countContinuousIntValues = IO_countContinuousIntValues + 1_pInt + & ! assuming range generation
|
|
|
|
(IO_intValue(line,chunkPos,2_pInt)-IO_intValue(line,chunkPos,1_pInt))/&
|
|
|
|
max(1_pInt,IO_intValue(line,chunkPos,3_pInt))
|
|
|
|
enddo
|
|
|
|
#endif
|
|
|
|
|
|
|
|
end function IO_countContinuousIntValues
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return integer list corresponding to items in consecutive lines.
|
|
|
|
!! First integer in array is counter
|
|
|
|
!> @details Marc: ints concatenated by "c" as last char, range of a "to" b, or named set
|
|
|
|
!! Abaqus: triplet of start,stop,inc or named set
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
function IO_continuousIntValues(fileUnit,maxN,lookupName,lookupMap,lookupMaxN)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: maxN
|
|
|
|
integer(pInt), dimension(1+maxN) :: IO_continuousIntValues
|
|
|
|
|
|
|
|
integer(pInt), intent(in) :: fileUnit, &
|
|
|
|
lookupMaxN
|
|
|
|
integer(pInt), dimension(:,:), intent(in) :: lookupMap
|
|
|
|
character(len=64), dimension(:), intent(in) :: lookupName
|
|
|
|
integer(pInt) :: i,first,last
|
|
|
|
#ifdef Abaqus
|
|
|
|
integer(pInt) :: j,l,c
|
|
|
|
#endif
|
|
|
|
|
|
|
|
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
|
|
character(len=65536) line
|
|
|
|
logical rangeGeneration
|
|
|
|
|
|
|
|
IO_continuousIntValues = 0_pInt
|
|
|
|
rangeGeneration = .false.
|
|
|
|
|
|
|
|
#if defined(Marc4DAMASK)
|
|
|
|
do
|
|
|
|
read(fileUnit,'(A65536)',end=100) line
|
|
|
|
chunkPos = IO_stringPos(line)
|
|
|
|
if (chunkPos(1) < 1_pInt) then ! empty line
|
|
|
|
exit
|
|
|
|
elseif (verify(IO_stringValue(line,chunkPos,1_pInt),'0123456789') > 0) then ! a non-int, i.e. set name
|
|
|
|
do i = 1_pInt, lookupMaxN ! loop over known set names
|
|
|
|
if (IO_stringValue(line,chunkPos,1_pInt) == lookupName(i)) then ! found matching name
|
|
|
|
IO_continuousIntValues = lookupMap(:,i) ! return resp. entity list
|
|
|
|
exit
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
exit
|
|
|
|
else if (chunkPos(1) > 2_pInt .and. IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'to' ) then ! found range indicator
|
|
|
|
first = IO_intValue(line,chunkPos,1_pInt)
|
|
|
|
last = IO_intValue(line,chunkPos,3_pInt)
|
|
|
|
do i = first, last, sign(1_pInt,last-first)
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = i
|
|
|
|
enddo
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
do i = 1_pInt,chunkPos(1)-1_pInt ! interpret up to second to last value
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = IO_intValue(line,chunkPos,i)
|
|
|
|
enddo
|
|
|
|
if ( IO_lc(IO_stringValue(line,chunkPos,chunkPos(1))) /= 'c' ) then ! line finished, read last value
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = IO_intValue(line,chunkPos,chunkPos(1))
|
|
|
|
exit
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
#elif defined(Abaqus)
|
|
|
|
c = IO_countDataLines(fileUnit)
|
|
|
|
do l = 1_pInt,c
|
|
|
|
backspace(fileUnit)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! check if the element values in the elset are auto generated
|
|
|
|
backspace(fileUnit)
|
|
|
|
read(fileUnit,'(A65536)',end=100) line
|
|
|
|
chunkPos = IO_stringPos(line)
|
|
|
|
do i = 1_pInt,chunkPos(1)
|
|
|
|
if (IO_lc(IO_stringValue(line,chunkPos,i)) == 'generate') rangeGeneration = .true.
|
|
|
|
enddo
|
|
|
|
|
|
|
|
do l = 1_pInt,c
|
|
|
|
read(fileUnit,'(A65536)',end=100) line
|
|
|
|
chunkPos = IO_stringPos(line)
|
|
|
|
if (verify(IO_stringValue(line,chunkPos,1_pInt),'0123456789') > 0) then ! a non-int, i.e. set names follow on this line
|
|
|
|
do i = 1_pInt,chunkPos(1) ! loop over set names in line
|
|
|
|
do j = 1_pInt,lookupMaxN ! look through known set names
|
|
|
|
if (IO_stringValue(line,chunkPos,i) == lookupName(j)) then ! found matching name
|
|
|
|
first = 2_pInt + IO_continuousIntValues(1) ! where to start appending data
|
|
|
|
last = first + lookupMap(1,j) - 1_pInt ! up to where to append data
|
|
|
|
IO_continuousIntValues(first:last) = lookupMap(2:1+lookupMap(1,j),j) ! add resp. entity list
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + lookupMap(1,j) ! count them
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
else if (rangeGeneration) then ! range generation
|
|
|
|
do i = IO_intValue(line,chunkPos,1_pInt),&
|
|
|
|
IO_intValue(line,chunkPos,2_pInt),&
|
|
|
|
max(1_pInt,IO_intValue(line,chunkPos,3_pInt))
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = i
|
|
|
|
enddo
|
|
|
|
else ! read individual elem nums
|
|
|
|
do i = 1_pInt,chunkPos(1)
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = IO_intValue(line,chunkPos,i)
|
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
#endif
|
|
|
|
|
|
|
|
100 end function IO_continuousIntValues
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2018-01-10 21:43:25 +05:30
|
|
|
! internal helper functions
|
2013-02-11 15:14:17 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief returns verified integer value in given string
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
integer(pInt) function IO_verifyIntValue (string,validChars,myName)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
implicit none
|
2018-01-10 21:43:25 +05:30
|
|
|
character(len=*), intent(in) :: string, & !< string for conversion to int value. Must not contain spaces!
|
2013-09-18 19:37:55 +05:30
|
|
|
validChars, & !< valid characters in string
|
|
|
|
myName !< name of caller function (for debugging)
|
|
|
|
integer(pInt) :: readStatus, invalidWhere
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
IO_verifyIntValue = 0_pInt
|
|
|
|
|
2014-02-06 23:18:01 +05:30
|
|
|
invalidWhere = verify(string,validChars)
|
2013-09-18 19:37:55 +05:30
|
|
|
if (invalidWhere == 0_pInt) then
|
2014-02-06 23:18:01 +05:30
|
|
|
read(UNIT=string,iostat=readStatus,FMT=*) IO_verifyIntValue ! no offending chars found
|
2018-02-02 19:36:13 +05:30
|
|
|
if (readStatus /= 0_pInt) & ! error during string to integer conversion
|
2015-09-10 15:56:09 +05:30
|
|
|
call IO_warning(203_pInt,ext_msg=myName//'"'//string//'"')
|
2013-09-18 19:37:55 +05:30
|
|
|
else
|
2015-09-10 15:56:09 +05:30
|
|
|
call IO_warning(202_pInt,ext_msg=myName//'"'//string//'"') ! complain about offending characters
|
2014-02-06 23:18:01 +05:30
|
|
|
read(UNIT=string(1_pInt:invalidWhere-1_pInt),iostat=readStatus,FMT=*) IO_verifyIntValue ! interpret remaining string
|
2018-02-02 19:36:13 +05:30
|
|
|
if (readStatus /= 0_pInt) & ! error during string to integer conversion
|
2015-09-10 15:56:09 +05:30
|
|
|
call IO_warning(203_pInt,ext_msg=myName//'"'//string(1_pInt:invalidWhere-1_pInt)//'"')
|
2013-09-18 19:37:55 +05:30
|
|
|
endif
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
end function IO_verifyIntValue
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief returns verified float value in given string
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
real(pReal) function IO_verifyFloatValue (string,validChars,myName)
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
implicit none
|
2018-01-10 21:43:25 +05:30
|
|
|
character(len=*), intent(in) :: string, & !< string for conversion to int value. Must not contain spaces!
|
2013-09-18 19:37:55 +05:30
|
|
|
validChars, & !< valid characters in string
|
|
|
|
myName !< name of caller function (for debugging)
|
|
|
|
|
|
|
|
integer(pInt) :: readStatus, invalidWhere
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
IO_verifyFloatValue = 0.0_pReal
|
|
|
|
|
2014-02-06 23:18:01 +05:30
|
|
|
invalidWhere = verify(string,validChars)
|
2013-09-18 19:37:55 +05:30
|
|
|
if (invalidWhere == 0_pInt) then
|
2014-02-06 23:18:01 +05:30
|
|
|
read(UNIT=string,iostat=readStatus,FMT=*) IO_verifyFloatValue ! no offending chars found
|
2013-09-18 19:37:55 +05:30
|
|
|
if (readStatus /= 0_pInt) & ! error during string to float conversion
|
2015-09-10 15:56:09 +05:30
|
|
|
call IO_warning(203_pInt,ext_msg=myName//'"'//string//'"')
|
2013-09-18 19:37:55 +05:30
|
|
|
else
|
2015-09-10 15:56:09 +05:30
|
|
|
call IO_warning(202_pInt,ext_msg=myName//'"'//string//'"') ! complain about offending characters
|
2014-02-06 23:18:01 +05:30
|
|
|
read(UNIT=string(1_pInt:invalidWhere-1_pInt),iostat=readStatus,FMT=*) IO_verifyFloatValue ! interpret remaining string
|
2013-09-18 19:37:55 +05:30
|
|
|
if (readStatus /= 0_pInt) & ! error during string to float conversion
|
2015-09-10 15:56:09 +05:30
|
|
|
call IO_warning(203_pInt,ext_msg=myName//'"'//string(1_pInt:invalidWhere-1_pInt)//'"')
|
2013-09-18 19:37:55 +05:30
|
|
|
endif
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2013-09-18 19:37:55 +05:30
|
|
|
end function IO_verifyFloatValue
|
2018-01-10 21:43:25 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end module IO
|