示例#1
0
 def RequestData(self, request, inVector, outVector):
     for outputPort in range(self.GetNumberOfOutputPorts()):
         oi = outVector.GetInformationObject(outputPort)
         if (oi.Has(vtkStreamingDemandDrivenPipeline.UPDATE_PIECE_NUMBER())
                 and oi.Has(vtkStreamingDemandDrivenPipeline.
                            UPDATE_NUMBER_OF_PIECES())):
             requestedPiece = oi.Get(
                 vtkStreamingDemandDrivenPipeline.UPDATE_PIECE_NUMBER())
             numberOfPieces = oi.Get(
                 vtkStreamingDemandDrivenPipeline.UPDATE_NUMBER_OF_PIECES())
             if requestedPiece != self._mpi_rank or\
                numberOfPieces != self._mpi_size:
                 print("Warning: Process numbers do not match "
                       "piece numbers {} != {}".format(
                           self._mpi_rank, requestedPiece))
         output = oi.Get(vtkDataObject.DATA_OBJECT())
         data = ascent_to_vtk(self._node, self._topologies[outputPort],
                              self._extent)
         output.ShallowCopy(data)
     return 1
示例#2
0
 def GetOutputData(self, outInfo, i):
     """Convenience method that returns an output data object
     given an information object and an index."""
     return outInfo.GetInformationObject(i).Get(vtkDataObject.DATA_OBJECT())
示例#3
0
    def GetInputData(self, inInfo, i, j):
        """Convenience method that returns an input data object
        given a vector of information objects and two indices."""

        return inInfo[i].GetInformationObject(j).Get(
            vtkDataObject.DATA_OBJECT())