[Paraview] Question on Information Objects

Burlen Loring bloring at lbl.gov
Mon Apr 9 16:05:16 EDT 2012


Looks OK. did you return a value ? if not you should return 1. You don't 
need to override RequestDataObject.

On 04/09/2012 12:57 PM, Joshua Murphy wrote:
> Burlen,
>
> Hopefully this will be the last question for a while… :)
>
> I have FillOutputInformation as follows:
>
> int  vtkENLILReader::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;
>      }
> }
>
> But when I load the plugin and open a file, I get the following Error:
>
> ERROR: In 
> /Users/jjm390/LASP/release/mpi_config/ParaView-3.12.0/VTK/Filtering/vtkDemandDrivenPipeline.cxx, 
> line 689
> vtkPVCompositeDataPipeline (0x1198155f0): Algorithm 
> vtkENLILReader(0x119820d80) did not create output for port 0 when 
> asked by REQUEST_DATA_OBJECT and does not specify any DATA_TYPE_NAME.
>
> Any thoughts?
>
> Thanks,
> Josh
>
> From: Burlen Loring <bloring at lbl.gov <mailto:bloring at lbl.gov>>
> Date: Mon, 9 Apr 2012 13:45:43 -0600
> To: Joshua Murphy <joshua.murphy at lasp.colorado.edu 
> <mailto:joshua.murphy at lasp.colorado.edu>>
> Cc: burlen <burlen.loring at gmail.com <mailto:burlen.loring at gmail.com>>, 
> "paraview at paraview.org <mailto:paraview at paraview.org>" 
> <paraview at paraview.org <mailto:paraview at paraview.org>>
> Subject: Re: [Paraview] Question on Information Objects
>
> Joshua,
>
> There was mistake in my previous post, you should override 
> FillOutputInformation and set 
> info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkTable");
>
> Sorry about that.
> Burlen
>
>
>
> On 04/09/2012 12:24 PM, Joshua Murphy wrote:
>> Hi Burlen,
>>
>> I think I am getting there, but I am having the following problem now..
>>
>> The following snippet from my RequestData is causing a segfault…
>>
>>   vtkInformation  *outInfo2  =  outputVector->GetInformationObject(1);
>>   vtkTable  *MetaDataOutput  =  vtkTable::SafeDownCast(outInfo2->Get(vtkDataObject::DATA_OBJECT()));
>>
>> Am I grabbing the information object incorrectly, or do I need to 
>> override another method? Do I need to do something with 
>> RequestDataObject()?
>>
>> If you can help, that would be great!
>>
>> -Josh
>>
>>
>> From: Burlen Loring <bloring at lbl.gov <mailto:bloring at lbl.gov>>
>> Date: Mon, 9 Apr 2012 12:34:02 -0600
>> To: Joshua Murphy <joshua.murphy at lasp.colorado.edu 
>> <mailto:joshua.murphy at lasp.colorado.edu>>
>> Cc: burlen <burlen.loring at gmail.com 
>> <mailto:burlen.loring at gmail.com>>, "paraview at paraview.org 
>> <mailto:paraview at paraview.org>" <paraview at paraview.org 
>> <mailto:paraview at paraview.org>>
>> Subject: Re: [Paraview] Question on Information Objects
>>
>> Hi Joshua,
>>
>> In your constructor you'd need to call
>>
>>     this->SetNumberOfInputPorts(2);
>>
>> You'd need to override
>>
>>     FillInputPortInformation(int port, vtkInformation *info)
>>
>> implement a switch on port number and do something like:
>>
>>  288   switch (port)
>>  289     {
>>  290     // Vector feild data
>>  291     case 0:
>>  292       info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), 
>> "vtkUnstructuredGrid");
>>  293       break;
>>  294     // Seed points
>>  295     case 1:
>>  296       info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), 
>> "vtkTable");
>>  297       break;
>>  398     }
>>
>> in request data you have to grab the table from the second 
>> information object.
>>
>> Hope this helps
>> Burlen
>>
>>
>>
>> On 04/09/2012 11:01 AM, Joshua Murphy wrote:
>>> Hello,
>>>
>>> So I am trying to figure out how to add an output port to my Reader, 
>>> but I am having difficulty.
>>>
>>> I am trying to create the new output as outlined in the email below, 
>>> but when I get to the point of adding the column to the table, 
>>> ParaView segfaults.
>>>
>>> Having looked through other emails on the list, it looks like the 
>>> output ports need to be configured somehow, but I am not sure how to 
>>> do that.
>>>
>>> My reader creates a vtkStructuredGrid for the data, and I need to 
>>> add the vtkTable for the meta-data… how do I configure the reader 
>>> for these two outputs?
>>>
>>>
>>> Currently, my getInformation (beginning) looks like this:
>>> ------------
>>>
>>>    vtkInformation  *outInfo  =  outputVector->GetInformationObject(0);
>>>    vtkStructuredGrid  *output  =  vtkStructuredGrid::SafeDownCast(
>>>          outInfo->Get(vtkDataObject::DATA_OBJECT()));
>>>    //TODO:  Add  Meta  Data  here  first
>>>    //       Use  VTK  Table  output  Port
>>>    //  Following  is  from  discussion  on  ParaView  Mailing  List
>>>    //-----------------------------------------------------------
>>>
>>>          
>>>    //   315    vtkInformation  *outInfo;
>>>
>>>          
>>>    //   316    vtkTable  *output;
>>>
>>>          
>>>    //   317    vtkStringArray  *data;
>>>
>>>          
>>>    //   318
>>>
>>>          
>>>    //   319    //  output  port  1  ->  bw  data
>>>
>>>          
>>>    //   320    outInfo=outputVector->GetInformationObject(0);
>>>
>>>          
>>>    //   321    output
>>>
>>>          
>>>    //   322      =  dynamic_cast<vtkTable*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));
>>>
>>>          
>>>    //   323    data=vtkStringArray::New();
>>>
>>>          
>>>    //   324    data->SetName("BW  Data");
>>>
>>>          
>>>    //   325    data->SetNumberOfComponents(1);
>>>
>>>          
>>>    //   326    data->InsertNextValue(bwData.c_str());
>>>
>>>          
>>>    //   327    output->AddColumn(data);
>>>
>>>          
>>>    //   328    data->Delete();
>>>
>>>          
>>>    //----------------------------------------------------------
>>>
>>>          
>>>    vtkTable  *MetaDataOutput;
>>>
>>>          
>>>    vtkStringArray  *MetaString;
>>>
>>>          
>>>    //output  port  for  table  data
>>>
>>>          
>>> MetaDataOutput  =  dynamic_cast<vtkTable*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));
>>>
>>>          
>>> MetaString  =  vtkStringArray::New();
>>>
>>>          
>>> MetaString->SetName("Meta  Data");
>>>
>>>          
>>> MetaString->InsertNextValue("This  is  a  Test");
>>>
>>>          
>>> MetaString->InsertNextValue("This  is  Another  Test");
>>>
>>>          
>>> //VVVVVVVVV  This  is  making  me  crash!  VVVVVVVVVVVV//
>>>
>>>          
>>> //-----  Need  another  output  port!  How?  -------//
>>>
>>>          
>>> MetaDataOutput->AddColumn(MetaString);
>>>
>>>          
>>> MetaString->Delete();
>>>
>>>          
>>> //structured  grid  below  here....
>>>
>>>          
>>>    vtkStructuredGrid  *structOutput  =  vtkStructuredGrid::SafeDownCast(output);
>>>
>>>          
>>>
>>>        
>>> --------------
>>>
>>> The reader segfaults on MetaDataOutput->AddColumn(MetaString);
>>>
>>> If someone could point me in the correct direction (or simply tell 
>>> me how stupid I am being!, and then point in the correct direction!) 
>>> I would be very grateful!  I am sure I have a basic misunderstanding 
>>> of what is supposed to be happening here!
>>>
>>> -Josh
>>>
>>>
>>>
>>> From: burlen <burlen.loring at gmail.com <mailto:burlen.loring at gmail.com>>
>>> Date: Thu, 22 Mar 2012 22:41:37 -0600
>>> To: Joshua Murphy <joshua.murphy at lasp.colorado.edu 
>>> <mailto:joshua.murphy at lasp.colorado.edu>>
>>> Cc: "paraview at paraview.org <mailto:paraview at paraview.org>" 
>>> <paraview at paraview.org <mailto:paraview at paraview.org>>
>>> Subject: Re: [Paraview] Question on Information Objects
>>>
>>> hi, information keys are more for passing info between filters 
>>> through the pipeline. if all you want is to display a string, you 
>>> could make a second output port to your reader that produces a 
>>> vtkTable and populate it with the string. This could be displayed in 
>>> the pv ui. here's a quick example of what you'd do in your request data:
>>>
>>>
>>> 315   vtkInformation *outInfo;
>>> 316   vtkTable *output;
>>> 317   vtkStringArray *data;
>>> 318
>>> 319   // output port 1 -> bw data
>>> 320   outInfo=outputVector->GetInformationObject(0);
>>> 321   output
>>> 322     = 
>>> dynamic_cast<vtkTable*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));
>>> 323   data=vtkStringArray::New();
>>> 324   data->SetName("BW Data");
>>> 325   data->SetNumberOfComponents(1);
>>> 326   data->InsertNextValue(bwData.c_str());
>>> 327   output->AddColumn(data);
>>> 328   data->Delete();
>>>
>>>
>>>
>>> On 03/22/2012 03:38 PM, Joshua Murphy wrote:
>>>> Hello,
>>>>
>>>> I am trying to get meta-data information from a file into ParaView. 
>>>>  I have successfully built the information key-value pairs in the 
>>>> information object in my reader, but I am uncertain how to get the 
>>>> data out on the ParaView side of things.
>>>>
>>>> Example:
>>>>
>>>> I want to get the Calendar date meta-data from my model file.  I 
>>>> added Key to the information object to the results info object.
>>>>
>>>> I set keys as follows:
>>>>
>>>>    request->AppendUnique(vtkExecutive::KEYS_TO_COPY(), vtkENLILMetaDataKeys::REFDATE_CAL());
>>>>
>>>>
>>>> I have a function to add the value to the key like such:
>>>>
>>>> void vtkENLILMetaDataKeys::populate_meta_data(vtkInformation* request, vtkInformationStringKey *key, char* value)
>>>> {
>>>>    request->Set(key, value);
>>>> }
>>>>
>>>>
>>>> I then add the values to the keys as follows:
>>>>
>>>>    vtkENLILMetaDataKeys::populate_meta_data(outInfo, vtkENLILMetaDataKeys::REFDATE_CAL(), temp);
>>>>
>>>> After I do this, I can successfully pull the placed data from the 
>>>> information object from within the reader.
>>>>
>>>> What I cannot figure out is how to access this object from within 
>>>> Paraview.
>>>>
>>>> My goal is to be able to include the calendar date (as text) in the 
>>>> render view.
>>>>
>>>> Can someone guide me in the correct direction on how to do this?  I 
>>>> am looking for possibly a python way of getting at this data.
>>>>
>>>> Thanks,
>>>>
>>>> Josh
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Powered bywww.kitware.com
>>>>
>>>> Visit other Kitware open-source projects athttp://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
>>>
>>>
>>> _______________________________________________
>>> Powered bywww.kitware.com
>>>
>>> Visit other Kitware open-source projects athttp://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 --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120409/7133d401/attachment-0001.htm>


More information about the ParaView mailing list