[vtk-developers] vtkXMLUnstructuredGridWriter

Brad King brad.king at kitware.com
Thu May 8 17:07:20 EDT 2003

> I'd like to suggest a small change to vtkXMLUnstructuredGridWriter.
>  vtkXMLUnstructuredGridWriter::WriteInlinePieceAttributes() should be:
> void vtkXMLUnstructuredGridWriter::WriteInlinePieceAttributes()
> {
>   vtkUnstructuredGrid* input = this->GetInput();
>   this->WriteScalarAttribute("NumberOfPoints",
> input->GetNumberOfPoints());
>   this->WriteScalarAttribute("NumberOfCells",
> input->GetNumberOfCells());
> }
> to have the "NumberOfPoints" added to the <Piece.......> line in the
> output file. Currently, it only prints the "NumberOfCells".

NumberOfPoints is written by


which is the common superclass to vtkXMLUnstructuredGridWriter and
vtkXMLPolyDataWriter.  Your suggestion is acutally a bug-fix, and the
proper fix is to have


call its superclass's implementation of the method:

void vtkXMLUnstructuredGridWriter::WriteInlinePieceAttributes()
  vtkUnstructuredGrid* input = this->GetInput();
  this->WriteScalarAttribute("NumberOfCells", input->GetNumberOfCells());

Note that WriteAppendedPieceAttributes does this already.

I've committed the change.


More information about the vtk-developers mailing list