[vtk-developers] A possible bug and questions regarding the "polyhedral challenge" branch

Takuya OSHIMA oshima at eng.niigata-u.ac.jp
Thu Apr 1 05:59:29 EDT 2010


Hi,

I have a possible bug report and a couple of questions regarding the
"polyhedral challenge" fork of VTK (git://github.com/huayang/VTK.git).

The possible bug is in vtkUnstructuredGrid::InsertNextCell() that is
used to insert a polyhedron. When a polyhedron is inserted for the
first time in a vtkUnstructuredGrid that already has non-polyhedral
cells, perhaps either FaceLocations should be padded until the current
position (as attached below), or offset to the current position should
be memorized and subtracted from cellId of
this->FaceLocations->GetValue(cellId) in
vtkUnstructuredGrid::GetFaces().

The questions are as follows, which I hope to be clarified in the
Doxygen docs eventually.

1. When inserting a polyhedral cell, does the ordering of the points
in the faces array matter (clockwise/counterclockwise from inside of
the cell)?

2. Should the point labels in the faces array be numbered globally, or
locally?

3. Is vtkUnstructuredGrid::FindCell() supposed to work for polyhedral
cells?

Thanks for all the efforts of the developers!

Takuya

diff --git a/Filtering/vtkUnstructuredGrid.cxx b/Filtering/vtkUnstructuredGrid.cxx
index a5c0deb..a6b917a 100644
--- a/Filtering/vtkUnstructuredGrid.cxx
+++ b/Filtering/vtkUnstructuredGrid.cxx
@@ -900,6 +900,11 @@ InsertNextCell(int type, vtkIdType npts, vtkIdType *pts,
     this->Faces->Allocate(this->Types->GetSize());
     this->FaceLocations = vtkIdTypeArray::New();
     this->FaceLocations->Allocate(this->Types->GetSize());
+    // FaceLocations must be padded until the current position
+    for(vtkIdType i = 0; i <= this->Types->GetMaxId(); i++)
+      {
+      this->FaceLocations->InsertNextValue(-1);
+      }
     }
 
   // Okay the faces go in
@@ -932,6 +937,11 @@ vtkIdType vtkUnstructuredGrid::SetAllFacesAtOnce(vtkCellArray *faces)
     this->Faces->Allocate(this->Types->GetSize());
     this->FaceLocations = vtkIdTypeArray::New();
     this->FaceLocations->Allocate(this->Types->GetSize());
+    // FaceLocations must be padded until the current position
+    for(vtkIdType i = 0; i <= this->Types->GetMaxId(); i++)
+      {
+      this->FaceLocations->InsertNextValue(-1);
+      }
     }

Takuya OSHIMA, Ph.D.
Faculty of Engineering, Niigata University
8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN



More information about the vtk-developers mailing list