[Paraview-developers] Necessity for RequestDataObject in custom reader plugin

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Fri Apr 17 08:38:34 EDT 2015


RequestDataObject is the pass in which a vtkAlgorithm subclass can
produce an instance of the dataset of the right type for the output.
Another mechanism for telling the pipeline which data object type is
going to be outputted would be the FillOutputPortInformation(). If a
concrete output type can be determined at compile time, one simply
uses FillOutputPortInformation to announce the output type. Data-type
specific subclasses of vtkAlgorithm e.g. vtkPolyDataAlgorithm use this
mechanism. If your reader is always going to produce vtkPolyData, for
example, just subclass from vtkPolyDataAlgorithm and you'll never need
to deal with RequestDataObject.

Now, when a filter/reader cannot tell the output type at compile time,
only at run time, then in FillOutputPortInformation one specifies a
generic type for the output e.g.  vtkDataObject and then overrides
RequestDataObject(). In RequestDataObject(), you create an instance of
the dataobject to be used as the output for the filter/reader. Now,
you have access to attributes set on the reader/filter as well as the
input data type -- all of which can be used to decide which output
dataset type to create.

Also note, RequestDataObject is not defined in vtkAlgorithm.
Subclasses of vtkAlgorithm typically override
vtkAlgorithm::ProcessRequest() method to call this method when the
`request` contains vtkDemandDrivenPipeline::REQUEST_DATA_OBJECT() key.

Hope that helps.
Utkarsh

On Fri, Apr 17, 2015 at 4:19 AM, Schlottke, Michael
<M.Schlottke at aia.rwth-aachen.de> wrote:
> Hi folks,
>
> Can somebody help me understand the purpose of the RequestDataObject() for a reader plugin? I see this method pop up now and then (typically in generic examples on how to create custom sources), but most of the readers in the Plugins/ directory do not seem to  use it. Is there a simple definition I can use to decide if and how to implement it?
>
> Regards,
>
> Michael
>
> P.S.: I’m working on two readers of vtkUnstructuredGridAlgorithm and vtkMultiBlockDataSetAlgorithm type.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers


More information about the Paraview-developers mailing list