VisIt-tutorial-Advanced-DBPlugin

This section of the tutorial covers creating a custom database reader plugin for VisIt.

Resources

This tutorial uses the following resources:

Other useful links

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.

Setup

  1. Make sure that cmake 2.8.8 or later is installed on your system
  2. Make sure that visit 2.5.2 or later is installed on your system
  3. Linux
    • 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.
  4. 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:

  1. Identify how you want to expose data from your file format into VisIt's data model
  2. Create an XML description of your plugin using xmledit
  3. Generate the plugin skeleton using xml2plugin
  4. Implement the required methods in the avt*FileFormat class
    1. Read the file as needed
    2. Fill out VTK data structures
  5. 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.

  1. Get the code examples and save them in your home directory.
  2. 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.

  1. Run a new instance of VisIt
  2. Click Open file and navigate to the ~/XYV_data directory
  3. Open data*.xyv database
  4. Add a Pseudocolor plot of v and click Draw

You should see an image like this:

VisIt plotting XYV file format data

Troubleshooting

If you ran into any problems, verify that VisIt in fact loaded your plugin. Check the Options->Plugin Manager window.

Plugin Manager window