Commit 3923138d authored by Dave Demarle's avatar Dave Demarle
Browse files

STYLE: Remove redundant filters that I introduced a couple of weeks ago....

STYLE: Remove redundant filters that I introduced a couple of weeks ago. Replace all uses of them with the originals.
parent f4755a20
......@@ -61,9 +61,6 @@ vtkDummyController.cxx
vtkEnSightWriter.cxx
vtkExtractCTHPart.cxx
vtkExtractHierarchicalDataPiece.cxx
vtkExtractImageDataPiece.cxx
vtkExtractRectilinearGridPiece.cxx
vtkExtractStructuredGridPiece.cxx
vtkExtractPolyDataPiece.cxx
vtkExtractUnstructuredGridPiece.cxx
vtkExtractUserDefinedPiece.cxx
......
......@@ -13,7 +13,7 @@
=========================================================================*/
// Test of vtkTransmitRectilinearGrid and vtkExtractRectilinearGrid.
// Tests vtkTransmitRectilinearGrid.
#include "vtkTestUtilities.h"
#include "vtkRegressionTestImage.h"
......
......@@ -13,7 +13,7 @@
=========================================================================*/
// Test of vtkTransmitStructuredGrid and vtkExtractStructuredGrid.
// Tests vtkTransmitStructuredGrid.
#include "vtkTestUtilities.h"
#include "vtkRegressionTestImage.h"
......
......@@ -15,10 +15,10 @@
#include "vtkExtractHierarchicalDataPiece.h"
#include "vtkExtentTranslator.h"
#include "vtkExtractImageDataPiece.h"
#include "vtkImageClip.h"
#include "vtkExtractPolyDataPiece.h"
#include "vtkExtractRectilinearGridPiece.h"
#include "vtkExtractStructuredGridPiece.h"
#include "vtkExtractRectilinearGrid.h"
#include "vtkExtractGrid.h"
#include "vtkExtractUnstructuredGridPiece.h"
#include "vtkHierarchicalDataSet.h"
#include "vtkImageData.h"
......@@ -31,7 +31,7 @@
#include "vtkStructuredGrid.h"
#include "vtkUnstructuredGrid.h"
vtkCxxRevisionMacro(vtkExtractHierarchicalDataPiece, "1.1");
vtkCxxRevisionMacro(vtkExtractHierarchicalDataPiece, "1.2");
vtkStandardNewMacro(vtkExtractHierarchicalDataPiece);
int vtkExtractHierarchicalDataPiece::RequestData(
......@@ -115,7 +115,8 @@ void vtkExtractHierarchicalDataPiece::ExtractImageData(
vtkInformation *extractInfo;
int ext[6];
vtkExtractImageDataPiece *extractID = vtkExtractImageDataPiece::New();
vtkImageClip *extractID = vtkImageClip::New();
extractID->ClipDataOn();
imageData->GetExtent(ext);
vtkExtentTranslator *translate = vtkExtentTranslator::New();
......@@ -175,8 +176,8 @@ void vtkExtractHierarchicalDataPiece::ExtractRectilinearGrid(
vtkInformation *extractInfo;
int ext[6];
vtkExtractRectilinearGridPiece *extractRG =
vtkExtractRectilinearGridPiece::New();
vtkExtractRectilinearGrid *extractRG =
vtkExtractRectilinearGrid::New();
rGrid->GetExtent(ext);
vtkExtentTranslator *translate = vtkExtentTranslator::New();
......@@ -210,8 +211,8 @@ void vtkExtractHierarchicalDataPiece::ExtractStructuredGrid(
vtkInformation *extractInfo;
int ext[6];
vtkExtractStructuredGridPiece *extractSG =
vtkExtractStructuredGridPiece::New();
vtkExtractGrid *extractSG =
vtkExtractGrid::New();
sGrid->GetExtent(ext);
vtkExtentTranslator *translate = vtkExtentTranslator::New();
......
......@@ -15,7 +15,7 @@
// .NAME vtkExtractHierarchicalDataPiece
// .SECTION Description
// vtkExtractHierarchicalDataPiece returns the appropriate piece of each
// sub-dataset in the vtkHierarchicalDataSet by requesting it from process 0.
// sub-dataset in the vtkHierarchicalDataSet.
// This filter can handle sub-datasets of type vtkImageData, vtkPolyData,
// vtkRectilinearGrid, vtkStructuredGrid, and vtkUnstructuredGrid; it does
// not handle sub-grids of type vtkHierarchicalDataSet.
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkExtractImageDataPiece.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkExtractImageDataPiece.h"
#include "vtkCell.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkGenericCell.h"
#include "vtkIdList.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkIntArray.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkUnsignedCharArray.h"
#include "vtkImageData.h"
#include "vtkDoubleArray.h"
vtkCxxRevisionMacro(vtkExtractImageDataPiece, "1.1");
vtkStandardNewMacro(vtkExtractImageDataPiece);
int vtkExtractImageDataPiece::RequestUpdateExtent(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *vtkNotUsed(outputVector))
{
// get the info object
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()),
6);
return 1;
}
int vtkExtractImageDataPiece::RequestData(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation *outInfo = outputVector->GetInformationObject(0);
vtkImageData *input = vtkImageData::SafeDownCast(
inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkImageData *output = vtkImageData::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
// Decide what to extract.
int uExtent[6] = {0,-1,0,-1,0,-1};
int wExtent[6] = {0,-1,0,-1,0,-1};
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), uExtent);
outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wExtent);
// Extract structure.
output->SetDimensions(input->GetDimensions());
output->SetExtent(uExtent);
// Extract attributes.
int usizek = uExtent[5]-uExtent[4]+1;
int usizej = uExtent[3]-uExtent[2]+1;
int usizei = uExtent[1]-uExtent[0]+1;
int usize = usizek*usizej*usizei;
vtkPointData *ipd = input->GetPointData();
vtkPointData *opd = output->GetPointData();
opd->CopyAllocate(ipd, usize, 1000);
vtkCellData *icd = input->GetCellData();
vtkCellData *ocd = output->GetCellData();
ocd->CopyAllocate(icd, usize, 1000);
vtkIdType ptCtr = 0;
vtkIdType clCtr = 0;
for (int k = uExtent[4]; k <= uExtent[5]; k++)
{
for (int j = uExtent[2]; j <= uExtent[3]; j++)
{
for (int i = uExtent[0]; i <= uExtent[1]; i++)
{
int ijk[3] = {i,j,k};
vtkIdType pointId = input->ComputePointId(ijk);
opd->CopyData(ipd, pointId, ptCtr++);
vtkIdType cellId = input->ComputeCellId(ijk);
ocd->CopyData(icd, cellId, clCtr++);
}
}
}
opd->Squeeze();
ocd->Squeeze();
//Copy the field data.
vtkFieldData *newFieldData = vtkFieldData::New();
newFieldData->DeepCopy(input->GetFieldData());
output->SetFieldData(newFieldData);
newFieldData->Delete();
return 1;
}
void vtkExtractImageDataPiece::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkExtractImageDataPiece.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkExtractImageDataPiece - Takes in ImageData and extracts a
// region within, producing another ImageData.
#ifndef __vtkExtractImageDataPiece_h
#define __vtkExtractImageDataPiece_h
#include "vtkImageAlgorithm.h"
class VTK_PARALLEL_EXPORT vtkExtractImageDataPiece : public vtkImageAlgorithm
{
public:
static vtkExtractImageDataPiece *New();
vtkTypeRevisionMacro(vtkExtractImageDataPiece, vtkImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
protected:
vtkExtractImageDataPiece() {};
~vtkExtractImageDataPiece() {};
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
private:
vtkExtractImageDataPiece(const vtkExtractImageDataPiece&); // Not implemented.
void operator=(const vtkExtractImageDataPiece&); // Not implemented.
};
#endif
/*=========================================================================
Program: Visualization Toolkit
Module: vtkExtractRectilinearGridPiece.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkExtractRectilinearGridPiece.h"
#include "vtkCell.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkGenericCell.h"
#include "vtkIdList.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkIntArray.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkUnsignedCharArray.h"
#include "vtkRectilinearGrid.h"
#include "vtkDoubleArray.h"
vtkCxxRevisionMacro(vtkExtractRectilinearGridPiece, "1.1");
vtkStandardNewMacro(vtkExtractRectilinearGridPiece);
int vtkExtractRectilinearGridPiece::RequestUpdateExtent(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *vtkNotUsed(outputVector))
{
// get the info object
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()),
6);
return 1;
}
int vtkExtractRectilinearGridPiece::RequestData(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation *outInfo = outputVector->GetInformationObject(0);
vtkRectilinearGrid *input = vtkRectilinearGrid::SafeDownCast(
inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkRectilinearGrid *output = vtkRectilinearGrid::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
// Decide what to extract.
int uExtent[6] = {0,-1,0,-1,0,-1};
int wExtent[6] = {0,-1,0,-1,0,-1};
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), uExtent);
outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wExtent);
// Extract structure.
output->SetDimensions(input->GetDimensions());
output->SetExtent(uExtent);
int usizek = uExtent[5]-uExtent[4]+1;
int usizej = uExtent[3]-uExtent[2]+1;
int usizei = uExtent[1]-uExtent[0]+1;
int usize = usizek*usizej*usizei;
vtkDoubleArray *s;
s = vtkDoubleArray::New();
s->SetNumberOfComponents(1);
s->SetNumberOfTuples(usizek);
input->GetZCoordinates()->GetData(wExtent[4], wExtent[5], 0, 0, s);
output->SetZCoordinates(s);
s->Squeeze();
s->Delete();
s = vtkDoubleArray::New();
s->SetNumberOfComponents(1);
s->SetNumberOfTuples(usizej);
input->GetYCoordinates()->GetData(wExtent[2], wExtent[3], 0, 0, s);
output->SetYCoordinates(s);
s->Squeeze();
s->Delete();
s = vtkDoubleArray::New();
s->SetNumberOfComponents(1);
s->SetNumberOfTuples(usizei);
input->GetXCoordinates()->GetData(wExtent[0], wExtent[1], 0, 0, s);
output->SetXCoordinates(s);
s->Squeeze();
s->Delete();
// Extract attributes.
vtkPointData *ipd = input->GetPointData();
vtkPointData *opd = output->GetPointData();
opd->CopyAllocate(ipd, usize, 1000);
vtkCellData *icd = input->GetCellData();
vtkCellData *ocd = output->GetCellData();
ocd->CopyAllocate(icd, usize, 1000);
vtkIdType ptCtr = 0;
vtkIdType clCtr = 0;
for (int k = uExtent[4]; k <= uExtent[5]; k++)
{
for (int j = uExtent[2]; j <= uExtent[3]; j++)
{
for (int i = uExtent[0]; i <= uExtent[1]; i++)
{
int ijk[3] = {i,j,k};
vtkIdType pointId = input->ComputePointId(ijk);
opd->CopyData(ipd, pointId, ptCtr++);
vtkIdType cellId = input->ComputeCellId(ijk);
ocd->CopyData(icd, cellId, clCtr++);
}
}
}
opd->Squeeze();
ocd->Squeeze();
//Copy the field data.
vtkFieldData *newFieldData = vtkFieldData::New();
newFieldData->DeepCopy(input->GetFieldData());
output->SetFieldData(newFieldData);
newFieldData->Delete();
return 1;
}
void vtkExtractRectilinearGridPiece::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkExtractRectilinearGridPiece.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkExtractRectilinearGridPiece - Takes in RectilinearGrid Data and
// extracts a region within, producing another RectilinearGrid.
#ifndef __vtkExtractRectilinearGridPiece_h
#define __vtkExtractRectilinearGridPiece_h
#include "vtkRectilinearGridAlgorithm.h"
class VTK_PARALLEL_EXPORT vtkExtractRectilinearGridPiece : public vtkRectilinearGridAlgorithm
{
public:
static vtkExtractRectilinearGridPiece *New();
vtkTypeRevisionMacro(vtkExtractRectilinearGridPiece, vtkRectilinearGridAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
protected:
vtkExtractRectilinearGridPiece() {};
~vtkExtractRectilinearGridPiece() {};
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
private:
vtkExtractRectilinearGridPiece(const vtkExtractRectilinearGridPiece&); // Not implemented.
void operator=(const vtkExtractRectilinearGridPiece&); // Not implemented.
};
#endif
/*=========================================================================
Program: Visualization Toolkit
Module: vtkExtractStructuredGridPiece.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkExtractStructuredGridPiece.h"
#include "vtkCell.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkGenericCell.h"
#include "vtkIdList.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkIntArray.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkUnsignedCharArray.h"
#include "vtkStructuredGrid.h"
#include "vtkDoubleArray.h"
vtkCxxRevisionMacro(vtkExtractStructuredGridPiece, "1.4");
vtkStandardNewMacro(vtkExtractStructuredGridPiece);
int vtkExtractStructuredGridPiece::RequestUpdateExtent(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *vtkNotUsed(outputVector))
{
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()),
6);
return 1;
}
int vtkExtractStructuredGridPiece::RequestData(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation *outInfo = outputVector->GetInformationObject(0);
vtkStructuredGrid *input = vtkStructuredGrid::SafeDownCast(
inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkStructuredGrid *output = vtkStructuredGrid::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
// Decide what to extract.
int uExtent[6] = {0,-1,0,-1,0,-1};
int wExtent[6] = {0,-1,0,-1,0,-1};
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), uExtent);
outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wExtent);
// Extract structure.
output->SetDimensions(input->GetDimensions());
output->SetExtent(uExtent);
int wsizej = wExtent[3]-wExtent[2]+1;
int wsizei = wExtent[1]-wExtent[0]+1;
int usizek = uExtent[5]-uExtent[4]+1;
int usizej = uExtent[3]-uExtent[2]+1;
int usizei = uExtent[1]-uExtent[0]+1;
int usize = usizek*usizej*usizei;
vtkPoints *ip = input->GetPoints();
vtkPoints *op = vtkPoints::New();
op->SetNumberOfPoints(usize);
double coords[3];
vtkIdType pCtr = 0;
for (int k = uExtent[4]; k <= uExtent[5]; k++)
{
for (int j = uExtent[2]; j <= uExtent[3]; j++)
{
for (int i = uExtent[0]; i <= uExtent[1]; i++)
{
vtkIdType pointId = k*wsizej*wsizei + j*wsizei + i;
ip->GetPoint(pointId, coords);
op->SetPoint(pCtr++, coords);
}
}
}
op->Squeeze();
output->SetPoints(op);
op->Delete();
// Extract attributes.
vtkPointData *ipd = input->GetPointData();
vtkPointData *opd = output->GetPointData();
opd->CopyAllocate(ipd, usize, 1000);
vtkCellData *icd = input->GetCellData();
vtkCellData *ocd = output->GetCellData();
ocd->CopyAllocate(icd, usize, 1000);
vtkIdType ptCtr = 0;
vtkIdType clCtr = 0;
for (int k = uExtent[4]; k <= uExtent[5]; k++)
{
for (int j = uExtent[2]; j <= uExtent[3]; j++)
{
for (int i = uExtent[0]; i <= uExtent[1]; i++)
{
vtkIdType pointId = k*wsizej*wsizei + j*wsizei + i;
opd->CopyData(ipd, pointId, ptCtr++);
if ((k != uExtent[5]) && (j != uExtent[3]) && (i != uExtent[1]))
{
vtkIdType cellId = k*(wsizej-1)*(wsizei-1) + j*(wsizei-1) + i;
ocd->CopyData(icd, cellId, clCtr++);
}
}
}
}
opd->Squeeze();
ocd->Squeeze();
//get field data
vtkFieldData *newFieldData = vtkFieldData::New();
newFieldData->DeepCopy(input->GetFieldData());
output->SetFieldData(newFieldData);
newFieldData->Delete();
return 1;
}
void vtkExtractStructuredGridPiece::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkExtractStructuredGridPiece.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.