changed constitutive to open file using IO_open_file and use fileunit 200 instead of 1

changed constitutive to skip empty lines when parsing files
activated call quit in IO_error
This commit is contained in:
Franz Roters 2007-05-16 14:36:03 +00:00
parent e1ae35c5e4
commit 09c47f15e3
2 changed files with 27 additions and 19 deletions

View File

@ -545,7 +545,7 @@
write(6,*) write(6,*)
write(6,*) msg write(6,*) msg
call flush(6) call flush(6)
! call quit(9000+ID) call quit(9000+ID)
! ABAQUS returns in some cases ! ABAQUS returns in some cases
return return

View File

@ -356,7 +356,9 @@ do
read(file,'(a80)',END=100) line read(file,'(a80)',END=100) line
positions=IO_stringPos(line,1) positions=IO_stringPos(line,1)
tag=IO_lc(IO_stringValue(line,positions,1)) tag=IO_lc(IO_stringValue(line,positions,1))
if (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then if (tag(1:1)=='#' .OR. positions(1)==0) then ! skip comment and empty lines
cycle
elseif (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then
part=tag(2:len_trim(tag)-1) part=tag(2:len_trim(tag)-1)
exit exit
elseif (tag(1:1)=='[') then elseif (tag(1:1)=='[') then
@ -387,7 +389,9 @@ do
read(file,'(a80)',END=100) line read(file,'(a80)',END=100) line
positions=IO_stringPos(line,1) positions=IO_stringPos(line,1)
tag=IO_lc(IO_stringValue(line,positions,1)) tag=IO_lc(IO_stringValue(line,positions,1))
if (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then if (tag(1:1)=='#' .OR. positions(1)==0) then ! skip comment and empty lines
cycle
elseif (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then
constitutive_assignNGaussAndFiber=tag(2:len_trim(tag)-1) constitutive_assignNGaussAndFiber=tag(2:len_trim(tag)-1)
exit exit
elseif (tag(1:1)=='[') then elseif (tag(1:1)=='[') then
@ -428,7 +432,9 @@ do
read(file,'(a80)',END=100) line read(file,'(a80)',END=100) line
positions=IO_stringPos(line,maxNchunks) positions=IO_stringPos(line,maxNchunks)
tag=IO_lc(IO_stringValue(line,positions,1)) tag=IO_lc(IO_stringValue(line,positions,1))
if (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then if (tag(1:1)=='#' .OR. positions(1)==0) then ! skip comment and empty lines
cycle
elseif (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then
constitutive_Parse_UnknownPart=tag(2:len_trim(tag)-1) constitutive_Parse_UnknownPart=tag(2:len_trim(tag)-1)
exit exit
endif endif
@ -462,7 +468,7 @@ do while(.true.)
read(file,'(a80)',END=100) line read(file,'(a80)',END=100) line
positions=IO_stringPos(line,maxNchunks) ! parse leading chunks positions=IO_stringPos(line,maxNchunks) ! parse leading chunks
tag=IO_lc(IO_stringValue(line,positions,1)) tag=IO_lc(IO_stringValue(line,positions,1))
if (tag(1:1)=='#') then ! skip comment line if (tag(1:1)=='#' .OR. positions(1)==0) then ! skip comment and empty lines
cycle cycle
elseif (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then elseif (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then
constitutive_parse_materialPart=tag(2:len_trim(tag)-1) constitutive_parse_materialPart=tag(2:len_trim(tag)-1)
@ -534,7 +540,7 @@ do while(.true.)
read(file,'(a80)',END=100) line read(file,'(a80)',END=100) line
positions=IO_stringPos(line,maxNchunks) ! parse leading chunks positions=IO_stringPos(line,maxNchunks) ! parse leading chunks
tag=IO_lc(IO_stringValue(line,positions,1)) tag=IO_lc(IO_stringValue(line,positions,1))
if (tag(1:1)=='#') then ! skip comment line if (tag(1:1)=='#' .OR. positions(1)==0) then ! skip comment and empty lines
cycle cycle
elseif (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then elseif (tag(1:1)=='<'.AND.tag(len_trim(tag):len_trim(tag))=='>') then
constitutive_parse_texturePart=tag(2:len_trim(tag)-1) constitutive_parse_texturePart=tag(2:len_trim(tag)-1)
@ -604,24 +610,26 @@ subroutine constitutive_Parse_MatTexDat(filename)
!* - filename : name of input file * !* - filename : name of input file *
!********************************************************************* !*********************************************************************
use prec, only: pReal,pInt use prec, only: pReal,pInt
use IO, only: IO_error use IO, only: IO_error, IO_open_file
use math, only: math_Mandel3333to66, math_Voigt66to3333 use math, only: math_Mandel3333to66, math_Voigt66to3333
implicit none implicit none
!* Definition of variables !* Definition of variables
character(len=*) filename character(len=*) filename
character(len=80) part,formerPart character(len=80) part,formerPart
integer(pInt) sectionCount,i,j,k integer(pInt) sectionCount,i,j,k, fileunit
! set fileunit
fileunit=200
!----------------------------- !-----------------------------
!* First reading: number of materials and textures !* First reading: number of materials and textures
!----------------------------- !-----------------------------
!* determine material_maxN and texture_maxN from last respective parts !* determine material_maxN and texture_maxN from last respective parts
open(1,FILE=filename,ACTION='READ',STATUS='OLD',ERR=100) if(IO_open_file(fileunit,filename)==.false.) goto 100
part = '_dummy_' part = '_dummy_'
do while (part/='') do while (part/='')
formerPart = part formerPart = part
call constitutive_CountSections(1,sectionCount,part) call constitutive_CountSections(fileunit,sectionCount,part)
select case (formerPart) select case (formerPart)
case ('materials') case ('materials')
material_maxN = sectionCount material_maxN = sectionCount
@ -654,14 +662,14 @@ allocate(texture_NRandom(texture_maxN)) ; texture_NRandom=0_pInt
!----------------------------- !-----------------------------
!* Second reading: number of Gauss and Fiber !* Second reading: number of Gauss and Fiber
!----------------------------- !-----------------------------
rewind(1) rewind(fileunit)
part = '_dummy_' part = '_dummy_'
do while (part/='') do while (part/='')
select case (part) select case (part)
case ('textures') case ('textures')
part = constitutive_assignNGaussAndFiber(1) part = constitutive_assignNGaussAndFiber(fileunit)
case default case default
part = constitutive_Parse_UnknownPart(1) part = constitutive_Parse_UnknownPart(fileunit)
end select end select
enddo enddo
!* Array allocation !* Array allocation
@ -673,19 +681,19 @@ allocate(texture_Fiber(6,texture_maxNFiber,texture_maxN)) ; texture_Fiber=0.0_pR
!----------------------------- !-----------------------------
!* Third reading: materials and textures are stored !* Third reading: materials and textures are stored
!----------------------------- !-----------------------------
rewind(1) rewind(fileunit)
part='_dummy_' part='_dummy_'
do while (part/='') do while (part/='')
select case (part) select case (part)
case ('materials') case ('materials')
part=constitutive_Parse_MaterialPart(1) part=constitutive_Parse_MaterialPart(fileunit)
case ('textures') case ('textures')
part=constitutive_Parse_TexturePart(1) part=constitutive_Parse_TexturePart(fileunit)
case default case default
part=constitutive_Parse_UnknownPart(1) part=constitutive_Parse_UnknownPart(fileunit)
end select end select
enddo enddo
close(1) close(fileunit)
!* Construction of the elasticity matrices !* Construction of the elasticity matrices
@ -720,7 +728,7 @@ enddo
! MISSING some consistency checks may be..? ! MISSING some consistency checks may be..?
! if ODFfile present then set NGauss NFiber =0 ! if ODFfile present then set NGauss NFiber =0
return return
100 call IO_error(110) ! corrupt materials_textures file 100 call IO_error(200) ! corrupt materials_textures file
end subroutine end subroutine