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

Joshua Murphy Joshua.Murphy at lasp.colorado.edu
Tue Jul 3 17:13:28 EDT 2012


I am calling it in the constructor… actually, it is the first call in the constructor.



//---------------------------------------------------------------

//    Constructors and Destructors

//---------------------------------------------------------------

vtkGenericReader::vtkGenericReader()

{

  //set the number of output ports you will need

  this->SetNumberOfOutputPorts(2);


  //set the number of input ports

  this->SetNumberOfInputPorts(0);


  //configure array status selectors

  this->PointDataArraySelection = vtkDataArraySelection::New();

  this->CellDataArraySelection  = vtkDataArraySelection::New();


}



Joshua Murphy

Laboratory for Atmospheric and Space Physics

University of Colorado, Boulder



From: <Biddiscombe>, "John A." <biddisco at cscs.ch<mailto:biddisco at cscs.ch>>
To: Joshua Murphy <joshua.murphy at lasp.colorado.edu<mailto:joshua.murphy at lasp.colorado.edu>>, "paraview-developers at paraview.org<mailto:paraview-developers at paraview.org>" <paraview-developers at paraview.org<mailto:paraview-developers at paraview.org>>
Subject: RE: [Paraview-developers] Question about using multiple ports in ParaView reader

>

 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> [mailto:paraview-developers-bounces at paraview.org] On Behalf Of Joshua Murphy
Sent: 03 July 2012 21:31
To: paraview-developers at paraview.org<mailto: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/476d4431/attachment.htm>


More information about the Paraview-developers mailing list