resview.py script

This is a script for quick VTK-based visualizations of finite element computations results.

Examples

The examples assume that python -c "import sfepy; sfepy.test('--output-dir=output-tests')" has been run successfully and the resulting data files are present.

  • View data in output-tests/test_navier_stokes.vtk:

    $ python resview.py output-tests/navier_stokes-navier_stokes.vtk
    
  • Customize the above output: plot0: field “p”, switch on edges, plot1: field “u”, surface with opacity 0.4, glyphs scaled by factor 2e-2.

    $ python resview.py output-tests/navier_stokes-navier_stokes.vtk -f p:e:p0 u:o.4:p1 u:g:f2e-2:p1

  • As above, but glyphs are scaled by the factor determined automatically as 20% of the minimum bounding box size.

    $ python resview.py output-tests/navier_stokes-navier_stokes.vtk -f p:e:p0 u:o.4:p1 u:g:f10%:p1

  • View data and take a screenshot.

    $ python resview.py output-tests/diffusion-poisson.vtk -o image.png

  • Take a screenshot without a window popping up.

    $ python resview.py output-tests/diffusion-poisson.vtk -o image.png –off-screen

  • Create animation from output-tests/diffusion-time_poisson.*.vtk.

    $ python resview.py output-tests/diffusion-time_poisson.*.vtk -a mov.mp4

  • Create animation from output-tests/test_hyperelastic.*.vtk, set frame rate to 3, plot displacements and mooney_rivlin_stress.

    $ python resview.py output-tests/test_hyperelastic_TL.*.vtk -f u:wu:e:p0 mooney_rivlin_stress:p1 -a mov.mp4 -r 3

class resview.FieldOptsToListAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]
separator = ':'
class resview.OptsToListAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]
separator = '='
class resview.StoreNumberAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]
resview.add_mat_id_to_grid(grid, cell_groups)[source]
resview.get_camera_position(bounds, azimuth, elevation, distance=None, zoom=1.0)[source]
resview.main()[source]
resview.make_cells_from_conn(conns, convert_to_vtk_type)[source]
resview.parse_options(opts, separator=':')[source]
resview.pv_plot(filenames, options, plotter=None, step=None, scalar_bar_limits=None, ret_scalar_bar_limits=False, step_inc=None, use_cache=True)[source]
resview.read_mesh(filenames, step=None, print_info=True, ret_n_steps=False, use_cache=True)[source]