[Paraview] Question on Multiple Ports in Custom Reader (repost from developer list)

Joshua Murphy Joshua.Murphy at lasp.colorado.edu
Fri Jul 6 12:15:06 EDT 2012


Hello all,

I am still struggling with this problem, so I figured I would re-post the question to the general list in hopes of getting a wider audience!

Thanks in advance for any help you may provide!

For Completeness, I have verified that I am setting the number of output ports in my constructor.

Thanks again for any help!

-Joshua Murphy

Laboratory for Atmospheric and Space Physics

University of Colorado, Boulder


Hello,

I am attempting to write a reader that handles both structured grids and meta-data.  It was recommended to me that I use multiple ports, and populate a vtkTable with the meta-data.

I think I am having some conceptual problems with how this is supposed to work.

I have written a dummy reader in an attempt to get the meta-data working prior to porting it to my real reader, but I am having trouble…

My understanding is that I need to


 1.  specify the number of output ports with this->SetNumberOfOutputPorts(2)
 2.  Populate the output port information
int vtkGenericReader::FillOutputPortInformation(int port, vtkInformation* info)

{

  switch(port)

    {

    case 0:

      info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkStructuredGrid");

      break;

    case 1:

      info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkTable");

      break;

    }

  return 1;

}



3. Get the informationObject from the outputVector

   outputvector->GetInformationObject(1);



4. Get the table data

     this->MetaData = dynamic_cast<vtkTable*>

      (this->MetaDataOutInfo->Get(vtkDataObject::DATA_OBJECT()));



5. Add string to the table



  vtkStringArray *MetaString = vtkStringArray::New();

  MetaString->SetName("Meta Data");

  MetaString->SetNumberOfComponents(1);

  MetaString->InsertNextValue("This is a Test");

  MetaString->InsertNextValue("Test 2");

  MetaString->InsertNextValue("Test 3");

  this->MetaData->AddColumn(MetaString);





It is my understanding that this information should then be available in the ParaView GUI.





The problems I am having are this:



1.  When attempting to get both port information objects on the first call to RequestInformation(), port 1 returns a NULL object.  On the SECOND call to GetInformation(), both ports are available.



2.  All calls to RequestData() only provide access to port 0 in the Output information Vector.  I can access port 1 if I utilize this->getExecutive()->getOutputInformation(1)



3.  When using #2 to get the information, I populate, but I am unsure where/how things are supposed to be accessible in the GUI.





What I am trying to do is be able to access the meta-data values from within ParaView so that I can utilize data values, units, model run data, etc.



If anyone can help me understand what is supposed to be going on, or if I am completely doing something wrong, I would be grateful!  Am I missing some steps? Do I need to have XML code to access the vtkTable?





Thanks,



Joshua Murphy

Laboratory for Atmospheric and Space Physics

University of Colorado, Boulder


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


More information about the ParaView mailing list