no need for special functions
This commit is contained in:
parent
fb8494e2b8
commit
eb7bd41acd
61
src/IO.f90
61
src/IO.f90
|
@ -37,14 +37,12 @@ module IO
|
|||
#if defined(Marc4DAMASK) || defined(Abaqus)
|
||||
public :: &
|
||||
IO_open_inputFile, &
|
||||
IO_continuousIntValues, &
|
||||
IO_continuousIntValues
|
||||
#endif
|
||||
#if defined(Abaqus)
|
||||
public :: &
|
||||
IO_extractValue, &
|
||||
IO_countDataLines
|
||||
#elif defined(Marc4DAMASK)
|
||||
IO_fixedNoEFloatValue, &
|
||||
IO_fixedIntValue
|
||||
#endif
|
||||
#endif
|
||||
|
||||
contains
|
||||
|
@ -56,7 +54,7 @@ contains
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine IO_init
|
||||
|
||||
write(6,'(/,a)') ' <<<+- IO init -+>>>'
|
||||
write(6,'(/,a)') ' <<<+- IO init -+>>>'; flush(6)
|
||||
|
||||
end subroutine IO_init
|
||||
|
||||
|
@ -443,57 +441,6 @@ integer function IO_intValue(string,chunkPos,myChunk)
|
|||
end function IO_intValue
|
||||
|
||||
|
||||
#ifdef Marc4DAMASK
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief reads float x.y+z value at myChunk from format string
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
real(pReal) function IO_fixedNoEFloatValue (string,ends,myChunk)
|
||||
|
||||
character(len=*), intent(in) :: string !< raw input with known ends of each chunk
|
||||
integer, intent(in) :: myChunk !< position number of desired chunk
|
||||
integer, dimension(:), intent(in) :: ends !< positions of end of each tag/chunk in given string
|
||||
character(len=*), parameter :: MYNAME = 'IO_fixedNoEFloatValue '
|
||||
character(len=*), parameter :: VALIDBASE = '0123456789.+-'
|
||||
character(len=*), parameter :: VALIDEXP = '0123456789+-'
|
||||
|
||||
real(pReal) :: base
|
||||
integer :: expon
|
||||
integer :: pos_exp
|
||||
|
||||
pos_exp = scan(string(ends(myChunk)+1:ends(myChunk+1)),'+-',back=.true.)
|
||||
hasExponent: if (pos_exp > 1) then
|
||||
base = verifyFloatValue(trim(adjustl(string(ends(myChunk)+1:ends(myChunk)+pos_exp-1))),&
|
||||
VALIDBASE,MYNAME//'(base): ')
|
||||
expon = verifyIntValue(trim(adjustl(string(ends(myChunk)+pos_exp:ends(myChunk+1)))),&
|
||||
VALIDEXP,MYNAME//'(exp): ')
|
||||
else hasExponent
|
||||
base = verifyFloatValue(trim(adjustl(string(ends(myChunk)+1:ends(myChunk+1)))),&
|
||||
VALIDBASE,MYNAME//'(base): ')
|
||||
expon = 0
|
||||
endif hasExponent
|
||||
IO_fixedNoEFloatValue = base*10.0_pReal**real(expon,pReal)
|
||||
|
||||
end function IO_fixedNoEFloatValue
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief reads integer value at myChunk from fixed format string
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
integer function IO_fixedIntValue(string,ends,myChunk)
|
||||
|
||||
character(len=*), intent(in) :: string !< raw input with known ends of each chunk
|
||||
integer, intent(in) :: myChunk !< position number of desired chunk
|
||||
integer, dimension(:), intent(in) :: ends !< positions of end of each tag/chunk in given string
|
||||
character(len=*), parameter :: MYNAME = 'IO_fixedIntValue: '
|
||||
character(len=*), parameter :: VALIDCHARACTERS = '0123456789+-'
|
||||
|
||||
IO_fixedIntValue = verifyIntValue(trim(adjustl(string(ends(myChunk)+1:ends(myChunk+1)))),&
|
||||
VALIDCHARACTERS,MYNAME)
|
||||
|
||||
end function IO_fixedIntValue
|
||||
#endif
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief changes characters in string to lower case
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -478,7 +478,8 @@ subroutine inputRead_mapNodes(fileContent)
|
|||
chunkPos = IO_stringPos(fileContent(l))
|
||||
if( IO_lc(IO_stringValue(fileContent(l),chunkPos,1)) == 'coordinates' ) then
|
||||
do i = 1,size(mesh_mapFEtoCPnode,2)
|
||||
mesh_mapFEtoCPnode(1:2,i) = [IO_fixedIntValue (fileContent(l+1+i),[0,10],1),i] ! ToDo: use IO_intValue
|
||||
chunkPos = IO_stringPos(fileContent(l+1+i))
|
||||
mesh_mapFEtoCPnode(:,i) = [IO_intValue(fileContent(l+1+i),chunkPos,1),i]
|
||||
enddo
|
||||
exit
|
||||
endif
|
||||
|
@ -499,7 +500,6 @@ subroutine inputRead_elemNodes(nodes, &
|
|||
integer, intent(in) :: nNode
|
||||
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines
|
||||
|
||||
integer, dimension(5), parameter :: node_ends = [0,10,30,50,70]
|
||||
integer, allocatable, dimension(:) :: chunkPos
|
||||
integer :: i,j,m,l
|
||||
|
||||
|
@ -509,9 +509,10 @@ subroutine inputRead_elemNodes(nodes, &
|
|||
chunkPos = IO_stringPos(fileContent(l))
|
||||
if( IO_lc(IO_stringValue(fileContent(l),chunkPos,1)) == 'coordinates' ) then
|
||||
do i=1,nNode
|
||||
m = mesh_FEasCP('node',IO_fixedIntValue(fileContent(l+1+i),node_ends,1)) !ToDo: use IO_intValue
|
||||
chunkPos = IO_stringPos(fileContent(l+1+i))
|
||||
m = mesh_FEasCP('node',IO_intValue(fileContent(l+1+i),chunkPos,1))
|
||||
do j = 1,3
|
||||
nodes(j,m) = mesh_unitlength * IO_fixedNoEFloatValue(fileContent(l+1+i),node_ends,j+1) !ToDo: use IO_floatValue
|
||||
nodes(j,m) = mesh_unitlength * IO_floatValue(fileContent(l+1+i),chunkPos,j+1)
|
||||
enddo
|
||||
enddo
|
||||
exit
|
||||
|
@ -699,7 +700,7 @@ subroutine inputRead_microstructureAndHomogenization(microstructureAt,homogeniza
|
|||
read (fileUnit,'(A300)',END=630) line ! read line with value of state var
|
||||
chunkPos = IO_stringPos(line)
|
||||
do while (scan(IO_stringValue(line,chunkPos,1),'+-',back=.true.)>1) ! is noEfloat value?
|
||||
myVal = nint(IO_fixedNoEFloatValue(line,[0,20],1),pInt) ! state var's value
|
||||
myVal = nint(IO_floatValue(line,chunkPos,1))
|
||||
if (initialcondTableStyle == 2) then
|
||||
read (fileUnit,'(A300)',END=630) line ! read extra line
|
||||
read (fileUnit,'(A300)',END=630) line ! read extra line
|
||||
|
|
Loading…
Reference in New Issue