# VtkSOADataArrayTemplate Java

**URL:** https://discourse.vtk.org/t/vtksoadataarraytemplate-java/12954
**Category:** Development
**Created:** [December 21, 2023, 9:29pm UTC](https://discourse.vtk.org/t/vtksoadataarraytemplate-java/12954 "2023-12-21T21:29:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Kostas\_Politis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kostas_politis/32/4328_2.png) [@Kostas\_Politis](https://discourse.vtk.org/u/Kostas_Politis)
#### Post date: [December 21, 2023, 9:29pm UTC](https://discourse.vtk.org/t/vtksoadataarraytemplate-java/12954/1 "2023-12-21T21:29:02Z")

</div>

Hello all,

We had some trouble transferring vtkMutliblocks of unstructured grids from c++ to java. Since our grids have vtksoaDataArrays of Doubles they obtain invalid pointers when passed to java. Transforming our arrays to classic vrkDoubleArray It is as if vtkJava has vtkAOSDataArrays i.e. vrkDoubleArray but not the SOA equivalent, well that’s a guess actually 🙂  
As a workaround we deepcopy our data that we seek to avoid.

Any observation of how we could pass vtkSOADataArray from cpp to java would be welcome!

Many thanks,  
Kostas

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [December 22, 2023, 2:57pm UTC](https://discourse.vtk.org/t/vtksoadataarraytemplate-java/12954/2 "2023-12-22T14:57:29Z")

</div>

Cc: @dgobbi (for wrapping) @Yohann_Bearzi (for data structures)

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [December 22, 2023, 4:19pm UTC](https://discourse.vtk.org/t/vtksoadataarraytemplate-java/12954/3 "2023-12-22T16:19:07Z")

</div>

I don’t have much advice to give on this one. The Java wrappers don’t touch templated classes, so they don’t know that `vtkAOSDataArrayTemplate<T>` is derived from `vtkDataArray`.

The Java wrappers _could_ be changed to handle unwrapped classes via their base classes. For example, when C++ returns a `vtkSOADataArray` to Java, the wrappers could use VTK’s `IsA()` to deduce that it’s a `vtkDataArray`. But this isn’t implemented. (If anyone is feeling inspired and wants to implement it, the Python wrappers do so [here](https://gitlab.kitware.com/vtk/vtk/-/blob/v9.3.0/Wrapping/PythonCore/vtkPythonUtil.cxx#L576)).

---

<div class="post-metadata">

### Author: ![Kostas\_Politis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kostas_politis/32/4328_2.png) [@Kostas\_Politis](https://discourse.vtk.org/u/Kostas_Politis)
#### Post date: [December 28, 2023, 9:52am UTC](https://discourse.vtk.org/t/vtksoadataarraytemplate-java/12954/4 "2023-12-28T09:52:13Z")

</div>

Hello,

We have made similar observations when passing SoA arrays from cpp to python and did not encounter any problems.

Ok I guess there is development work to do here 🙂
