Commit ac76fe16 authored by Kitware Robot's avatar Kitware Robot Committed by Ben Boeckel

clang-format: reformat using clang-format-8

Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 8.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
parent 8118ae5c

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -25,8 +25,7 @@
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
int TestVTKMCleanGrid(int argc, char *argv[])
int TestVTKMCleanGrid(int argc, char* argv[])
{
vtkNew<vtkRTAnalyticSource> wavelet;
wavelet->SetWholeExtent(-10, 10, -10, 10, -10, 10);
......
......@@ -32,10 +32,11 @@
#include "vtkSphereSource.h"
#include "vtkUnstructuredGrid.h"
namespace {
namespace
{
template <typename DataSetT>
void GenerateScalars(DataSetT *dataset, bool negate)
void GenerateScalars(DataSetT* dataset, bool negate)
{
vtkIdType numPoints = dataset->GetNumberOfPoints();
......@@ -48,8 +49,7 @@ void GenerateScalars(DataSetT *dataset, bool negate)
for (vtkIdType i = 0; i < numPoints; ++i)
{
dataset->GetPoint(i, point);
scalars->SetTypedComponent(i, 0, (negate ?-point[0] - point[1]
: point[0] + point[1]));
scalars->SetTypedComponent(i, 0, (negate ? -point[0] - point[1] : point[0] + point[1]));
}
dataset->GetPointData()->SetScalars(scalars);
}
......@@ -66,7 +66,7 @@ int TestVTKMClip(int, char*[])
sphereSource->SetThetaResolution(50);
sphereSource->SetPhiResolution(50);
sphereSource->Update();
vtkPolyData *sphere = sphereSource->GetOutput();
vtkPolyData* sphere = sphereSource->GetOutput();
GenerateScalars(sphere, false);
// Clip at zero:
......@@ -104,7 +104,7 @@ int TestVTKMClip(int, char*[])
vtkNew<vtkDelaunay3D> tetrahedralizer;
tetrahedralizer->SetInputConnection(imageToPoints->GetOutputPort());
tetrahedralizer->Update();
vtkUnstructuredGrid *tets = tetrahedralizer->GetOutput();
vtkUnstructuredGrid* tets = tetrahedralizer->GetOutput();
GenerateScalars(tets, true);
// Clip at zero:
......@@ -129,7 +129,7 @@ int TestVTKMClip(int, char*[])
renderer->AddActor(tetActor);
// Third dataset tests imagedata. This should produce an unstructured grid:
vtkImageData *image = imageSource->GetOutput();
vtkImageData* image = imageSource->GetOutput();
GenerateScalars(image, false);
vtkNew<vtkmClip> imageClipper;
......@@ -159,10 +159,10 @@ int TestVTKMClip(int, char*[])
iren->SetRenderWindow(renWin);
renWin->AddRenderer(renderer);
renWin->SetSize(500,500);
renderer->GetActiveCamera()->SetPosition(0,0,1);
renderer->GetActiveCamera()->SetFocalPoint(0,0,0);
renderer->GetActiveCamera()->SetViewUp(0,1,0);
renWin->SetSize(500, 500);
renderer->GetActiveCamera()->SetPosition(0, 0, 1);
renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);
renderer->GetActiveCamera()->SetViewUp(0, 1, 0);
renderer->ResetCamera();
renWin->Render();
......
......@@ -28,7 +28,6 @@
#include "vtkRenderer.h"
#include "vtkSphere.h"
int TestVTKMClipWithImplicitFunction(int argc, char* argv[])
{
vtkNew<vtkRTAnalyticSource> wavelet;
......
......@@ -19,7 +19,8 @@
#include "vtkPolyData.h"
#include "vtkSmartPointer.h"
namespace {
namespace
{
const double pi = 3.14159265358979323846264338327950288;
const double twoPi = 6.28318530717958647692528676655900576;
const int dim = 5;
......@@ -28,20 +29,20 @@ const double tolerance = 0.0001;
bool ArePointsWithinTolerance(double v1, double v2)
{
if(v1 == v2 || fabs(v1)+fabs(v2) < tolerance)
if (v1 == v2 || fabs(v1) + fabs(v2) < tolerance)
{
return true;
}
if(v1 == 0.0)
if (v1 == 0.0)
{
if(fabs(v2) < tolerance)
if (fabs(v2) < tolerance)
{
return true;
}
return false;
}
if(fabs(fabs(v1) - fabs(v2)) < tolerance)
if (fabs(fabs(v1) - fabs(v2)) < tolerance)
{
return true;
}
......@@ -65,14 +66,12 @@ void MakeTestDataSet(vtkPolyData* pd, const CoordinateType& coordType)
{
for (vtkIdType i = 0; i < dim; ++i)
{
double z =
static_cast<double>(i) / static_cast<double>(dim - 1);
double z = static_cast<double>(i) / static_cast<double>(dim - 1);
for (vtkIdType j = 0; j < dim; ++j)
{
double x =
static_cast<double>(j) / static_cast<double>(dim - 1);
double x = static_cast<double>(j) / static_cast<double>(dim - 1);
double y = (x * x + z * z) / 2.0f;
pcoords->SetTuple3(i*dim + j,x + 0, y + 0, z + 0);
pcoords->SetTuple3(i * dim + j, x + 0, y + 0, z + 0);
}
}
}
......@@ -81,67 +80,60 @@ void MakeTestDataSet(vtkPolyData* pd, const CoordinateType& coordType)
double R = 1.0f;
for (vtkIdType i = 0; i < dim; i++)
{
double Z =
static_cast<double>(i) / static_cast<double>(dim - 1);
double Z = static_cast<double>(i) / static_cast<double>(dim - 1);
for (vtkIdType j = 0; j < dim; j++)
{
double Theta = twoPi *
(static_cast<double>(j) / static_cast<double>(dim - 1));
pcoords->SetTuple3(i*dim + j, R, Theta, Z);
double Theta = twoPi * (static_cast<double>(j) / static_cast<double>(dim - 1));
pcoords->SetTuple3(i * dim + j, R, Theta, Z);
}
}
}
else if (coordType == CoordinateType::SPH)
{
//Spherical coordinates have some degenerate cases, so provide some good cases.
// Spherical coordinates have some degenerate cases, so provide some good cases.
double R = 1.0f;
std::vector<double> Thetas = {
eps, pi / 4, pi / 3, pi / 2, pi - eps
};
std::vector<double> Phis = {
eps, twoPi / 4, twoPi / 3, twoPi / 2, twoPi - eps
};
std::vector<double> Thetas = { eps, pi / 4, pi / 3, pi / 2, pi - eps };
std::vector<double> Phis = { eps, twoPi / 4, twoPi / 3, twoPi / 2, twoPi - eps };
for (std::size_t i = 0; i < Thetas.size(); i++)
{
for (std::size_t j = 0; j < Phis.size(); j++)
{
pcoords->SetTuple3(static_cast<vtkIdType>(i*dim + j), R, Thetas[i], Phis[j]);
pcoords->SetTuple3(static_cast<vtkIdType>(i * dim + j), R, Thetas[i], Phis[j]);
}
}
}
pd->GetPoints()->SetData(pcoords);
}
void ValidateCoordTransform(vtkPolyData* pd, vtkPolyData* pdTrans,
const std::vector<bool>& isAngle)
void ValidateCoordTransform(vtkPolyData* pd, vtkPolyData* pdTrans, const std::vector<bool>& isAngle)
{
vtkPoints* pdPoints = pd->GetPoints();
vtkPoints* pdTransPoints = pdTrans->GetPoints();
assert(pdPoints->GetNumberOfPoints() == pdTransPoints->GetNumberOfPoints());
for (vtkIdType i=0; i < pdPoints->GetNumberOfPoints(); i++)
for (vtkIdType i = 0; i < pdPoints->GetNumberOfPoints(); i++)
{
double* point = pdPoints->GetPoint(i);
double* pointTrans = pdTransPoints->GetPoint(i);
bool isEqual = true;
for (size_t j=0; j <3; j++)
for (size_t j = 0; j < 3; j++)
{
if (isAngle[j])
{
isEqual &= (ArePointsWithinTolerance(point[j], pointTrans[j]) ||
ArePointsWithinTolerance(point[j] + static_cast<double>(twoPi), pointTrans[j]) ||
ArePointsWithinTolerance(point[j], pointTrans[j] + static_cast<double>(twoPi)));
ArePointsWithinTolerance(point[j] + static_cast<double>(twoPi), pointTrans[j]) ||
ArePointsWithinTolerance(point[j], pointTrans[j] + static_cast<double>(twoPi)));
}
else
{
isEqual &= ArePointsWithinTolerance(point[j], pointTrans[j]);
}
if (isEqual==false)
if (isEqual == false)
{
std::cerr << "i=" << i << " is wrong! result value=" << pointTrans[j] <<
" target value=" << point[j] <<std::endl;
std::cerr << "i=" << i << " is wrong! result value=" << pointTrans[j]
<< " target value=" << point[j] << std::endl;
}
}
assert (isEqual == true);
assert(isEqual == true);
}
}