Merge branch 'fix_structured_pt_to_cell' into 'master'

fixing 2d structured connectivity calc for logical point indices.

`CalculateLogicalPointIndices` in `ConnectivityStructuredInternals.h` for 2D grids was incorrect -- it was using cell dimensions instead of point dimensions.  This fixes the calculation and the unit test for the data set.

See merge request !153
This commit is contained in:
Jeremy Meredith 2015-09-01 13:48:04 -04:00
commit 1b01d824c6
2 changed files with 23 additions and 10 deletions

@ -136,10 +136,10 @@ TwoDimRegularTest()
vtkm::Id expectedCellIds[6][4] = {{0,-1,-1,-1},
{0,1,-1,-1},
{1,-1,-1,-1},
{0,-1,-1,-1},
{0,1,-1,-1},
{2,-1,-1,-1},
{2,3,-1,-1}};
{1,-1,-1,-1}};
for (vtkm::Id pointIndex = 0; pointIndex < 6; pointIndex++)
{

@ -190,7 +190,7 @@ public:
vtkm::Vec<vtkm::Id,NUM_POINTS_IN_CELL> GetPointsOfCell(vtkm::Id index) const
{
vtkm::Id i, j;
this->CalculateLogicalPointIndices(index, i, j);
this->CalculateLogicalCellIndices(index, i, j);
vtkm::Vec<vtkm::Id,NUM_POINTS_IN_CELL> pointIds;
pointIds[0] = j*this->PointDimensions[0] + i;
@ -255,6 +255,13 @@ private:
private:
VTKM_EXEC_CONT_EXPORT
void CalculateLogicalPointIndices(vtkm::Id index, vtkm::Id &i, vtkm::Id &j) const
{
vtkm::Id2 pointDimensions = this->GetPointDimensions();
i = index % pointDimensions[0];
j = index / pointDimensions[0];
}
VTKM_EXEC_CONT_EXPORT
void CalculateLogicalCellIndices(vtkm::Id index, vtkm::Id &i, vtkm::Id &j) const
{
vtkm::Id2 cellDimensions = this->GetCellDimensions();
i = index % cellDimensions[0];
@ -327,13 +334,8 @@ public:
VTKM_EXEC_CONT_EXPORT
vtkm::Vec<vtkm::Id,NUM_POINTS_IN_CELL> GetPointsOfCell(vtkm::Id index) const
{
vtkm::Id3 cellDimensions = this->GetCellDimensions();
vtkm::Id cellDims01 = cellDimensions[0] * cellDimensions[1];
vtkm::Id k = index / cellDims01;
vtkm::Id indexij = index % cellDims01;
vtkm::Id j = indexij / cellDimensions[0];
vtkm::Id i = indexij % cellDimensions[0];
vtkm::Id i, j, k;
this->CalculateLogicalCellIndices(index, i, j, k);
vtkm::Vec<vtkm::Id,NUM_POINTS_IN_CELL> pointIds;
pointIds[0] = (k * this->PointDimensions[1] + j) * this->PointDimensions[0] + i;
@ -415,6 +417,17 @@ private:
private:
VTKM_EXEC_CONT_EXPORT
void CalculateLogicalCellIndices(vtkm::Id index, vtkm::Id &i, vtkm::Id &j, vtkm::Id &k) const
{
vtkm::Id3 cellDimensions = this->GetCellDimensions();
vtkm::Id cellDims01 = cellDimensions[0] * cellDimensions[1];
k = index / cellDims01;
vtkm::Id indexij = index % cellDims01;
j = indexij / cellDimensions[0];
i = indexij % cellDimensions[0];
}
VTKM_EXEC_CONT_EXPORT
void CalculateLogicalPointIndices(vtkm::Id index, vtkm::Id &i, vtkm::Id &j, vtkm::Id &k) const
{