[vtkusers] Bug in the vktPlot3DReader when reading multiblock files with FORTRAN byte count

Ulfar Mani Fridjonsson ulfar.mani.fridjonsson at uni-c.dk
Thu Mar 6 13:18:41 EST 2003


There is a bug in vtkPlot3DReader.cxx. While reading the multi block q files
the funktion ReadQHeader does not skip the second FORTRAN byte count after
having read the dimensions for each block. Wich causes the dimensions to be
read incorrectly resulting in a read error for this kind of files.
The funktion should be:
int vtkPLOT3DReader::ReadQHeader(FILE* fp)

{

 int numGrid = this->GetNumberOfOutputsInternal(fp, 0);

vtkDebugMacro("Q number of grids: " << numGrid);

if ( numGrid == 0 )

{

return VTK_ERROR;

}

this->SkipByteCount(fp);

for(int i=0; i<numGrid; i++)

{

int ni, nj, nk;

this->ReadIntBlock(fp, 1, &ni);

this->ReadIntBlock(fp, 1, &nj);

this->ReadIntBlock(fp, 1, &nk);

this->SkipByteCount(fp); //here is where the byte count should be skipped
and not outside the loop

vtkDebugMacro("Q, block " << i << " dimensions: "

<< ni << " " << nj << " " << nk);

int extent[6];

this->GetOutput(i)->GetWholeExtent(extent);

if ( extent[1] != ni-1 || extent[3] != nj-1 || extent[5] != nk-1)

{

this->SetErrorCode(vtkErrorCode::FileFormatError);

vtkErrorMacro("Geometry and data dimensions do not match. "

"Data file may be corrupt.");

//here is where the skip used to be.

return VTK_ERROR;

}

}


return VTK_OK;

}

I'm not quite sure how to submit code yet. But I' hope this submission will
be of help.

Best regards Ulfar Fridjonsson




More information about the vtkusers mailing list