parsing of spectral geom file now accepts two-dimensional microstructure definition (plus range indications by 'x to y')
For instance: 1 2 3 4 5 6 7 8 9 10 11 12 ...
This commit is contained in:
parent
11c71aae86
commit
f3bb2271c9
22
code/IO.f90
22
code/IO.f90
|
@ -969,14 +969,14 @@ endfunction
|
||||||
|
|
||||||
integer(pInt) unit,l,count
|
integer(pInt) unit,l,count
|
||||||
integer(pInt) IO_countContinousIntValues
|
integer(pInt) IO_countContinousIntValues
|
||||||
integer(pInt), parameter :: maxNchunks = 64
|
integer(pInt), parameter :: maxNchunks = 8192
|
||||||
integer(pInt), dimension(1+2*maxNchunks) :: pos
|
integer(pInt), dimension(1+2*maxNchunks) :: pos
|
||||||
character(len=300) line
|
character(len=65536) line
|
||||||
|
|
||||||
IO_countContinousIntValues = 0_pInt
|
IO_countContinousIntValues = 0_pInt
|
||||||
|
|
||||||
select case (FEsolver)
|
select case (FEsolver)
|
||||||
case ('Marc')
|
case ('Marc','Spectral')
|
||||||
|
|
||||||
do
|
do
|
||||||
read(unit,'(A300)',end=100) line
|
read(unit,'(A300)',end=100) line
|
||||||
|
@ -1025,22 +1025,22 @@ endfunction
|
||||||
|
|
||||||
integer(pInt) unit,maxN,i,j,l,count,first,last
|
integer(pInt) unit,maxN,i,j,l,count,first,last
|
||||||
integer(pInt), dimension(1+maxN) :: IO_continousIntValues
|
integer(pInt), dimension(1+maxN) :: IO_continousIntValues
|
||||||
integer(pInt), parameter :: maxNchunks = 64
|
integer(pInt), parameter :: maxNchunks = 8192_pInt
|
||||||
integer(pInt), dimension(1+2*maxNchunks) :: pos
|
integer(pInt), dimension(1+2*maxNchunks) :: pos
|
||||||
character(len=64), dimension(:) :: lookupName
|
character(len=64), dimension(:) :: lookupName
|
||||||
integer(pInt) :: lookupMaxN
|
integer(pInt) :: lookupMaxN
|
||||||
integer(pInt), dimension(:,:) :: lookupMap
|
integer(pInt), dimension(:,:) :: lookupMap
|
||||||
character(len=300) line
|
character(len=65536) line
|
||||||
logical rangeGeneration
|
logical rangeGeneration
|
||||||
|
|
||||||
IO_continousIntValues = 0
|
IO_continousIntValues = 0
|
||||||
rangeGeneration = .false.
|
rangeGeneration = .false.
|
||||||
|
|
||||||
select case (FEsolver)
|
select case (FEsolver)
|
||||||
case ('Marc')
|
case ('Marc','Spectral')
|
||||||
|
|
||||||
do
|
do
|
||||||
read(unit,'(A300)',end=100) line
|
read(unit,'(A65536)',end=100) line
|
||||||
pos = IO_stringPos(line,maxNchunks)
|
pos = IO_stringPos(line,maxNchunks)
|
||||||
if (verify(IO_stringValue(line,pos,1),"0123456789") > 0) then ! a non-int, i.e. set name
|
if (verify(IO_stringValue(line,pos,1),"0123456789") > 0) then ! a non-int, i.e. set name
|
||||||
do i = 1,lookupMaxN ! loop over known set names
|
do i = 1,lookupMaxN ! loop over known set names
|
||||||
|
@ -1050,7 +1050,7 @@ endfunction
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
exit
|
exit
|
||||||
else if (IO_lc(IO_stringValue(line,pos,2)) == 'to' ) then ! found range indicator
|
else if (pos(1) > 2_pInt .and. IO_lc(IO_stringValue(line,pos,2)) == 'to' ) then ! found range indicator
|
||||||
do i = IO_intValue(line,pos,1),IO_intValue(line,pos,3)
|
do i = IO_intValue(line,pos,1),IO_intValue(line,pos,3)
|
||||||
IO_continousIntValues(1) = IO_continousIntValues(1) + 1
|
IO_continousIntValues(1) = IO_continousIntValues(1) + 1
|
||||||
IO_continousIntValues(1+IO_continousIntValues(1)) = i
|
IO_continousIntValues(1+IO_continousIntValues(1)) = i
|
||||||
|
@ -1078,14 +1078,14 @@ endfunction
|
||||||
|
|
||||||
! check if the element values in the elset are auto generated
|
! check if the element values in the elset are auto generated
|
||||||
backspace(unit)
|
backspace(unit)
|
||||||
read(unit,'(A300)',end=100) line
|
read(unit,'(A65536)',end=100) line
|
||||||
pos = IO_stringPos(line,maxNchunks)
|
pos = IO_stringPos(line,maxNchunks)
|
||||||
do i = 1,pos(1)
|
do i = 1,pos(1)
|
||||||
if (IO_lc(IO_stringValue(line,pos,i)) == 'generate') rangeGeneration = .true.
|
if (IO_lc(IO_stringValue(line,pos,i)) == 'generate') rangeGeneration = .true.
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
do l = 1,count
|
do l = 1,count
|
||||||
read(unit,'(A300)',end=100) line
|
read(unit,'(A65536)',end=100) line
|
||||||
pos = IO_stringPos(line,maxNchunks)
|
pos = IO_stringPos(line,maxNchunks)
|
||||||
if (verify(IO_stringValue(line,pos,1),"0123456789") > 0) then ! a non-int, i.e. set names follow on this line
|
if (verify(IO_stringValue(line,pos,1),"0123456789") > 0) then ! a non-int, i.e. set names follow on this line
|
||||||
do i = 1,pos(1) ! loop over set names in line
|
do i = 1,pos(1) ! loop over set names in line
|
||||||
|
@ -1200,6 +1200,8 @@ endfunction
|
||||||
msg = 'texture index out of bounds'
|
msg = 'texture index out of bounds'
|
||||||
case (170)
|
case (170)
|
||||||
msg = 'sum of phase fractions differs from 1'
|
msg = 'sum of phase fractions differs from 1'
|
||||||
|
case (180)
|
||||||
|
msg = 'mismatch of microstructure count and a*b*c in geom file'
|
||||||
case (200)
|
case (200)
|
||||||
msg = 'unknown constitution specified'
|
msg = 'unknown constitution specified'
|
||||||
case (201)
|
case (201)
|
||||||
|
|
|
@ -2577,17 +2577,20 @@ subroutine mesh_marc_count_cpSizes (myUnit)
|
||||||
|
|
||||||
integer(pInt), parameter :: maxNchunks = 7
|
integer(pInt), parameter :: maxNchunks = 7
|
||||||
integer(pInt), dimension (1+2*maxNchunks) :: myPos
|
integer(pInt), dimension (1+2*maxNchunks) :: myPos
|
||||||
integer(pInt) a,b,c,e,i,j,homog,headerLength
|
integer(pInt) a,b,c,e,i,j,homog,headerLength,maxIntCount
|
||||||
|
integer(pInt), dimension(:), allocatable :: microstructures
|
||||||
|
integer(pInt), dimension(1,1) :: dummySet = 0_pInt
|
||||||
|
|
||||||
integer(pInt) myUnit
|
integer(pInt) myUnit
|
||||||
character(len=1024) line,keyword
|
character(len=65536) line,keyword
|
||||||
|
character(len=64), dimension(1) :: dummyName = ''
|
||||||
|
|
||||||
a = 1_pInt
|
a = 1_pInt
|
||||||
b = 1_pInt
|
b = 1_pInt
|
||||||
c = 1_pInt
|
c = 1_pInt
|
||||||
|
|
||||||
rewind(myUnit)
|
rewind(myUnit)
|
||||||
read(myUnit,'(a1024)') line
|
read(myUnit,'(a65536)') line
|
||||||
myPos = IO_stringPos(line,2)
|
myPos = IO_stringPos(line,2)
|
||||||
keyword = IO_lc(IO_StringValue(line,myPos,2))
|
keyword = IO_lc(IO_StringValue(line,myPos,2))
|
||||||
if (keyword(1:4) == 'head') then
|
if (keyword(1:4) == 'head') then
|
||||||
|
@ -2598,7 +2601,7 @@ subroutine mesh_marc_count_cpSizes (myUnit)
|
||||||
|
|
||||||
rewind(myUnit)
|
rewind(myUnit)
|
||||||
do i = 1, headerLength
|
do i = 1, headerLength
|
||||||
read(myUnit,'(a1024)') line
|
read(myUnit,'(a65536)') line
|
||||||
myPos = IO_stringPos(line,maxNchunks)
|
myPos = IO_stringPos(line,maxNchunks)
|
||||||
select case ( IO_lc(IO_StringValue(line,myPos,1)) )
|
select case ( IO_lc(IO_StringValue(line,myPos,1)) )
|
||||||
case ('resolution')
|
case ('resolution')
|
||||||
|
@ -2617,19 +2620,31 @@ subroutine mesh_marc_count_cpSizes (myUnit)
|
||||||
end select
|
end select
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
allocate (mesh_element (4+mesh_maxNnodes,mesh_NcpElems)) ; mesh_element = 0_pInt
|
maxIntCount = 0_pInt
|
||||||
|
i = 1_pInt
|
||||||
|
|
||||||
|
do while (i > 0_pInt)
|
||||||
|
i = IO_countContinousIntValues(myUnit)
|
||||||
|
maxIntCount = max(maxIntCount, i)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
rewind (myUnit)
|
||||||
|
do i=1,headerLength ! skip header
|
||||||
|
read(myUnit,'(a65536)') line
|
||||||
|
enddo
|
||||||
|
|
||||||
|
100 allocate (mesh_element (4+mesh_maxNnodes,mesh_NcpElems)) ; mesh_element = 0_pInt
|
||||||
|
allocate (microstructures (1_pInt+maxIntCount)) ; microstructures = 2_pInt
|
||||||
|
|
||||||
e = 0_pInt
|
e = 0_pInt
|
||||||
do while (e < mesh_NcpElems)
|
do while (e < mesh_NcpElems .and. microstructures(1) > 0_pInt) ! fill expected number of elements, stop at end of data (or blank line!)
|
||||||
read(myUnit,'(a1024)',END=110) line
|
microstructures = IO_continousIntValues(myUnit,maxIntCount,dummyName,dummySet,0) ! get affected elements
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
do i = 1,microstructures(1)
|
||||||
myPos(1:1+2*1) = IO_stringPos(line,1)
|
|
||||||
|
|
||||||
e = e+1 ! valid element entry
|
e = e+1 ! valid element entry
|
||||||
mesh_element ( 1,e) = e ! FE id
|
mesh_element ( 1,e) = e ! FE id
|
||||||
mesh_element ( 2,e) = FE_mapElemtype('C3D8R') ! elem type
|
mesh_element ( 2,e) = FE_mapElemtype('C3D8R') ! elem type
|
||||||
mesh_element ( 3,e) = homog ! homogenization
|
mesh_element ( 3,e) = homog ! homogenization
|
||||||
mesh_element ( 4,e) = IO_IntValue(line,myPos,1) ! microstructure
|
mesh_element ( 4,e) = microstructures(1_pInt+i) ! microstructure
|
||||||
mesh_element ( 5,e) = e + (e-1)/a + (e-1)/a/b*(a+1) ! base node
|
mesh_element ( 5,e) = e + (e-1)/a + (e-1)/a/b*(a+1) ! base node
|
||||||
mesh_element ( 6,e) = mesh_element ( 5,e) + 1
|
mesh_element ( 6,e) = mesh_element ( 5,e) + 1
|
||||||
mesh_element ( 7,e) = mesh_element ( 5,e) + (a+1) + 1
|
mesh_element ( 7,e) = mesh_element ( 5,e) + (a+1) + 1
|
||||||
|
@ -2641,8 +2656,12 @@ subroutine mesh_marc_count_cpSizes (myUnit)
|
||||||
mesh_maxValStateVar(1) = max(mesh_maxValStateVar(1),mesh_element(3,e)) !needed for statistics
|
mesh_maxValStateVar(1) = max(mesh_maxValStateVar(1),mesh_element(3,e)) !needed for statistics
|
||||||
mesh_maxValStateVar(2) = max(mesh_maxValStateVar(2),mesh_element(4,e))
|
mesh_maxValStateVar(2) = max(mesh_maxValStateVar(2),mesh_element(4,e))
|
||||||
enddo
|
enddo
|
||||||
|
enddo
|
||||||
|
|
||||||
110 endsubroutine
|
110 deallocate(microstructures)
|
||||||
|
if (e /= mesh_NcpElems) call IO_error(180,e)
|
||||||
|
|
||||||
|
endsubroutine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue