This section of the tutorial covers creating a custom database reader plugin for VisIt.
This tutorial uses the following resources:
- Writing a File Format Reader for VisIt (powerpoint) (pdf)
- tutorial code (gzipped tar file of plugin code and data generation script)
Creating a database reader plugin for VisIt is a complex subject that spans a wide variety of topics, including: VisIt data model, VisIt development, VTK data structures, file I/O, and so on. Here are some useful references , apart from this tutorial, that will help you write your own database readers for VisIt.
- Getting Data Into VisIt manual
- Templates for filling out VTK data structures
- vtkDataSet class reference
- vtkDataArray class reference
- Building plugins using CMake
- Make sure that cmake 2.8.8 or later is installed on your system
- Make sure that visit 2.5.2 or later is installed on your system
- If you installed a VisIt binary tarball for Linux into ~/visit then the path to VisIt would be ~/visit/bin/visit. You may want to add ~/visit/bin to your path.
- MacOS X
- If you dragged the application bundle for VisIt onto your desktop to install it then the path to the visit executable would be ~/Desktop/VisIt.app/Contents/Resources/bin. You may want to add that to your path.
Writing a Database Reader
The process for creating a simple database reader is covered in the slides.
At a high level, the process is as follows:
- Identify how you want to expose data from your file format into VisIt's data model
- Create an XML description of your plugin using xmledit
- Generate the plugin skeleton using xml2plugin
- Implement the required methods in the avt*FileFormat class
- Read the file as needed
- Fill out VTK data structures
- Build the plugin using cmake
Building the tutorial plugin
These following instructions are sufficient for Mac and Linux. Windows instructions are a little lengthier as you must build the plugins using Visual Studio 2010.
- Get the code examples and save them in your home directory.
- Open a command prompt window and run these commands:
cd tar zxvf Tutorial_FileFormatReader_code.tar.gz cd XYV xml2cmake -clobber XYV.xml cmake . make
- We run xml2cmake in the above example because we need to overwrite the CMakeLists.txt file that comes in the code tarball with a newer version that will link to your installed VisIt.
- Once make has completed, your XYV plugin will be located in your ~/.visit directory.
- MacOS X 10.7 and 10.8 users running VisIt 2.6.0 or earlier will run into an issue when building against installed VisIt binaries.
- VisIt 2.6.0 (and earlier) binaries are built with support for OpenMPI but that package is not available on MacOS X 10.7 and 10.8.
- You will need to edit ~/Desktop/VisIt.app/Contents/Resources/<ver>/darwin-x86_64/include/PluginVsInstall.cmake and set VISIT_PARALLEL to OFF before you run cmake.
- VisIt 2.6.1 and later is built against an MPICH library that is distributed within the VisIt bundle itself so parallel builds should succeed.
Testing the tutorial plugin
Generating the data files
Generate the data files that are compatible with the tutorial plugin by following these commands in a console:
cd cd XYV_data chmod 700 generate.py ./generate.py
- The above commands run a Python script that generates 1000 time steps of data for the tutorial XYV file format.
Opening the data files
If your plugin has built successfully, VisIt will load the plugin the next time you run VisIt. If you have any instances of VisIt running, close them now.
- Run a new instance of VisIt
- Click Open file and navigate to the ~/XYV_data directory
- Open data*.xyv database
- Add a Pseudocolor plot of v and click Draw
You should see an image like this:
If you ran into any problems, verify that VisIt in fact loaded your plugin. Check the Options->Plugin Manager window.