Merge branch 'windows_tbb_min_max_macro_issue' into 'master'

Windows tbb min max macro issue

See merge request !84
This commit is contained in:
Robert Maynard 2015-07-15 11:12:35 -04:00
commit d22100f06a
3 changed files with 22 additions and 6 deletions

@ -40,7 +40,15 @@
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wconversion"
#endif // gcc || clang
// gcc || clang
#elif _WIN32
// TBB includes windows.h, which clobbers min and max functions so we
// define NOMINMAX to fix that problem. We also include WIN32_LEAN_AND_MEAN
// to reduce the number of macros and objects windows.h imports as those also
// can cause conflicts
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#endif
//we provide an patched implementation of tbb parallel_sort
//that fixes ADL for std::swap. This patch has been submitted to Intel
@ -57,8 +65,11 @@
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
#pragma GCC diagnostic pop
#endif // gcc || clang
// gcc || clang
#elif _WIN32
#undef WIN32_LEAN_AND_MEAN
#undef NOMINMAX
#endif
namespace vtkm {
namespace cont {

@ -309,8 +309,13 @@ public:
gridInfo.origin[2] = static_cast<FloatType>((bounds[5]+bounds[4])*0.5 - gridInfo.grid_width*(gridInfo.dim[2])*.5);
}
if( static_cast<vtkm::Int64>(gridInfo.dim[0])*gridInfo.dim[1]*gridInfo.dim[2] > std::numeric_limits<vtkm::Id>::max() )
const vtkm::Int64 gridSize = static_cast<vtkm::Int64>(gridInfo.dim[0]) *
static_cast<vtkm::Int64>(gridInfo.dim[1]) *
static_cast<vtkm::Int64>(gridInfo.dim[2]);
if( gridSize > std::numeric_limits<vtkm::Id>::max() )
{
throw vtkm::cont::ErrorControlBadValue("Grid resolution larger than vtkm::Id capacity. ");
}
// Use 64-bit id will solve the issue.
//construct the scheduler that will execute all the worklets
@ -373,7 +378,7 @@ public:
///
/// map: convert each triangle vertices from original point id to the new cluster indexes
/// If the triangle is degenerated, set the ids to <-1, -1, -1>
///
///
vtkm::Id nPoints = repPointArray.GetNumberOfValues();
vtkm::cont::ArrayHandle<vtkm::Id3> pointId3Array;

@ -134,7 +134,7 @@ void TestVertexClustering()
VTKM_TEST_ASSERT(ds_out.GetNumberOfCellSets() == 1, "Number of output cellsets mismatch");
vtkm::cont::CellSetExplicit<> *cellset = dynamic_cast<vtkm::cont::CellSetExplicit<> *>(ds_out.GetCellSet(0).get());
VTKM_TEST_ASSERT(cellset, "CellSet Cast fail");
VTKM_TEST_ASSERT(cellset != NULL, "CellSet Cast fail");
vtkm::cont::ExplicitConnectivity<> &conn = cellset->GetNodeToCellConnectivity();
VTKM_TEST_ASSERT(conn.GetConnectivityArray().GetNumberOfValues() == output_pointIds, "Number of connectivity array elements mismatch");
for (vtkm::Id i=0; i<conn.GetConnectivityArray().GetNumberOfValues(); i++)