read from memory, not from file
This commit is contained in:
parent
f33a99d125
commit
2b68c108f0
24
src/IO.f90
24
src/IO.f90
|
@ -44,7 +44,6 @@ module IO
|
||||||
IO_extractValue, &
|
IO_extractValue, &
|
||||||
IO_countDataLines
|
IO_countDataLines
|
||||||
#elif defined(Marc4DAMASK)
|
#elif defined(Marc4DAMASK)
|
||||||
IO_skipChunks, &
|
|
||||||
IO_fixedNoEFloatValue, &
|
IO_fixedNoEFloatValue, &
|
||||||
IO_fixedIntValue, &
|
IO_fixedIntValue, &
|
||||||
IO_countNumericalDataLines
|
IO_countNumericalDataLines
|
||||||
|
@ -403,7 +402,7 @@ pure function IO_stringPos(string)
|
||||||
left = right + verify(string(right+1:),SEP)
|
left = right + verify(string(right+1:),SEP)
|
||||||
right = left + scan(string(left:),SEP) - 2
|
right = left + scan(string(left:),SEP) - 2
|
||||||
if ( string(left:left) == '#' ) exit
|
if ( string(left:left) == '#' ) exit
|
||||||
IO_stringPos = [IO_stringPos,left, right]
|
IO_stringPos = [IO_stringPos,left,right]
|
||||||
IO_stringPos(1) = IO_stringPos(1)+1
|
IO_stringPos(1) = IO_stringPos(1)+1
|
||||||
endOfString: if (right < left) then
|
endOfString: if (right < left) then
|
||||||
IO_stringPos(IO_stringPos(1)*2+1) = len_trim(string)
|
IO_stringPos(IO_stringPos(1)*2+1) = len_trim(string)
|
||||||
|
@ -1023,27 +1022,6 @@ integer function IO_countNumericalDataLines(fileUnit)
|
||||||
backspace(fileUnit)
|
backspace(fileUnit)
|
||||||
|
|
||||||
end function IO_countNumericalDataLines
|
end function IO_countNumericalDataLines
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief reads file to skip (at least) N chunks (may be over multiple lines)
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine IO_skipChunks(fileUnit,N)
|
|
||||||
|
|
||||||
integer, intent(in) :: fileUnit, & !< file handle
|
|
||||||
N !< minimum number of chunks to skip
|
|
||||||
|
|
||||||
integer :: remainingChunks
|
|
||||||
character(len=65536) :: line
|
|
||||||
|
|
||||||
line = ''
|
|
||||||
remainingChunks = N
|
|
||||||
|
|
||||||
do while (trim(line) /= IO_EOF .and. remainingChunks > 0)
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
remainingChunks = remainingChunks - (size(IO_stringPos(line))-1)/2
|
|
||||||
enddo
|
|
||||||
end subroutine IO_skipChunks
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,7 @@ subroutine mesh_init(ip,el)
|
||||||
call geometry_plastic_nonlocal_setIParea(norm2(x,1))
|
call geometry_plastic_nonlocal_setIParea(norm2(x,1))
|
||||||
call geometry_plastic_nonlocal_results
|
call geometry_plastic_nonlocal_results
|
||||||
|
|
||||||
|
|
||||||
end subroutine mesh_init
|
end subroutine mesh_init
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
@ -224,7 +225,7 @@ subroutine inputRead(elem,node0_elem,connectivity_elem,microstructureAt,homogeni
|
||||||
call inputRead_mapNodes(inputFile)
|
call inputRead_mapNodes(inputFile)
|
||||||
|
|
||||||
call inputRead_elemType(elem, &
|
call inputRead_elemType(elem, &
|
||||||
nElems,FILEUNIT)
|
nElems,inputFile)
|
||||||
call inputRead_elemNodes(node0_elem, &
|
call inputRead_elemNodes(node0_elem, &
|
||||||
Nnodes,inputFile)
|
Nnodes,inputFile)
|
||||||
|
|
||||||
|
@ -442,17 +443,16 @@ subroutine inputRead_mapElems(tableStyle,nameElemSet,mapElemSet,fileFormatVersio
|
||||||
do
|
do
|
||||||
read (fileUnit,'(A300)',END=620) line
|
read (fileUnit,'(A300)',END=620) line
|
||||||
chunkPos = IO_stringPos(line)
|
chunkPos = IO_stringPos(line)
|
||||||
if (fileFormatVersion < 13) then ! Marc 2016 or earlier
|
Marc2016andEarlier: if (fileFormatVersion < 13) then
|
||||||
if( IO_lc(IO_stringValue(line,chunkPos,1)) == 'hypoelastic' ) then
|
if( IO_lc(IO_stringValue(line,chunkPos,1)) == 'hypoelastic' ) then
|
||||||
do i=1,3+TableStyle ! skip three (or four if new table style!) lines
|
skipLines: do i=1,3+TableStyle
|
||||||
read (fileUnit,'(A300)') line
|
read (fileUnit,'(A300)') line
|
||||||
enddo
|
enddo skipLines
|
||||||
contInts = IO_continuousIntValues(fileUnit,size(mesh_mapFEtoCPelem,2),nameElemSet,&
|
contInts = IO_continuousIntValues(fileUnit,size(mesh_mapFEtoCPelem,2),nameElemSet,&
|
||||||
mapElemSet,size(nameElemSet))
|
mapElemSet,size(nameElemSet))
|
||||||
|
|
||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
else ! Marc2017 and later
|
else Marc2016andEarlier
|
||||||
if ( IO_lc(IO_stringValue(line,chunkPos,1)) == 'connectivity') then
|
if ( IO_lc(IO_stringValue(line,chunkPos,1)) == 'connectivity') then
|
||||||
read (fileUnit,'(A300)',END=620) line
|
read (fileUnit,'(A300)',END=620) line
|
||||||
chunkPos = IO_stringPos(line)
|
chunkPos = IO_stringPos(line)
|
||||||
|
@ -470,7 +470,7 @@ subroutine inputRead_mapElems(tableStyle,nameElemSet,mapElemSet,fileFormatVersio
|
||||||
enddo
|
enddo
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif Marc2016andEarlier
|
||||||
enddo
|
enddo
|
||||||
620 do i = 1,contInts(1)
|
620 do i = 1,contInts(1)
|
||||||
cpElem = cpElem+1
|
cpElem = cpElem+1
|
||||||
|
@ -545,35 +545,34 @@ end subroutine inputRead_elemNodes
|
||||||
!> @brief Gets element type (and checks if the whole mesh comprises of only one type)
|
!> @brief Gets element type (and checks if the whole mesh comprises of only one type)
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine inputRead_elemType(elem, &
|
subroutine inputRead_elemType(elem, &
|
||||||
nElem,fileUnit)
|
nElem,fileContent)
|
||||||
|
|
||||||
type(tElement), intent(out) :: elem
|
type(tElement), intent(out) :: elem
|
||||||
integer, intent(in) :: &
|
integer, intent(in) :: nElem
|
||||||
nElem, &
|
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines
|
||||||
fileUnit
|
|
||||||
|
|
||||||
integer, allocatable, dimension(:) :: chunkPos
|
integer, allocatable, dimension(:) :: chunkPos
|
||||||
character(len=300) :: line
|
integer :: i,j,t,l,remainingChunks
|
||||||
integer :: i,t
|
|
||||||
|
|
||||||
t = -1
|
t = -1
|
||||||
|
j = 0
|
||||||
rewind(fileUnit)
|
do l = 1, size(fileContent)
|
||||||
do
|
chunkPos = IO_stringPos(fileContent(l))
|
||||||
read (fileUnit,'(A300)',END=620) line
|
if( IO_lc(IO_stringValue(fileContent(l),chunkPos,1)) == 'connectivity' ) then
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
if( IO_lc(IO_stringValue(line,chunkPos,1)) == 'connectivity' ) then
|
|
||||||
read (fileUnit,'(A300)') line ! Garbage line
|
|
||||||
do i=1,nElem ! read all elements
|
do i=1,nElem ! read all elements
|
||||||
read (fileUnit,'(A300)') line
|
chunkPos = IO_stringPos(fileContent(l+1+i+j))
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
if (t == -1) then
|
if (t == -1) then
|
||||||
t = mapElemtype(IO_stringValue(line,chunkPos,2))
|
t = mapElemtype(IO_stringValue(fileContent(l+1+i+j),chunkPos,2))
|
||||||
call elem%init(t)
|
call elem%init(t)
|
||||||
else
|
else
|
||||||
if (t /= mapElemtype(IO_stringValue(line,chunkPos,2))) call IO_error(191,el=t,ip=i)
|
if (t /= mapElemtype(IO_stringValue(fileContent(l+1+i+j),chunkPos,2))) call IO_error(191,el=t,ip=i)
|
||||||
endif
|
endif
|
||||||
call IO_skipChunks(fileUnit,elem%nNodes-(chunkPos(1)-2))
|
remainingChunks = elem%nNodes - (chunkPos(1) - 2)
|
||||||
|
do while(remainingChunks > 0)
|
||||||
|
j = j + 1
|
||||||
|
chunkPos = IO_stringPos(fileContent(l+1+i+j))
|
||||||
|
remainingChunks = remainingChunks - chunkPos(1)
|
||||||
|
enddo
|
||||||
enddo
|
enddo
|
||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
|
@ -622,10 +621,10 @@ subroutine inputRead_elemType(elem, &
|
||||||
call IO_error(error_ID=190,ext_msg=IO_lc(what))
|
call IO_error(error_ID=190,ext_msg=IO_lc(what))
|
||||||
end select
|
end select
|
||||||
|
|
||||||
end function mapElemtype
|
end function mapElemtype
|
||||||
|
|
||||||
|
|
||||||
620 end subroutine inputRead_elemType
|
end subroutine inputRead_elemType
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue