Lawrence Livermore National Laboratory

20. How do I start writing a plugin for VisIt?

VisIt customers most commonly want to know how to write a database reader plugin. The process for writing a new database reader plugin is described in the Getting Data Into VisIt manual. Other plugin types will eventually be documented in the Plugin Developer's Guide. Since that guide has not been completed, the best way to begin writing a new plot or operator plugin is to send e-mail describing the plugin that you plan to write to The VisIt developers will be able to tell you the general steps that are involved and also suggest where to look for code that you can copy from existing plugins.

Plugins are generally meant to be written using the shared libraries and header files that are provided in the binary installations of VisIt. This means that you don't have to build all of VisIt in order to start developing your plugin. However, this assumes that you are going to use compilers that are compatible with the ones used to build VisIt. If you use compilers that generate code that is not compatible with the compilers used to generate a VisIt binary distribution then you will have to build VisIt. Building VisIt on the Windows platform currently requires that you use the Microsoft Visual Studio .Net 2003 compiler if you plan to build only your plugin and not all of VisIt since the import libraries distributed with the Windows version of VisIt are built using that compiler. Building a plugin begins with the step of creating an XML file. All VisIt plugins whether they are plot, operator, or database plugins begin with an XML file that describes the plugin's attributes. Have a look at the source code for other VisIt plot, operator, or database plugins to see how the XML files are used in practice.

There are two popular methods for starting a plugin. You can copy the files from another plugin, rename, and gradually adapt them to your needs or you can begin from scratch. If you begin from scratch, you will want to run VisIt's XMLEdit program, which loads, edits, and saves XML files for VisIt plugins. XMLEdit is used to set up the required attributes of a plugin such as its type and name. XMLEdit is also used to set up more advanced attributes such as the file extensions associated with a database plugin or the plot attributes required for a plot plugin. It can be helpful to look at the XML files from existing VisIt plugins to get an idea of how the XML files are used.

Once you have created an XML file for your plugin, run xml2plugin -clobber myxmlfile.xml to generate the plugin skeleton, any automatically generated code, and Makefile or project files needed to build your plugin. Once you've generated your plugin for the first time, check the directory in which you're keeping your plugin sources and XML file. There should be several new files. Most are boilerplate but pay special attention to the files that begin with "avt" since those are the files to which you generally must add your plugin code.