cape.pvutils: Utilities for using PyVista with CAPE¶
This module provides common utilities to create PyVista flow
visualization figures in combination with CAPE. It includes a
main_template() that can be used as the main interface to
PyVista for individual customized templates.
This includes the class PVArgs to process various command-line
options, which can either make a single frame or a video. Videos can be
made using multiple processes working in parallel (each process working
a specific frame).
- class cape.pvutils.PVArgs(*args, **kw)¶
Argument and CLI parser for PyVista utilities
- cape.pvutils.genr8_filenames(OUTS: list, n: int | None = None, j: int | None = None) list¶
Create list of file names, which may have frame number
The inputs are simple prefixes. If n is
None, the outputs will simply add".png"to each template:>>> genr8_filenames(["y0-far", "y0-near"]) ["y0-far.png", "y0-near.png"]
If an iteration is given, the output will have a frame number
>>> genr8_filenames(["y0-far", "y0-near"], 1000) ["y0-far.001000.png", "y0-near.001000.png"] >>> genr8_filenames(["y0-far", "y0-near"], 1000, 20) ["y0-far.000020.png", "y0-near.000020.png"]
- cape.pvutils.main_template(frame_func: Callable, outs: list, pat: str) int¶
Template function for customized PyVista scripts
- Call:
>>> ierr = main_template(frame_func, outs, pat)
- Inputs:
- Outputs:
- ierr:
int Return code
- ierr:
- cape.pvutils.make_video(runner: CaseRunner, outs: list, pat: str | int, frame_func: Callable, parser: PVArgs, cutplanes: list | None = None, surfaces: list | None = None) int¶
Template to assemble PyVista frames into a video
- Call:
>>> make_video(runner, outs, pat, frame_func, parser)
- Inputs:
- runner:
cape.cfdx.casecntl.CaseRunner Single-case control instance
- outs:
list[str] List of prefixes for file names
- pat:
str Template file name to search for iterations of
- frame_func:
callable Function to process a single frame, takes args as follows:
frame_func(runner, parser, n=None, j=None)- parser:
PVArgs CLI args parsed using
PVAgs
- runner: