VTKFIG
0.25.0
Easy VTK based in situ visualization
|
The API is handles object instanced using the standard C++11 smart pointer std::shared_ptr
.
All data are stored in instances of vtkfig::DataSet which in fact just wrap vtkDataSet instances describing a grid with all its attached scalar and vector functions.
Create such a DataSet:
Similar to the VTK library, the ::New()
methods are static class methods which return smart pointers to objects, effectively just wrapping std::make_shared
A data set can have multiple functions attached, which can be shown in different figures, which share one instance of grid information.
A particular visualization of data from a data set is done via a subclass of vtkfig::Figure. Create a Figure and add the scalar named "v" from the dataset:
To be seen on the screen, put the figure into an instance of vtkfig::Frame:
Each frame corresponts to a window on the screen. A vtkfig::Frame can have subframes (similar to subplots in matplotlib), allowing to have multiple figures in a frame. The implementation for multiple frames has performance issues. The Interact()
method handles blocking interaction.
If instead of blocking interaction you want to render data evolving during time, you can do this in a loop:
In the default mode, rendering in the frame is running in a separate thread, so the UI is responsive also during calculation.
Currently, there is no proper GUI, and due to lack of resources, no plan to develop one. Nevertheless, the visualization can be influenced interactively. Besides of the standard mouse interaction from VTK, a number of keyboard commands is available, see vtkfig::Frame::KeyboardHelp.
The module can be influenced by a number of environment variables
Variable | Default | Semantics |
---|---|---|
VTKFIG_PORT_NUMBER | 35000 | Port number passed from vtkfig-exec to client |
VTKFIG_WAIT_SECONDS | 10 | Waiting time before abandoning connection attempt |
VTKFIG_DEBUG | 0 | Toggle debug output |
VTKFIG_MULTITHREADED | 1 | Render from extra thread |
VTKFIG_DOUBLEBUFFER | 1 | Use double buffering. |
This feature is still quite experimental.
The file src/vtkfig-exec.cxx builds to an experimental visualization client for server-client communication. Most examples are equipped with this feature. Here is how to use it (we assume working from the build
directory, port
is an optional port number, vtkfigpath
is the path to the vtkfig source directory on the remote host ):
remote
remote
with ssh tunnel via gateway gate