Skip to content

Add vtkm::cont::CellSetPermutation

Robert Maynard requested to merge robertmaynard/vtk-m:cellset_permutation into master

vtkm::cont::CellSetPermutation is a subclass of vtkm::cont::CellSet that allows for efficient representation of a CellSet that iterates over a subset or list of cells from an existing CellSetExplicit or CellSetStructured.

vtkm::cont::CellSetPermutation efficient representation for explicit cell sets is attained by using CellSetExplicit where the Shapes, NumIndices, and Offsets are wrapped in permutation ArrayHandles. For structured data we use a custom execution representation that references the original structured data, this saves in having to transform from structured to explicit.

Here is an example of how you create a CellSetPermutation, to iterate over a single cell of a structured data multiple times.

std::vector< vtkm::Id > validCellIds(4,4); 
vtkm::cont::ArrayHandle<vtkm::Id> cellIds = vtkm::cont::make_ArrayHandle(validCellids);

vtkm::cont::CellSetStructured<3> cellSet("cells");
cellSet.SetPointDimensions( vtkm::make_Vec(3,2,3) );

typedef vtkm::cont::CellSetPermutation< vtkm::cont::ArrayHandle<vtkm::Id>,
                                        vtkm::cont::CellSetStructured<3> > permuteStructured;

permuteStructured.Fill(cellIds,cellSet);

Merge request reports