[Paraview] Question on Multiple Ports in Custom Reader (repost from developer list)
Joshua Murphy
Joshua.Murphy at lasp.colorado.edu
Thu Jul 12 12:51:26 EDT 2012
Hi Utkarsh,
Here is a version of my generic reader that will build a non-time series
version and a time series version. This way you can observe the behavior.
A file is not read in the reader, but it generates sample data on its own...
just select any txt file to test. (as noted in previous emails, the
information objects are not provided properly to requestInformation and
requestData when using the time series version)...
I am hoping there is a simple thing that I am missing in the time series
XML to make this work, but am afraid that it may be a bug with ParaView...
if you can provide help, I would be grateful.
Thanks,
-- Joshua Murphy
Laboratory for Atmospheric and Space Physics
University of Colorado, Boulder
On 7/6/12 2:06 PM, "Utkarsh Ayachit" <utkarsh.ayachit at kitware.com> wrote:
>Joshua,
>
>Can you attach a data file to test the reader out as well? In the mean
>time here are few things I see:
>
>1. RequestInformation() should produce meta-data about both output
>ports, not just the one requested for. (I will have to dig in the code
>to confirm).
>2. You should not be saving the information objects passed into
>RequestInformation(..) i.e. there should be no place for
>this->DataOutInfo, this->MetaDataOutInfo!
>3. In RequestData, you can get access to the output data object by
>vtkDataObject::GetData(outputVector, 0) or
>vtkDataObject::GetData(outputVector, 1) and NOT
>this->GetExecutive()->GetOutputInformation(). You can also use
>vtkTable::GetData(outputVector, 1).
>
>Try fixing these issues, I am guessing that should solve the problems
>you are experiencing too.
>
>Utkarsh
>
>On Fri, Jul 6, 2012 at 12:53 PM, Joshua Murphy
><Joshua.Murphy at lasp.colorado.edu> wrote:
>> 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
>>>>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generic_reader.zip
Type: application/zip
Size: 22506 bytes
Desc: generic_reader.zip
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120712/375d474c/attachment-0001.zip>
More information about the ParaView
mailing list