vtk-m/vtkm/cont/arg/TransportTagBitField.h
Kenneth Moreland 76ce9c87f0 Support using Token calling PrepareForExecution in ExecutionObject
The old version of ExecutionObject (that only takes a device) is still
supported, but you will get a deprecated warning if that is what is
defined.

Supporing this also included sending vtkm::cont::Token through the
vtkm::cont::arg::Transport mechanism, which was a change that propogated
through a lot of code.
2020-02-25 07:41:39 -07:00

89 lines
2.8 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.
//============================================================================
#ifndef vtk_m_cont_arg_TransportTagBitField_h
#define vtk_m_cont_arg_TransportTagBitField_h
#include <vtkm/cont/arg/Transport.h>
#include <vtkm/cont/BitField.h>
namespace vtkm
{
namespace cont
{
namespace arg
{
struct TransportTagBitFieldIn
{
};
struct TransportTagBitFieldOut
{
};
struct TransportTagBitFieldInOut
{
};
template <typename Device>
struct Transport<vtkm::cont::arg::TransportTagBitFieldIn, vtkm::cont::BitField, Device>
{
using ExecObjectType =
typename vtkm::cont::BitField::template ExecutionTypes<Device>::PortalConst;
template <typename InputDomainType>
VTKM_CONT ExecObjectType operator()(vtkm::cont::BitField& field,
const InputDomainType&,
vtkm::Id,
vtkm::Id,
vtkm::cont::Token& token) const
{
return field.PrepareForInput(Device{}, token);
}
};
template <typename Device>
struct Transport<vtkm::cont::arg::TransportTagBitFieldOut, vtkm::cont::BitField, Device>
{
using ExecObjectType = typename vtkm::cont::BitField::template ExecutionTypes<Device>::Portal;
template <typename InputDomainType>
VTKM_CONT ExecObjectType operator()(vtkm::cont::BitField& field,
const InputDomainType&,
vtkm::Id,
vtkm::Id,
vtkm::cont::Token& token) const
{
// This behaves similarly to WholeArray tags, where "Out" maps to InPlace
// since we don't want to reallocate or enforce size restrictions.
return field.PrepareForInPlace(Device{}, token);
}
};
template <typename Device>
struct Transport<vtkm::cont::arg::TransportTagBitFieldInOut, vtkm::cont::BitField, Device>
{
using ExecObjectType = typename vtkm::cont::BitField::template ExecutionTypes<Device>::Portal;
template <typename InputDomainType>
VTKM_CONT ExecObjectType operator()(vtkm::cont::BitField& field,
const InputDomainType&,
vtkm::Id,
vtkm::Id,
vtkm::cont::Token& token) const
{
return field.PrepareForInPlace(Device{}, token);
}
};
}
}
} // namespace vtkm::cont::arg
#endif //vtk_m_cont_arg_TransportTagBitField_h