mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Fix cell measure when using double precision as default.
This commit is contained in:
parent
ffe7f67e52
commit
52a1495859
@ -60,10 +60,10 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
}
|
||||
else
|
||||
{
|
||||
arcLength = Magnitude(pts[1] - pts[0]);
|
||||
arcLength = static_cast<OutType>(Magnitude(pts[1] - pts[0]));
|
||||
for (int ii = 2; ii < numPts; ++ii)
|
||||
{
|
||||
arcLength += Magnitude(pts[ii] - pts[ii - 1]);
|
||||
arcLength += static_cast<OutType>(Magnitude(pts[ii] - pts[ii - 1]));
|
||||
}
|
||||
}
|
||||
return arcLength;
|
||||
@ -84,7 +84,7 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
}
|
||||
typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
|
||||
typename PointCoordVecType::ComponentType v2 = pts[2] - pts[0];
|
||||
OutType area = OutType(0.5) * Magnitude(Cross(v1, v2));
|
||||
OutType area = OutType(0.5) * static_cast<OutType>(Magnitude(Cross(v1, v2)));
|
||||
return area;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ void TestCellMeasuresFilter(vtkm::cont::DataSet& dataset,
|
||||
VTKM_TEST_ASSERT(temp.GetNumberOfValues() == static_cast<vtkm::Id>(expected.size()),
|
||||
"Output field could not be found or was improper.");
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> resultArrayHandle;
|
||||
temp.CopyTo(resultArrayHandle);
|
||||
VTKM_TEST_ASSERT(resultArrayHandle.GetNumberOfValues() == static_cast<vtkm::Id>(expected.size()),
|
||||
"Wrong number of entries in the output dataset");
|
||||
|
@ -34,7 +34,7 @@ void TestCellMeasureUniform3D()
|
||||
vtkm::cont::testing::MakeTestDataSet testDataSet;
|
||||
vtkm::cont::DataSet dataSet = testDataSet.Make3DUniformDataSet0();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellMeasure<vtkm::Volume>> dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), result);
|
||||
@ -55,7 +55,7 @@ void TestCellMeasureWorklet(vtkm::cont::DataSet& dataset,
|
||||
{
|
||||
std::cout << "Testing CellMeasures Filter on " << msg << "\n";
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellMeasure<IntegrationType>> dispatcher;
|
||||
dispatcher.Invoke(dataset.GetCellSet(), dataset.GetCoordinateSystem(), result);
|
||||
|
Loading…
Reference in New Issue
Block a user