Merge topic 'correct_gcc_7_crashes'
f025c218 Suppress conversion warning inside Cell Interpolate code 822d4c61 Marching Cubes test doesn't abuse fall through case statements dac7ab98 Correct a bad memcpy in ColorTable that gcc 7 found c6726644 Reformat some test code to stop gcc 7.3 from segfaulting. Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Utkarsh Ayachit <utkarsh.ayachit@kitware.com> Merge-request: !1175
This commit is contained in:
commit
4649c172c7
@ -132,7 +132,7 @@ inline bool rangeAlmostEqual(const vtkm::Range& r)
|
||||
// needs to be a memcpy to avoid strict aliasing issues, doing a count
|
||||
// of 2*sizeof(T) to couple both values at the same time
|
||||
std::memcpy(irange, &r.Min, sizeof(vtkm::Int64));
|
||||
std::memcpy(irange, &r.Max, sizeof(vtkm::Int64));
|
||||
std::memcpy(irange + 1, &r.Max, sizeof(vtkm::Int64));
|
||||
// determine the absolute delta between these two numbers.
|
||||
const vtkm::Int64 delta = std::abs(irange[1] - irange[0]);
|
||||
// If the numbers are not nearly equal, we don't touch them. This avoids running into
|
||||
|
@ -49,6 +49,19 @@ struct CopyWorklet : public vtkm::worklet::WorkletMapField
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename S, typename DeviceAdapter>
|
||||
inline void TestVirtualAccess(const vtkm::cont::ArrayHandle<T, S>& in,
|
||||
vtkm::cont::ArrayHandle<T>& out,
|
||||
DeviceAdapter)
|
||||
{
|
||||
vtkm::worklet::DispatcherMapField<CopyWorklet, DeviceAdapter>().Invoke(
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates(in), vtkm::cont::ArrayHandleVirtualCoordinates(out));
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal_portals(in.GetPortalConstControl(), out.GetPortalConstControl()),
|
||||
"Input and output portals don't match");
|
||||
}
|
||||
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
template <typename DeviceAdapter>
|
||||
@ -60,17 +73,7 @@ private:
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>>;
|
||||
|
||||
template <typename T, typename InStorageTag, typename OutStorageTag>
|
||||
static void TestVirtualAccess(const vtkm::cont::ArrayHandle<T, InStorageTag>& in,
|
||||
vtkm::cont::ArrayHandle<T, OutStorageTag>& out)
|
||||
{
|
||||
vtkm::worklet::DispatcherMapField<CopyWorklet, DeviceAdapter>().Invoke(
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates(in),
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates(out));
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal_portals(in.GetPortalConstControl(), out.GetPortalConstControl()),
|
||||
"Input and output portals don't match");
|
||||
}
|
||||
|
||||
static void TestAll()
|
||||
{
|
||||
@ -86,10 +89,11 @@ private:
|
||||
{
|
||||
a1.GetPortalControl().Set(i, TestValue(i, PointType()));
|
||||
}
|
||||
TestVirtualAccess(a1, out);
|
||||
TestVirtualAccess(a1, out, DeviceAdapter{});
|
||||
|
||||
std::cout << "Testing ArrayHandleUniformPointCoordinates as input\n";
|
||||
TestVirtualAccess(vtkm::cont::ArrayHandleUniformPointCoordinates(vtkm::Id3(4, 4, 4)), out);
|
||||
auto t = vtkm::cont::ArrayHandleUniformPointCoordinates(vtkm::Id3(4, 4, 4));
|
||||
TestVirtualAccess(t, out, DeviceAdapter{});
|
||||
|
||||
std::cout << "Testing ArrayHandleCartesianProduct as input\n";
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> c1, c2, c3;
|
||||
@ -103,7 +107,8 @@ private:
|
||||
c2.GetPortalControl().Set(i, p[1]);
|
||||
c3.GetPortalControl().Set(i, p[2]);
|
||||
}
|
||||
TestVirtualAccess(vtkm::cont::make_ArrayHandleCartesianProduct(c1, c2, c3), out);
|
||||
TestVirtualAccess(
|
||||
vtkm::cont::make_ArrayHandleCartesianProduct(c1, c2, c3), out, DeviceAdapter{});
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -70,7 +70,7 @@ private:
|
||||
"Unexpected scalar field range.");
|
||||
}
|
||||
|
||||
template <typename T, vtkm::Id NumberOfComponents>
|
||||
template <typename T, vtkm::IdComponent NumberOfComponents>
|
||||
static void TestVecField()
|
||||
{
|
||||
const vtkm::Id nvals = 11;
|
||||
|
@ -27,6 +27,11 @@
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
|
||||
#if (defined(VTKM_GCC) || defined(VTKM_CLANG))
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif // gcc || clang
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace exec
|
||||
@ -441,4 +446,8 @@ VTKM_EXEC typename FieldVecType::ComponentType CellInterpolate(
|
||||
}
|
||||
} // namespace vtkm::exec
|
||||
|
||||
#if (defined(VTKM_GCC) || defined(VTKM_CLANG))
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // gcc || clang
|
||||
|
||||
#endif //vtk_m_exec_Interpolate_h
|
||||
|
@ -182,25 +182,30 @@ public:
|
||||
|
||||
switch (localId)
|
||||
{
|
||||
case 2:
|
||||
globalId += 1;
|
||||
case 3:
|
||||
globalId += this->Dimension;
|
||||
case 1:
|
||||
globalId += 1;
|
||||
case 0:
|
||||
break;
|
||||
case 6:
|
||||
globalId += 1;
|
||||
case 7:
|
||||
globalId += this->Dimension;
|
||||
case 5:
|
||||
case 1:
|
||||
globalId += 1;
|
||||
break;
|
||||
case 2:
|
||||
globalId += this->Dimension + 2;
|
||||
break;
|
||||
case 3:
|
||||
globalId += this->Dimension + 1;
|
||||
break;
|
||||
case 4:
|
||||
globalId += this->DimPlus1Squared;
|
||||
break;
|
||||
case 5:
|
||||
globalId += this->DimPlus1Squared + 1;
|
||||
break;
|
||||
case 6:
|
||||
globalId += this->Dimension + this->DimPlus1Squared + 2;
|
||||
break;
|
||||
case 7:
|
||||
globalId += this->Dimension + this->DimPlus1Squared + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return globalId;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user