Commit 6883a5ac authored by Robert Maynard's avatar Robert Maynard

Simplify using CellSetPermutation by providing a default permutation type.

Previously you had to explicitly state you wanted a CellSetPermutation
with an ArrayHanlde of Id's, now that is done automatically.
parent bb60abb1
This diff is collapsed.
......@@ -107,8 +107,7 @@ void TestDataSet_Explicit()
dataSet.GetCellSet(0).CopyTo(cellSet);
//verify that we can create a subset of a singlset
typedef vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
vtkm::cont::CellSetSingleType<> > SubsetType;
typedef vtkm::cont::CellSetPermutation< vtkm::cont::CellSetSingleType<> > SubsetType;
SubsetType subset;
subset.Fill(validCellIds,cellSet);
......@@ -158,8 +157,7 @@ void TestDataSet_Structured2D()
dataSet.GetCellSet(0).CopyTo(cellSet);
//verify that we can create a subset of a 2d UniformDataSet
vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
vtkm::cont::CellSetStructured<2> > subset;
vtkm::cont::CellSetPermutation< vtkm::cont::CellSetStructured<2> > subset;
subset.Fill(validCellIds,cellSet);
subset.PrintSummary(std::cout);
......@@ -205,8 +203,7 @@ void TestDataSet_Structured3D()
dataSet.GetCellSet(0).CopyTo(cellSet);
//verify that we can create a subset of a 2d UniformDataSet
vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
vtkm::cont::CellSetStructured<3> > subset;
vtkm::cont::CellSetPermutation< vtkm::cont::CellSetStructured<3> > subset;
subset.Fill(validCellIds,cellSet);
subset.PrintSummary(std::cout);
......
......@@ -24,14 +24,13 @@ set(headers
CellDerivative.h
CellInterpolate.h
ConnectivityExplicit.h
ConnectivityPermuted.h
ConnectivityStructured.h
ConnectivityStructuredPermuted.h
ExecutionObjectBase.h
ExecutionWholeArray.h
FunctorBase.h
NewtonsMethod.h
ParametricCoordinates.h
)
#-----------------------------------------------------------------------------
......
......@@ -19,8 +19,8 @@
//============================================================================
#ifndef vtk_m_exec_ConnectivityStructuredPermuted_h
#define vtk_m_exec_ConnectivityStructuredPermuted_h
#ifndef vtk_m_exec_ConnectivityPermuted_h
#define vtk_m_exec_ConnectivityPermuted_h
#include <vtkm/TopologyElementTag.h>
#include <vtkm/Types.h>
......@@ -30,70 +30,63 @@ namespace vtkm {
namespace exec {
template<typename PermutationPortal,
typename FromTopology,
typename ToTopology,
vtkm::IdComponent Dimension>
class ConnectivityStructuredPermuted
typename OriginalConnectivity>
class ConnectivityPermuted
{
VTKM_IS_TOPOLOGY_ELEMENT_TAG(FromTopology);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(ToTopology);
typedef vtkm::exec::ConnectivityStructured<FromTopology,
ToTopology,
Dimension> StructuredType;
public:
typedef vtkm::Id SchedulingRangeType;
VTKM_EXEC_CONT_EXPORT
ConnectivityStructuredPermuted():
ConnectivityPermuted():
Portal(),
FullStructuredGrid()
Connectivity()
{
}
VTKM_EXEC_CONT_EXPORT
ConnectivityStructuredPermuted(const PermutationPortal& portal,
const StructuredType &src):
ConnectivityPermuted(const PermutationPortal& portal,
const OriginalConnectivity &src):
Portal(portal),
FullStructuredGrid(src)
Connectivity(src)
{
}
VTKM_EXEC_CONT_EXPORT
ConnectivityStructuredPermuted(const ConnectivityStructuredPermuted &src):
ConnectivityPermuted(const ConnectivityPermuted &src):
Portal(src.Portal),
FullStructuredGrid(src.FullStructuredGrid)
Connectivity(src.Connectivity)
{
}
VTKM_EXEC_EXPORT
vtkm::IdComponent GetNumberOfIndices(vtkm::Id index) const {
return this->FullStructuredGrid.GetNumberOfIndices( this->Portal.Get(index) );
return this->Connectivity.GetNumberOfIndices( this->Portal.Get(index) );
}
// This needs some thought. What does cell shape mean when the to topology
// is not a cell?
typedef typename StructuredType::CellShapeTag CellShapeTag;
typedef typename OriginalConnectivity::CellShapeTag CellShapeTag;
VTKM_EXEC_EXPORT
CellShapeTag GetCellShape(vtkm::Id=0) const {
return CellShapeTag();
CellShapeTag GetCellShape(vtkm::Id index) const {
vtkm::Id pIndex = this->Portal.Get(index);
return this->Connectivity.GetCellShape( pIndex );
}
typedef typename StructuredType::IndicesType IndicesType;
typedef typename OriginalConnectivity::IndicesType IndicesType;
VTKM_EXEC_EXPORT
IndicesType GetIndices(vtkm::Id index) const
{
return this->FullStructuredGrid.GetIndices( this->Portal.Get(index) );
return this->Connectivity.GetIndices( this->Portal.Get(index) );
}
private:
PermutationPortal Portal;
StructuredType FullStructuredGrid;
OriginalConnectivity Connectivity;
};
}
} // namespace vtkm::exec
#endif //vtk_m_exec_ConnectivityStructuredPermuted_h
#endif //vtk_m_exec_ConnectivityPermuted_h
......@@ -74,7 +74,7 @@ public:
// is not a cell?
typedef typename InternalsType::CellShapeTag CellShapeTag;
VTKM_EXEC_EXPORT
CellShapeTag GetCellShape(vtkm::Id=0) const {
CellShapeTag GetCellShape(vtkm::Id) const {
return CellShapeTag();
}
......@@ -116,11 +116,11 @@ public:
}
VTKM_EXEC_CONT_EXPORT
vtkm::Vec<vtkm::Id,Dimension> GetPointDimensions() const
vtkm::Vec<vtkm::Id,Dimension> GetPointDimensions() const
{
return this->Internals.GetPointDimensions();
}
private:
InternalsType Internals;
};
......
......@@ -64,8 +64,7 @@ public:
template<typename CellSetType>
void operator()(const CellSetType& cellset ) const
{
typedef vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
CellSetType> PermutationCellSetType;
typedef vtkm::cont::CellSetPermutation<CellSetType> PermutationCellSetType;
PermutationCellSetType permCellSet(*this->ValidIds, cellset,
cellset.GetName(),
......
......@@ -102,14 +102,13 @@ public:
};
template <typename CellSetType, typename UnaryPredicate, typename DeviceAdapter>
vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>, CellSetType>
vtkm::cont::CellSetPermutation< CellSetType >
Run(const CellSetType &cellSet,
const vtkm::cont::Field &field,
const UnaryPredicate &predicate,
DeviceAdapter)
{
typedef vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
CellSetType> OutputType;
typedef vtkm::cont::CellSetPermutation< CellSetType > OutputType;
vtkm::cont::ArrayHandle<bool> passFlags;
switch(field.GetAssociation())
......
......@@ -60,8 +60,7 @@ public:
std::cout << "Testing threshold on 2D uniform dataset" << std::endl;
typedef vtkm::cont::CellSetStructured<2> CellSetType;
typedef vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
CellSetType> OutCellSetType;
typedef vtkm::cont::CellSetPermutation<CellSetType> OutCellSetType;
typedef vtkm::cont::ArrayHandlePermutation<
vtkm::cont::ArrayHandle<vtkm::Id>,
vtkm::cont::ArrayHandle<vtkm::Float32> > OutCellFieldArrayHandleType;
......@@ -94,8 +93,7 @@ public:
std::cout << "Testing threshold on 3D uniform dataset" << std::endl;
typedef vtkm::cont::CellSetStructured<3> CellSetType;
typedef vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
CellSetType> OutCellSetType;
typedef vtkm::cont::CellSetPermutation<CellSetType> OutCellSetType;
typedef vtkm::cont::ArrayHandlePermutation<
vtkm::cont::ArrayHandle<vtkm::Id>,
vtkm::cont::ArrayHandle<vtkm::Float32> > OutCellFieldArrayHandleType;
......@@ -129,8 +127,7 @@ public:
std::cout << "Testing threshold on 3D explicit dataset" << std::endl;
typedef vtkm::cont::CellSetExplicit<> CellSetType;
typedef vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
CellSetType> OutCellSetType;
typedef vtkm::cont::CellSetPermutation<CellSetType> OutCellSetType;
typedef vtkm::cont::ArrayHandlePermutation<
vtkm::cont::ArrayHandle<vtkm::Id>,
vtkm::cont::ArrayHandle<vtkm::Float32> > OutCellFieldArrayHandleType;
......
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