Commit 41b02b4c authored by brugger's avatar brugger

I made some more changes for VTK 6.0. Most of the changes work with VTK

5.8 and 6.0, but a few don't and those are conditionaly compiled. My
plan is to remove the VTK 5.8 cases once we have switched, but this allows
the changes to be tested.

The types of changes made were:

1) filter->SetInput(vtkDataObject);
   filter->AddInput(vtkDataObvect);
   filter->RemoveInput(vtkDataObvect);

     to

   filter->SetInputData(vtkDataObject);
   filter->AddInputData(vtkDataObvect);
   filter->RemoveInputData(vtkDataObvect);

2) filter1->SetInput(filter2->GetOutput());

     to

   filter1->SetInputConnection(filter2->GetOutputPort());

 3) output->GetUpdateGhostLevel();
    output->GetUpdateNumberOfPieces();

      to

    outInfo->Get(
      vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS());
    outInfo->Get(
      vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES());

 4) virtual void WriteFile(ofstream *, vtkImageData, int ext[6]);
    virtual void WriteFileHeader(ofstream *, vtkImageData *);

      to

    virtual void WriteFile(ofstream *, vtkImageData *, int ext[6], int wExt[6]);
    virtual void WriteFileHeader(ofstream *, vtkImageData *, int wExt[6]);



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@20178 18c085ea-50e0-402c-830e-de6fd14e8384
parent cfdd11cd
......@@ -939,12 +939,14 @@ vtkCSGGrid::PrintSelf(ostream& os, vtkIndent indent)
else
{
os << ", is a boolean ";
#if (VTK_MAJOR_VERSION == 5)
switch (boolFunc->GetOperationType())
{
case VTK_INTERSECTION: os << "intersection "; break;
case VTK_UNION: os << "union "; break;
case VTK_DIFFERENCE: os << "difference "; break;
}
#endif
vtkIdType leftId = funcMap[leftFunc];
vtkIdType rightId = funcMap[rightFunc];
......@@ -2088,17 +2090,17 @@ vtkCSGGrid::DiscretizeSurfaces(
regSample->CappingOn();
vtkContourFilter *regContour = vtkContourFilter::New();
regContour->SetInput((vtkDataSet*)regSample->GetOutput());
regContour->SetInputConnection(regSample->GetOutputPort());
regContour->SetValue(0, 0.0);
appender->AddInput(regContour->GetOutput());
appender->AddInputConnection(regContour->GetOutputPort());
regContour->Delete();
regSample->Delete();
reg->Delete();
}
appender->Update();
vtkPolyData *rv = appender->GetOutput();
rv->Update();
rv->Register(0);
appender->Delete();
return rv;
......@@ -2195,19 +2197,23 @@ vtkCSGGrid::DiscretizeSpace(
// Clip it!
vtkVisItClipper *regClipper = vtkVisItClipper::New();
#if (VTK_MAJOR_VERSION == 5)
regClipper->SetInput(rgrid);
#else
regClipper->SetInputData(rgrid);
#endif
regClipper->SetClipFunction(reg);
regClipper->SetInsideOut(true);
regClipper->Update();
appender->AddInput(regClipper->GetOutput());
appender->AddInputConnection(regClipper->GetOutputPort());
regClipper->Delete();
rgrid->Delete();
reg->Delete();
}
appender->Update();
vtkUnstructuredGrid *rv = appender->GetOutput();
rv->Update();
rv->Register(0);
appender->Delete();
return rv;
......@@ -2409,7 +2415,11 @@ vtkCSGGrid::DiscretizeSpaceMultiPass(const double bnds[6], const int dims[3],
multipassTags = new vector<FixedLengthBitField<64> >;
#if (VTK_MAJOR_VERSION == 5)
regClipper->SetInput(rgrid);
#else
regClipper->SetInputData(rgrid);
#endif
regClipper->SetTagBitField(multipassTags);
regClipper->SetClipFunctions(gridBoundaries, numBoundaries);
......@@ -2418,7 +2428,6 @@ vtkCSGGrid::DiscretizeSpaceMultiPass(const double bnds[6], const int dims[3],
output = regClipper->GetOutput();
output->Register(0);
output->SetSource(NULL);
regClipper->Delete();
rgrid->Delete();
......@@ -2465,7 +2474,11 @@ vtkCSGGrid::GetMultiPassDiscretization(int specificZone)
// Threshold out the cells for this region
vtkThreshold *threshold = vtkThreshold::New();
#if (VTK_MAJOR_VERSION == 5)
threshold->SetInput(rv);
#else
threshold->SetInputData(rv);
#endif
threshold->ThresholdByUpper(0.5);
threshold->Update();
rv = threshold->GetOutput();
......@@ -2711,7 +2724,11 @@ vtkCSGGrid::MakeMeshZonesByCuttingBox4(const Box *theBox,
vtkQuadric *quadric = vtkQuadric::New();
quadric->SetCoefficients(&gridBoundaries[NUM_QCOEFFS*bndId]);
vtkVisItClipper *pieceCutter = vtkVisItClipper::New();
#if (VTK_MAJOR_VERSION == 5)
pieceCutter->SetInput((*piecesCurrent)[i]);
#else
pieceCutter->SetInputData((*piecesCurrent)[i]);
#endif
pieceCutter->SetUseZeroCrossings(true);
pieceCutter->SetClipFunction(quadric);
......@@ -2727,7 +2744,7 @@ vtkCSGGrid::MakeMeshZonesByCuttingBox4(const Box *theBox,
pieceCutter->Modified();
//pieceCutter->Update();
pieceCutter->GetOutput()->Update();
pieceCutter->Update();
vtkUnstructuredGrid *thePiece = vtkUnstructuredGrid::New();
thePiece->ShallowCopy(pieceCutter->GetOutput());
......@@ -2839,7 +2856,11 @@ vtkCSGGrid::MakeMeshZonesByCuttingBox2(const Box *theBox,
const int theInt = it->first;
vtkVisItClipper *boxCutter = vtkVisItClipper::New();
#if (VTK_MAJOR_VERSION == 5)
boxCutter->SetInput(boxUgrid);
#else
boxCutter->SetInputData(boxUgrid);
#endif
boxCutter->SetUseZeroCrossings(true);
vtkQuadric *quadric = vtkQuadric::New();
......@@ -2851,7 +2872,6 @@ vtkCSGGrid::MakeMeshZonesByCuttingBox2(const Box *theBox,
boxCutter->Update();
vtkUnstructuredGrid *cutBox = boxCutter->GetOutput();
cutBox->Update();
cutBox->Register(NULL);
quadric->Delete();
......
......@@ -571,7 +571,11 @@ vtkDataSetRemoveGhostCells::RectilinearGridExecute()
}
vtkVisItExtractRectilinearGrid *extractor = vtkVisItExtractRectilinearGrid::New();
#if (VTK_MAJOR_VERSION == 5)
extractor->SetInput(inGrid);
#else
extractor->SetInputData(inGrid);
#endif
extractor->SetVOI(voi);
extractor->Update();
......@@ -656,7 +660,11 @@ vtkDataSetRemoveGhostCells::StructuredGridExecute()
}
vtkVisItExtractGrid *extractor = vtkVisItExtractGrid::New();
#if (VTK_MAJOR_VERSION == 5)
extractor->SetInput(inGrid);
#else
extractor->SetInputData(inGrid);
#endif
extractor->SetVOI(voi);
extractor->Update();
......
......@@ -49,8 +49,9 @@
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkVisItProbeFilter.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include <vtkUnsignedCharArray.h>
#include <vtkVisItProbeFilter.h>
vtkStandardNewMacro(vtkLineoutFilter);
......@@ -162,7 +163,7 @@ vtkLineoutFilter::RequestData(
this->Probe->SetCellData(1);
}
this->Probe->SetSource(inDS);
this->Probe->SetInput(this->LineSource->GetOutput());
this->Probe->SetInputConnection(this->LineSource->GetOutputPort());
this->Probe->Update();
//
......@@ -206,7 +207,8 @@ vtkLineoutFilter::RequestData(
vtkDataArray *gl =
this->Probe->GetOutput()->GetPointData()->GetArray("avtGhostZones");
int updateLevel = GetOutput()->GetUpdateGhostLevel();
int updateLevel = outInfo->Get(
vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS());
if (gl && gl->GetDataType() == VTK_UNSIGNED_CHAR &&
gl->GetNumberOfComponents() == 1)
{
......
......@@ -153,7 +153,11 @@ int vtkLinesFromOriginalCells::RequestData(
vtkDebugMacro(<<"No proper match for OriginalCellNumbers found in "
"field data. Using vtkExtractEdges.");
vtkExtractEdges *extractor = vtkExtractEdges::New();
#if (VTK_MAJOR_VERSION == 5)
extractor->SetInput(input);
#else
extractor->SetInputData(input);
#endif
extractor->Update();
output->ShallowCopy(extractor->GetOutput());
extractor->Delete();
......
......@@ -56,8 +56,13 @@ vtkPPMWriter::vtkPPMWriter()
this->FileLowerLeft = 1;
}
#if (VTK_MAJOR_VERSION == 5)
void vtkPPMWriter::WriteFileHeader(ofstream *file, vtkImageData *cache)
#else
void vtkPPMWriter::WriteFileHeader(ofstream *file, vtkImageData *, int wExt[6])
#endif
{
#if (VTK_MAJOR_VERSION == 5)
int min0, max0, min1, max1, min2, max2;
int width, height;
......@@ -65,6 +70,12 @@ void vtkPPMWriter::WriteFileHeader(ofstream *file, vtkImageData *cache)
cache->GetWholeExtent(min0, max0, min1, max1, min2, max2);
width = (max0 - min0 + 1);
height = (max1 - min1 + 1);
#else
int width, height;
width = (wExt[1] - wExt[0] + 1);
height = (wExt[3] - wExt[2] + 1);
#endif
// Figure out the header and write it to the file.
char header[100];
......@@ -74,8 +85,13 @@ void vtkPPMWriter::WriteFileHeader(ofstream *file, vtkImageData *cache)
}
#if (VTK_MAJOR_VERSION == 5)
void vtkPPMWriter::WriteFile(ofstream *file, vtkImageData *data,
int extent[6])
#else
void vtkPPMWriter::WriteFile(ofstream *file, vtkImageData *data,
int extent[6], int wExtent[6])
#endif
{
int idx1;
int rowLength, i; // in bytes
......@@ -85,7 +101,6 @@ void vtkPPMWriter::WriteFile(ofstream *file, vtkImageData *data,
unsigned long target;
float progress = this->Progress;
float area;
int *wExtent;
bpp = data->GetNumberOfScalarComponents();
......@@ -106,7 +121,9 @@ void vtkPPMWriter::WriteFile(ofstream *file, vtkImageData *data,
// Row length of x axis
rowLength = extent[1] - extent[0] + 1;
wExtent = this->GetInput()->GetWholeExtent();
#if (VTK_MAJOR_VERSION == 5)
int *wExtent = this->GetInput()->GetWholeExtent();
#endif
area = ((extent[5] - extent[4] + 1)*(extent[3] - extent[2] + 1)*
(extent[1] - extent[0] + 1)) /
((wExtent[5] -wExtent[4] + 1)*(wExtent[3] -wExtent[2] + 1)*
......
......@@ -52,8 +52,13 @@ protected:
vtkPPMWriter();
~vtkPPMWriter() {};
#if (VTK_MAJOR_VERSION == 5)
virtual void WriteFile(ofstream *file, vtkImageData *data, int ext[6]);
virtual void WriteFileHeader(ofstream *, vtkImageData *);
#else
virtual void WriteFile(ofstream *file, vtkImageData *data, int ext[6], int wExt[6]);
virtual void WriteFileHeader(ofstream *, vtkImageData *, int wExt[6]);
#endif
private:
vtkPPMWriter(const vtkPPMWriter&);
......
......@@ -107,7 +107,11 @@ vtkRGBWriter::vtkRGBWriter()
this->FileLowerLeft = 1;
}
#if (VTK_MAJOR_VERSION == 5)
void vtkRGBWriter::WriteFileHeader(ofstream *, vtkImageData *)
#else
void vtkRGBWriter::WriteFileHeader(ofstream *, vtkImageData *, int wExt[6])
#endif
{
// Do nothing since we need to actually compress the data BEFORE
// writing the file. It does not look possible to rewind the file
......@@ -115,8 +119,13 @@ void vtkRGBWriter::WriteFileHeader(ofstream *, vtkImageData *)
}
#if (VTK_MAJOR_VERSION == 5)
void vtkRGBWriter::WriteFile(ofstream *file, vtkImageData *data,
int extent[6])
#else
void vtkRGBWriter::WriteFile(ofstream *file, vtkImageData *data,
int extent[6], int wExtent[6])
#endif
{
int i, bpp = data->GetNumberOfScalarComponents();
......@@ -197,8 +206,9 @@ void vtkRGBWriter::WriteFile(ofstream *file, vtkImageData *data,
unsigned long target;
float progress = this->Progress;
float area;
int *wExtent;
wExtent = this->GetInput()->GetWholeExtent();
#if (VTK_MAJOR_VERSION == 5)
int *wExtent = this->GetInput()->GetWholeExtent();
#endif
area = ((extent[5] - extent[4] + 1)*(extent[3] - extent[2] + 1)*
(extent[1] - extent[0] + 1)) /
((wExtent[5] -wExtent[4] + 1)*(wExtent[3] -wExtent[2] + 1)*
......
......@@ -52,8 +52,13 @@ protected:
vtkRGBWriter();
~vtkRGBWriter() {};
#if (VTK_MAJOR_VERSION == 5)
virtual void WriteFile(ofstream *file, vtkImageData *data, int ext[6]);
virtual void WriteFileHeader(ofstream *, vtkImageData *);
#else
virtual void WriteFile(ofstream *file, vtkImageData *data, int ext[6], int wExt[6]);
virtual void WriteFileHeader(ofstream *, vtkImageData *, int wExt[6]);
#endif
private:
vtkRGBWriter(const vtkRGBWriter&);
......
......@@ -670,18 +670,30 @@ vtkSlicer::UnstructuredGridExecute(void)
{
vtkPolyData *not_from_zoo = vtkPolyData::New();
SliceDataset(stuff_I_cant_slice, not_from_zoo, true);
#if (VTK_MAJOR_VERSION == 5)
appender->AddInput(not_from_zoo);
#else
appender->AddInputData(not_from_zoo);
#endif
not_from_zoo->Delete();
}
if (numVertices > 0)
{
#if (VTK_MAJOR_VERSION == 5)
appender->AddInput(vertices_on_slice);
#else
appender->AddInputData(vertices_on_slice);
#endif
}
vtkPolyData *just_from_zoo = vtkPolyData::New();
sfv.ConstructPolyData(inPD, inCD, just_from_zoo, inPts);
#if (VTK_MAJOR_VERSION == 5)
appender->AddInput(just_from_zoo);
#else
appender->AddInputData(just_from_zoo);
#endif
just_from_zoo->Delete();
appender->Update();
......@@ -734,7 +746,11 @@ vtkSlicer::SliceDataset(vtkDataSet *in_ds, vtkPolyData *out_pd,
{
vtkCutter *cutter = vtkCutter::New();
cutter->SetCutFunction(plane);
#if (VTK_MAJOR_VERSION == 5)
cutter->SetInput(in_ds);
#else
cutter->SetInputData(in_ds);
#endif
cutter->Update();
out_pd->ShallowCopy(cutter->GetOutput());
......@@ -744,7 +760,11 @@ vtkSlicer::SliceDataset(vtkDataSet *in_ds, vtkPolyData *out_pd,
{
vtkVisItCutter *cutter = vtkVisItCutter::New();
cutter->SetCutFunction(plane);
#if (VTK_MAJOR_VERSION == 5)
cutter->SetInput(in_ds);
#else
cutter->SetInputData(in_ds);
#endif
cutter->Update();
out_pd->ShallowCopy(cutter->GetOutput());
......
......@@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkPolygon.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include <vtkTriangleStrip.h>
#include <vtkUnsignedCharArray.h>
......@@ -154,7 +155,8 @@ int vtkUniqueFeatureEdges::RequestData(
vtkCellData *cd=input->GetCellData(), *outCD=output->GetCellData();
unsigned char* ghostLevels=0;
vtkEdgeTable *edgeTable;
unsigned char updateLevel = (unsigned char) output->GetUpdateGhostLevel();
unsigned char updateLevel = (unsigned char) outInfo->Get(
vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS());
vtkDebugMacro(<<"Executing feature edges");
......@@ -479,11 +481,14 @@ int vtkUniqueFeatureEdges::RequestUpdateExtent(
vtkPolyData *output = vtkPolyData::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
int numPieces = output->GetUpdateNumberOfPieces();
int ghostLevel = output->GetUpdateGhostLevel();
int numPieces = (int) outInfo->Get(
vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES());
int ghostLevel = (int) outInfo->Get(
vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS());
if (numPieces > 1)
{
input->SetUpdateGhostLevel(ghostLevel + 1);
inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS(),
ghostLevel + 1);
}
return 1;
}
......
......@@ -270,7 +270,11 @@ vtkVisItClipper::FilterState::ClipDataset(vtkDataSet *in_ds,
vtkUnstructuredGrid *out_ds)
{
vtkClipDataSet *clipData = vtkClipDataSet::New();
#if (VTK_MAJOR_VERSION == 5)
clipData->SetInput(in_ds);
#else
clipData->SetInputData(in_ds);
#endif
if (this->clipFunction)
{
clipData->SetClipFunction(this->clipFunction);
......@@ -1147,22 +1151,35 @@ vtkVisItClipper_Algorithm(Bridge &bridge, ScalarAccess scalar,
bridge.ConstructDataSet(vfvIn, just_from_zoo);
vtkAppendFilter *appender = vtkAppendFilter::New();
#if (VTK_MAJOR_VERSION == 5)
appender->AddInput(not_from_zoo);
appender->AddInput(just_from_zoo);
appender->GetOutput()->Update();
#else
appender->AddInputData(not_from_zoo);
appender->AddInputData(just_from_zoo);
#endif
appender->Update();
output->ShallowCopy(appender->GetOutput());
if (state.computeInsideAndOut)
{
#if (VTK_MAJOR_VERSION == 5)
appender->RemoveInput(just_from_zoo);
#else
appender->RemoveInputData(just_from_zoo);
#endif
just_from_zoo->Delete();
just_from_zoo = vtkUnstructuredGrid::New();
bridge.ConstructDataSet(vfvOut, just_from_zoo);
#if (VTK_MAJOR_VERSION == 5)
appender->AddInput(just_from_zoo);
appender->GetOutput()->Update();
#else
appender->AddInputData(just_from_zoo);
#endif
appender->Update();
if (state.otherOutput != NULL)
state.otherOutput->Delete();
......
......@@ -492,8 +492,13 @@ vtkVisItContourFilter::UnstructuredGridExecute(vtkDataSet *input,
sfv.ConstructPolyData(inPD, inCD, just_from_zoo, inPts);
vtkAppendPolyData *appender = vtkAppendPolyData::New();
#if (VTK_MAJOR_VERSION == 5)
appender->AddInput(not_from_zoo);
appender->AddInput(just_from_zoo);
#else
appender->AddInputData(not_from_zoo);
appender->AddInputData(just_from_zoo);
#endif
appender->Update();
output->ShallowCopy(appender->GetOutput());
......@@ -525,7 +530,11 @@ vtkVisItContourFilter::ContourDataset(vtkDataSet *in_ds,
contour->SetNumberOfContours(1);
contour->SetValue(0, Isovalue);
#if (VTK_MAJOR_VERSION == 5)
contour->SetInput(in_ds);
#else
contour->SetInputData(in_ds);
#endif
contour->Update();
out_pd->ShallowCopy(contour->GetOutput());
......
......@@ -28,6 +28,7 @@
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkPolygon.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include <vtkTriangleStrip.h>
#include <vtkUnsignedCharArray.h>
......@@ -450,11 +451,15 @@ int vtkVisItFeatureEdges::RequestUpdateExtent(
vtkPolyData *output = vtkPolyData::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
int numPieces = output->GetUpdateNumberOfPieces();
int ghostLevel = output->GetUpdateGhostLevel();
int numPieces = outInfo->Get(
vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES());
int ghostLevel = outInfo->Get(
vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS());
if (numPieces > 1)
{
input->SetUpdateGhostLevel(ghostLevel + 1);
inInfo->Set(
vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS(),
ghostLevel + 1);
}
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment