[Paraview] Reader methods question

Moreland, Kenneth kmorel at sandia.gov
Tue Aug 31 11:29:27 EDT 2010


FillOutputPortInformation:

This adds one or more data types to an info object to announce what type of data this reader/filter will generate.  I always felt this was of limited use as the data type very often changes depending on the input, and I'm pretty sure ParaView ignores it altogether.  At any rate, just subclass from something like vtkDataObjectAlgorithm that provides an implementation for you.


RequestDataObject:

This method is called to create the data object that is placed in the output of the filter.  The method should check to see if the current output exists and is of the correct type.  If not, it should allocate a new object and connect it to the output.  Your implementation should look something like this.

int vtkMyReader::RequestDataObject(vtkInformation *,
                                   vtkInformationVector **,
                                   vtkInformationVector **otuputVector)
{
  // Figure out what the output type should be.

  vtkInformation *outInfo = outputVector->GetInformationObject(0);
  vtkDataObject *output = vtkDataObject::GetData(outInfo);

  if (/*output type is vtkStructuredGrid*/)
    {
    if (!output || !output->IsA("vtkStructuredGrid"))
      {
      output = vtkStructuredGrid::New();
      output->SetPipelineInformation(outInfo);
      output->Delete();   // Not really deleted.
      }
    }
  else if (/*output type is vtkUnstructuredGrid*/)
    {
    if (!output || !output->IsA("vtkUnstructuredGrid"))
      {
      output = vtkUnstructuredGrid::New();
      output->SetPipelineInformation(outInfo);
      output->Delete();   // Not really deleted.
      }
    }
  else
    {
    vtkErrorMacro("Internal error: bad input type?");
    return 0;
    }

  return 1;
}


RequestInformation:

Fill output information objects with meta information about the data.  If loading structured data, then set vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT().  If unstructured data, then set vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES() (set to -1 if you can load any number of pieces).

If your reader supports time data, then you should also set vtkStreamingDemandDrivenPipeline::TIME_STEPS() and vtkStreamingDemandDrivenPipeline::TIME_RANGE().


RequestUpdateExtent:

The update extent pass moves up the pipeline.  It gives filters a chance to adjust the extent requested (for example, by adding a ghost level).  Since your reader is at the top of the pipeline, you can ignore this.  You don't need to provide an implementation.


RequestData:

Basically what you said.  Load the data and put it into the output object (that was previously created with vtkRequestDataObject).  Pay attention to the values of the vtkStreamingDemandDrivenPipeline::UPDATE_* keys in the output information object.

-Ken


On 8/31/10 1:36 AM, "Felipe Bordeu" <felipe.bordeu at ec-nantes.fr> wrote:

Hello,

I am a little confuse about all the methods in a reader (filter).
I writing a new reader (I already read all the wiki pages) that can
generate Un/Structured grids depending on the file.

But I am not sure about what to put in each method.

ProcessRequest(...
RequestDataObject(...
RequestData(...
RequestUpdateExtent(...
RequestInformation(...
FillOutputPortInformation(..

I know RequesInformation(.. is for the type of output and the extend(in
the case is structured).
and I Know RequestData(... if for the generated data.

Thanks for the help.

--

Felipe

_______________________________________________
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




   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100831/f9e362aa/attachment.htm>


More information about the ParaView mailing list