nicer STDOUTput and can now properly deal with resolutions of 1
This commit is contained in:
parent
4658190951
commit
25e3c4baf8
|
@ -315,8 +315,9 @@ for filename in args:
|
||||||
m = re.search('(\d+)\shead',content[0],re.I)
|
m = re.search('(\d+)\shead',content[0],re.I)
|
||||||
if m == None:
|
if m == None:
|
||||||
continue
|
continue
|
||||||
print filename
|
print filename,
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
headrow = int(m.group(1))
|
headrow = int(m.group(1))
|
||||||
headings = content[headrow].split()
|
headings = content[headrow].split()
|
||||||
column = {}
|
column = {}
|
||||||
|
@ -342,7 +343,7 @@ for filename in args:
|
||||||
break
|
break
|
||||||
|
|
||||||
if column['tensor'][options.defgrad] < 0:
|
if column['tensor'][options.defgrad] < 0:
|
||||||
print 'missing deformation gradient..!'
|
print 'missing deformation gradient "%s"..!'%options.defgrad
|
||||||
continue
|
continue
|
||||||
|
|
||||||
column['vector'] = {}
|
column['vector'] = {}
|
||||||
|
@ -376,12 +377,15 @@ for filename in args:
|
||||||
res = numpy.array([len(grid[0]),\
|
res = numpy.array([len(grid[0]),\
|
||||||
len(grid[1]),\
|
len(grid[1]),\
|
||||||
len(grid[2]),],'i')
|
len(grid[2]),],'i')
|
||||||
dim = numpy.array([max(map(float,grid[0].keys()))-min(map(float,grid[0].keys())),\
|
|
||||||
max(map(float,grid[1].keys()))-min(map(float,grid[1].keys())),\
|
dim = numpy.ones(3)
|
||||||
max(map(float,grid[2].keys()))-min(map(float,grid[2].keys())),]*res/(res-numpy.ones(3)), 'd')
|
|
||||||
|
for i,r in enumerate(res):
|
||||||
|
if r > 1:
|
||||||
|
dim[i] = (max(map(float,grid[i].keys()))-min(map(float,grid[i].keys())))*r/(r-1.0)
|
||||||
|
|
||||||
|
print res,dim
|
||||||
|
|
||||||
print 'resolution',res
|
|
||||||
print 'dimension',dim
|
|
||||||
defgrad_av = postprocessingMath.tensor_avg(res[0],res[1],res[2],\
|
defgrad_av = postprocessingMath.tensor_avg(res[0],res[1],res[2],\
|
||||||
numpy.reshape(values[:,column['tensor'][options.defgrad]:
|
numpy.reshape(values[:,column['tensor'][options.defgrad]:
|
||||||
column['tensor'][options.defgrad]+9],
|
column['tensor'][options.defgrad]+9],
|
||||||
|
@ -410,6 +414,6 @@ for filename in args:
|
||||||
out['box'] = vtk_writeASCII_box(dim,defgrad_av)
|
out['box'] = vtk_writeASCII_box(dim,defgrad_av)
|
||||||
|
|
||||||
for what in out.keys():
|
for what in out.keys():
|
||||||
vtk = open(os.path.splitext(filename)[0]+'_%s.vtk'%what, 'w')
|
vtk = open('%s_'%what+os.path.splitext(filename)[0]+'.vtk', 'w')
|
||||||
output(out[what],{'filepointer':vtk},'File')
|
output(out[what],{'filepointer':vtk},'File')
|
||||||
vtk.close()
|
vtk.close()
|
||||||
|
|
Loading…
Reference in New Issue