also ouptut materialpoint results if requested

This commit is contained in:
Martin Diehl 2019-07-15 17:07:04 -07:00
parent c51cf8d506
commit d446248d75
1 changed files with 27 additions and 0 deletions

View File

@ -60,6 +60,7 @@ for filename in options.filenames:
vtk_data = []
results.active['increments'] = [inc]
results.active['m_output_types'] = []
for label in options.con:
for o in results.c_output_types:
@ -85,6 +86,32 @@ for filename in options.filenames:
vtk_data.append(numpy_support.numpy_to_vtk(num_array=array.reshape(shape),deep=True,array_type= vtk.VTK_DOUBLE))
vtk_data[-1].SetName('1_'+x[0].split('/')[1]+'/generic/'+label)
rGrid.GetCellData().AddArray(vtk_data[-1])
results.active['c_output_types'] = []
for label in options.mat:
for o in results.m_output_types:
results.active['m_output_types'] = [o]
if o != 'generic':
for m in results.materialpoints:
results.active['materialpoints'] = [m]
x = results.get_dataset_location(label)
if len(x) == 0:
continue
array = results.read_dataset(x,0)
shape = [array.shape[0],np.product(array.shape[1:])]
vtk_data.append(numpy_support.numpy_to_vtk(num_array=array.reshape(shape),deep=True,array_type= vtk.VTK_DOUBLE))
vtk_data[-1].SetName('1_'+x[0].split('/',1)[1])
rGrid.GetCellData().AddArray(vtk_data[-1])
else:
results.active['materialpoints'] = results.materialpoints
x = results.get_dataset_location(label)
if len(x) == 0:
continue
array = results.read_dataset(x,0)
shape = [array.shape[0],np.product(array.shape[1:])]
vtk_data.append(numpy_support.numpy_to_vtk(num_array=array.reshape(shape),deep=True,array_type= vtk.VTK_DOUBLE))
vtk_data[-1].SetName('1_'+x[0].split('/')[1]+'/generic/'+label)
rGrid.GetCellData().AddArray(vtk_data[-1])
if results.structured:
writer = vtk.vtkXMLRectilinearGridWriter()