Commit f74c0d3c authored by Chuck Atkins's avatar Chuck Atkins

Remove type conversion related warnings for GCC

parent 3b067841
......@@ -35,7 +35,7 @@ struct TemplatedTests
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>
......
......@@ -37,7 +37,7 @@ struct TemplatedTests
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>
......
......@@ -36,7 +36,7 @@ struct TemplatedTests
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
......
......@@ -97,11 +97,11 @@ void FillArray(std::vector<T> &arr,
switch (fillMethod)
{
case 0: xi = static_cast<T>(i); break;
case 1: xi = static_cast<T>(i) / static_cast<vtkm::Float32>(size-1); break;
case 2: xi = static_cast<T>(i*2); break;
case 3: xi = static_cast<T>(i*0.1f); break;
case 4: xi = static_cast<T>(i*i); break;
case 0: break;
case 1: xi /= static_cast<vtkm::Float32>(size-1); break;
case 2: xi *= 2; break;
case 3: xi *= 0.1f; break;
case 4: xi *= xi; break;
default: VTKM_TEST_FAIL("Bad internal test state: invalid fill method.");
}
arr[i] = xi;
......
......@@ -103,7 +103,7 @@ void FillMethod(vtkm::IdComponent method,
break;
case 1:
origin = 0;
spacing = static_cast<T>(1.0/dimensionSize);
spacing = static_cast<T>(1.0/static_cast<double>(dimensionSize));
break;
case 2:
origin = 0;
......@@ -120,7 +120,7 @@ void FillMethod(vtkm::IdComponent method,
}
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>
......
......@@ -849,8 +849,8 @@ CellDerivative(const FieldVecType &field,
fieldCenter = fieldCenter + field[pointIndex];
wcoordCenter = wcoordCenter + wCoords[pointIndex];
}
fieldCenter = fieldCenter*FieldType(1.0f/numPoints);
wcoordCenter = wcoordCenter*WCoordType(1.0f/numPoints);
fieldCenter = fieldCenter*FieldType(1.0f/static_cast<float>(numPoints));
wcoordCenter = wcoordCenter*WCoordType(1.0f/static_cast<float>(numPoints));
ParametricCoordType angle;
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*FieldType(1.0f/numPoints);
fieldCenter = fieldCenter*FieldType(1.0f/static_cast<float>(numPoints));
if ((vtkm::Abs(pcoords[0]-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][2] = 0;
polygonCoords[1][0] = 0.5f*(vtkm::Cos(deltaAngle*firstPointIndex)+1);
polygonCoords[1][1] = 0.5f*(vtkm::Sin(deltaAngle*firstPointIndex)+1);
polygonCoords[1][2] = 0;
polygonCoords[1][0] = 0.5f*(vtkm::Cos(deltaAngle*static_cast<ParametricCoordType>(firstPointIndex))+1);
polygonCoords[1][1] = 0.5f*(vtkm::Sin(deltaAngle*static_cast<ParametricCoordType>(firstPointIndex))+1);
polygonCoords[1][2] = 0.0f;
polygonCoords[2][0] = 0.5f*(vtkm::Cos(deltaAngle*secondPointIndex)+1);
polygonCoords[2][1] = 0.5f*(vtkm::Sin(deltaAngle*secondPointIndex)+1);
polygonCoords[2][2] = 0;
polygonCoords[2][0] = 0.5f*(vtkm::Cos(deltaAngle*static_cast<ParametricCoordType>(secondPointIndex))+1);
polygonCoords[2][1] = 0.5f*(vtkm::Sin(deltaAngle*static_cast<ParametricCoordType>(secondPointIndex))+1);
polygonCoords[2][2] = 0.0f;
vtkm::Vec<ParametricCoordType,3> trianglePCoords =
vtkm::exec::internal::ReverseInterpolateTriangle(
......
......@@ -802,7 +802,7 @@ WorldCoordinatesToParametricCoordinates(
{
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,
// 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
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
......
......@@ -46,7 +46,7 @@ struct DivideWorklet: public vtkm::worklet::WorkletMapField
void operator()(const ValueType &v, const vtkm::Id &count, ValueType &vout) const
{
typedef typename VecTraits<ValueType>::ComponentType ComponentType;
vout = v * ComponentType(1./count);
vout = v * ComponentType(1./static_cast<double>(count));
}
template <class T1, class T2>
......
......@@ -330,7 +330,7 @@ public:
vtkm::Float64 res[3];
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]));
......@@ -342,9 +342,9 @@ public:
gridInfo.dim[2] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds[5]-bounds[4])*inv_grid_width), nDivisions[2]);
// center the mesh in the grids
gridInfo.origin[0] = (bounds[1]+bounds[0])*0.5 - gridInfo.grid_width*(gridInfo.dim[0])*.5;
gridInfo.origin[1] = (bounds[3]+bounds[2])*0.5 - gridInfo.grid_width*(gridInfo.dim[1])*.5;
gridInfo.origin[2] = (bounds[5]+bounds[4])*0.5 - gridInfo.grid_width*(gridInfo.dim[2])*.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*static_cast<vtkm::Float64>(gridInfo.dim[1])*.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
......
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