Commit e7d7f32c authored by Sean McBride's avatar Sean McBride

Manually reviewed use of 'static int' occurrences

- Changed some to be const also.
- Replaced others with call to ClampValue method.
- Changed some from int to bool.
- In a couple of cases the variable was unused, removed it.
parent 8a614710
......@@ -95,7 +95,7 @@ int ComparePointLocators(vtkAbstractPointLocator* locator1, vtkAbstractPointLoca
int rval = 0;
int i, j, k, kOffset, jOffset, offset;
float x[3];
static int dims[3]={39,31,31};
static const int dims[3]={39,31,31};
// Create the structured grid.
vtkStructuredGrid *sgrid = vtkStructuredGrid::New();
......
......@@ -184,12 +184,12 @@ vtkIdType vtkAbstractCellLocator::FindCell(
vtkIdType returnVal=-1;
int subId;
//
static int warning_shown = 0;
static bool warning_shown = false;
if (!warning_shown)
{
vtkWarningMacro(<<this->GetClassName() << " Does not implement FindCell"
<< " Reverting to slow DataSet implementation");
warning_shown = 1;
warning_shown = true;
}
//
if (this->DataSet)
......
......@@ -383,7 +383,7 @@ void vtkHexahedron::Contour(double value, vtkDataArray *cellScalars,
vtkCellData *inCd, vtkIdType cellId,
vtkCellData *outCd)
{
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
vtkMarchingCubesTriangleCases *triCase;
EDGE_LIST *edge;
int i, j, index, *vert;
......
......@@ -40,13 +40,13 @@ vtkImplicitWindowFunction::~vtkImplicitWindowFunction()
// Evaluate window function.
double vtkImplicitWindowFunction::EvaluateFunction(double x[3])
{
static int beenWarned=0;
static bool beenWarned=false;
double value, diff1, diff2, scaledRange;
if ( ! this->ImplicitFunction && ! beenWarned )
{
vtkErrorMacro(<<"Implicit function must be defined");
beenWarned = 1;
beenWarned = true;
return 0.0;
}
......
......@@ -256,7 +256,7 @@ void vtkLine::Contour(double value, vtkDataArray *cellScalars,
vtkPointData *inPd, vtkPointData *outPd,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd)
{
static int CASE_MASK[2] = {1,2};
static const int CASE_MASK[2] = {1,2};
int index, i, newCellId;
VERT_CASES *vertCase;
VERT_LIST *vert;
......@@ -767,7 +767,7 @@ void vtkLine::Clip(double value, vtkDataArray *cellScalars,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
int insideOut)
{
static int CASE_MASK[3] = {1,2};
static const int CASE_MASK[3] = {1,2};
LINE_CASES *lineCase;
int i, j, index, *vert, newCellId;
vtkIdType pts[3];
......
......@@ -747,7 +747,7 @@ inline static int IsAPoint(OTTetra *t, vtkIdType id)
// Given two tetra face neighbors, assign the neighbor pointers to each tetra.
static void AssignNeighbors(OTTetra* t1, OTTetra* t2)
{
static int CASE_MASK[4] = {1,2,4,8};
static const int CASE_MASK[4] = {1,2,4,8};
int i, index;
for (i=0, index=0; i<4; ++i)
......
......@@ -224,7 +224,7 @@ void vtkPixel::Contour(double value, vtkDataArray *cellScalars,
vtkPointData *inPd, vtkPointData *outPd,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd)
{
static int CASE_MASK[4] = {1,2,8,4}; //note differenceom quad!
static const int CASE_MASK[4] = {1,2,8,4}; //note differenceom quad!
vtkMarchingSquaresLineCases *lineCase;
EDGE_LIST *edge;
int i, j, index, *vert;
......@@ -553,7 +553,7 @@ void vtkPixel::Clip(double value, vtkDataArray *cellScalars,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
int insideOut)
{
static int CASE_MASK[4] = {1,2,8,4}; //note difference from quad!
static const int CASE_MASK[4] = {1,2,8,4}; //note difference from quad!
PIXEL_CASES *pixelCase;
PIXEL_EDGE_LIST *edge;
int i, j, index, *vert;
......
......@@ -398,7 +398,7 @@ void vtkPyramid::Contour(double value, vtkDataArray *cellScalars,
vtkCellData *inCd, vtkIdType cellId,
vtkCellData *outCd)
{
static int CASE_MASK[5] = {1,2,4,8,16};
static const int CASE_MASK[5] = {1,2,4,8,16};
TRIANGLE_CASES *triCase;
EDGE_LIST *edge;
int i, j, index, *vert, v1, v2, newCellId;
......
......@@ -417,7 +417,7 @@ void vtkQuad::Contour(double value, vtkDataArray *cellScalars,
vtkPointData *inPd, vtkPointData *outPd,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd)
{
static int CASE_MASK[4] = {1,2,4,8};
static const int CASE_MASK[4] = {1,2,4,8};
LINE_CASES *lineCase;
EDGE_LIST *edge;
int i, j, index, *vert;
......@@ -811,7 +811,7 @@ void vtkQuad::Clip(double value, vtkDataArray *cellScalars,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
int insideOut)
{
static int CASE_MASK[4] = {1,2,4,8};
static const int CASE_MASK[4] = {1,2,4,8};
QUAD_CASES *quadCase;
QUAD_EDGE_LIST *edge;
int i, j, index, *vert;
......
......@@ -317,8 +317,8 @@ void vtkStructuredData::GetPointCells(vtkIdType ptId, vtkIdList *cellIds,
int ptLoc[3], cellLoc[3];
int i, j;
vtkIdType cellId;
static int offset[8][3] = {{-1,0,0}, {-1,-1,0}, {-1,-1,-1}, {-1,0,-1},
{0,0,0}, {0,-1,0}, {0,-1,-1}, {0,0,-1}};
static const int offset[8][3] = {{-1,0,0}, {-1,-1,0}, {-1,-1,-1}, {-1,0,-1},
{0,0,0}, {0,-1,0}, {0,-1,-1}, {0,0,-1}};
for (i=0; i<3; i++)
{
......
......@@ -257,7 +257,7 @@ void vtkTetra::Contour(double value, vtkDataArray *cellScalars,
vtkPointData *inPd, vtkPointData *outPd,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd)
{
static int CASE_MASK[4] = {1,2,4,8};
static const int CASE_MASK[4] = {1,2,4,8};
TRIANGLE_CASES *triCase;
EDGE_LIST *edge;
int i, j, index, *vert, v1, v2, newCellId;
......@@ -830,7 +830,7 @@ void vtkTetra::Clip(double value, vtkDataArray *cellScalars,
vtkCellData *inCD, vtkIdType cellId, vtkCellData *outCD,
int insideOut)
{
static int CASE_MASK[4] = {1,2,4,8};
static const int CASE_MASK[4] = {1,2,4,8};
TETRA_CASES *tetraCase;
TETRA_EDGE_LIST *edge;
int i, j, index, *vert, newCellId;
......
......@@ -392,7 +392,7 @@ void vtkTriangle::Contour(double value, vtkDataArray *cellScalars,
vtkCellData *inCd, vtkIdType cellId,
vtkCellData *outCd)
{
static int CASE_MASK[3] = {1,2,4};
static const int CASE_MASK[3] = {1,2,4};
LINE_CASES *lineCase;
EDGE_LIST *edge;
int i, j, index, *vert;
......@@ -867,7 +867,7 @@ void vtkTriangle::Clip(double value, vtkDataArray *cellScalars,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
int insideOut)
{
static int CASE_MASK[3] = {1,2,4};
static const int CASE_MASK[3] = {1,2,4};
TRIANGLE_CASES *triangleCase;
TRIANGLE_EDGE_LIST *edge;
int i, j, index, *vert;
......
......@@ -96,7 +96,7 @@ void vtkTriangleStrip::EvaluateLocation(int& subId, const double pcoords[3],
double x[3], double *weights)
{
int i;
static int idx[2][3]={{0,1,2},{1,0,2}};
static const int idx[2][3]={{0,1,2},{1,0,2}};
int order = subId % 2;
double pt1[3], pt2[3], pt3[3];
......@@ -118,7 +118,7 @@ void vtkTriangleStrip::EvaluateLocation(int& subId, const double pcoords[3],
//----------------------------------------------------------------------------
int vtkTriangleStrip::CellBoundary(int subId, const double pcoords[3], vtkIdList *pts)
{
static int idx[2][3]={{0,1,2},{1,0,2}};
static const int idx[2][3]={{0,1,2},{1,0,2}};
int order;
order = subId % 2;
......@@ -226,7 +226,7 @@ int vtkTriangleStrip::Triangulate(int vtkNotUsed(index), vtkIdList *ptIds,
{
int numTris = this->Points->GetNumberOfPoints()-2;
int i, order;
static int idx[2][3]={{0,1,2},{1,0,2}};
static const int idx[2][3]={{0,1,2},{1,0,2}};
pts->Reset();
ptIds->Reset();
......
......@@ -308,11 +308,11 @@ void vtkVoxel::Contour(double value, vtkDataArray *cellScalars,
vtkPointData *inPd, vtkPointData *outPd,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd)
{
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
vtkMarchingCubesTriangleCases *triCase;
EDGE_LIST *edge;
int i, j, index, *vert;
static int vertMap[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
static const int vertMap[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
int newCellId;
vtkIdType pts[3];
double t, x1[3], x2[3], x[3];
......
......@@ -396,7 +396,7 @@ void vtkWedge::Contour(double value, vtkDataArray *cellScalars,
vtkPointData *inPd, vtkPointData *outPd,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd)
{
static int CASE_MASK[6] = {1,2,4,8,16,32};
static const int CASE_MASK[6] = {1,2,4,8,16,32};
TRIANGLE_CASES *triCase;
EDGE_LIST *edge;
int i, j, index, *vert, v1, v2, newCellId;
......
......@@ -1662,43 +1662,43 @@ int vtkFunctionParser::GetMathFunctionNumberByCheckingParenthesis
const int NUMBFUNCS = 24;
static int charsLens[NUMBFUNCS] = { 4, 4, 5, 6,
3, 6, 4, 5,
4, 5, 4, 5,
4, 5, 5, 5,
5, 4, 4, 6,
5, 4, 5, 3
static const int charsLens[NUMBFUNCS] = { 4, 4, 5, 6,
3, 6, 4, 5,
4, 5, 4, 5,
4, 5, 5, 5,
5, 4, 4, 6,
5, 4, 5, 3
};
static int funcNumbs[NUMBFUNCS] = { VTK_PARSER_ABSOLUTE_VALUE,
VTK_PARSER_EXPONENT,
VTK_PARSER_CEILING,
VTK_PARSER_FLOOR,
VTK_PARSER_LOGARITHME,
VTK_PARSER_LOGARITHM10,
VTK_PARSER_LOGARITHM,
VTK_PARSER_SQUARE_ROOT,
VTK_PARSER_SINE,
VTK_PARSER_HYPERBOLIC_SINE,
VTK_PARSER_COSINE,
VTK_PARSER_HYPERBOLIC_COSINE,
VTK_PARSER_TANGENT,
VTK_PARSER_HYPERBOLIC_TANGENT,
VTK_PARSER_ARCSINE,
VTK_PARSER_ARCCOSINE,
VTK_PARSER_ARCTANGENT,
VTK_PARSER_MIN,
VTK_PARSER_MAX,
VTK_PARSER_CROSS,
VTK_PARSER_SIGN,
VTK_PARSER_MAGNITUDE,
VTK_PARSER_NORMALIZE,
VTK_PARSER_IF
static const int funcNumbs[NUMBFUNCS] = { VTK_PARSER_ABSOLUTE_VALUE,
VTK_PARSER_EXPONENT,
VTK_PARSER_CEILING,
VTK_PARSER_FLOOR,
VTK_PARSER_LOGARITHME,
VTK_PARSER_LOGARITHM10,
VTK_PARSER_LOGARITHM,
VTK_PARSER_SQUARE_ROOT,
VTK_PARSER_SINE,
VTK_PARSER_HYPERBOLIC_SINE,
VTK_PARSER_COSINE,
VTK_PARSER_HYPERBOLIC_COSINE,
VTK_PARSER_TANGENT,
VTK_PARSER_HYPERBOLIC_TANGENT,
VTK_PARSER_ARCSINE,
VTK_PARSER_ARCCOSINE,
VTK_PARSER_ARCTANGENT,
VTK_PARSER_MIN,
VTK_PARSER_MAX,
VTK_PARSER_CROSS,
VTK_PARSER_SIGN,
VTK_PARSER_MAGNITUDE,
VTK_PARSER_NORMALIZE,
VTK_PARSER_IF
};
static char funcNames[NUMBFUNCS][10] = { "abs(", "exp(", "ceil(", "floor(",
......
......@@ -39,7 +39,7 @@ int main()
int i, j, k, kOffset, jOffset, offset;
float x[3], v[3], rMin=0.5, rMax=1.0, deltaRad, deltaZ;
float radius, theta;
static int dims[3]={13,11,11};
static const int dims[3]={13,11,11};
// Create the structured grid.
vtkStructuredGrid *sgrid = vtkStructuredGrid::New();
......
......@@ -558,7 +558,7 @@ int vtkDelaunay3D::RequestData(
int hasNei, j, k;
double x1[3], x2[3], x3[3];
vtkDelaunayTetra *tetra;
static int edge[6][2] = {{0,1},{1,2},{2,0},{0,3},{1,3},{2,3}};
static const int edge[6][2] = {{0,1},{1,2},{2,0},{0,3},{1,3},{2,3}};
edges = vtkEdgeTable::New();
edges->InitEdgeInsertion(numPoints+6);
......
......@@ -430,8 +430,8 @@ vtkFlyingEdges3DAlgorithm():XCases(nullptr),EdgeMetaData(nullptr),NewScalars(nul
NewNormals(nullptr)
{
int i, j, k, l, ii, eCase, index, numTris;
static int vertMap[8] = {0,1,3,2,4,5,7,6};
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int vertMap[8] = {0,1,3,2,4,5,7,6};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
EDGE_LIST *edge;
vtkMarchingCubesTriangleCases *triCase;
unsigned char *edgeCase;
......
......@@ -380,8 +380,8 @@ vtkFlyingEdgesPlaneCutterAlgorithm():XCases(nullptr),EdgeMetaData(nullptr),NewSc
NewTris(nullptr),NewPoints(nullptr),NewNormals(nullptr)
{
int i, j, k, l, ii, eCase, index, numTris;
static int vertMap[8] = {0,1,3,2,4,5,7,6};
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int vertMap[8] = {0,1,3,2,4,5,7,6};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
EDGE_LIST *edge;
vtkMarchingCubesTriangleCases *triCase;
unsigned char *edgeCase;
......
......@@ -164,7 +164,7 @@ void vtkMarchingCubesComputeGradient(vtkMarchingCubes *self,T *scalars, int dims
double s[8], value;
int i, j, k;
vtkIdType sliceSize;
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
vtkMarchingCubesTriangleCases *triCase, *triCases;
EDGE_LIST *edge;
int contNum, jOffset, ii, index, *vert;
......
......@@ -110,7 +110,7 @@ void vtkContourImage(T *scalars, vtkDataArray *newScalars, int roi[6], int dir[3
double t, *x1, *x2, x[3], xp, yp;
double pts[4][3], min, max;
int contNum, jOffset, idx, ii, jj, index, *vert;
static int CASE_MASK[4] = {1,2,8,4};
static const int CASE_MASK[4] = {1,2,8,4};
vtkMarchingSquaresLineCases *lineCase, *lineCases;
static int edges[4][2] = { {0,1}, {1,3}, {2,3}, {0,2} };
EDGE_LIST *edge;
......
......@@ -1213,7 +1213,7 @@ void CutStructuredGrid(T* pts,
const double* planeNormal,
bool generatePolygons)
{
static int CASE_MASK[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
static const int CASE_MASK[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
EDGE_LIST* edge;
int i, j, index, *vert;
......
......@@ -520,8 +520,8 @@ void vtkClipVolume::ClipVoxel(double value, vtkDataArray *cellScalars,
static int edges[12][2] = { {0,1}, {2,3}, {4,5}, {6,7},
{0,2}, {1,3}, {4,6}, {5,7},
{0,4}, {1,5}, {2,6}, {3,7}};
static int order[2][8] = { {0,3,5,6,1,2,4,7},
{1,2,4,7,0,3,5,6}};//injection order based on flip
static const int order[2][8] = { {0,3,5,6,1,2,4,7},
{1,2,4,7,0,3,5,6}};//injection order based on flip
// compute bounds for voxel and initialize
cellPts->GetPoint(0,voxelOrigin);
......
......@@ -429,8 +429,8 @@ vtkDiscreteFlyingEdges3DAlgorithm():XCases(nullptr),EdgeMetaData(nullptr),NewSca
NewNormals(nullptr)
{
int i, j, k, l, ii, eCase, index, numTris;
static int vertMap[8] = {0,1,3,2,4,5,7,6};
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int vertMap[8] = {0,1,3,2,4,5,7,6};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
EDGE_LIST *edge;
vtkMarchingCubesTriangleCases *triCase;
unsigned char *edgeCase;
......
......@@ -70,7 +70,7 @@ void vtkDiscreteMarchingCubesComputeGradient(
double s[8], value;
int i, j, k;
vtkIdType sliceSize, rowSize;
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
vtkMarchingCubesTriangleCases *triCase, *triCases;
EDGE_LIST *edge;
int contNum, ii, index, *vert;
......
......@@ -129,13 +129,13 @@ void vtkLinkEdgels::LinkEdgels(int xdim, int ydim, double *image,
double linkThresh, phiThresh;
// these direction vectors are rotated 90 degrees
// to convert gradient direction into edgel direction
static double directions[8][2] = {
static const double directions[8][2] = {
{0,1}, {-0.707, 0.707},
{-1,0}, {-0.707, -0.707},
{0,-1}, {0.707, -0.707},
{1,0}, {0.707, 0.707}};
static int xoffset[8] = {1,1,0,-1,-1,-1,0,1};
static int yoffset[8] = {0,1,1,1,0,-1,-1,-1};
static const int xoffset[8] = {1,1,0,-1,-1,-1,0,1};
static const int yoffset[8] = {0,1,1,1,0,-1,-1,-1};
int length, start;
int bestDirection = 0;
double error, bestError;
......
......@@ -357,19 +357,19 @@ Want right handed Tetrahedra...
*/
// Split voxel in 2 along diagonal, 3 tets on either side
static int tet6[6][4] =
static const int tet6[6][4] =
{
{1,6,2,3}, {1,6,7,5}, {1,6,3,7},
{1,6,0,2}, {1,6,5,4}, {1,6,4,0},
};
static int tet5[5][4] =
static const int tet5[5][4] =
{ {0,1,4,2},{1,4,7,5},{1,4,2,7},{1,2,3,7},{2,7,4,6} };
static int tet5flip[5][4] =
static const int tet5flip[5][4] =
{ {3,1,0,5}, {0,3,6,2}, {3,5,6,7}, {0,6,5,4}, {0,3,5,6}};
// 12 tet to confirm to tet5
static int tet12_conform[12][4] = {
static const int tet12_conform[12][4] = {
/* Left side */
{8,2,4,0},
{8,4,2,6},
......
......@@ -450,8 +450,8 @@ vtkExtractSurfaceAlgorithm():XCases(nullptr),EdgeMetaData(nullptr),NewTris(nullp
NewPoints(nullptr),NewGradients(nullptr),NewNormals(nullptr)
{
int i, j, k, l, ii, eCase, index, numTris;
static int vertMap[8] = {0,1,3,2,4,5,7,6};
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int vertMap[8] = {0,1,3,2,4,5,7,6};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
EDGE_LIST *edge;
vtkMarchingCubesTriangleCases *triCase;
unsigned char *edgeCase;
......
......@@ -28,7 +28,7 @@
int TestThreadedSynchronizedTemplates3D(int, char *[])
{
static const int dim = 256;
static int ext[6] = { 0, dim - 1, 0, dim - 1, 0, dim - 1 };
static const int ext[6] = { 0, dim - 1, 0, dim - 1, 0, dim - 1 };
//vtkSMPTools::Initialize(4);
vtkNew<vtkTimerLog> tl;
......
......@@ -34,7 +34,7 @@
int TestThreadedSynchronizedTemplatesCutter3D(int, char *[])
{
static const int dim = 257;
static int ext[6] = { 0, dim - 1, 0, dim - 1, 0, dim - 1 };
static const int ext[6] = { 0, dim - 1, 0, dim - 1, 0, dim - 1 };
//vtkSMPTools::Initialize(4);
vtkNew<vtkTimerLog> tl;
......
......@@ -1400,7 +1400,7 @@ void vtkCellTypeSource::GenerateLagrangeTets(vtkUnstructuredGrid* output, int ex
output->GetPoint(corners[6], pt[6].GetData());
output->GetPoint(corners[7], pt[7].GetData());
static int tetsOfHex[5][4] = {
static const int tetsOfHex[5][4] = {
{ 0, 1, 3, 4 },
{ 1, 2, 3, 6 },
{ 4, 7, 6, 3 },
......
......@@ -1117,8 +1117,8 @@ void vtkWin32VideoSource::DoVFWFormatCheck()
//----------------------------------------------------------------------------
void vtkWin32VideoSource::DoVFWFormatSetup()
{
static int colorBits[3] = { 24, 32, 16 };
static int greyBits[3] = { 8, 4, 1 };
static const int colorBits[3] = { 24, 32, 16 };
static const int greyBits[3] = { 8, 4, 1 };
int i, bytesPerRow, bitCount;
// get the real video format
......
......@@ -157,10 +157,7 @@ void vtkAbstractImageInterpolator::PrintSelf(ostream& os, vtkIndent indent)
//----------------------------------------------------------------------------
void vtkAbstractImageInterpolator::SetBorderMode(int mode)
{
static int minmode = VTK_IMAGE_BORDER_CLAMP;
static int maxmode = VTK_IMAGE_BORDER_MIRROR;
mode = ((mode > minmode) ? mode : minmode);
mode = ((mode < maxmode) ? mode : maxmode);
mode = vtkMath::ClampValue(mode, VTK_IMAGE_BORDER_CLAMP, VTK_IMAGE_BORDER_MIRROR);
if (this->BorderMode != mode)
{
this->BorderMode = mode;
......
......@@ -247,7 +247,7 @@ void vtkImageBSplineCoefficientsExecute(
int extent[6], int axis, int threadId)
{
// change the order so the inner loop is the chosen axis
static int permute[3][3] = {
static const int permute[3][3] = {
{ 0, 1, 2 }, { 1, 0, 2 }, { 2, 0, 1 } };
int borderMode = self->GetBorderMode();
......
......@@ -82,10 +82,7 @@ bool vtkImageBSplineInterpolator::IsSeparable()
//----------------------------------------------------------------------------
void vtkImageBSplineInterpolator::SetSplineDegree(int degree)
{
static int mindegree = 0;
static int maxdegree = VTK_IMAGE_BSPLINE_DEGREE_MAX;
degree = ((degree > mindegree) ? degree : mindegree);
degree = ((degree < maxdegree) ? degree : maxdegree);
degree = vtkMath::ClampValue(degree, 0, VTK_IMAGE_BSPLINE_DEGREE_MAX);
if (this->SplineDegree != degree)
{
this->SplineDegree = degree;
......
......@@ -57,10 +57,7 @@ bool vtkImageInterpolator::IsSeparable()
//----------------------------------------------------------------------------
void vtkImageInterpolator::SetInterpolationMode(int mode)
{
static int minmode = VTK_NEAREST_INTERPOLATION;
static int maxmode = VTK_CUBIC_INTERPOLATION;
mode = ((mode > minmode) ? mode : minmode);
mode = ((mode < maxmode) ? mode : maxmode);
mode = vtkMath::ClampValue(mode, VTK_NEAREST_INTERPOLATION, VTK_CUBIC_INTERPOLATION);
if (this->InterpolationMode != mode)
{
this->InterpolationMode = mode;
......
......@@ -343,10 +343,7 @@ namespace {
#define VTK_RESIZE_CONVERT_INT_CLAMP(T, minval, maxval) \
void vtkImageResizeConvert(double v, T &u) \
{ \
static double vmin = minval; \
static double vmax = maxval; \
v = (v > vmin ? v : vmin); \
v = (v < vmax ? v : vmax); \
v = vtkMath::ClampValue(v, minval, maxval); \
u = vtkInterpolationMath::Round(v); \
}
......
......@@ -211,10 +211,7 @@ bool vtkImageSincInterpolator::IsSeparable()
//----------------------------------------------------------------------------
void vtkImageSincInterpolator::SetWindowHalfWidth(int size)
{
static int minsize = 1;
static int maxsize = VTK_SINC_KERNEL_SIZE_MAX/2;
size = ((size > minsize) ? size : minsize);
size = ((size < maxsize) ? size : maxsize);
size = vtkMath::ClampValue(size, 1, VTK_SINC_KERNEL_SIZE_MAX/2);
if (this->WindowHalfWidth != size)
{
this->WindowHalfWidth = size;
......@@ -228,10 +225,7 @@ void vtkImageSincInterpolator::SetWindowHalfWidth(int size)
//----------------------------------------------------------------------------
void vtkImageSincInterpolator::SetWindowFunction(int mode)
{
static int minmode = VTK_LANCZOS_WINDOW;
static int maxmode = VTK_BLACKMAN_NUTTALL4;
mode = ((mode > minmode) ? mode : minmode);
mode = ((mode < maxmode) ? mode : maxmode);
mode = vtkMath::ClampValue(mode, VTK_LANCZOS_WINDOW, VTK_BLACKMAN_NUTTALL4);
if (this->WindowFunction != mode)
{
this->WindowFunction = mode;
......@@ -382,11 +376,8 @@ void vtkImageSincInterpolator::InternalUpdate()
int hsize[3];
for (int i = 0; i < 3; i++)
{
static int minsize = 1;
static int maxsize = VTK_SINC_KERNEL_SIZE_MAX/2;
int size = this->KernelSize[i]/2;
size = ((size > minsize) ? size : minsize);
size = ((size < maxsize) ? size : maxsize);
size = vtkMath::ClampValue(size, 1, VTK_SINC_KERNEL_SIZE_MAX/2);
hsize[i] = size;
blurchange |= (fabs(this->BlurFactors[i] - this->LastBlurFactors[i]) >=
VTK_INTERPOLATE_FLOOR_TOL);
......
......@@ -146,7 +146,7 @@ int vtkSliceCubesContour(T *slice, S *scalars, int imageRange[2], int dims[3],
int numTriangles=0, numComp = 0;
double s[8];
int i, j, k, idx, jOffset, ii, index, *vert, jj, sliceSize=0;
static int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
static const int CASE_MASK[8] = {1,2,4,8,16,32,64,128};
vtkMarchingCubesTriangleCases *triCase, *triCases;
EDGE_LIST *edge;
double pts[8][3], grad[8][3];
......
......@@ -197,15 +197,15 @@ void vtkImageCroppingRegionsWidget::UpdateOpacity()
return;
}
static int indices[][9] = {{ 0, 9, 18, 3, 12, 21, 6, 15, 24},
{ 1, 10, 19, 4, 13, 22, 7, 16, 25},
{ 2, 11, 20, 5, 14, 23, 8, 17, 26},
{ 0, 1, 2, 9, 10, 11, 18, 19, 20},
{ 3, 4, 5, 12, 13, 14, 21, 22, 23},
{ 6, 7, 8, 15, 16, 17, 24, 25, 26},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8},
{ 9, 10, 11, 12, 13, 14, 15, 16, 17},
{18, 19, 20, 21, 22, 23, 24, 25, 26}};
static const int indices[][9] = {{ 0, 9, 18, 3, 12, 21, 6, 15, 24},
{ 1, 10, 19, 4, 13, 22, 7, 16, 25},
{ 2, 11, 20, 5, 14, 23, 8, 17, 26},
{ 0, 1, 2, 9, 10, 11, 18, 19, 20},
{ 3, 4, 5, 12, 13, 14, 21, 22, 23},
{ 6, 7, 8, 15, 16, 17, 24, 25, 26},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8},
{ 9, 10, 11, 12, 13, 14, 15, 16, 17},
{18, 19, 20, 21, 22, 23, 24, 25, 26}};
double slice_pos = this->GetSlicePosition();
......
......@@ -48,11 +48,11 @@ int TestBareScalarsToColors(int argc, char *argv[])
arr->SetNumberOfTuples(6400);
// luminance conversion factors
static float a = 0.30;
static float b = 0.59;
static float c = 0.11;
static float d = 0.50;
static int f = 85;
static const float a = 0.30;
static const float b = 0.59;
static const float c = 0.11;
static const float d = 0.50;