Commit d755e43d authored by Dave Pugmire's avatar Dave Pugmire
Browse files

Use ArrayHandleCompositeVector to represent separated point arrays for DataSetBuilderExplicit.h.

parent c7b0ffb8
......@@ -21,6 +21,7 @@
#define vtk_m_cont_CoordinateSystem_h
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
#include <vtkm/cont/ArrayHandleCompositeVector.h>
#include <vtkm/cont/Field.h>
#ifndef VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG
......@@ -36,6 +37,22 @@
namespace vtkm {
namespace cont {
namespace detail {
typedef vtkm::cont::ArrayHandleCompositeVectorType<
vtkm::cont::ArrayHandle<vtkm::Float32>,
vtkm::cont::ArrayHandle<vtkm::Float32>,
vtkm::cont::ArrayHandle<vtkm::Float32> >::type
ArrayHandleCompositeVectorFloat32_3Default;
typedef vtkm::cont::ArrayHandleCompositeVectorType<
vtkm::cont::ArrayHandle<vtkm::Float64>,
vtkm::cont::ArrayHandle<vtkm::Float64>,
vtkm::cont::ArrayHandle<vtkm::Float64> >::type
ArrayHandleCompositeVectorFloat64_3Default;
} // namespace detail
/// \brief Default storage list for CoordinateSystem arrays.
///
/// \c VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG is set to this value
......@@ -44,7 +61,9 @@ namespace cont {
struct StorageListTagCoordinateSystemDefault
: vtkm::ListTagJoin<
VTKM_DEFAULT_STORAGE_LIST_TAG,
vtkm::ListTagBase<vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag> >
vtkm::ListTagBase<vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag,
detail::ArrayHandleCompositeVectorFloat32_3Default::StorageTag,
detail::ArrayHandleCompositeVectorFloat64_3Default::StorageTag> >
{ };
typedef vtkm::cont::DynamicArrayHandleBase<
......
......@@ -22,6 +22,7 @@
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/ArrayHandleCompositeVector.h>
#include <vtkm/cont/Assert.h>
namespace vtkm {
......@@ -183,20 +184,10 @@ DataSetBuilderExplicit::BuildDataSet(const vtkm::cont::ArrayHandle<T> &X,
shapes.GetNumberOfValues() == numIndices.GetNumberOfValues());
vtkm::cont::DataSet dataSet;
//Temp code until ArrayHandleCompositeVector is fully working...
typedef vtkm::Vec<vtkm::Float32,3> CoordType;
std::size_t nPts = X.GetNumberOfValues();
std::vector<CoordType> coords(nPts);
for (std::size_t i = 0; i < nPts; i++)
{
coords[i][0] = X.GetPortalConstControl().Get(i);
coords[i][1] = Y.GetPortalConstControl().Get(i);
coords[i][2] = Z.GetPortalConstControl().Get(i);
}
dataSet.AddCoordinateSystem(
vtkm::cont::CoordinateSystem(coordsNm, 1, coords));
vtkm::cont::CoordinateSystem(coordsNm, 1,
make_ArrayHandleCompositeVector(X,0, Y,0, Z,0)));
vtkm::Id nPts = X.GetNumberOfValues();
vtkm::cont::CellSetExplicit<> cellSet(nPts, cellNm, 3);
cellSet.Fill(shapes, numIndices, connectivity);
......
Supports Markdown
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