[vtkusers] Bug in vtkPlot3DReader.cxx and in vtkMultiBlockPLOT3DReader.cxx

mstucky5 at cox.net mstucky5 at cox.net
Thu Nov 9 13:33:12 EST 2006



There appears to be a bug in both vtkPlot3DReader.cxx and
vtkMultiBlockPLOT3DReader.cxx

The function "ReadQHeader" (in both files) does not properly
handle 2D geometries.  

     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);

The above incorrectly attempts to read "nk" whether the
data is 2D or 3D.  The above should be changed to test
for the 2D case :

       for(i=0; i<numGrid; i++)
         {
         int ni, nj, nk;
         this->ReadIntBlock(fp, 1, &ni);
         this->ReadIntBlock(fp, 1, &nj);
         if (!this->TwoDimensionalGeometry)
           {
           this->ReadIntBlock(fp, 1, &nk);
           }
         else
           {
           nk = 1;
           }

This is how it is correctly handled in the function 
"ReadGeometryHeader".

Regards,

--Mark Stucky




More information about the vtkusers mailing list