Commit 38d04ce3 authored by Boris Basic's avatar Boris Basic

Replace some incorrect int declarations with vtkIdType

parent 9db353bb
......@@ -1575,7 +1575,7 @@ void vtkCellLocator::ClearCellHasBeenVisited()
}
//----------------------------------------------------------------------------
void vtkCellLocator::ClearCellHasBeenVisited(int id)
void vtkCellLocator::ClearCellHasBeenVisited(vtkIdType id)
{
if (this->CellHasBeenVisited
&& this->DataSet && id < this->DataSet->GetNumberOfCells())
......
......@@ -176,7 +176,7 @@ protected:
int prevMinLevel[3], int prevMaxLevel[3]);
void ClearCellHasBeenVisited();
void ClearCellHasBeenVisited(int id);
void ClearCellHasBeenVisited(vtkIdType id);
double Distance2ToBucket(const double x[3], int nei[3]);
double Distance2ToBounds(const double x[3], double bounds[6]);
......
......@@ -846,7 +846,6 @@ void vtkPointLocator::FindPointsWithinRadius(double R, const double x[3],
void vtkPointLocator::BuildLocator()
{
int ndivs[3];
int i;
vtkIdType idx;
vtkIdList *bucket;
vtkIdType numPts;
......@@ -891,7 +890,7 @@ void vtkPointLocator::BuildLocator()
{
bbox.Inflate(); //make sure non-zero volume
bbox.GetBounds(this->Bounds);
for (i=0; i<3; i++)
for (int i=0; i<3; ++i)
{
ndivs[i] = ( this->Divisions[i] < 1 ? 1 : this->Divisions[i] );
}
......@@ -905,7 +904,7 @@ void vtkPointLocator::BuildLocator()
// Compute width of bucket in three directions
//
for (i=0; i<3; i++)
for (int i=0; i<3; ++i)
{
this->H[i] = (this->Bounds[2*i+1] - this->Bounds[2*i]) / static_cast<double>(ndivs[i]);
}
......@@ -921,7 +920,7 @@ void vtkPointLocator::BuildLocator()
// Insert each point into the appropriate bucket. Make sure point
// falls within bucket.
//
for (i=0; i<numPts; i++)
for (vtkIdType i=0; i<numPts; ++i)
{
this->DataSet->GetPoint(i, x);
idx = this->GetBucketIndex(x);
......
......@@ -36,10 +36,12 @@ vtkPointsProjectedHull::vtkPointsProjectedHull()
{
this->InitFlags();
}
vtkPointsProjectedHull::~vtkPointsProjectedHull()
{
this->ClearAllocations();
}
void vtkPointsProjectedHull::Initialize()
{
this->ClearAllocations();
......@@ -47,11 +49,13 @@ void vtkPointsProjectedHull::Initialize()
vtkPoints::Initialize();
}
void vtkPointsProjectedHull::Update()
{
this->ClearAllocations();
this->InitFlags();
}
void vtkPointsProjectedHull::InitFlags()
{
int i;
......@@ -203,10 +207,10 @@ extern "C"
int vtkPointsProjectedHullIncrVertAxis(const void *p1, const void *p2);
int vtkPointsProjectedHullCCW(const void *p1, const void *p2);
}
int vtkPointsProjectedHull::GrahamScanAlgorithm(int dir)
{
int horizAxis = 0, vertAxis = 0;
int i,j;
int horizAxis = 0, vertAxis = 0;
if ((this->Npts == 0) || (this->GetMTime() > this->PtsTime))
{
......@@ -242,7 +246,7 @@ int i,j;
double *hullPts = new double[this->Npts*2];
for (i=0; i<this->Npts; i++)
for (vtkIdType i=0; i<this->Npts; ++i)
{
hullPts[i*2] = this->Pts[i*3 + horizAxis];
hullPts[i*2 + 1] = this->Pts[i*3 + vertAxis];
......@@ -252,7 +256,7 @@ int i,j;
int firstId = 0;
for (i=1; i<this->Npts; i++)
for (vtkIdType i=1; i<this->Npts; ++i)
{
if (hullPts[i*2 + 1] != hullPts[1]) break;
......@@ -275,9 +279,9 @@ int i,j;
// If there are duplicates of the first point in the
// projection, the vtkPointsProjectedHullCCW sort will fail.
int dups = 0;
vtkIdType dups = 0;
for (j=1, i=1; j < this->Npts; j++)
for (vtkIdType j=1, i=1; j < this->Npts; ++j)
{
if ( !dups && (hullPts[j*2+1] != hullPts[1])) break;
......@@ -288,14 +292,14 @@ int i,j;
hullPts[i*2] = hullPts[j*2];
hullPts[i*2+1] = hullPts[j*2+1];
}
i++;
++i;
}
else
{
dups++;
}
}
int nHullPts = this->Npts - dups;
vtkIdType nHullPts = this->Npts - dups;
// I'm not sure what I'm doing here but the current code is clearly screwed
// up and doesn't handle some degenerate cases
......@@ -323,9 +327,9 @@ int i,j;
int top = 1;
for (i=2; i<nHullPts; i++)
for (vtkIdType i=2; i<nHullPts; ++i)
{
int newpos = PositionInHull(hullPts, hullPts + top*2, hullPts + i*2);
vtkIdType newpos = PositionInHull(hullPts, hullPts + top*2, hullPts + i*2);
hullPts[newpos*2] = hullPts[i*2];
hullPts[newpos*2+ 1] = hullPts[i*2+ 1];
......@@ -341,7 +345,7 @@ int i,j;
double y0 = hullPts[1];
double y1 = hullPts[1];
for (i=1; i<nHullPts; i++)
for (vtkIdType i=1; i<nHullPts; ++i)
{
if (hullPts[2*i] < x0)
{
......@@ -380,10 +384,12 @@ int i,j;
return 0;
}
double vtkPointsProjectedHull::Distance(double *p1, double *p2)
{
return (p1[0] - p2[0])*(p1[0] - p2[0]) + (p1[1] - p2[1])*(p1[1] - p2[1]);
}
int vtkPointsProjectedHull::RemoveExtras(double *pts, int n)
{
int i, prev, skipMe, coord;
......@@ -440,10 +446,11 @@ int vtkPointsProjectedHull::RemoveExtras(double *pts, int n)
return prev+1; // size of new list
}
int vtkPointsProjectedHull::PositionInHull(double *base, double *top, double *pt)
vtkIdType vtkPointsProjectedHull::PositionInHull(double *base, double *top, double *pt)
{
double *p1, *p2;
double where;
double *p1, *p2;
double where;
p2 = top;
p1 = p2 - 2;
......@@ -476,16 +483,15 @@ double where;
return ((p2 - base) / 2) + 1;
}
void vtkPointsProjectedHull::GetPoints()
{
int i;
delete [] this->Pts;
this->Npts = this->Data->GetNumberOfTuples();
this->Pts = new double [this->Npts*3];
for (i=0; i<this->Npts; i++)
for (vtkIdType i=0; i<this->Npts; ++i)
{
this->Pts[i*3] = this->Data->GetComponent(i, 0);
this->Pts[i*3 + 1] = this->Data->GetComponent(i, 1);
......@@ -494,6 +500,7 @@ void vtkPointsProjectedHull::GetPoints()
this->PtsTime.Modified();
}
int vtkPointsProjectedHull::
RectangleBoundingBoxIntersection(double hmin, double hmax,
double vmin, double vmax, int dim)
......@@ -538,6 +545,7 @@ OutsideHorizontalLine(double vmin, double vmax,
}
}
}
int vtkPointsProjectedHull::
OutsideVerticalLine(double hmin, double hmax,
double *p0, double *, double *insidePt)
......@@ -565,6 +573,7 @@ OutsideVerticalLine(double hmin, double hmax,
}
}
}
int vtkPointsProjectedHull::
OutsideLine(double hmin, double hmax, double vmin, double vmax,
double *p0, double *p1, double *insidePt)
......@@ -606,12 +615,11 @@ OutsideLine(double hmin, double hmax, double vmin, double vmax,
return 1;
}
int vtkPointsProjectedHull::RectangleOutside(double hmin, double hmax,
double vmin, double vmax, int dir)
{
int i;
int npts = this->HullSize[dir];
vtkIdType npts = this->HullSize[dir];
if (npts == 2)
{
......@@ -646,7 +654,7 @@ int vtkPointsProjectedHull::RectangleOutside(double hmin, double hmax,
// polygon, determine if rectangle is entirely outside that line.
// If so, it must be outside the polygon.
for (i=0; i < npts-1; i++)
for (vtkIdType i=0; i < npts-1; ++i)
{
if (OutsideLine(hmin,hmax,vmin,vmax,
this->CCWHull[dir] + 2*i,
......@@ -677,6 +685,7 @@ int vtkPointsProjectedHull::RectangleOutside(double hmin, double hmax,
return 0;
}
int vtkPointsProjectedHull::RectangleOutside1DPolygon(double hmin, double hmax,
double vmin, double vmax, int dir)
{
......
......@@ -170,7 +170,7 @@ private:
static int RemoveExtras(double *pts, int n);
static double Distance(double *p1, double *p2);
static int PositionInHull(double *base, double *top, double *pt);
static vtkIdType PositionInHull(double *base, double *top, double *pt);
static int OutsideLine(double hmin, double hmax,
double vmin, double vmax, double *p0, double *p1, double *insidePt);
static int OutsideHorizontalLine(double vmin, double vmax,
......@@ -179,7 +179,7 @@ private:
double *p1, double *insidePt);
double *Pts;
int Npts;
vtkIdType Npts;
vtkTimeStamp PtsTime;
double *CCWHull[3];
......
......@@ -1152,14 +1152,13 @@ void vtkStructuredGrid::ComputeScalarRange()
double ptRange[2];
double cellRange[2];
double s;
int id, num;
ptRange[0] = VTK_DOUBLE_MAX;
ptRange[1] = VTK_DOUBLE_MIN;
ptRange[0] = VTK_DOUBLE_MAX;
ptRange[1] = VTK_DOUBLE_MIN;
if ( ptScalars )
{
num = this->GetNumberOfPoints();
for (id=0; id < num; id++)
vtkIdType num = this->GetNumberOfPoints();
for (vtkIdType id=0; id < num; ++id)
{
if ( this->IsPointVisible(id) )
{
......@@ -1176,12 +1175,12 @@ void vtkStructuredGrid::ComputeScalarRange()
}
}
cellRange[0] = ptRange[0];
cellRange[1] = ptRange[1];
cellRange[0] = ptRange[0];
cellRange[1] = ptRange[1];
if ( cellScalars )
{
num = this->GetNumberOfCells();
for (id=0; id < num; id++)
vtkIdType num = this->GetNumberOfCells();
for (vtkIdType id=0; id < num; ++id)
{
if ( this->IsCellVisible(id) )
{
......
......@@ -800,14 +800,13 @@ void vtkUniformGrid::ComputeScalarRange()
double ptRange[2];
double cellRange[2];
double s;
int id, num;
ptRange[0] = VTK_DOUBLE_MAX;
ptRange[1] = VTK_DOUBLE_MIN;
ptRange[0] = VTK_DOUBLE_MAX;
ptRange[1] = VTK_DOUBLE_MIN;
if ( ptScalars )
{
num = this->GetNumberOfPoints();
for (id=0; id < num; id++)
vtkIdType num = this->GetNumberOfPoints();
for (vtkIdType id=0; id < num; ++id)
{
if ( this->IsPointVisible(id) )
{
......@@ -824,12 +823,12 @@ void vtkUniformGrid::ComputeScalarRange()
}
}
cellRange[0] = ptRange[0];
cellRange[1] = ptRange[1];
cellRange[0] = ptRange[0];
cellRange[1] = ptRange[1];
if ( cellScalars )
{
num = this->GetNumberOfCells();
for (id=0; id < num; id++)
vtkIdType num = this->GetNumberOfCells();
for (vtkIdType id=0; id < num; ++id)
{
if ( this->IsCellVisible(id) )
{
......
......@@ -162,7 +162,7 @@ int vtkCleanPolyData::RequestData(
// we'll be needing these
vtkIdType inCellID, newId;
int i;
vtkIdType i;
vtkIdType ptId;
vtkIdType npts = 0;
vtkIdType *pts = nullptr;
......@@ -199,7 +199,7 @@ int vtkCleanPolyData::RequestData(
else
{
pointMap = new vtkIdType [numPts];
for (i=0; i < numPts; i++)
for (i=0; i < numPts; ++i)
{
pointMap[i] = -1; //initialize unused
}
......@@ -235,7 +235,7 @@ int vtkCleanPolyData::RequestData(
for (inVerts->InitTraversal(); inVerts->GetNextCell(npts,pts);
inCellID++)
{
for ( numNewPts=0, i=0; i < npts; i++ )
for ( numNewPts=0, i=0; i < npts; ++i )
{
inPts->GetPoint(pts[i],x);
this->OperateOnPoint(x, newx);
......@@ -537,28 +537,28 @@ int vtkCleanPolyData::RequestData(
// Now transfer all CellData from Lines/Polys/Strips into final
// Cell data output
int CombinedCellID = vertIDcounter;
vtkIdType combinedCellID = vertIDcounter;
if (newLines)
{
for (i=0; i<lineIDcounter; i++, CombinedCellID++)
for (i=0; i<lineIDcounter; ++i, ++combinedCellID)
{
outputCD->CopyData(outLineData, i, CombinedCellID);
outputCD->CopyData(outLineData, i, combinedCellID);
}
outLineData->Delete();
}
if (newPolys)
{
for (i=0; i<polyIDcounter; i++, CombinedCellID++)
for (i=0; i<polyIDcounter; ++i, ++combinedCellID)
{
outputCD->CopyData(outPolyData, i, CombinedCellID);
outputCD->CopyData(outPolyData, i, combinedCellID);
}
outPolyData->Delete();
}
if (newStrips)
{
for (i=0; i<strpIDcounter; i++, CombinedCellID++)
for (i=0; i<strpIDcounter; ++i, ++combinedCellID)
{
outputCD->CopyData(outStrpData, i, CombinedCellID);
outputCD->CopyData(outStrpData, i, combinedCellID);
}
outStrpData->Delete();
}
......
......@@ -132,9 +132,9 @@ int vtkConnectivityFilter::RequestData(
vtkIdType numPts, numCells, cellId, i, j, pt;
vtkPoints *newPts;
int id;
int maxCellsInRegion;
int largestRegionId = 0;
vtkIdType id;
vtkIdType maxCellsInRegion;
vtkIdType largestRegionId = 0;
vtkPointData *pd=input->GetPointData(), *outputPD=output->GetPointData();
vtkCellData *cd=input->GetCellData(), *outputCD=output->GetCellData();
......
......@@ -240,9 +240,9 @@ int vtkDataSetToDataObjectFilter::RequestData(
vtkIdType numCells=input->GetNumberOfCells();
vtkIntArray *types=vtkIntArray::New();
types->SetNumberOfValues(numCells);
for (i=0; i<numCells; i++)
for (vtkIdType cellId=0; cellId<numCells; ++cellId)
{
types->SetValue(i, input->GetCellType(i));
types->SetValue(cellId, input->GetCellType(cellId));
}
types->SetName("CellTypes");
fd->AddArray( types );
......
......@@ -105,7 +105,7 @@ int vtkReverseSense::RequestData(
double n[3];
progressInterval=numPoints/5+1;
for ( int ptId=0; ptId < numPoints; ptId++ )
for ( vtkIdType ptId=0; ptId < numPoints; ++ptId )
{
if ( ! (ptId % progressInterval) ) //manage progress / early abort
{
......
......@@ -198,7 +198,7 @@ int vtkStaticCleanPolyData::RequestData(
// we'll be needing these
vtkIdType inCellID, newId;
int i;
vtkIdType i;
vtkIdType ptId;
vtkIdType npts = 0;
vtkIdType *pts = nullptr;
......@@ -536,28 +536,28 @@ int vtkStaticCleanPolyData::RequestData(
// Now transfer all CellData from Lines/Polys/Strips into final
// Cell data output
int CombinedCellID = vertIDcounter;
vtkIdType combinedCellID = vertIDcounter;
if (newLines)
{
for (i=0; i<lineIDcounter; i++, CombinedCellID++)
for (i=0; i<lineIDcounter; ++i, ++combinedCellID)
{
outCD->CopyData(outLineData, i, CombinedCellID);
outCD->CopyData(outLineData, i, combinedCellID);
}
outLineData->Delete();
}
if (newPolys)
{
for (i=0; i<polyIDcounter; i++, CombinedCellID++)
for (i=0; i<polyIDcounter; ++i, ++combinedCellID)
{
outCD->CopyData(outPolyData, i, CombinedCellID);
outCD->CopyData(outPolyData, i, combinedCellID);
}
outPolyData->Delete();
}
if (newStrips)
{
for (i=0; i<strpIDcounter; i++, CombinedCellID++)
for (i=0; i<strpIDcounter;++ i, ++combinedCellID)
{
outCD->CopyData(outStrpData, i, CombinedCellID);
outCD->CopyData(outStrpData, i, combinedCellID);
}
outStrpData->Delete();
}
......
......@@ -239,7 +239,7 @@ struct VTile
radii->SetNumberOfTuples(nPts);
tile->InsertNextCell(static_cast<int>(nPts));
int i;
vtkIdType i;
double r;
VertexRingIterator tPtr;
for ( i=0, tPtr=this->Verts.begin(); tPtr != this->Verts.end(); ++tPtr, ++i )
......
......@@ -457,8 +457,8 @@ vtkIdType vtkExtractCells::reMapPointIds(vtkDataSet *grid)
}
memset(temp, 0, totalPoints);
int numberOfIds = 0;
int i;
vtkIdType numberOfIds = 0;
vtkIdType i;
vtkIdType id;
vtkIdList *ptIds = vtkIdList::New();
std::vector<vtkIdType>::const_iterator cellPtr;
......@@ -475,13 +475,13 @@ vtkIdType vtkExtractCells::reMapPointIds(vtkDataSet *grid)
vtkIdType *ptId = ptIds->GetPointer(0);
for (i=0; i<nIds; i++)
for (i=0; i<nIds; ++i)
{
id = *ptId++;
if (temp[id] == 0)
{
numberOfIds++;
++numberOfIds;
temp[id] = 1;
}
}
......@@ -511,13 +511,13 @@ vtkIdType vtkExtractCells::reMapPointIds(vtkDataSet *grid)
this->SubSetUGridCellArraySize += (1 + nIds);
for (i=0; i<nIds; i++)
for (i=0; i<nIds; ++i)
{
id = cellArray[loc++];
if (temp[id] == 0)
{
numberOfIds++;
++numberOfIds;
temp[id] = 1;
}
}
......
......@@ -119,7 +119,8 @@ int vtkExtractUnstructuredGrid::RequestData(
vtkIdType ptId;
vtkPointData *pd = input->GetPointData();
vtkCellData *cd = input->GetCellData();
int allVisible, numIds;
int allVisible;
vtkIdType numIds;
vtkPointData *outputPD = output->GetPointData();
vtkCellData *outputCD = output->GetCellData();
vtkIdType *pointMap = nullptr;
......
......@@ -344,7 +344,7 @@ void vtkCachingInterpolatedVelocityField::FastCompute(
{
for (int j=0; j<numPts; j++)
{
int id = data->Cell->PointIds->GetId(j);
vtkIdType id = data->Cell->PointIds->GetId(j);
f[0] += dvectors[id*3 + 0] * this->Weights[j];
f[1] += dvectors[id*3 + 1] * this->Weights[j];
f[2] += dvectors[id*3 + 2] * this->Weights[j];
......@@ -355,7 +355,7 @@ void vtkCachingInterpolatedVelocityField::FastCompute(
float *fvectors = data->VelocityFloat;
for (int j=0; j<numPts; j++)
{
int id = data->Cell->PointIds->GetId(j);
vtkIdType id = data->Cell->PointIds->GetId(j);
f[0] += fvectors[id*3 + 0] * this->Weights[j];
f[1] += fvectors[id*3 + 1] * this->Weights[j];
f[2] += fvectors[id*3 + 2] * this->Weights[j];
......
......@@ -640,10 +640,10 @@ void vtkParticleTracerBase::AssignSeedsToProcessors(
//
// take points from the source object and create a particle list
//
int numSeeds = source->GetNumberOfPoints();
vtkIdType numSeeds = source->GetNumberOfPoints();
candidates.resize(numSeeds);
//
for (int i=0; i<numSeeds; i++)
for (vtkIdType i=0; i<numSeeds; i++)
{
ParticleInformation &info = candidates[i];
memcpy(&(info.CurrentPosition.x[0]), source->GetPoint(i), sizeof(double)*3);
......
......@@ -322,7 +322,6 @@ void vtkStreamTracer::InitializeSeeds(vtkDataArray*& seeds,
if (source)
{
int i;
vtkIdType numSeeds = source->GetNumberOfPoints();
if (numSeeds > 0)
{
......@@ -331,7 +330,7 @@ void vtkStreamTracer::InitializeSeeds(vtkDataArray*& seeds,
if (this->IntegrationDirection == BOTH)
{
seedIds->SetNumberOfIds(2*numSeeds);
for (i=0; i<numSeeds; i++)
for (vtkIdType i=0; i<numSeeds; ++i)
{
seedIds->SetId(i, i);
seedIds->SetId(numSeeds + i, i);
......@@ -340,7 +339,7 @@ void vtkStreamTracer::InitializeSeeds(vtkDataArray*& seeds,
else
{
seedIds->SetNumberOfIds(numSeeds);
for (i=0; i<numSeeds; i++)
for (vtkIdType i=0; i<numSeeds; ++i)
{
seedIds->SetId(i, i);
}
......@@ -360,7 +359,7 @@ void vtkStreamTracer::InitializeSeeds(vtkDataArray*& seeds,
seeds = vtkDoubleArray::New();
seeds->SetNumberOfComponents(3);
seeds->SetNumberOfTuples(numSeeds);
for (i=0; i<numSeeds; i++)
for (vtkIdType i=0; i<numSeeds; ++i)
{
seeds->SetTuple(i, source->GetPoint(i));
}
......
......@@ -543,10 +543,10 @@ void vtkTemporalStreamTracer::AssignSeedsToProcessors(
//
// take points from the source object and create a particle list
//
int numSeeds = source->GetNumberOfPoints();
vtkIdType numSeeds = source->GetNumberOfPoints();
candidates.resize(numSeeds);
//
for (int i=0; i<numSeeds; i++) {
for (vtkIdType i=0; i<numSeeds; i++) {
ParticleInformation &info = candidates[i];
memcpy(&(info.CurrentPosition.x[0]), source->GetPoint(i), sizeof(double)*3);
info.CurrentPosition.x[3] = this->CurrentTimeSteps[0];
......
......@@ -1115,7 +1115,7 @@ void vtkOBBTree::BuildTree(vtkIdList *cells, vtkOBBNode *OBBptr, int level)
{
vtkIdType i, j, numCells=cells->GetNumberOfIds();
vtkIdType cellId;
int ptId;
vtkIdType ptId;
vtkIdList *cellPts = vtkIdList::New();
double size[3];
......
......@@ -69,7 +69,6 @@ int vtkRotationFilter::RequestData(
vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkIdType i;
vtkPointData *inPD = input->GetPointData();
vtkPointData *outPD = output->GetPointData();
vtkCellData *inCD = input->GetCellData();
......@@ -84,7 +83,7 @@ int vtkRotationFilter::RequestData(
double tuple[3];
vtkPoints *outPoints;
double point[3], center[3], negativCenter[3];
int ptId, cellId, j, k;
vtkIdType ptId, cellId;
vtkGenericCell *cell = vtkGenericCell::New();
vtkIdList *ptIds = vtkIdList::New();
......@@ -120,7 +119,7 @@ int vtkRotationFilter::RequestData(
// Copy first points.
if (this->CopyInput)
{
for (i = 0; i < numPts; i++)
for (vtkIdType i = 0; i < numPts; ++i)
{
input->GetPoint(i, point);
ptId = outPoints->InsertNextPoint(point);
......@@ -135,7 +134,7 @@ int vtkRotationFilter::RequestData(
negativCenter[1] = -center[1];
negativCenter[2] = -center[2];
for (k = 0; k < this->GetNumberOfCopies(); k++)
for (int k = 0; k < this->GetNumberOfCopies(); ++k)
{
localTransform->Identity();
localTransform->Translate(center);
......@@ -154,7 +153,7 @@ int vtkRotationFilter::RequestData(
break;
}
localTransform->Translate(negativCenter);
for (i = 0; i < numPts; i++)
for (vtkIdType i = 0; i < numPts; ++i)
{
input->GetPoint(i, point);