fipy.viewers.vtkViewer¶
Functions
|
Generic function for creating a VTKViewer. |
- class fipy.viewers.vtkViewer.VTKCellViewer(vars, title=None, limits={}, **kwlimits)¶
Bases:
VTKViewerRenders CellVariable data in VTK format
Creates a VTKViewer
- Parameters:
vars (
CellVariableorFaceVariableorlist) – theMeshVariableobjects to display.title (
str, optional) – displayed at the top of the Viewer windowlimits (
dict, optional) – a (deprecated) alternative to limit keyword argumentsxmin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.xmax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.ymin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.ymax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.zmin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.zmax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.datamin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.datamax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- plot(filename=None)¶
Update the display of the viewed variables.
- Parameters:
filename (
str) – If not None, the name of a file to save the image into.
- plotMesh(filename=None)¶
Display a representation of the mesh
- Parameters:
filename (
str) – If not None, the name of a file to save the image into.
- raw()¶
Returns a VTK object, which can be passed to a visualizer of choice. In the example below, we pass this to the popular visualization library [pyvista](https://docs.pyvista.org/index.html).
>>> from fipy import Grid3D, CellVariable >>> from fipy import VTKViewer >>> import pyvista as pv
>>> mesh = Grid3D(dx=1, dy=1, dz=1, nx=10, ny=10, nz=10) >>> var = CellVariable(mesh) >>> var.setValue(1, where=mesh.cellCenters[0] > 5) >>> var.setValue(2, where=mesh.cellCenters[0] <= 5) >>> viewer = VTKViewer(vars=var)
>>> vtk = viewer.raw() >>> pv.wrap(vtk).plot() >>> viewer._promptForOpinion()
- setLimits(limits={}, **kwlimits)¶
Update the limits.
- Parameters:
limits (
dict, optional) – a (deprecated) alternative to limit keyword argumentsxmin (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.xmax (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.ymin (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.ymax (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.zmin (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.zmax (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.datamin (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.datamax (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
- class fipy.viewers.vtkViewer.VTKFaceViewer(vars, title=None, limits={}, **kwlimits)¶
Bases:
VTKViewerRenders
MeshVariabledata in VTK formatCreates a VTKViewer
- Parameters:
vars (
CellVariableorFaceVariableorlist) – theMeshVariableobjects to display.title (
str, optional) – displayed at the top of the Viewer windowlimits (
dict, optional) – a (deprecated) alternative to limit keyword argumentsxmin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.xmax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.ymin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.ymax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.zmin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.zmax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.datamin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.datamax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- plot(filename=None)¶
Update the display of the viewed variables.
- Parameters:
filename (
str) – If not None, the name of a file to save the image into.
- plotMesh(filename=None)¶
Display a representation of the mesh
- Parameters:
filename (
str) – If not None, the name of a file to save the image into.
- raw()¶
Returns a VTK object, which can be passed to a visualizer of choice. In the example below, we pass this to the popular visualization library [pyvista](https://docs.pyvista.org/index.html).
>>> from fipy import Grid3D, CellVariable >>> from fipy import VTKViewer >>> import pyvista as pv
>>> mesh = Grid3D(dx=1, dy=1, dz=1, nx=10, ny=10, nz=10) >>> var = CellVariable(mesh) >>> var.setValue(1, where=mesh.cellCenters[0] > 5) >>> var.setValue(2, where=mesh.cellCenters[0] <= 5) >>> viewer = VTKViewer(vars=var)
>>> vtk = viewer.raw() >>> pv.wrap(vtk).plot() >>> viewer._promptForOpinion()
- setLimits(limits={}, **kwlimits)¶
Update the limits.
- Parameters:
limits (
dict, optional) – a (deprecated) alternative to limit keyword argumentsxmin (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.xmax (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.ymin (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.ymax (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.zmin (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.zmax (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.datamin (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.datamax (
float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
- fipy.viewers.vtkViewer.VTKViewer(vars, title=None, limits={}, **kwlimits)¶
Generic function for creating a VTKViewer.
The VTKViewer factory will search the module tree and return an instance of the first VTKViewer it finds of the correct dimension and rank.
- Parameters:
vars (
CellVariableorFaceVariableorlist) – theMeshVariableobjects to display.title (
str, optional) – displayed at the top of the Viewer windowlimits (
dict, optional) – a (deprecated) alternative to limit keyword argumentsxmin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.xmax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.ymin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.ymax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.zmin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.zmax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.datamin (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.datamax (
float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
Modules
Test numeric implementation of the mesh |
|
FiPy