[Paraview-developers] Question about using multiple ports in ParaView reader

Biddiscombe, John A. biddisco at cscs.ch
Tue Jul 3 17:09:58 EDT 2012


>

  1.  specify the number of output ports with this->SetNumberOfOutputPorts(2)
<

Are you doing that in the constructor or somewhere else? The fact that you get one port NULL on first iteration hints that you're calling this function too late.

Just a thought

JB

From: paraview-developers-bounces at paraview.org [mailto:paraview-developers-bounces at paraview.org] On Behalf Of Joshua Murphy
Sent: 03 July 2012 21:31
To: paraview-developers at paraview.org
Subject: [Paraview-developers] Question about using multiple ports in ParaView reader

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://public.kitware.com/pipermail/paraview-developers/attachments/20120703/11e578fd/attachment-0001.htm>


More information about the Paraview-developers mailing list