mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Merge branch 'master' into cmake_refactor
This commit is contained in:
commit
4b058229ce
@ -281,7 +281,7 @@ function(vtkm_pyexpander_generated_file generated_file_name)
|
||||
-DPYEXPANDER_COMMAND=${PYEXPANDER_COMMAND}
|
||||
-DSOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name}
|
||||
-DGENERATED_FILE=${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name}
|
||||
-P ${CMAKE_SOURCE_DIR}/CMake/VTKmCheckPyexpander.cmake
|
||||
-P ${VTKm_CMAKE_MODULE_PATH}/VTKmCheckPyexpander.cmake
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name}.in
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name}
|
||||
COMMENT "Checking validity of ${generated_file_name}"
|
||||
|
@ -56,12 +56,6 @@ struct VecAxisAlignedPointCoordinatesNumComponents<3>
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 8;
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::FloatDefault VecAxisAlignedPointCoordinatesOffsetTable[8][3] = {
|
||||
{ 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, 1.0f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 1.0f }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief An implicit vector for point coordinates in axis aligned cells. For
|
||||
@ -110,7 +104,12 @@ public:
|
||||
VTKM_EXEC_CONT
|
||||
ComponentType operator[](vtkm::IdComponent index) const
|
||||
{
|
||||
const vtkm::FloatDefault* offset = detail::VecAxisAlignedPointCoordinatesOffsetTable[index];
|
||||
static const vtkm::FloatDefault VecAxisAlignedPointCoordinatesOffsetTable[8][3] = {
|
||||
{ 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, 1.0f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 1.0f }
|
||||
};
|
||||
|
||||
const auto& offset = VecAxisAlignedPointCoordinatesOffsetTable[index];
|
||||
return ComponentType(this->Origin[0] + offset[0] * this->Spacing[0],
|
||||
this->Origin[1] + offset[1] * this->Spacing[1],
|
||||
this->Origin[2] + offset[2] * this->Spacing[2]);
|
||||
|
@ -409,6 +409,7 @@ void CastAndCall(const vtkm::cont::Field& field, const Functor& f, Args&&... arg
|
||||
|
||||
namespace internal
|
||||
{
|
||||
|
||||
template <>
|
||||
struct DynamicTransformTraits<vtkm::cont::Field>
|
||||
{
|
||||
|
@ -42,6 +42,7 @@ class MakeTestDataSet
|
||||
public:
|
||||
// 1D uniform datasets.
|
||||
vtkm::cont::DataSet Make1DUniformDataSet0();
|
||||
vtkm::cont::DataSet Make1DUniformDataSet1();
|
||||
// 1D explicit datasets.
|
||||
vtkm::cont::DataSet Make1DExplicitDataSet0();
|
||||
|
||||
@ -92,6 +93,20 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make1DUniformDataSet0()
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
//Make another simple 1D dataset.
|
||||
inline vtkm::cont::DataSet MakeTestDataSet::Make1DUniformDataSet1()
|
||||
{
|
||||
vtkm::cont::DataSetBuilderUniform dsb;
|
||||
const vtkm::Id nVerts = 6;
|
||||
vtkm::cont::DataSet dataSet = dsb.Create(nVerts);
|
||||
|
||||
vtkm::cont::DataSetFieldAdd dsf;
|
||||
vtkm::Float32 var[nVerts] = { 1.0e3f, 5.e5f, 2.e8f, 1.e10f, 2e12f, 3e15f };
|
||||
dsf.AddPointField(dataSet, "pointvar", var, nVerts);
|
||||
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
inline vtkm::cont::DataSet MakeTestDataSet::Make1DExplicitDataSet0()
|
||||
{
|
||||
const int nVerts = 5;
|
||||
|
@ -17,8 +17,8 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_exec_CellFaces_h
|
||||
#define vtk_m_exec_CellFaces_h
|
||||
#ifndef vtk_m_exec_CellEdge_h
|
||||
#define vtk_m_exec_CellEdge_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/CellShape.h>
|
||||
@ -35,224 +35,241 @@ namespace exec
|
||||
namespace detail
|
||||
{
|
||||
|
||||
static const vtkm::IdComponent MAX_NUM_EDGES = 12;
|
||||
class CellEdgeTables
|
||||
{
|
||||
public:
|
||||
static const vtkm::IdComponent MAX_NUM_EDGES = 12;
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
static const vtkm::IdComponent NumEdges[vtkm::NUMBER_OF_CELL_SHAPES] = {
|
||||
0, // 0: CELL_SHAPE_EMPTY
|
||||
0, // 1: CELL_SHAPE_VERTEX
|
||||
0, // 2: Unused
|
||||
0, // 3: CELL_SHAPE_LINE
|
||||
0, // 4: Unused
|
||||
3, // 5: CELL_SHAPE_TRIANGLE
|
||||
0, // 6: Unused
|
||||
-1, // 7: CELL_SHAPE_POLYGON ---special case---
|
||||
0, // 8: Unused
|
||||
4, // 9: CELL_SHAPE_QUAD
|
||||
6, // 10: CELL_SHAPE_TETRA
|
||||
0, // 11: Unused
|
||||
12, // 12: CELL_SHAPE_HEXAHEDRON
|
||||
9, // 13: CELL_SHAPE_WEDGE
|
||||
8 // 14: CELL_SHAPE_PYRAMID
|
||||
};
|
||||
private:
|
||||
struct Tables
|
||||
{
|
||||
vtkm::IdComponent NumEdges[vtkm::NUMBER_OF_CELL_SHAPES];
|
||||
vtkm::IdComponent PointsInEdge[vtkm::NUMBER_OF_CELL_SHAPES][MAX_NUM_EDGES][2];
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
static const vtkm::IdComponent PointsInEdge[vtkm::NUMBER_OF_CELL_SHAPES][MAX_NUM_EDGES][2] = {
|
||||
// 0: CELL_SHAPE_EMPTY
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 1: CELL_SHAPE_VERTEX
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 2: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 3: CELL_SHAPE_LINE
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 4: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 5: CELL_SHAPE_TRIANGLE
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 0 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 6: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 7: CELL_SHAPE_POLYGON --- special case ---
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 8: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 9: CELL_SHAPE_QUAD
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 3 },
|
||||
{ 3, 0 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 10: CELL_SHAPE_TETRA
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 0 },
|
||||
{ 0, 3 },
|
||||
{ 1, 3 },
|
||||
{ 2, 3 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 11: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 12: CELL_SHAPE_HEXAHEDRON
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 3, 2 },
|
||||
{ 0, 3 },
|
||||
{ 4, 5 },
|
||||
{ 5, 6 },
|
||||
{ 7, 6 },
|
||||
{ 4, 7 },
|
||||
{ 0, 4 },
|
||||
{ 1, 5 },
|
||||
{ 3, 7 },
|
||||
{ 2, 6 } },
|
||||
// 13: CELL_SHAPE_WEDGE
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 0 },
|
||||
{ 3, 4 },
|
||||
{ 4, 5 },
|
||||
{ 5, 3 },
|
||||
{ 0, 3 },
|
||||
{ 1, 4 },
|
||||
{ 2, 5 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 14: CELL_SHAPE_PYRAMID
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 3 },
|
||||
{ 3, 0 },
|
||||
{ 0, 4 },
|
||||
{ 1, 4 },
|
||||
{ 2, 4 },
|
||||
{ 3, 4 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
public:
|
||||
VTKM_EXEC_CONT static const Tables& Get()
|
||||
{
|
||||
static const Tables table = { {
|
||||
// NumEdges
|
||||
0, // 0: CELL_SHAPE_EMPTY
|
||||
0, // 1: CELL_SHAPE_VERTEX
|
||||
0, // 2: Unused
|
||||
0, // 3: CELL_SHAPE_LINE
|
||||
0, // 4: Unused
|
||||
3, // 5: CELL_SHAPE_TRIANGLE
|
||||
0, // 6: Unused
|
||||
-1, // 7: CELL_SHAPE_POLYGON ---special case---
|
||||
0, // 8: Unused
|
||||
4, // 9: CELL_SHAPE_QUAD
|
||||
6, // 10: CELL_SHAPE_TETRA
|
||||
0, // 11: Unused
|
||||
12, // 12: CELL_SHAPE_HEXAHEDRON
|
||||
9, // 13: CELL_SHAPE_WEDGE
|
||||
8 // 14: CELL_SHAPE_PYRAMID
|
||||
},
|
||||
|
||||
{
|
||||
// PointsInEdge
|
||||
// 0: CELL_SHAPE_EMPTY
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 1: CELL_SHAPE_VERTEX
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 2: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 3: CELL_SHAPE_LINE
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 4: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 5: CELL_SHAPE_TRIANGLE
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 0 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 6: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 7: CELL_SHAPE_POLYGON --- special case ---
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 8: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 9: CELL_SHAPE_QUAD
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 3 },
|
||||
{ 3, 0 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 10: CELL_SHAPE_TETRA
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 0 },
|
||||
{ 0, 3 },
|
||||
{ 1, 3 },
|
||||
{ 2, 3 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 11: Unused
|
||||
{ { -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 12: CELL_SHAPE_HEXAHEDRON
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 3, 2 },
|
||||
{ 0, 3 },
|
||||
{ 4, 5 },
|
||||
{ 5, 6 },
|
||||
{ 7, 6 },
|
||||
{ 4, 7 },
|
||||
{ 0, 4 },
|
||||
{ 1, 5 },
|
||||
{ 3, 7 },
|
||||
{ 2, 6 } },
|
||||
// 13: CELL_SHAPE_WEDGE
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 0 },
|
||||
{ 3, 4 },
|
||||
{ 4, 5 },
|
||||
{ 5, 3 },
|
||||
{ 0, 3 },
|
||||
{ 1, 4 },
|
||||
{ 2, 5 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
// 14: CELL_SHAPE_PYRAMID
|
||||
{ { 0, 1 },
|
||||
{ 1, 2 },
|
||||
{ 2, 3 },
|
||||
{ 3, 0 },
|
||||
{ 0, 4 },
|
||||
{ 1, 4 },
|
||||
{ 2, 4 },
|
||||
{ 3, 4 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, -1 } },
|
||||
} };
|
||||
|
||||
return table;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@ -264,7 +281,7 @@ static inline VTKM_EXEC vtkm::IdComponent CellEdgeNumberOfEdges(vtkm::IdComponen
|
||||
{
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == vtkm::CellTraits<CellShapeTag>::NUM_POINTS);
|
||||
return detail::NumEdges[CellShapeTag::Id];
|
||||
return detail::CellEdgeTables::Get().NumEdges[CellShapeTag::Id];
|
||||
}
|
||||
|
||||
static inline VTKM_EXEC vtkm::IdComponent CellEdgeNumberOfEdges(vtkm::IdComponent numPoints,
|
||||
@ -286,7 +303,7 @@ static inline VTKM_EXEC vtkm::IdComponent CellEdgeNumberOfEdges(
|
||||
}
|
||||
else
|
||||
{
|
||||
return detail::NumEdges[shape.Id];
|
||||
return detail::CellEdgeTables::Get().NumEdges[shape.Id];
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,15 +315,15 @@ static inline VTKM_EXEC vtkm::Vec<vtkm::IdComponent, 2> CellEdgeLocalIndices(
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
{
|
||||
VTKM_ASSUME(edgeIndex >= 0);
|
||||
VTKM_ASSUME(edgeIndex < detail::MAX_NUM_EDGES);
|
||||
VTKM_ASSUME(edgeIndex < detail::CellEdgeTables::MAX_NUM_EDGES);
|
||||
if (edgeIndex >= vtkm::exec::CellEdgeNumberOfEdges(numPoints, shape, worklet))
|
||||
{
|
||||
worklet.RaiseError("Invalid edge number.");
|
||||
return vtkm::Vec<vtkm::IdComponent, 2>(0);
|
||||
}
|
||||
|
||||
return vtkm::make_Vec(detail::PointsInEdge[CellShapeTag::Id][edgeIndex][0],
|
||||
detail::PointsInEdge[CellShapeTag::Id][edgeIndex][1]);
|
||||
return vtkm::make_Vec(detail::CellEdgeTables::Get().PointsInEdge[CellShapeTag::Id][edgeIndex][0],
|
||||
detail::CellEdgeTables::Get().PointsInEdge[CellShapeTag::Id][edgeIndex][1]);
|
||||
}
|
||||
|
||||
static inline VTKM_EXEC vtkm::Vec<vtkm::IdComponent, 2> CellEdgeLocalIndices(
|
||||
@ -336,7 +353,7 @@ static inline VTKM_EXEC vtkm::Vec<vtkm::IdComponent, 2> CellEdgeLocalIndices(
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
{
|
||||
VTKM_ASSUME(edgeIndex >= 0);
|
||||
VTKM_ASSUME(edgeIndex < detail::MAX_NUM_EDGES);
|
||||
VTKM_ASSUME(edgeIndex < detail::CellEdgeTables::MAX_NUM_EDGES);
|
||||
|
||||
if (shape.Id == vtkm::CELL_SHAPE_POLYGON)
|
||||
{
|
||||
@ -344,14 +361,14 @@ static inline VTKM_EXEC vtkm::Vec<vtkm::IdComponent, 2> CellEdgeLocalIndices(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (edgeIndex >= detail::NumEdges[shape.Id])
|
||||
if (edgeIndex >= detail::CellEdgeTables::Get().NumEdges[shape.Id])
|
||||
{
|
||||
worklet.RaiseError("Invalid edge number.");
|
||||
return vtkm::Vec<vtkm::IdComponent, 2>(0);
|
||||
}
|
||||
|
||||
return vtkm::make_Vec(detail::PointsInEdge[shape.Id][edgeIndex][0],
|
||||
detail::PointsInEdge[shape.Id][edgeIndex][1]);
|
||||
return vtkm::make_Vec(detail::CellEdgeTables::Get().PointsInEdge[shape.Id][edgeIndex][0],
|
||||
detail::CellEdgeTables::Get().PointsInEdge[shape.Id][edgeIndex][1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,157 +34,174 @@ namespace exec
|
||||
namespace detail
|
||||
{
|
||||
|
||||
static const vtkm::IdComponent MAX_FACE_SIZE = 4;
|
||||
static const vtkm::IdComponent MAX_NUM_FACES = 6;
|
||||
class CellFaceTables
|
||||
{
|
||||
public:
|
||||
static const vtkm::IdComponent MAX_FACE_SIZE = 4;
|
||||
static const vtkm::IdComponent MAX_NUM_FACES = 6;
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
static const vtkm::IdComponent NumFaces[vtkm::NUMBER_OF_CELL_SHAPES] = {
|
||||
0, // 0: CELL_SHAPE_EMPTY
|
||||
0, // 1: CELL_SHAPE_VERTEX
|
||||
0, // 2: Unused
|
||||
0, // 3: CELL_SHAPE_LINE
|
||||
0, // 4: Unused
|
||||
0, // 5: CELL_SHAPE_TRIANGLE
|
||||
0, // 6: Unused
|
||||
0, // 7: CELL_SHAPE_POLYGON
|
||||
0, // 8: Unused
|
||||
0, // 9: CELL_SHAPE_QUAD
|
||||
4, // 10: CELL_SHAPE_TETRA
|
||||
0, // 11: Unused
|
||||
6, // 12: CELL_SHAPE_HEXAHEDRON
|
||||
5, // 13: CELL_SHAPE_WEDGE
|
||||
5 // 14: CELL_SHAPE_PYRAMID
|
||||
private:
|
||||
struct Tables
|
||||
{
|
||||
vtkm::IdComponent NumFaces[vtkm::NUMBER_OF_CELL_SHAPES];
|
||||
vtkm::IdComponent NumPointsInFace[vtkm::NUMBER_OF_CELL_SHAPES][MAX_NUM_FACES];
|
||||
vtkm::IdComponent PointsInFace[vtkm::NUMBER_OF_CELL_SHAPES][MAX_NUM_FACES][MAX_FACE_SIZE];
|
||||
};
|
||||
|
||||
public:
|
||||
VTKM_EXEC_CONT
|
||||
static const Tables& Get()
|
||||
{
|
||||
static const Tables table = { // NumFaces
|
||||
{
|
||||
0, // 0: CELL_SHAPE_EMPTY
|
||||
0, // 1: CELL_SHAPE_VERTEX
|
||||
0, // 2: Unused
|
||||
0, // 3: CELL_SHAPE_LINE
|
||||
0, // 4: Unused
|
||||
0, // 5: CELL_SHAPE_TRIANGLE
|
||||
0, // 6: Unused
|
||||
0, // 7: CELL_SHAPE_POLYGON
|
||||
0, // 8: Unused
|
||||
0, // 9: CELL_SHAPE_QUAD
|
||||
4, // 10: CELL_SHAPE_TETRA
|
||||
0, // 11: Unused
|
||||
6, // 12: CELL_SHAPE_HEXAHEDRON
|
||||
5, // 13: CELL_SHAPE_WEDGE
|
||||
5 // 14: CELL_SHAPE_PYRAMID
|
||||
},
|
||||
|
||||
// NumPointsInFace
|
||||
{
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 0: CELL_SHAPE_EMPTY
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 1: CELL_SHAPE_VERTEX
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 2: Unused
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 3: CELL_SHAPE_LINE
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 4: Unused
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 5: CELL_SHAPE_TRIANGLE
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 6: Unused
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 7: CELL_SHAPE_POLYGON
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 8: Unused
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 9: CELL_SHAPE_QUAD
|
||||
{ 3, 3, 3, 3, -1, -1 }, // 10: CELL_SHAPE_TETRA
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 11: Unused
|
||||
{ 4, 4, 4, 4, 4, 4 }, // 12: CELL_SHAPE_HEXAHEDRON
|
||||
{ 3, 3, 4, 4, 4, -1 }, // 13: CELL_SHAPE_WEDGE
|
||||
{ 4, 3, 3, 3, 3, -1 } // 14: CELL_SHAPE_PYRAMID
|
||||
},
|
||||
|
||||
// PointsInFace
|
||||
{ // 0: CELL_SHAPE_EMPTY
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 1: CELL_SHAPE_VERTEX
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 2: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 3: CELL_SHAPE_LINE
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 4: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 5: CELL_SHAPE_TRIANGLE
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 6: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 7: CELL_SHAPE_POLYGON
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 8: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 9: CELL_SHAPE_QUAD
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 10: CELL_SHAPE_TETRA
|
||||
{ { 0, 1, 3, -1 },
|
||||
{ 1, 2, 3, -1 },
|
||||
{ 2, 0, 3, -1 },
|
||||
{ 0, 2, 1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 11: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 12: CELL_SHAPE_HEXAHEDRON
|
||||
{ { 0, 4, 7, 3 },
|
||||
{ 1, 2, 6, 5 },
|
||||
{ 0, 1, 5, 4 },
|
||||
{ 3, 7, 6, 2 },
|
||||
{ 0, 3, 2, 1 },
|
||||
{ 4, 5, 6, 7 } },
|
||||
// 13: CELL_SHAPE_WEDGE
|
||||
{ { 0, 1, 2, -1 },
|
||||
{ 3, 5, 4, -1 },
|
||||
{ 0, 3, 4, 1 },
|
||||
{ 1, 4, 5, 2 },
|
||||
{ 2, 5, 3, 0 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 14: CELL_SHAPE_PYRAMID
|
||||
{ { 0, 3, 2, 1 },
|
||||
{ 0, 1, 4, -1 },
|
||||
{ 1, 2, 4, -1 },
|
||||
{ 2, 3, 4, -1 },
|
||||
{ 3, 0, 4, -1 },
|
||||
{ -1, -1, -1, -1 } } }
|
||||
};
|
||||
|
||||
return table;
|
||||
}
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
static const vtkm::IdComponent NumPointsInFace[vtkm::NUMBER_OF_CELL_SHAPES][MAX_NUM_FACES] = {
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 0: CELL_SHAPE_EMPTY
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 1: CELL_SHAPE_VERTEX
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 2: Unused
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 3: CELL_SHAPE_LINE
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 4: Unused
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 5: CELL_SHAPE_TRIANGLE
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 6: Unused
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 7: CELL_SHAPE_POLYGON
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 8: Unused
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 9: CELL_SHAPE_QUAD
|
||||
{ 3, 3, 3, 3, -1, -1 }, // 10: CELL_SHAPE_TETRA
|
||||
{ -1, -1, -1, -1, -1, -1 }, // 11: Unused
|
||||
{ 4, 4, 4, 4, 4, 4 }, // 12: CELL_SHAPE_HEXAHEDRON
|
||||
{ 3, 3, 4, 4, 4, -1 }, // 13: CELL_SHAPE_WEDGE
|
||||
{ 4, 3, 3, 3, 3, -1 } // 14: CELL_SHAPE_PYRAMID
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
static const vtkm::IdComponent PointsInFace[vtkm::NUMBER_OF_CELL_SHAPES][MAX_NUM_FACES]
|
||||
[MAX_FACE_SIZE] = {
|
||||
// 0: CELL_SHAPE_EMPTY
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 1: CELL_SHAPE_VERTEX
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 2: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 3: CELL_SHAPE_LINE
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 4: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 5: CELL_SHAPE_TRIANGLE
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 6: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 7: CELL_SHAPE_POLYGON
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 8: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 9: CELL_SHAPE_QUAD
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 10: CELL_SHAPE_TETRA
|
||||
{ { 0, 1, 3, -1 },
|
||||
{ 1, 2, 3, -1 },
|
||||
{ 2, 0, 3, -1 },
|
||||
{ 0, 2, 1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 11: Unused
|
||||
{ { -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 12: CELL_SHAPE_HEXAHEDRON
|
||||
{ { 0, 4, 7, 3 },
|
||||
{ 1, 2, 6, 5 },
|
||||
{ 0, 1, 5, 4 },
|
||||
{ 3, 7, 6, 2 },
|
||||
{ 0, 3, 2, 1 },
|
||||
{ 4, 5, 6, 7 } },
|
||||
// 13: CELL_SHAPE_WEDGE
|
||||
{ { 0, 1, 2, -1 },
|
||||
{ 3, 5, 4, -1 },
|
||||
{ 0, 3, 4, 1 },
|
||||
{ 1, 4, 5, 2 },
|
||||
{ 2, 5, 3, 0 },
|
||||
{ -1, -1, -1, -1 } },
|
||||
// 14: CELL_SHAPE_PYRAMID
|
||||
{ { 0, 3, 2, 1 },
|
||||
{ 0, 1, 4, -1 },
|
||||
{ 1, 2, 4, -1 },
|
||||
{ 2, 3, 4, -1 },
|
||||
{ 3, 0, 4, -1 },
|
||||
{ -1, -1, -1, -1 } }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename CellShapeTag>
|
||||
@ -192,7 +209,7 @@ static inline VTKM_EXEC vtkm::IdComponent CellFaceNumberOfFaces(CellShapeTag sha
|
||||
const vtkm::exec::FunctorBase&)
|
||||
{
|
||||
(void)shape; //C4100 false positive workaround
|
||||
return detail::NumFaces[shape.Id];
|
||||
return detail::CellFaceTables::Get().NumFaces[shape.Id];
|
||||
}
|
||||
|
||||
template <typename CellShapeTag>
|
||||
@ -202,14 +219,14 @@ static inline VTKM_EXEC vtkm::IdComponent CellFaceNumberOfPoints(
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
{
|
||||
VTKM_ASSUME(faceIndex >= 0);
|
||||
VTKM_ASSUME(faceIndex < detail::MAX_NUM_FACES);
|
||||
VTKM_ASSUME(faceIndex < detail::CellFaceTables::MAX_NUM_FACES);
|
||||
if (faceIndex >= vtkm::exec::CellFaceNumberOfFaces(shape, worklet))
|
||||
{
|
||||
worklet.RaiseError("Invalid face number.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return detail::NumPointsInFace[shape.Id][faceIndex];
|
||||
return detail::CellFaceTables::Get().NumPointsInFace[shape.Id][faceIndex];
|
||||
}
|
||||
|
||||
template <typename CellShapeTag>
|
||||
@ -218,7 +235,7 @@ static inline VTKM_EXEC vtkm::UInt8 CellFaceShape(vtkm::IdComponent faceIndex,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
{
|
||||
VTKM_ASSUME(faceIndex >= 0);
|
||||
VTKM_ASSUME(faceIndex < detail::MAX_NUM_FACES);
|
||||
VTKM_ASSUME(faceIndex < detail::CellFaceTables::MAX_NUM_FACES);
|
||||
switch (CellFaceNumberOfPoints(faceIndex, shape, worklet))
|
||||
{
|
||||
case 3:
|
||||
@ -244,7 +261,8 @@ static inline VTKM_EXEC vtkm::VecCConst<vtkm::IdComponent> CellFaceLocalIndices(
|
||||
return vtkm::VecCConst<vtkm::IdComponent>();
|
||||
}
|
||||
|
||||
return vtkm::make_VecC(detail::PointsInFace[shape.Id][faceIndex], numPointsInFace);
|
||||
return vtkm::make_VecC(detail::CellFaceTables::Get().PointsInFace[shape.Id][faceIndex],
|
||||
numPointsInFace);
|
||||
}
|
||||
|
||||
/// \brief Returns a canonical identifer for a cell face
|
||||
|
@ -56,7 +56,6 @@ set(headers
|
||||
FunctionInterfaceDetailPost.h
|
||||
FunctionInterfaceDetailPre.h
|
||||
IndexTag.h
|
||||
IntegerSequence.h
|
||||
Invocation.h
|
||||
ListTagDetail.h
|
||||
Unreachable.h
|
||||
|
@ -34,12 +34,10 @@
|
||||
#else
|
||||
#define VTKM_SUPPRESS_EXEC_WARNINGS #pragma hd_warning_disable
|
||||
#endif
|
||||
#define VTKM_EXEC_CONSTANT __device__ __constant__
|
||||
#else
|
||||
#define VTKM_EXEC
|
||||
#define VTKM_EXEC_CONT
|
||||
#define VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
#define VTKM_EXEC_CONSTANT
|
||||
#endif
|
||||
|
||||
#define VTKM_CONT
|
||||
|
@ -243,6 +243,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
explicit FunctionInterface(const detail::ParameterContainer<FunctionSignature>& p)
|
||||
: Result()
|
||||
, Parameters(p)
|
||||
{
|
||||
}
|
||||
|
||||
// the number of parameters as an integral constant
|
||||
typedef detail::FunctionSigInfo<FunctionSignature> SigInfo;
|
||||
typedef typename SigInfo::ArityType SignatureArity;
|
||||
|
@ -272,8 +272,11 @@ FunctionInterface<R()>
|
||||
make_FunctionInterface(
|
||||
)
|
||||
{
|
||||
FunctionInterface<R()> fi;
|
||||
return fi;
|
||||
detail::ParameterContainer<R()> container =
|
||||
{
|
||||
};
|
||||
|
||||
return FunctionInterface<R()>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -297,9 +300,12 @@ make_FunctionInterface(
|
||||
const P1& p1
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1)> container =
|
||||
{
|
||||
p1
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -325,10 +331,13 @@ make_FunctionInterface(
|
||||
const P2& p2
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2)> container =
|
||||
{
|
||||
p1,
|
||||
p2
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -356,11 +365,14 @@ make_FunctionInterface(
|
||||
const P3& p3
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2,P3)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
fi.template SetParameter<3>(p3);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2,P3)> container =
|
||||
{
|
||||
p1,
|
||||
p2,
|
||||
p3
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2,P3)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -390,12 +402,15 @@ make_FunctionInterface(
|
||||
const P4& p4
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2,P3,P4)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
fi.template SetParameter<3>(p3);
|
||||
fi.template SetParameter<4>(p4);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2,P3,P4)> container =
|
||||
{
|
||||
p1,
|
||||
p2,
|
||||
p3,
|
||||
p4
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2,P3,P4)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -427,13 +442,16 @@ make_FunctionInterface(
|
||||
const P5& p5
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2,P3,P4,P5)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
fi.template SetParameter<3>(p3);
|
||||
fi.template SetParameter<4>(p4);
|
||||
fi.template SetParameter<5>(p5);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2,P3,P4,P5)> container =
|
||||
{
|
||||
p1,
|
||||
p2,
|
||||
p3,
|
||||
p4,
|
||||
p5
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2,P3,P4,P5)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -467,14 +485,17 @@ make_FunctionInterface(
|
||||
const P6& p6
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2,P3,P4,P5,P6)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
fi.template SetParameter<3>(p3);
|
||||
fi.template SetParameter<4>(p4);
|
||||
fi.template SetParameter<5>(p5);
|
||||
fi.template SetParameter<6>(p6);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2,P3,P4,P5,P6)> container =
|
||||
{
|
||||
p1,
|
||||
p2,
|
||||
p3,
|
||||
p4,
|
||||
p5,
|
||||
p6
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2,P3,P4,P5,P6)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -510,15 +531,18 @@ make_FunctionInterface(
|
||||
const P7& p7
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
fi.template SetParameter<3>(p3);
|
||||
fi.template SetParameter<4>(p4);
|
||||
fi.template SetParameter<5>(p5);
|
||||
fi.template SetParameter<6>(p6);
|
||||
fi.template SetParameter<7>(p7);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2,P3,P4,P5,P6,P7)> container =
|
||||
{
|
||||
p1,
|
||||
p2,
|
||||
p3,
|
||||
p4,
|
||||
p5,
|
||||
p6,
|
||||
p7
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -556,16 +580,19 @@ make_FunctionInterface(
|
||||
const P8& p8
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
fi.template SetParameter<3>(p3);
|
||||
fi.template SetParameter<4>(p4);
|
||||
fi.template SetParameter<5>(p5);
|
||||
fi.template SetParameter<6>(p6);
|
||||
fi.template SetParameter<7>(p7);
|
||||
fi.template SetParameter<8>(p8);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2,P3,P4,P5,P6,P7,P8)> container =
|
||||
{
|
||||
p1,
|
||||
p2,
|
||||
p3,
|
||||
p4,
|
||||
p5,
|
||||
p6,
|
||||
p7,
|
||||
p8
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -605,17 +632,20 @@ make_FunctionInterface(
|
||||
const P9& p9
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
fi.template SetParameter<3>(p3);
|
||||
fi.template SetParameter<4>(p4);
|
||||
fi.template SetParameter<5>(p5);
|
||||
fi.template SetParameter<6>(p6);
|
||||
fi.template SetParameter<7>(p7);
|
||||
fi.template SetParameter<8>(p8);
|
||||
fi.template SetParameter<9>(p9);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2,P3,P4,P5,P6,P7,P8,P9)> container =
|
||||
{
|
||||
p1,
|
||||
p2,
|
||||
p3,
|
||||
p4,
|
||||
p5,
|
||||
p6,
|
||||
p7,
|
||||
p8,
|
||||
p9
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9)>{container};
|
||||
}
|
||||
|
||||
/// \brief Create a \c FunctionInterface
|
||||
@ -657,18 +687,21 @@ make_FunctionInterface(
|
||||
const P10& p10
|
||||
)
|
||||
{
|
||||
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)> fi;
|
||||
fi.template SetParameter<1>(p1);
|
||||
fi.template SetParameter<2>(p2);
|
||||
fi.template SetParameter<3>(p3);
|
||||
fi.template SetParameter<4>(p4);
|
||||
fi.template SetParameter<5>(p5);
|
||||
fi.template SetParameter<6>(p6);
|
||||
fi.template SetParameter<7>(p7);
|
||||
fi.template SetParameter<8>(p8);
|
||||
fi.template SetParameter<9>(p9);
|
||||
fi.template SetParameter<10>(p10);
|
||||
return fi;
|
||||
detail::ParameterContainer<R(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)> container =
|
||||
{
|
||||
p1,
|
||||
p2,
|
||||
p3,
|
||||
p4,
|
||||
p5,
|
||||
p6,
|
||||
p7,
|
||||
p8,
|
||||
p9,
|
||||
p10
|
||||
};
|
||||
|
||||
return FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)>{container};
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,11 +138,14 @@ $for(param_index in xrange(1,num_params+1))\
|
||||
$endfor\
|
||||
)
|
||||
{
|
||||
FunctionInterface<$signature(num_params)> fi;
|
||||
detail::ParameterContainer<$signature(num_params)> container =
|
||||
{
|
||||
$for(param_index in xrange(1,num_params+1))\
|
||||
fi.template SetParameter<$(param_index)>(p$(param_index));
|
||||
p$(param_index)$comma_if(param_index<num_params)
|
||||
$endfor\
|
||||
return fi;
|
||||
};
|
||||
|
||||
return FunctionInterface<$signature(num_params)>{container};
|
||||
}
|
||||
|
||||
$endfor\
|
||||
|
@ -1,119 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
||||
// Copyright 2014 UT-Battelle, LLC.
|
||||
// Copyright 2014 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-NA0003525 with NTESS,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_internal_IntegerSequence_h
|
||||
#define vtk_m_internal_IntegerSequence_h
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
/// \brief A container of unsigned integers
|
||||
///
|
||||
/// C++11 Doesn't provide an IntegerSequence class and helper constructor
|
||||
// So we need to roll our own. This class has been tested up to 512 elements.
|
||||
//
|
||||
template <int...>
|
||||
struct IntegerSequence
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <int N, int... Is> //unroll in blocks of 4
|
||||
struct MakeSeq /** @cond */ : MakeSeq<N - 4, N - 3, N - 2, N - 1, N, Is...> /** @endcond */
|
||||
{
|
||||
//The cond/endcond are used to tell doxygen to ignore the inheritance, as that
|
||||
//builds a massive inheritance tree
|
||||
};
|
||||
|
||||
template <int... Is>
|
||||
struct MakeSeq<0, 1, 2, 3, Is...> //termination case
|
||||
{
|
||||
using type = IntegerSequence<0, 1, 2, 3, Is...>;
|
||||
};
|
||||
|
||||
template <int Mod, int N>
|
||||
struct PreMakeSeq : MakeSeq<N - 3, N - 2, N - 1, N>
|
||||
{
|
||||
};
|
||||
|
||||
template <int N> //specialization for value +1 to divisible by 4
|
||||
struct PreMakeSeq<1, N> : MakeSeq<N>
|
||||
{
|
||||
};
|
||||
|
||||
template <int N> //specialization for value +2 to divisible by 4
|
||||
struct PreMakeSeq<2, N> : MakeSeq<N - 1, N>
|
||||
{
|
||||
};
|
||||
|
||||
template <int N> //specialization for value +3 to divisible by 4
|
||||
struct PreMakeSeq<3, N> : MakeSeq<N - 2, N - 1, N>
|
||||
{
|
||||
};
|
||||
|
||||
template <> //specialization for 4
|
||||
struct PreMakeSeq<4, 3>
|
||||
{
|
||||
using type = IntegerSequence<0, 1, 2, 3>;
|
||||
};
|
||||
|
||||
template <> //specialization for 3
|
||||
struct PreMakeSeq<3, 2>
|
||||
{
|
||||
using type = IntegerSequence<0, 1, 2>;
|
||||
};
|
||||
|
||||
template <> //specialization for 2
|
||||
struct PreMakeSeq<2, 1>
|
||||
{
|
||||
using type = IntegerSequence<0, 1>;
|
||||
};
|
||||
|
||||
template <> //specialization for 1
|
||||
struct PreMakeSeq<1, 0>
|
||||
{
|
||||
using type = IntegerSequence<0>;
|
||||
};
|
||||
|
||||
template <> //specialization for 0
|
||||
struct PreMakeSeq<0, -1>
|
||||
{
|
||||
using type = IntegerSequence<>;
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
|
||||
/// \brief A helper method to create an Integer sequence of 0...N-1.
|
||||
template <int N>
|
||||
struct MakeIntegerSequence /** @cond */ : detail::PreMakeSeq<N % 4, N - 1> /** @endcond */
|
||||
{
|
||||
//The cond/endcond are used to tell doxygen to ignore the inheritance, as that
|
||||
//builds a massive inheritance tree
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif //vtk_m_internal_IntegerSequence_h
|
@ -23,6 +23,5 @@ set(unit_tests
|
||||
UnitTestConfigureFor32.cxx
|
||||
UnitTestConfigureFor64.cxx
|
||||
UnitTestFunctionInterface.cxx
|
||||
UnitTestIntegerSequence.cxx
|
||||
)
|
||||
vtkm_unit_tests(SOURCES ${unit_tests})
|
||||
|
@ -1,71 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
||||
// Copyright 2014 UT-Battelle, LLC.
|
||||
// Copyright 2014 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-NA0003525 with NTESS,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/internal/IntegerSequence.h>
|
||||
#include <vtkm/testing/Testing.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
template <std::size_t Len, int... Ts>
|
||||
void verify_correct_length(vtkm::internal::IntegerSequence<Ts...>)
|
||||
{
|
||||
static_assert(Len == sizeof...(Ts), "Incorrect length");
|
||||
|
||||
//use a runtime time to verify the contents of the integer sequence
|
||||
//are 0...N-1
|
||||
std::vector<int> container = { Ts... };
|
||||
for (std::size_t i = 0; i < Len; ++i)
|
||||
{
|
||||
VTKM_TEST_ASSERT(container[i] == static_cast<int>(i), "Incorrect value");
|
||||
}
|
||||
}
|
||||
|
||||
void IntegerSequenceSizes()
|
||||
{
|
||||
using zero = vtkm::internal::MakeIntegerSequence<0>::type;
|
||||
using one = vtkm::internal::MakeIntegerSequence<1>::type;
|
||||
using two = vtkm::internal::MakeIntegerSequence<2>::type;
|
||||
using four = vtkm::internal::MakeIntegerSequence<4>::type;
|
||||
using thirty_two = vtkm::internal::MakeIntegerSequence<32>::type;
|
||||
using thirty_three = vtkm::internal::MakeIntegerSequence<33>::type;
|
||||
using thirty_four = vtkm::internal::MakeIntegerSequence<34>::type;
|
||||
using thirty_five = vtkm::internal::MakeIntegerSequence<35>::type;
|
||||
using two_fifty_six = vtkm::internal::MakeIntegerSequence<256>::type;
|
||||
using five_twelve = vtkm::internal::MakeIntegerSequence<512>::type;
|
||||
|
||||
verify_correct_length<0>(zero());
|
||||
verify_correct_length<1>(one());
|
||||
verify_correct_length<2>(two());
|
||||
verify_correct_length<4>(four());
|
||||
verify_correct_length<32>(thirty_two());
|
||||
verify_correct_length<33>(thirty_three());
|
||||
verify_correct_length<34>(thirty_four());
|
||||
verify_correct_length<35>(thirty_five());
|
||||
verify_correct_length<256>(two_fifty_six());
|
||||
verify_correct_length<512>(five_twelve());
|
||||
}
|
||||
}
|
||||
|
||||
int UnitTestIntegerSequence(int, char* [])
|
||||
{
|
||||
return vtkm::testing::Testing::Run(IntegerSequenceSizes);
|
||||
}
|
@ -330,11 +330,21 @@ struct Canvas::CanvasInternals
|
||||
: Width(width)
|
||||
, Height(height)
|
||||
{
|
||||
BackgroundColor.Components[0] = 0.f;
|
||||
BackgroundColor.Components[1] = 0.f;
|
||||
BackgroundColor.Components[2] = 0.f;
|
||||
BackgroundColor.Components[3] = 1.f;
|
||||
|
||||
ForegroundColor.Components[0] = 1.f;
|
||||
ForegroundColor.Components[1] = 1.f;
|
||||
ForegroundColor.Components[2] = 1.f;
|
||||
ForegroundColor.Components[3] = 1.f;
|
||||
}
|
||||
|
||||
vtkm::Id Width;
|
||||
vtkm::Id Height;
|
||||
vtkm::rendering::Color BackgroundColor;
|
||||
vtkm::rendering::Color ForegroundColor;
|
||||
ColorBufferType ColorBuffer;
|
||||
DepthBufferType DepthBuffer;
|
||||
vtkm::rendering::BitmapFont Font;
|
||||
@ -400,6 +410,16 @@ void Canvas::SetBackgroundColor(const vtkm::rendering::Color& color)
|
||||
Internals->BackgroundColor = color;
|
||||
}
|
||||
|
||||
const vtkm::rendering::Color& Canvas::GetForegroundColor() const
|
||||
{
|
||||
return Internals->ForegroundColor;
|
||||
}
|
||||
|
||||
void Canvas::SetForegroundColor(const vtkm::rendering::Color& color)
|
||||
{
|
||||
Internals->ForegroundColor = color;
|
||||
}
|
||||
|
||||
void Canvas::Initialize()
|
||||
{
|
||||
}
|
||||
|
@ -87,6 +87,12 @@ public:
|
||||
VTKM_CONT
|
||||
void SetBackgroundColor(const vtkm::rendering::Color& color);
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::rendering::Color& GetForegroundColor() const;
|
||||
|
||||
VTKM_CONT
|
||||
void SetForegroundColor(const vtkm::rendering::Color& color);
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Id2 GetScreenPoint(vtkm::Float32 x,
|
||||
vtkm::Float32 y,
|
||||
|
@ -56,7 +56,7 @@ void ColorBarAnnotation::Render(const vtkm::rendering::Camera& camera,
|
||||
|
||||
canvas.AddColorBar(bounds, this->ColorTable, true);
|
||||
|
||||
this->Axis.SetColor(vtkm::rendering::Color(1, 1, 1));
|
||||
this->Axis.SetColor(canvas.GetForegroundColor());
|
||||
this->Axis.SetLineWidth(1);
|
||||
this->Axis.SetScreenPosition(bounds.X.Min, bounds.Y.Min, bounds.X.Max, bounds.Y.Min);
|
||||
this->Axis.SetMajorTickSize(0, .02, 1.0);
|
||||
|
@ -40,12 +40,52 @@ namespace rendering
|
||||
namespace
|
||||
{
|
||||
|
||||
class CreateConnectivity : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
CreateConnectivity() {}
|
||||
|
||||
typedef void ControlSignature(FieldIn<>, WholeArrayOut<>);
|
||||
|
||||
typedef void ExecutionSignature(_1, _2);
|
||||
|
||||
template <typename ConnPortalType>
|
||||
VTKM_EXEC void operator()(const vtkm::Id& i, ConnPortalType& connPortal) const
|
||||
{
|
||||
connPortal.Set(i * 2 + 0, i);
|
||||
connPortal.Set(i * 2 + 1, i + 1);
|
||||
}
|
||||
}; // conn
|
||||
|
||||
struct ConnFunctor
|
||||
{
|
||||
|
||||
template <typename Device>
|
||||
VTKM_CONT bool operator()(Device,
|
||||
vtkm::cont::ArrayHandleCounting<vtkm::Id>& iter,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& conn)
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
||||
vtkm::worklet::DispatcherMapField<CreateConnectivity, Device>(CreateConnectivity())
|
||||
.Invoke(iter, conn);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class Convert1DCoordinates : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
private:
|
||||
bool LogY;
|
||||
bool LogX;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
Convert1DCoordinates() {}
|
||||
Convert1DCoordinates(bool logY, bool logX)
|
||||
: LogY(logY)
|
||||
, LogX(logX)
|
||||
{
|
||||
}
|
||||
|
||||
typedef void ControlSignature(FieldIn<>,
|
||||
FieldIn<vtkm::TypeListTagScalarAll>,
|
||||
@ -69,11 +109,39 @@ public:
|
||||
outCoord[0] = inCoord[0];
|
||||
outCoord[1] = static_cast<vtkm::Float32>(scalar);
|
||||
outCoord[2] = 0.f;
|
||||
if (LogY)
|
||||
{
|
||||
outCoord[1] = vtkm::Log10(outCoord[1]);
|
||||
}
|
||||
if (LogX)
|
||||
{
|
||||
outCoord[0] = vtkm::Log10(outCoord[0]);
|
||||
}
|
||||
// all lines have the same color
|
||||
fieldOut = 1.f;
|
||||
}
|
||||
}; // convert coords
|
||||
|
||||
struct ConvertFunctor
|
||||
{
|
||||
|
||||
template <typename Device, typename CoordType, typename ScalarType>
|
||||
VTKM_CONT bool operator()(Device,
|
||||
CoordType coords,
|
||||
ScalarType scalars,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>>& outCoords,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>& outScalars,
|
||||
bool logY,
|
||||
bool logX)
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
||||
vtkm::worklet::DispatcherMapField<Convert1DCoordinates, Device>(
|
||||
Convert1DCoordinates(logY, logX))
|
||||
.Invoke(coords, scalars, outCoords, outScalars);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(VTKM_MSVC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4127) //conditional expression is constant
|
||||
@ -189,12 +257,14 @@ struct MapperWireframer::InternalsType
|
||||
: Canvas(canvas)
|
||||
, ShowInternalZones(showInternalZones)
|
||||
, IsOverlay(isOverlay)
|
||||
, CompositeBackground(true)
|
||||
{
|
||||
}
|
||||
|
||||
vtkm::rendering::Canvas* Canvas;
|
||||
bool ShowInternalZones;
|
||||
bool IsOverlay;
|
||||
bool CompositeBackground;
|
||||
}; // struct MapperWireframer::InternalsType
|
||||
|
||||
MapperWireframer::MapperWireframer()
|
||||
@ -274,22 +344,24 @@ void MapperWireframer::RenderCells(const vtkm::cont::DynamicCellSet& inCellSet,
|
||||
//
|
||||
// Convert the cell set into something we can draw
|
||||
//
|
||||
vtkm::worklet::DispatcherMapField<Convert1DCoordinates, vtkm::cont::DeviceAdapterTagSerial>(
|
||||
Convert1DCoordinates())
|
||||
.Invoke(coords.GetData(), inScalarField.GetData(), newCoords, newScalars);
|
||||
vtkm::cont::TryExecute(ConvertFunctor(),
|
||||
coords.GetData(),
|
||||
inScalarField.GetData(),
|
||||
newCoords,
|
||||
newScalars,
|
||||
this->LogarithmY,
|
||||
this->LogarithmX);
|
||||
|
||||
actualCoords = vtkm::cont::CoordinateSystem("coords", newCoords);
|
||||
actualField =
|
||||
vtkm::cont::Field(inScalarField.GetName(), vtkm::cont::Field::ASSOC_POINTS, newScalars);
|
||||
|
||||
vtkm::Id numCells = cellSet.GetNumberOfCells();
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> conn;
|
||||
vtkm::cont::ArrayHandleCounting<vtkm::Id> iter =
|
||||
vtkm::cont::make_ArrayHandleCounting(vtkm::Id(0), vtkm::Id(1), numCells);
|
||||
conn.Allocate(numCells * 2);
|
||||
auto connPortal = conn.GetPortalControl();
|
||||
for (int i = 0; i < numCells; ++i)
|
||||
{
|
||||
connPortal.Set(i * 2 + 0, i);
|
||||
connPortal.Set(i * 2 + 1, i + 1);
|
||||
}
|
||||
vtkm::cont::TryExecute(ConnFunctor(), iter, conn);
|
||||
|
||||
vtkm::cont::CellSetSingleType<> newCellSet("cells");
|
||||
newCellSet.Fill(newCoords.GetNumberOfValues(), vtkm::CELL_SHAPE_LINE, 2, conn);
|
||||
@ -356,6 +428,16 @@ void MapperWireframer::RenderCells(const vtkm::cont::DynamicCellSet& inCellSet,
|
||||
renderer.SetColorMap(this->ColorMap);
|
||||
renderer.SetData(actualCoords, edgeIndices, actualField, scalarRange);
|
||||
renderer.Render();
|
||||
|
||||
if (this->Internals->CompositeBackground)
|
||||
{
|
||||
this->Internals->Canvas->BlendBackground();
|
||||
}
|
||||
}
|
||||
|
||||
void MapperWireframer::SetCompositeBackground(bool on)
|
||||
{
|
||||
this->Internals->CompositeBackground = on;
|
||||
}
|
||||
|
||||
vtkm::rendering::Mapper* MapperWireframer::NewCopy() const
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
|
||||
bool GetShowInternalZones() const;
|
||||
void SetShowInternalZones(bool showInternalZones);
|
||||
void SetCompositeBackground(bool on);
|
||||
|
||||
bool GetIsOverlay() const;
|
||||
void SetIsOverlay(bool isOverlay);
|
||||
|
@ -28,13 +28,16 @@ namespace rendering
|
||||
View::View(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor)
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: Scene(scene)
|
||||
, MapperPointer(mapper.NewCopy())
|
||||
, CanvasPointer(canvas.NewCopy())
|
||||
, WorldAnnotatorPointer(canvas.CreateWorldAnnotator())
|
||||
{
|
||||
this->CanvasPointer->SetBackgroundColor(backgroundColor);
|
||||
this->CanvasPointer->SetForegroundColor(foregroundColor);
|
||||
this->AxisColor = foregroundColor;
|
||||
|
||||
vtkm::Bounds spatialBounds = this->Scene.GetSpatialBounds();
|
||||
this->Camera.ResetToBounds(spatialBounds);
|
||||
@ -52,7 +55,8 @@ View::View(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor)
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: Scene(scene)
|
||||
, MapperPointer(mapper.NewCopy())
|
||||
, CanvasPointer(canvas.NewCopy())
|
||||
@ -60,6 +64,8 @@ View::View(const vtkm::rendering::Scene& scene,
|
||||
, Camera(camera)
|
||||
{
|
||||
this->CanvasPointer->SetBackgroundColor(backgroundColor);
|
||||
this->CanvasPointer->SetForegroundColor(foregroundColor);
|
||||
this->AxisColor = foregroundColor;
|
||||
}
|
||||
|
||||
View::~View()
|
||||
|
@ -42,13 +42,15 @@ public:
|
||||
View(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1));
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
View(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1));
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
virtual ~View();
|
||||
|
||||
@ -94,6 +96,12 @@ public:
|
||||
this->CanvasPointer->SetBackgroundColor(color);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void SetForegroundColor(const vtkm::rendering::Color& color)
|
||||
{
|
||||
this->CanvasPointer->SetForegroundColor(color);
|
||||
}
|
||||
|
||||
virtual void Initialize();
|
||||
|
||||
virtual void Paint() = 0;
|
||||
|
@ -30,8 +30,9 @@ namespace rendering
|
||||
View1D::View1D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor)
|
||||
: View(scene, mapper, canvas, backgroundColor)
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: View(scene, mapper, canvas, backgroundColor, foregroundColor)
|
||||
{
|
||||
}
|
||||
|
||||
@ -39,8 +40,9 @@ View1D::View1D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor)
|
||||
: View(scene, mapper, canvas, camera, backgroundColor)
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: View(scene, mapper, canvas, camera, backgroundColor, foregroundColor)
|
||||
{
|
||||
}
|
||||
|
||||
@ -116,6 +118,7 @@ void View1D::RenderColorLegendAnnotations()
|
||||
vtkm::rendering::Actor act = this->GetScene().GetActor(i);
|
||||
this->Legend.AddItem(act.GetScalarField().GetName(), act.GetColorTable().MapRGB(0));
|
||||
}
|
||||
this->Legend.SetLabelColor(this->GetCanvas().GetForegroundColor());
|
||||
this->Legend.Render(this->GetCamera(), this->GetWorldAnnotator(), this->GetCanvas());
|
||||
}
|
||||
}
|
||||
|
@ -35,13 +35,15 @@ public:
|
||||
View1D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1));
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
View1D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1));
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
~View1D();
|
||||
|
||||
|
@ -28,8 +28,9 @@ namespace rendering
|
||||
View2D::View2D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor)
|
||||
: View(scene, mapper, canvas, backgroundColor)
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: View(scene, mapper, canvas, backgroundColor, foregroundColor)
|
||||
{
|
||||
}
|
||||
|
||||
@ -37,8 +38,9 @@ View2D::View2D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor)
|
||||
: View(scene, mapper, canvas, camera, backgroundColor)
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: View(scene, mapper, canvas, camera, backgroundColor, foregroundColor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,13 +36,15 @@ public:
|
||||
View2D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1));
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
View2D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1));
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
~View2D();
|
||||
|
||||
|
@ -28,8 +28,9 @@ namespace rendering
|
||||
View3D::View3D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor)
|
||||
: View(scene, mapper, canvas, backgroundColor)
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: View(scene, mapper, canvas, backgroundColor, foregroundColor)
|
||||
{
|
||||
}
|
||||
|
||||
@ -37,8 +38,9 @@ View3D::View3D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor)
|
||||
: View(scene, mapper, canvas, camera, backgroundColor)
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: View(scene, mapper, canvas, camera, backgroundColor, foregroundColor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -37,13 +37,15 @@ public:
|
||||
View3D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1));
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
View3D(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Mapper& mapper,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1));
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
~View3D();
|
||||
|
||||
|
@ -255,7 +255,6 @@ public:
|
||||
rayOriginX = origin[0];
|
||||
rayOriginY = origin[1];
|
||||
rayOriginZ = origin[2];
|
||||
|
||||
i += Minx;
|
||||
j += Miny;
|
||||
pixelIndex = static_cast<vtkm::Id>(j * w + i);
|
||||
@ -333,7 +332,12 @@ public:
|
||||
pixelIndex = static_cast<vtkm::Id>(j * w + i);
|
||||
ray_dir = nlook + delta_x * ((2.f * Precision(i) - Precision(w)) / 2.0f) +
|
||||
delta_y * ((2.f * Precision(j) - Precision(h)) / 2.0f);
|
||||
|
||||
// avoid some numerical issues
|
||||
for (vtkm::Int32 d = 0; d < 3; ++d)
|
||||
{
|
||||
if (ray_dir[d] == 0.f)
|
||||
ray_dir[d] += 0.0000001f;
|
||||
}
|
||||
Precision dot = vtkm::dot(ray_dir, ray_dir);
|
||||
Precision sq_mag = vtkm::Sqrt(dot);
|
||||
|
||||
|
@ -47,8 +47,10 @@ VTKM_EXEC_CONT inline void IntersectZoo(T xpoints[8],
|
||||
vtkm::Int32 kx, ky, kz;
|
||||
WaterTight<T> intersector;
|
||||
intersector.FindDir(dir, sx, sy, sz, kx, ky, kz);
|
||||
const vtkm::Int32 tableOffset = ZooLookUp[CellTypeLookUp[shapeType]][0];
|
||||
const vtkm::Int32 numTriangles = ZooLookUp[CellTypeLookUp[shapeType]][1];
|
||||
const vtkm::Int32 tableOffset =
|
||||
CellTables::Get().ZooLookUp[CellTables::Get().CellTypeLookUp[shapeType]][0];
|
||||
const vtkm::Int32 numTriangles =
|
||||
CellTables::Get().ZooLookUp[CellTables::Get().CellTypeLookUp[shapeType]][1];
|
||||
// Decompose each face into two triangles
|
||||
for (int i = 0; i < 6; ++i)
|
||||
distances[i] = -1.;
|
||||
@ -56,16 +58,16 @@ VTKM_EXEC_CONT inline void IntersectZoo(T xpoints[8],
|
||||
{
|
||||
const vtkm::Int32 offset = tableOffset + i;
|
||||
vtkm::Vec<T, 3> a, c, b;
|
||||
a[0] = xpoints[ZooTable[offset][1]];
|
||||
a[1] = ypoints[ZooTable[offset][1]];
|
||||
a[2] = zpoints[ZooTable[offset][1]];
|
||||
b[0] = xpoints[ZooTable[offset][2]];
|
||||
b[1] = ypoints[ZooTable[offset][2]];
|
||||
b[2] = zpoints[ZooTable[offset][2]];
|
||||
c[0] = xpoints[ZooTable[offset][3]];
|
||||
c[1] = ypoints[ZooTable[offset][3]];
|
||||
c[2] = zpoints[ZooTable[offset][3]];
|
||||
const vtkm::Int32 faceId = ZooTable[offset][0];
|
||||
a[0] = xpoints[CellTables::Get().ZooTable[offset][1]];
|
||||
a[1] = ypoints[CellTables::Get().ZooTable[offset][1]];
|
||||
a[2] = zpoints[CellTables::Get().ZooTable[offset][1]];
|
||||
b[0] = xpoints[CellTables::Get().ZooTable[offset][2]];
|
||||
b[1] = ypoints[CellTables::Get().ZooTable[offset][2]];
|
||||
b[2] = zpoints[CellTables::Get().ZooTable[offset][2]];
|
||||
c[0] = xpoints[CellTables::Get().ZooTable[offset][3]];
|
||||
c[1] = ypoints[CellTables::Get().ZooTable[offset][3]];
|
||||
c[2] = zpoints[CellTables::Get().ZooTable[offset][3]];
|
||||
const vtkm::Int32 faceId = CellTables::Get().ZooTable[offset][0];
|
||||
T distance = -1.f;
|
||||
|
||||
T uNotUsed, vNotUsed;
|
||||
@ -111,18 +113,18 @@ VTKM_EXEC_CONT inline void IntersectHex(T xpoints[8],
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
vtkm::Vec<T, 3> a, c, b, d;
|
||||
a[0] = xpoints[ShapesFaceList[i][1]];
|
||||
a[1] = ypoints[ShapesFaceList[i][1]];
|
||||
a[2] = zpoints[ShapesFaceList[i][1]];
|
||||
b[0] = xpoints[ShapesFaceList[i][2]];
|
||||
b[1] = ypoints[ShapesFaceList[i][2]];
|
||||
b[2] = zpoints[ShapesFaceList[i][2]];
|
||||
c[0] = xpoints[ShapesFaceList[i][3]];
|
||||
c[1] = ypoints[ShapesFaceList[i][3]];
|
||||
c[2] = zpoints[ShapesFaceList[i][3]];
|
||||
d[0] = xpoints[ShapesFaceList[i][4]];
|
||||
d[1] = ypoints[ShapesFaceList[i][4]];
|
||||
d[2] = zpoints[ShapesFaceList[i][4]];
|
||||
a[0] = xpoints[CellTables::Get().ShapesFaceList[i][1]];
|
||||
a[1] = ypoints[CellTables::Get().ShapesFaceList[i][1]];
|
||||
a[2] = zpoints[CellTables::Get().ShapesFaceList[i][1]];
|
||||
b[0] = xpoints[CellTables::Get().ShapesFaceList[i][2]];
|
||||
b[1] = ypoints[CellTables::Get().ShapesFaceList[i][2]];
|
||||
b[2] = zpoints[CellTables::Get().ShapesFaceList[i][2]];
|
||||
c[0] = xpoints[CellTables::Get().ShapesFaceList[i][3]];
|
||||
c[1] = ypoints[CellTables::Get().ShapesFaceList[i][3]];
|
||||
c[2] = zpoints[CellTables::Get().ShapesFaceList[i][3]];
|
||||
d[0] = xpoints[CellTables::Get().ShapesFaceList[i][4]];
|
||||
d[1] = ypoints[CellTables::Get().ShapesFaceList[i][4]];
|
||||
d[2] = zpoints[CellTables::Get().ShapesFaceList[i][4]];
|
||||
T distance = -1.f;
|
||||
distances[i] = distance; //init to -1
|
||||
|
||||
@ -189,19 +191,20 @@ VTKM_EXEC_CONT inline void IntersectTet(T xpoints[8],
|
||||
WaterTight<T> intersector;
|
||||
intersector.FindDir(dir, sx, sy, sz, kx, ky, kz);
|
||||
|
||||
const vtkm::Int32 tableOffset = FaceLookUp[CellTypeLookUp[CELL_SHAPE_TETRA]][0];
|
||||
const vtkm::Int32 tableOffset =
|
||||
CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[CELL_SHAPE_TETRA]][0];
|
||||
for (vtkm::Int32 i = 0; i < 4; ++i)
|
||||
{
|
||||
vtkm::Vec<T, 3> a, c, b;
|
||||
a[0] = xpoints[ShapesFaceList[i + tableOffset][1]];
|
||||
a[1] = ypoints[ShapesFaceList[i + tableOffset][1]];
|
||||
a[2] = zpoints[ShapesFaceList[i + tableOffset][1]];
|
||||
b[0] = xpoints[ShapesFaceList[i + tableOffset][2]];
|
||||
b[1] = ypoints[ShapesFaceList[i + tableOffset][2]];
|
||||
b[2] = zpoints[ShapesFaceList[i + tableOffset][2]];
|
||||
c[0] = xpoints[ShapesFaceList[i + tableOffset][3]];
|
||||
c[1] = ypoints[ShapesFaceList[i + tableOffset][3]];
|
||||
c[2] = zpoints[ShapesFaceList[i + tableOffset][3]];
|
||||
a[0] = xpoints[CellTables::Get().ShapesFaceList[i + tableOffset][1]];
|
||||
a[1] = ypoints[CellTables::Get().ShapesFaceList[i + tableOffset][1]];
|
||||
a[2] = zpoints[CellTables::Get().ShapesFaceList[i + tableOffset][1]];
|
||||
b[0] = xpoints[CellTables::Get().ShapesFaceList[i + tableOffset][2]];
|
||||
b[1] = ypoints[CellTables::Get().ShapesFaceList[i + tableOffset][2]];
|
||||
b[2] = zpoints[CellTables::Get().ShapesFaceList[i + tableOffset][2]];
|
||||
c[0] = xpoints[CellTables::Get().ShapesFaceList[i + tableOffset][3]];
|
||||
c[1] = ypoints[CellTables::Get().ShapesFaceList[i + tableOffset][3]];
|
||||
c[2] = zpoints[CellTables::Get().ShapesFaceList[i + tableOffset][3]];
|
||||
T distance = -1.f;
|
||||
distances[i] = distance; //init to -1
|
||||
|
||||
@ -245,23 +248,24 @@ VTKM_EXEC_CONT inline void IntersectWedge(T xpoints[8],
|
||||
WaterTight<T> intersector;
|
||||
intersector.FindDir(dir, sx, sy, sz, kx, ky, kz);
|
||||
// TODO: try two sepate loops to see performance impact
|
||||
const vtkm::Int32 tableOffset = FaceLookUp[CellTypeLookUp[CELL_SHAPE_WEDGE]][0];
|
||||
const vtkm::Int32 tableOffset =
|
||||
CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[CELL_SHAPE_WEDGE]][0];
|
||||
// Decompose each face into two triangles
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
vtkm::Vec<T, 3> a, c, b, d;
|
||||
a[0] = xpoints[ShapesFaceList[i + tableOffset][1]];
|
||||
a[1] = ypoints[ShapesFaceList[i + tableOffset][1]];
|
||||
a[2] = zpoints[ShapesFaceList[i + tableOffset][1]];
|
||||
b[0] = xpoints[ShapesFaceList[i + tableOffset][2]];
|
||||
b[1] = ypoints[ShapesFaceList[i + tableOffset][2]];
|
||||
b[2] = zpoints[ShapesFaceList[i + tableOffset][2]];
|
||||
c[0] = xpoints[ShapesFaceList[i + tableOffset][3]];
|
||||
c[1] = ypoints[ShapesFaceList[i + tableOffset][3]];
|
||||
c[2] = zpoints[ShapesFaceList[i + tableOffset][3]];
|
||||
d[0] = xpoints[ShapesFaceList[i + tableOffset][4]];
|
||||
d[1] = ypoints[ShapesFaceList[i + tableOffset][4]];
|
||||
d[2] = zpoints[ShapesFaceList[i + tableOffset][4]];
|
||||
a[0] = xpoints[CellTables::Get().ShapesFaceList[i + tableOffset][1]];
|
||||
a[1] = ypoints[CellTables::Get().ShapesFaceList[i + tableOffset][1]];
|
||||
a[2] = zpoints[CellTables::Get().ShapesFaceList[i + tableOffset][1]];
|
||||
b[0] = xpoints[CellTables::Get().ShapesFaceList[i + tableOffset][2]];
|
||||
b[1] = ypoints[CellTables::Get().ShapesFaceList[i + tableOffset][2]];
|
||||
b[2] = zpoints[CellTables::Get().ShapesFaceList[i + tableOffset][2]];
|
||||
c[0] = xpoints[CellTables::Get().ShapesFaceList[i + tableOffset][3]];
|
||||
c[1] = ypoints[CellTables::Get().ShapesFaceList[i + tableOffset][3]];
|
||||
c[2] = zpoints[CellTables::Get().ShapesFaceList[i + tableOffset][3]];
|
||||
d[0] = xpoints[CellTables::Get().ShapesFaceList[i + tableOffset][4]];
|
||||
d[1] = ypoints[CellTables::Get().ShapesFaceList[i + tableOffset][4]];
|
||||
d[2] = zpoints[CellTables::Get().ShapesFaceList[i + tableOffset][4]];
|
||||
T distance = -1.f;
|
||||
distances[i] = distance; //init to -1
|
||||
|
||||
|
@ -30,100 +30,114 @@ namespace rendering
|
||||
namespace raytracing
|
||||
{
|
||||
|
||||
//LookUp of Shapes to FaceLookUp
|
||||
VTKM_EXEC_CONSTANT
|
||||
static vtkm::Int32 CellTypeLookUp[15] = {
|
||||
4, // 0 Nothing
|
||||
4, // 1 Vertex
|
||||
4, // 2 (Not Used) Poly Vertex
|
||||
4, // 3 Line
|
||||
4, // 4 (Not Used) Poly Line
|
||||
4, // 5 Triangle
|
||||
4, // 6 (not used) triangle strip
|
||||
4, // 7 Polygon
|
||||
4, // 8 (Not used)Pixel
|
||||
4, // 9 Quad
|
||||
1, // 10 Tetra
|
||||
4, // 11 (Not used) Voxel
|
||||
0, // 12 Hex
|
||||
2, // 13 Wedge
|
||||
3 // 14 Pyramid
|
||||
};
|
||||
class CellTables
|
||||
{
|
||||
private:
|
||||
struct Tables
|
||||
{
|
||||
vtkm::Int32 CellTypeLookUp[15];
|
||||
vtkm::Int32 FaceLookUp[5][3];
|
||||
vtkm::Int32 ShapesFaceList[20][5];
|
||||
vtkm::Int32 ZooTable[30][4];
|
||||
vtkm::Int32 ZooLookUp[5][2];
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
static vtkm::Int32 FaceLookUp[5][3] = {
|
||||
{ 0, 6, 8 }, //hex offset into shapes face list, num faces and number of Indices
|
||||
{ 6, 4, 4 }, //tet
|
||||
{ 10, 5, 6 }, //wedge
|
||||
{ 15, 5, 5 }, //pyramid
|
||||
{ -1, 0, 0 } //unsupported shape
|
||||
};
|
||||
public:
|
||||
VTKM_EXEC_CONT static const Tables& Get()
|
||||
{
|
||||
static const Tables tables = {
|
||||
// CellTypeLookUp: LookUp of Shapes to FaceLookUp
|
||||
{
|
||||
4, // 0 Nothing
|
||||
4, // 1 Vertex
|
||||
4, // 2 (Not Used) Poly Vertex
|
||||
4, // 3 Line
|
||||
4, // 4 (Not Used) Poly Line
|
||||
4, // 5 Triangle
|
||||
4, // 6 (not used) triangle strip
|
||||
4, // 7 Polygon
|
||||
4, // 8 (Not used)Pixel
|
||||
4, // 9 Quad
|
||||
1, // 10 Tetra
|
||||
4, // 11 (Not used) Voxel
|
||||
0, // 12 Hex
|
||||
2, // 13 Wedge
|
||||
3 // 14 Pyramid
|
||||
},
|
||||
|
||||
// The convention for the faces is that looking from the outside of
|
||||
// the shape at a face, triangles should wind CCW.
|
||||
// Quads are broken up by {4=quad,a,b,c,d}:
|
||||
// t1 = abc and t2 = acd. Indices of the face are ordered CW, and the mapping
|
||||
// of t1 and t2 become CCW.
|
||||
// Since we know the triangle winding, we could tell
|
||||
// if we hit an inside face or outside face.
|
||||
VTKM_EXEC_CONSTANT
|
||||
static vtkm::Int32 ShapesFaceList[20][5] = {
|
||||
//hex
|
||||
{ 4, 0, 1, 5, 4 }, //face 0
|
||||
{ 4, 1, 2, 6, 5 },
|
||||
{ 4, 3, 7, 6, 2 },
|
||||
{ 4, 0, 4, 7, 3 },
|
||||
{ 4, 0, 3, 2, 1 },
|
||||
{ 4, 4, 5, 6, 7 }, //face 5
|
||||
// FaceLookUp
|
||||
{
|
||||
{ 0, 6, 8 }, //hex offset into shapes face list, num faces and number of Indices
|
||||
{ 6, 4, 4 }, //tet
|
||||
{ 10, 5, 6 }, //wedge
|
||||
{ 15, 5, 5 }, //pyramid
|
||||
{ -1, 0, 0 } //unsupported shape
|
||||
},
|
||||
|
||||
//tet
|
||||
{ 3, 0, 3, 1, -1 },
|
||||
{ 3, 1, 2, 3, -1 },
|
||||
{ 3, 0, 2, 3, -1 },
|
||||
{ 3, 0, 2, 1, -1 },
|
||||
// ShapesFaceList:
|
||||
// The convention for the faces is that looking from the outside of
|
||||
// the shape at a face, triangles should wind CCW.
|
||||
// Quads are broken up by {4=quad,a,b,c,d}:
|
||||
// t1 = abc and t2 = acd. Indices of the face are ordered CW, and the mapping
|
||||
// of t1 and t2 become CCW.
|
||||
// Since we know the triangle winding, we could tell
|
||||
// if we hit an inside face or outside face.
|
||||
{ //hex
|
||||
{ 4, 0, 1, 5, 4 }, //face 0
|
||||
{ 4, 1, 2, 6, 5 },
|
||||
{ 4, 3, 7, 6, 2 },
|
||||
{ 4, 0, 4, 7, 3 },
|
||||
{ 4, 0, 3, 2, 1 },
|
||||
{ 4, 4, 5, 6, 7 }, //face 5
|
||||
|
||||
//wedge
|
||||
{ 3, 0, 1, 2, -1 },
|
||||
{ 3, 3, 5, 4, -1 },
|
||||
{ 4, 3, 0, 2, 5 },
|
||||
{ 4, 1, 4, 5, 2 },
|
||||
{ 4, 0, 3, 4, 1 },
|
||||
//tet
|
||||
{ 3, 0, 3, 1, -1 },
|
||||
{ 3, 1, 2, 3, -1 },
|
||||
{ 3, 0, 2, 3, -1 },
|
||||
{ 3, 0, 2, 1, -1 },
|
||||
|
||||
//pyramid
|
||||
{ 3, 0, 4, 1, -1 },
|
||||
{ 3, 1, 2, 4, -1 },
|
||||
{ 3, 2, 3, 4, -1 },
|
||||
{ 3, 0, 4, 3, -1 },
|
||||
{ 4, 3, 2, 1, 0 }
|
||||
//wedge
|
||||
{ 3, 0, 1, 2, -1 },
|
||||
{ 3, 3, 5, 4, -1 },
|
||||
{ 4, 3, 0, 2, 5 },
|
||||
{ 4, 1, 4, 5, 2 },
|
||||
{ 4, 0, 3, 4, 1 },
|
||||
|
||||
};
|
||||
//pyramid
|
||||
{ 3, 0, 4, 1, -1 },
|
||||
{ 3, 1, 2, 4, -1 },
|
||||
{ 3, 2, 3, 4, -1 },
|
||||
{ 3, 0, 4, 3, -1 },
|
||||
{ 4, 3, 2, 1, 0 } },
|
||||
|
||||
// Test of zoo table.
|
||||
// Format (faceNumber, triangle)
|
||||
//
|
||||
VTKM_EXEC_CONSTANT
|
||||
static vtkm::Int32 ZooTable[30][4] = {
|
||||
{ 0, 0, 1, 5 }, // hex
|
||||
{ 0, 0, 5, 4 }, { 1, 1, 2, 6 }, { 1, 1, 6, 5 }, { 2, 3, 7, 6 }, { 2, 3, 6, 2 },
|
||||
{ 3, 0, 4, 7 }, { 3, 0, 7, 3 }, { 4, 0, 3, 2 }, { 4, 0, 2, 1 }, { 5, 4, 5, 6 },
|
||||
{ 5, 4, 6, 7 }, { 0, 0, 3, 1 }, // Tet
|
||||
{ 1, 1, 2, 3 }, { 2, 0, 2, 3 }, { 3, 0, 2, 1 }, { 0, 0, 1, 2 }, // Wedge
|
||||
{ 1, 3, 5, 4 }, { 2, 3, 0, 2 }, { 2, 3, 2, 5 }, { 3, 1, 4, 5 }, { 3, 1, 5, 2 },
|
||||
{ 4, 0, 3, 4 }, { 4, 0, 4, 1 }, { 0, 0, 4, 1 }, // Pyramid
|
||||
{ 1, 1, 2, 4 }, { 2, 2, 3, 4 }, { 3, 0, 4, 3 }, { 4, 3, 2, 1 }, { 4, 3, 1, 0 }
|
||||
};
|
||||
// ZooTable:
|
||||
// Test of zoo table.
|
||||
// Format (faceNumber, triangle)
|
||||
//
|
||||
{ { 0, 0, 1, 5 }, // hex
|
||||
{ 0, 0, 5, 4 }, { 1, 1, 2, 6 }, { 1, 1, 6, 5 }, { 2, 3, 7, 6 }, { 2, 3, 6, 2 },
|
||||
{ 3, 0, 4, 7 }, { 3, 0, 7, 3 }, { 4, 0, 3, 2 }, { 4, 0, 2, 1 }, { 5, 4, 5, 6 },
|
||||
{ 5, 4, 6, 7 }, { 0, 0, 3, 1 }, // Tet
|
||||
{ 1, 1, 2, 3 }, { 2, 0, 2, 3 }, { 3, 0, 2, 1 }, { 0, 0, 1, 2 }, // Wedge
|
||||
{ 1, 3, 5, 4 }, { 2, 3, 0, 2 }, { 2, 3, 2, 5 }, { 3, 1, 4, 5 }, { 3, 1, 5, 2 },
|
||||
{ 4, 0, 3, 4 }, { 4, 0, 4, 1 }, { 0, 0, 4, 1 }, // Pyramid
|
||||
{ 1, 1, 2, 4 }, { 2, 2, 3, 4 }, { 3, 0, 4, 3 }, { 4, 3, 2, 1 }, { 4, 3, 1, 0 } },
|
||||
|
||||
//
|
||||
// Offset into zoo table and the
|
||||
// number of triangles for the shape
|
||||
//
|
||||
VTKM_EXEC_CONSTANT
|
||||
static vtkm::Int32 ZooLookUp[5][2] = {
|
||||
{ 0, 12 }, //hex offset into shapes face list, num faces and number of Indices
|
||||
{ 12, 4 }, //tet
|
||||
{ 16, 8 }, //wedge
|
||||
{ 24, 6 }, //pyramid
|
||||
{ -1, 0 } //unsupported shape
|
||||
// ZooLookUp:
|
||||
// Offset into zoo table and the
|
||||
// number of triangles for the shape
|
||||
//
|
||||
{
|
||||
{ 0, 12 }, //hex offset into shapes face list, num faces and number of Indices
|
||||
{ 12, 4 }, //tet
|
||||
{ 16, 8 }, //wedge
|
||||
{ 24, 6 }, //pyramid
|
||||
{ -1, 0 } //unsupported shape
|
||||
}
|
||||
};
|
||||
|
||||
return tables;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace raytracing
|
||||
|
@ -281,7 +281,8 @@ public:
|
||||
}
|
||||
const vtkm::UInt8 cellShape = MeshConn.GetCellShape(currentCell);
|
||||
Intersector.IntersectCell(xpoints, ypoints, zpoints, dir, origin, distances, cellShape);
|
||||
const vtkm::Int32 numFaces = FaceLookUp[CellTypeLookUp[cellShape]][1];
|
||||
const vtkm::Int32 numFaces =
|
||||
CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[cellShape]][1];
|
||||
//vtkm::Int32 minFace = 6;
|
||||
vtkm::Int32 maxFace = -1;
|
||||
|
||||
@ -415,7 +416,8 @@ public:
|
||||
|
||||
const vtkm::UInt8 cellShape = MeshConn.GetCellShape(currentCell);
|
||||
Intersector.IntersectCell(xpoints, ypoints, zpoints, dir, origin, distances, cellShape);
|
||||
const vtkm::Int32 numFaces = FaceLookUp[CellTypeLookUp[cellShape]][1];
|
||||
const vtkm::Int32 numFaces =
|
||||
CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[cellShape]][1];
|
||||
|
||||
//vtkm::Int32 minFace = 6;
|
||||
vtkm::Int32 maxFace = -1;
|
||||
|
@ -110,19 +110,19 @@ public:
|
||||
vtkm::Int32 tableOffset = 0;
|
||||
if (shapeType == vtkm::CELL_SHAPE_TETRA)
|
||||
{
|
||||
tableOffset = FaceLookUp[1][0];
|
||||
tableOffset = CellTables::Get().FaceLookUp[1][0];
|
||||
}
|
||||
else if (shapeType == vtkm::CELL_SHAPE_HEXAHEDRON)
|
||||
{
|
||||
tableOffset = FaceLookUp[0][0];
|
||||
tableOffset = CellTables::Get().FaceLookUp[0][0];
|
||||
}
|
||||
else if (shapeType == vtkm::CELL_SHAPE_WEDGE)
|
||||
{
|
||||
tableOffset = FaceLookUp[2][0];
|
||||
tableOffset = CellTables::Get().FaceLookUp[2][0];
|
||||
}
|
||||
else if (shapeType == vtkm::CELL_SHAPE_PYRAMID)
|
||||
{
|
||||
tableOffset = FaceLookUp[3][0];
|
||||
tableOffset = CellTables::Get().FaceLookUp[3][0];
|
||||
}
|
||||
else
|
||||
printf("Error shape not recognized %d\n", (int)shapeType);
|
||||
@ -190,8 +190,8 @@ public:
|
||||
vtkm::Id shape2Offset =
|
||||
GetShapeOffset(shapes.Get(cellId2)) + faceIdPairs.Get(currentIndex)[1];
|
||||
|
||||
vtkm::Int32 icount1 = ShapesFaceList[shape1Offset][0];
|
||||
vtkm::Int32 icount2 = ShapesFaceList[shape2Offset][0];
|
||||
vtkm::Int32 icount1 = CellTables::Get().ShapesFaceList[shape1Offset][0];
|
||||
vtkm::Int32 icount2 = CellTables::Get().ShapesFaceList[shape2Offset][0];
|
||||
//Check to see if we have the same number of idices
|
||||
if (icount1 != icount2)
|
||||
continue;
|
||||
@ -201,22 +201,24 @@ public:
|
||||
vtkm::Vec<vtkm::Id, 4> indices1;
|
||||
vtkm::Vec<vtkm::Id, 4> indices2;
|
||||
|
||||
for (vtkm::Int32 i = 1; i <= ShapesFaceList[shape1Offset][0]; ++i)
|
||||
for (vtkm::Int32 i = 1; i <= CellTables::Get().ShapesFaceList[shape1Offset][0]; ++i)
|
||||
{
|
||||
BOUNDS_CHECK(offsets, cellId1);
|
||||
BOUNDS_CHECK(offsets, cellId2);
|
||||
BOUNDS_CHECK(connectivity, (offsets.Get(cellId1) + ShapesFaceList[shape1Offset][i]));
|
||||
BOUNDS_CHECK(connectivity, (offsets.Get(cellId2) + ShapesFaceList[shape2Offset][i]));
|
||||
indices1[i - 1] =
|
||||
connectivity.Get(offsets.Get(cellId1) + ShapesFaceList[shape1Offset][i]);
|
||||
indices2[i - 1] =
|
||||
connectivity.Get(offsets.Get(cellId2) + ShapesFaceList[shape2Offset][i]);
|
||||
BOUNDS_CHECK(connectivity,
|
||||
(offsets.Get(cellId1) + CellTables::Get().ShapesFaceList[shape1Offset][i]));
|
||||
BOUNDS_CHECK(connectivity,
|
||||
(offsets.Get(cellId2) + CellTables::Get().ShapesFaceList[shape2Offset][i]));
|
||||
indices1[i - 1] = connectivity.Get(offsets.Get(cellId1) +
|
||||
CellTables::Get().ShapesFaceList[shape1Offset][i]);
|
||||
indices2[i - 1] = connectivity.Get(offsets.Get(cellId2) +
|
||||
CellTables::Get().ShapesFaceList[shape2Offset][i]);
|
||||
}
|
||||
|
||||
bool isEqual = true;
|
||||
for (vtkm::Int32 i = 0; i < ShapesFaceList[shape1Offset][0]; ++i)
|
||||
for (vtkm::Int32 i = 0; i < CellTables::Get().ShapesFaceList[shape1Offset][0]; ++i)
|
||||
{
|
||||
if (!IsIn(indices1[i], indices2, ShapesFaceList[shape1Offset][0]))
|
||||
if (!IsIn(indices1[i], indices2, CellTables::Get().ShapesFaceList[shape1Offset][0]))
|
||||
isEqual = false;
|
||||
}
|
||||
|
||||
@ -285,7 +287,8 @@ public:
|
||||
vtkm::Id offset = shapeOffsets.Get(cellId);
|
||||
BOUNDS_CHECK(shapes, cellId);
|
||||
vtkm::Int32 shapeId = static_cast<vtkm::Int32>(shapes.Get(cellId));
|
||||
vtkm::Int32 shapesFaceOffset = FaceLookUp[CellTypeLookUp[shapeId]][0];
|
||||
vtkm::Int32 shapesFaceOffset =
|
||||
CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[shapeId]][0];
|
||||
if (shapesFaceOffset == -1)
|
||||
{
|
||||
printf("Unsupported Shape Type %d\n", shapeId);
|
||||
@ -294,12 +297,12 @@ public:
|
||||
|
||||
vtkm::Vec<vtkm::Id, 4> faceIndices(-1, -1, -1, -1);
|
||||
vtkm::Int32 tableIndex = static_cast<vtkm::Int32>(shapesFaceOffset + faceIdPair[1]);
|
||||
const vtkm::Int32 numIndices = ShapesFaceList[tableIndex][0];
|
||||
const vtkm::Int32 numIndices = CellTables::Get().ShapesFaceList[tableIndex][0];
|
||||
|
||||
for (vtkm::Int32 i = 1; i <= numIndices; ++i)
|
||||
{
|
||||
BOUNDS_CHECK(indices, offset + ShapesFaceList[tableIndex][i]);
|
||||
faceIndices[i - 1] = indices.Get(offset + ShapesFaceList[tableIndex][i]);
|
||||
BOUNDS_CHECK(indices, offset + CellTables::Get().ShapesFaceList[tableIndex][i]);
|
||||
faceIndices[i - 1] = indices.Get(offset + CellTables::Get().ShapesFaceList[tableIndex][i]);
|
||||
}
|
||||
vtkm::Vec<vtkm::Id, 4> triangle;
|
||||
triangle[0] = cellId;
|
||||
@ -344,18 +347,6 @@ public:
|
||||
}
|
||||
}; //class WriteFaceConn
|
||||
|
||||
// Each one of size segments will process
|
||||
// one face of the hex and domain
|
||||
VTKM_EXEC_CONSTANT
|
||||
static vtkm::Int32 SegmentToFace[6] = { 0, 2, 1, 3, 4, 5 };
|
||||
|
||||
// Each face/segment has 2 varying dimensions
|
||||
VTKM_EXEC_CONSTANT
|
||||
static vtkm::Int32 SegmentDirections[6][2] = { { 0, 2 }, //face 0 and 2 have the same directions
|
||||
{ 0, 2 }, { 1, 2 }, //1 and 3
|
||||
{ 1, 2 }, { 0, 1 }, // 4 and 5
|
||||
{ 0, 1 } };
|
||||
|
||||
class StructuredExternalTriangles : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
protected:
|
||||
@ -395,6 +386,18 @@ public:
|
||||
template <typename TrianglePortalType>
|
||||
VTKM_EXEC inline void operator()(const vtkm::Id& index, TrianglePortalType& triangles) const
|
||||
{
|
||||
// Each one of size segments will process
|
||||
// one face of the hex and domain
|
||||
static const vtkm::Int32 SegmentToFace[6] = { 0, 2, 1, 3, 4, 5 };
|
||||
|
||||
// Each face/segment has 2 varying dimensions
|
||||
static const vtkm::Int32 SegmentDirections[6][2] = {
|
||||
{ 0, 2 }, //face 0 and 2 have the same directions
|
||||
{ 0, 2 }, { 1, 2 }, //1 and 3
|
||||
{ 1, 2 }, { 0, 1 }, // 4 and 5
|
||||
{ 0, 1 }
|
||||
};
|
||||
|
||||
//
|
||||
// We get one index per extenal face
|
||||
//
|
||||
@ -449,7 +452,8 @@ public:
|
||||
// Look up the offset into the face list for each cell type
|
||||
// This should always be zero, but in case this table changes I don't
|
||||
// want to break anything.
|
||||
vtkm::Int32 shapesFaceOffset = FaceLookUp[CellTypeLookUp[CELL_SHAPE_HEXAHEDRON]][0];
|
||||
vtkm::Int32 shapesFaceOffset =
|
||||
CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[CELL_SHAPE_HEXAHEDRON]][0];
|
||||
|
||||
vtkm::Vec<vtkm::Id, 4> faceIndices;
|
||||
vtkm::Int32 tableIndex = shapesFaceOffset + cellFace;
|
||||
@ -457,7 +461,7 @@ public:
|
||||
// Load the face
|
||||
for (vtkm::Int32 i = 1; i <= 4; ++i)
|
||||
{
|
||||
faceIndices[i - 1] = cellIndices[ShapesFaceList[tableIndex][i]];
|
||||
faceIndices[i - 1] = cellIndices[CellTables::Get().ShapesFaceList[tableIndex][i]];
|
||||
}
|
||||
const vtkm::Id outputOffset = index * 2;
|
||||
vtkm::Vec<vtkm::Id, 4> triangle;
|
||||
@ -492,14 +496,15 @@ public:
|
||||
vtkm::Id cellId = faceIdPair[0];
|
||||
vtkm::Id cellFace = faceIdPair[1];
|
||||
vtkm::Int32 shapeType = static_cast<vtkm::Int32>(shapes.Get(cellId));
|
||||
vtkm::Int32 faceStartIndex = FaceLookUp[CellTypeLookUp[shapeType]][0];
|
||||
vtkm::Int32 faceStartIndex =
|
||||
CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[shapeType]][0];
|
||||
if (faceStartIndex == -1)
|
||||
{
|
||||
//Unsupported Shape Type this should never happen
|
||||
triangleCount = 0;
|
||||
return;
|
||||
}
|
||||
vtkm::Int32 faceType = ShapesFaceList[faceStartIndex + cellFace][0];
|
||||
vtkm::Int32 faceType = CellTables::Get().ShapesFaceList[faceStartIndex + cellFace][0];
|
||||
// The face will either have 4 or 3 indices, so quad or tri
|
||||
triangleCount = (faceType == 4) ? 2 : 1;
|
||||
|
||||
|
@ -278,7 +278,8 @@ public:
|
||||
inline vtkm::Int32 GetCellIndices(vtkm::Id cellIndices[8], const vtkm::Id& cellId) const
|
||||
{
|
||||
const vtkm::Int32 shapeId = static_cast<vtkm::Int32>(ShapesPortal.Get(cellId));
|
||||
const vtkm::Int32 numIndices = FaceLookUp[CellTypeLookUp[shapeId]][2];
|
||||
const vtkm::Int32 numIndices =
|
||||
CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[shapeId]][2];
|
||||
BOUNDS_CHECK(CellOffsetsPortal, cellId);
|
||||
const vtkm::Id cellOffset = CellOffsetsPortal.Get(cellId);
|
||||
|
||||
@ -367,7 +368,7 @@ public:
|
||||
Cellset.GetShapesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
|
||||
|
||||
ShapeId = shapes.GetPortalConstControl().Get(0);
|
||||
NumIndices = FaceLookUp[CellTypeLookUp[ShapeId]][2];
|
||||
NumIndices = CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[ShapeId]][2];
|
||||
|
||||
if (NumIndices == 0)
|
||||
{
|
||||
@ -377,7 +378,7 @@ public:
|
||||
throw vtkm::cont::ErrorBadValue(message.str());
|
||||
}
|
||||
vtkm::Id start = 0;
|
||||
NumFaces = FaceLookUp[CellTypeLookUp[ShapeId]][1];
|
||||
NumFaces = CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[ShapeId]][1];
|
||||
vtkm::Id numCells = CellConnectivity.GetPortalConstControl().GetNumberOfValues();
|
||||
CellOffsets = vtkm::cont::make_ArrayHandleCounting<vtkm::Id>(start, NumIndices, numCells);
|
||||
|
||||
|
@ -172,30 +172,26 @@ public:
|
||||
{
|
||||
vtkm::Int32 faceCount;
|
||||
vtkm::Int32 tableOffset;
|
||||
// suppress some unused variables warnings
|
||||
(void)(CellTypeLookUp);
|
||||
(void)(ZooTable);
|
||||
(void)(ZooLookUp);
|
||||
|
||||
if (cellShape.Id == vtkm::CELL_SHAPE_TETRA)
|
||||
{
|
||||
faceCount = FaceLookUp[1][1];
|
||||
tableOffset = FaceLookUp[1][0];
|
||||
faceCount = CellTables::Get().FaceLookUp[1][1];
|
||||
tableOffset = CellTables::Get().FaceLookUp[1][0];
|
||||
}
|
||||
else if (cellShape.Id == vtkm::CELL_SHAPE_HEXAHEDRON)
|
||||
{
|
||||
faceCount = FaceLookUp[0][1];
|
||||
tableOffset = FaceLookUp[0][0];
|
||||
faceCount = CellTables::Get().FaceLookUp[0][1];
|
||||
tableOffset = CellTables::Get().FaceLookUp[0][0];
|
||||
}
|
||||
else if (cellShape.Id == vtkm::CELL_SHAPE_WEDGE)
|
||||
{
|
||||
faceCount = FaceLookUp[2][1];
|
||||
tableOffset = FaceLookUp[2][0];
|
||||
faceCount = CellTables::Get().FaceLookUp[2][1];
|
||||
tableOffset = CellTables::Get().FaceLookUp[2][0];
|
||||
}
|
||||
else if (cellShape.Id == vtkm::CELL_SHAPE_PYRAMID)
|
||||
{
|
||||
faceCount = FaceLookUp[3][1];
|
||||
tableOffset = FaceLookUp[3][0];
|
||||
faceCount = CellTables::Get().FaceLookUp[3][1];
|
||||
tableOffset = CellTables::Get().FaceLookUp[3][0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -218,11 +214,11 @@ public:
|
||||
// we currently check for.
|
||||
vtkm::Vec<vtkm::Id, 4> faceIndices;
|
||||
faceIndices[3] = -1;
|
||||
const vtkm::Id indiceCount =
|
||||
ShapesFaceList[tableOffset + i][0]; //Number of indices this face has
|
||||
//Number of indices this face has
|
||||
const vtkm::Id indiceCount = CellTables::Get().ShapesFaceList[tableOffset + i][0];
|
||||
for (vtkm::Int32 j = 1; j <= indiceCount; j++)
|
||||
{
|
||||
faceIndices[j - 1] = cellIndices[ShapesFaceList[tableOffset + i][j]];
|
||||
faceIndices[j - 1] = cellIndices[CellTables::Get().ShapesFaceList[tableOffset + i][j]];
|
||||
}
|
||||
//sort the indices in descending order
|
||||
Sort4(faceIndices);
|
||||
|
@ -38,8 +38,11 @@ namespace raytracing
|
||||
|
||||
namespace
|
||||
{
|
||||
VTKM_EXEC_CONSTANT static vtkm::Int32 END_FLAG2 = -1000000000;
|
||||
VTKM_EXEC_CONSTANT static vtkm::Float32 EPSILON2 = 0.0001f;
|
||||
|
||||
enum : vtkm::Int32
|
||||
{
|
||||
END_FLAG2 = -1000000000
|
||||
};
|
||||
}
|
||||
|
||||
template <typename TriIntersector>
|
||||
@ -99,6 +102,8 @@ public:
|
||||
const Precision& originY,
|
||||
const Precision& originZ) const
|
||||
{
|
||||
const vtkm::Float32 EPSILON2 = 0.0001f;
|
||||
|
||||
vtkm::Vec<Precision, 3> e1 = b - a;
|
||||
vtkm::Vec<Precision, 3> e2 = c - a;
|
||||
|
||||
@ -774,7 +779,7 @@ public:
|
||||
|
||||
vtkm::Int32 todo[64];
|
||||
vtkm::Int32 stackptr = 0;
|
||||
vtkm::Int32 barrier = (vtkm::Int32)END_FLAG2;
|
||||
vtkm::Int32 barrier = END_FLAG2;
|
||||
currentNode = 0;
|
||||
|
||||
todo[stackptr] = barrier;
|
||||
@ -923,7 +928,7 @@ public:
|
||||
|
||||
vtkm::Int32 todo[64];
|
||||
vtkm::Int32 stackptr = 0;
|
||||
vtkm::Int32 barrier = (vtkm::Int32)END_FLAG2;
|
||||
vtkm::Int32 barrier = END_FLAG2;
|
||||
currentNode = 0;
|
||||
|
||||
todo[stackptr] = barrier;
|
||||
|
@ -103,14 +103,15 @@ void Render(const vtkm::cont::DataSet& ds,
|
||||
{
|
||||
MapperType mapper;
|
||||
CanvasType canvas(512, 512);
|
||||
canvas.SetBackgroundColor(vtkm::rendering::Color::white);
|
||||
vtkm::rendering::Scene scene;
|
||||
|
||||
scene.AddActor(vtkm::rendering::Actor(
|
||||
ds.GetCellSet(), ds.GetCoordinateSystem(), ds.GetField(fieldNm), colorTable));
|
||||
vtkm::rendering::Camera camera;
|
||||
SetCamera<ViewType>(camera, ds.GetCoordinateSystem().GetBounds(), ds.GetField(fieldNm));
|
||||
ViewType view(scene, mapper, canvas, camera, vtkm::rendering::Color(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
vtkm::rendering::Color background(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
vtkm::rendering::Color foreground(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
ViewType view(scene, mapper, canvas, camera, background, foreground);
|
||||
|
||||
// Print the title
|
||||
vtkm::rendering::TextAnnotationScreen* titleAnnotation =
|
||||
@ -142,7 +143,10 @@ void Render(const vtkm::cont::DataSet& ds,
|
||||
}
|
||||
vtkm::rendering::Camera camera;
|
||||
SetCamera<ViewType>(camera, ds.GetCoordinateSystem().GetBounds(), ds.GetField(fields[0]));
|
||||
ViewType view(scene, mapper, canvas, camera, vtkm::rendering::Color(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
|
||||
vtkm::rendering::Color background(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
vtkm::rendering::Color foreground(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
ViewType view(scene, mapper, canvas, camera, background, foreground);
|
||||
|
||||
// Print the title
|
||||
vtkm::rendering::TextAnnotationScreen* titleAnnotation =
|
||||
@ -164,7 +168,6 @@ void Render(const vtkm::cont::DataSet& ds,
|
||||
{
|
||||
MapperType mapper;
|
||||
CanvasType canvas(512, 512);
|
||||
canvas.SetBackgroundColor(vtkm::rendering::Color::white);
|
||||
vtkm::rendering::Scene scene;
|
||||
|
||||
//DRP Actor? no field? no colortable (or a constant colortable) ??
|
||||
@ -172,14 +175,15 @@ void Render(const vtkm::cont::DataSet& ds,
|
||||
vtkm::rendering::Actor(ds.GetCellSet(), ds.GetCoordinateSystem(), ds.GetField(fieldNm), color));
|
||||
vtkm::rendering::Camera camera;
|
||||
SetCamera<ViewType>(camera, ds.GetCoordinateSystem().GetBounds(), ds.GetField(fieldNm));
|
||||
ViewType view(scene, mapper, canvas, camera, vtkm::rendering::Color(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
|
||||
vtkm::rendering::Color background(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
vtkm::rendering::Color foreground(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
ViewType view(scene, mapper, canvas, camera, background, foreground);
|
||||
// Print the title
|
||||
vtkm::rendering::TextAnnotationScreen* titleAnnotation =
|
||||
new vtkm::rendering::TextAnnotationScreen("1D Test Plot",
|
||||
vtkm::rendering::Color(1, 1, 1, 1),
|
||||
.1f,
|
||||
vtkm::Vec<vtkm::Float32, 2>(-.27f, .87f),
|
||||
0.f);
|
||||
new vtkm::rendering::TextAnnotationScreen(
|
||||
"1D Test Plot", foreground, .1f, vtkm::Vec<vtkm::Float32, 2>(-.27f, .87f), 0.f);
|
||||
view.AddAnnotation(titleAnnotation);
|
||||
view.SetLogY(logY);
|
||||
Render<MapperType, CanvasType, ViewType>(view, outputFile);
|
||||
|
@ -107,14 +107,14 @@ void RenderTests()
|
||||
typedef vtkm::rendering::View1D V1;
|
||||
|
||||
vtkm::cont::testing::MakeTestDataSet maker;
|
||||
vtkm::rendering::ColorTable colorTable("thermal");
|
||||
vtkm::rendering::ColorTable colorTable("OrRd");
|
||||
|
||||
//vtkm::rendering::testing::Render<M, C, V3>(
|
||||
// maker.Make3DRegularDataSet0(), "pointvar", colorTable, "reg3D.pnm");
|
||||
//vtkm::rendering::testing::Render<M, C, V3>(
|
||||
// maker.Make3DRectilinearDataSet0(), "pointvar", colorTable, "rect3D.pnm");
|
||||
//vtkm::rendering::testing::Render<M, C, V3>(
|
||||
// maker.Make3DExplicitDataSet4(), "pointvar", colorTable, "expl3D.pnm");
|
||||
vtkm::rendering::testing::Render<M, C, V3>(
|
||||
maker.Make3DRegularDataSet0(), "pointvar", colorTable, "reg3D.pnm");
|
||||
vtkm::rendering::testing::Render<M, C, V3>(
|
||||
maker.Make3DRectilinearDataSet0(), "pointvar", colorTable, "rect3D.pnm");
|
||||
vtkm::rendering::testing::Render<M, C, V3>(
|
||||
maker.Make3DExplicitDataSet4(), "pointvar", colorTable, "expl3D.pnm");
|
||||
vtkm::rendering::testing::Render<M, C, V3>(
|
||||
Make3DUniformDataSet(), "pointvar", colorTable, "uniform3D.pnm");
|
||||
vtkm::rendering::testing::Render<M, C, V2>(
|
||||
@ -130,6 +130,10 @@ void RenderTests()
|
||||
colors.push_back(vtkm::rendering::Color(0.f, 1.f, 0.f));
|
||||
vtkm::rendering::testing::Render<M, C, V1>(
|
||||
maker.Make1DUniformDataSet0(), fields, colors, "lines1D.pnm");
|
||||
//test log y
|
||||
vtkm::rendering::Color red = vtkm::rendering::Color::red;
|
||||
vtkm::rendering::testing::Render<M, C, V1>(
|
||||
maker.Make1DUniformDataSet1(), "pointvar", red, "linesLogY1D.pnm", true);
|
||||
}
|
||||
|
||||
} //namespace
|
||||
|
@ -43,56 +43,88 @@
|
||||
namespace UnitTestMathNamespace
|
||||
{
|
||||
|
||||
const vtkm::IdComponent NUM_NUMBERS = 5;
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 NumberList[NUM_NUMBERS] = { 0.25, 0.5, 1.0, 2.0, 3.75 };
|
||||
class Lists
|
||||
{
|
||||
public:
|
||||
static const vtkm::IdComponent NUM_NUMBERS = 5;
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 AngleList[NUM_NUMBERS] = { 0.643501108793284, // angle for 3, 4, 5 triangle.
|
||||
0.78539816339745, // pi/4
|
||||
0.5235987755983, // pi/6
|
||||
1.0471975511966, // pi/3
|
||||
0.0 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 OppositeList[NUM_NUMBERS] = { 3.0,
|
||||
1.0,
|
||||
1.0,
|
||||
1.732050807568877 /*sqrt(3)*/,
|
||||
0.0 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 AdjacentList[NUM_NUMBERS] = { 4.0,
|
||||
1.0,
|
||||
1.732050807568877 /*sqrt(3)*/,
|
||||
1.0,
|
||||
1.0 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 HypotenuseList[NUM_NUMBERS] = { 5.0,
|
||||
1.414213562373095 /*sqrt(2)*/,
|
||||
2.0,
|
||||
2.0,
|
||||
1.0 };
|
||||
private:
|
||||
struct Data
|
||||
{
|
||||
vtkm::Float64 NumberList[NUM_NUMBERS];
|
||||
vtkm::Float64 AngleList[NUM_NUMBERS];
|
||||
vtkm::Float64 OppositeList[NUM_NUMBERS];
|
||||
vtkm::Float64 AdjacentList[NUM_NUMBERS];
|
||||
vtkm::Float64 HypotenuseList[NUM_NUMBERS];
|
||||
vtkm::Float64 NumeratorList[NUM_NUMBERS];
|
||||
vtkm::Float64 DenominatorList[NUM_NUMBERS];
|
||||
vtkm::Float64 FModRemainderList[NUM_NUMBERS];
|
||||
vtkm::Float64 RemainderList[NUM_NUMBERS];
|
||||
vtkm::Int64 QuotientList[NUM_NUMBERS];
|
||||
vtkm::Float64 XList[NUM_NUMBERS];
|
||||
vtkm::Float64 FractionalList[NUM_NUMBERS];
|
||||
vtkm::Float64 FloorList[NUM_NUMBERS];
|
||||
vtkm::Float64 CeilList[NUM_NUMBERS];
|
||||
vtkm::Float64 RoundList[NUM_NUMBERS];
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 NumeratorList[NUM_NUMBERS] = { 6.5, 5.8, 9.3, 77.0, 0.1 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 DenominatorList[NUM_NUMBERS] = { 2.3, 1.6, 3.1, 19.0, 0.4 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 FModRemainderList[NUM_NUMBERS] = { 1.9, 1.0, 0.0, 1.0, 0.1 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 RemainderList[NUM_NUMBERS] = { -0.4, -0.6, 0.0, 1.0, 0.1 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Int64 QuotientList[NUM_NUMBERS] = { 3, 4, 3, 4, 0 };
|
||||
public:
|
||||
VTKM_EXEC_CONT static const Data& Get()
|
||||
{
|
||||
static const Data data = {
|
||||
// NumberList
|
||||
{ 0.25, 0.5, 1.0, 2.0, 3.75 },
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 XList[NUM_NUMBERS] = { 4.6, 0.1, 73.4, 55.0, 3.75 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 FractionalList[NUM_NUMBERS] = { 0.6, 0.1, 0.4, 0.0, 0.75 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 FloorList[NUM_NUMBERS] = { 4.0, 0.0, 73.0, 55.0, 3.0 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 CeilList[NUM_NUMBERS] = { 5.0, 1.0, 74.0, 55.0, 4.0 };
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::Float64 RoundList[NUM_NUMBERS] = { 5.0, 0.0, 73.0, 55.0, 4.0 };
|
||||
// AngleList
|
||||
{ 0.643501108793284, // angle for 3, 4, 5 triangle.
|
||||
0.78539816339745, // pi/4
|
||||
0.5235987755983, // pi/6
|
||||
1.0471975511966, // pi/3
|
||||
0.0 },
|
||||
|
||||
// OppositeList
|
||||
{ 3.0, 1.0, 1.0, 1.732050807568877 /*sqrt(3)*/, 0.0 },
|
||||
|
||||
// AdjacentList
|
||||
{ 4.0, 1.0, 1.732050807568877 /*sqrt(3)*/, 1.0, 1.0 },
|
||||
|
||||
// HypotenuseList
|
||||
{ 5.0, 1.414213562373095 /*sqrt(2)*/, 2.0, 2.0, 1.0 },
|
||||
|
||||
// NumeratorList
|
||||
{ 6.5, 5.8, 9.3, 77.0, 0.1 },
|
||||
|
||||
// DenominatorList
|
||||
{ 2.3, 1.6, 3.1, 19.0, 0.4 },
|
||||
|
||||
// FModRemainderList
|
||||
{ 1.9, 1.0, 0.0, 1.0, 0.1 },
|
||||
|
||||
// RemainderList
|
||||
{ -0.4, -0.6, 0.0, 1.0, 0.1 },
|
||||
|
||||
// QuotientList
|
||||
{ 3, 4, 3, 4, 0 },
|
||||
|
||||
// XList
|
||||
{ 4.6, 0.1, 73.4, 55.0, 3.75 },
|
||||
|
||||
// FractionalList
|
||||
{ 0.6, 0.1, 0.4, 0.0, 0.75 },
|
||||
|
||||
// FloorList
|
||||
{ 4.0, 0.0, 73.0, 55.0, 3.0 },
|
||||
|
||||
// CeilList
|
||||
{ 5.0, 1.0, 74.0, 55.0, 4.0 },
|
||||
|
||||
// RoundList
|
||||
{ 5.0, 0.0, 73.0, 55.0, 4.0 },
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
@ -130,9 +162,9 @@ struct ScalarFieldTests : public vtkm::exec::FunctorBase
|
||||
void TestPow() const
|
||||
{
|
||||
// std::cout << "Running power tests." << std::endl;
|
||||
for (vtkm::IdComponent index = 0; index < NUM_NUMBERS; index++)
|
||||
for (vtkm::IdComponent index = 0; index < Lists::NUM_NUMBERS; index++)
|
||||
{
|
||||
T x = static_cast<T>(NumberList[index]);
|
||||
T x = static_cast<T>(Lists::Get().NumberList[index]);
|
||||
T powx = vtkm::Pow(x, static_cast<T>(2.0));
|
||||
T sqrx = x * x;
|
||||
VTKM_MATH_ASSERT(test_equal(powx, sqrx), "Power gave wrong result.");
|
||||
@ -206,13 +238,13 @@ struct ScalarFieldTests : public vtkm::exec::FunctorBase
|
||||
void TestRemainders() const
|
||||
{
|
||||
// std::cout << "Testing remainders." << std::endl;
|
||||
for (vtkm::IdComponent index = 0; index < NUM_NUMBERS; index++)
|
||||
for (vtkm::IdComponent index = 0; index < Lists::NUM_NUMBERS; index++)
|
||||
{
|
||||
T numerator = static_cast<T>(NumeratorList[index]);
|
||||
T denominator = static_cast<T>(DenominatorList[index]);
|
||||
T fmodremainder = static_cast<T>(FModRemainderList[index]);
|
||||
T remainder = static_cast<T>(RemainderList[index]);
|
||||
vtkm::Int64 quotient = QuotientList[index];
|
||||
T numerator = static_cast<T>(Lists::Get().NumeratorList[index]);
|
||||
T denominator = static_cast<T>(Lists::Get().DenominatorList[index]);
|
||||
T fmodremainder = static_cast<T>(Lists::Get().FModRemainderList[index]);
|
||||
T remainder = static_cast<T>(Lists::Get().RemainderList[index]);
|
||||
vtkm::Int64 quotient = Lists::Get().QuotientList[index];
|
||||
|
||||
VTKM_MATH_ASSERT(test_equal(vtkm::FMod(numerator, denominator), fmodremainder),
|
||||
"Bad FMod remainder.");
|
||||
@ -229,13 +261,13 @@ struct ScalarFieldTests : public vtkm::exec::FunctorBase
|
||||
void TestRound() const
|
||||
{
|
||||
// std::cout << "Testing round." << std::endl;
|
||||
for (vtkm::IdComponent index = 0; index < NUM_NUMBERS; index++)
|
||||
for (vtkm::IdComponent index = 0; index < Lists::NUM_NUMBERS; index++)
|
||||
{
|
||||
T x = static_cast<T>(XList[index]);
|
||||
T fractional = static_cast<T>(FractionalList[index]);
|
||||
T floor = static_cast<T>(FloorList[index]);
|
||||
T ceil = static_cast<T>(CeilList[index]);
|
||||
T round = static_cast<T>(RoundList[index]);
|
||||
T x = static_cast<T>(Lists::Get().XList[index]);
|
||||
T fractional = static_cast<T>(Lists::Get().FractionalList[index]);
|
||||
T floor = static_cast<T>(Lists::Get().FloorList[index]);
|
||||
T ceil = static_cast<T>(Lists::Get().CeilList[index]);
|
||||
T round = static_cast<T>(Lists::Get().RoundList[index]);
|
||||
|
||||
T intPart;
|
||||
VTKM_MATH_ASSERT(test_equal(vtkm::ModF(x, intPart), fractional),
|
||||
@ -312,7 +344,7 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase
|
||||
{
|
||||
// std::cout << "Testing normal trig functions." << std::endl;
|
||||
|
||||
for (vtkm::IdComponent index = 0; index < NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
for (vtkm::IdComponent index = 0; index < Lists::NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
{
|
||||
VectorType angle;
|
||||
VectorType opposite;
|
||||
@ -321,16 +353,21 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase
|
||||
for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; componentIndex++)
|
||||
{
|
||||
Traits::SetComponent(
|
||||
angle, componentIndex, static_cast<ComponentType>(AngleList[componentIndex + index]));
|
||||
Traits::SetComponent(opposite,
|
||||
componentIndex,
|
||||
static_cast<ComponentType>(OppositeList[componentIndex + index]));
|
||||
Traits::SetComponent(adjacent,
|
||||
componentIndex,
|
||||
static_cast<ComponentType>(AdjacentList[componentIndex + index]));
|
||||
Traits::SetComponent(hypotenuse,
|
||||
componentIndex,
|
||||
static_cast<ComponentType>(HypotenuseList[componentIndex + index]));
|
||||
angle,
|
||||
componentIndex,
|
||||
static_cast<ComponentType>(Lists::Get().AngleList[componentIndex + index]));
|
||||
Traits::SetComponent(
|
||||
opposite,
|
||||
componentIndex,
|
||||
static_cast<ComponentType>(Lists::Get().OppositeList[componentIndex + index]));
|
||||
Traits::SetComponent(
|
||||
adjacent,
|
||||
componentIndex,
|
||||
static_cast<ComponentType>(Lists::Get().AdjacentList[componentIndex + index]));
|
||||
Traits::SetComponent(
|
||||
hypotenuse,
|
||||
componentIndex,
|
||||
static_cast<ComponentType>(Lists::Get().HypotenuseList[componentIndex + index]));
|
||||
}
|
||||
|
||||
VTKM_MATH_ASSERT(test_equal(vtkm::Sin(angle), opposite / hypotenuse), "Sin failed test.");
|
||||
@ -364,13 +401,15 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase
|
||||
const VectorType zero(0);
|
||||
const VectorType half(0.5);
|
||||
|
||||
for (vtkm::IdComponent index = 0; index < NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
for (vtkm::IdComponent index = 0; index < Lists::NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
{
|
||||
VectorType x;
|
||||
for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; componentIndex++)
|
||||
{
|
||||
Traits::SetComponent(
|
||||
x, componentIndex, static_cast<ComponentType>(AngleList[componentIndex + index]));
|
||||
x,
|
||||
componentIndex,
|
||||
static_cast<ComponentType>(Lists::Get().AngleList[componentIndex + index]));
|
||||
}
|
||||
|
||||
const VectorType minusX = zero - x;
|
||||
@ -391,13 +430,14 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase
|
||||
template <typename FunctionType>
|
||||
VTKM_EXEC void RaiseToTest(FunctionType function, ComponentType exponent) const
|
||||
{
|
||||
for (vtkm::IdComponent index = 0; index < NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
for (vtkm::IdComponent index = 0; index < Lists::NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
{
|
||||
VectorType original;
|
||||
VectorType raiseresult;
|
||||
for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; componentIndex++)
|
||||
{
|
||||
ComponentType x = static_cast<ComponentType>(NumberList[componentIndex + index]);
|
||||
ComponentType x =
|
||||
static_cast<ComponentType>(Lists::Get().NumberList[componentIndex + index]);
|
||||
Traits::SetComponent(original, componentIndex, x);
|
||||
Traits::SetComponent(raiseresult, componentIndex, vtkm::Pow(x, exponent));
|
||||
}
|
||||
@ -462,13 +502,14 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase
|
||||
ComponentType exponentbias = 0.0,
|
||||
ComponentType resultbias = 0.0) const
|
||||
{
|
||||
for (vtkm::IdComponent index = 0; index < NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
for (vtkm::IdComponent index = 0; index < Lists::NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
{
|
||||
VectorType original;
|
||||
VectorType raiseresult;
|
||||
for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; componentIndex++)
|
||||
{
|
||||
ComponentType x = static_cast<ComponentType>(NumberList[componentIndex + index]);
|
||||
ComponentType x =
|
||||
static_cast<ComponentType>(Lists::Get().NumberList[componentIndex + index]);
|
||||
Traits::SetComponent(original, componentIndex, x);
|
||||
Traits::SetComponent(
|
||||
raiseresult, componentIndex, vtkm::Pow(base, x + exponentbias) + resultbias);
|
||||
@ -533,14 +574,15 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase
|
||||
ComponentType base,
|
||||
ComponentType bias = 0.0) const
|
||||
{
|
||||
for (vtkm::IdComponent index = 0; index < NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
for (vtkm::IdComponent index = 0; index < Lists::NUM_NUMBERS - NUM_COMPONENTS + 1; index++)
|
||||
{
|
||||
VectorType basevector(base);
|
||||
VectorType original;
|
||||
VectorType biased;
|
||||
for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; componentIndex++)
|
||||
{
|
||||
ComponentType x = static_cast<ComponentType>(NumberList[componentIndex + index]);
|
||||
ComponentType x =
|
||||
static_cast<ComponentType>(Lists::Get().NumberList[componentIndex + index]);
|
||||
Traits::SetComponent(original, componentIndex, x);
|
||||
Traits::SetComponent(biased, componentIndex, x + bias);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(CellSetIn cellset,
|
||||
FieldInTo<Scalar> scalars,
|
||||
FieldInTo<ScalarAll> scalars,
|
||||
FieldOut<BoolType> passFlags);
|
||||
|
||||
typedef _3 ExecutionSignature(_2);
|
||||
|
@ -38,6 +38,7 @@ set(headers
|
||||
MarkActiveNeighbors.h
|
||||
PointerJump.h
|
||||
SetCandidateParticles.h
|
||||
TagTypes.h
|
||||
ValidHalo.h
|
||||
)
|
||||
|
||||
|
@ -63,6 +63,7 @@
|
||||
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/cosmotools/TagTypes.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -76,19 +77,15 @@ template <typename T>
|
||||
class GraftParticles : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
struct TagType : vtkm::ListTagBase<T>
|
||||
{
|
||||
};
|
||||
|
||||
typedef void ControlSignature(
|
||||
FieldIn<IdType> index, // (input) index into particles
|
||||
FieldIn<IdType> partId, // (input) particle id sorted by bin
|
||||
FieldIn<IdType> binId, // (input) bin id sorted by bin
|
||||
FieldIn<vtkm::UInt32> activeFlag, // (input) flag indicates which of neighbor ranges are used
|
||||
WholeArrayIn<IdType> partIdArray, // (input) particle id sorted by bin entire array
|
||||
WholeArrayIn<TagType> location, // (input) location of particles
|
||||
WholeArrayIn<IdType> firstParticleId, // (input) first particle index vector
|
||||
WholeArrayIn<IdType> lastParticleId, // (input) last particle index vector
|
||||
FieldIn<IdType> index, // (input) index into particles
|
||||
FieldIn<IdType> partId, // (input) particle id sorted by bin
|
||||
FieldIn<IdType> binId, // (input) bin id sorted by bin
|
||||
FieldIn<UInt32TagType> activeFlag, // (input) flag indicates which of neighbor ranges are used
|
||||
WholeArrayIn<IdType> partIdArray, // (input) particle id sorted by bin entire array
|
||||
WholeArrayIn<Vec3TagType<T>> location, // (input) location of particles
|
||||
WholeArrayIn<IdType> firstParticleId, // (input) first particle index vector
|
||||
WholeArrayIn<IdType> lastParticleId, // (input) last particle index vector
|
||||
WholeArrayOut<IdType> haloId);
|
||||
typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8, _9);
|
||||
typedef _1 InputDomain;
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
typedef void ControlSignature(FieldIn<IdType> index,
|
||||
WholeArrayInOut<IdType> haloIdCurrent,
|
||||
WholeArrayInOut<IdType> haloIdLast,
|
||||
WholeArrayInOut<bool> rootedStar);
|
||||
WholeArrayInOut<> rootedStar);
|
||||
typedef void ExecutionSignature(_1, _2, _3, _4);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
|
@ -63,6 +63,7 @@
|
||||
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/cosmotools/TagTypes.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -70,26 +71,21 @@ namespace worklet
|
||||
{
|
||||
namespace cosmotools
|
||||
{
|
||||
|
||||
// Worklet for particles to indicate which neighbors are active
|
||||
// because at least one particle in that bin is within linking length
|
||||
template <typename T>
|
||||
class MarkActiveNeighbors : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
struct TagType : vtkm::ListTagBase<T>
|
||||
{
|
||||
};
|
||||
|
||||
typedef void ControlSignature(
|
||||
FieldIn<IdType> index, // (input) particle index
|
||||
FieldIn<IdType> partId, // (input) particle id sorted
|
||||
FieldIn<IdType> binId, // (input) bin Id per particle
|
||||
WholeArrayIn<IdType> partIdArray, // (input) sequence imposed on sorted particle Ids
|
||||
WholeArrayIn<TagType> location, // (input) location of particles
|
||||
WholeArrayIn<IdType> firstPartId, // (input) vector of first particle indices
|
||||
WholeArrayIn<IdType> lastPartId, // (input) vector of last particle indices
|
||||
FieldOut<vtkm::UInt32> flag); // (output) active bin neighbors mask
|
||||
FieldIn<IdType> index, // (input) particle index
|
||||
FieldIn<IdType> partId, // (input) particle id sorted
|
||||
FieldIn<IdType> binId, // (input) bin Id per particle
|
||||
WholeArrayIn<IdType> partIdArray, // (input) sequence imposed on sorted particle Ids
|
||||
WholeArrayIn<Vec3TagType<T>> location, // (input) location of particles
|
||||
WholeArrayIn<IdType> firstPartId, // (input) vector of first particle indices
|
||||
WholeArrayIn<IdType> lastPartId, // (input) vector of last particle indices
|
||||
FieldOut<UInt32TagType> flag); // (output) active bin neighbors mask
|
||||
typedef _8 ExecutionSignature(_1, _2, _3, _4, _5, _6, _7);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
|
83
vtkm/worklet/cosmotools/TagTypes.h
Normal file
83
vtkm/worklet/cosmotools/TagTypes.h
Normal file
@ -0,0 +1,83 @@
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
||||
// Copyright 2014 UT-Battelle, LLC.
|
||||
// Copyright 2014 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-NA0003525 with NTESS,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
// Copyright (c) 2016, Los Alamos National Security, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Copyright 2016. Los Alamos National Security, LLC.
|
||||
// This software was produced under U.S. Government contract DE-AC52-06NA25396
|
||||
// for Los Alamos National Laboratory (LANL), which is operated by
|
||||
// Los Alamos National Security, LLC for the U.S. Department of Energy.
|
||||
// The U.S. Government has rights to use, reproduce, and distribute this
|
||||
// software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC
|
||||
// MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE
|
||||
// USE OF THIS SOFTWARE. If software is modified to produce derivative works,
|
||||
// such modified software should be clearly marked, so as not to confuse it
|
||||
// with the version available from LANL.
|
||||
//
|
||||
// Additionally, redistribution and use in source and binary forms, with or
|
||||
// without modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// 3. Neither the name of Los Alamos National Security, LLC, Los Alamos
|
||||
// National Laboratory, LANL, the U.S. Government, nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND
|
||||
// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS
|
||||
// NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtkm_worklet_cosmotools_graft_tagtypes_h
|
||||
#define vtkm_worklet_cosmotools_graft_tagtypes_h
|
||||
|
||||
#include <vtkm/TypeListTag.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace worklet
|
||||
{
|
||||
namespace cosmotools
|
||||
{
|
||||
|
||||
struct UInt32TagType : vtkm::ListTagBase<vtkm::UInt32>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Vec3TagType : vtkm::ListTagBase<vtkm::Vec<T, 3>>
|
||||
{
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -19456,26 +19456,6 @@ static vtkm::UInt8 CellEdges[CELL_EDGES_SIZE] = {
|
||||
};
|
||||
#undef X
|
||||
|
||||
// index into ClipTablesIndices for each shape
|
||||
VTKM_EXEC_CONSTANT
|
||||
static vtkm::Int16 CellIndexLookup[vtkm::NUMBER_OF_CELL_SHAPES] = {
|
||||
-1, // 0 = vtkm::CELL_SHAPE_EMPTY_CELL
|
||||
0, // 1 = vtkm::CELL_SHAPE_VERTEX
|
||||
-1, // 2 = vtkm::CELL_SHAPE_POLY_VERTEX
|
||||
2, // 3 = vtkm::CELL_SHAPE_LINE
|
||||
-1, // 4 = vtkm::CELL_SHAPE_POLY_LINE
|
||||
6, // 5 = vtkm::CELL_SHAPE_TRIANGLE
|
||||
-1, // 6 = vtkm::CELL_SHAPE_TRIANGLE_STRIP
|
||||
-1, // 7 = vtkm::CELL_SHAPE_POLYGON
|
||||
-1, // 8 = vtkm::CELL_SHAPE_PIXEL
|
||||
14, // 9 = vtkm::CELL_SHAPE_QUAD
|
||||
30, // 10 = vtkm::CELL_SHAPE_TETRA
|
||||
-1, // 11 = vtkm::CELL_SHAPE_VOXEL
|
||||
46, // 12 = vtkm::CELL_SHAPE_HEXAHEDRON
|
||||
302, // 13 = vtkm::CELL_SHAPE_WEDGE
|
||||
366 // 14 = vtkm::CELL_SHAPE_PYRAMID
|
||||
};
|
||||
|
||||
class ClipTables
|
||||
{
|
||||
public:
|
||||
@ -19488,6 +19468,25 @@ public:
|
||||
VTKM_EXEC
|
||||
vtkm::Id GetCaseIndex(vtkm::Id shape, vtkm::Id caseId) const
|
||||
{
|
||||
// index into ClipTablesIndices for each shape
|
||||
static vtkm::Int16 CellIndexLookup[vtkm::NUMBER_OF_CELL_SHAPES] = {
|
||||
-1, // 0 = vtkm::CELL_SHAPE_EMPTY_CELL
|
||||
0, // 1 = vtkm::CELL_SHAPE_VERTEX
|
||||
-1, // 2 = vtkm::CELL_SHAPE_POLY_VERTEX
|
||||
2, // 3 = vtkm::CELL_SHAPE_LINE
|
||||
-1, // 4 = vtkm::CELL_SHAPE_POLY_LINE
|
||||
6, // 5 = vtkm::CELL_SHAPE_TRIANGLE
|
||||
-1, // 6 = vtkm::CELL_SHAPE_TRIANGLE_STRIP
|
||||
-1, // 7 = vtkm::CELL_SHAPE_POLYGON
|
||||
-1, // 8 = vtkm::CELL_SHAPE_PIXEL
|
||||
14, // 9 = vtkm::CELL_SHAPE_QUAD
|
||||
30, // 10 = vtkm::CELL_SHAPE_TETRA
|
||||
-1, // 11 = vtkm::CELL_SHAPE_VOXEL
|
||||
46, // 12 = vtkm::CELL_SHAPE_HEXAHEDRON
|
||||
302, // 13 = vtkm::CELL_SHAPE_WEDGE
|
||||
366 // 14 = vtkm::CELL_SHAPE_PYRAMID
|
||||
};
|
||||
|
||||
vtkm::Id index = CellIndexLookup[shape];
|
||||
return this->ClipTablesIndicesPortal.Get(index + caseId);
|
||||
}
|
||||
|
@ -36,18 +36,27 @@
|
||||
|
||||
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
|
||||
|
||||
#include <vtkm/internal/IntegerSequence.h>
|
||||
#include <vtkm/internal/brigand.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
// Forward declaration.
|
||||
template <typename CellSetList>
|
||||
class DynamicCellSetBase;
|
||||
}
|
||||
}
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace worklet
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
@ -59,10 +68,7 @@ namespace detail
|
||||
// these unsupported combinations we just silently halt the compiler from
|
||||
// attempting to create code for these errant conditions and throw a run-time
|
||||
// error if one every tries to create one.
|
||||
inline void PrintFailureMessage(int, std::true_type)
|
||||
{
|
||||
}
|
||||
inline void PrintFailureMessage(int index, std::false_type)
|
||||
inline void PrintFailureMessage(int index)
|
||||
{
|
||||
std::stringstream message;
|
||||
message << "Encountered bad type for parameter " << index
|
||||
@ -70,6 +76,14 @@ inline void PrintFailureMessage(int index, std::false_type)
|
||||
throw vtkm::cont::ErrorBadType(message.str());
|
||||
}
|
||||
|
||||
template <bool, typename T, typename TypeCheckTag>
|
||||
struct ParameterTypeCorrect;
|
||||
template <typename T, typename TypeCheckTag>
|
||||
struct ParameterTypeCorrect<true, T, TypeCheckTag>
|
||||
{
|
||||
static VTKM_CONSTEXPR bool value = true;
|
||||
};
|
||||
|
||||
// Is designed as a brigand fold operation.
|
||||
template <typename T, typename State>
|
||||
struct DetermineIfHasDynamicParameter
|
||||
@ -81,18 +95,22 @@ struct DetermineIfHasDynamicParameter
|
||||
using type = std::integral_constant<bool, (State::value || isDynamic::value)>;
|
||||
};
|
||||
|
||||
|
||||
// Is designed as a brigand fold operation.
|
||||
template <typename Index, typename Params, typename SigTypes>
|
||||
template <typename T, typename State, typename SigTypes>
|
||||
struct DetermineHasInCorrectParameters
|
||||
{
|
||||
using T = typename brigand::at_c<Params, Index::value>;
|
||||
using ControlSignatureTag = typename brigand::at_c<SigTypes, Index::value>;
|
||||
//T is the type of the Param at the current index
|
||||
//State if the index to use to fetch the control signature tag
|
||||
using ControlSignatureTag = typename brigand::at_c<SigTypes, State::value>;
|
||||
using TypeCheckTag = typename ControlSignatureTag::TypeCheckTag;
|
||||
|
||||
using type = std::integral_constant<bool, vtkm::cont::arg::TypeCheck<TypeCheckTag, T>::value>;
|
||||
using isCorrect =
|
||||
ParameterTypeCorrect<vtkm::cont::arg::TypeCheck<TypeCheckTag, T>::value, TypeCheckTag, T>;
|
||||
static_assert(isCorrect::value,
|
||||
"The type check failed since the parameter passed in doesn't pass the TypeCheck");
|
||||
|
||||
static_assert(type::value,
|
||||
"Unable to match 'ValueType' to the signature tag 'ControlSignatureTag'");
|
||||
using type = std::integral_constant<std::size_t, State::value + 1>;
|
||||
};
|
||||
|
||||
// Checks that an argument in a ControlSignature is a valid control signature
|
||||
@ -123,89 +141,6 @@ struct DispatcherBaseExecutionSignatureTagCheck
|
||||
};
|
||||
};
|
||||
|
||||
// Used in the dynamic cast to check to make sure that the type passed into
|
||||
// the Invoke method matches the type accepted by the ControlSignature.
|
||||
template <typename ContinueFunctor, typename TypeCheckTag, vtkm::IdComponent Index>
|
||||
struct DispatcherBaseTypeCheckFunctor
|
||||
{
|
||||
const ContinueFunctor& Continue;
|
||||
|
||||
VTKM_CONT
|
||||
DispatcherBaseTypeCheckFunctor(const ContinueFunctor& continueFunc)
|
||||
: Continue(continueFunc)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT void operator()(const T& x) const
|
||||
{
|
||||
typedef std::integral_constant<bool, vtkm::cont::arg::TypeCheck<TypeCheckTag, T>::value>
|
||||
CanContinueTagType;
|
||||
|
||||
vtkm::worklet::internal::detail::PrintFailureMessage(Index, CanContinueTagType());
|
||||
this->WillContinue(x, CanContinueTagType());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
VTKM_CONT void WillContinue(const T& x, std::true_type) const
|
||||
{
|
||||
this->Continue(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT void WillContinue(const T&, std::false_type) const
|
||||
{
|
||||
}
|
||||
|
||||
void operator=(const DispatcherBaseTypeCheckFunctor<ContinueFunctor, TypeCheckTag, Index>&) =
|
||||
delete;
|
||||
};
|
||||
|
||||
// Uses vtkm::cont::internal::DynamicTransform and the DynamicTransformCont
|
||||
// method of FunctionInterface to convert all DynamicArrayHandles and any
|
||||
// other arguments declaring themselves as dynamic to static versions.
|
||||
template <typename ControlInterface>
|
||||
struct DispatcherBaseDynamicTransform
|
||||
{
|
||||
vtkm::cont::internal::DynamicTransform BasicDynamicTransform;
|
||||
|
||||
template <typename InputType, typename ContinueFunctor, vtkm::IdComponent Index>
|
||||
VTKM_CONT void operator()(const InputType& input,
|
||||
const ContinueFunctor& continueFunc,
|
||||
const vtkm::internal::IndexTag<Index>& indexTag) const
|
||||
{
|
||||
typedef typename ControlInterface::template ParameterType<Index>::type ControlSignatureTag;
|
||||
|
||||
typedef DispatcherBaseTypeCheckFunctor<ContinueFunctor,
|
||||
typename ControlSignatureTag::TypeCheckTag,
|
||||
Index>
|
||||
TypeCheckFunctor;
|
||||
|
||||
this->BasicDynamicTransform(input, TypeCheckFunctor(continueFunc), indexTag);
|
||||
}
|
||||
};
|
||||
|
||||
// A functor called at the end of the dynamic transform to call the next
|
||||
// step in the dynamic transform.
|
||||
template <typename DispatcherBaseType>
|
||||
struct DispatcherBaseDynamicTransformHelper
|
||||
{
|
||||
const DispatcherBaseType* Dispatcher;
|
||||
|
||||
VTKM_CONT
|
||||
DispatcherBaseDynamicTransformHelper(const DispatcherBaseType* dispatcher)
|
||||
: Dispatcher(dispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename FunctionInterface>
|
||||
VTKM_CONT void operator()(const FunctionInterface& parameters) const
|
||||
{
|
||||
this->Dispatcher->DynamicTransformInvoke(parameters, std::true_type());
|
||||
}
|
||||
};
|
||||
|
||||
// A look up helper used by DispatcherBaseTransportFunctor to determine
|
||||
//the types independent of the device we are templated on.
|
||||
template <typename ControlInterface, vtkm::IdComponent Index>
|
||||
@ -276,6 +211,101 @@ private:
|
||||
void operator=(const DispatcherBaseTransportFunctor&) = delete;
|
||||
};
|
||||
|
||||
//forward declares
|
||||
template <std::size_t LeftToProcess>
|
||||
struct for_each_dynamic_arg;
|
||||
|
||||
template <std::size_t LeftToProcess, typename TypeCheckTag>
|
||||
struct convert_arg_wrapper
|
||||
{
|
||||
template <typename T, typename... Args>
|
||||
void operator()(T&& t, Args&&... args) const
|
||||
{
|
||||
using Type = typename std::decay<T>::type;
|
||||
using valid =
|
||||
std::integral_constant<bool, vtkm::cont::arg::TypeCheck<TypeCheckTag, Type>::value>;
|
||||
this->WillContinue(valid(), std::forward<T>(t), std::forward<Args>(args)...);
|
||||
}
|
||||
template <typename T, typename... Args>
|
||||
void WillContinue(std::true_type, T&& t, Args&&... args) const
|
||||
{
|
||||
for_each_dynamic_arg<LeftToProcess - 1>()(std::forward<Args>(args)..., std::forward<T>(t));
|
||||
}
|
||||
template <typename... Args>
|
||||
void WillContinue(std::false_type, Args&&...) const
|
||||
{
|
||||
vtkm::worklet::internal::detail::PrintFailureMessage(LeftToProcess);
|
||||
}
|
||||
};
|
||||
|
||||
template <std::size_t LeftToProcess,
|
||||
typename T,
|
||||
typename ContParams,
|
||||
typename Trampoline,
|
||||
typename... Args>
|
||||
inline void convert_arg(vtkm::cont::internal::DynamicTransformTagStatic,
|
||||
T&& t,
|
||||
const ContParams&,
|
||||
const Trampoline& trampoline,
|
||||
Args&&... args)
|
||||
{ //This is a static array, so just push it to the back
|
||||
using popped_sig = brigand::pop_front<ContParams>;
|
||||
for_each_dynamic_arg<LeftToProcess - 1>()(
|
||||
trampoline, popped_sig(), std::forward<Args>(args)..., std::forward<T>(t));
|
||||
}
|
||||
|
||||
template <std::size_t LeftToProcess,
|
||||
typename T,
|
||||
typename ContParams,
|
||||
typename Trampoline,
|
||||
typename... Args>
|
||||
inline void convert_arg(vtkm::cont::internal::DynamicTransformTagCastAndCall,
|
||||
T&& t,
|
||||
const ContParams&,
|
||||
const Trampoline& trampoline,
|
||||
Args&&... args)
|
||||
{ //This is something dynamic so cast and call
|
||||
using tag_check = typename brigand::at_c<ContParams, 0>::TypeCheckTag;
|
||||
using popped_sig = brigand::pop_front<ContParams>;
|
||||
|
||||
vtkm::cont::CastAndCall(t,
|
||||
convert_arg_wrapper<LeftToProcess, tag_check>(),
|
||||
trampoline,
|
||||
popped_sig(),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <std::size_t LeftToProcess>
|
||||
struct for_each_dynamic_arg
|
||||
{
|
||||
template <typename Trampoline, typename ContParams, typename T, typename... Args>
|
||||
void operator()(const Trampoline& trampoline, ContParams&& sig, T&& t, Args&&... args) const
|
||||
{
|
||||
//Determine that state of T
|
||||
using Type = typename std::decay<T>::type;
|
||||
using tag = typename vtkm::cont::internal::DynamicTransformTraits<Type>::DynamicTag;
|
||||
//convert the first item to a known type
|
||||
convert_arg<LeftToProcess>(
|
||||
tag(), std::forward<T>(t), sig, trampoline, std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct for_each_dynamic_arg<0>
|
||||
{
|
||||
template <typename Trampoline, typename ContParams, typename... Args>
|
||||
void operator()(const Trampoline& trampoline, ContParams&&, Args&&... args) const
|
||||
{
|
||||
trampoline.StartInvokeDynamic(std::false_type(), std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Trampoline, typename ContParams, typename... Args>
|
||||
inline void deduce(Trampoline&& trampoline, ContParams&& sig, Args&&... args)
|
||||
{
|
||||
for_each_dynamic_arg<sizeof...(Args)>()(std::forward<Trampoline>(trampoline), sig, args...);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// Base class for all dispatcher classes. Every worklet type should have its
|
||||
@ -287,7 +317,7 @@ class DispatcherBase
|
||||
private:
|
||||
typedef DispatcherBase<DerivedClass, WorkletType, BaseWorkletType> MyType;
|
||||
|
||||
friend struct detail::DispatcherBaseDynamicTransformHelper<MyType>;
|
||||
friend struct detail::for_each_dynamic_arg<0>;
|
||||
|
||||
protected:
|
||||
typedef vtkm::internal::FunctionInterface<typename WorkletType::ControlSignature>
|
||||
@ -305,10 +335,11 @@ private:
|
||||
typedef typename ExecutionInterface::template StaticTransformType<
|
||||
detail::DispatcherBaseExecutionSignatureTagCheck>::type ExecutionSignatureCheck;
|
||||
|
||||
template <typename Signature>
|
||||
VTKM_CONT void StartInvoke(const vtkm::internal::FunctionInterface<Signature>& parameters) const
|
||||
template <typename... Args>
|
||||
VTKM_CONT void StartInvoke(Args&&... args) const
|
||||
{
|
||||
using ParameterInterface = vtkm::internal::FunctionInterface<Signature>;
|
||||
using ParameterInterface =
|
||||
vtkm::internal::FunctionInterface<void(typename std::decay<Args>::type...)>;
|
||||
|
||||
VTKM_STATIC_ASSERT_MSG(ParameterInterface::ARITY == NUM_INVOKE_PARAMS,
|
||||
"Dispatcher Invoke called with wrong number of arguments.");
|
||||
@ -329,31 +360,26 @@ private:
|
||||
std::false_type,
|
||||
detail::DetermineIfHasDynamicParameter<brigand::_element, brigand::_state>>;
|
||||
|
||||
this->StartInvokeDynamic(parameters, HasDynamicTypes());
|
||||
this->StartInvokeDynamic(HasDynamicTypes(), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename Signature>
|
||||
VTKM_CONT void StartInvokeDynamic(const vtkm::internal::FunctionInterface<Signature>& parameters,
|
||||
std::true_type) const
|
||||
template <typename... Args>
|
||||
VTKM_CONT void StartInvokeDynamic(std::true_type, Args&&... args) const
|
||||
{
|
||||
// As we do the dynamic transform, we are also going to check the static
|
||||
// type against the TypeCheckTag in the ControlSignature tags. To do this,
|
||||
// the check needs access to both the parameter (in the parameters
|
||||
// argument) and the ControlSignature tags (in the ControlInterface type).
|
||||
// To make this possible, we call DynamicTransform with a functor containing
|
||||
// the control signature tags. It uses the index provided by the
|
||||
// dynamic transform mechanism to get the right tag and make sure that
|
||||
// the dynamic type is correct. (This prevents the compiler from expanding
|
||||
// worklets with types that should not be.)
|
||||
parameters.DynamicTransformCont(detail::DispatcherBaseDynamicTransform<ControlInterface>(),
|
||||
detail::DispatcherBaseDynamicTransformHelper<MyType>(this));
|
||||
using ContParamsInfo =
|
||||
vtkm::internal::detail::FunctionSigInfo<typename WorkletType::ControlSignature>;
|
||||
detail::deduce(*this, typename ContParamsInfo::Parameters(), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename Signature>
|
||||
VTKM_CONT void StartInvokeDynamic(const vtkm::internal::FunctionInterface<Signature>& parameters,
|
||||
std::false_type) const
|
||||
template <typename... Args>
|
||||
VTKM_CONT void StartInvokeDynamic(std::false_type, Args&&... args) const
|
||||
{
|
||||
using ParameterInterface = vtkm::internal::FunctionInterface<Signature>;
|
||||
using ParameterInterface =
|
||||
vtkm::internal::FunctionInterface<void(typename std::decay<Args>::type...)>;
|
||||
|
||||
//Nothing requires a conversion from dynamic to static types, so
|
||||
//next we need to verify that each argument's type is correct. If not
|
||||
@ -361,42 +387,37 @@ private:
|
||||
using ParamTypes = typename ParameterInterface::ParameterSig;
|
||||
using ContSigTypes = typename vtkm::internal::detail::FunctionSigInfo<
|
||||
typename WorkletType::ControlSignature>::Parameters;
|
||||
using NumParams = vtkm::internal::MakeIntegerSequence<ParameterInterface::ARITY>;
|
||||
|
||||
using isAllValid = brigand::fold<
|
||||
NumParams,
|
||||
std::true_type,
|
||||
detail::DetermineHasInCorrectParameters<brigand::_element, ParamTypes, ContSigTypes>>;
|
||||
//When isAllValid is false we produce a second static_assert
|
||||
//stating that the static transform is not possible
|
||||
static_assert(isAllValid::value, "Unable to match all parameter types");
|
||||
//isAllValid will throw a compile error if everything doesn't match
|
||||
using isAllValid =
|
||||
brigand::fold<ParamTypes,
|
||||
std::integral_constant<std::size_t, 0>,
|
||||
detail::DetermineHasInCorrectParameters<brigand::_element,
|
||||
brigand::_state,
|
||||
brigand::pin<ContSigTypes>>>;
|
||||
|
||||
this->DynamicTransformInvoke(parameters, isAllValid());
|
||||
}
|
||||
//this warning exists so that we don't get a warning from not using isAllValid
|
||||
using expectedLen = std::integral_constant<std::size_t, sizeof...(Args)>;
|
||||
static_assert(isAllValid::value == expectedLen::value,
|
||||
"All arguments failed the TypeCheck pass");
|
||||
|
||||
template <typename Signature>
|
||||
VTKM_CONT void DynamicTransformInvoke(
|
||||
const vtkm::internal::FunctionInterface<Signature>& parameters,
|
||||
std::true_type) const
|
||||
{
|
||||
// TODO: Check parameters
|
||||
static const vtkm::IdComponent INPUT_DOMAIN_INDEX = WorkletType::InputDomain::INDEX;
|
||||
reinterpret_cast<const DerivedClass*>(this)->DoInvoke(
|
||||
vtkm::internal::make_Invocation<INPUT_DOMAIN_INDEX>(
|
||||
parameters, ControlInterface(), ExecutionInterface()));
|
||||
}
|
||||
|
||||
template <typename Signature>
|
||||
VTKM_CONT void DynamicTransformInvoke(const vtkm::internal::FunctionInterface<Signature>&,
|
||||
std::false_type) const
|
||||
{
|
||||
auto fi =
|
||||
vtkm::internal::make_FunctionInterface<void, typename std::decay<Args>::type...>(args...);
|
||||
auto ivc = vtkm::internal::Invocation<ParameterInterface,
|
||||
ControlInterface,
|
||||
ExecutionInterface,
|
||||
WorkletType::InputDomain::INDEX,
|
||||
vtkm::internal::NullType,
|
||||
vtkm::internal::NullType>(
|
||||
fi, vtkm::internal::NullType{}, vtkm::internal::NullType{});
|
||||
static_cast<const DerivedClass*>(this)->DoInvoke(ivc);
|
||||
}
|
||||
|
||||
public:
|
||||
template <typename... ArgTypes>
|
||||
VTKM_CONT void Invoke(ArgTypes... args) const
|
||||
template <typename... Args>
|
||||
VTKM_CONT void Invoke(Args&&... args) const
|
||||
{
|
||||
this->StartInvoke(vtkm::internal::make_FunctionInterface<void>(args...));
|
||||
this->StartInvoke(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -52,14 +52,23 @@ struct TestExecObject
|
||||
|
||||
struct TestExecObjectType : vtkm::exec::ExecutionObjectBase
|
||||
{
|
||||
template <typename Functor>
|
||||
void CastAndCall(Functor f) const
|
||||
template <typename Functor, typename... Args>
|
||||
void CastAndCall(Functor f, Args&&... args) const
|
||||
{
|
||||
f(*this);
|
||||
f(*this, std::forward<Args>(args)...);
|
||||
}
|
||||
vtkm::Id Value;
|
||||
};
|
||||
|
||||
struct TestExecObjectTypeBad
|
||||
{ //this will fail as it doesn't inherit from vtkm::exec::ExecutionObjectBase
|
||||
template <typename Functor, typename... Args>
|
||||
void CastAndCall(Functor f, Args&&... args) const
|
||||
{
|
||||
f(*this, std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
struct TestTypeCheckTag
|
||||
{
|
||||
};
|
||||
@ -91,7 +100,7 @@ struct TypeCheck<TestTypeCheckTag, vtkm::Id*>
|
||||
template <>
|
||||
struct Transport<TestTransportTag, vtkm::Id*, Device>
|
||||
{
|
||||
typedef TestExecObject ExecObjectType;
|
||||
using ExecObjectType = TestExecObject;
|
||||
|
||||
VTKM_CONT
|
||||
ExecObjectType operator()(vtkm::Id* contData,
|
||||
@ -118,7 +127,12 @@ namespace internal
|
||||
template <>
|
||||
struct DynamicTransformTraits<TestExecObjectType>
|
||||
{
|
||||
typedef vtkm::cont::internal::DynamicTransformTagCastAndCall DynamicTag;
|
||||
using DynamicTag = vtkm::cont::internal::DynamicTransformTagCastAndCall;
|
||||
};
|
||||
template <>
|
||||
struct DynamicTransformTraits<TestExecObjectTypeBad>
|
||||
{
|
||||
using DynamicTag = vtkm::cont::internal::DynamicTransformTagCastAndCall;
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -137,7 +151,7 @@ struct Fetch<TestFetchTagInput,
|
||||
vtkm::exec::arg::ThreadIndicesBasic,
|
||||
TestExecObject>
|
||||
{
|
||||
typedef vtkm::Id ValueType;
|
||||
using ValueType = vtkm::Id;
|
||||
|
||||
VTKM_EXEC
|
||||
ValueType Load(const vtkm::exec::arg::ThreadIndicesBasic indices,
|
||||
@ -159,7 +173,7 @@ struct Fetch<TestFetchTagOutput,
|
||||
vtkm::exec::arg::ThreadIndicesBasic,
|
||||
TestExecObject>
|
||||
{
|
||||
typedef vtkm::Id ValueType;
|
||||
using ValueType = vtkm::Id;
|
||||
|
||||
VTKM_EXEC
|
||||
ValueType Load(const vtkm::exec::arg::ThreadIndicesBasic&, const TestExecObject&) const
|
||||
@ -190,15 +204,15 @@ class TestWorkletBase : public vtkm::worklet::internal::WorkletBase
|
||||
public:
|
||||
struct TestIn : vtkm::cont::arg::ControlSignatureTagBase
|
||||
{
|
||||
typedef TestTypeCheckTag TypeCheckTag;
|
||||
typedef TestTransportTag TransportTag;
|
||||
typedef TestFetchTagInput FetchTag;
|
||||
using TypeCheckTag = TestTypeCheckTag;
|
||||
using TransportTag = TestTransportTag;
|
||||
using FetchTag = TestFetchTagInput;
|
||||
};
|
||||
struct TestOut : vtkm::cont::arg::ControlSignatureTagBase
|
||||
{
|
||||
typedef TestTypeCheckTag TypeCheckTag;
|
||||
typedef TestTransportTag TransportTag;
|
||||
typedef TestFetchTagOutput FetchTag;
|
||||
using TypeCheckTag = TestTypeCheckTag;
|
||||
using TransportTag = TestTransportTag;
|
||||
using FetchTag = TestFetchTagOutput;
|
||||
};
|
||||
};
|
||||
|
||||
@ -235,17 +249,9 @@ class TestDispatcher : public vtkm::worklet::internal::DispatcherBase<TestDispat
|
||||
WorkletType,
|
||||
TestWorkletBase>
|
||||
{
|
||||
typedef vtkm::worklet::internal::DispatcherBase<TestDispatcher<WorkletType>,
|
||||
WorkletType,
|
||||
TestWorkletBase>
|
||||
Superclass;
|
||||
typedef vtkm::internal::FunctionInterface<void(vtkm::Id*, TestExecObjectType, vtkm::Id*)>
|
||||
ParameterInterface;
|
||||
typedef vtkm::internal::Invocation<ParameterInterface,
|
||||
typename Superclass::ControlInterface,
|
||||
typename Superclass::ExecutionInterface,
|
||||
1>
|
||||
Invocation;
|
||||
using Superclass = vtkm::worklet::internal::DispatcherBase<TestDispatcher<WorkletType>,
|
||||
WorkletType,
|
||||
TestWorkletBase>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
@ -255,7 +261,8 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void DoInvoke(const Invocation& invocation) const
|
||||
template <typename Invocation>
|
||||
void DoInvoke(Invocation&& invocation) const
|
||||
{
|
||||
std::cout << "In TestDispatcher::DoInvoke()" << std::endl;
|
||||
this->BasicInvoke(invocation, ARRAY_SIZE, Device());
|
||||
@ -321,40 +328,26 @@ void TestInvokeWithError()
|
||||
}
|
||||
}
|
||||
|
||||
void TestInvokeWithDynamicAndBadTypes()
|
||||
void TestInvokeWithBadDynamicType()
|
||||
{
|
||||
std::cout << "Test invoke with bad type" << std::endl;
|
||||
|
||||
vtkm::Id array[ARRAY_SIZE];
|
||||
TestExecObjectType execObject;
|
||||
execObject.Value = EXPECTED_EXEC_OBJECT_VALUE;
|
||||
vtkm::Id inputArray[ARRAY_SIZE];
|
||||
vtkm::Id outputArray[ARRAY_SIZE];
|
||||
TestExecObjectTypeBad execObject;
|
||||
TestDispatcher<TestWorklet> dispatcher;
|
||||
|
||||
try
|
||||
{
|
||||
std::cout << " First argument bad." << std::endl;
|
||||
dispatcher.Invoke(nullptr, execObject, array);
|
||||
std::cout << " Second argument bad." << std::endl;
|
||||
dispatcher.Invoke(inputArray, execObject, outputArray);
|
||||
VTKM_TEST_FAIL("Dispatcher did not throw expected error.");
|
||||
}
|
||||
catch (vtkm::cont::ErrorBadType& error)
|
||||
{
|
||||
std::cout << " Got expected exception." << std::endl;
|
||||
std::cout << " " << error.GetMessage() << std::endl;
|
||||
VTKM_TEST_ASSERT(error.GetMessage().find(" 1 ") != std::string::npos,
|
||||
"Parameter index not named in error message.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
std::cout << " Third argument bad." << std::endl;
|
||||
dispatcher.Invoke(array, execObject, nullptr);
|
||||
VTKM_TEST_FAIL("Dispatcher did not throw expected error.");
|
||||
}
|
||||
catch (vtkm::cont::ErrorBadType& error)
|
||||
{
|
||||
std::cout << " Got expected exception." << std::endl;
|
||||
std::cout << " " << error.GetMessage() << std::endl;
|
||||
VTKM_TEST_ASSERT(error.GetMessage().find(" 3 ") != std::string::npos,
|
||||
VTKM_TEST_ASSERT(error.GetMessage().find(" 2 ") != std::string::npos,
|
||||
"Parameter index not named in error message.");
|
||||
}
|
||||
}
|
||||
@ -363,7 +356,7 @@ void TestDispatcherBase()
|
||||
{
|
||||
TestBasicInvoke();
|
||||
TestInvokeWithError();
|
||||
TestInvokeWithDynamicAndBadTypes();
|
||||
TestInvokeWithBadDynamicType();
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -40,17 +40,6 @@ namespace vtkm
|
||||
namespace worklet
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
const static vtkm::IdComponent StructuredTetrahedronIndices[2][5][4] = {
|
||||
{ { 0, 1, 3, 4 }, { 1, 4, 5, 6 }, { 1, 4, 6, 3 }, { 1, 3, 6, 2 }, { 3, 6, 7, 4 } },
|
||||
{ { 2, 1, 5, 0 }, { 0, 2, 3, 7 }, { 2, 5, 6, 7 }, { 0, 7, 4, 5 }, { 0, 2, 7, 5 } }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief Compute the tetrahedralize cells for a uniform grid data set
|
||||
template <typename DeviceAdapter>
|
||||
class TetrahedralizeStructured
|
||||
@ -82,6 +71,11 @@ public:
|
||||
ConnectivityOutVec& connectivityOut,
|
||||
const ThreadIndicesType threadIndices) const
|
||||
{
|
||||
const static vtkm::IdComponent StructuredTetrahedronIndices[2][5][4] = {
|
||||
{ { 0, 1, 3, 4 }, { 1, 4, 5, 6 }, { 1, 4, 6, 3 }, { 1, 3, 6, 2 }, { 3, 6, 7, 4 } },
|
||||
{ { 2, 1, 5, 0 }, { 0, 2, 3, 7 }, { 2, 5, 6, 7 }, { 0, 7, 4, 5 }, { 0, 2, 7, 5 } }
|
||||
};
|
||||
|
||||
vtkm::Id3 inputIndex = threadIndices.GetInputIndex3D();
|
||||
|
||||
// Calculate the type of tetrahedron generated because it alternates
|
||||
@ -89,14 +83,10 @@ public:
|
||||
|
||||
vtkm::IdComponent visitIndex = threadIndices.GetVisitIndex();
|
||||
|
||||
connectivityOut[0] =
|
||||
connectivityIn[detail::StructuredTetrahedronIndices[indexType][visitIndex][0]];
|
||||
connectivityOut[1] =
|
||||
connectivityIn[detail::StructuredTetrahedronIndices[indexType][visitIndex][1]];
|
||||
connectivityOut[2] =
|
||||
connectivityIn[detail::StructuredTetrahedronIndices[indexType][visitIndex][2]];
|
||||
connectivityOut[3] =
|
||||
connectivityIn[detail::StructuredTetrahedronIndices[indexType][visitIndex][3]];
|
||||
connectivityOut[0] = connectivityIn[StructuredTetrahedronIndices[indexType][visitIndex][0]];
|
||||
connectivityOut[1] = connectivityIn[StructuredTetrahedronIndices[indexType][visitIndex][1]];
|
||||
connectivityOut[2] = connectivityIn[StructuredTetrahedronIndices[indexType][visitIndex][2]];
|
||||
connectivityOut[3] = connectivityIn[StructuredTetrahedronIndices[indexType][visitIndex][3]];
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -40,14 +40,6 @@ namespace vtkm
|
||||
namespace worklet
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
const static vtkm::IdComponent StructuredTriangleIndices[2][3] = { { 0, 1, 2 }, { 0, 2, 3 } };
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief Compute the triangulate cells for a uniform grid data set
|
||||
template <typename DeviceAdapter>
|
||||
class TriangulateStructured
|
||||
@ -79,9 +71,11 @@ public:
|
||||
ConnectivityOutVec& connectivityOut,
|
||||
vtkm::IdComponent visitIndex) const
|
||||
{
|
||||
connectivityOut[0] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][0]];
|
||||
connectivityOut[1] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][1]];
|
||||
connectivityOut[2] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][2]];
|
||||
const static vtkm::IdComponent StructuredTriangleIndices[2][3] = { { 0, 1, 2 }, { 0, 2, 3 } };
|
||||
|
||||
connectivityOut[0] = connectivityIn[StructuredTriangleIndices[visitIndex][0]];
|
||||
connectivityOut[1] = connectivityIn[StructuredTriangleIndices[visitIndex][1]];
|
||||
connectivityOut[2] = connectivityIn[StructuredTriangleIndices[visitIndex][2]];
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user