[vtkusers] Extra meta data in pvd

Cory Quammen cory.quammen at kitware.com
Fri Nov 11 10:30:09 EST 2016


Ah, yes, I should have caught that you would be using a
vtkStringArray, which is not accessed the same way as the numeric data
arrays. Glad you found the solution.

Cory

On Thu, Nov 10, 2016 at 2:15 PM, Chris Marsh <chris.marsh at usask.ca> wrote:
> Hi all,
>
> Following the advice here
> http://public.kitware.com/pipermail/paraview/2012-September/026100.html
>
> worked.  That is, in Python, the following works
> my_mesh.GetFieldData().GetAbstractArray("proj4").GetValue(0)
>
>
> On 9 November 2016 at 15:54, Chris Marsh <chris.marsh at usask.ca> wrote:
>>
>> Hi Cory,
>> Thanks for the reply. This looks like a perfect way forward.
>>
>> I am following this
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/FieldData
>>
>> and am having troubles with this approach. The field data doesn't seem to
>> be set properly. I can see the field data *name* in paraview when I load my
>> mesh, but it has an NA value.
>>
>>
>> What I'm doing is:
>>
>> std::string _srs_wkt = "my projection data here";
>> vtkSmartPointer<vtkStringArray> proj4 =
>> vtkSmartPointer<vtkStringArray>::New();
>> proj4->SetNumberOfComponents(1);
>> proj4->SetName("proj4");
>> proj4->InsertNextValue(_srs_wkt);
>>
>> vtkSmartPointer<vtkUnstructuredGrid> _vtk_unstructuredGrid =
>> vtkSmartPointer<vtkUnstructuredGrid>::New();
>>
>> //... build up _vtk_unstructuredGrid etc.
>>
>>  _vtk_unstructuredGrid->GetFieldData()->AddArray(proj4);
>>
>>  //validate
>>  vtkStringArray* test =
>> vtkStringArray::SafeDownCast(_vtk_unstructuredGrid->GetFieldData()->GetArray("proj4"));
>>
>>  //test is NULL
>>
>> any ideas?
>> Thanks
>>
>>
>> Chris Marsh
>> PhD Candidate
>> chrismarsh.ca
>>
>> 13 Kirk Hall
>> University of Saskatchewan
>>
>> On 9 November 2016 at 01:31, Cory Quammen <cory.quammen at kitware.com>
>> wrote:
>>>
>>> Hi Chris,
>>>
>>> Usually we stuff this kind of data into the generic field data (arrays
>>> not associated with points of cells) in the data set. The VTU
>>> reader/writer supports reading/writing field data.
>>>
>>> HTH,
>>> Cory
>>>
>>> On Tue, Nov 8, 2016 at 6:15 PM, Chris Marsh <chris.marsh at usask.ca> wrote:
>>> > Hi,
>>> >
>>> > I would like to add some extra meta-data to a pvd file. Specifically, a
>>> > proj4 string containing information about the coordinate system
>>> > projection
>>> > of the data contained in a vtu file.
>>> >
>>> > Is there a recommended way to do this?
>>> >
>>> > Cheers
>>> > Chris
>>> >
>>> > _______________________________________________
>>> > 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 VTK FAQ at:
>>> > http://www.vtk.org/Wiki/VTK_FAQ
>>> >
>>> > Search the list archives at: http://markmail.org/search/?q=vtkusers
>>> >
>>> > Follow this link to subscribe/unsubscribe:
>>> > http://public.kitware.com/mailman/listinfo/vtkusers
>>> >
>>>
>>>
>>>
>>> --
>>> Cory Quammen
>>> Staff R&D Engineer
>>> Kitware, Inc.
>>
>>
>



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.


More information about the vtkusers mailing list