MantisBT - VTK
View Issue Details
0014034VTK(No Category)public2013-04-25 04:302013-10-24 11:58
santosh 
Dan Lipsa 
normalminorhave not tried
closedunable to reproduce 
5.10.0 
 
TBD
incorrect functionality
0014034: Bug in vtkCellArray::WritePointer function
In vtkCellArray::WritePointer function the InsertLocation member variable is becoming zero. After using WritePointer function if user use vtkCellArray::GetInsertLocation, it is giving incorrect location as InsertLocation is not getting updated.

I got this issue when I was using output of vtkAppendPolyData. I am inserting new linked polys using vtkPolyData::InsertNextLinkedCell. While using this API the cells are not getting updated correctly and because of which I was getting issues in my algorithm which is based on topological information.

I have modified function vtkCellArray::WritePointer and everything is working fine. Following is the modified code of the function

inline vtkIdType *vtkCellArray::WritePointer(const vtkIdType ncells,
                                             const vtkIdType size)
{
  this->NumberOfCells = ncells;
  this->TraversalLocation = 0;
  vtkIdType* pIdArray = this->Ia->WritePointer(0,size);
  this->InsertLocation = this->Ia->GetMaxId() + 1;
  return pIdArray;
}
Indeed vtkCellArray::WritePointer resets the InsertLocation member variable. While this decision can be questioned, it is not necessary a bug.
Changing this behavior, might cause problems for other code that depends on it.

Please provide us with more information if you have a test case where this causes problems in VTK.

Note that you can use vtkPolyData::InsertNextCell (without calling WritePointer) to insert cells beyond the original number of allocated cells as this takes care of the reallocation and also maintains the InsertLocation variable correctly.
No tags attached.
Issue History
2013-04-25 04:30santoshNew Issue
2013-06-25 12:08Dave DeMarleNote Added: 0031049
2013-10-21 13:39Dan LipsaAssigned To => Dan Lipsa
2013-10-21 13:39Dan LipsaStatusbacklog => tabled
2013-10-21 14:18Dave DeMarleStatustabled => backlog
2013-10-24 11:58Dan LipsaStatusbacklog => closed
2013-10-24 11:58Dan LipsaResolutionopen => unable to reproduce
2013-10-24 11:58Dan LipsaAdditional Information Updatedbug_revision_view_page.php?rev_id=662#r662

Notes
(0031049)
Dave DeMarle   
2013-06-25 12:08   
Would you please submit the patch in the form of a gerrit topic to facilitate automated testing and review?
For details on how to do so see http://www.vtk.org/Wiki/VTK/Git/Develop [^]
Please also provide code that exercises the fault.