<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Here is the type of check I was thinking of:</div><div><br>
</div><div><div>  for(vtkIdType cellId = 0; cellId < numCells; cellId++)</div><div>    {</div><div>    vtkSmartPointer<vtkIdList> pointList =</div>
<div>        vtkSmartPointer<vtkIdList>::New();</div><div>    data->GetCellPoints(cellId, pointList);</div><div>    </div><div>    for(vtkIdType p = 0; p < pointList->GetNumberOfIds(); p++)</div><div>      {</div>

<div>      vtkIdType id = pointList->GetId(p);</div><div>      if(id < 0 || id >= numPoints)</div><div>        {</div><div>        cout << "The data contains a cell which is defined on invalid geometry!" << endl;</div>

<div>        cout << "In particular, cell " << cellId << " tries to reference point " << id << </div><div>            ", but there are only " << numPoints << " points." << endl;</div>

<div>        return EXIT_FAILURE;</div><div>        }</div><div>      }</div><div>    }</div></div></blockquote><div><br>This is too inefficient. You should directly walk over the cell connectivity arrays (Verts, Lines, Polys, Strips) and check the point ids there.<br>
  <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
<div>In vtkXMLReader::RequestData, we have a vtkDataObject, so I guess we would just cast it to a vtkDataSet and if the cast passes then we could use the above function?</div></div></blockquote><div><br>You can't always cast to vtkDataSet. vtkXMLReaders can produce other types. I would add a pure virtual method to vtkDataObject called something like SanityCheck() or VerifyXXX() and implement it in subclasses. vtkDataSet would also call CheckAttributes() in this function. Then in vtkXMLReader, you can have something like<br>
<br>if (this->VerifyOutput && !this->SanityCheck())<br>   {<br>   vtkErrorMacro<br>   return empty output<br>   }<br><br>I would have this flag set to off by default in the class but to on in ParaView. <br><br>
-berk<br></div></div>