office.py 876 B

12345678910111213141516171819
  1. """Stream tubes originating from a probing grid of points.
  2. Data is from CFD analysis of airflow in an office with
  3. ventilation and a burning cigarette."""
  4. from vedo import dataurl, download, loadStructuredGrid, UnstructuredGrid, Grid, show
  5. from off_furniture import furniture
  6. fpath = download(dataurl + 'office.binary.vtk')
  7. sgrid = loadStructuredGrid(fpath)
  8. ugrid = UnstructuredGrid(sgrid) # convert to unstructured grid which vedo supports
  9. # Create a grid of points and use it as integration seeds
  10. seeds = Grid(res=[2,3], c="white").rotate_y(90).pos(2,2,1)
  11. streamlines = ugrid.compute_streamlines(seeds, initial_step_size=0.01, max_propagation=15)
  12. streamlines.cmap("Reds").add_scalarbar3d(c='white')
  13. streamlines.scalarbar = streamlines.scalarbar.clone2d("center-right", size=0.15)
  14. print(streamlines)
  15. show(streamlines, seeds, furniture(), __doc__, axes=1, bg='bb').close()