//============================================================================ // 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_cont_CoordinateSystem_hxx #define vtk_m_cont_CoordinateSystem_hxx #include namespace vtkm { namespace cont { namespace detail { struct MakeArrayHandleVirtualCoordinatesFunctor { template VTKM_CONT void operator()(const vtkm::cont::ArrayHandle& array, ArrayHandleVirtualCoordinates& output) const { output = vtkm::cont::ArrayHandleVirtualCoordinates(array); } template VTKM_CONT void operator()(const vtkm::cont::ArrayHandle& array, ArrayHandleVirtualCoordinates& output) const { output = vtkm::cont::ArrayHandleVirtualCoordinates(array); } }; template VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates MakeArrayHandleVirtualCoordinates( const vtkm::cont::VariantArrayHandleBase& array) { vtkm::cont::ArrayHandleVirtualCoordinates output; vtkm::cont::CastAndCall(array.ResetTypes(vtkm::TypeListFieldVec3{}), MakeArrayHandleVirtualCoordinatesFunctor{}, output); return output; } } // namespace detail template VTKM_CONT CoordinateSystem::CoordinateSystem( std::string name, const vtkm::cont::VariantArrayHandleBase& data) : Superclass(name, Association::POINTS, detail::MakeArrayHandleVirtualCoordinates(data)) { } template VTKM_CONT CoordinateSystem::CoordinateSystem(std::string name, const vtkm::cont::ArrayHandle& data) : Superclass(name, Association::POINTS, vtkm::cont::ArrayHandleVirtualCoordinates(data)) { } template VTKM_CONT void CoordinateSystem::SetData(const vtkm::cont::ArrayHandle& newdata) { this->SetData(vtkm::cont::ArrayHandleVirtualCoordinates(newdata)); } template VTKM_CONT void CoordinateSystem::SetData( const vtkm::cont::VariantArrayHandleBase& newdata) { this->SetData(detail::MakeArrayHandleVirtualCoordinates(newdata)); } } } #endif