Tip Build A Paraview3 Plugin

From OpenFOAMWiki
Revision as of 12:12, 5 October 2007 by 7islands (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In current Versions of Paraview3 there is no support for OpenFOAM (although the VTK can read OF-Files). To add that:

  1. Download Paraview3-Sources and compile them (that's the hard part)
  • Create a directory (OFPlugin or so). In that directory add the files
    • CMakeLists.txt:
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})
ADD_PARAVIEW_PLUGIN(OpenFOAMGUIPlugin "1.0" 
                    GUI_RESOURCES foamReader.qrc )
    • foamReader.qrc:
 
<RCC>
    <qresource prefix="/ParaViewResources" >
        <file>foamReader.xml</file>
    </qresource>
</RCC>
    • foamReader.xml:
 
<ParaViewReaders>
  <Reader name="OpenFOAMReader"
          extensions="controlDict foam"
          file_description="OpenFOAM Files">
  </Reader>
</ParaViewReaders>
  • In that directory do
ccmake .
  • Specify the path where you compiled paraview and generate the Makefiles
  • A simple make should produce a dynamic library (the Plugin)

Now to use that plugin:

  • start paraview
  • go to the Tools-Menu - Plugin Manager
  • Load the dynamic library you generated as a Client-Plugin
  • now the file open-Dialog knows about OpenFOAM (the file to "open" is the controlDict)

Notes:

  • Caution: currently the Reader can't deal with gzipped files. Make sure everything in your cases is unzipped. Otherwise paraview might hang (and crash) while opening the case
  • The good people of Kitware intend to enable the OF-Reader by default (then all this won't be necessary)
  • Altanatively, on ParaView 3.0.2 (at least, I still haven't tried other ParaView3 versions) you can turn on OpenFOAMReader as a builtin reader by adding
 
  <Reader name="OpenFOAMReader"
          extensions="controlDict foam"
          file_description="OpenFOAM Files">
  </Reader>

to ParaView3/Qt/Components/Resources/XML/ParaViewReaders.xml in the ParaView3 source tree before configureing ParaView3 with ccmake. -- 7islands 14:12, 5 Oct 2007 (CEST)