<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Courier;
panose-1:2 7 4 9 2 2 5 2 4 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello ParaView community,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">while programming a ParaView filter I encountered a problem with the CS wrapping. In the following I will describe the problem. The ParaView version I am currently using is 5.3.0.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">In my project I created a filter that has one of two possible outputs, depending on a preprocessor variable. The idea behind this is, that there is a define “_DETAILED” that can be set via cmake. If it is not defined,
a vtkRectilinearGrid is created. It it is defined, the plugin outputs a multiblock data set with an additional polydata object.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The problem now is that the generation of the MyPluginClientServer.cxx doesn’t account for the preprocessor variable and just takes the last defined algorithm. In my case, this means that in the MyPluginClientServer.cxx
file the line is always written as<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:blue">const</span><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">char</span><span style="font-size:9.5pt;font-family:Consolas;color:black">* commandName =
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515">"vtkRectilinearGridAlgorithm"</span><span style="font-size:9.5pt;font-family:Consolas;color:black">;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">This leads to a runtime error when applying the filter because it erroneously tries to downcast the plugin to the wrong algorithm data type.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Here the error message:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:8.5pt;font-family:Courier;color:maroon;mso-fareast-language:DE">ERROR: In T:\paraview\source\ParaView-v5.3.0\ParaViewCore\ServerImplementation\Core\vtkPVSessionCore.cxx, line 371<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:8.5pt;font-family:Courier;color:maroon;mso-fareast-language:DE">vtkPVSessionCore (000001D0D3633550): Cannot cast MyPlugin object to vtkRectilinearGridAlgorithm. This probably means the class specifies
the incorrect superclass in vtkTypeMacro.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:8.5pt;font-family:Courier;color:maroon;mso-fareast-language:DE">while processing<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:8.5pt;font-family:Courier;color:maroon;mso-fareast-language:DE">Message 0 = Invoke<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:8.5pt;font-family:Courier;color:maroon;mso-fareast-language:DE"> Argument 0 = vtk_object_pointer {MyPlugin (000001D080685680)}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:8.5pt;font-family:Courier;color:maroon;mso-fareast-language:DE"> Argument 1 = string_value {SetInputConnection}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:8.5pt;font-family:Courier;color:maroon;mso-fareast-language:DE"> Argument 2 = vtk_object_pointer {vtkAlgorithmOutput (000001D0E3D49AB0)}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The following is how I create the plugin class:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">[…]<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray">#ifdef</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#6F008A">_DETAILED</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:green">// Create multi block data set for additional output as polydata</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray">#include</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#A31515">"vtkMultiBlockDataSetAlgorithm.h"</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">class</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#6F008A">VTK_EXPORT</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">MyPlugin</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"> :
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">public</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkMultiBlockDataSetAlgorithm</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">public</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">static</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">MyPlugin</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">* New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#6F008A">vtkTypeMacro</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">(</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">MyPlugin</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkMultiBlockDataSetAlgorithm</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray">#else</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:green">// Create rectilinear grid</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray">#include</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#A31515">"vtkRectilinearGridAlgorithm.h"</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">class</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#6F008A">VTK_EXPORT</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">MyPlugin
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">:
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">public</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkRectilinearGridAlgorithm</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">public</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">static</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">MyPlugin</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">* New();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#6F008A">vtkTypeMacro</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">(</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">MyPlugin</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkRectilinearGridAlgorithm</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">);</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:gray">#endif</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">[…]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The work-around so far is to manually edit the MyPluginClientServer.cxx file to use the correct algorithm base class. This however is very unpractical as the code is supposed to be distributed to others. As I don’t have
enough knowledge of the inner workings of ParaView, especially the wrapping that is done, I don’t know where or how to fix this. I would be glad if someone was able to help me with this issue.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Kind regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Alex<o:p></o:p></span></p>
</div>
</body>
</html>