Fix support for enabling 64bit vtkm::Id and double precision

The CMake flag and define differ in their capitalization of the 'm' in
VTKm so I've made CMake variables that match those used in Configure.h.in,
thereby keeping the original naming of VTKm in CMake code, and VTKM in the
C++ code.

This fix also revealed some areas in CellSet and CellSetExplicit where ints
where used instead of vtkm::Ids which caused errors with child classes who
override the methods and returned a vtkm::Id instead of an int.

Also fixed issues that appeared in TestOutOfMemory which got out of date due
to not being compiled since the `VTKM_USE_64BIT_IDS` flag would never be set.
The test now runs and passes when 64bit ids are enabled.
This commit is contained in:
Will Usher 2015-07-22 13:49:50 -06:00 committed by Robert Maynard
parent c7d3d0df5c
commit 50fa6f78d3
4 changed files with 24 additions and 14 deletions

@ -131,12 +131,21 @@ check_type_size("long long" VTKm_SIZE_LONG_LONG BUILTIN_TYPES_ONLY)
#-----------------------------------------------------------------------------
# Build the configure file.
# need to set VTKM_USE_DOUBLE_PRECISION, and VTKM_USE_64BIT_IDS as that
# is the spelling we use for our defines.
set(VTKM_USE_DOUBLE_PRECISION ${VTKm_USE_DOUBLE_PRECISION})
set(VTKM_USE_64BIT_IDS ${VTKm_USE_64BIT_IDS})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkm/internal/Configure.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkm/internal/Configure.h
@ONLY)
vtkm_install_headers(
vtkm/internal ${CMAKE_CURRENT_BINARY_DIR}/vtkm/internal/Configure.h)
unset(VTKM_USE_DOUBLE_PRECISION)
unset(VTKM_USE_64BIT_IDS)
#-----------------------------------------------------------------------------
# List of Boost features used:
# * Smart Ptr
# * Meta programming language

@ -33,7 +33,7 @@ namespace cont {
class CellSet
{
public:
CellSet(const std::string &n, int d)
CellSet(const std::string &n, vtkm::Id d)
: name(n), dimensionality(d), logicalStructure()
{
}
@ -46,19 +46,19 @@ public:
{
return name;
}
virtual int GetDimensionality()
virtual vtkm::Id GetDimensionality()
{
return dimensionality;
}
virtual int GetNumCells() = 0;
virtual vtkm::Id GetNumCells() = 0;
virtual int GetNumFaces()
virtual vtkm::Id GetNumFaces()
{
return 0;
}
virtual int GetNumEdges()
virtual vtkm::Id GetNumEdges()
{
return 0;
}
@ -67,7 +67,7 @@ public:
protected:
std::string name;
int dimensionality;
vtkm::Id dimensionality;
vtkm::cont::LogicalStructure logicalStructure;
};

@ -37,12 +37,12 @@ public:
ConnectivityStorageTag
> ExplicitConnectivityType;
CellSetExplicit(const std::string &n, int d)
CellSetExplicit(const std::string &n, vtkm::Id d)
: CellSet(n,d)
{
}
virtual int GetNumCells()
virtual vtkm::Id GetNumCells()
{
return nodesOfCellsConnectivity.GetNumberOfElements();
}

@ -384,13 +384,14 @@ private:
try
{
std::cout << "Do array allocation that should fail." << std::endl;
vtkm::cont::internal::ArrayManagerExecution<
vtkm::Vector4,StorageTagBasic,DeviceAdapterTag>
bigManager;
vtkm::cont::internal::Storage<
vtkm::Vector4, StorageTagBasic> supportArray;
vtkm::Vec<vtkm::Float32, 4>, StorageTagBasic> supportArray;
vtkm::cont::internal::ArrayManagerExecution<
vtkm::Vec<vtkm::Float32, 4>, StorageTagBasic, DeviceAdapterTag>
bigManager(&supportArray);
const vtkm::Id bigSize = 0x7FFFFFFFFFFFFFFFLL;
bigManager.AllocateArrayForOutput(supportArray, bigSize);
bigManager.PrepareForOutput(bigSize);
// It does not seem reasonable to get here. The previous call should fail.
VTKM_TEST_FAIL("A ridiculously sized allocation succeeded. Either there "
"was a failure that was not reported but should have been "
@ -402,7 +403,7 @@ private:
std::cout << "Got the expected error: " << error.GetMessage() << std::endl;
}
#else
std::cout << "--------- Skiping out of memory test" << std::endl;
std::cout << "--------- Skipping out of memory test" << std::endl;
#endif
}