Commit 39929d5a authored by Robert Maynard's avatar Robert Maynard

Update vtkm/io to work with vtkm::cont::ArrayHandleVariant

parent 0c72555e
......@@ -60,8 +60,7 @@ inline void FixupCellSet(vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
{
vtkm::UInt8 shape = shapes.GetPortalConstControl().Get(i);
vtkm::IdComponent numInds = numIndices.GetPortalConstControl().Get(i);
vtkm::cont::ArrayHandle<vtkm::Id>::PortalConstControl connPortal =
connectivity.GetPortalConstControl();
auto connPortal = connectivity.GetPortalConstControl();
switch (shape)
{
case vtkm::CELL_SHAPE_VERTEX:
......@@ -219,9 +218,7 @@ inline void FixupCellSet(vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
inline bool IsSingleShape(const vtkm::cont::ArrayHandle<vtkm::UInt8>& shapes)
{
vtkm::cont::ArrayHandle<vtkm::UInt8>::PortalConstControl shapesPortal =
shapes.GetPortalConstControl();
auto shapesPortal = shapes.GetPortalConstControl();
vtkm::UInt8 shape0 = shapesPortal.Get(0);
for (vtkm::Id i = 1; i < shapes.GetNumberOfValues(); ++i)
{
......
This diff is collapsed.
......@@ -49,15 +49,13 @@ inline vtkm::cont::ArrayHandle<T> ConcatinateArrayHandles(
vtkm::cont::ArrayHandle<T> out;
out.Allocate(size);
using IteratorType = typename vtkm::cont::ArrayPortalToIterators<
typename vtkm::cont::ArrayHandle<T>::PortalControl>::IteratorType;
IteratorType outp = vtkm::cont::ArrayPortalToIteratorBegin(out.GetPortalControl());
auto outp = vtkm::cont::ArrayPortalToIteratorBegin(out.GetPortalControl());
for (std::size_t i = 0; i < arrays.size(); ++i)
{
std::copy(vtkm::cont::ArrayPortalToIteratorBegin(arrays[i].GetPortalConstControl()),
vtkm::cont::ArrayPortalToIteratorEnd(arrays[i].GetPortalConstControl()),
outp);
using DifferenceType = typename std::iterator_traits<IteratorType>::difference_type;
using DifferenceType = typename std::iterator_traits<decltype(outp)>::difference_type;
std::advance(outp, static_cast<DifferenceType>(arrays[i].GetNumberOfValues()));
}
......
......@@ -64,7 +64,7 @@ private:
//Read the points.
std::string dataType;
std::size_t numPoints[3];
vtkm::cont::DynamicArrayHandle X, Y, Z;
vtkm::cont::ArrayHandleVariant X, Y, Z;
// Always read coordinates as vtkm::FloatDefault
std::string readDataType = vtkm::io::internal::DataTypeName<vtkm::FloatDefault>::Name();
......@@ -72,17 +72,17 @@ private:
this->DataFile->Stream >> tag >> numPoints[0] >> dataType >> std::ws;
if (tag != "X_COORDINATES")
throw vtkm::io::ErrorIO("X_COORDINATES tag not found");
this->DoReadDynamicArray(readDataType, numPoints[0], 1, X);
this->DoReadArrayVariant(readDataType, numPoints[0], 1, X);
this->DataFile->Stream >> tag >> numPoints[1] >> dataType >> std::ws;
if (tag != "Y_COORDINATES")
throw vtkm::io::ErrorIO("Y_COORDINATES tag not found");
this->DoReadDynamicArray(readDataType, numPoints[1], 1, Y);
this->DoReadArrayVariant(readDataType, numPoints[1], 1, Y);
this->DataFile->Stream >> tag >> numPoints[2] >> dataType >> std::ws;
if (tag != "Z_COORDINATES")
throw vtkm::io::ErrorIO("Z_COORDINATES tag not found");
this->DoReadDynamicArray(readDataType, numPoints[2], 1, Z);
this->DoReadArrayVariant(readDataType, numPoints[2], 1, Z);
if (dim != vtkm::Id3(static_cast<vtkm::Id>(numPoints[0]),
static_cast<vtkm::Id>(numPoints[1]),
......
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