Hi,

GetCell(...) is intended for internal use (see the doxygen documentation) where loc is not the cell id, but an offset in the internal array. Using InitTraversal together with GetNextCell instead would be easier.

HTH
Jerome

On 12/12/2011 06:19 PM, Fred Fred wrote:
Hello,
I have been reading and reading this piece of code but cannot figure out what is wrong! I create a couple of cells of 4 ids and get...anything but what is expected.
Please tell me where I am wrong!

  vtkCellArray *faces = vtkCellArray::New();
  vtkIdList *fIds = vtkIdList::New();
  for (int i=0 ; i<faceIds.size() ; i++) {
    for (int j=0 ; j<faceIds[i].size() ; j++)
      fIds->InsertNextId(faceIds[i][j]);
    faces->InsertNextCell(fIds);
    printf("cell %d has %d ids\n", i, fIds->GetNumberOfIds());
    fIds->Reset();
  }
  for (int i=0 ; i<faces->GetNumberOfCells() ; i++) {
    vtkIdList *list = vtkIdList::New();
    faces->GetCell(i, list);
    printf("cell %d has %d ids\n", i, list->GetNumberOfIds());
  }

cell 0 has 4 ids
cell 1 has 4 ids
cell 2 has 4 ids
cell 3 has 4 ids
cell 4 has 4 ids
cell 5 has 4 ids
cell 6 has 4 ids
cell 7 has 4 ids
cell 8 has 4 ids
cell 9 has 4 ids
cell 10 has 4 ids
cell 11 has 4 ids
cell 12 has 4 ids
cell 13 has 4 ids
cell 14 has 4 ids
cell 15 has 4 ids
cell 16 has 4 ids
cell 17 has 4 ids
cell 18 has 4 ids
cell 19 has 4 ids

cell 0 has 4 ids
cell 1 has 64 ids
cell 2 has 71 ids
cell 3 has 113 ids
cell 4 has 120 ids
cell 5 has 4 ids
cell 6 has 63 ids
cell 7 has 64 ids
cell 8 has 112 ids
cell 9 has 113 ids
cell 10 has 4 ids
cell 11 has 64 ids
cell 12 has 63 ids
cell 13 has 71 ids
cell 14 has 70 ids
cell 15 has 4 ids
cell 16 has 71 ids
cell 17 has 78 ids
cell 18 has 120 ids
cell 19 has 127 ids



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview


--
Jérôme Velut
R&D Engineer
Kitware SAS
26 rue Louis Guérin
69100 Villeurbanne, France
F: +33 (0)4.37.45.04.15
http://www.kitware.fr
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to