added function IO_countContinousIntValues
to read number of items in set definitions: 123 to 423 or something like 1 3 5 6 7 9 10 c 12 14
This commit is contained in:
parent
80e76fcd3f
commit
08a9985179
34
trunk/IO.f90
34
trunk/IO.f90
|
@ -468,7 +468,39 @@
|
||||||
|
|
||||||
|
|
||||||
!********************************************************************
|
!********************************************************************
|
||||||
! read consecutive lines of ints concatenatred by "c" as last char
|
! count items in consecutive lines of ints concatenated by "c"
|
||||||
|
! as last char or range of values a "to" b
|
||||||
|
!********************************************************************
|
||||||
|
FUNCTION IO_countContinousIntValues (unit)
|
||||||
|
|
||||||
|
use prec, only: pReal,pInt
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
integer(pInt) IO_continousIntValues,unit,i
|
||||||
|
integer(pInt), dimension(67) :: pos ! allow for 32 values excl "c"
|
||||||
|
character(len=300) line
|
||||||
|
|
||||||
|
IO_countContinousIntValues(1) = 0
|
||||||
|
do
|
||||||
|
read(unit,'(A300)',end=100) line
|
||||||
|
pos = IO_stringPos(line,33)
|
||||||
|
if (IO_lc(IO_stringValue(line,pos,2)) == 'to' ) then ! found range indicator
|
||||||
|
IO_countContinousIntValues = IO_countContinousIntValues+1+IO_intValue(line,pos,3)-IO_intValue(line,pos,1)
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
IO_countContinousIntValues = IO_countContinousIntValues+pos(1)-1
|
||||||
|
if ( IO_lc(IO_stringValue(line,pos,pos(1))) /= 'c' ) then ! line finished, read last value
|
||||||
|
IO_countContinousIntValues = IO_countContinousIntValues+1
|
||||||
|
exit
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
100 return
|
||||||
|
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
!********************************************************************
|
||||||
|
! read consecutive lines of ints concatenated by "c" as last char
|
||||||
! or range of values a "to" b
|
! or range of values a "to" b
|
||||||
!********************************************************************
|
!********************************************************************
|
||||||
FUNCTION IO_continousIntValues (unit,maxN)
|
FUNCTION IO_continousIntValues (unit,maxN)
|
||||||
|
|
Loading…
Reference in New Issue