|
[Sponsors] |
[General] Passing simple values between custom filters in ParaView |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 23, 2016, 10:24 |
Passing simple values between custom filters in ParaView
|
#1 |
New Member
Oliver Fernandes
Join Date: Mar 2016
Posts: 2
Rep Power: 0 |
Hello all,
I'm not sure this is the correct forum for this, but here goes anyway. So I wrote a couple of ParaView filters in C++, namely a reader A for a custom file format deriving from vtkUnstructuredGridAlgorithm, and a filter B that takes two of these outputs as input and does some calculation on them. Everything is working fine, but now I noticed that I need to pass a single string value (and 3-4 numbers) from each reader to the actual filter B doing stuff. A use case would be, for example, passing the input data filename from a reader to a filter on to a writer plugin, which can use it to come up with an appropriate output filename. Now the work-around I'm using at the moment to pass these data to the filter B is abusing CellData or PointData arrays of the vtkUnstructuredGrid generated in A. Needles to say this is not very elegant and creates other problems too. I think that somehow I need to create an appropriate vtkInformationKey storing the data. However, for everything I tried, the key seems to disappear in the pipeline between the filters. Here is some pseudocode snippet to show what I tried to add a value to an vtkInformation. Here the reader class A: Code:
class A : vtkUnstructuredGridAlgorithm { static vtkInformationStringKey* MYSTRING(); ... } vtkInformationKeyMacro(A, MYSTRING, String); A::RequestInformation(...) { vtkSmartPointer<vtkInformation> outInfo = outputVector->GetInformationObject(0); outInfo->Set(A::MYSTRING(),"test"); } Code:
#include "classA.h" class B : vtkUnstructuredGridAlgorithm { ... } B::RequestInformation(...) { vtkSmartPointer<vtkInformation> inInfo = inputVector[0]->GetInformationObject(0); if (!inInfo->Has(A::MYSTRING())) std::cout << "fail" std::endl; } So here is the question(s): Is this the correct approach using vtkInformation? If yes, what am I doing wrong? The ImageFoo example on the wiki page does exactly the same. Can someone give me a detailed explanation on the step necessary, or a well commented example? If no,is there a better, or more paraviewesque way to do it, and can I get hint at what I need to look at please? Any other comments on how to pass user defined data along the pipeline? Thanks alot for the help, Oli P.S.: I'm using ParaView 5.0.0 |
|
Tags |
c++, custom filters, paraview, pipeline |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] need to find an animation(just a simple one) made in paraview | frankieerie | ParaView | 5 | October 7, 2012 16:11 |
[ANSYS Meshing] Give me some simple formula for to calculate min & max size values using scaling | pandu | ANSYS Meshing & Geometry | 2 | June 6, 2011 12:35 |
Problem with a simple UDF to calculate cell-averaged particle values | kmayank | FLUENT | 1 | January 18, 2011 02:40 |
max node values exceed max element values in contour plot | jason_t | FLUENT | 0 | August 19, 2009 12:32 |
[OpenFOAM] paraview simple quesions | preibie | ParaView | 2 | June 29, 2009 06:15 |