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_countDataLines
|
||||
#elif defined(Marc4DAMASK)
|
||||
IO_skipChunks, &
|
||||
IO_fixedNoEFloatValue, &
|
||||
IO_fixedIntValue, &
|
||||
IO_countNumericalDataLines
|
||||
|
@ -403,7 +402,7 @@ pure function IO_stringPos(string)
|
|||
left = right + verify(string(right+1:),SEP)
|
||||
right = left + scan(string(left:),SEP) - 2
|
||||
if ( string(left:left) == '#' ) exit
|
||||
IO_stringPos = [IO_stringPos,left, right]
|
||||
IO_stringPos = [IO_stringPos,left,right]
|
||||
IO_stringPos(1) = IO_stringPos(1)+1
|
||||
endOfString: if (right < left) then
|
||||
IO_stringPos(IO_stringPos(1)*2+1) = len_trim(string)
|
||||
|
@ -1023,27 +1022,6 @@ integer function IO_countNumericalDataLines(fileUnit)
|
|||
backspace(fileUnit)
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ subroutine mesh_init(ip,el)
|
|||
call geometry_plastic_nonlocal_setIParea(norm2(x,1))
|
||||
call geometry_plastic_nonlocal_results
|
||||
|
||||
|
||||
end subroutine mesh_init
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
@ -224,7 +225,7 @@ subroutine inputRead(elem,node0_elem,connectivity_elem,microstructureAt,homogeni
|
|||
call inputRead_mapNodes(inputFile)
|
||||
|
||||
call inputRead_elemType(elem, &
|
||||
nElems,FILEUNIT)
|
||||
nElems,inputFile)
|
||||
call inputRead_elemNodes(node0_elem, &
|
||||
Nnodes,inputFile)
|
||||
|
||||
|
@ -442,17 +443,16 @@ subroutine inputRead_mapElems(tableStyle,nameElemSet,mapElemSet,fileFormatVersio
|
|||
do
|
||||
read (fileUnit,'(A300)',END=620) 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
|
||||
do i=1,3+TableStyle ! skip three (or four if new table style!) lines
|
||||
skipLines: do i=1,3+TableStyle
|
||||
read (fileUnit,'(A300)') line
|
||||
enddo
|
||||
enddo skipLines
|
||||
contInts = IO_continuousIntValues(fileUnit,size(mesh_mapFEtoCPelem,2),nameElemSet,&
|
||||
mapElemSet,size(nameElemSet))
|
||||
|
||||
exit
|
||||
endif
|
||||
else ! Marc2017 and later
|
||||
else Marc2016andEarlier
|
||||
if ( IO_lc(IO_stringValue(line,chunkPos,1)) == 'connectivity') then
|
||||
read (fileUnit,'(A300)',END=620) line
|
||||
chunkPos = IO_stringPos(line)
|
||||
|
@ -470,7 +470,7 @@ subroutine inputRead_mapElems(tableStyle,nameElemSet,mapElemSet,fileFormatVersio
|
|||
enddo
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif Marc2016andEarlier
|
||||
enddo
|
||||
620 do i = 1,contInts(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)
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine inputRead_elemType(elem, &
|
||||
nElem,fileUnit)
|
||||
nElem,fileContent)
|
||||
|
||||
type(tElement), intent(out) :: elem
|
||||
integer, intent(in) :: &
|
||||
nElem, &
|
||||
fileUnit
|
||||
integer, intent(in) :: nElem
|
||||
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines
|
||||
|
||||
integer, allocatable, dimension(:) :: chunkPos
|
||||
character(len=300) :: line
|
||||
integer :: i,t
|
||||
integer :: i,j,t,l,remainingChunks
|
||||
|
||||
t = -1
|
||||
|
||||
rewind(fileUnit)
|
||||
do
|
||||
read (fileUnit,'(A300)',END=620) line
|
||||
chunkPos = IO_stringPos(line)
|
||||
if( IO_lc(IO_stringValue(line,chunkPos,1)) == 'connectivity' ) then
|
||||
read (fileUnit,'(A300)') line ! Garbage line
|
||||
j = 0
|
||||
do l = 1, size(fileContent)
|
||||
chunkPos = IO_stringPos(fileContent(l))
|
||||
if( IO_lc(IO_stringValue(fileContent(l),chunkPos,1)) == 'connectivity' ) then
|
||||
do i=1,nElem ! read all elements
|
||||
read (fileUnit,'(A300)') line
|
||||
chunkPos = IO_stringPos(line)
|
||||
chunkPos = IO_stringPos(fileContent(l+1+i+j))
|
||||
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)
|
||||
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
|
||||
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
|
||||
exit
|
||||
endif
|
||||
|
@ -622,10 +621,10 @@ subroutine inputRead_elemType(elem, &
|
|||
call IO_error(error_ID=190,ext_msg=IO_lc(what))
|
||||
end select
|
||||
|
||||
end function mapElemtype
|
||||
end function mapElemtype
|
||||
|
||||
|
||||
620 end subroutine inputRead_elemType
|
||||
end subroutine inputRead_elemType
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue