[Paraview] Question on Multiple Ports in Custom Reader (repost from developer list)
Joshua Murphy
Joshua.Murphy at lasp.colorado.edu
Fri Jul 6 15:13:01 EDT 2012
I think the example you gave me was for input ports, not output ports... it
generates the following paraview error:
ERROR: In
/Users/jjm390/Development/paraview/ParaView-3.14.1-Source/VTK/Filtering/vtk
DemandDrivenPipeline.cxx, line 689
vtkPVCompositeDataPipeline (0x7fbfdec84150): Algorithm
vtkGenericReader(0x7fbfdec5e4a0) did not create output for port 0 when
asked by REQUEST_DATA_OBJECT and does not specify any DATA_TYPE_NAME.
-Josh
On 7/6/12 12:26 PM, "Biddiscombe, John A." <biddisco at cscs.ch> wrote:
>You've used
> switch(port)
> {
> case 0:
> info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkStructuredGrid");
> break;
>
> case 1:
> info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkTable");
> break;
> }
>
>But I always use
> if (port==0) {
> info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPointSet");
> }
> else if (port==1) {
> info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPointSet");
> }
>
>Does that fix it?
>
>
>-----Original Message-----
>From: paraview-bounces at paraview.org
>[mailto:paraview-bounces at paraview.org] On Behalf Of Joshua Murphy
>Sent: 06 July 2012 18:53
>To: Utkarsh Ayachit
>Cc: paraview at paraview.org
>Subject: Re: [Paraview] Question on Multiple Ports in Custom Reader
>(repost from developer list)
>
>Hi Utkarsh,
>
>Here is the generic reader I am experimenting withŠ I haven't ported
>anything into my actual reader yet, as I am just trying to get the second
>port to work before messing with my actual reader.
>
>Thanks for helping!
>
>-Josh
>
>
>On 7/6/12 10:46 AM, "Utkarsh Ayachit" <utkarsh.ayachit at kitware.com> wrote:
>
>>Can you post you reader's code? It might make things easier.
>>
>>Utkarsh
>>
>>On Fri, Jul 6, 2012 at 12:15 PM, Joshua Murphy
>><Joshua.Murphy at lasp.colorado.edu> wrote:
>>> 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
>>>
>>>
>>>
>>> specify the number of output ports with
>>> this->SetNumberOfOutputPorts(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
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>
More information about the ParaView
mailing list