vtkAffineArray

in a ParaView I/O plugin for particle data, I am attempting to replace this simple piece of code creating the connectivity list for a POLY_VERTEXCELL (code inspired from vtkConvertToPointCloud)

  std::vector<vtkIdType> polyVertex(N);
  std::iota(polyVertex.begin(), polyVertex.end(), 0);
  vtkNew<vtkCellArray> verts;
  verts->InsertNextCell(N, polyVertex.data());
  output->SetVerts(verts);

by a new code using a vtkAffineArray

vtkNew<vtkAffineArray<vtkIdType>> polyVertex;
polyVertex->SetBackend(std::make_shared<vtkAffineImplicitBackend<vtkIdType>>(1, 0));
polyVertex->SetNumberOfTuples(N);
vtkNew<vtkCellArray> verts;
verts->SetData(1, polyVertex);
output->SetVerts(verts);

At run-time, I am greeted with this message,
vtkCellArray.cxx:926 ERR| vtkCellArray (0x60464f495700): Offsets and Connectivity arrays must have the same type.
So, this is telling me that the automatic offset array creation can’t take my AffineArray as input.
I’d appreciate a clue on how to fix this. This functionality should eventually end-up in the conduit source for creating implicit pointset connectivity, as suggested to me by a developer.

Hi @jfavre ,

I fear this is not doable without modification in vtkCellArray
Maybe the failing check should be changed to be only based on the vtkAbstractArray::GetDataType instead of relying on concrete class, but this needs some investigation.

@Charles_Gueunet may have more inputs.

and also maybe @spyridon97 or @Yohann_Bearzi ?

@jaswantp has started this MR, https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10769, which is not finished yet, because there are some performance issues to think about and funding of course. This basically allows vtkCellArray to hold any vtkDataArray subclass as offsets or connectivity arrays.