Compare commits

..

No commits in common. "aec0cdead6e55f6eb4cecf71244e1d247bb41c00" and "b7b250ca5f37d7a695888cee9e77add4f9d69c38" have entirely different histories.

2 changed files with 4 additions and 30 deletions

View File

@ -536,17 +536,12 @@ class Trajectories:
self.unraveled = False
return
def to_vtk(self,slice_part=slice(None),slice_time=slice(None),force_ravel=False):
def to_vtk(self):
import pyvista as pv
mesh = pv.PolyData()
if force_ravel or not self.unraveled:
for part in self.get_trajectories_segmented(slice_part=slice_part,slice_time=slice_time):
for seg in part:
mesh += pv.helpers.lines_from_points(seg.transpose())
else:
tmp = self.get_trajectories(slice_part=slice_part,slice_time=slice_time)
for ipart in range(self.numpart):
mesh += pv.helpers.lines_from_points(np.array([tmp[0][ipart],tmp[1][ipart],tmp[2][ipart]]).transpose())
for part in self.get_trajectories_segmented():
for seg in part:
mesh += pv.helpers.lines_from_points(seg.transpose())
return mesh
def _make_data_array(self):

21
visu.py
View File

@ -4,27 +4,6 @@ def add_domain_bounds(plotter,bounds,color='black',line_width=2.):
plotter.add_mesh(domain,color=color,style='wireframe',line_width=line_width,opacity=0.999,lighting=False)
return
def add_domain_bounds_open(plotter,bounds,opacity_front=None,xlen=1.0,ylen=1.0,zlen=1.0,
color='black',line_width=2.):
import pyvista
x0,x1,y0,y1,z0,z1 = bounds
domain = pyvista.Line((x0,y0,z0),(x1,y0,z0)) + \
pyvista.Line((x0,y0,z0),(x0,y1,z0)) + \
pyvista.Line((x0,y0,z0),(x0,y0,z1)) + \
pyvista.Line((x1,y0,z0),(x1,y1,z0)) + \
pyvista.Line((x1,y0,z0),(x1,y0,z1)) + \
pyvista.Line((x0,y0,z1),(x1,y0,z1)) + \
pyvista.Line((x1,y0,z1),(x1,y1,z1)) + \
pyvista.Line((x0,y1,z0),(x1,y1,z0)) + \
pyvista.Line((x1,y1,z0),(x1,y1,z1))
plotter.add_mesh(domain,color=color,line_width=line_width,opacity=0.999,lighting=False)
if not opacity_front is None:
domain_front = pyvista.Line((x0+(1.-xlen)*(x1-x0),y1,z1),(x1,y1,z1)) + \
pyvista.Line((x0,y0,z1),(x0,ylen*y1,z1)) + \
pyvista.Line((x0,y1,z0),(x0,y1,zlen*z1))
plotter.add_mesh(domain_front,color=color,line_width=line_width,opacity=opacity_front,lighting=False)
return
def enable_shadows_hacked(pl):
# Reimplements pyvistas "enable_shadows()" method to also render translucent
# objects (without shadows). Can be used to add objects which do not throw