Commit ccf8a76e authored by Ken Martin's avatar Ken Martin

add getNumberOfPieces to XML Reader, fix progress

The XMLUnstructuredDataReader had no way of querying thenumber
of pieces in the file.

The XMLUnstructuredDataWriter was not correctly reporting progress
when writing pieces. It reported 100% progress after the first
piece.
parent 331df4a5
Pipeline #7127 passed with stage
......@@ -339,6 +339,12 @@ vtkIdType vtkXMLUnstructuredDataReader::GetNumberOfCells()
return this->TotalNumberOfCells;
}
//----------------------------------------------------------------------------
vtkIdType vtkXMLUnstructuredDataReader::GetNumberOfPieces()
{
return this->NumberOfPieces;
}
//----------------------------------------------------------------------------
vtkIdType vtkXMLUnstructuredDataReader::GetNumberOfPointsInPiece(int piece)
{
......
......@@ -45,6 +45,10 @@ public:
// Get the number of cells in the output.
virtual vtkIdType GetNumberOfCells();
// Description:
// Get the number of pieces in the file
virtual vtkIdType GetNumberOfPieces();
// Description:
// Setup the reader as if the given update extent were requested by
// its output. This can be used after an UpdateInformation to
......
......@@ -130,9 +130,8 @@ int vtkXMLUnstructuredDataWriter::ProcessRequest(vtkInformation* request,
}
else
{
float progressRange[2] = {0,0};
this->GetProgressRange(progressRange);
this->SetProgressRange(progressRange, this->CurrentPiece, this->NumberOfPieces);
float wholeProgressRange[2] = {0,1};
this->SetProgressRange(wholeProgressRange, this->CurrentPiece, this->NumberOfPieces);
}
int result = 1;
......@@ -144,8 +143,11 @@ int vtkXMLUnstructuredDataWriter::ProcessRequest(vtkInformation* request,
this->UpdateProgress(0);
// Initialize progress range to entire 0..1 range.
float wholeProgressRange[2] = {0,1};
this->SetProgressRange(wholeProgressRange, 0, 1);
if (this->WritePiece >= 0)
{
float wholeProgressRange[2] = {0,1};
this->SetProgressRange(wholeProgressRange, 0, 1);
}
if (!this->OpenStream())
{
......@@ -230,8 +232,8 @@ int vtkXMLUnstructuredDataWriter::ProcessRequest(vtkInformation* request,
}
this->NumberOfPieces = numPieces;
// We have finished writing.
this->UpdateProgressDiscrete(1);
// We have finished writing (at least this piece)
this->SetProgressPartial(1);
return result;
}
return this->Superclass::ProcessRequest(request, inputVector, outputVector);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment