//============================================================================ // 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. //============================================================================ #include #include class TestGraphConnectivity { public: void operator()() const { std::vector counts{ 1, 1, 2, 2, 2 }; std::vector offsets{ 0, 1, 2, 4, 6 }; std::vector conn{ 2, 4, 0, 3, 2, 4, 1, 3 }; vtkm::cont::ArrayHandle counts_h = vtkm::cont::make_ArrayHandle(counts); vtkm::cont::ArrayHandle offsets_h = vtkm::cont::make_ArrayHandle(offsets); vtkm::cont::ArrayHandle conn_h = vtkm::cont::make_ArrayHandle(conn); vtkm::cont::ArrayHandle comps; vtkm::worklet::connectivity::GraphConnectivity().Run(counts_h, offsets_h, conn_h, comps); for (int i = 0; i < comps.GetNumberOfValues(); i++) { VTKM_TEST_ASSERT(comps.ReadPortal().Get(i) == 0, "Components has unexpected value."); } } }; int UnitTestGraphConnectivity(int argc, char* argv[]) { return vtkm::cont::testing::Testing::Run(TestGraphConnectivity(), argc, argv); }