mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Merge topic 'lookupTable-add-one-bp' into release-2.1
e734f14b8 LookupTable: Shift computed idx by 1 Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Vicente Bolea <vicente.bolea@kitware.com> Merge-request: !3125
This commit is contained in:
commit
7fa44ff4a8
@ -466,14 +466,14 @@ void TestLookupTable()
|
|||||||
const bool ran = vtkm::cont::ColorTableMap(field, samples, colors);
|
const bool ran = vtkm::cont::ColorTableMap(field, samples, colors);
|
||||||
VTKM_TEST_ASSERT(ran, "color table failed to execute");
|
VTKM_TEST_ASSERT(ran, "color table failed to execute");
|
||||||
|
|
||||||
//values confirmed with ParaView 5.4
|
//values confirmed with ParaView 5.11
|
||||||
CheckColors(colors,
|
CheckColors(colors,
|
||||||
{ { 0, 0, 255 },
|
{ { 0, 0, 255 },
|
||||||
{ 59, 76, 192 },
|
{ 59, 76, 192 },
|
||||||
{ 122, 157, 248 },
|
{ 124, 159, 249 },
|
||||||
{ 191, 211, 246 },
|
{ 192, 212, 245 },
|
||||||
{ 241, 204, 184 },
|
{ 242, 203, 183 },
|
||||||
{ 238, 134, 105 },
|
{ 238, 133, 104 },
|
||||||
{ 180, 4, 38 },
|
{ 180, 4, 38 },
|
||||||
{ 255, 0, 0 } });
|
{ 255, 0, 0 } });
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,10 @@ void TestFieldToColors()
|
|||||||
vtkm::cont::ArrayHandle<vtkm::Vec4ui_8> resultRGBAHandle;
|
vtkm::cont::ArrayHandle<vtkm::Vec4ui_8> resultRGBAHandle;
|
||||||
Result.GetData().AsArrayHandle(resultRGBAHandle);
|
Result.GetData().AsArrayHandle(resultRGBAHandle);
|
||||||
|
|
||||||
//values confirmed with ParaView 5.4
|
//values confirmed with ParaView 5.11
|
||||||
const vtkm::Vec4ui_8 correct_diverging_rgba_values[nvals] = {
|
const vtkm::Vec4ui_8 correct_diverging_rgba_values[nvals] = {
|
||||||
{ 0, 0, 255, 255 }, { 59, 76, 192, 255 }, { 122, 157, 248, 255 }, { 191, 211, 246, 255 },
|
{ 0, 0, 255, 255 }, { 59, 76, 192, 255 }, { 124, 159, 249, 255 }, { 192, 212, 245, 255 },
|
||||||
{ 241, 204, 184, 255 }, { 238, 134, 105, 255 }, { 180, 4, 38, 255 }, { 255, 0, 0, 255 }
|
{ 242, 203, 183, 255 }, { 238, 133, 104, 255 }, { 180, 4, 38, 255 }, { 255, 0, 0, 255 }
|
||||||
};
|
};
|
||||||
auto portalRGBA = resultRGBAHandle.ReadPortal();
|
auto portalRGBA = resultRGBAHandle.ReadPortal();
|
||||||
for (std::size_t i = 0; i < nvals; ++i)
|
for (std::size_t i = 0; i < nvals; ++i)
|
||||||
@ -63,10 +63,10 @@ void TestFieldToColors()
|
|||||||
vtkm::cont::ArrayHandle<vtkm::Vec3ui_8> resultRGBHandle;
|
vtkm::cont::ArrayHandle<vtkm::Vec3ui_8> resultRGBHandle;
|
||||||
Result.GetData().AsArrayHandle(resultRGBHandle);
|
Result.GetData().AsArrayHandle(resultRGBHandle);
|
||||||
|
|
||||||
//values confirmed with ParaView 5.4
|
//values confirmed with ParaView 5.11
|
||||||
const vtkm::Vec3ui_8 correct_diverging_rgb_values[nvals] = { { 0, 0, 255 }, { 59, 76, 192 },
|
const vtkm::Vec3ui_8 correct_diverging_rgb_values[nvals] = { { 0, 0, 255 }, { 59, 76, 192 },
|
||||||
{ 122, 157, 248 }, { 191, 211, 246 },
|
{ 124, 159, 249 }, { 192, 212, 245 },
|
||||||
{ 241, 204, 184 }, { 238, 134, 105 },
|
{ 242, 203, 183 }, { 238, 133, 104 },
|
||||||
{ 180, 4, 38 }, { 255, 0, 0 } };
|
{ 180, 4, 38 }, { 255, 0, 0 } };
|
||||||
auto portalRGB = resultRGBHandle.ReadPortal();
|
auto portalRGB = resultRGBHandle.ReadPortal();
|
||||||
for (std::size_t i = 0; i < nvals; ++i)
|
for (std::size_t i = 0; i < nvals; ++i)
|
||||||
|
@ -94,7 +94,7 @@ struct LookupTable : public vtkm::worklet::WorkletMapField
|
|||||||
// When v is very close to p.Range[1], the floating point calculation giving
|
// When v is very close to p.Range[1], the floating point calculation giving
|
||||||
// idx may map above the highest value in the lookup table. That is why it
|
// idx may map above the highest value in the lookup table. That is why it
|
||||||
// is padded
|
// is padded
|
||||||
idx = static_cast<vtkm::Int32>(v);
|
idx = 1 + static_cast<vtkm::Int32>(v);
|
||||||
}
|
}
|
||||||
output = lookupTable.Get(idx);
|
output = lookupTable.Get(idx);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user