Commit 68cb906a authored by Robert Maynard's avatar Robert Maynard Committed by Kitware Robot

Merge topic 'correct_ubsan_undefined_behavior'

512d0431 Cell and Point locators have correct export visibility
c7f82758 Correct signed to unsigned warning conversion found by clang-8
c2879784 Gradient's ComputeDivergence is now properly initialized
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti's avatarAllison Vacanti <allison.vacanti@kitware.com>
Merge-request: !1705
parents 5e534205 512d0431
......@@ -291,7 +291,7 @@ struct ReduceHelper
if (numVals >= numThreads * 2)
{
doParallel = true;
threadData.reset(new ReturnType[numThreads]);
threadData.reset(new ReturnType[static_cast<std::size_t>(numThreads)]);
}
}
......
......@@ -19,7 +19,7 @@ namespace vtkm
namespace exec
{
class CellLocator : public vtkm::VirtualObjectBase
class VTKM_ALWAYS_EXPORT CellLocator : public vtkm::VirtualObjectBase
{
public:
VTKM_EXEC_CONT virtual ~CellLocator() noexcept
......
......@@ -52,7 +52,8 @@ struct CellLocatorBoundingIntervalHierarchyNode
}; // struct CellLocatorBoundingIntervalHierarchyNode
template <typename DeviceAdapter, typename CellSetType>
class VTKM_ALWAYS_EXPORT CellLocatorBoundingIntervalHierarchyExec : public vtkm::exec::CellLocator
class VTKM_ALWAYS_EXPORT CellLocatorBoundingIntervalHierarchyExec final
: public vtkm::exec::CellLocator
{
using NodeArrayHandle =
vtkm::cont::ArrayHandle<vtkm::exec::CellLocatorBoundingIntervalHierarchyNode>;
......
......@@ -29,7 +29,7 @@ namespace exec
{
template <typename DeviceAdapter>
class VTKM_ALWAYS_EXPORT CellLocatorRectilinearGrid : public vtkm::exec::CellLocator
class VTKM_ALWAYS_EXPORT CellLocatorRectilinearGrid final : public vtkm::exec::CellLocator
{
private:
using FromType = vtkm::TopologyElementTagPoint;
......
......@@ -28,7 +28,7 @@ namespace exec
{
template <typename DeviceAdapter>
class VTKM_ALWAYS_EXPORT CellLocatorUniformGrid : public vtkm::exec::CellLocator
class VTKM_ALWAYS_EXPORT CellLocatorUniformGrid final : public vtkm::exec::CellLocator
{
private:
using FromType = vtkm::TopologyElementTagPoint;
......
......@@ -17,9 +17,15 @@ namespace vtkm
namespace exec
{
class PointLocator : public vtkm::VirtualObjectBase
class VTKM_ALWAYS_EXPORT PointLocator : public vtkm::VirtualObjectBase
{
public:
VTKM_EXEC_CONT virtual ~PointLocator() noexcept
{
// This must not be defaulted, since defaulted virtual destructors are
// troublesome with CUDA __host__ __device__ markup.
}
VTKM_EXEC virtual void FindNearestNeighbor(const vtkm::Vec<vtkm::FloatDefault, 3>& queryPoint,
vtkm::Id& pointId,
vtkm::FloatDefault& distanceSquared) const = 0;
......
......@@ -25,7 +25,7 @@ namespace exec
{
template <typename DeviceAdapter>
class PointLocatorUniformGrid : public vtkm::exec::PointLocator
class VTKM_ALWAYS_EXPORT PointLocatorUniformGrid final : public vtkm::exec::PointLocator
{
public:
using CoordPortalType =
......
......@@ -30,8 +30,6 @@ namespace filter
class Gradient : public vtkm::filter::FilterCell<Gradient>
{
public:
Gradient();
/// When this flag is on (default is off), the gradient filter will provide a
/// point based gradients, which are significantly more costly since for each
/// point we need to compute the gradient of each cell that uses it.
......@@ -94,17 +92,17 @@ public:
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
private:
bool ComputePointGradient;
bool ComputeDivergence;
bool ComputeVorticity;
bool ComputeQCriterion;
bool StoreGradient;
bool RowOrdering;
std::string GradientsName;
std::string DivergenceName;
std::string VorticityName;
std::string QCriterionName;
bool ComputePointGradient = false;
bool ComputeDivergence = false;
bool ComputeVorticity = false;
bool ComputeQCriterion = false;
bool StoreGradient = true;
bool RowOrdering = true;
std::string DivergenceName = "Divergence";
std::string GradientsName = "Gradients";
std::string QCriterionName = "QCriterion";
std::string VorticityName = "Vorticity";
};
template <>
......
......@@ -57,20 +57,6 @@ namespace vtkm
namespace filter
{
//-----------------------------------------------------------------------------
Gradient::Gradient()
: ComputePointGradient(false)
, ComputeVorticity(false)
, ComputeQCriterion(false)
, StoreGradient(true)
, RowOrdering(true)
, GradientsName("Gradients")
, DivergenceName("Divergence")
, VorticityName("Vorticity")
, QCriterionName("QCriterion")
{
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy>
inline vtkm::cont::DataSet Gradient::DoExecute(
......
......@@ -126,7 +126,7 @@ private:
void AllocateFilterMemory()
{
LowDecomposeFilter = new vtkm::Float64[FilterLength * 4];
LowDecomposeFilter = new vtkm::Float64[static_cast<std::size_t>(FilterLength * 4)];
HighDecomposeFilter = LowDecomposeFilter + FilterLength;
LowReconstructFilter = HighDecomposeFilter + FilterLength;
HighReconstructFilter = LowReconstructFilter + FilterLength;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment