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

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.

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.

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

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?

This works

#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);
  }

Thanks!

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

Thanks again!

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

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