//============================================================================ // 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. //============================================================================ #ifndef vtk_m_worklet_gradient_Transpose_h #define vtk_m_worklet_gradient_Transpose_h #include #include namespace vtkm { namespace worklet { namespace gradient { template using TransposeType = vtkm::List, 3>>; template struct Transpose3x3 : vtkm::worklet::WorkletMapField { using ControlSignature = void(FieldInOut field); template VTKM_EXEC void operator()(FieldInVecType& field) const { T tempA, tempB, tempC; tempA = field[0][1]; field[0][1] = field[1][0]; field[1][0] = tempA; tempB = field[0][2]; field[0][2] = field[2][0]; field[2][0] = tempB; tempC = field[1][2]; field[1][2] = field[2][1]; field[2][1] = tempC; } template void Run(vtkm::cont::ArrayHandle, 3>, S>& field, vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny()) { vtkm::worklet::DispatcherMapField> dispatcher; dispatcher.SetDevice(device); dispatcher.Invoke(field); } }; } } } #endif