Commit 9714cfcd authored by Ken Martin's avatar Ken Martin
Browse files

pipeline change

parent c33ff8dd
......@@ -42,11 +42,6 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
vtkAppendFilter::vtkAppendFilter()
{
}
vtkAppendFilter::~vtkAppendFilter()
{
}
// Description:
......@@ -96,7 +91,7 @@ void vtkAppendFilter::Update()
this->Updating = 0;
if (mtime > this->GetMTime() || this->GetMTime() > this->ExecuteTime ||
this->GetDataReleased() )
this->GetDataReleased() )
{
if ( this->StartMethod ) (*this->StartMethod)(this->StartMethodArg);
this->Execute();
......@@ -121,9 +116,11 @@ void vtkAppendFilter::Execute()
int i;
vtkDataSet *ds;
int ptId, cellId;
vtkUnstructuredGrid *output = (vtkUnstructuredGrid *)this->Output;
vtkPointData *outputPD = output->GetPointData();
vtkDebugMacro(<<"Appending data together");
this->Initialize();
output->Initialize();
// loop over all data sets, checking to see what point data is available.
numPts = 0;
......@@ -153,16 +150,16 @@ void vtkAppendFilter::Execute()
vtkErrorMacro(<<"No data to append!");
return;
}
// Now can allocate memory
this->Allocate(numCells); //allocate storage for geometry/topology
if ( !scalarsPresent ) this->PointData.CopyScalarsOff();
if ( !vectorsPresent ) this->PointData.CopyVectorsOff();
if ( !normalsPresent ) this->PointData.CopyNormalsOff();
if ( !tcoordsPresent ) this->PointData.CopyTCoordsOff();
if ( !tensorsPresent ) this->PointData.CopyTensorsOff();
if ( !userDefinedPresent ) this->PointData.CopyUserDefinedOff();
this->PointData.CopyAllocate(pd,numPts);
// Now can allocate memory
output->Allocate(numCells); //allocate storage for geometry/topology
if ( !scalarsPresent ) outputPD->CopyScalarsOff();
if ( !vectorsPresent ) outputPD->CopyVectorsOff();
if ( !normalsPresent ) outputPD->CopyNormalsOff();
if ( !tcoordsPresent ) outputPD->CopyTCoordsOff();
if ( !tensorsPresent ) outputPD->CopyTensorsOff();
if ( !userDefinedPresent ) outputPD->CopyUserDefinedOff();
outputPD->CopyAllocate(pd,numPts);
newPts = new vtkFloatPoints(numPts);
......@@ -176,7 +173,7 @@ void vtkAppendFilter::Execute()
for (ptId=0; ptId < numPts; ptId++)
{
newPts->SetPoint(ptId+ptOffset,ds->GetPoint(ptId));
this->PointData.CopyData(pd,ptId,ptId+ptOffset);
outputPD->CopyData(pd,ptId,ptId+ptOffset);
}
// copy cells
......@@ -185,32 +182,23 @@ void vtkAppendFilter::Execute()
ds->GetCellPoints(cellId,ptIds);
for (i=0; i < ptIds.GetNumberOfIds(); i++)
newPtIds.SetId(i,ptIds.GetId(i)+ptOffset);
this->InsertNextCell(ds->GetCellType(cellId),newPtIds);
output->InsertNextCell(ds->GetCellType(cellId),newPtIds);
}
}
//
// Update ourselves and release memory
//
this->SetPoints(newPts);
output->SetPoints(newPts);
newPts->Delete();
}
void vtkAppendFilter::PrintSelf(ostream& os, vtkIndent indent)
{
vtkUnstructuredGrid::PrintSelf(os,indent);
vtkFilter::_PrintSelf(os,indent);
vtkFilter::PrintSelf(os,indent);
os << indent << "Input DataSets:\n";
this->InputList.PrintSelf(os,indent.GetNextIndent());
}
int vtkAppendFilter::GetDataReleased()
{
return this->DataReleased;
}
void vtkAppendFilter::SetDataReleased(int flag)
{
this->DataReleased = flag;
}
......@@ -42,10 +42,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
vtkAppendPolyData::vtkAppendPolyData()
{
}
vtkAppendPolyData::~vtkAppendPolyData()
{
this->Output = new vtkPolyData;
}
// Description:
......@@ -86,7 +83,8 @@ void vtkAppendPolyData::Update()
if (this->Updating) return;
this->Updating = 1;
for (mtime=0, this->InputList.InitTraversal(); pd = this->InputList.GetNextItem(); )
for (mtime=0, this->InputList.InitTraversal();
pd = this->InputList.GetNextItem();)
{
pd->Update();
pdMtime = pd->GetMTime();
......@@ -124,9 +122,11 @@ void vtkAppendPolyData::Execute()
int numPts, numCells;
vtkPointData *pd;
int npts, *pts;
vtkPolyData *output = (vtkPolyData *)this->Output;
vtkPointData *outputPD = output->GetPointData();
vtkDebugMacro(<<"Appending data together");
this->Initialize();
output->Initialize();
// loop over all data sets, checking to see what point data is available.
numPts = 0;
......@@ -158,13 +158,13 @@ void vtkAppendPolyData::Execute()
}
// Now can allocate memory
if ( !scalarsPresent ) this->PointData.CopyScalarsOff();
if ( !vectorsPresent ) this->PointData.CopyVectorsOff();
if ( !normalsPresent ) this->PointData.CopyNormalsOff();
if ( !tcoordsPresent ) this->PointData.CopyTCoordsOff();
if ( !tensorsPresent ) this->PointData.CopyTensorsOff();
if ( !userDefinedPresent ) this->PointData.CopyUserDefinedOff();
this->PointData.CopyAllocate(pd,numPts);
if ( !scalarsPresent ) outputPD->CopyScalarsOff();
if ( !vectorsPresent ) outputPD->CopyVectorsOff();
if ( !normalsPresent ) outputPD->CopyNormalsOff();
if ( !tcoordsPresent ) outputPD->CopyTCoordsOff();
if ( !tensorsPresent ) outputPD->CopyTensorsOff();
if ( !userDefinedPresent ) outputPD->CopyUserDefinedOff();
outputPD->CopyAllocate(pd,numPts);
newPts = new vtkFloatPoints(numPts);
......@@ -196,7 +196,7 @@ void vtkAppendPolyData::Execute()
for (ptId=0; ptId < numPts; ptId++)
{
newPts->SetPoint(ptId+ptOffset,inPts->GetPoint(ptId));
this->PointData.CopyData(pd,ptId,ptId+ptOffset);
outputPD->CopyData(pd,ptId,ptId+ptOffset);
}
for (inVerts->InitTraversal(); inVerts->GetNextCell(npts,pts); )
......@@ -226,38 +226,27 @@ void vtkAppendPolyData::Execute()
//
// Update ourselves and release memory
//
this->SetPoints(newPts);
output->SetPoints(newPts);
newPts->Delete();
if ( newVerts->GetNumberOfCells() > 0 ) this->SetVerts(newVerts);
if ( newVerts->GetNumberOfCells() > 0 ) output->SetVerts(newVerts);
newVerts->Delete();
if ( newLines->GetNumberOfCells() > 0 ) this->SetLines(newLines);
if ( newLines->GetNumberOfCells() > 0 ) output->SetLines(newLines);
newLines->Delete();
if ( newPolys->GetNumberOfCells() > 0 ) this->SetPolys(newPolys);
if ( newPolys->GetNumberOfCells() > 0 ) output->SetPolys(newPolys);
newPolys->Delete();
if ( newStrips->GetNumberOfCells() > 0 ) this->SetStrips(newStrips);
if ( newStrips->GetNumberOfCells() > 0 ) output->SetStrips(newStrips);
newStrips->Delete();
this->Squeeze();
}
int vtkAppendPolyData::GetDataReleased()
{
return this->DataReleased;
}
void vtkAppendPolyData::SetDataReleased(int flag)
{
this->DataReleased = flag;
output->Squeeze();
}
void vtkAppendPolyData::PrintSelf(ostream& os, vtkIndent indent)
{
vtkPolyData::PrintSelf(os,indent);
vtkFilter::_PrintSelf(os,indent);
vtkFilter::PrintSelf(os,indent);
os << indent << "Input DataSets:\n";
this->InputList.PrintSelf(os,indent.GetNextIndent());
......
......@@ -62,8 +62,10 @@ void vtkAxes::Execute()
vtkFloatNormals *newNormals;
float x[3], n[3];
int ptIds[2];
this->Initialize();
vtkPolyData *output = (vtkPolyData *)this->Output;
// clear the output data
this->Output->Initialize();
newPts = new vtkFloatPoints(numPts);
newLines = new vtkCellArray();
......@@ -113,29 +115,28 @@ void vtkAxes::Execute()
newScalars->InsertNextScalar(0.5);
newNormals->InsertNextNormal(n);
newLines->InsertNextCell(2,ptIds);
//
// Update self and release memory
//
this->SetPoints(newPts);
//
// Update our output and release memory
//
output->SetPoints(newPts);
newPts->Delete();
this->PointData.SetScalars(newScalars);
output->GetPointData()->SetScalars(newScalars);
newScalars->Delete();
this->PointData.SetNormals(newNormals);
output->GetPointData()->SetNormals(newNormals);
newNormals->Delete();
this->SetLines(newLines);
output->SetLines(newLines);
newLines->Delete();
}
void vtkAxes::PrintSelf(ostream& os, vtkIndent indent)
{
vtkPolySource::PrintSelf(os,indent);
os << indent << "Origin: (" << this->Origin[0] << ", "
<< this->Origin[1] << ", "
<< this->Origin[2] << ")\n";
os << indent << "Scale Factor: " << this->ScaleFactor << "\n";
}
......@@ -73,7 +73,7 @@ void vtkBYUReader::Execute()
//
// Initialize
//
this->Initialize();
this->Output->Initialize();
if ((geomFp = fopen(this->GeometryFilename, "r")) == NULL)
{
......@@ -100,9 +100,11 @@ void vtkBYUReader::ReadGeometryFile(FILE *geomFile, int &numPts)
float x[3];
int npts, pts[MAX_CELL_SIZE];
int id, polyId;
//
// Read header (not using fixed format! - potential problem in some files.)
//
vtkPolyData *output = this->GetOutput();
//
// Read header (not using fixed format! - potential problem in some files.)
//
fscanf (geomFile, "%d %d %d %d", &numParts, &numPts, &numPolys, &numEdges);
if ( this->PartNumber > numParts )
......@@ -177,10 +179,10 @@ void vtkBYUReader::ReadGeometryFile(FILE *geomFile, int &numPts)
vtkDebugMacro(<<"Reading:" << numPts << " points, "
<< numPolys << " polygons.");
this->SetPoints(newPts);
output->SetPoints(newPts);
newPts->Delete();
this->SetPolys(newPolys);
output->SetPolys(newPolys);
newPolys->Delete();
}
......@@ -190,7 +192,8 @@ void vtkBYUReader::ReadDisplacementFile(int numPts)
int i;
float v[3];
vtkFloatVectors *newVectors;
vtkPolyData *output = this->GetOutput();
if ( this->ReadDisplacement && this->DisplacementFilename )
{
if ( !(dispFp = fopen(this->DisplacementFilename, "r")) )
......@@ -213,7 +216,7 @@ void vtkBYUReader::ReadDisplacementFile(int numPts)
vtkDebugMacro(<<"Read " << numPts << " displacements");
this->PointData.SetVectors(newVectors);
output->GetPointData()->SetVectors(newVectors);
newVectors->Delete();
}
......@@ -223,7 +226,8 @@ void vtkBYUReader::ReadScalarFile(int numPts)
int i;
float s;
vtkFloatScalars *newScalars;
vtkPolyData *output = this->GetOutput();
if ( this->ReadScalar && this->ScalarFilename )
{
if ( !(scalarFp = fopen(this->ScalarFilename, "r")) )
......@@ -246,7 +250,7 @@ void vtkBYUReader::ReadScalarFile(int numPts)
vtkDebugMacro(<<"Read " << numPts << " scalars");
this->PointData.SetScalars(newScalars);
output->GetPointData()->SetScalars(newScalars);
newScalars->Delete();
}
......@@ -256,6 +260,7 @@ void vtkBYUReader::ReadTextureFile(int numPts)
int i;
float t[2];
vtkFloatTCoords *newTCoords;
vtkPolyData *output = this->GetOutput();
if ( this->ReadTexture && this->TextureFilename )
{
......@@ -279,7 +284,7 @@ void vtkBYUReader::ReadTextureFile(int numPts)
vtkDebugMacro(<<"Read " << numPts << " texture coordinates");
this->PointData.SetTCoords(newTCoords);
output->GetPointData()->SetTCoords(newTCoords);
newTCoords->Delete();
}
......
......@@ -58,17 +58,7 @@ vtkBooleanStructuredPoints::vtkBooleanStructuredPoints()
this->OperationType = UNION_OPERATOR;
// this->Operator = this->Union;
}
vtkBooleanStructuredPoints::~vtkBooleanStructuredPoints()
{
}
unsigned long int vtkBooleanStructuredPoints::GetMTime()
{
unsigned long dtime = this->vtkStructuredPoints::GetMTime();
unsigned long ftime = this->vtkFilter::_GetMTime();
return (dtime > ftime ? dtime : ftime);
this->Output = new vtkStructuredPoints;
}
// Description:
......@@ -136,10 +126,12 @@ void vtkBooleanStructuredPoints::InitializeBoolean()
float *bounds;
int numPts;
int i, j;
this->Initialize();
this->SetDimensions(this->SampleDimensions);
numPts = this->GetNumberOfPoints();
vtkStructuredPoints *output = this->GetOutput();
float tempf[3];
output->Initialize();
output->SetDimensions(this->SampleDimensions);
numPts = output->GetNumberOfPoints();
// If ModelBounds unset, use input, else punt
if ( this->ModelBounds[0] >= this->ModelBounds[1] ||
......@@ -173,11 +165,16 @@ void vtkBooleanStructuredPoints::InitializeBoolean()
// Update origin and aspect ratio
for (i=0; i<3; i++)
{
this->Origin[i] = this->ModelBounds[2*i];
this->AspectRatio[i] = (this->ModelBounds[2*i+1] - this->ModelBounds[2*i])
/ (this->SampleDimensions[i] - 1);
tempf[i] = this->ModelBounds[2*i];
}
output->SetOrigin(tempf);
for (i=0; i<3; i++)
{
tempf[i] = (this->ModelBounds[2*i+1] - this->ModelBounds[2*i])
/ (this->SampleDimensions[i] - 1);
}
output->SetAspectRatio(tempf);
// Create output scalar (same type as input)
if ( this->InputList.GetNumberOfItems() > 0 )
{
......@@ -193,9 +190,8 @@ void vtkBooleanStructuredPoints::InitializeBoolean()
{
newScalars = new vtkFloatScalars(numPts);
}
this->PointData.SetScalars(newScalars);
output->GetPointData()->SetScalars(newScalars);
newScalars->Delete();
}
// Perform Boolean operations on input volumes
......@@ -225,11 +221,13 @@ void vtkBooleanStructuredPoints::Append(vtkStructuredPoints *sp)
int inKval,inJval;
int destKval,destJval;
int *inDimensions;
if ( (currentScalars = this->PointData.GetScalars()) == NULL )
vtkStructuredPoints *output = (vtkStructuredPoints *)this->Output;
float *aspectRatio = output->GetAspectRatio();
if ((currentScalars = this->Output->GetPointData()->GetScalars()) == NULL )
{
this->InitializeBoolean();
currentScalars = this->PointData.GetScalars();
currentScalars = this->Output->GetPointData()->GetScalars();
}
inScalars = sp->GetPointData()->GetScalars();
......@@ -247,7 +245,7 @@ void vtkBooleanStructuredPoints::Append(vtkStructuredPoints *sp)
// for each cell
for (k = 0; k < this->SampleDimensions[2]; k++)
{
inZ = destBounds[4] + k*this->AspectRatio[2];
inZ = destBounds[4] + k*aspectRatio[2];
inK = int ((float)(inZ - inBounds[4])/in_aspect[2]);
if ((inK >= 0)&&(inK < inDimensions[2]))
{
......@@ -255,7 +253,7 @@ void vtkBooleanStructuredPoints::Append(vtkStructuredPoints *sp)
destKval = k*this->SampleDimensions[0]*this->SampleDimensions[1];
for (j = 0; j < this->SampleDimensions[1]; j++)
{
inY = destBounds[2] + j*this->AspectRatio[1];
inY = destBounds[2] + j*aspectRatio[1];
inJ = (int) ((float)(inY - inBounds[2])/in_aspect[1]);
if ((inJ >= 0)&&(inJ < inDimensions[1]))
{
......@@ -263,7 +261,7 @@ void vtkBooleanStructuredPoints::Append(vtkStructuredPoints *sp)
destJval = j*this->SampleDimensions[0];
for (i = 0; i < this->SampleDimensions[0]; i++)
{
inX = destBounds[0] + i*this->AspectRatio[0];
inX = destBounds[0] + i*aspectRatio[0];
inI = (int) ((float)(inX - inBounds[0])/in_aspect[0]);
if ((inI >= 0)&&(inI < inDimensions[0]))
{
......@@ -325,6 +323,8 @@ void vtkBooleanStructuredPoints::SetModelBounds(float *bounds)
void vtkBooleanStructuredPoints::SetModelBounds(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
{
vtkStructuredPoints *output = this->GetOutput();
if (this->ModelBounds[0] != xmin || this->ModelBounds[1] != xmax ||
this->ModelBounds[2] != ymin || this->ModelBounds[3] != ymax ||
this->ModelBounds[4] != zmin || this->ModelBounds[5] != zmax )
......@@ -339,32 +339,16 @@ void vtkBooleanStructuredPoints::SetModelBounds(float xmin, float xmax, float ym
this->ModelBounds[4] = zmin;
this->ModelBounds[5] = zmax;
this->Origin[0] = xmin;
this->Origin[1] = ymin;
this->Origin[2] = zmin;
output->SetOrigin(xmin,ymin,zmin);
if ( (length = xmax - xmin) == 0.0 ) length = 1.0;
this->AspectRatio[0] = 1.0;
this->AspectRatio[1] = (ymax - ymin) / length;
this->AspectRatio[2] = (zmax - zmin) / length;
output->SetAspectRatio(1.0,(ymax - ymin) / length,(zmax - zmin) / length);
}
}
int vtkBooleanStructuredPoints::GetDataReleased()
{
return this->DataReleased;
}
void vtkBooleanStructuredPoints::SetDataReleased(int flag)
{
this->DataReleased = flag;
}
void vtkBooleanStructuredPoints::PrintSelf(ostream& os, vtkIndent indent)
{
vtkStructuredPoints::PrintSelf(os,indent);
vtkFilter::_PrintSelf(os,indent);
vtkFilter::PrintSelf(os,indent);
os << indent << "Input DataSets:\n";
this->InputList.PrintSelf(os,indent.GetNextIndent());
......
......@@ -63,8 +63,9 @@ void vtkBooleanTexture::Execute()
int numPts, i, j;
vtkAGraymap *newScalars;
int midILower, midJLower, midIUpper, midJUpper;
this->Initialize();
vtkStructuredPoints *output = this->GetOutput();
output->Initialize();
if ( (numPts = this->XSize * this->YSize) < 1 )
{
......@@ -72,7 +73,7 @@ void vtkBooleanTexture::Execute()
return;
}
this->SetDimensions(this->XSize,this->YSize,1);
output->SetDimensions(this->XSize,this->YSize,1);
newScalars = new vtkAGraymap(numPts);
//
// Compute size of various regions
......@@ -112,13 +113,13 @@ void vtkBooleanTexture::Execute()
//
// Update ourselves
//
this->PointData.SetScalars(newScalars);
output->GetPointData()->SetScalars(newScalars);
newScalars->Delete();
}
void vtkBooleanTexture::PrintSelf(ostream& os, vtkIndent indent)
{
vtkObject::PrintSelf(os,indent);
vtkStructuredPointsSource::PrintSelf(os,indent);
os << indent << "Thickness: " << this->Thickness << "\n";
os << indent << "In/In: (" << this->InIn[0] << "," << this->InIn[1] << ")\n";
......
......@@ -57,7 +57,7 @@ void vtkBrownianPoints::Execute()
vtkDebugMacro(<< "Executing Brownian filter");
this->Initialize();
this->Output->Initialize();
if ( ((numPts=this->Input->GetNumberOfPoints()) < 1) )
{
......@@ -95,10 +95,10 @@ void vtkBrownianPoints::Execute()
//
// Update ourselves
//
this->PointData.CopyVectorsOff();
this->PointData.PassData(this->Input->GetPointData());
this->Output->GetPointData()->CopyVectorsOff();
this->Output->GetPointData()->PassData(this->Input->GetPointData());
this->GetPointData()->SetVectors(newVectors);
this->Output->GetPointData()->SetVectors(newVectors);
newVectors->Delete();
}
......
......@@ -72,9 +72,11 @@ void vtkCleanPolyData::Execute()
vtkCellArray *inLines=input->GetLines(), *newLines=NULL;
vtkCellArray *inPolys=input->GetPolys(), *newPolys=NULL;
vtkCellArray *inStrips=input->GetStrips(), *newStrips=NULL;
vtkPolyData *output = this->GetOutput();
vtkPointData *outputPD = output->GetPointData();
vtkDebugMacro(<<"Cleaning data");
this->Initialize();
output->Initialize();
if ( numPts < 1 || (inPts=input->GetPoints()) == NULL )
{
......@@ -83,7 +85,7 @@ void vtkCleanPolyData::Execute()
}
pd = input->GetPointData();
this->PointData.CopyAllocate(pd);
outputPD->CopyAllocate(pd);
if ( this->Locator == NULL ) this->CreateDefaultLocator();
......@@ -111,14 +113,14 @@ void vtkCleanPolyData::Execute()
if ( Index[i] == numNewPts )
{
newPts->SetPoint(numNewPts,inPts->GetPoint(i));
this->PointData.CopyData(pd,i,numNewPts);
outputPD->CopyData(pd,i,numNewPts);
numNewPts++;
}
}
// need to reclaim space since we've reduced storage req.
newPts->Squeeze();
this->PointData.Squeeze();
outputPD->Squeeze();
vtkDebugMacro(<<"Removed " << numPts-numNewPts << " points");
......@@ -243,26 +245,26 @@ void vtkCleanPolyData::Execute()
//
delete [] Index;
this->SetPoints(newPts);
output->SetPoints(newPts);
newPts->Delete();
if (newVerts)