[vtk-developers] How to set several scalars to vtkPoint ?

houssen houssen at ipgp.fr
Sun Apr 2 12:39:50 EDT 2017


KO ! Does not work (realize I tried this before !) => I only get data1 
OR data2 (never both of them) in the written .vtu file...
It is possible to make this work or to create a N-sized-vector.

BTW, data1 is "pressure", data2 is "velocity" (that is data 1 and 2 are 
not related to each other)

Franck

Le 2017-04-02 18:24, Bill Lorensen a écrit :
> Try
> uGrid->GetPointdata()->AddArray(data2);
>
>
> On Sun, Apr 2, 2017 at 12:01 PM, houssen <houssen at ipgp.fr> wrote:
>> Hello,
>>
>> How to set several scalars to vtkPoint ?
>>
>> Seems vtkDataPoint scratchs the previous scalar array ?!
>>
>> vtkSmartPointer<vtkIntArray> data1 = 
>> vtkSmartPointer<vtkIntArray>::New();
>> data1->SetName("data1");
>> vtkSmartPointer<vtkIntArray> data2 = 
>> vtkSmartPointer<vtkIntArray>::New();
>> data2->SetName("data2");
>> for (...) {data1->SetValue(idx, d1[i]); data2->SetValue(idx, 
>> d2[idx]) }
>> uGrid->GetPointdata()->SetScalars(data1); // OK
>> uGrid->GetPointdata()->SetScalars(data2); // data2 scratch data1 ?!
>>
>> uGrid->GetPointdata()->SetActiveScalar("data1") does not do what I 
>> need :
>> seems that it activate data1 back but "scratch" data2 back.
>>
>> uGrid is a vtkUnstructuredGrid : the final goal is to write the grid 
>> to a
>> file (with vtkWriter). In this file, I'd like to have BOTH data1 and 
>> data2
>> for points.
>> I only get either one or the other... How to get both ?
>>
>> Also tried to create a N-sized-vector (N=2 or 4) to associate to the
>> vtkPoint : does not work as it seems vector dimension MUST be 3. I 
>> somebody
>> knows a solution to attach a N-sized-vector to a vtkPoint, it could 
>> solve my
>> problem
>>
>> Franck
>>
>> PS : found nothing relevant on the web, targetting VTK-7.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: 
>> http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>



More information about the vtk-developers mailing list