Make regular conn/struct cont and export. Update other files to reflect the changes.
This commit is contained in:
parent
6816ec4293
commit
5ddc1230bd
@ -24,6 +24,8 @@ set(headers
|
||||
Extent.h
|
||||
ListTag.h
|
||||
Pair.h
|
||||
RegularConnectivity.h
|
||||
RegularStructure.h
|
||||
TypeListTag.h
|
||||
Types.h
|
||||
TypeTraits.h
|
||||
|
@ -19,22 +19,17 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
#ifndef vtk_m_cont_RegularConnectivity_h
|
||||
#define vtk_m_cont_RegularConnectivity_h
|
||||
#ifndef vtk_m_RegularConnectivity_h
|
||||
#define vtk_m_RegularConnectivity_h
|
||||
|
||||
#include <vtkm/cont/RegularStructure.h>
|
||||
#include <vtkm/RegularStructure.h>
|
||||
#include <vtkm/cont/TopologyType.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
template<TopologyType From, TopologyType To, vtkm::IdComponent Dimension>
|
||||
template<vtkm::cont::TopologyType From, vtkm::cont::TopologyType To, vtkm::IdComponent Dimension>
|
||||
struct IndexLookupHelper
|
||||
{
|
||||
// We want an unconditional failure if this unspecialized class ever gets
|
||||
@ -46,9 +41,10 @@ struct IndexLookupHelper
|
||||
};
|
||||
|
||||
template<vtkm::IdComponent Dimension>
|
||||
struct IndexLookupHelper<NODE,CELL,Dimension>
|
||||
struct IndexLookupHelper<vtkm::cont::NODE,vtkm::cont::CELL,Dimension>
|
||||
{
|
||||
template <vtkm::IdComponent ItemTupleLength>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static void GetIndices(RegularStructure<Dimension> &rs,
|
||||
vtkm::Id index, vtkm::Vec<vtkm::Id,ItemTupleLength> &ids)
|
||||
{
|
||||
@ -56,21 +52,26 @@ struct IndexLookupHelper<NODE,CELL,Dimension>
|
||||
}
|
||||
};
|
||||
|
||||
template<TopologyType FromTopology, TopologyType ToTopoogy,
|
||||
template<vtkm::cont::TopologyType FromTopology, vtkm::cont::TopologyType ToTopoogy,
|
||||
vtkm::IdComponent Dimension>
|
||||
class RegularConnectivity
|
||||
{
|
||||
public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void SetNodeDimension(int node_i, int node_j=0, int node_k=0)
|
||||
{
|
||||
rs.SetNodeDimension(node_i, node_j, node_k);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfElements() const {return rs.GetNumberOfElements();}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfIndices(vtkm::Id=0) const {return rs.GetNumberOfIndices();}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::CellType GetElementShapeType(vtkm::Id=0) const {return rs.GetElementShapeType();}
|
||||
|
||||
template <vtkm::IdComponent ItemTupleLength>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void GetIndices(vtkm::Id index, vtkm::Vec<vtkm::Id,ItemTupleLength> &ids)
|
||||
{
|
||||
IndexLookupHelper<FromTopology,ToTopoogy,Dimension>::GetIndices(rs,index,ids);
|
||||
@ -79,7 +80,6 @@ private:
|
||||
RegularStructure<Dimension> rs;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
} // namespace vtkm
|
||||
|
||||
#endif //vtk_m_cont_RegularConnectivity_h
|
||||
#endif //vtk_m_RegularConnectivity_h
|
@ -18,14 +18,13 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_cont_RegularStructure_h
|
||||
#define vtk_m_cont_RegularStructure_h
|
||||
#ifndef vtk_m_RegularStructure_h
|
||||
#define vtk_m_RegularStructure_h
|
||||
|
||||
#include <vtkm/Extent.h>
|
||||
#include <vtkm/CellType.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
template<vtkm::IdComponent> class RegularStructure;
|
||||
|
||||
@ -34,16 +33,21 @@ template<>
|
||||
class RegularStructure<1>
|
||||
{
|
||||
public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void SetNodeDimension(int node_i, int, int)
|
||||
{
|
||||
cellDims.Min[0] = nodeDims.Min[0] = 0;
|
||||
cellDims.Max[0] = node_i-1;
|
||||
nodeDims.Max[0] = node_i;
|
||||
}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfCells() const {return cellDims.Max[0];}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfIndices() const {return 2;}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::CellType GetElementShapeType() const {return VTKM_LINE;}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void GetNodesOfCells(vtkm::Id index, vtkm::Vec<vtkm::Id,2> &ids) const
|
||||
{
|
||||
ids[0] = index;
|
||||
@ -60,6 +64,7 @@ template<>
|
||||
class RegularStructure<2>
|
||||
{
|
||||
public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void SetNodeDimension(int node_i, int node_j, int)
|
||||
{
|
||||
cellDims.Min[0] = cellDims.Min[1] = 0;
|
||||
@ -69,10 +74,14 @@ public:
|
||||
cellDims.Max[1] = node_j-1;
|
||||
nodeDims.Max[1] = node_j;
|
||||
}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfCells() const {return cellDims.Max[0]*cellDims.Max[1];}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfIndices() const {return 4;}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::CellType GetElementShapeType() const {return VTKM_PIXEL;}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void GetNodesOfCells(vtkm::Id index, vtkm::Vec<vtkm::Id,4> &ids) const
|
||||
{
|
||||
int i = index % cellDims.Max[0];
|
||||
@ -94,6 +103,7 @@ template<>
|
||||
class RegularStructure<3>
|
||||
{
|
||||
public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void SetNodeDimension(int node_i, int node_j, int node_k)
|
||||
{
|
||||
cellDims.Min[0] = cellDims.Min[1] = cellDims.Min[2] = 0;
|
||||
@ -105,10 +115,14 @@ public:
|
||||
cellDims.Max[2] = node_k-1;
|
||||
nodeDims.Max[2] = node_k;
|
||||
}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfCells() const {return cellDims.Max[0]*cellDims.Max[1]*cellDims.Max[2];}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfIndices() const {return 8;}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::CellType GetElementShapeType() const {return VTKM_VOXEL;}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void GetNodesOfCells(vtkm::Id index, vtkm::Vec<vtkm::Id,8> &ids) const
|
||||
{
|
||||
int cellDims01 = cellDims.Max[0] * cellDims.Max[1];
|
||||
@ -132,7 +146,6 @@ private:
|
||||
Extent<3> nodeDims;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
} // namespace vtkm
|
||||
|
||||
#endif //vtk_m_cont_RegularStructure_h
|
||||
#endif //vtk_m_RegularStructure_h
|
@ -50,8 +50,6 @@ set(headers
|
||||
PointCoordinatesArray.h
|
||||
PointCoordinatesListTag.h
|
||||
PointCoordinatesUniform.h
|
||||
RegularConnectivity.h
|
||||
RegularStructure.h
|
||||
Storage.h
|
||||
StorageBasic.h
|
||||
StorageImplicit.h
|
||||
|
@ -2,8 +2,8 @@
|
||||
#define vtk_m_cont_CellSetStructured_h
|
||||
|
||||
#include <vtkm/cont/CellSet.h>
|
||||
#include <vtkm/cont/RegularConnectivity.h>
|
||||
#include <vtkm/cont/RegularStructure.h>
|
||||
#include <vtkm/RegularConnectivity.h>
|
||||
#include <vtkm/RegularStructure.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
@ -22,21 +22,21 @@ public:
|
||||
|
||||
virtual vtkm::Id GetNumCells()
|
||||
{
|
||||
return regStruct.GetNumberOfCells();
|
||||
return structure.GetNumberOfCells();
|
||||
}
|
||||
|
||||
vtkm::cont::RegularConnectivity<NODE,CELL,Dimension>
|
||||
vtkm::RegularConnectivity<NODE,CELL,Dimension>
|
||||
GetNodeToCellConnectivity()
|
||||
{
|
||||
vtkm::cont::RegularConnectivity<NODE,CELL,Dimension> regConn;
|
||||
regConn.SetNodeDimension(regStruct.nodeDims.Max[0],
|
||||
regStruct.nodeDims.Max[1],
|
||||
regStruct.nodeDims.Max[2]);
|
||||
vtkm::RegularConnectivity<NODE,CELL,Dimension> regConn;
|
||||
regConn.SetNodeDimension(structure.nodeDims.Max[0],
|
||||
structure.nodeDims.Max[1],
|
||||
structure.nodeDims.Max[2]);
|
||||
return regConn;
|
||||
}
|
||||
|
||||
public:
|
||||
vtkm::cont::RegularStructure<Dimension> regStruct;
|
||||
vtkm::RegularStructure<Dimension> structure;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/ExplicitConnectivity.h>
|
||||
#include <vtkm/cont/RegularConnectivity.h>
|
||||
#include <vtkm/RegularConnectivity.h>
|
||||
#include <vtkm/cont/CellSet.h>
|
||||
#include <vtkm/cont/CellSetExplicit.h>
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
|
@ -55,7 +55,7 @@ void TestDataSet_Regular()
|
||||
ds.AddCellSet(cs);
|
||||
|
||||
//Set regular structure
|
||||
cs->regStruct.SetNodeDimension(3,2,3);
|
||||
cs->structure.SetNodeDimension(3,2,3);
|
||||
|
||||
//Run a worklet to populate a cell centered field.
|
||||
vtkm::Float32 cellVals[4] = {-1.1, -1.2, -1.3, -1.4};
|
||||
@ -67,16 +67,16 @@ void TestDataSet_Regular()
|
||||
VTKM_TEST_ASSERT(test_equal(ds.GetNumberOfFields(), 6),
|
||||
"Incorrect number of fields");
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(cs->regStruct.GetNumberOfCells(), 4),
|
||||
VTKM_TEST_ASSERT(test_equal(cs->structure.GetNumberOfCells(), 4),
|
||||
"Incorrect number of cells");
|
||||
|
||||
vtkm::Id numCells = cs->regStruct.GetNumberOfCells();
|
||||
vtkm::Id numCells = cs->structure.GetNumberOfCells();
|
||||
vtkm::Vec<vtkm::Id,8> ids;
|
||||
for (int i = 0; i < numCells; i++)
|
||||
{
|
||||
VTKM_TEST_ASSERT(test_equal(cs->regStruct.GetNumberOfIndices(), 8),
|
||||
VTKM_TEST_ASSERT(test_equal(cs->structure.GetNumberOfIndices(), 8),
|
||||
"Incorrect number of cell indices");
|
||||
vtkm::CellType shape = cs->regStruct.GetElementShapeType();
|
||||
vtkm::CellType shape = cs->structure.GetElementShapeType();
|
||||
VTKM_TEST_ASSERT(shape == vtkm::VTKM_VOXEL, "Incorrect element type.");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user