safer to use functions

don't mess with attributes of the object, they might be renamed
This commit is contained in:
Martin Diehl 2019-09-13 21:41:35 -07:00
parent 898f53295d
commit a6567e0cc6
2 changed files with 13 additions and 20 deletions

View File

@ -60,11 +60,10 @@ for filename in options.filenames:
header+=' 1_pos 2_pos 3_pos' header+=' 1_pos 2_pos 3_pos'
results.active['increments'] = [inc] results.active['increments'] = [inc]
for label in options.con: for label in options.con:
for o in results.c_output_types: for o in results.constituent_output_iter():
results.active['c_output_types'] = [o] for c in results.constituent_iter():
for c in results.constituents:
results.active['constituents'] = [c]
x = results.get_dataset_location(label) x = results.get_dataset_location(label)
if len(x) == 0: if len(x) == 0:
continue continue
@ -80,10 +79,8 @@ for filename in options.filenames:
header+=' '+label header+=' '+label
for label in options.mat: for label in options.mat:
for o in results.m_output_types: for o in results.materialpoint_output_iter():
results.active['m_output_types'] = [o] for m in results.materialpoint_iter():
for m in results.materialpoints:
results.active['materialpoints'] = [m]
x = results.get_dataset_location(label) x = results.get_dataset_location(label)
if len(x) == 0: if len(x) == 0:
continue continue

View File

@ -62,14 +62,13 @@ for filename in options.filenames:
vtk_data = [] vtk_data = []
results.active['increments'] = [inc] results.active['increments'] = [inc]
results.active['m_output_types'] = [] results.materialpoint_set([])
results.constituent_set(results.constituents)
for label in options.con: for label in options.con:
for o in results.c_output_types: for o in results.constituent_output_iter():
results.active['c_output_types'] = [o]
if o != 'generic': if o != 'generic':
for c in results.constituents: for c in results.constituent_iter():
results.active['constituents'] = [c]
x = results.get_dataset_location(label) x = results.get_dataset_location(label)
if len(x) == 0: if len(x) == 0:
continue continue
@ -79,7 +78,6 @@ for filename in options.filenames:
vtk_data[-1].SetName('1_'+x[0].split('/',1)[1]) vtk_data[-1].SetName('1_'+x[0].split('/',1)[1])
rGrid.GetCellData().AddArray(vtk_data[-1]) rGrid.GetCellData().AddArray(vtk_data[-1])
else: else:
results.active['constituents'] = results.constituents
x = results.get_dataset_location(label) x = results.get_dataset_location(label)
if len(x) == 0: if len(x) == 0:
continue continue
@ -89,13 +87,12 @@ for filename in options.filenames:
vtk_data[-1].SetName('1_'+x[0].split('/')[1]+'/generic/'+label) vtk_data[-1].SetName('1_'+x[0].split('/')[1]+'/generic/'+label)
rGrid.GetCellData().AddArray(vtk_data[-1]) rGrid.GetCellData().AddArray(vtk_data[-1])
results.active['c_output_types'] = [] results.constituent_set([])
results.materialpoint_set(results.materialpoints)
for label in options.mat: for label in options.mat:
for o in results.m_output_types: for o in results.materialpoint_output_iter():
results.active['m_output_types'] = [o]
if o != 'generic': if o != 'generic':
for m in results.materialpoints: for m in results.materialpoint_iter():
results.active['materialpoints'] = [m]
x = results.get_dataset_location(label) x = results.get_dataset_location(label)
if len(x) == 0: if len(x) == 0:
continue continue
@ -105,7 +102,6 @@ for filename in options.filenames:
vtk_data[-1].SetName('1_'+x[0].split('/',1)[1]) vtk_data[-1].SetName('1_'+x[0].split('/',1)[1])
rGrid.GetCellData().AddArray(vtk_data[-1]) rGrid.GetCellData().AddArray(vtk_data[-1])
else: else:
results.active['materialpoints'] = results.materialpoints
x = results.get_dataset_location(label) x = results.get_dataset_location(label)
if len(x) == 0: if len(x) == 0:
continue continue