# Assigning Multiple Tensors to a Point

**URL:** https://discourse.vtk.org/t/assigning-multiple-tensors-to-a-point/5867
**Category:** Support
**Created:** [May 26, 2021, 2:57pm UTC](https://discourse.vtk.org/t/assigning-multiple-tensors-to-a-point/5867 "2021-05-26T14:57:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nrsharan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nrsharan/32/3459_2.png) [@nrsharan](https://discourse.vtk.org/u/nrsharan)
#### Post date: [May 26, 2021, 2:57pm UTC](https://discourse.vtk.org/t/assigning-multiple-tensors-to-a-point/5867/1 "2021-05-26T14:57:54Z")

</div>

Hi everyone,

I am using VTK to generate .vtu files from Java to use them in ParaView.

I am trying to use `polyData.GetPointData().SetTensors(stress)`  
`polyData.GetPointData().SetTensors(strain)`  
where `polyData` is a variable of `vtkPolyData` type, and `stress` and `strain` are of type `vtkDoubleArray` with 9 components.

But I notice that in the .vtu file generated there is only one Tensor written, and indeed the last one assigned, i.e. strain in this case.

Is there some other way to do this?  
Any help is appreciated. Thanks a lot, and stay safe!

Regards,  
Sharan

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [May 26, 2021, 3:02pm UTC](https://discourse.vtk.org/t/assigning-multiple-tensors-to-a-point/5867/2 "2021-05-26T15:02:53Z")

</div>

You can use

polyData.GetPointData().AddArray(stress1)  
polyData.GetPointData().AddArray(stress2)  
polyData.GetPointData().SetActiveTensors(“Stress 1”)

instead.

---

<div class="post-metadata">

### Author: ![nrsharan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nrsharan/32/3459_2.png) [@nrsharan](https://discourse.vtk.org/u/nrsharan)
#### Post date: [May 26, 2021, 3:36pm UTC](https://discourse.vtk.org/t/assigning-multiple-tensors-to-a-point/5867/3 "2021-05-26T15:36:02Z")

</div>

This worked perfectly, thanks a lot!
