2018-11-06 16:20:30 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2018-11-06 16:20:30 +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_internal_TransferInfo_h
|
|
|
|
#define vtk_m_cont_internal_TransferInfo_h
|
|
|
|
|
|
|
|
#include <vtkm/cont/vtkm_cont_export.h>
|
|
|
|
|
2021-04-23 20:07:11 +00:00
|
|
|
#include <vtkm/internal/Configure.h>
|
|
|
|
#ifdef VTKM_NO_DEPRECATED_VIRTUAL
|
|
|
|
#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set."
|
|
|
|
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
|
|
|
|
2018-11-06 16:20:30 +00:00
|
|
|
#include <vtkm/Types.h>
|
2019-04-03 20:28:31 +00:00
|
|
|
#include <vtkm/cont/DeviceAdapterTag.h>
|
2018-11-06 16:20:30 +00:00
|
|
|
#include <vtkm/internal/ArrayPortalVirtual.h>
|
|
|
|
|
2021-04-23 20:07:11 +00:00
|
|
|
// This is a deprecated class. Don't warn about deprecation while implementing
|
|
|
|
// deprecated functionality.
|
|
|
|
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
|
|
|
|
2018-11-06 16:20:30 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace internal
|
|
|
|
{
|
|
|
|
class PortalVirtualBase;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace cont
|
|
|
|
{
|
|
|
|
namespace internal
|
|
|
|
{
|
|
|
|
|
|
|
|
struct VTKM_CONT_EXPORT TransferInfoArray
|
|
|
|
{
|
|
|
|
bool valid(vtkm::cont::DeviceAdapterId tagValue) const noexcept;
|
|
|
|
|
|
|
|
void updateHost(std::unique_ptr<vtkm::internal::PortalVirtualBase>&& host) noexcept;
|
|
|
|
void updateDevice(
|
|
|
|
vtkm::cont::DeviceAdapterId id,
|
|
|
|
std::unique_ptr<vtkm::internal::PortalVirtualBase>&& host_copy, //NOT the same as host version
|
|
|
|
const vtkm::internal::PortalVirtualBase* device,
|
|
|
|
const std::shared_ptr<void>& state) noexcept;
|
|
|
|
void releaseDevice();
|
|
|
|
void releaseAll();
|
|
|
|
|
2020-11-30 23:39:56 +00:00
|
|
|
const vtkm::internal::PortalVirtualBase* hostPtr() noexcept { return this->Host.get(); }
|
2018-11-06 16:20:30 +00:00
|
|
|
const vtkm::internal::PortalVirtualBase* devicePtr() const noexcept { return this->Device; }
|
|
|
|
vtkm::cont::DeviceAdapterId deviceId() const noexcept { return this->DeviceId; }
|
|
|
|
|
|
|
|
std::shared_ptr<void>& state() noexcept { return this->DeviceTransferState; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
vtkm::cont::DeviceAdapterId DeviceId = vtkm::cont::DeviceAdapterTagUndefined{};
|
|
|
|
std::unique_ptr<vtkm::internal::PortalVirtualBase> Host = nullptr;
|
|
|
|
std::unique_ptr<vtkm::internal::PortalVirtualBase> HostCopyOfDevice = nullptr;
|
|
|
|
const vtkm::internal::PortalVirtualBase* Device = nullptr;
|
|
|
|
std::shared_ptr<void> DeviceTransferState = nullptr;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-23 20:07:11 +00:00
|
|
|
VTKM_DEPRECATED_SUPPRESS_END
|
|
|
|
|
2018-11-06 16:20:30 +00:00
|
|
|
#endif
|