added total increment column
This commit is contained in:
parent
ac5b6233e6
commit
33ab391c14
|
@ -60,7 +60,7 @@ for file in files:
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
|
|
||||||
output = '1\theader\n' + \
|
output = '1\theader\n' + \
|
||||||
'\t'.join(['loadcase','increment','iterations']) + '\n'
|
'\t'.join(['increment','loadcase','step','iterations']) + '\n'
|
||||||
|
|
||||||
if options.memory:
|
if options.memory:
|
||||||
data = file['input'].readlines()
|
data = file['input'].readlines()
|
||||||
|
@ -72,28 +72,30 @@ for file in files:
|
||||||
# ------------------------------------------ read file ---------------------------------------
|
# ------------------------------------------ read file ---------------------------------------
|
||||||
|
|
||||||
pattern = re.compile('Loadcase\s+(\d+)\s+Increment\s+(\d+)/\d+\s+@\s+Iteration\s+(\d+)/\d+.*')
|
pattern = re.compile('Loadcase\s+(\d+)\s+Increment\s+(\d+)/\d+\s+@\s+Iteration\s+(\d+)/\d+.*')
|
||||||
lastLoadcase = 1
|
lastLoadcase = 0
|
||||||
lastIncrement = 1
|
lastStep = 0
|
||||||
lastIteration = 0
|
lastIteration = 0
|
||||||
|
theIncrement = 1
|
||||||
|
|
||||||
for line in {True : data,
|
for line in {True : data,
|
||||||
False : file['input']}[options.memory]:
|
False : file['input']}[options.memory]:
|
||||||
|
|
||||||
m = re.match(pattern, line)
|
m = re.match(pattern, line)
|
||||||
if m:
|
if m:
|
||||||
thisLoadcase = int(m.group(1))
|
thisLoadcase = int(m.group(1))
|
||||||
thisIncrement = int(m.group(2))
|
thisStep = int(m.group(2))
|
||||||
thisIteration = int(m.group(3))
|
thisIteration = int(m.group(3))
|
||||||
if thisIteration <= lastIteration: # indicator for new increment or loadcase
|
if thisIteration <= lastIteration: # indicator for new increment or loadcase
|
||||||
output += '\t'.join(map(str,[lastLoadcase,lastIncrement,lastIteration])) + '\n'
|
output += '\t'.join(map(str,[theIncrement,lastLoadcase,lastStep,lastIteration])) + '\n'
|
||||||
|
theIncrement += 1
|
||||||
if not options.memory:
|
if not options.memory:
|
||||||
file['output'].write(output)
|
file['output'].write(output)
|
||||||
output = ''
|
output = ''
|
||||||
lastLoadcase = thisLoadcase
|
lastLoadcase = thisLoadcase
|
||||||
lastIncrement = thisIncrement
|
lastStep = thisStep
|
||||||
lastIteration = thisIteration
|
lastIteration = thisIteration
|
||||||
|
|
||||||
output += '\t'.join(map(str,[lastLoadcase,lastIncrement,lastIteration])) + '\n' # process last iteration (for which, of course, no further iteration can be found)
|
output += '\t'.join(map(str,[theIncrement,lastLoadcase,lastStep,lastIteration])) + '\n' # process last iteration (for which, of course, no further iteration can be found)
|
||||||
|
|
||||||
file['input'].close()
|
file['input'].close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue