Merge topic 'cleanup-gcc-warnings'

af7bba06 Refactor liner interpolation to use (1-w)*v0+w*v1
635f8c79 Add a CTestCustom file to to filter out warnings that cant be eliminated
f74c0d3c Remove type conversion related warnings for GCC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !351
This commit is contained in:
Chuck Atkins 2016-03-18 11:47:34 -04:00 committed by Kitware Robot
commit ab1ac55b29
14 changed files with 56 additions and 30 deletions

@ -107,6 +107,8 @@ option(VTKm_USE_64BIT_IDS "Use 64-bit indices." ON)
if (VTKm_ENABLE_TESTING) if (VTKm_ENABLE_TESTING)
enable_testing() enable_testing()
include(CTest) include(CTest)
configure_file(${VTKm_SOURCE_DIR}/CTestCustom.cmake.in
${VTKm_BINARY_DIR}/CTestCustom.cmake @ONLY)
endif() endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

23
CTestCustom.cmake.in Normal file

@ -0,0 +1,23 @@
##============================================================================
## Copyright (c) Kitware, Inc.
## All rights reserved.
## See LICENSE.txt for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notice for more information.
##
## Copyright 2014 Sandia Corporation.
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"warning: ignoring loop annotation"
)

@ -43,10 +43,10 @@ namespace vtkm {
template<typename ValueType, typename WeightType> template<typename ValueType, typename WeightType>
VTKM_EXEC_CONT_EXPORT VTKM_EXEC_CONT_EXPORT
ValueType Lerp(const ValueType &value0, ValueType Lerp(const ValueType &value0,
const ValueType & value1, const ValueType &value1,
const WeightType &weight) const WeightType &weight)
{ {
return static_cast<ValueType>(value0 + weight * (value1-value0)); return static_cast<ValueType>((WeightType(1)-weight)*value0+weight*value1);
} }
template<typename ValueType, vtkm::IdComponent N, typename WeightType> template<typename ValueType, vtkm::IdComponent N, typename WeightType>
VTKM_EXEC_CONT_EXPORT VTKM_EXEC_CONT_EXPORT
@ -54,7 +54,7 @@ vtkm::Vec<ValueType,N> Lerp(const vtkm::Vec<ValueType,N> &value0,
const vtkm::Vec<ValueType,N> &value1, const vtkm::Vec<ValueType,N> &value1,
const WeightType &weight) const WeightType &weight)
{ {
return value0 + static_cast<ValueType>(weight) * (value1-value0); return (WeightType(1)-weight)*value0+weight*value1;
} }
template<typename ValueType, vtkm::IdComponent N> template<typename ValueType, vtkm::IdComponent N>
VTKM_EXEC_CONT_EXPORT VTKM_EXEC_CONT_EXPORT
@ -62,7 +62,8 @@ vtkm::Vec<ValueType,N> Lerp(const vtkm::Vec<ValueType,N> &value0,
const vtkm::Vec<ValueType,N> &value1, const vtkm::Vec<ValueType,N> &value1,
const vtkm::Vec<ValueType,N> &weight) const vtkm::Vec<ValueType,N> &weight)
{ {
return value0 + weight * (value1-value0); static const vtkm::Vec<ValueType,N> One(ValueType(1));
return (One-weight)*value0+weight*value1;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

@ -35,7 +35,7 @@ struct TemplatedTests
ValueType ExpectedValue(vtkm::Id index, ComponentType value) ValueType ExpectedValue(vtkm::Id index, ComponentType value)
{ {
return ValueType(ComponentType(index) + value); return ValueType(static_cast<ComponentType>(index+static_cast<vtkm::Id>(value)));
} }
template<class IteratorType> template<class IteratorType>

@ -37,7 +37,7 @@ struct TemplatedTests
ValueType ExpectedValue(vtkm::Id index, ComponentType value) ValueType ExpectedValue(vtkm::Id index, ComponentType value)
{ {
return ValueType(ComponentType(index) + value); return ValueType(static_cast<ComponentType>(index+static_cast<vtkm::Id>(value)));
} }
template<class IteratorType> template<class IteratorType>

@ -36,7 +36,7 @@ struct TemplatedTests
static ValueType ExpectedValue(vtkm::Id index, ComponentType value) static ValueType ExpectedValue(vtkm::Id index, ComponentType value)
{ {
return ValueType(static_cast<ComponentType>(index) + value); return ValueType(static_cast<ComponentType>(index+static_cast<vtkm::Id>(value)));
} }
class ReadOnlyArrayPortal class ReadOnlyArrayPortal

@ -97,11 +97,11 @@ void FillArray(std::vector<T> &arr,
switch (fillMethod) switch (fillMethod)
{ {
case 0: xi = static_cast<T>(i); break; case 0: break;
case 1: xi = static_cast<T>(i) / static_cast<vtkm::Float32>(size-1); break; case 1: xi /= static_cast<vtkm::Float32>(size-1); break;
case 2: xi = static_cast<T>(i*2); break; case 2: xi *= 2; break;
case 3: xi = static_cast<T>(i*0.1f); break; case 3: xi *= 0.1f; break;
case 4: xi = static_cast<T>(i*i); break; case 4: xi *= xi; break;
default: VTKM_TEST_FAIL("Bad internal test state: invalid fill method."); default: VTKM_TEST_FAIL("Bad internal test state: invalid fill method.");
} }
arr[i] = xi; arr[i] = xi;

@ -103,7 +103,7 @@ void FillMethod(vtkm::IdComponent method,
break; break;
case 1: case 1:
origin = 0; origin = 0;
spacing = static_cast<T>(1.0/dimensionSize); spacing = static_cast<T>(1.0/static_cast<double>(dimensionSize));
break; break;
case 2: case 2:
origin = 0; origin = 0;
@ -120,7 +120,7 @@ void FillMethod(vtkm::IdComponent method,
} }
boundsMin = static_cast<vtkm::Float64>(origin); boundsMin = static_cast<vtkm::Float64>(origin);
boundsMax = static_cast<vtkm::Float64>(origin + (dimensionSize-1)*spacing); boundsMax = static_cast<vtkm::Float64>(origin + static_cast<T>(dimensionSize-1)*spacing);
} }
template <typename T> template <typename T>

@ -849,8 +849,8 @@ CellDerivative(const FieldVecType &field,
fieldCenter = fieldCenter + field[pointIndex]; fieldCenter = fieldCenter + field[pointIndex];
wcoordCenter = wcoordCenter + wCoords[pointIndex]; wcoordCenter = wcoordCenter + wCoords[pointIndex];
} }
fieldCenter = fieldCenter*FieldType(1.0f/numPoints); fieldCenter = fieldCenter*FieldType(1.0f/static_cast<float>(numPoints));
wcoordCenter = wcoordCenter*WCoordType(1.0f/numPoints); wcoordCenter = wcoordCenter*WCoordType(1.0f/static_cast<float>(numPoints));
ParametricCoordType angle; ParametricCoordType angle;
if ((vtkm::Abs(pcoords[0]-0.5f) < 4*vtkm::Epsilon<ParametricCoordType>()) && if ((vtkm::Abs(pcoords[0]-0.5f) < 4*vtkm::Epsilon<ParametricCoordType>()) &&

@ -276,7 +276,7 @@ CellInterpolate(const FieldVecType &field,
{ {
fieldCenter = fieldCenter + field[pointIndex]; fieldCenter = fieldCenter + field[pointIndex];
} }
fieldCenter = fieldCenter*FieldType(1.0f/numPoints); fieldCenter = fieldCenter*FieldType(1.0f/static_cast<float>(numPoints));
if ((vtkm::Abs(pcoords[0]-0.5f) < 4*vtkm::Epsilon<ParametricCoordType>()) && if ((vtkm::Abs(pcoords[0]-0.5f) < 4*vtkm::Epsilon<ParametricCoordType>()) &&
(vtkm::Abs(pcoords[1]-0.5f) < 4*vtkm::Epsilon<ParametricCoordType>())) (vtkm::Abs(pcoords[1]-0.5f) < 4*vtkm::Epsilon<ParametricCoordType>()))
@ -305,13 +305,13 @@ CellInterpolate(const FieldVecType &field,
polygonCoords[0][1] = 0.5f; polygonCoords[0][1] = 0.5f;
polygonCoords[0][2] = 0; polygonCoords[0][2] = 0;
polygonCoords[1][0] = 0.5f*(vtkm::Cos(deltaAngle*firstPointIndex)+1); polygonCoords[1][0] = 0.5f*(vtkm::Cos(deltaAngle*static_cast<ParametricCoordType>(firstPointIndex))+1);
polygonCoords[1][1] = 0.5f*(vtkm::Sin(deltaAngle*firstPointIndex)+1); polygonCoords[1][1] = 0.5f*(vtkm::Sin(deltaAngle*static_cast<ParametricCoordType>(firstPointIndex))+1);
polygonCoords[1][2] = 0; polygonCoords[1][2] = 0.0f;
polygonCoords[2][0] = 0.5f*(vtkm::Cos(deltaAngle*secondPointIndex)+1); polygonCoords[2][0] = 0.5f*(vtkm::Cos(deltaAngle*static_cast<ParametricCoordType>(secondPointIndex))+1);
polygonCoords[2][1] = 0.5f*(vtkm::Sin(deltaAngle*secondPointIndex)+1); polygonCoords[2][1] = 0.5f*(vtkm::Sin(deltaAngle*static_cast<ParametricCoordType>(secondPointIndex))+1);
polygonCoords[2][2] = 0; polygonCoords[2][2] = 0.0f;
vtkm::Vec<ParametricCoordType,3> trianglePCoords = vtkm::Vec<ParametricCoordType,3> trianglePCoords =
vtkm::exec::internal::ReverseInterpolateTriangle( vtkm::exec::internal::ReverseInterpolateTriangle(

@ -802,7 +802,7 @@ WorldCoordinatesToParametricCoordinates(
{ {
wcoordCenter = wcoordCenter + pointWCoords[pointIndex]; wcoordCenter = wcoordCenter + pointWCoords[pointIndex];
} }
wcoordCenter = wcoordCenter*WCoordType(1.0f/numPoints); wcoordCenter = wcoordCenter*WCoordType(1.0f/static_cast<float>(numPoints));
// Find the normal vector to the polygon. If the polygon is planar, convex, // Find the normal vector to the polygon. If the polygon is planar, convex,
// and in general position, any three points will give a normal in the same // and in general position, any three points will give a normal in the same

@ -411,7 +411,7 @@ template<typename T>
VTKM_EXEC_CONT_EXPORT VTKM_EXEC_CONT_EXPORT
T TestValue(vtkm::Id index, T, vtkm::TypeTraitsRealTag) T TestValue(vtkm::Id index, T, vtkm::TypeTraitsRealTag)
{ {
return T(0.01*index + 1.001); return T(0.01*static_cast<double>(index) + 1.001);
} }
/// Many tests involve getting and setting values in some index-based structure /// Many tests involve getting and setting values in some index-based structure

@ -46,7 +46,7 @@ struct DivideWorklet: public vtkm::worklet::WorkletMapField
void operator()(const ValueType &v, const vtkm::Id &count, ValueType &vout) const void operator()(const ValueType &v, const vtkm::Id &count, ValueType &vout) const
{ {
typedef typename VecTraits<ValueType>::ComponentType ComponentType; typedef typename VecTraits<ValueType>::ComponentType ComponentType;
vout = v * ComponentType(1./count); vout = v * ComponentType(1./static_cast<double>(count));
} }
template <class T1, class T2> template <class T1, class T2>

@ -330,7 +330,7 @@ public:
vtkm::Float64 res[3]; vtkm::Float64 res[3];
for (vtkm::IdComponent i=0; i<3; i++) for (vtkm::IdComponent i=0; i<3; i++)
{ {
res[i] = (bounds[i*2+1]-bounds[i*2])/nDivisions[i]; res[i] = (bounds[i*2+1]-bounds[i*2])/static_cast<vtkm::Float64>(nDivisions[i]);
} }
gridInfo.grid_width = vtkm::Max(res[0], vtkm::Max(res[1], res[2])); gridInfo.grid_width = vtkm::Max(res[0], vtkm::Max(res[1], res[2]));
@ -342,9 +342,9 @@ public:
gridInfo.dim[2] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds[5]-bounds[4])*inv_grid_width), nDivisions[2]); gridInfo.dim[2] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds[5]-bounds[4])*inv_grid_width), nDivisions[2]);
// center the mesh in the grids // center the mesh in the grids
gridInfo.origin[0] = (bounds[1]+bounds[0])*0.5 - gridInfo.grid_width*(gridInfo.dim[0])*.5; gridInfo.origin[0] = (bounds[1]+bounds[0])*0.5 - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[0])*.5;
gridInfo.origin[1] = (bounds[3]+bounds[2])*0.5 - gridInfo.grid_width*(gridInfo.dim[1])*.5; gridInfo.origin[1] = (bounds[3]+bounds[2])*0.5 - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[1])*.5;
gridInfo.origin[2] = (bounds[5]+bounds[4])*0.5 - gridInfo.grid_width*(gridInfo.dim[2])*.5; gridInfo.origin[2] = (bounds[5]+bounds[4])*0.5 - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[2])*.5;
} }
//construct the scheduler that will execute all the worklets //construct the scheduler that will execute all the worklets