<div dir="ltr"><div><div><div>Hi Hong,<br><br></div>I don&#39;t think you want to do VTK Python wrapping of your class. What you want is to have the proxy to the filter Python wrapped such that it&#39;s available when you import paraview.simple. This is what&#39;s needed for Catalyst Python pipelines. I don&#39;t think you&#39;re properly initializing the plugins from the previous directions I sent. You may want to look at <a href="http://public.kitware.com/pipermail/paraview-developers/2013-September/002499.html">http://public.kitware.com/pipermail/paraview-developers/2013-September/002499.html</a><br>

<br></div>As a side note, the gradient of unstructured data set filter can compute vorticity as well. It does require a vtkDataArray with three components to use though. <br><br></div>Regards,<br>Andy<br><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Sep 30, 2013 at 5:06 PM, Hong Yi <span dir="ltr">&lt;<a href="mailto:hongyi@renci.org" target="_blank">hongyi@renci.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Thanks, Andy. The CMakeLists.txt for my plugin is copied below with newly added lines for python wrapping in orange:<br>
<br>
-----------------------------<br>
if(NOT ParaView_SOURCE_DIR)<br>
  find_package(ParaView)<br>
  include(&quot;${PARAVIEW_USE_FILE}&quot;)<br>
  include (ParaViewPlugins)<br>
else()<br>
  # we&#39;re building from within ParaView Source.<br>
endif()<br>
<br>
include_directories(${VTK_INCLUDE_DIRS})<br>
<font color="FF9900">include(wrap-python.cmake)</font><br>
<br>
# create a paraview plugin containing server manager xml and the server<br>
# manager classes to build<br>
# this plugin can be loaded on the server side<br>
<br>
ADD_PARAVIEW_PLUGIN(SMVorticity &quot;1.0&quot;<br>
  SERVER_MANAGER_XML VorticityFilter.xml <br>
  SERVER_MANAGER_SOURCES VorticityFilter.cxx)<br>
<br>
<font color="FF9900">target_link_libraries(SMVorticity ${deps})</font><br>
<br>
<font color="FF9900">if(VTK_WRAP_PYTHON)<br>
  wrap_python(SMVorticity &quot;${sources}&quot;)<br>
endif()</font><br>
-----------------------------<br>
<br>
The orange lines are added by following <a href="http://www.paraview.org/pipermail/paraview/2012-May/024855.html" target="_blank">
http://www.paraview.org/pipermail/paraview/2012-May/024855.html</a> which works well and builds my filter and also wraps it in Python (i.e., it generates libSMVorticity.a and libSMVorticityPythonD.a). I have also verified the plugin is indeed loaded into pvserver
 and pvpython in paraview built bin directory.<br>
<br>
However, I still got &quot;name not defined&quot; error in coprocessing script when creating this filter by name &quot;VorticityOfUnstructuredDataSet&quot; in python script. I have a couple of specific questions I am currently investigating and hoping to get some inputs from experts
 in the list:<br>
<br>
1. I am not sure where this name &quot;VorticityOfUnstructuredDataSet&quot; (exported by coprocessing script generator plugin) comes from, the only clue I can see is in plugin.cmake, where the plugin is specified with DESCRIPTION &quot;Vorticity Of Unstructured DataSet&quot; and
 in VorticityFilter.xml, where the plugin is given a label of &quot;Vorticity Of Unstructured DataSet.&quot; Should this name be defined somewhere such as in some python file in paraview python site-packages?
<br>
<br>
2. I did try to add PV_PLUGIN_IMPORT macros to the adaptor since I am using Catalyst, however, the plugin symbol &quot;pv_plugin_instance_SMVorticity&quot; is undefined in the adaptor static lib (the same plugin symbol is defined in pvserver), hence I got an undefined
 error when linking simulation code to the adaptor. I did try to add my plugin static lib (in which the plugin symbol is defined) to the adaptor target via target_link_libraries before linking to vtkPVPythonCatalyst, but that does not seem to take any effect.
 For some reason I am still investigating, my plugin lib does not get to link to the adaptor via target_link_libraries. What I did is to go to src directory in the cross target and modified CMakeLists.txt for PhastaAdaptor, then went to corresponding paraview-build
 directory, and did &quot;make clean&quot; followed by &quot;make&quot; to rebuild PhastaAdaptor lib. Is there something obvious that I did not do correctly?<br>
<br>
Thanks for any inputs!<br>
<br>
Hong<br>
<br>
<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Andy Bauer [<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>]<br>
<b>Sent:</b> Friday, September 27, 2013 3:00 PM<br>
<b>To:</b> Hong Yi<br>
<b>Cc:</b> David E DeMarle; <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><div><div class="h5"><br>
<b>Subject:</b> Re: [Paraview] My own filter as part of pipeline for coprocessing raises &quot;name not defined&quot; error<br>
</div></div></font><br>
</div><div><div class="h5">
<div></div>
<div>
<div dir="ltr">
<div>
<div>Can you share your plugin or at least the CMakeLists.txt for your plugin? Have you tried with any other plugins that get packaged with ParaView to see if they work?<br>
<br>
</div>
If you&#39;re using Catalyst, I would suggest adding in the PV_PLUGIN_IMPORT_INIT<span>
</span>macros to the adaptor.<br>
<br>
</div>
Andy<br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, Sep 26, 2013 at 3:40 PM, Hong Yi <span dir="ltr">
&lt;<a href="mailto:hongyi@renci.org" target="_blank">hongyi@renci.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US">
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks! I did put my plugin inside
<span>ParaView</span>/Plugins in the same way as other Plugins, and enabled it when building
<span>ParaView</span> <span>superbuild</span> on Titan. I can see the static lib for the Plugin is built in
<span>paraview</span>-build/lib directory. And yes, I did use a plugin and load it via
<span>Tools|Manage</span> Plugins when creating python <span>coprocessing</span> script. However, it looks like my plugin is not loaded automatically even though it is built by
<span>ParaView</span> <span>superbuild</span>. Perhaps I should still follow the link
</span><a href="http://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Plugins_in_Static_Applications" target="_blank">http://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Plugins_in_Static_Applications</a>
<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">
but I am having some difficulty in following the info in the link to do what is suggested. Specifically, to what file should I insert two macros? It does not sound right to insert them into my custom plugin cxx file. Where should I add two macros to get my
 custom filter plugin to be loaded and wrapper into python module? I see &quot;LoadPlugin&quot; function defined in simple.py to call servermanager.LoadPlugin(filename, remote) which I am thinking perhaps should be called to load my plugin before my python coprocessing
 script is executed, but not sure whether this is the case or not. <br>
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks for any suggestions!
<br>
</span></p>
<p class="MsoNormal"><br>
<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hong<br>
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><span> </span></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p>
<p class="MsoNormal"><a name="14170b156e21f8ea_1415bc9d3c7fa960__MailOriginal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b></a><span><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> David E DeMarle [mailto:<a href="mailto:dave.demarle@kitware.com" target="_blank">dave.demarle@kitware.com</a>]
<br>
<b>Sent:</b> Thursday, September 26, 2013 1:28 PM<br>
<b>To:</b> Andy Bauer<br>
<b>Cc:</b> Hong Yi; <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview] My own filter as part of pipeline for coprocessing raises &quot;name not defined&quot; error</span></span></p>
<div>
<div>
<p class="MsoNormal"><span> </span></p>
<div>
<p class="MsoNormal"><span>Utkarsh pointed out that you still need to follow </span><a href="http://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Plugins_in_Static_Applications" target="_blank"><span>http://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Plugins_in_Static_Applications</span><span></span></a><span></span></p>

<div>
<p class="MsoNormal"><span>when the plugin is external to ParaView. If you put your plugin inside ParaView/Plugins, then it is done automatically.</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span><br clear="all">
</span></p>
<div>
<p class="MsoNormal"><span>David E DeMarle<br>
Kitware, Inc.<br>
R&amp;D Engineer<br>
21 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: <a href="tel:518-881-4909" value="+15188814909" target="_blank">518-881-4909</a></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span> </span></p>
<div>
<p class="MsoNormal"><span>On Thu, Sep 26, 2013 at 12:23 PM, David E DeMarle &lt;</span><a href="mailto:dave.demarle@kitware.com" target="_blank"><span>dave.demarle@kitware.com</span><span></span></a><span>&gt; wrote:</span></p>

<div>
<p class="MsoNormal"><span>I think that information is out of date. I believe that is done automatically now.</span></p>
<div>
<p class="MsoNormal"><span> </span></p>
</div>
<div>
<p class="MsoNormal"><span>Otherwise Andy is right. Putting the filter inside a plugin a good way to go. The plugin infrastructure will make it so that when you provide the XML that describes your vtk class, ParaView&#39;s build system will automatically wrap it
 into a proxy and python class so that ParaView will be able to use it.</span></p>
</div>
<div>
<p class="MsoNormal"><span> </span></p>
</div>
<div>
<p class="MsoNormal"><span>Also, I recommend trying it on a local static build first. That way the build time will be less and development will be quicker. Once you can load you plugin locally, then you should only have to compile on titan once.</span></p>

</div>
<div>
<p class="MsoNormal"><span><span style="color:#888888"> </span></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span><span style="color:#888888"><br clear="all">
</span><span></span></span></p>
<div>
<p class="MsoNormal"><span><span style="color:#888888">David E DeMarle<br>
Kitware, Inc.<br>
R&amp;D Engineer<br>
21 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: </span></span><a href="tel:518-881-4909" target="_blank"><span>518-881-4909</span><span></span></a><span></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span> </span></p>
<div>
<p class="MsoNormal"><span>On Wed, Sep 25, 2013 at 10:34 PM, Andy Bauer &lt;</span><a href="mailto:andy.bauer@kitware.com" target="_blank"><span>andy.bauer@kitware.com</span><span></span></a><span>&gt; wrote:</span></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span>Did you use a plugin to add in your custom filter when creating the Python co-processing script? I&#39;m not sure how plugins are &quot;loaded&quot; for static builds but you may want to look at
</span><a href="http://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Plugins_in_Static_Applications" target="_blank"><span>http://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Plugins_in_Static_Applications</span><span></span></a><span>. If that doesn&#39;t work, we&#39;ll
 have to figure out some other way to do it.</span></p>
</div>
<div>
<p class="MsoNormal"><span>Andy</span></p>
</div>
<div>
<p class="MsoNormal"><span> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span> </span></p>
</div>
<p class="MsoNormal"><span> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span> </span></p>
<div>
<div>
<div>
<p class="MsoNormal"><span>On Wed, Sep 25, 2013 at 9:16 PM, Hong Yi &lt;</span><a href="mailto:hongyi@renci.org" target="_blank"><span>hongyi@renci.org</span><span></span></a><span>&gt; wrote:</span></p>
</div>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">Hello,<br>
<br>
I set up a pipeline that used a custom filter I developed and exported it as a python script for coprocessing. I have made sure the static library for my custom filter is built and available in paraview-build/lib directory, and I have also linked this custom
 filter static library along with Catalyst libs to the simulation code for coprocessing. However, when I run the simulation linked with ParaView coprocessing for in-situ visualization, I got &quot;NameError: name &#39;MyCustomizedFilterName&#39; is not defined&quot; error when
 the line of my customized filter in my python coprocessing script is read in for pipeline coprocessing. What should I do to get my custom filter wrapped in python so that it can be recognized and used as part of the python pipeline script for coprocessing?
 Any advice and suggestions are very much appreciated.<br>
<br>
Thanks,<br>
<br>
Hong<br>
<br>
</span></span></p>
</div>
</div>
<p class="MsoNormal"><span> </span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span>_______________________________________________<br>
Powered by </span><a href="http://www.kitware.com" target="_blank"><span>www.kitware.com</span><span></span></a><span><br>
<br>
Visit other Kitware open-source projects at </span><a href="http://www.kitware.com/opensource/opensource.html" target="_blank"><span>http://www.kitware.com/opensource/opensource.html</span><span></span></a><span><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: </span><a href="http://paraview.org/Wiki/ParaView" target="_blank"><span>http://paraview.org/Wiki/ParaView</span><span></span></a><span><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
</span><a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank"><span>http://www.paraview.org/mailman/listinfo/paraview</span><span></span></a><span></span></p>
</blockquote>
</div>
<p class="MsoNormal"><span> </span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span><br>
_______________________________________________<br>
Powered by </span><a href="http://www.kitware.com" target="_blank"><span>www.kitware.com</span><span></span></a><span><br>
<br>
Visit other Kitware open-source projects at </span><a href="http://www.kitware.com/opensource/opensource.html" target="_blank"><span>http://www.kitware.com/opensource/opensource.html</span><span></span></a><span><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: </span><a href="http://paraview.org/Wiki/ParaView" target="_blank"><span>http://paraview.org/Wiki/ParaView</span><span></span></a><span><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
</span><a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank"><span>http://www.paraview.org/mailman/listinfo/paraview</span><span></span></a><span></span></p>
</div>
<p class="MsoNormal"><span> </span></p>
</div>
</div>
</div>
</div>
<span></span>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>
</div>
</div>

</blockquote></div><br></div>