Remove boost :: int64_t from smtk/mesh/ExtractTessellation.h/cxx
using boost::int64_t causes problems on systems where VTK doesn't set vtkIdType to the same value. This likely needs to use the same logic as the vtkIdType selection logic to ensure compatibility to VTK.
One sloppy workaround for this issue is in ExportVTKData.cxx:167:
namespace
{
template<class T, class U>
struct swapDataTypesIfNecessary
{
void operator()(T*& in, U*& out, boost::int64_t len)
{
out = new U[len];
for (boost::int64_t i=0;i<len;i++)
{
out[i] = in[i];
}
delete [] in;
}
};
template<class T>
struct swapDataTypesIfNecessary<T,T>
{
void operator()(T*& in, T*& out, boost::int64_t)
{
out = in;
}
};
}
//----------------------------------------------------------------------------
void ExportVTKData::operator()(const smtk::mesh::MeshSet& meshset,
vtkUnstructuredGrid* ug) const
{
boost::int64_t connectivityLength= -1;
boost::int64_t numberOfCells = -1;
boost::int64_t numberOfPoints = -1;
//determine the allocation lengths
smtk::mesh::PreAllocatedTessellation::determineAllocationLengths(
meshset, connectivityLength, numberOfCells, numberOfPoints);
// add the number of cells to the connectivity length to get the length of
// VTK-style connectivity
connectivityLength += numberOfCells;
//create raw data buffers to hold our data
double* pointsData = new double[3*numberOfPoints];
unsigned char* cellTypesData = new unsigned char[numberOfCells];
boost::int64_t* cellLocationsData_ = new boost::int64_t[numberOfCells];
boost::int64_t* connectivityData_ = new boost::int64_t[connectivityLength];
//extract tessellation information
smtk::mesh::PreAllocatedTessellation tess(connectivityData_,
cellLocationsData_,
cellTypesData, pointsData);
smtk::mesh::extractTessellation(meshset, tess);
swapDataTypesIfNecessary<boost::int64_t, vtkIdType> swap;
vtkIdType* cellLocationsData;
swap(cellLocationsData_, cellLocationsData, numberOfCells);
vtkIdType* connectivityData;
swap(connectivityData_, connectivityData, connectivityLength);
// create vtk data arrays to hold our data
vtkNew<vtkDoubleArray> pointsArray;
vtkNew<vtkUnsignedCharArray> cellTypes;
vtkNew<vtkIdTypeArray> cellLocations;
vtkNew<vtkIdTypeArray> connectivity;
// transfer ownership of our raw data arrays to the vtk data arrays
pointsArray->SetNumberOfComponents(3);
pointsArray->SetArray(pointsData, 3*numberOfPoints, false,
vtkDoubleArray::VTK_DATA_ARRAY_DELETE);
cellTypes->SetArray(cellTypesData, numberOfCells, false,
vtkUnsignedCharArray::VTK_DATA_ARRAY_DELETE);
cellLocations->SetArray(cellLocationsData, numberOfCells, false,
vtkIdTypeArray::VTK_DATA_ARRAY_DELETE);
connectivity->SetArray(connectivityData, connectivityLength, false,
vtkIdTypeArray::VTK_DATA_ARRAY_DELETE);
vtkNew<vtkPoints> points;
points->SetData(pointsArray.GetPointer());
vtkNew<vtkCellArray> cells;
cells->SetCells(numberOfCells, connectivity.GetPointer());
ug->SetPoints(points.GetPointer());
ug->SetCells(cellTypes.GetPointer(), cellLocations.GetPointer(),
cells.GetPointer());
}