Hello ParaView community,
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.
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.
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
const char* commandName = "vtkRectilinearGridAlgorithm";
This leads to a runtime error when applying the filter because it erroneously
tries to downcast the plugin to the wrong algorithm data type.
Here the error message:
ERROR: In
T:\paraview\source\ParaView-v5.3.0\ParaViewCore\ServerImplementation\Core\vtkPVSessionCore.cxx,
line 371
vtkPVSessionCore (000001D0D3633550): Cannot cast MyPlugin object to
vtkRectilinearGridAlgorithm. This probably means the class specifies the
incorrect superclass in vtkTypeMacro.
while processing
Message 0 = Invoke
Argument 0 = vtk_object_pointer {MyPlugin (000001D080685680)}
Argument 1 = string_value {SetInputConnection}
Argument 2 = vtk_object_pointer {vtkAlgorithmOutput (000001D0E3D49AB0)}
The following is how I create the plugin class:
[...]
#ifdef _DETAILED
// Create multi block data set for additional output as polydata
#include "vtkMultiBlockDataSetAlgorithm.h"
class VTK_EXPORT MyPlugin : public vtkMultiBlockDataSetAlgorithm
{
public:
static MyPlugin* New();
vtkTypeMacro(MyPlugin, vtkMultiBlockDataSetAlgorithm);
#else
// Create rectilinear grid
#include "vtkRectilinearGridAlgorithm.h"
class VTK_EXPORT MyPlugin : public vtkRectilinearGridAlgorithm
{
public:
static MyPlugin* New();
vtkTypeMacro(MyPlugin, vtkRectilinearGridAlgorithm);
#endif
[...]
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.
Kind regards,
Alex
_______________________________________________
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
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
https://paraview.org/mailman/listinfo/paraview