Commit 340b7506 authored by Will Schroeder's avatar Will Schroeder
Browse files

Cleaned dashboard warnings

parent 6198ab4a
......@@ -19,12 +19,16 @@
#include "vtkPolyData.h"
#include "vtkExtractGeometry.h"
#include "vtkSphere.h"
#include "vtkSphereSource.h"
#include "vtkTimerLog.h"
// Test the building of static cell links in both unstructured and structured
// grids.
int TestStaticCellLinks( int, char *[] )
{
int dataDim = 3;
// First create an instructured grid
vtkSmartPointer<vtkImageData> volume =
vtkSmartPointer<vtkImageData>::New();
volume->SetDimensions(dataDim,dataDim,dataDim);
......@@ -52,7 +56,8 @@ int TestStaticCellLinks( int, char *[] )
int numCells = slinks.GetNumberOfCells(0);
const int *cells = slinks.GetCells(0);
cout << "Lower Left corner (numCells, cells): " << numCells << " (";
cout << "Unstructured Grid:\n";
cout << " Lower Left corner (numCells, cells): " << numCells << " (";
for (int i=0; i<numCells; ++i)
{
cout << cells[i];
......@@ -64,10 +69,9 @@ int TestStaticCellLinks( int, char *[] )
return EXIT_FAILURE;
}
numCells = slinks.GetNumberOfCells(13);
cells = slinks.GetCells(13);
cout << "Center (numCells, cells): " << numCells << " (";
cout << " Center (numCells, cells): " << numCells << " (";
for (int i=0; i<numCells; ++i)
{
cout << cells[i];
......@@ -81,7 +85,7 @@ int TestStaticCellLinks( int, char *[] )
numCells = slinks.GetNumberOfCells(26);
cells = slinks.GetCells(26);
cout << "Upper Right corner (numCells, cells): " << numCells << " (";
cout << " Upper Right corner (numCells, cells): " << numCells << " (";
for (int i=0; i<numCells; ++i)
{
cout << cells[i];
......@@ -93,5 +97,50 @@ int TestStaticCellLinks( int, char *[] )
return EXIT_FAILURE;
}
// Okay now create a polydata
vtkSmartPointer<vtkSphereSource> ss =
vtkSmartPointer<vtkSphereSource>::New();
ss->SetThetaResolution(12);
ss->SetPhiResolution(10);
ss->Update();
vtkSmartPointer<vtkPolyData> pdata =
vtkSmartPointer<vtkPolyData>::New();
pdata = ss->GetOutput();
slinks.BuildLinks(pdata);
// The first point is at the pole
numCells = slinks.GetNumberOfCells(0);
cells = slinks.GetCells(0);
cout << "\nPolydata:\n";
cout << " Pole: (numCells, cells): " << numCells << " (";
for (int i=0; i<numCells; ++i)
{
cout << cells[i];
if ( i < (numCells-1) ) cout << "," ;
}
cout << ")\n";
if ( numCells != 12 )
{
return EXIT_FAILURE;
}
// The next point is at near the equator
numCells = slinks.GetNumberOfCells(5);
cells = slinks.GetCells(5);
cout << " Equator: (numCells, cells): " << numCells << " (";
for (int i=0; i<numCells; ++i)
{
cout << cells[i];
if ( i < (numCells-1) ) cout << "," ;
}
cout << ")\n";
if ( numCells != 6 )
{
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......@@ -95,9 +95,10 @@ BuildLinks(vtkPolyData *pd)
this->NumCells = pd->GetNumberOfCells();
this->NumPts = pd->GetNumberOfPoints();
const vtkCellArray *cellArrays[4];
vtkCellArray *cellArrays[4];
vtkIdType numCells[4];
vtkIdType sizes[4];
int i, j;
cellArrays[0] = pd->GetVerts();
cellArrays[1] = pd->GetLines();
......@@ -120,7 +121,7 @@ BuildLinks(vtkPolyData *pd)
// Allocate
this->LinksSize = sizes[0] + sizes[1] + sizes[2] + sizes[3];
this->Links = new TIds[this->LinksSize];
this->Links = new TIds[this->LinksSize+1];
this->Links[this->LinksSize] = this->NumPts;
this->Offsets = new TIds[this->NumPts+1];
this->Offsets[this->NumPts] = this->LinksSize;
......@@ -129,19 +130,18 @@ BuildLinks(vtkPolyData *pd)
// Now create the links.
vtkIdType npts, cellId, CellId, ptId;
const vtkIdType *cell;
int i, j;
// Visit the four arrays
for ( CellId=0, j=0; j < 4; ++j )
{
// Count number of point uses
cell = cellArrays[j];
for ( cellId=0; cellId < numCells[i]; ++cellId )
cell = cellArrays[j]->GetPointer();
for ( cellId=0; cellId < numCells[j]; ++cellId )
{
npts = *cell++;
for (i=0; i<npts; ++i)
{
this->Offsets[CellId+(*cell)++]++;
this->Offsets[CellId+(*cell++)]++;
}
}
CellId += numCells[j];
......@@ -160,8 +160,8 @@ BuildLinks(vtkPolyData *pd)
// points to the beginning of each cell run.
for ( CellId=0, j=0; j < 4; ++j )
{
cell = cellArrays[j];
for ( cellId=0; cellId < numCells[i]; ++cellId )
cell = cellArrays[j]->GetPointer();
for ( cellId=0; cellId < numCells[j]; ++cellId )
{
npts = *cell++;
for (i=0; i<npts; ++i)
......@@ -172,6 +172,7 @@ BuildLinks(vtkPolyData *pd)
}
CellId += numCells[j];
}//for each of the four polydata arrays
this->Offsets[this->NumPts] = this->LinksSize;
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment