Commit e47aa66c authored by Brad King's avatar Brad King
Browse files

BUG: Fixed divide by zero in progress calculations for empty data.

parent 57ec219b
......@@ -23,7 +23,7 @@
#include "vtkUnsignedCharArray.h"
#include "vtkCellArray.h"
vtkCxxRevisionMacro(vtkXMLPolyDataReader, "1.3");
vtkCxxRevisionMacro(vtkXMLPolyDataReader, "1.4");
vtkStandardNewMacro(vtkXMLPolyDataReader);
//----------------------------------------------------------------------------
......@@ -390,15 +390,16 @@ int vtkXMLPolyDataReader::ReadArrayForCells(vtkXMLDataElement* da,
// be read for each type of cell.
float progressRange[2] = {0,0};
this->GetProgressRange(progressRange);
int total = this->TotalNumberOfCells?this->TotalNumberOfCells:1;
float fractions[5] =
{
0,
float(this->NumberOfVerts[this->Piece])/this->TotalNumberOfCells,
float(this->NumberOfVerts[this->Piece])/total,
float(this->NumberOfVerts[this->Piece]+
this->NumberOfLines[this->Piece])/this->TotalNumberOfCells,
this->NumberOfLines[this->Piece])/total,
float(this->NumberOfVerts[this->Piece]+
this->NumberOfLines[this->Piece]+
this->NumberOfStrips[this->Piece])/this->TotalNumberOfCells,
this->NumberOfStrips[this->Piece])/total,
1
};
......
......@@ -28,7 +28,7 @@
#include "vtkUnsignedCharArray.h"
#include "vtkZLibDataCompressor.h"
vtkCxxRevisionMacro(vtkXMLWriter, "1.19");
vtkCxxRevisionMacro(vtkXMLWriter, "1.20");
vtkCxxSetObjectMacro(vtkXMLWriter, Compressor, vtkDataCompressor);
//----------------------------------------------------------------------------
......@@ -1433,6 +1433,10 @@ void vtkXMLWriter::WriteCoordinatesInline(vtkDataArray* xc, vtkDataArray* yc,
vtkIdType total = (oxc->GetNumberOfTuples()+
oyc->GetNumberOfTuples()+
ozc->GetNumberOfTuples());
if(total == 0)
{
total = 1;
}
float fractions[4] =
{
0,
......@@ -1497,6 +1501,10 @@ void vtkXMLWriter::WriteCoordinatesAppendedData(vtkDataArray* xc,
vtkIdType total = (oxc->GetNumberOfTuples()+
oyc->GetNumberOfTuples()+
ozc->GetNumberOfTuples());
if(total == 0)
{
total = 1;
}
float fractions[4] =
{
0,
......
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