From 9ff58329096397a4b5895d22dec56fea35cdeb45 Mon Sep 17 00:00:00 2001 From: Jeremy Meredith Date: Tue, 12 May 2015 09:39:00 -0400 Subject: [PATCH] adding wrapper for exec connectivity. --- vtkm/cont/CellSetExplicit.h | 21 +++++++++++++--- vtkm/cont/CellSetStructured.h | 2 +- vtkm/cont/ExplicitConnectivity.h | 32 ++++++++++++++++++++++++ vtkm/cont/TopologyType.h | 35 +++++++++++++++++++++++++++ vtkm/cont/testing/UnitTestDataSet.cxx | 2 +- vtkm/exec/ExplicitConnectivity.h | 33 +++++++++++++++++++++++++ 6 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 vtkm/cont/TopologyType.h create mode 100644 vtkm/exec/ExplicitConnectivity.h diff --git a/vtkm/cont/CellSetExplicit.h b/vtkm/cont/CellSetExplicit.h index 37a0462ef..1a20746a9 100644 --- a/vtkm/cont/CellSetExplicit.h +++ b/vtkm/cont/CellSetExplicit.h @@ -7,10 +7,25 @@ namespace vtkm { namespace cont { -class CellSetExplicit +class CellSetExplicit : public CellSet { - public: - ExplicitConnectivity nodesOfCellsConnectivity; +public: + //CellSetExplicit() : CellSet("", 0) + //{ + //} + + CellSetExplicit(const std::string &n, int d) + : CellSet(n,d) + { + } + + virtual int GetNumCells() + { + return nodesOfCellsConnectivity.GetNumberOfElements(); + } + +public: + ExplicitConnectivity nodesOfCellsConnectivity; }; } diff --git a/vtkm/cont/CellSetStructured.h b/vtkm/cont/CellSetStructured.h index 34188f2d6..522fe9d7e 100644 --- a/vtkm/cont/CellSetStructured.h +++ b/vtkm/cont/CellSetStructured.h @@ -7,7 +7,7 @@ namespace vtkm { namespace cont { -class CellSetStructured +class CellSetStructured// : public CellSet { public: RegularConnectivity structure; diff --git a/vtkm/cont/ExplicitConnectivity.h b/vtkm/cont/ExplicitConnectivity.h index 45c534452..50a7ab05a 100644 --- a/vtkm/cont/ExplicitConnectivity.h +++ b/vtkm/cont/ExplicitConnectivity.h @@ -1,7 +1,27 @@ +//============================================================================ +// 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 2015 Sandia Corporation. +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// 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_cont_ExplicitConnectivity_h #define vtk_m_cont_ExplicitConnectivity_h #include +#include #include #include #include @@ -12,6 +32,9 @@ namespace cont { class ExplicitConnectivity { +public: + typedef vtkm::exec::ExplicitConnectivity ExecObjectType; + public: ExplicitConnectivity() {} @@ -41,6 +64,15 @@ public: ///\todo: how do I modify an array handle? } + ExecObjectType GetExecObject() + { + vtkm::exec::ExplicitConnectivity obj; + //obj.Shapes = Shapes.GetPortal(); ///??? + /// ... + return obj; + } + + vtkm::cont::ArrayHandle Shapes; vtkm::cont::ArrayHandle NumIndices; vtkm::cont::ArrayHandle Connectivity; diff --git a/vtkm/cont/TopologyType.h b/vtkm/cont/TopologyType.h new file mode 100644 index 000000000..5ba19eda2 --- /dev/null +++ b/vtkm/cont/TopologyType.h @@ -0,0 +1,35 @@ +//============================================================================ +// 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 2015 Sandia Corporation. +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// 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_cont_TopologyType_h +#define vtk_m_cont_TopologyType_h + +namespace vtkm { +namespace cont { + +enum TopologyType +{ + NODE, + CELL, + EDGE, + FACE +}; + +} // namespace cont +} // namespace vtkm diff --git a/vtkm/cont/testing/UnitTestDataSet.cxx b/vtkm/cont/testing/UnitTestDataSet.cxx index dbdee5e9c..7030a0e96 100644 --- a/vtkm/cont/testing/UnitTestDataSet.cxx +++ b/vtkm/cont/testing/UnitTestDataSet.cxx @@ -143,7 +143,7 @@ void TestDataSet_Explicit() map_cell_to_iondex.push_back(0); map_cell_to_iondex.push_back(3); - vtkm::cont::CellSetExplicit *cs = new vtkm::cont::CellSetExplicit; + vtkm::cont::CellSetExplicit *cs = new vtkm::cont::CellSetExplicit("cells",2); tmp2 = vtkm::cont::make_ArrayHandle(shapes); vtkm::cont::DeviceAdapterAlgorithm::Copy(tmp2, cs->nodesOfCellsConnectivity.Shapes); diff --git a/vtkm/exec/ExplicitConnectivity.h b/vtkm/exec/ExplicitConnectivity.h new file mode 100644 index 000000000..f87493686 --- /dev/null +++ b/vtkm/exec/ExplicitConnectivity.h @@ -0,0 +1,33 @@ +//============================================================================ +// 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 2015 Sandia Corporation. +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// 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_exec_ExplicitConnectivity_h +#define vtk_m_exec_ExplicitConnectivity_h + +namespace vtkm { +namespace exec { + +class ExplicitConnectivity +{ +}; + +} // namespace exec +} // namespace vtkm + +#endif // vtk_m_exec_ExplicitConnectivity_h