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

Stucky, Mark B UTRC StuckyMB at utrc.utc.com
Thu Nov 9 11:21:07 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061109/ebe8fd82/attachment.htm>


More information about the vtkusers mailing list