Commit a595ab8e authored by Sean McBride's avatar Sean McBride

Fixed a bunch of clang-tidy misc-macro-parentheses warnings

This tool warns where macros should be using parens.
Fixed many issues it pointed out by either:
 - adding parens (which it can do automatically)
 - removed unused (or rarely used) macros
 - replacing macros with functions, notably vtkMath stuff
parent 2aa2df67
Pipeline #3183 passed with stage
......@@ -1082,7 +1082,7 @@ int Test_doubleptr_GetTupleN_i()
case _N: \
{ \
double *tmpPtr = source->GetTuple##_N(t); \
std::copy(tmpPtr, tmpPtr + _N, tuple.begin()); \
std::copy(tmpPtr, tmpPtr + (_N), tuple.begin()); \
} \
break
vtkDataArrayAPIGetTupleNCase(2);
......
......@@ -93,9 +93,9 @@ public:
// Description:
// Rounds a float to the nearest integer.
static int Round(float f) {
return static_cast<int>( f + ( f >= 0 ? 0.5 : -0.5 ) ); }
return static_cast<int>( f + ( f >= 0.0 ? 0.5 : -0.5 ) ); }
static int Round(double f) {
return static_cast<int>( f + ( f >= 0 ? 0.5 : -0.5 ) ); }
return static_cast<int>( f + ( f >= 0.0 ? 0.5 : -0.5 ) ); }
// Description:
// Rounds a double to the nearest integer not greater than itself.
......
......@@ -42,11 +42,11 @@
#include "vtkRegressionTestImage.h"
#define compare_doublevec(x, y, e) \
(((x[0]-y[0])<e) && ((x[0]-y[0])>-e) && \
((x[1]-y[1])<e) && ((x[1]-y[1])>-e) && \
((x[2]-y[2])<e) && ((x[2]-y[2])>-e))
(((x[0]-y[0])<(e)) && ((x[0]-y[0])>-(e)) && \
((x[1]-y[1])<(e)) && ((x[1]-y[1])>-(e)) && \
((x[2]-y[2])<(e)) && ((x[2]-y[2])>-(e)))
#define compare_double(x, y, e) ((x)-(y)<e && (x)-(y)>-e)
#define compare_double(x, y, e) ((x)-(y)<(e) && (x)-(y)>-(e))
// Test of vtkPolyhedron. A structured grid is converted to a polyhedral
// mesh.
......
......@@ -26,8 +26,6 @@
vtkStandardNewMacro(vtkAMRInformation);
#define ReturnFalseIfMacro(b,msg) { if(b) { std::cerr<<msg<<std::endl; return false;}}
namespace
{
inline bool Inside(double q[3], double gbounds[6])
......@@ -805,8 +803,16 @@ bool vtkAMRInformation::FindCell(double q[3],unsigned int level, unsigned int id
bool vtkAMRInformation::GetCoarsenedAMRBox(unsigned int level, unsigned int id, vtkAMRBox& box) const
{
box = this->GetAMRBox(level,id);
ReturnFalseIfMacro(box.IsInvalid(),"Invalid AMR box.")
ReturnFalseIfMacro(level==0, "Cannot get AMR box at level 0.")
if(box.IsInvalid())
{
std::cerr<<"Invalid AMR box."<<std::endl;
return false;
}
if(level==0)
{
std::cerr<<"Cannot get AMR box at level 0."<<std::endl;
return false;
}
int refinementRatio = this->GetRefinementRatio(level-1);
box.Coarsen(refinementRatio);
......
......@@ -34,7 +34,6 @@
#define JMAX(ext) ext[3]
#define KMIN(ext) ext[4]
#define KMAX(ext) ext[5]
#define PRINT(x) cout<<"("<<myRank<<")"<<x<<endl;
//------------------------------------------------------------------------------
void vtkAMRUtilities::PrintSelf( std::ostream& os, vtkIndent indent )
......
......@@ -42,10 +42,10 @@ if (this->BuildRegionList()) \
{ \
return err; \
} \
if ((id < 0) || (id >= this->NumberOfRegions)) \
{ \
vtkErrorMacro(<< "Invalid region ID"); \
return err; \
if (((id) < 0) || ((id) >= this->NumberOfRegions)) \
{ \
vtkErrorMacro(<< "Invalid region ID"); \
return (err); \
}
//----------------------------------------------------------------------------
......
......@@ -337,9 +337,6 @@ static int faces[8][6] = { {0,5,4,3,2,1}, {6,7,8,9,10,11},
{2,3,9,8,-1,-1}, {3,4,10,9,-1,-1},
{4,5,11,10,-1,-1}, {5,0,6,11,-1,-1} };
#define VTK_MAX(a,b) (((a)>(b))?(a):(b))
#define VTK_MIN(a,b) (((a)<(b))?(a):(b))
//----------------------------------------------------------------------------
// Returns the closest face to the point specified. Closeness is measured
// parametrically.
......@@ -356,8 +353,8 @@ int vtkHexagonalPrism::CellBoundary(int subId, double pcoords[3],
this->Polygon->CellBoundary( subId, pcoords, pts);
int min = VTK_MIN(pts->GetId( 0 ), pts->GetId( 1 ));
int max = VTK_MAX(pts->GetId( 0 ), pts->GetId( 1 ));
int min = vtkMath::Min(pts->GetId( 0 ), pts->GetId( 1 ));
int max = vtkMath::Max(pts->GetId( 0 ), pts->GetId( 1 ));
//Base on the edge find the quad that correspond:
int index;
......
......@@ -1391,13 +1391,7 @@ void vtkKdTree::AddNewRegions(vtkKdNode *kd, float *c1, int midpt, int dim, doub
} \
}
#define sign(x) ((x<0) ? (-1) : (1))
#ifndef max
#define max(x,y) ((x>y) ? (x) : (y))
#endif
#ifndef min
#define min(x,y) ((x<y) ? (x) : (y))
#endif
#define sign(x) (((x)<0) ? (-1) : (1))
//----------------------------------------------------------------------------
int vtkKdTree::Select(int dim, float *c1, int *ids, int nvals, double &coord)
......@@ -1497,8 +1491,8 @@ void vtkKdTree::_Select(int dim, float *X, int *ids,
Z = static_cast<float>(log(static_cast<float>(N)));
S = static_cast<int>(.5 * exp(2*Z/3));
SD = static_cast<int>(.5 * sqrt(Z*S*static_cast<float>(N-S)/N) * sign(I - N/2));
LL = max(L, K - static_cast<int>(I*static_cast<float>(S)/N) + SD);
RR = min(R, K + static_cast<int>((N-I)*static_cast<float>(S)/N) + SD);
LL = vtkMath::Max(L, K - static_cast<int>(I*static_cast<float>(S)/N) + SD);
RR = vtkMath::Min(R, K + static_cast<int>((N-I)*static_cast<float>(S)/N) + SD);
_Select(dim, X, ids, LL, RR, K);
}
......@@ -3480,12 +3474,12 @@ void vtkKdTree::GenerateRepresentation(int *regions, int len, vtkPolyData *pd)
//----------------------------------------------------------------------------
// Cell ID lists
//
#define SORTLIST(l, lsize) std::sort(l, l + lsize)
#define SORTLIST(l, lsize) std::sort(l, (l) + (lsize))
#define REMOVEDUPLICATES(l, lsize, newsize) \
{ \
int ii,jj; \
for (ii=0, jj=0; ii<lsize; ii++) \
for (ii=0, jj=0; ii<(lsize); ii++) \
{ \
if ((ii > 0) && (l[ii] == l[jj-1])) \
{ \
......
......@@ -382,9 +382,6 @@ static int faces[7][5] = { {0,4,3,2,1}, {5,6,7,8,9},
{2,3,8,7,-1}, {3,4,9,8,-1},
{4,0,5,9,-1} };
#define VTK_MAX(a,b) (((a)>(b))?(a):(b))
#define VTK_MIN(a,b) (((a)<(b))?(a):(b))
//----------------------------------------------------------------------------
// Returns the closest face to the point specified. Closeness is measured
// parametrically.
......@@ -401,8 +398,8 @@ int vtkPentagonalPrism::CellBoundary(int subId, double pcoords[3],
this->Polygon->CellBoundary( subId, pcoords, pts);
int min = VTK_MIN(pts->GetId( 0 ), pts->GetId( 1 ));
int max = VTK_MAX(pts->GetId( 0 ), pts->GetId( 1 ));
int min = vtkMath::Min(pts->GetId( 0 ), pts->GetId( 1 ));
int max = vtkMath::Max(pts->GetId( 0 ), pts->GetId( 1 ));
//Base on the edge find the quad that correspond:
int index;
......
......@@ -130,10 +130,10 @@ int vtkPointsProjectedHull::RectangleIntersection##which(vtkPoints *R) \
R->GetBounds(bounds); \
double hmin, hmax, vmin, vmax; \
\
hmin = bounds[(dim*2+2)%6]; \
hmax = bounds[(dim*2+2)%6+1]; \
vmin = bounds[(dim*2+4)%6]; \
vmax = bounds[(dim*2+4)%6 + 1]; \
hmin = bounds[((dim)*2+2)%6]; \
hmax = bounds[((dim)*2+2)%6+1]; \
vmin = bounds[((dim)*2+4)%6]; \
vmax = bounds[((dim)*2+4)%6 + 1]; \
\
return RectangleIntersection##which(hmin, hmax, vmin, vmax); \
} \
......
......@@ -71,7 +71,7 @@ double vtkPolygon::ComputeArea()
}
#define VTK_POLYGON_FAILURE -1
#define VTK_POLYGON_FAILURE (-1)
#define VTK_POLYGON_OUTSIDE 0
#define VTK_POLYGON_INSIDE 1
#define VTK_POLYGON_INTERSECTION 2
......
......@@ -62,7 +62,7 @@ inline static bool vtkReebGraphVertexSoS(const std::pair<int, double> v0,
#define vtkReebGraphInitialStreamSize 1000
#define vtkReebGraphIsSmaller(myReebGraph, nodeId0, nodeId1, node0, node1) \
((node0->Value < node1->Value) || (node0->Value == node1->Value && nodeId0 < nodeId1))
((node0->Value < node1->Value) || (node0->Value == node1->Value && (nodeId0) < (nodeId1)))
#define vtkReebGraphGetArcPersistence(rg,a) \
((this->GetNode(a->NodeId1)->Value - this->GetNode(a->NodeId0)->Value) \
......
......@@ -691,11 +691,11 @@ bool vtkFunctionParser::Evaluate()
break;
case VTK_PARSER_CROSS:
// Cross Product
#define Ux stackPosition-5
#define Uy stackPosition-4
#define Uz stackPosition-3
#define Vx stackPosition-2
#define Vy stackPosition-1
#define Ux (stackPosition-5)
#define Uy (stackPosition-4)
#define Uz (stackPosition-3)
#define Vx (stackPosition-2)
#define Vy (stackPosition-1)
#define Vz stackPosition
temp[0] = this->Stack[Uy]*this->Stack[Vz] -
this->Stack[Uz]*this->Stack[Vy];
......
......@@ -20,7 +20,7 @@
#define CHECK_MO(num) \
if (ed->GetMO(num) != mo##num.GetPointer()) \
{ \
cerr << "MO number " << num << " has changed since being set: " \
cerr << "MO number " << (num) << " has changed since being set: " \
<< "Expected @" << mo##num.GetPointer() \
<< ", got @" << ed->GetMO(num) << ".\n"; \
return EXIT_FAILURE; \
......
......@@ -24,8 +24,6 @@
#include <limits>
#include <cassert>
#define PRINT(x) cout<<"("<<myRank<<")"<<x<<endl;
//------------------------------------------------------------------------------
void vtkParallelAMRUtilities::PrintSelf( std::ostream& os, vtkIndent indent )
{
......@@ -77,7 +75,7 @@ void vtkParallelAMRUtilities::DistributeProcessInformation(vtkOverlappingAMR* am
offsets[i] = currentOffset;
currentOffset+=numBlocks[i];
}
PRINT("total # of active blocks: "<<currentOffset<<" out of total "<<amrInfo->GetTotalNumberOfBlocks());
cout<<"("<<myRank<<")"<<"total # of active blocks: "<<currentOffset<<" out of total "<<amrInfo->GetTotalNumberOfBlocks()<<endl;
std::vector<int> allBlocks(currentOffset,-1);
controller->AllGatherV(&myBlocks[0], &allBlocks[0], (vtkIdType)myBlocks.size(), &numBlocks[0], &offsets[0] );
......
......@@ -19,6 +19,7 @@
#include "vtkDoubleArray.h"
#include "vtkFloatArray.h"
#include "vtkGenericCell.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkSmartPointer.h"
......@@ -130,12 +131,11 @@ vtkCachingInterpolatedVelocityField::~vtkCachingInterpolatedVelocityField()
//---------------------------------------------------------------------------
void vtkCachingInterpolatedVelocityField::SetDataSet(int I, vtkDataSet* dataset, bool staticdataset, vtkAbstractCellLocator *locator)
{
#define max(x,y) ((x>y) ? (x) : (y))
int N = max(I+1, static_cast<int>(this->CacheList.size()));
int N = vtkMath::Max(I+1, static_cast<int>(this->CacheList.size()));
this->CacheList.resize(N);
this->CacheList[I].SetDataSet(dataset, this->VectorsSelection, staticdataset, locator);
//
int maxsize = max(static_cast<int>(this->Weights.size()), dataset->GetMaxCellSize());
int maxsize = vtkMath::Max(static_cast<int>(this->Weights.size()), dataset->GetMaxCellSize());
this->Weights.assign(maxsize, 0.0);
}
//---------------------------------------------------------------------------
......
......@@ -203,7 +203,7 @@ void vtkCurvatures::GetMeanCurvature(vtkPolyData *mesh)
delete [] num_neighb;
};
//--------------------------------------------
#define CLAMP_MACRO(v) ((v)<(-1) ? (-1) : (v) > (1) ? (1) : v)
#define CLAMP_MACRO(v) ((v)<(-1) ? (-1) : (v) > (1) ? (1) : (v))
void vtkCurvatures::GetGaussCurvature(vtkPolyData *output)
{
vtkDebugMacro("Start vtkCurvatures::GetGaussCurvature()");
......
......@@ -36,7 +36,7 @@ vtkStandardNewMacro(vtkRectilinearGridToTetrahedra);
#define VTK_TETRAHEDRALIZE_5 0
#define VTK_TETRAHEDRALIZE_5_FLIP 1
#define VTK_TETRAHEDRALIZE_6 6
#define VTK_TETRAHEDRALIZE_12_CONFORM -1
#define VTK_TETRAHEDRALIZE_12_CONFORM (-1)
#define VTK_TETRAHEDRALIZE_12_CONFORM_FLIP 2
#define VTK_TETRAHEDRALIZE_12 10
......
......@@ -33,8 +33,8 @@ vtkStandardNewMacro(vtkGreedyTerrainDecimation);
// Define some constants describing vertices
//
#define VTK_VERTEX_NO_TRIANGLE -1
#define VTK_VERTEX_INSERTED -2
#define VTK_VERTEX_NO_TRIANGLE (-1)
#define VTK_VERTEX_INSERTED (-2)
#define VTK_IN_TRIANGLE 0
#define VTK_INTERIOR_EDGE 1
......
......@@ -17,6 +17,7 @@
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
#include "vtkMath.h"
#include "vtkPKdTree.h"
#include "vtkKdNode.h"
#include "vtkDataSet.h"
......@@ -895,13 +896,7 @@ void vtkPKdTree::ExchangeVals(int pos1, int pos2)
// all the elements X[j], j < k satisfy X[j] <= X[K], and all the
// elements X[j], j > k satisfy X[j] >= X[K].
#define sign(x) ((x<0) ? (-1) : (1))
#ifndef max
#define max(x,y) ((x>y) ? (x) : (y))
#endif
#ifndef min
#define min(x,y) ((x<y) ? (x) : (y))
#endif
#define sign(x) (((x)<0) ? (-1) : (1))
void vtkPKdTree::_select(int L, int R, int K, int dim)
{
......@@ -922,8 +917,8 @@ void vtkPKdTree::_select(int L, int R, int K, int dim)
Z = static_cast<float>(log(float(N)));
S = static_cast<int>(.5 * exp(2*Z/3));
SD = static_cast<int>(.5 * sqrt(Z*S*((float)(N-S)/N)) * sign(I - N/2));
LL = max(L, K - static_cast<int>((I*((float)S/N))) + SD);
RR = min(R, K + static_cast<int>((N-I) * ((float)S/N)) + SD);
LL = vtkMath::Max(L, K - static_cast<int>((I*((float)S/N))) + SD);
RR = vtkMath::Min(R, K + static_cast<int>((N-I) * ((float)S/N)) + SD);
this->_select(LL, RR, K, dim);
}
......@@ -2333,7 +2328,7 @@ void vtkPKdTree::FreeSelectBuffer()
int i; \
if (list) \
{ \
for (i=0; i<len; i++) \
for (i=0; i<(len); i++) \
{ \
if (list[i]) delete [] list[i]; \
} \
......@@ -2344,7 +2339,7 @@ void vtkPKdTree::FreeSelectBuffer()
#define MakeList(field, type, len) \
{ \
if (len>0) \
if ((len)>0) \
{ \
field = new type [len]; \
if (field) \
......
......@@ -494,8 +494,8 @@ static void vtkMultiCorrelativeCholesky( std::vector<double*>& a, vtkIdType m )
#ifdef L
# undef L
#endif
#define A(i,j) ( j >= i ? a[j][i] : a[i][j] )
#define L(i,j) a[j][i + 1]
#define A(i,j) ( (j) >= (i) ? a[j][i] : a[i][j] )
#define L(i,j) a[j][(i) + 1]
// Then perform decomposition
double tmp;
......
......@@ -634,11 +634,11 @@ void testPipeline(vtkUnstructuredGridBase *input, vtkDataSet *&output,
{ \
timeLog_.clear(); \
timeLog_.resize(repeat_, -500); \
for (int benchmark = 0; benchmark < repeat_; ++benchmark) \
for (int benchmark = 0; benchmark < (repeat_); ++benchmark) \
{ \
double &benchmarkTime = timeLog_[benchmark]; \
call_; \
if (benchmark + 1 != repeat_) \
if (benchmark + 1 != (repeat_)) \
{ \
reset_; \
} \
......
......@@ -152,10 +152,10 @@ static const char* obj_typestr[] = {
"N"
};
#define OBJTYPE_IS_BLOCK(i) ((i>=0)&&(i<3))
#define OBJTYPE_IS_SET(i) ((i>2)&&(i<8))
#define OBJTYPE_IS_MAP(i) ((i>7)&&(i<12))
#define OBJTYPE_IS_NODAL(i) (i==12)
#define OBJTYPE_IS_BLOCK(i) (((i)>=0)&&((i)<3))
#define OBJTYPE_IS_SET(i) (((i)>2)&&((i)<8))
#define OBJTYPE_IS_MAP(i) (((i)>7)&&((i)<12))
#define OBJTYPE_IS_NODAL(i) ((i)==12)
// Unlike obj* items above:
// - conn* arrays only reference objects that generate connectivity information
......@@ -189,8 +189,8 @@ static int conn_obj_idx_cvt[] = {
2, 1, 0, 7, 6, 5, 4, 3
};
#define CONNTYPE_IS_BLOCK(i) ((i>=0)&&(i<3))
#define CONNTYPE_IS_SET(i) ((i>2)&&(i<8))
#define CONNTYPE_IS_BLOCK(i) (((i)>=0)&&((i)<3))
#define CONNTYPE_IS_SET(i) (((i)>2)&&((i)<8))
static const char* glomTypeNames[] = {
"Scalar",
......
......@@ -56,9 +56,9 @@ public:
}
#define FREELIST(x, len) \
if (x && len) \
if (x && (len)) \
{ \
for (i=0; i<len; i++) \
for (i=0; i<(len); i++) \
{ \
delete [] x[i]; \
} \
......
......@@ -57,7 +57,7 @@ int TestOBJReaderRelative( int argc, char *argv[] )
#define CHECK_ARRAY(obj, idx) \
if (obj##_rel[idx] != obj##_abs[idx]) \
{ \
cerr << "Error: different values for " #obj "[" << idx << "]" << endl; \
cerr << "Error: different values for " #obj "[" << (idx) << "]" << endl; \
retVal = 1; \
}
#define CHECK_SCALAR(obj) \
......
......@@ -2797,11 +2797,11 @@ int vtkLSDynaReader::ReadCellStateInfo( vtkIdType vtkNotUsed(step) )
char ctmp[128];
#define VTK_LS_CELLARRAY(cond,celltype,arrayname,numComps)\
if ( cond && this->GetCellArrayStatus( celltype, arrayname ) ) \
if ( (cond) && this->GetCellArrayStatus( celltype, arrayname ) ) \
{ \
this->Parts->AddProperty(celltype,arrayname,startPos,numComps); \
} \
startPos+=numComps;
startPos+=(numComps);
// Solid element data========================================================
int startPos=0; //used to keep track of the startpos between calls to VTK_LS_CELLARRAY
......@@ -3018,11 +3018,11 @@ int vtkLSDynaReader::ReadSPHState( vtkIdType vtkNotUsed(step) )
p->Fam.SkipWords(p->SPHStateOffset);
#define VTK_LS_SPHARRAY(cond,celltype,arrayname,numComps)\
if ( cond && this->GetCellArrayStatus( celltype, arrayname ) ) \
if ( (cond) && this->GetCellArrayStatus( celltype, arrayname ) ) \
{ \
this->Parts->AddProperty(celltype,arrayname,startPos,numComps); \
} \
startPos+=numComps;
startPos+=(numComps);
// Smooth Particle ========================================================
......
......@@ -327,7 +327,7 @@ int vtkMINCImageReader::CloseNetCDFFile(int ncid)
// this is a macro so the vtkErrorMacro will report a useful line number
#define vtkMINCImageReaderFailAndClose(ncid, status) \
{ \
if (status != NC_NOERR) \
if ((status) != NC_NOERR) \
{ \
vtkErrorMacro("There was an error with the MINC file:\n" \
<< this->GetFileName() << "\n" \
......
......@@ -218,7 +218,7 @@ int vtkMINCImageWriter::CloseNetCDFFile(int ncid)
// this is a macro so the vtkErrorMacro will report a useful line number
#define vtkMINCImageWriterFailAndClose(ncid, status) \
{ \
if (status != NC_NOERR) \
if ((status) != NC_NOERR) \
{ \
vtkErrorMacro("There was an error with the MINC file \"" \
<< this->GetFileName() << "\":\n" \
......
......@@ -129,7 +129,7 @@ typedef long nc_size_t;
{ \
vtkNcTemplateMacro(call); \
default: \
vtkErrorMacro(<<"Unsupported data type: " << type); \
vtkErrorMacro(<<"Unsupported data type: " << (type)); \
abort(); \
}
......
......@@ -91,7 +91,7 @@ static const int ply_type_size[] = {
0, 1, 2, 4, 4, 1, 2, 4, 1, 4, 4, 8
};
#define NO_OTHER_PROPS -1
#define NO_OTHER_PROPS (-1)
#define DONT_STORE_PROP 0
#define STORE_PROP 1
......
......@@ -37,6 +37,7 @@
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkUnstructuredGrid.h"
#include "vtkDoubleArray.h"
#include "vtkMath.h"
#include "vtkSmartPointer.h"
#define VTK_CREATE(type, name) \
......@@ -46,10 +47,6 @@
#include <vtksys/hash_map.hxx>
//=============================================================================
#define MY_MIN(x, y) ((x) < (y) ? (x) : (y))
#define MY_MAX(x, y) ((x) < (y) ? (y) : (x))
//=============================================================================
#define CALL_NETCDF(call) \
{ \
......@@ -1006,8 +1003,8 @@ int vtkPSLACReader::ReadMidpointCoordinates (
position.coord[2] = mp[4];
midpointTopologyType topology;
topology.minEdgePoint = static_cast<vtkIdType>(MY_MIN(mp[0], mp[1]));
topology.maxEdgePoint = static_cast<vtkIdType>(MY_MAX(mp[0], mp[1]));
topology.minEdgePoint = static_cast<vtkIdType>(vtkMath::Min(mp[0], mp[1]));
topology.maxEdgePoint = static_cast<vtkIdType>(vtkMath::Max(mp[0], mp[1]));
topology.globalId = i + startMidpoint + this->NumberOfGlobalPoints;
// find the processor the minimum edge point belongs to (by global id)
......
......@@ -99,9 +99,6 @@ void vtkImageCanvasSource2D::PrintSelf(ostream& os, vtkIndent indent)
<< ")\n";
}
#define vtkMAX(x, y) (((x)>(y))?(x):(y))
#define vtkMIN(x, y) (((x)<(y))?(x):(y))
//----------------------------------------------------------------------------
// Draw a data. Only implentented for 2D extents.
template <class T>
......@@ -187,7 +184,7 @@ void vtkImageCanvasSource2D::DrawImage(int x0, int y0,
}
else
{
width = vtkMIN(width, ext[1] - ext[0] + 1);
width = vtkMath::Min(width, ext[1] - ext[0] + 1);
}
if ( height < 0 )
{
......@@ -195,12 +192,12 @@ void vtkImageCanvasSource2D::DrawImage(int x0, int y0,
}
else
{
height = vtkMIN(height, ext[3] - ext[2] + 1);
height = vtkMath::Min(height, ext[3] - ext[2] + 1);
}
ext[0] = vtkMAX(sx, ext[0]);
ext[1] = vtkMAX(sx+width-1, ext[1]);
ext[2] = vtkMAX(sy, ext[2]);
ext[3] = vtkMAX(sy+height-1, ext[3]);
ext[0] = vtkMath::Max(sx, ext[0]);
ext[1] = vtkMath::Max(sx+width-1, ext[1]);
ext[2] = vtkMath::Max(sy, ext[2]);
ext[3] = vtkMath::Max(sy+height-1, ext[3]);
clip->SetOutputWholeExtent(ext);
vtkImageCast* ic = vtkImageCast::New();
......
......@@ -64,11 +64,6 @@ public:
vtkStandardNewMacro(vtkAttributeClustering2DLayoutStrategy);
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
// Cool-down function.
static inline float CoolDown(float t, float r)
{
......@@ -496,7 +491,7 @@ void vtkAttributeClustering2DLayoutStrategy::Layout()
// Avoid divide by zero
float forceDiv = fabs(forceX) + fabs(forceY) + epsilon;
float pNormalize = MIN(1, 1.0/forceDiv);
float pNormalize = vtkMath::Min(1.0f, 1.0f/forceDiv);
pNormalize *= this->Temp;
forceX *= pNormalize;
forceY *= pNormalize;
......
......@@ -43,11 +43,6 @@
vtkStandardNewMacro(vtkClustering2DLayoutStrategy);
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
// Cool-down function.
static inline float CoolDown(float t, float r)
{
......@@ -463,7 +458,7 @@ void vtkClustering2DLayoutStrategy::Layout()
// Avoid divide by zero
float forceDiv = fabs(forceX) + fabs(forceY) + epsilon;
float pNormalize = MIN(1, 1.0/forceDiv);
float pNormalize = vtkMath::Min(1.0f, 1.0f/forceDiv);
pNormalize *= this->Temp;
forceX *= pNormalize;
forceY *= pNormalize;
......
......@@ -43,11 +43,6 @@
vtkStandardNewMacro(vtkCommunity2DLayoutStrategy);
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
// Cool-down function.
static inline float CoolDown(float t, float r)
{
......@@ -458,7 +453,7 @@ void vtkCommunity2DLayoutStrategy::Layout()
// Avoid divide by zero
float forceDiv = fabs(forceX) + fabs(forceY) + epsilon;
float pNormalize = MIN(1, 1.0/forceDiv);
float pNormalize = vtkMath::Min(1.0f, 1.0f/forceDiv);
pNormalize *= this->Temp;
forceX *= pNormalize;
forceY *= pNormalize;
......
......@@ -43,11 +43,6 @@
vtkStandardNewMacro(vtkConstrained2DLayoutStrategy);
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
// Cool-down function.
static inline float CoolDown(float t, float r)
{
......@@ -422,7 +417,7 @@ void vtkConstrained2DLayoutStrategy::Layout()
// Avoid divide by zero
float forceDiv = fabs(forceX) + fabs(forceY) + epsilon;
float pNormalize = MIN(1, 1.0/forceDiv);
float pNormalize = vtkMath::Min(1.0f, 1.0f/forceDiv);
pNormalize *= this->Temp;
forceX *= pNormalize;
forceY *= pNormalize;
......
......@@ -43,11 +43,6 @@
vtkStandardNewMacro(vtkFast2DLayoutStrategy);
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
// Cool-down function.
static inline float CoolDown(float t, float r)
{
......@@ -420,7 +415,7 @@ void vtkFast2DLayoutStrategy::Layout()
// Avoid divide by zero
float forceDiv = fabs(forceX) + fabs(forceY) + epsilon;
float pNormalize = MIN(1, 1.0/forceDiv);
float pNormalize = vtkMath::Min(1.0f, 1.0f/forceDiv);
pNormalize *= this->Temp;
forceX *= pNormalize;
forceY *= pNormalize;
......
......@@ -39,10 +39,6 @@
vtkStandardNewMacro(vtkSimple2DLayoutStrategy);
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
// Cool-down function.
static inline float CoolDown(float t, float r)
{
......@@ -308,7 +304,7 @@ void vtkSimple2DLayoutStrategy::Layout()
// Avoid divide by zero
float forceDiv = fabs(forceX) + fabs(forceY) + epsilon;
float pNormalize = MIN(1, 1.0/forceDiv);
float pNormalize = vtkMath::Min(1.0f, 1.0f/forceDiv);
pNormalize *= this->Temp;
forceX *= pNormalize;
forceY *= pNormalize;
......
......@@ -27,10 +27,6 @@
#include "vtkMath.h"
#include "vtkGenericCell.h"
#define min(x,y) ((x<y) ? (x) : (y))
#define max(x,y) ((x>y) ? (x) : (y))