From 747b780a9678e397e7d29b5ef90f4edd37a6ba49 Mon Sep 17 00:00:00 2001
From: Berk Geveci <berk.geveci@kitware.com>
Date: Wed, 5 Mar 2014 12:58:04 -0500
Subject: [PATCH] Updated filters and sources to work with new pipeline logic.

Change-Id: Id76d3bc545a64675a0820cb1d9b45c61a51efc6a
---
 .../ExecutionModel/vtkCompositeDataPipeline.h |  2 +-
 Filters/Core/vtkDataObjectGenerator.cxx       |  4 +-
 Filters/Core/vtkProbeFilter.cxx               | 49 ------------
 Filters/General/vtkTimeSourceExample.cxx      |  2 +-
 Filters/Hybrid/vtkTemporalFractal.cxx         | 17 +----
 Filters/Sources/vtkArcSource.cxx              |  7 +-
 Filters/Sources/vtkConeSource.cxx             |  8 +-
 Filters/Sources/vtkLineSource.cxx             |  8 +-
 Filters/Sources/vtkRegularPolygonSource.cxx   | 20 -----
 Filters/Sources/vtkSelectionSource.cxx        | 12 +++
 Filters/Sources/vtkSelectionSource.h          |  3 +
 IO/AMR/vtkAMRBaseReader.cxx                   |  1 +
 IO/Geometry/vtkMultiBlockPLOT3DReader.cxx     |  5 --
 IO/Geometry/vtkParticleReader.cxx             | 25 ++++++-
 IO/Geometry/vtkTecplotReader.cxx              |  5 --
 IO/Geometry/vtkWindBladeReader.cxx            |  4 +
 IO/Image/vtkImageReader2.cxx                  |  3 +
 IO/LSDyna/vtkLSDynaReader.cxx                 |  6 --
 IO/NetCDF/vtkNetCDFCAMReader.cxx              |  4 +-
 IO/NetCDF/vtkNetCDFCFReader.cxx               | 10 ++-
 IO/NetCDF/vtkSLACParticleReader.cxx           | 14 ----
 IO/Parallel/vtkPChacoReader.cxx               | 10 +--
 IO/Parallel/vtkPDataSetReader.cxx             | 75 ++++++++-----------
 IO/Parallel/vtkPOpenFOAMReader.cxx            | 14 +---
 IO/Parallel/vtkPOpenFOAMReader.h              |  1 -
 IO/Parallel/vtkPSLACReader.cxx                |  9 +--
 IO/ParallelExodus/vtkPExodusIIReader.cxx      |  8 +-
 IO/ParallelLSDyna/vtkPLSDynaReader.cxx        |  7 +-
 IO/ParallelNetCDF/vtkPNetCDFPOPReader.cxx     |  2 +
 .../Testing/Python/testParallelXMLWriters.py  |  2 +
 IO/VPIC/vtkVPICReader.cxx                     |  6 +-
 IO/VPIC/vtkVPICReader.h                       |  1 -
 IO/XML/vtkXMLCompositeDataReader.cxx          |  8 +-
 IO/XML/vtkXMLPStructuredDataReader.cxx        |  9 +--
 IO/XML/vtkXMLPUnstructuredDataReader.cxx      |  8 +-
 IO/XML/vtkXMLUnstructuredDataReader.cxx       | 10 ---
 IO/XML/vtkXMLUnstructuredDataWriter.cxx       | 13 ----
 IO/Xdmf2/vtkXdmfReader.cxx                    |  2 +-
 38 files changed, 122 insertions(+), 272 deletions(-)

diff --git a/Common/ExecutionModel/vtkCompositeDataPipeline.h b/Common/ExecutionModel/vtkCompositeDataPipeline.h
index a469ce86c68..af70ccfb6ac 100644
--- a/Common/ExecutionModel/vtkCompositeDataPipeline.h
+++ b/Common/ExecutionModel/vtkCompositeDataPipeline.h
@@ -25,7 +25,7 @@
 // the contents of the composite dataset in this pass.
 // Sources that can produce more than one piece (note that a piece is
 // different than a block; each piece consistes of 0 or more blocks) should
-// set MAXIMUM_NUMBER_OF_PIECES to -1.
+// set CAN_HANDLE_PIECE_REQUEST.
 //
 // * REQUEST_UPDATE_EXTENT: This pass is identical to the one implemented
 // in vtkStreamingDemandDrivenPipeline
diff --git a/Filters/Core/vtkDataObjectGenerator.cxx b/Filters/Core/vtkDataObjectGenerator.cxx
index 310d8c86344..a7c535efe32 100644
--- a/Filters/Core/vtkDataObjectGenerator.cxx
+++ b/Filters/Core/vtkDataObjectGenerator.cxx
@@ -428,10 +428,8 @@ int vtkDataObjectGenerator::RequestInformation(vtkInformation *req,
 
   //Say that this filter can break up its output into any number of pieces
   vtkInformation *outInfo = outV->GetInformationObject(0);
-  /*
   outInfo->Set(
-    vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1);
-  */
+    vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
   //If my output is an atomic structured type, fill in the whole extent info
   vtkInternalStructureCache *top = this->Structure->children.front();
diff --git a/Filters/Core/vtkProbeFilter.cxx b/Filters/Core/vtkProbeFilter.cxx
index 3f514432b8d..56dec39fe1b 100644
--- a/Filters/Core/vtkProbeFilter.cxx
+++ b/Filters/Core/vtkProbeFilter.cxx
@@ -398,55 +398,6 @@ int vtkProbeFilter::RequestInformation(
   outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
                inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()),
                6);
-  /*
-  outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-               inInfo->Get(
-                 vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES()));
-  */
-
-  /*
-  // Special case for ParaView.
-  if (this->SpatialMatch == 2)
-    {
-    outInfo->Set(
-      vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-      sourceInfo->Get(
-        vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES()));
-    }
-  */
-
-  if (this->SpatialMatch == 1)
-    {
-    /*
-    //int m1 =
-    //inInfo->Get(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES());
-    //int m2 =
-    //sourceInfo->Get(
-    //vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES());
-    if (m1 < 0 && m2 < 0)
-      {
-      //outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-      //-1);
-      }
-    else
-      {
-      if (m1 < -1)
-        {
-        m1 = VTK_INT_MAX;
-        }
-      if (m2 < -1)
-        {
-        m2 = VTK_INT_MAX;
-        }
-      if (m2 < m1)
-        {
-        m1 = m2;
-        }
-      //outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-      //m1);
-      }
-    */
-    }
 
   // A variation of the bug fix from John Biddiscombe.
   // Make sure that the scalar type and number of components
diff --git a/Filters/General/vtkTimeSourceExample.cxx b/Filters/General/vtkTimeSourceExample.cxx
index a169cafa247..c84ebc26ba8 100644
--- a/Filters/General/vtkTimeSourceExample.cxx
+++ b/Filters/General/vtkTimeSourceExample.cxx
@@ -188,7 +188,7 @@ int vtkTimeSourceExample::RequestInformation(
       );
     }
 
-  //info->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1);
+  info->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
   return 1;
 }
diff --git a/Filters/Hybrid/vtkTemporalFractal.cxx b/Filters/Hybrid/vtkTemporalFractal.cxx
index 3d76cf4d74d..7f94279feb1 100644
--- a/Filters/Hybrid/vtkTemporalFractal.cxx
+++ b/Filters/Hybrid/vtkTemporalFractal.cxx
@@ -489,19 +489,10 @@ int vtkTemporalFractal::ProcessRequest(
   // execute information
   if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))
     {
-    /*
-    if(request->Has(vtkStreamingDemandDrivenPipeline::FROM_OUTPUT_PORT()))
-      {
-      int outputPort = request->Get(
-        vtkStreamingDemandDrivenPipeline::FROM_OUTPUT_PORT());
-      vtkInformation* info = outputVector->GetInformationObject(outputPort);
-      if (info)
-        {
-        info->Set(
-          vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1);
-        }
-      }
-    */
+    vtkInformation* info = outputVector->GetInformationObject(0);
+    info->Set(
+      vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
+
     return this->RequestInformation(request, inputVector, outputVector);
     }
 
diff --git a/Filters/Sources/vtkArcSource.cxx b/Filters/Sources/vtkArcSource.cxx
index 1a12fb00acd..c04b4276ad0 100644
--- a/Filters/Sources/vtkArcSource.cxx
+++ b/Filters/Sources/vtkArcSource.cxx
@@ -79,13 +79,12 @@ vtkArcSource::vtkArcSource(int res)
 int vtkArcSource::RequestInformation(
   vtkInformation *vtkNotUsed(request),
   vtkInformationVector **vtkNotUsed(inputVector),
-  vtkInformationVector *vtkNotUsed(outputVector))
+  vtkInformationVector *outputVector)
 {
-  /*
   // get the info object
   vtkInformation* outInfo = outputVector->GetInformationObject(0);
-  outInfo->Set( vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1 );
-  */
+  outInfo->Set( vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1 );
+
   return 1;
 }
 
diff --git a/Filters/Sources/vtkConeSource.cxx b/Filters/Sources/vtkConeSource.cxx
index d86e77c8df5..4d8b4c0539c 100644
--- a/Filters/Sources/vtkConeSource.cxx
+++ b/Filters/Sources/vtkConeSource.cxx
@@ -304,13 +304,11 @@ int vtkConeSource::RequestData(
 int vtkConeSource::RequestInformation(
   vtkInformation *vtkNotUsed(request),
   vtkInformationVector **vtkNotUsed(inputVector),
-  vtkInformationVector *vtkNotUsed(outputVector))
+  vtkInformationVector *outputVector)
 {
-  /*
   vtkInformation *outInfo = outputVector->GetInformationObject(0);
-  outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-               -1);
-  */
+  outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(),
+               1);
   return 1;
 }
 
diff --git a/Filters/Sources/vtkLineSource.cxx b/Filters/Sources/vtkLineSource.cxx
index 0ffb95ff288..64e2ec57e99 100644
--- a/Filters/Sources/vtkLineSource.cxx
+++ b/Filters/Sources/vtkLineSource.cxx
@@ -58,14 +58,12 @@ vtkLineSource::~vtkLineSource()
 int vtkLineSource::RequestInformation(
   vtkInformation *vtkNotUsed(request),
   vtkInformationVector **vtkNotUsed(inputVector),
-  vtkInformationVector *vtkNotUsed(outputVector))
+  vtkInformationVector *outputVector)
 {
-  /*
   // get the info object
   vtkInformation *outInfo = outputVector->GetInformationObject(0);
-  outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-               -1);
-  */
+  outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(),
+               1);
   return 1;
 }
 
diff --git a/Filters/Sources/vtkRegularPolygonSource.cxx b/Filters/Sources/vtkRegularPolygonSource.cxx
index 66ff9069db3..6330569955e 100644
--- a/Filters/Sources/vtkRegularPolygonSource.cxx
+++ b/Filters/Sources/vtkRegularPolygonSource.cxx
@@ -40,20 +40,6 @@ vtkRegularPolygonSource::vtkRegularPolygonSource()
   this->SetNumberOfInputPorts(0);
 }
 
-int vtkRegularPolygonSource::RequestInformation(
-  vtkInformation *vtkNotUsed(request),
-  vtkInformationVector **vtkNotUsed(inputVector),
-  vtkInformationVector *vtkNotUsed(outputVector))
-{
-  /*
-  // get the info object
-  vtkInformation *outInfo = outputVector->GetInformationObject(0);
-  outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),-1);
-  */
-
-  return 1;
-}
-
 int vtkRegularPolygonSource::RequestData(
   vtkInformation *vtkNotUsed(request),
   vtkInformationVector **vtkNotUsed(inputVector),
@@ -66,12 +52,6 @@ int vtkRegularPolygonSource::RequestData(
   vtkPolyData *output = vtkPolyData::SafeDownCast(
     outInfo->Get(vtkDataObject::DATA_OBJECT()));
 
-  // We only produce one piece
-  if (outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) > 0)
-    {
-    return 1;
-    }
-
   double x[3], r[3];
   int i, j, numPts=this->NumberOfSides;
   vtkPoints *newPoints;
diff --git a/Filters/Sources/vtkSelectionSource.cxx b/Filters/Sources/vtkSelectionSource.cxx
index 25db875e787..a396c3e2878 100644
--- a/Filters/Sources/vtkSelectionSource.cxx
+++ b/Filters/Sources/vtkSelectionSource.cxx
@@ -258,6 +258,18 @@ void vtkSelectionSource::PrintSelf(ostream& os, vtkIndent indent)
   os << indent << "QueryString: " << (this->QueryString ? this->QueryString : "NULL") << endl;
 }
 
+//----------------------------------------------------------------------------
+int vtkSelectionSource::RequestInformation(
+  vtkInformation* vtkNotUsed(request),
+  vtkInformationVector** vtkNotUsed(inputVector),
+  vtkInformationVector* outputVector)
+{
+  vtkInformation* outInfo = outputVector->GetInformationObject(0);
+  outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
+
+  return 1;
+}
+
 //----------------------------------------------------------------------------
 int vtkSelectionSource::RequestData(
   vtkInformation* vtkNotUsed( request ),
diff --git a/Filters/Sources/vtkSelectionSource.h b/Filters/Sources/vtkSelectionSource.h
index cfb85da5e36..395ff224e2c 100644
--- a/Filters/Sources/vtkSelectionSource.h
+++ b/Filters/Sources/vtkSelectionSource.h
@@ -133,6 +133,9 @@ protected:
   vtkSelectionSource();
   ~vtkSelectionSource();
 
+  virtual int RequestInformation(vtkInformation* request,
+                          vtkInformationVector** inputVector,
+                          vtkInformationVector* outputVector);
   virtual int RequestData(vtkInformation* request,
                           vtkInformationVector** inputVector,
                           vtkInformationVector* outputVector);
diff --git a/IO/AMR/vtkAMRBaseReader.cxx b/IO/AMR/vtkAMRBaseReader.cxx
index 91aa33e3e67..a0240ef56b4 100644
--- a/IO/AMR/vtkAMRBaseReader.cxx
+++ b/IO/AMR/vtkAMRBaseReader.cxx
@@ -267,6 +267,7 @@ int vtkAMRBaseReader::RequestInformation(
   this->Metadata->GenerateParentChildInformation();
   vtkTimerLog::MarkEndEvent("vtkAMRBaseReader::GenerateParentChildInformation");
 
+  info->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
   // std::cout<<"Generate Meta Data: ";
   // for(int levelIdx=0 ; levelIdx < this->Metadata->GetNumberOfLevels(); ++levelIdx )
diff --git a/IO/Geometry/vtkMultiBlockPLOT3DReader.cxx b/IO/Geometry/vtkMultiBlockPLOT3DReader.cxx
index b4162a6ea43..dd927c5ff67 100644
--- a/IO/Geometry/vtkMultiBlockPLOT3DReader.cxx
+++ b/IO/Geometry/vtkMultiBlockPLOT3DReader.cxx
@@ -897,11 +897,6 @@ int vtkMultiBlockPLOT3DReader::RequestInformation(
     fclose(qFp);
     }
 
-  /*
-  info->Set(
-    vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), 1);
-  */
-
   return 1;
 }
 
diff --git a/IO/Geometry/vtkParticleReader.cxx b/IO/Geometry/vtkParticleReader.cxx
index e5f2b896793..c9f3b6aedbf 100644
--- a/IO/Geometry/vtkParticleReader.cxx
+++ b/IO/Geometry/vtkParticleReader.cxx
@@ -181,11 +181,28 @@ int vtkParticleReader::RequestInformation(
   vtkInformationVector **vtkNotUsed(inputVector),
   vtkInformationVector *outputVector)
 {
-  // get the info object
-  vtkInformation *outInfo = outputVector->GetInformationObject(0);
+  this->OpenFile();
+  int ft = this->FileType;
+  if ( ft == FILE_TYPE_IS_UNKNOWN )
+    {
+    ft = DetermineFileType();
+    if ( ft == FILE_TYPE_IS_UNKNOWN )
+      {
+      vtkErrorMacro(<< "File type cannot be determined.");
+      return 0;
+      }
+    }
+  this->File->close();
+  delete this->File;
+  this->File = NULL;
 
-  outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(),
-               1);
+
+  if (ft == FILE_TYPE_IS_BINARY)
+    {
+    vtkInformation *outInfo = outputVector->GetInformationObject(0);
+    outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(),
+                 1);
+    }
 
   return 1;
 }
diff --git a/IO/Geometry/vtkTecplotReader.cxx b/IO/Geometry/vtkTecplotReader.cxx
index 70a6cc09768..1682c16a585 100644
--- a/IO/Geometry/vtkTecplotReader.cxx
+++ b/IO/Geometry/vtkTecplotReader.cxx
@@ -582,11 +582,6 @@ int vtkTecplotReader::RequestInformation( vtkInformation * request,
     return 0;
     }
 
-  /*
-  vtkInformation * info = outputVector->GetInformationObject( 0 );
-  info->Set( vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1 );
-  */
-
   this->GetDataArraysList();
 
   return 1;
diff --git a/IO/Geometry/vtkWindBladeReader.cxx b/IO/Geometry/vtkWindBladeReader.cxx
index f1f5e6adce0..19aea574487 100644
--- a/IO/Geometry/vtkWindBladeReader.cxx
+++ b/IO/Geometry/vtkWindBladeReader.cxx
@@ -332,13 +332,17 @@ int vtkWindBladeReader::RequestInformation(vtkInformation* reqInfo,
     field->SetDimensions(this->Dimension);
     fieldInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
                    this->WholeExtent, 6);
+    fieldInfo->Set(CAN_PRODUCE_SUB_EXTENT(),1);
 
     ground->SetDimensions(this->GDimension);
     groundInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
                    this->GExtent, 6);
+    groundInfo->Set(CAN_PRODUCE_SUB_EXTENT(),1);
 
     bladeInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
                    this->WholeExtent, 6);
+    // Simply loads the blade on all processes
+    bladeInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
     // Create the rectilinear coordinate spacing for entire problem
     this->CreateCoordinates();
diff --git a/IO/Image/vtkImageReader2.cxx b/IO/Image/vtkImageReader2.cxx
index 630bc1fff12..0e172f4e999 100644
--- a/IO/Image/vtkImageReader2.cxx
+++ b/IO/Image/vtkImageReader2.cxx
@@ -538,6 +538,9 @@ int vtkImageReader2::RequestInformation (
 
   vtkDataObject::SetPointDataActiveScalarInfo(outInfo, this->DataScalarType,
     this->NumberOfScalarComponents);
+
+  outInfo->Set(CAN_PRODUCE_SUB_EXTENT(), 1);
+
   return 1;
 }
 
diff --git a/IO/LSDyna/vtkLSDynaReader.cxx b/IO/LSDyna/vtkLSDynaReader.cxx
index ec5b398c2f7..88fc2ba39e1 100644
--- a/IO/LSDyna/vtkLSDynaReader.cxx
+++ b/IO/LSDyna/vtkLSDynaReader.cxx
@@ -2367,12 +2367,6 @@ int vtkLSDynaReader::RequestInformation( vtkInformation* vtkNotUsed(request),
   timeRange[1] = p->TimeValues[p->TimeValues.size() - 1];
   outInfo->Set( vtkStreamingDemandDrivenPipeline::TIME_RANGE(), timeRange, 2 );
 
-  /*
-  // Currently, this is a serial reader.
-  outInfo->Set(
-    vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), 1);
-  */
-
   return 1;
 }
 
diff --git a/IO/NetCDF/vtkNetCDFCAMReader.cxx b/IO/NetCDF/vtkNetCDFCAMReader.cxx
index 01e79c6a09e..e8a59dd2c5a 100644
--- a/IO/NetCDF/vtkNetCDFCAMReader.cxx
+++ b/IO/NetCDF/vtkNetCDFCAMReader.cxx
@@ -246,10 +246,8 @@ int vtkNetCDFCAMReader::RequestInformation(
     outInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_RANGE());
     }
 
-  /*
   outInfo->Set(
-    vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1);
-  */
+    vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
   return 1;
 }
diff --git a/IO/NetCDF/vtkNetCDFCFReader.cxx b/IO/NetCDF/vtkNetCDFCFReader.cxx
index 256b52a93d0..47dc9511e59 100644
--- a/IO/NetCDF/vtkNetCDFCFReader.cxx
+++ b/IO/NetCDF/vtkNetCDFCFReader.cxx
@@ -992,17 +992,19 @@ int vtkNetCDFCFReader::RequestInformation(vtkInformation *request,
     return 0;
     }
 
-  /*
   // Superclass understands structured data, but we have to handle unstructured
   // "extents" (pieces).
   vtkInformation *outInfo = outputVector->GetInformationObject(0);
   vtkDataObject *output = vtkDataObject::GetData(outInfo);
-  if (output && (output->GetExtentType() != VTK_3D_EXTENT))
+  if (output->GetExtentType() != VTK_3D_EXTENT)
     {
     outInfo->Set(
-              vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1);
+              vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
+    }
+  else
+    {
+    outInfo->Set(CAN_PRODUCE_SUB_EXTENT(), 1);
     }
-  */
 
   return 1;
 }
diff --git a/IO/NetCDF/vtkSLACParticleReader.cxx b/IO/NetCDF/vtkSLACParticleReader.cxx
index 613a28a332e..5d85cafb0eb 100644
--- a/IO/NetCDF/vtkSLACParticleReader.cxx
+++ b/IO/NetCDF/vtkSLACParticleReader.cxx
@@ -257,12 +257,6 @@ int vtkSLACParticleReader::RequestInformation(
   timeRange[0] = timeRange[1] = timeValue;
   outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(), timeRange, 2);
 
-  /*
-  // Report that we support any number of pieces (but we are only really going
-  // to load anything for piece 0).
-  outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1);
-  */
-
   return 1;
 }
 
@@ -279,14 +273,6 @@ int vtkSLACParticleReader::RequestData(vtkInformation *vtkNotUsed(request),
     return 0;
     }
 
-  vtkInformation *outInfo = outputVector->GetInformationObject(0);
-  int requestedPiece = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER());
-  if (requestedPiece != 0)
-    {
-    // Return empty data for all but piece 0.
-    return 1;
-    }
-
   vtkSLACParticleReaderAutoCloseNetCDF ncFD(this->FileName, NC_NOWRITE);
   if (!ncFD.Valid()) return 0;
 
diff --git a/IO/Parallel/vtkPChacoReader.cxx b/IO/Parallel/vtkPChacoReader.cxx
index dc85e5eb083..fed931b7a3b 100644
--- a/IO/Parallel/vtkPChacoReader.cxx
+++ b/IO/Parallel/vtkPChacoReader.cxx
@@ -98,14 +98,8 @@ int vtkPChacoReader::RequestInformation(
     return 0;
     }
 
-  // Setting maximum number of pieces to -1 indicates to the
-  // upstream consumer that I can provide the same number of pieces
-  // as there are number of processors
-  // get the info object
-
-  //vtkInformation *outInfo = outputVector->GetInformationObject(0);
-  //outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-  //-1);
+  vtkInformation *outInfo = outputVector->GetInformationObject(0);
+  outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
   int retVal = 1;
 
diff --git a/IO/Parallel/vtkPDataSetReader.cxx b/IO/Parallel/vtkPDataSetReader.cxx
index bda6fbbe1cd..9fa99d1f860 100644
--- a/IO/Parallel/vtkPDataSetReader.cxx
+++ b/IO/Parallel/vtkPDataSetReader.cxx
@@ -518,14 +518,6 @@ void vtkPDataSetReader::ReadPVTKFileInformation(
     if (strcmp(param, "numberOfPieces") == 0)
       {
       this->SetNumberOfPieces(atoi(val));
-      /*
-      if (! this->StructuredFlag)
-        {
-        info->Set(
-          vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-          this->NumberOfPieces);
-        }
-      */
       }
 
     // Handle parameter: wholeExtent.
@@ -764,12 +756,6 @@ void vtkPDataSetReader::ReadVTKFileInformation(
     vtkErrorMacro("I can not figure out what type of data set this is: " << str);
     return;
     }
-  /*
-  if (this->DataType == VTK_POLY_DATA || this->DataType == VTK_UNSTRUCTURED_GRID)
-    {
-    info->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), 1);
-    }
-  */
 }
 
 void vtkPDataSetReader::SkipFieldData(ifstream *file)
@@ -911,39 +897,42 @@ int vtkPDataSetReader::RequestData(vtkInformation* request,
 
   if (this->VTKFileFlag)
     {
-    vtkDataSetReader *reader = vtkDataSetReader::New();
-    reader->ReadAllScalarsOn();
-    reader->ReadAllVectorsOn();
-    reader->ReadAllNormalsOn();
-    reader->ReadAllTensorsOn();
-    reader->ReadAllColorScalarsOn();
-    reader->ReadAllTCoordsOn();
-    reader->ReadAllFieldsOn();
-    reader->SetFileName(this->FileName);
-    reader->Update();
-    vtkDataSet *data = reader->GetOutput();
-
-    if (data == NULL)
+    int updatePiece = vtkStreamingDemandDrivenPipeline::GetUpdatePiece(info);
+    if (updatePiece == 0)
       {
-      vtkErrorMacro("Could not read file: " << this->FileName);
-      return 0;
-      }
-//    data->Update();
+      vtkDataSetReader *reader = vtkDataSetReader::New();
+      reader->ReadAllScalarsOn();
+      reader->ReadAllVectorsOn();
+      reader->ReadAllNormalsOn();
+      reader->ReadAllTensorsOn();
+      reader->ReadAllColorScalarsOn();
+      reader->ReadAllTCoordsOn();
+      reader->ReadAllFieldsOn();
+      reader->SetFileName(this->FileName);
+      reader->Update();
+      vtkDataSet *data = reader->GetOutput();
 
-    if (data->CheckAttributes())
-      {
-      vtkErrorMacro("Attribute Mismatch.");
-      return 0;
-      }
+      if (data == NULL)
+        {
+        vtkErrorMacro("Could not read file: " << this->FileName);
+        return 0;
+        }
 
-    output->CopyStructure(data);
-    output->GetFieldData()->PassData(data->GetFieldData());
-    output->GetCellData()->PassData(data->GetCellData());
-    output->GetPointData()->PassData(data->GetPointData());
-    this->SetNumberOfPieces(0);
+      if (data->CheckAttributes())
+        {
+        vtkErrorMacro("Attribute Mismatch.");
+        return 0;
+        }
 
-    reader->Delete();
-    return 1;
+      output->CopyStructure(data);
+      output->GetFieldData()->PassData(data->GetFieldData());
+      output->GetCellData()->PassData(data->GetCellData());
+      output->GetPointData()->PassData(data->GetPointData());
+      this->SetNumberOfPieces(0);
+
+      reader->Delete();
+      }
+      return 1;
     }
 
   switch (this->DataType)
diff --git a/IO/Parallel/vtkPOpenFOAMReader.cxx b/IO/Parallel/vtkPOpenFOAMReader.cxx
index e77bb421788..315cdef7b9b 100644
--- a/IO/Parallel/vtkPOpenFOAMReader.cxx
+++ b/IO/Parallel/vtkPOpenFOAMReader.cxx
@@ -55,7 +55,6 @@ vtkPOpenFOAMReader::vtkPOpenFOAMReader()
     }
   this->CaseType = RECONSTRUCTED_CASE;
   this->MTimeOld = 0;
-  this->MaximumNumberOfPieces = 1;
 }
 
 //-----------------------------------------------------------------------------
@@ -70,8 +69,6 @@ void vtkPOpenFOAMReader::PrintSelf(ostream &os, vtkIndent indent)
   this->Superclass::PrintSelf(os, indent);
   os << indent << "Case Type: " << this->CaseType << endl;
   os << indent << "MTimeOld: " << this->MTimeOld << endl;
-  os << indent << "Maximum Number of Pieces: " << this->MaximumNumberOfPieces
-      << endl;
   os << indent << "Number of Processes: " << this->NumProcesses << endl;
   os << indent << "Process Id: " << this->ProcessId << endl;
   os << indent << "Controller: " << this->Controller << endl;
@@ -258,8 +255,6 @@ int vtkPOpenFOAMReader::RequestInformation(vtkInformation *request,
       timeValues->Delete();
       }
 
-    this->MaximumNumberOfPieces = procNames->GetNumberOfTuples();
-
     // create reader instances for other processor subdirectories
     // skip processor0 since it's already created
     for (int procI = (this->ProcessId ? this->ProcessId : this->NumProcesses); procI
@@ -288,12 +283,9 @@ int vtkPOpenFOAMReader::RequestInformation(vtkInformation *request,
     this->Superclass::Refresh = false;
     }
 
-  /*
-  // it seems MAXIMUM_NUMBER_OF_PIECES must be returned every time
-  // RequestInformation() is called
-  outputVector->GetInformationObject(0)->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-      this->MaximumNumberOfPieces);
-  */
+  outputVector->GetInformationObject(0)->Set(
+    vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(),
+    1);
 
   return 1;
 }
diff --git a/IO/Parallel/vtkPOpenFOAMReader.h b/IO/Parallel/vtkPOpenFOAMReader.h
index afa5e465ead..c7b701ccf7d 100644
--- a/IO/Parallel/vtkPOpenFOAMReader.h
+++ b/IO/Parallel/vtkPOpenFOAMReader.h
@@ -66,7 +66,6 @@ private:
   vtkMultiProcessController *Controller;
   caseType CaseType;
   unsigned long MTimeOld;
-  int MaximumNumberOfPieces;
   int NumProcesses;
   int ProcessId;
 
diff --git a/IO/Parallel/vtkPSLACReader.cxx b/IO/Parallel/vtkPSLACReader.cxx
index 07205da9cfe..a55ccafaf03 100644
--- a/IO/Parallel/vtkPSLACReader.cxx
+++ b/IO/Parallel/vtkPSLACReader.cxx
@@ -417,17 +417,12 @@ int vtkPSLACReader::RequestInformation(vtkInformation *request,
     return 0;
     }
 
-  /*
-  // We only work if each process requests the piece corresponding to its
-  // own local process id.  Hint at this by saying that we support the same
-  // amount of pieces as processes.
   for (int i = 0; i < vtkPSLACReader::NUM_OUTPUTS; i++)
     {
     vtkInformation *outInfo = outputVector->GetInformationObject(i);
-    outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-                 this->Controller->GetNumberOfProcesses());
+    outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(),
+                 1);
     }
-  */
 
   return 1;
 }
diff --git a/IO/ParallelExodus/vtkPExodusIIReader.cxx b/IO/ParallelExodus/vtkPExodusIIReader.cxx
index 58174e705c7..d48285fb7da 100644
--- a/IO/ParallelExodus/vtkPExodusIIReader.cxx
+++ b/IO/ParallelExodus/vtkPExodusIIReader.cxx
@@ -237,13 +237,9 @@ int vtkPExodusIIReader::RequestInformation(
   vtkInformationVector** inputVector,
   vtkInformationVector* outputVector )
 {
-  // Setting maximum number of pieces to -1 indicates to the
-  // upstream consumer that I can provide the same number of pieces
-  // as there are number of processors
-  // get the info object
   vtkInformation* outInfo = outputVector->GetInformationObject( 0 );
-  //outInfo->Set(
-  //vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1 );
+  outInfo->Set(
+   vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
 #ifdef DBG_PEXOIIRDR
   this->Controller->Barrier();
diff --git a/IO/ParallelLSDyna/vtkPLSDynaReader.cxx b/IO/ParallelLSDyna/vtkPLSDynaReader.cxx
index 251790f64eb..226b258c9c8 100644
--- a/IO/ParallelLSDyna/vtkPLSDynaReader.cxx
+++ b/IO/ParallelLSDyna/vtkPLSDynaReader.cxx
@@ -139,11 +139,8 @@ int vtkPLSDynaReader::RequestInformation( vtkInformation* request,
   //be a massive chunk of code
   this->Superclass::RequestInformation(request,iinfo,outputVector);
 
-  /*
-  //force an override of the serial reader setting the number of pieces to 1
-  outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-              -1);
-  */
+  outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(),
+               1);
   return 1;
 }
 
diff --git a/IO/ParallelNetCDF/vtkPNetCDFPOPReader.cxx b/IO/ParallelNetCDF/vtkPNetCDFPOPReader.cxx
index 31b4cea9bed..1f4666c92d6 100644
--- a/IO/ParallelNetCDF/vtkPNetCDFPOPReader.cxx
+++ b/IO/ParallelNetCDF/vtkPNetCDFPOPReader.cxx
@@ -288,6 +288,8 @@ int vtkPNetCDFPOPReader::RequestInformation(
 
   //fill in the extent information
   outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),extent,6);
+  outInfo->Set(CAN_PRODUCE_SUB_EXTENT(), 1);
+
   return 1;
 }
 
diff --git a/IO/ParallelXML/Testing/Python/testParallelXMLWriters.py b/IO/ParallelXML/Testing/Python/testParallelXMLWriters.py
index afb19230e05..ea271eacd20 100644
--- a/IO/ParallelXML/Testing/Python/testParallelXMLWriters.py
+++ b/IO/ParallelXML/Testing/Python/testParallelXMLWriters.py
@@ -113,6 +113,8 @@ def TestDataType(dataType, reader, writer, ext, numTris):
 
     cf = vtk.vtkContourFilter()
     cf.SetValue(0, 130)
+    cf.SetComputeNormals(0)
+    cf.SetComputeGradients(0)
     cf.SetInputConnection(reader.GetOutputPort())
     cf.UpdateInformation()
     cf.GetOutputInformation(0).Set(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_NUMBER_OF_PIECES(), nranks)
diff --git a/IO/VPIC/vtkVPICReader.cxx b/IO/VPIC/vtkVPICReader.cxx
index a79028b4e61..2a8012e4803 100644
--- a/IO/VPIC/vtkVPICReader.cxx
+++ b/IO/VPIC/vtkVPICReader.cxx
@@ -204,10 +204,8 @@ int vtkVPICReader::RequestInformation(
     this->YLayout[0] = 0;       this->YLayout[1] = layoutSize[1] - 1;
     this->ZLayout[0] = 0;       this->ZLayout[1] = layoutSize[2] - 1;
 
-    // Maximum number of pieces (processors) is number of files
-    this->NumberOfPieces = this->vpicData->getNumberOfParts();
-    //outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-    //this->NumberOfPieces);
+    outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(),
+     1);
 
     // Collect temporal information
     this->NumberOfTimeSteps = this->vpicData->getNumberOfTimeSteps();
diff --git a/IO/VPIC/vtkVPICReader.h b/IO/VPIC/vtkVPICReader.h
index fd71cd1e33f..72d15488e97 100644
--- a/IO/VPIC/vtkVPICReader.h
+++ b/IO/VPIC/vtkVPICReader.h
@@ -97,7 +97,6 @@ protected:
   VPICDataSet* vpicData;                // Data structure controlling access
   GridExchange* exchanger;		// Exchange ghost cells between procs
 
-  int NumberOfPieces;                   // Number of files in dataset
   vtkIdType NumberOfNodes;              // Number of points in grid
   vtkIdType NumberOfCells;              // Number of cells in grid
   vtkIdType NumberOfTuples;             // Number of tuples in sub extent
diff --git a/IO/XML/vtkXMLCompositeDataReader.cxx b/IO/XML/vtkXMLCompositeDataReader.cxx
index ce391a6f2dd..d9462b8670f 100644
--- a/IO/XML/vtkXMLCompositeDataReader.cxx
+++ b/IO/XML/vtkXMLCompositeDataReader.cxx
@@ -384,11 +384,9 @@ int vtkXMLCompositeDataReader::RequestInformation(
 {
   this->Superclass::RequestInformation(request, inputVector, outputVector);
 
-  /*
- vtkInformation* info = outputVector->GetInformationObject(0);
-  info->Set(
-    vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1);
-  */
+  vtkInformation* info = outputVector->GetInformationObject(0);
+   info->Set(
+     vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
   return 1;
 }
diff --git a/IO/XML/vtkXMLPStructuredDataReader.cxx b/IO/XML/vtkXMLPStructuredDataReader.cxx
index 515e0c4336a..d8ff53abd14 100644
--- a/IO/XML/vtkXMLPStructuredDataReader.cxx
+++ b/IO/XML/vtkXMLPStructuredDataReader.cxx
@@ -184,14 +184,7 @@ int vtkXMLPStructuredDataReader::RequestInformation(vtkInformation *request,
     vtkInformationVector **inputVector,
     vtkInformationVector *outputVector)
 {
-
-  // Tell the output to use the table extent translator to provide the
-  // correct piece breakdown for the file layout.
-  /*
-  outputVector->GetInformationObject(0)->Set(
-      vtkStreamingDemandDrivenPipeline::EXTENT_TRANSLATOR(),
-      this->ExtentTranslator);
-   */
+  outputVector->GetInformationObject(0)->Set(CAN_PRODUCE_SUB_EXTENT(), 1);
 
   return this->Superclass::RequestInformation(
       request, inputVector, outputVector);
diff --git a/IO/XML/vtkXMLPUnstructuredDataReader.cxx b/IO/XML/vtkXMLPUnstructuredDataReader.cxx
index f0e517323d8..9ffcff4d9cf 100644
--- a/IO/XML/vtkXMLPUnstructuredDataReader.cxx
+++ b/IO/XML/vtkXMLPUnstructuredDataReader.cxx
@@ -130,19 +130,13 @@ void vtkXMLPUnstructuredDataReader::SetupOutputInformation(vtkInformation *outIn
 {
   this->Superclass::SetupOutputInformation(outInfo);
 
-  // Set the maximum number of pieces that can be provided by this
-  // reader.
-  //outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), this->NumberOfPieces);
+  outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 }
 
 //----------------------------------------------------------------------------
 void vtkXMLPUnstructuredDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
 {
   this->Superclass::CopyOutputInformation(outInfo, port);
-  //vtkInformation *localInfo =
-  //this->GetExecutive()->GetOutputInformation( port );
-  //outInfo->CopyEntry(localInfo,
-  //vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES() );
 }
 
 //----------------------------------------------------------------------------
diff --git a/IO/XML/vtkXMLUnstructuredDataReader.cxx b/IO/XML/vtkXMLUnstructuredDataReader.cxx
index 188e5453737..495560fcd36 100644
--- a/IO/XML/vtkXMLUnstructuredDataReader.cxx
+++ b/IO/XML/vtkXMLUnstructuredDataReader.cxx
@@ -356,10 +356,6 @@ void vtkXMLUnstructuredDataReader::SetupOutputInformation(vtkInformation *outInf
     {
     outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
     }
-  // Set the maximum number of pieces that can be provided by this
-  // reader.
-  //outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),
-  //this->NumberOfPieces);
 }
 
 
@@ -367,12 +363,6 @@ void vtkXMLUnstructuredDataReader::SetupOutputInformation(vtkInformation *outInf
 void vtkXMLUnstructuredDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
 {
   this->Superclass::CopyOutputInformation(outInfo, port);
-  /*
-  vtkInformation *localInfo =
-    this->GetExecutive()->GetOutputInformation( port );
-  outInfo->CopyEntry(localInfo,
-    vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES() );
-  */
 }
 
 
diff --git a/IO/XML/vtkXMLUnstructuredDataWriter.cxx b/IO/XML/vtkXMLUnstructuredDataWriter.cxx
index 117401a8bb1..2a6f3d65b7a 100644
--- a/IO/XML/vtkXMLUnstructuredDataWriter.cxx
+++ b/IO/XML/vtkXMLUnstructuredDataWriter.cxx
@@ -121,20 +121,7 @@ int vtkXMLUnstructuredDataWriter::ProcessRequest(vtkInformation* request,
       return 0;
       }
 
-    // We don't want to write more pieces than the pipeline can produce,
-    // but we need to preserve the user's requested number of pieces in
-    // case the input changes later.  If MaximumNumberOfPieces is lower
-    // than 1, any number of pieces can be produced by the pipeline.
-    //vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
     int numPieces = this->NumberOfPieces;
-    /*
-    int maxPieces =
-      inInfo->Get(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES());
-    if((maxPieces > 0) && (this->NumberOfPieces > maxPieces))
-      {
-      this->NumberOfPieces = maxPieces;
-      }
-    */
 
     if (this->WritePiece >= 0)
       {
diff --git a/IO/Xdmf2/vtkXdmfReader.cxx b/IO/Xdmf2/vtkXdmfReader.cxx
index b78f9822878..8a1a7670551 100644
--- a/IO/Xdmf2/vtkXdmfReader.cxx
+++ b/IO/Xdmf2/vtkXdmfReader.cxx
@@ -272,7 +272,7 @@ int vtkXdmfReader::RequestInformation(vtkInformation *, vtkInformationVector **,
   vtkXdmfDomain* domain = this->XdmfDocument->GetActiveDomain();
 
   // * Publish the fact that this reader can satisfy any piece request.
-  //outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), -1);
+  outInfo->Set(vtkStreamingDemandDrivenPipeline::CAN_HANDLE_PIECE_REQUEST(), 1);
 
   this->LastTimeIndex = this->ChooseTimeStep(outInfo);
 
-- 
GitLab