[Paraview] modifying vtkInformation object to point to new vtkDataObject

Berk Geveci berk.geveci at kitware.com
Wed Oct 14 06:49:12 EDT 2009


> Yes, I realize that I shouldn't modify the original input vector.
> There are copy methods for both vtkInformationVector and
> vtkInformation, so I'm planning to work with a duplicate of the
> original, modified only in the data object it holds, to send to the
> superclass. Would that scenario also be bad practice?

Totally kosher and good practice. This is the way the composite
executive iterates over the blocks of a multi-block or AMR dataset.
Just to be sure, I would check the source code of the superclass just
to make sure that it works only with the information vector and that
it does not do something like GetInputDataObject(). Filters are not
supposed to do that but some do anyway.

> I'm not sure there is another good way, unless I copy and paste the
> superclass' RequestData code into my subclass or modify the
> superclass, which I'd also rather not do as the superclass is within
> ParaView's main tree.

I didn't realize the superclass was in ParaView.

> In any case, I'd like to know more about figuring out which key to use
> to access data from the information vector. The get/set methods in
> vtkInformation take a key as input. But if I were to create a key,
> e.g. using the constructor of vtkInformationDataObjectKey I need both
> a name and a location, neither of which I know.

As you have already discovered, you use vtkDataObject::DATA_OBJECT()
to get/set the data object. For some of the other keys, look at the
header for: vtkDataObject, vtkExecutive, vtkDemandDrivenPipeline,
vtkStreamingDemandDrivenPipeline and vtkCompositeDataPipeline. The
keys related to the pipeline and filters are documented in the VTK
user's guide and one or two Kitware Source articles (I think). Beyond
that, it is a matter of finding an example filter to see what  it
does. Copy and paste is our best friend :-)

-berk

> On Wed, Oct 14, 2009 at 3:50 AM, Berk Geveci <berk.geveci at kitware.com> wrote:
>> I am not sure why it doesn't work but what you are doing is not safe
>> and is bad practice. The inputVector belongs to the input of this
>> filter and you should not modify it (other than passing a request
>> during RequestUpdateExtent). Isn't there another way you can do this?
>> Maybe having a data member defined in the superclass that you set in
>> the subclass? Or defining a helper function that you can call from the
>> subclass with the alternative input and with the regular input from
>> the superclass' RequestData?
>>
>>
>> On Tue, Oct 13, 2009 at 3:38 PM, Christine Corbett Moran
>> <corbett at physik.uzh.ch> wrote:
>>> Hi,
>>>
>>> I want to modify a vtkInformation object (specifically one within a
>>> vtkInformation vector) to point to a new data set.
>>>
>>> The use case is I have a derived class for which, in its RequestData
>>> method, I want to do some preprocessing on the input, then send the
>>> preprocessed input to the superclass via the superclass' RequestData
>>> method, then post process the output within the derived class. I don't
>>> want to modify the original input so I work with an (in my use case
>>> much smaller) subset of it, but the problem is then passing it on to
>>> the superclass for processing.
>>>
>>> Right now I do:
>>> inputVector[0]->GetInformationObject(0)->Set(
>>>  vtkDataObject::DATA_OBJECT(),newDataSet).
>>> Before my call to the super's RequestData method, but the superclass
>>> seems not to operate on the newDataSet, nor on the original data set,
>>> so I think I'm inadvertently pummeling something, probably using the
>>> wrong vtkInformationDataObjectKey. However I'm not sure how to divine
>>> the correct one. Any help would be appreciated.
>>>
>>> Cheers,
>>> Christine
>>> _______________________________________________
>>> 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
>>>
>>
> _______________________________________________
> 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
>


More information about the ParaView mailing list