Merge branch 'reverseRange' into development
This commit is contained in:
commit
ae05bdd9fd
12
code/IO.f90
12
code/IO.f90
|
@ -1267,8 +1267,8 @@ integer(pInt) function IO_countContinuousIntValues(fileUnit)
|
|||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
||||
exit
|
||||
elseif (IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'to' ) then ! found range indicator
|
||||
IO_countContinuousIntValues = 1_pInt + IO_intValue(line,chunkPos,3_pInt) &
|
||||
- IO_intValue(line,chunkPos,1_pInt)
|
||||
IO_countContinuousIntValues = 1_pInt + abs( IO_intValue(line,chunkPos,3_pInt) &
|
||||
- IO_intValue(line,chunkPos,1_pInt))
|
||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
||||
exit ! only one single range indicator allowed
|
||||
else if (IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'of' ) then ! found multiple entries indicator
|
||||
|
@ -1321,9 +1321,9 @@ function IO_continuousIntValues(fileUnit,maxN,lookupName,lookupMap,lookupMaxN)
|
|||
lookupMaxN
|
||||
integer(pInt), dimension(:,:), intent(in) :: lookupMap
|
||||
character(len=64), dimension(:), intent(in) :: lookupName
|
||||
integer(pInt) :: i
|
||||
integer(pInt) :: i,first,last
|
||||
#ifdef Abaqus
|
||||
integer(pInt) :: j,l,c,first,last
|
||||
integer(pInt) :: j,l,c
|
||||
#endif
|
||||
|
||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
||||
|
@ -1348,7 +1348,9 @@ function IO_continuousIntValues(fileUnit,maxN,lookupName,lookupMap,lookupMaxN)
|
|||
enddo
|
||||
exit
|
||||
else if (chunkPos(1) > 2_pInt .and. IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'to' ) then ! found range indicator
|
||||
do i = IO_intValue(line,chunkPos,1_pInt),IO_intValue(line,chunkPos,3_pInt)
|
||||
first = IO_intValue(line,chunkPos,1_pInt)
|
||||
last = IO_intValue(line,chunkPos,3_pInt)
|
||||
do i = first, last, sign(1_pInt,last-first)
|
||||
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
||||
IO_continuousIntValues(1+IO_continuousIntValues(1)) = i
|
||||
enddo
|
||||
|
|
|
@ -600,8 +600,11 @@ class ASCIItable():
|
|||
while i < N and self.data_read():
|
||||
items = self.data
|
||||
if len(items) > 2:
|
||||
if items[1].lower() == 'of': items = np.ones(datatype(items[0]))*datatype(items[2])
|
||||
elif items[1].lower() == 'to': items = np.arange(datatype(items[0]),1+datatype(items[2]))
|
||||
if items[1].lower() == 'of':
|
||||
items = np.ones(datatype(items[0]))*datatype(items[2])
|
||||
elif items[1].lower() == 'to':
|
||||
items = np.linspace(datatype(items[0]),datatype(items[2]),
|
||||
abs(datatype(items[2])-datatype(items[0]))+1,dtype=int)
|
||||
else: items = list(map(datatype,items))
|
||||
else: items = list(map(datatype,items))
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ for name in filenames:
|
|||
|
||||
# --- write packed microstructure information -----------------------------------------------------
|
||||
|
||||
type = ''
|
||||
compressType = ''
|
||||
former = start = -1
|
||||
reps = 0
|
||||
|
||||
|
@ -81,25 +81,25 @@ for name in filenames:
|
|||
else: items = map(int,items)
|
||||
|
||||
for current in items:
|
||||
if current == former+1 and start+reps == former+1:
|
||||
type = 'to'
|
||||
if abs(current - former) == 1 and abs(start-former) == reps - 1:
|
||||
compressType = 'to'
|
||||
reps += 1
|
||||
elif current == former and start == former:
|
||||
type = 'of'
|
||||
compressType = 'of'
|
||||
reps += 1
|
||||
else:
|
||||
if type == '':
|
||||
if compressType == '':
|
||||
table.data = []
|
||||
elif type == '.':
|
||||
elif compressType == '.':
|
||||
table.data = [former]
|
||||
elif type == 'to':
|
||||
table.data = [former-reps+1,'to',former]
|
||||
elif type == 'of':
|
||||
elif compressType == 'to':
|
||||
table.data = [start,'to',former]
|
||||
elif compressType == 'of':
|
||||
table.data = [reps,'of',former]
|
||||
|
||||
outputAlive = table.data_write(delimiter = ' ') # output processed line
|
||||
|
||||
type = '.'
|
||||
compressType = '.'
|
||||
start = current
|
||||
reps = 1
|
||||
|
||||
|
@ -107,9 +107,9 @@ for name in filenames:
|
|||
|
||||
table.data = {
|
||||
'.' : [former],
|
||||
'to': [former-reps+1,'to',former],
|
||||
'to': [start,'to',former],
|
||||
'of': [reps,'of',former],
|
||||
}[type]
|
||||
}[compressType]
|
||||
|
||||
outputAlive = table.data_write(delimiter = ' ') # output processed line
|
||||
|
||||
|
|
Loading…
Reference in New Issue