[Paraview] VisIt Database Bridge - Custom Plugin of VisIt Reader

Simon Su newsgroup4ssu at gmail.com
Mon Apr 25 11:12:28 EDT 2011


Hi Robert,

I will give it a try.

thanks
-simon

On Mon, Apr 18, 2011 at 9:26 AM, Robert Maynard
<robert.maynard at kitware.com>wrote:

> Hi Simon,
>
> I have attached an example CMakeLists.txt that support external library
> linking and include directories. Since you are linking to a static build of
> HDF5 you will need to manually add each library
> to VISIT_PLUGIN_EXTERNAL_LIBS separated by semicolons.
>
>
> On Mon, Apr 11, 2011 at 5:19 PM, Simon Su <newsgroup4ssu at gmail.com> wrote:
>
>> Hi Robert,
>>
>> It worked. adding the other file listed under my Files components="M" xml
>> block solve the error when the plugin manager tries to loader the plugin.
>>
>> So I went and try to load my file in ParaView ... but this is what I
>> got....
>>
>>
>> sms:/local/home/build/paraview-plugin/gfdl-paraview-loader-build> paraview
>> /local/home/tools/ParaView/ParaView-3.10.0/sms.Linux-2.6.18-194.26.1.el5.x86_64.gcc-4.1.2.release/lib/paraview-3.10/paraview:
>> symbol lookup error:
>> /local/home/build/paraview-plugin/gfdl-paraview-loader-build/libVisItReaderGFDL.so:
>> undefined symbol: nc_inq_attlen
>>
>>
>> The question now is, where in ccmake can I specify for the plugin when it
>> is compiling to also include libnetcdf.a libhdf5_hl.a libhdf5.a libsz.a
>> libraries? Which variable do I add the libraries to? my ccmake only show
>> three variables when the toggle advanced mode is Off (CMAKE_BUILD_TYPE,
>> CMAKE_INSTALL_PREFIX, and ParaView_DIR). When I turn on the advanced mode,
>> it gave me many many more... but going through the list, I am also not sure
>> which cmake variable to use.
>>
>> vtkVisItReaderGFDL.cxx is attached and it with generated after I added the
>> second file into my CMakeLists.txt. I hope the file is not too big for the
>> list. if it is, it is also included at the bottom of this email.
>>
>> thank you for your help
>>
>> best,
>> -simon
>>
>>
>>
>> /*=========================================================================
>>
>>    Program: ParaView
>>    Module:    vtkVisItReaderGFDL.cxx
>>
>>    Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
>>    All rights reserved.
>>
>>    ParaView is a free software; you can redistribute it and/or modify it
>>    under the terms of the ParaView license version 1.2.
>>
>>    See License_v1.2.txt for the full ParaView license.
>>    A copy of this license can be obtained by contacting
>>    Kitware Inc.
>>    28 Corporate Drive
>>    Clifton Park, NY 12065
>>    USA
>>
>> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>> A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
>> CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
>> EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
>> PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
>> PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
>> LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
>> NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
>> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>>
>> ========================================================================*/
>> #include "vtkVisItReaderGFDL.h"
>> #include "vtkInformation.h"
>> #include "vtkInformationVector.h"
>> #include "vtkObjectFactory.h"
>> #include "vtkMultiBlockDataSet.h"
>>
>> #include "avtCM24FileFormat.h"
>> #include "avtDatabaseMetaData.h"
>> #include "avtMeshMetaData.h"
>> #include "avtVariableCache.h"
>>
>> /* #undef ARG_VISIT_READER_USES_OPTIONS */
>>
>> #ifdef ARG_VISIT_READER_USES_OPTIONS
>> #include ".h"
>> #endif
>>
>> /* #undef VISIT_READER_USES_INTERFACE */
>> #ifdef VISIT_READER_USES_INTERFACE
>> #include "vtkVisItReaderGFDL.h"
>> #endif
>>
>> vtkStandardNewMacro(vtkVisItReaderGFDL);
>>
>>
>> //-----------------------------------------------------------------------------
>> vtkVisItReaderGFDL::vtkVisItReaderGFDL()
>> {
>>   this->FileName = 0;
>> }
>>
>>
>> //-----------------------------------------------------------------------------
>> vtkVisItReaderGFDL::~vtkVisItReaderGFDL()
>> {
>>   this->SetFileName(0);
>> }
>>
>> #ifdef VISIT_READER_USES_INTERFACE
>>
>> //-----------------------------------------------------------------------------
>> int vtkVisItReaderGFDL::CanReadFile(const char *fname)
>> {
>>   int valid = 0;
>>   try
>>     {
>>     valid = vtkVisItReaderGFDL::;
>>     }
>>   catch(...){}
>>   return valid;
>> }
>> #endif
>>
>>
>> //-----------------------------------------------------------------------------
>> bool vtkVisItReaderGFDL::InitializeAVTReader(  const int& timestep  )
>> {
>>  if (!this->MetaData)
>>     {
>>     this->MetaData = new avtDatabaseMetaData( );
>>     }
>>
>>   if (!this->Cache)
>>     {
>>     this->Cache = new avtVariableCache( );
>>     }
>>
>>   if (!this->AvtFile)
>>     {
>>     try
>>       {
>> #ifdef ARG_VISIT_READER_USES_OPTIONS
>>        *options =
>>         new ();
>>       this->AvtFile = new avtCM24FileFormat(
>>         this->FileName, options->GetReadOptions() );
>>       delete options;
>> #else
>>       this->AvtFile = new avtCM24FileFormat(this->FileName);
>> #endif
>>       }
>>     catch(...)
>>       {
>>       this->AvtFile = NULL;
>>       return false;
>>       }
>>     avtCM24FileFormat *file = dynamic_cast<avtCM24FileFormat*>
>>       (this->AvtFile);
>>     if ( file )
>>       {
>>       //we have to make sure the visit reader populates its cache
>>       //before activating a time step
>>       try
>>         {
>>         file->SetCache( this->Cache );
>>         file->ActivateTimestep(timestep);
>>
>>         //only fill database after choosing timestep to activate
>>         file->SetDatabaseMetaData( this->MetaData, timestep );
>>         }
>>       catch(...)
>>         {
>>         return false;
>>         }
>>       }
>>     else
>>       {
>>       return false;
>>       }
>>     }
>>
>>   return true;
>> }
>>
>>
>>
>>
>> //-----------------------------------------------------------------------------
>> void vtkVisItReaderGFDL::PrintSelf(ostream& os, vtkIndent indent)
>> {
>>   this->Superclass::PrintSelf(os, indent);
>>
>> }
>>
>>
>>
>>
>>
>>
>> On Mon, Apr 11, 2011 at 4:41 PM, Robert Maynard <
>> robert.maynard at kitware.com> wrote:
>>
>>> Hi Simon,
>>>
>>> You do not need to modify the avt file or add the revision macro as that
>>> is not the problem you are currently facing. I would try reverting your avt
>>> file to its original content, adding all the files listed in the Files
>>> components="M" xml block to your SOURCES list, and adding the plugin
>>> build folder to your LD_LIBRARY_PATH.
>>>
>>> Also would you be able to send me the contents of the vtkVisItReaderGFDL.cxx
>>> from your build directory and I will confirm the automatic wrapping is
>>> working properly.
>>>
>>>
>>> On Mon, Apr 11, 2011 at 3:02 PM, Simon Su <newsgroup4ssu at gmail.com>wrote:
>>>
>>>> Hi Robert,
>>>>
>>>> I inferred a CMakeLists.txt from the wiki page
>>>>
>>>>
>>>> ================ CMakeLists.txt for the plugin
>>>>
>>>> PROJECT(VisItReaderGFDL)
>>>>
>>>> cmake_minimum_required(VERSION 2.8)
>>>>
>>>> FIND_PACKAGE(ParaView REQUIRED)
>>>> INCLUDE(${PARAVIEW_USE_FILE})
>>>>
>>>> SET(SOURCES
>>>>  avtCM24FileFormat.C
>>>>  )
>>>>
>>>> ADD_VISIT_PLUGIN_READER(VisItReaderGFDL "1.0"
>>>>   VISIT_READER_NAME "avtCM24FileFormat"
>>>>   VISIT_READER_TYPE "MTSD"
>>>>   VISIT_READER_FILE_PATTERN "nc"
>>>>   SERVER_SOURCES ${SOURCES}
>>>>   )
>>>>
>>>> TARGET_LINK_LIBRARIES(VisItReaderGFDL vtkVisItAVTAlgorithms)
>>>> ============================
>>>>
>>>> I then placed the .C and .h files in the same directory
>>>> sms:/local/home/build/paraview-plugin> ls -alF gfdl-paraview-loader
>>>> total 112
>>>> drwxr-xr-x 2 sms t  4096 Apr 11 14:53 ./
>>>> drwxr-xr-x 5 sms t  4096 Apr 11 14:20 ../
>>>> -rw-r--r-- 1 sms t 87958 Apr 11 12:51 avtCM24FileFormat.C
>>>> -rw-r--r-- 1 sms t  7311 Apr 11 14:25 avtCM24FileFormat.h
>>>> -rw-r--r-- 1 sms t   404 Apr 11 13:02 CMakeLists.txt
>>>>
>>>>
>>>> Then in the build directory, I did a ccmake and entered the right text
>>>> for ParaView_DIR variable and I got this after configure/generate/make
>>>>
>>>> sms:/local/home/build/paraview-plugin/gfdl-paraview-loader-build> ls
>>>> -alF
>>>> total 228
>>>> drwxr-xr-x 3 sms t  4096 Apr 11 14:25 ./
>>>> drwxr-xr-x 5 sms t  4096 Apr 11 14:20 ../
>>>> -rw-r--r-- 1 sms t 42197 Apr 11 14:24 CMakeCache.txt
>>>> drwxr-xr-x 6 sms t  4096 Apr 11 14:25 CMakeFiles/
>>>> -rw-r--r-- 1 sms t  1691 Apr 11 14:24 cmake_install.cmake
>>>> -rwxr-xr-x 1 sms t 74174 Apr 11 14:25 libVisItReaderGFDL.so*
>>>> -rw-r--r-- 1 sms t 12258 Apr 11 14:24 Makefile
>>>> -rw-r--r-- 1 sms t  2685 Apr 11 14:24 moc_VisItReaderGFDL_Plugin.cxx
>>>> -rw-r--r-- 1 sms t  3376 Apr 11 14:24 qrc_VisItReaderGFDL.cxx
>>>> -rw-r--r-- 1 sms t   578 Apr 11 14:24 VisItReaderGFDLInit.cxx
>>>> -rw-r--r-- 1 sms t  4308 Apr 11 14:24 VisItReaderGFDL_Plugin.cxx
>>>> -rw-r--r-- 1 sms t  3809 Apr 11 14:24 VisItReaderGFDL_Plugin.h
>>>> -rw-r--r-- 1 sms t   163 Apr 11 14:24 VisItReaderGFDL.qrc
>>>> -rw-r--r-- 1 sms t  1045 Apr 11 14:24
>>>> vtkSMVisItReaderGFDLInstantiator.cxx
>>>> -rw-r--r-- 1 sms t   464 Apr 11 14:24 vtkSMVisItReaderGFDLInstantiator.h
>>>> -rw-r--r-- 1 sms t  5473 Apr 11 14:24 vtkSMXML_VisItReaderGFDL.h
>>>> -rw-r--r-- 1 sms t  4705 Apr 11 14:24 vtkVisItReaderGFDLClientServer.cxx
>>>> -rw-r--r-- 1 sms t  4025 Apr 11 14:24 vtkVisItReaderGFDL.cxx
>>>> -rw-r--r-- 1 sms t  1740 Apr 11 14:24 vtkVisItReaderGFDLExport.h
>>>> -rw-r--r-- 1 sms t   151 Apr 11 14:24 vtkVisItReaderGFDLGUI.xml
>>>> -rw-r--r-- 1 sms t  2194 Apr 11 14:24 vtkVisItReaderGFDL.h
>>>> -rw-r--r-- 1 sms t  4169 Apr 11 14:24 vtkVisItReaderGFDLSM.xml
>>>>
>>>>
>>>> however, loading the plugin using plugin manager gui resulted in an
>>>> error
>>>>
>>>> Cannot load library
>>>> /local/home/build/paraview-plugin/gfdl-paraview-loader-build/libVisItReaderGFDL.so:
>>>> (/local/home/build/paraview-plugin/gfdl-paraview-loader-build/libVisItReaderGFDL.so:
>>>> undefined symbol: _ZTI17avtCM24FileFormat)
>>>>
>>>> then from your plugin wiki page, I added the following line into my
>>>> avtCM24FileFormat.h file
>>>>
>>>> vtkCxxRevisionMacro(VisItReaderGFDL, "$Revision$");
>>>>
>>>> but when I compile, I get
>>>>
>>>> sms:/local/home/build/paraview-plugin/gfdl-paraview-loader-build> make
>>>> [  9%] Generating moc_VisItReaderGFDL_Plugin.cxx
>>>> [ 18%] Generating vtkVisItReaderGFDLClientServer.cxx
>>>> [ 27%] Generating qrc_VisItReaderGFDL.cxx
>>>> [ 36%] Generating vtkSMXML_VisItReaderGFDL.h
>>>> -- Generate module: vtkVisItReaderGFDLSM
>>>> [ 45%] Building CXX object
>>>> CMakeFiles/VisItReaderGFDL.dir/qrc_VisItReaderGFDL.cxx.o
>>>> [ 54%] Building CXX object
>>>> CMakeFiles/VisItReaderGFDL.dir/vtkVisItReaderGFDL.cxx.o
>>>> /local/home/build/paraview-plugin/gfdl-paraview-loader/avtCM24FileFormat.h:45:
>>>> error: 'VisItReaderGFDL' has not been declared
>>>> /local/home/build/paraview-plugin/gfdl-paraview-loader/avtCM24FileFormat.h:
>>>> In function 'void CollectRevisions(std::ostream&)':
>>>> /local/home/build/paraview-plugin/gfdl-paraview-loader/avtCM24FileFormat.h:45:
>>>> error: invalid use of 'this' in non-member function
>>>> /local/home/build/paraview-plugin/gfdl-paraview-loader/avtCM24FileFormat.h:45:
>>>> error: 'Superclass' has not been declared
>>>> make[2]: *** [CMakeFiles/VisItReaderGFDL.dir/vtkVisItReaderGFDL.cxx.o]
>>>> Error 1
>>>> make[1]: *** [CMakeFiles/VisItReaderGFDL.dir/all] Error 2
>>>> make: *** [all] Error 2
>>>>
>>>> and actually, my plugin code also depend on both netcdf and hdf5 library
>>>> which is specified in my VisIt xml file
>>>>
>>>> sms:/local/home/build/paraview-plugin/gfdl-visit-load> cat CM24.xml
>>>> <?xml version="1.0"?>
>>>>   <Plugin name="CM24" type="database" label="NetCDF CM2.4" version="1.0"
>>>> enabled="true" mdspecificcode="false" engspecificcode="false"
>>>> onlyengine="false" noengine="false" dbtype="MTSD" haswriter="false"
>>>> hasoptions="false">
>>>>     <CXXFLAGS>
>>>>
>>>> -I/net/sms/tools/VisIt/VisIt-2.2.1/sms.Linux-2.6.18-194.26.1.el5.x86_64.gcc-4.1.2.release/current/linux-x86_64/include/netcdf
>>>>       -Wno-deprecated
>>>>     </CXXFLAGS>
>>>>     <LIBS>
>>>>
>>>> /local/home/tools/VisIt/VisIt-2.2.1/sms.Linux-2.6.18-194.26.1.el5.x86_64.gcc-4.1.2.release/current/linux-x86_64/archives/libnetcdf.a
>>>>
>>>> /local/home/tools/VisIt/VisIt-2.2.1/sms.Linux-2.6.18-194.26.1.el5.x86_64.gcc-4.1.2.release/current/linux-x86_64/lib/libhdf5_hl.a
>>>>
>>>> /local/home/tools/VisIt/VisIt-2.2.1/sms.Linux-2.6.18-194.26.1.el5.x86_64.gcc-4.1.2.release/current/linux-x86_64/lib/libhdf5.a
>>>>
>>>> /local/home/tools/VisIt/VisIt-2.2.1/sms.Linux-2.6.18-194.26.1.el5.x86_64.gcc-4.1.2.release/current/linux-x86_64/lib/libsz.a
>>>>     </LIBS>
>>>>     <FilePatterns>
>>>>       *.nc
>>>>     </FilePatterns>
>>>>     <Files components="M">
>>>>       avtCM24FileFormat.C
>>>>       NETCDFFileObject.C
>>>>     </Files>
>>>>     <Files components="E">
>>>>       avtCM24FileFormat.C
>>>>       NETCDFFileObject.C
>>>>     </Files>
>>>>     <Attribute name="" purpose="" persistent="true" keyframe="true"
>>>> exportAPI="" exportInclude="">
>>>>     </Attribute>
>>>>   </Plugin>
>>>>
>>>> how do I go about adding the appropriate netcdf and hdf5 libraries into
>>>> the plugin CMakeLists.txt file?
>>>>
>>>> any help is much appreciated.
>>>>
>>>> thank you
>>>> -simon
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Apr 11, 2011 at 8:25 AM, Robert Maynard <
>>>> robert.maynard at kitware.com> wrote:
>>>>
>>>>> Hi Simon,
>>>>>
>>>>> You do not need to place the CMakeLists.txt inside ParaView at all to
>>>>> build a plugin. You just need to set that folder as the source folder
>>>>> for CMake, and set a different directory as the plugin build
>>>>> directory. After that you will need to set ParaView_DIR to your
>>>>> ParaView build directory.
>>>>>
>>>>> I would also look over: http://www.paraview.org/Wiki/Plugin_HowTo for
>>>>> my information on building plugins.
>>>>>
>>>>> On Fri, Apr 8, 2011 at 5:12 PM, Simon Su <newsgroup4ssu at gmail.com>
>>>>> wrote:
>>>>> > Hi there,
>>>>> >
>>>>> > I have silo plugin working and now I would like to try out adding my
>>>>> own
>>>>> > VisIt database plugin to ParaView.
>>>>> > http://www.cmake.org/Wiki/VisIt_Database_Bridge mentioned how to
>>>>> write the
>>>>> > CMakeLists.txt file but where do I need to place the files (
>>>>> CMakeLists.txt,
>>>>> > and avtMyReaderFileFormat.C) in the source tree of ParaView to be
>>>>> pickup by
>>>>> > the cmake process?
>>>>> >
>>>>> > thanks
>>>>> > -simon
>>>>> >
>>>>> > _______________________________________________
>>>>> > Powered by www.kitware.com
>>>>> >
>>>>> > Visit other Kitware open-source projects at
>>>>> > http://www.kitware.com/opensource/opensource.html
>>>>> >
>>>>> > Please keep messages on-topic and check the ParaView Wiki at:
>>>>> > http://paraview.org/Wiki/ParaView
>>>>> >
>>>>> > Follow this link to subscribe/unsubscribe:
>>>>> > http://www.paraview.org/mailman/listinfo/paraview
>>>>> >
>>>>> >
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Robert Maynard
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Robert Maynard
>>>
>>
>>
>
>
> --
> Robert Maynard
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110425/e3f0050a/attachment-0001.htm>


More information about the ParaView mailing list