mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Fixes for CellLocatorUniformGrid
- Fixing compiler warnings - Making code concise
This commit is contained in:
parent
42e2bb7f9a
commit
08421eb638
@ -57,9 +57,12 @@ public:
|
||||
if (!bounds.Contains(point))
|
||||
return -1;
|
||||
vtkm::Vec<vtkm::Id, 3> logical;
|
||||
logical[0] = static_cast<vtkm::Id>(vtkm::Floor((point[0] / bounds.X.Length()) * (dims[0] - 1)));
|
||||
logical[1] = static_cast<vtkm::Id>(vtkm::Floor((point[1] / bounds.Y.Length()) * (dims[1] - 1)));
|
||||
logical[2] = static_cast<vtkm::Id>(vtkm::Floor((point[2] / bounds.Z.Length()) * (dims[2] - 1)));
|
||||
logical[0] = static_cast<vtkm::Id>(
|
||||
vtkm::Floor((point[0] / bounds.X.Length()) * static_cast<vtkm::FloatDefault>(dims[0] - 1)));
|
||||
logical[1] = static_cast<vtkm::Id>(
|
||||
vtkm::Floor((point[1] / bounds.Y.Length()) * static_cast<vtkm::FloatDefault>(dims[1] - 1)));
|
||||
logical[2] = static_cast<vtkm::Id>(
|
||||
vtkm::Floor((point[2] / bounds.Z.Length()) * static_cast<vtkm::FloatDefault>(dims[2] - 1)));
|
||||
return logical[2] * (dims[0] - 1) * (dims[1] - 1) + logical[1] * (dims[0] - 1) + logical[0];
|
||||
}
|
||||
|
||||
|
@ -72,14 +72,13 @@ public:
|
||||
return;
|
||||
}
|
||||
// Get the Cell Id from the point.
|
||||
vtkm::Vec<vtkm::FloatDefault, 3> relative;
|
||||
relative[0] = static_cast<vtkm::FloatDefault>((point[0] - Bounds.X.Min) * RangeTransform[0]);
|
||||
relative[1] = static_cast<vtkm::FloatDefault>((point[1] - Bounds.Y.Min) * RangeTransform[1]);
|
||||
relative[2] = static_cast<vtkm::FloatDefault>((point[2] - Bounds.Z.Min) * RangeTransform[2]);
|
||||
vtkm::Vec<vtkm::Id, 3> logicalCell;
|
||||
logicalCell[0] = static_cast<vtkm::Id>(vtkm::Floor(relative[0]));
|
||||
logicalCell[1] = static_cast<vtkm::Id>(vtkm::Floor(relative[1]));
|
||||
logicalCell[2] = static_cast<vtkm::Id>(vtkm::Floor(relative[2]));
|
||||
logicalCell[0] =
|
||||
static_cast<vtkm::Id>(vtkm::Floor((point[0] - Bounds.X.Min) * RangeTransform[0]));
|
||||
logicalCell[1] =
|
||||
static_cast<vtkm::Id>(vtkm::Floor((point[1] - Bounds.Y.Min) * RangeTransform[1]));
|
||||
logicalCell[2] =
|
||||
static_cast<vtkm::Id>(vtkm::Floor((point[2] - Bounds.Z.Min) * RangeTransform[2]));
|
||||
// Get the actual cellId, from the logical cell index of the cell
|
||||
cellId = logicalCell[2] * PlaneSize + logicalCell[1] * RowSize + logicalCell[0];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user