# vtkCellLinks.GetCells (vtkIdType ptId) not accessible from Java wrapper

**URL:** https://discourse.vtk.org/t/vtkcelllinks-getcells-vtkidtype-ptid-not-accessible-from-java-wrapper/16442
**Category:** Support
**Created:** [June 3, 2026, 3:16pm UTC](https://discourse.vtk.org/t/vtkcelllinks-getcells-vtkidtype-ptid-not-accessible-from-java-wrapper/16442 "2026-06-03T15:16:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jMaxR](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jMaxR](https://discourse.vtk.org/u/jMaxR)
#### Post date: [June 3, 2026, 3:16pm UTC](https://discourse.vtk.org/t/vtkcelllinks-getcells-vtkidtype-ptid-not-accessible-from-java-wrapper/16442/1 "2026-06-03T15:16:37Z")

</div>

I use vtk 9.5 with java wrapper. vtkCellLinks can be instantiated and built (with BuildLinks()), but GetLink() and GetCells() simply do not appear in the Java wrapper. I can’t figure out how vtkCellLinks can be useful if links cannot be retrieved. Maybe (probably) I miss something.  
How can I do to retrieve my links ? Do I have to build in Java a ‘parallel’ structure ?

Any hint will be gratefully appreciated.

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [June 4, 2026, 7:29am UTC](https://discourse.vtk.org/t/vtkcelllinks-getcells-vtkidtype-ptid-not-accessible-from-java-wrapper/16442/2 "2026-06-04T07:29:21Z")

</div>

You can forget about `GetLink()`. The return type is not a vtkObject so it won’t be wrapped.

The Java wrapper code does not seem to recognise the return type for GetCells(). I would suggest changing

`vtkIdType* GetCells(vtkIdType ptId)`

to

`long long* GetCells(vtkIdType ptId)`

and then rebuild.

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [June 5, 2026, 3:15am UTC](https://discourse.vtk.org/t/vtkcelllinks-getcells-vtkidtype-ptid-not-accessible-from-java-wrapper/16442/3 "2026-06-05T03:15:11Z")

</div>

Well that doesn’t work, so I tried adding a new method

```auto
void GetLink(vtkIdType ptId, vtkIdType& nCells, vtkIdType*& cells) VTK_SIZEHINT(cells, nCells);

void vtkCellLinks::GetLink(vtkIdType ptId, vtkIdType& nCells, vtkIdType*& cells) 
{
  Link& link = this->Array[ptId];
  nCells = link.ncells;
  cells = link.cells;
}

```

but it doesn’t generate Java wrapper code either. However there are other VTK classes which generate correctly e.g. `const vtkIdType* vtkWedge::GetFaceArray()`

This is a mystery to me. @dgobbi Do you know where the translation from **vtkIdType** to **long long** occurs?

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [June 10, 2026, 3:07am UTC](https://discourse.vtk.org/t/vtkcelllinks-getcells-vtkidtype-ptid-not-accessible-from-java-wrapper/16442/4 "2026-06-10T03:07:49Z")

</div>

This works

```auto
#include "vtkIdTypeArray.h"

  void GetCells(vtkIdType ptId, vtkIdTypeArray* cells);

  void vtkCellLinks::GetCells(vtkIdType ptId, vtkIdTypeArray* cells)
  {
    vtkIdType count = this->Array[ptId].ncells;
    cells->SetNumberOfValues(count);
    cells->SetArray(this->Array[ptId].cells, count, 1);
  }

```

---

<div class="post-metadata">

### Author: ![jMaxR](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jMaxR](https://discourse.vtk.org/u/jMaxR)
#### Post date: [June 10, 2026, 1:43pm UTC](https://discourse.vtk.org/t/vtkcelllinks-getcells-vtkidtype-ptid-not-accessible-from-java-wrapper/16442/5 "2026-06-10T13:43:00Z")

</div>

Thanks!

I’ll try to figure out how to incorporate this into my codebase.

Thanks again!

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [June 11, 2026, 12:09am UTC](https://discourse.vtk.org/t/vtkcelllinks-getcells-vtkidtype-ptid-not-accessible-from-java-wrapper/16442/6 "2026-06-11T00:09:14Z")

</div>

The problem is that the original `GetCells()` method contains no information indicating the size of the array to return. This could be patched in the wrapper code if VTK\_SIZEHINT was modified to take a function call.

As a work-around you can paste the code shown above into your VTK source file and rebuild. A new method will be generated in the Java wrapper, so that you can do something like

```auto
vtkIdTypeArray cells = new vtkIdTypeArray();
links.GetCells(id, cells);

```
