2018-03-09 19:01:22 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2018-03-09 19:01:22 +00:00
|
|
|
// 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 <vtkm/cont/CoordinateSystem.h>
|
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace cont
|
|
|
|
{
|
|
|
|
namespace detail
|
|
|
|
{
|
|
|
|
|
|
|
|
struct MakeArrayHandleVirtualCoordinatesFunctor
|
|
|
|
{
|
|
|
|
template <typename StorageTag>
|
2019-07-31 16:20:38 +00:00
|
|
|
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<vtkm::Vec3f_32, StorageTag>& array,
|
|
|
|
ArrayHandleVirtualCoordinates& output) const
|
2018-03-09 19:01:22 +00:00
|
|
|
{
|
|
|
|
output = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename StorageTag>
|
2019-07-31 16:20:38 +00:00
|
|
|
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<vtkm::Vec3f_64, StorageTag>& array,
|
|
|
|
ArrayHandleVirtualCoordinates& output) const
|
2018-03-09 19:01:22 +00:00
|
|
|
{
|
|
|
|
output = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-11-06 16:40:39 +00:00
|
|
|
template <typename TypeList>
|
2018-03-09 19:01:22 +00:00
|
|
|
VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates MakeArrayHandleVirtualCoordinates(
|
2018-12-11 13:56:08 +00:00
|
|
|
const vtkm::cont::VariantArrayHandleBase<TypeList>& array)
|
2018-03-09 19:01:22 +00:00
|
|
|
{
|
|
|
|
vtkm::cont::ArrayHandleVirtualCoordinates output;
|
2019-12-05 17:55:57 +00:00
|
|
|
vtkm::cont::CastAndCall(array.ResetTypes(vtkm::TypeListFieldVec3{}),
|
2018-03-09 19:01:22 +00:00
|
|
|
MakeArrayHandleVirtualCoordinatesFunctor{},
|
|
|
|
output);
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
} // namespace detail
|
|
|
|
|
2018-11-06 16:40:39 +00:00
|
|
|
template <typename TypeList>
|
2018-03-09 19:01:22 +00:00
|
|
|
VTKM_CONT CoordinateSystem::CoordinateSystem(
|
|
|
|
std::string name,
|
2018-12-11 13:56:08 +00:00
|
|
|
const vtkm::cont::VariantArrayHandleBase<TypeList>& data)
|
2018-05-18 20:10:15 +00:00
|
|
|
: Superclass(name, Association::POINTS, detail::MakeArrayHandleVirtualCoordinates(data))
|
2018-03-09 19:01:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T, typename Storage>
|
|
|
|
VTKM_CONT CoordinateSystem::CoordinateSystem(std::string name,
|
|
|
|
const vtkm::cont::ArrayHandle<T, Storage>& data)
|
2018-05-18 20:10:15 +00:00
|
|
|
: Superclass(name, Association::POINTS, vtkm::cont::ArrayHandleVirtualCoordinates(data))
|
2018-03-09 19:01:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T, typename Storage>
|
|
|
|
VTKM_CONT void CoordinateSystem::SetData(const vtkm::cont::ArrayHandle<T, Storage>& newdata)
|
|
|
|
{
|
|
|
|
this->SetData(vtkm::cont::ArrayHandleVirtualCoordinates(newdata));
|
|
|
|
}
|
|
|
|
|
2018-11-06 16:40:39 +00:00
|
|
|
template <typename TypeList>
|
2018-03-09 19:01:22 +00:00
|
|
|
VTKM_CONT void CoordinateSystem::SetData(
|
2018-12-11 13:56:08 +00:00
|
|
|
const vtkm::cont::VariantArrayHandleBase<TypeList>& newdata)
|
2018-03-09 19:01:22 +00:00
|
|
|
{
|
|
|
|
this->SetData(detail::MakeArrayHandleVirtualCoordinates(newdata));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|