only store points, no vertices

visualize via 'Points Gaussian', not 'Points' in paraview.
+ adding displacements for points
This commit is contained in:
Martin Diehl 2020-03-12 12:28:28 +01:00
parent 4c915eddbc
commit 827f354435
2 changed files with 19 additions and 27 deletions

View File

@ -107,15 +107,8 @@ class VTK:
vtk_points= vtk.vtkPoints() vtk_points= vtk.vtkPoints()
vtk_points.SetData(np_to_vtk(points)) vtk_points.SetData(np_to_vtk(points))
vertices = vtk.vtkCellArray()
vertices.SetNumberOfCells(points.shape[0])
T = np.concatenate((np.ones((points.shape[0],1),dtype=np.int64),
np.arange(points.shape[0],dtype=np.int64).reshape(-1,1)),axis=1).ravel()
vertices.SetCells(points.shape[0],np_to_vtk(T, deep=True, array_type=vtk.VTK_ID_TYPE))
geom = vtk.vtkPolyData() geom = vtk.vtkPolyData()
geom.SetPoints(vtk_points) geom.SetPoints(vtk_points)
geom.SetVerts(vertices)
return VTK(geom) return VTK(geom)

View File

@ -446,7 +446,7 @@ class Result:
def cell_coordinates(self): def cell_coordinates(self):
"""Return initial coordinates of the cell centers.""" """Return initial coordinates of the cell centers."""
if self.structured: if self.structured:
return grid_filters.cell_coord0(self.grid,self.size,self.origin) return grid_filters.cell_coord0(self.grid,self.size,self.origin).reshape(-1,3)
else: else:
with h5py.File(self.fname,'r') as f: with h5py.File(self.fname,'r') as f:
return f['geometry/x_c'][()] return f['geometry/x_c'][()]
@ -1082,8 +1082,7 @@ class Result:
v.add(array,'1_'+x[0].split('/',1)[1]) v.add(array,'1_'+x[0].split('/',1)[1])
self.pick('constituents',constituents_backup) self.pick('constituents',constituents_backup)
if mode.lower()=='cell': u = self.read_dataset(self.get_dataset_location('u_n' if mode.lower() == 'cell' else 'u_p'))
u = self.read_dataset(self.get_dataset_location('u_n'))
v.add(u,'u') v.add(u,'u')
file_out = '{}_inc{}'.format(os.path.splitext(os.path.basename(self.fname))[0], file_out = '{}_inc{}'.format(os.path.splitext(os.path.basename(self.fname))[0],