vtk-m/vtkm/worklet/connectivities/CellSetConnectivity.h
Haocheng LIU 8859636672 Merge worklet testing executables into a device dependent shared library
VTK-m has been updated to replace old per device worklet testing executables with a device
dependent shared library so that it's able to accept a device adapter
at runtime.
Meanwhile, it updates the testing infrastructure APIs. vtkm::cont::testing::Run
function would call ForceDevice when needed and if users need the device
adapter info at runtime, RunOnDevice function would pass the adapter into the functor.

Optional Parser is bumped from 1.3 to 1.7.
2018-11-23 10:13:56 -05:00

56 lines
1.9 KiB
C++

//=============================================================================
//
// 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 2018 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2018 UT-Battelle, LLC.
// Copyright 2018 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_worklet_connectivity_CellSetConnectivity_h
#define vtk_m_worklet_connectivity_CellSetConnectivity_h
#include <vtkm/worklet/connectivities/CellSetDualGraph.h>
#include <vtkm/worklet/connectivities/GraphConnectivity.h>
namespace vtkm
{
namespace worklet
{
namespace connectivity
{
class CellSetConnectivity
{
public:
template <typename CellSetType>
void Run(const CellSetType& cellSet, vtkm::cont::ArrayHandle<vtkm::Id>& componentArray) const
{
vtkm::cont::ArrayHandle<vtkm::Id> numIndicesArray;
vtkm::cont::ArrayHandle<vtkm::Id> indexOffsetArray;
vtkm::cont::ArrayHandle<vtkm::Id> connectivityArray;
// create cell to cell connectivity graph (dual graph)
CellSetDualGraph().Run(cellSet, numIndicesArray, indexOffsetArray, connectivityArray);
// find the connected component of the dual graph
GraphConnectivity().Run(numIndicesArray, indexOffsetArray, connectivityArray, componentArray);
}
};
}
}
} // vtkm::worklet::connectivity
#endif // vtk_m_worklet_connectivity_CellSetConnectivity_h