VTK-m  2.0
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
vtkm::cont::ArrayHandle< T, StorageTag_ > Class Template Reference

Manages an array-worth of data. More...

#include <ArrayHandle.h>

Inheritance diagram for vtkm::cont::ArrayHandle< T, StorageTag_ >:
vtkm::cont::ArrayHandleCartesianProduct< AxisIndexArrayCells, AxisIndexArrayCells, AxisIndexArrayCells > vtkm::cont::ArrayHandleCartesianProduct< AxisIndexArrayPoints, AxisIndexArrayPoints, AxisIndexArrayPoints > vtkm::cont::ArrayHandleImplicit< detail::PhiloxFunctor > vtkm::cont::ArrayHandleCartesianProduct< FirstHandleType, SecondHandleType, ThirdHandleType > vtkm::cont::ArrayHandleDecorator< DecoratorImplT, ArrayTs > vtkm::cont::ArrayHandleDiscard< ValueType_ > vtkm::cont::ArrayHandleImplicit< FunctorType > vtkm::cont::ArrayHandleZip< FirstHandleType, SecondHandleType >

Public Types

using ValueType = T
 
using StorageTag = StorageTag_
 
using StorageType = vtkm::cont::internal::Storage< ValueType, StorageTag >
 
using ReadPortalType = typename StorageType::ReadPortalType
 
using WritePortalType = typename StorageType::WritePortalType
 

Public Member Functions

VTKM_CONT ArrayHandle ()
 Constructs an empty ArrayHandle. More...
 
VTKM_CONT ArrayHandle (const vtkm::cont::ArrayHandle< ValueType, StorageTag > &src)
 Copy constructor. More...
 
VTKM_CONT ArrayHandle (vtkm::cont::ArrayHandle< ValueType, StorageTag > &&src) noexcept
 Move constructor. More...
 
VTKM_CONT ~ArrayHandle ()
 Destructs an empty ArrayHandle. More...
 
VTKM_CONT vtkm::cont::ArrayHandle< ValueType, StorageTag > & operator= (const vtkm::cont::ArrayHandle< ValueType, StorageTag > &src)
 Copies an ArrayHandle. More...
 
VTKM_CONT vtkm::cont::ArrayHandle< ValueType, StorageTag > & operator= (vtkm::cont::ArrayHandle< ValueType, StorageTag > &&src) noexcept
 Move and Assignment of an ArrayHandle. More...
 
VTKM_CONT bool operator== (const ArrayHandle< ValueType, StorageTag > &rhs) const
 Like a pointer, two ArrayHandles are considered equal if they point to the same location in memory. More...
 
VTKM_CONT bool operator!= (const ArrayHandle< ValueType, StorageTag > &rhs) const
 
template<typename VT , typename ST >
VTKM_CONT bool operator== (const ArrayHandle< VT, ST > &) const
 
template<typename VT , typename ST >
VTKM_CONT bool operator!= (const ArrayHandle< VT, ST > &) const
 
VTKM_CONT StorageType GetStorage () const
 Get the storage. More...
 
VTKM_CONT WritePortalType WritePortal () const
 Get an array portal that can be used in the control environment. More...
 
VTKM_CONT WritePortalType WritePortal (vtkm::cont::Token &token) const
 
VTKM_CONT vtkm::Id GetNumberOfValues () const
 Returns the number of entries in the array. More...
 
VTKM_CONT void ReleaseResourcesExecution () const
 Releases any resources being used in the execution environment (that are not being shared by the control environment). More...
 
VTKM_CONT void ReleaseResources () const
 Releases all resources in both the control and execution environments. More...
 
VTKM_CONT ReadPortalType PrepareForInput (vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
 Prepares this array to be used as an input to an operation in the execution environment. More...
 
VTKM_CONT WritePortalType PrepareForInPlace (vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
 Prepares this array to be used in an in-place operation (both as input and output) in the execution environment. More...
 
VTKM_CONT WritePortalType PrepareForOutput (vtkm::Id numberOfValues, vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
 Prepares (allocates) this array to be used as an output from an operation in the execution environment. More...
 
VTKM_CONT bool IsOnDevice (vtkm::cont::DeviceAdapterId device) const
 Returns true if the ArrayHandle's data is on the given device. More...
 
VTKM_CONT bool IsOnHost () const
 Returns true if the ArrayHandle's data is on the host. More...
 
VTKM_CONT void SyncControlArray () const
 Synchronizes the control array with the execution array. More...
 
VTKM_CONT void Enqueue (const vtkm::cont::Token &token) const
 Enqueue a token for access to this ArrayHandle. More...
 
VTKM_CONT void DeepCopyFrom (const vtkm::cont::ArrayHandle< ValueType, StorageTag > &source) const
 Deep copies the data in the array. More...
 
const VTKM_CONT std::vector< vtkm::cont::internal::Buffer > & GetBuffers () const
 Returns the internal Buffer structures that hold the data. More...
 
VTKM_CONT std::vector< vtkm::cont::internal::Buffer > & GetBuffers ()
 
VTKM_CONT ArrayHandle (const std::vector< vtkm::cont::internal::Buffer > &buffers)
 
VTKM_CONT ArrayHandle (std::vector< vtkm::cont::internal::Buffer > &&buffers) noexcept
 
VTKM_CONT ReadPortalType ReadPortal () const
 Get an array portal that can be used in the control environment. More...
 
VTKM_CONT ReadPortalType ReadPortal (vtkm::cont::Token &token) const
 Get an array portal that can be used in the control environment. More...
 
VTKM_CONT void Allocate (vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
 Allocates an array large enough to hold the given number of values. More...
 
VTKM_CONT void Allocate (vtkm::Id numberOfValues, vtkm::CopyFlag preserve=vtkm::CopyFlag::Off) const
 Allocates an array large enough to hold the given number of values. More...
 
VTKM_CONT void AllocateAndFill (vtkm::Id numberOfValues, const ValueType &fillValue, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
 Allocates an array and fills it with an initial value. More...
 
VTKM_CONT void AllocateAndFill (vtkm::Id numberOfValues, const ValueType &fillValue, vtkm::CopyFlag preserve=vtkm::CopyFlag::Off) const
 Allocates an array and fills it with an initial value. More...
 
VTKM_CONT void Fill (const ValueType &fillValue, vtkm::Id startIndex, vtkm::Id endIndex, vtkm::cont::Token &token) const
 Fills the array with a given value. More...
 
VTKM_CONT void Fill (const ValueType &fillValue, vtkm::Id startIndex, vtkm::Id endIndex) const
 Fills the array with a given value. More...
 
VTKM_CONT void Fill (const ValueType &fillValue, vtkm::Id startIndex=0) const
 Fills the array with a given value. More...
 

Protected Member Functions

VTKM_CONT void SetBuffer (vtkm::IdComponent index, const vtkm::cont::internal::Buffer &buffer)
 
VTKM_CONT void SetBuffers (const std::vector< vtkm::cont::internal::Buffer > &buffers)
 
VTKM_CONT void SetBuffers (std::vector< vtkm::cont::internal::Buffer > &&buffers)
 

Private Member Functions

 VTKM_STATIC_ASSERT_MSG ((internal::IsValidArrayHandle< T, StorageTag_ >::value), "Attempted to create an ArrayHandle with an invalid type/storage combination.")
 

Private Attributes

std::vector< vtkm::cont::internal::Buffer > Buffers
 

Detailed Description

template<typename T, typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
class vtkm::cont::ArrayHandle< T, StorageTag_ >

Manages an array-worth of data.

ArrayHandle manages as array of data that can be manipulated by VTKm algorithms. The ArrayHandle may have up to two copies of the array, one for the control environment and one for the execution environment, although depending on the device and how the array is being used, the ArrayHandle will only have one copy when possible.

An ArrayHandle is often constructed by instantiating one of the ArrayHandle subclasses. Several basic ArrayHandle types can also be constructed directly and then allocated. The ArrayHandleBasic subclass provides mechanisms for importing user arrays into an ArrayHandle.

ArrayHandle behaves like a shared smart pointer in that when it is copied each copy holds a reference to the same array. These copies are reference counted so that when all copies of the ArrayHandle are destroyed, any allocated memory is released.

Member Typedef Documentation

◆ ReadPortalType

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
using vtkm::cont::ArrayHandle< T, StorageTag_ >::ReadPortalType = typename StorageType::ReadPortalType

◆ StorageTag

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
using vtkm::cont::ArrayHandle< T, StorageTag_ >::StorageTag = StorageTag_

◆ StorageType

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
using vtkm::cont::ArrayHandle< T, StorageTag_ >::StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>

◆ ValueType

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
using vtkm::cont::ArrayHandle< T, StorageTag_ >::ValueType = T

◆ WritePortalType

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
using vtkm::cont::ArrayHandle< T, StorageTag_ >::WritePortalType = typename StorageType::WritePortalType

Constructor & Destructor Documentation

◆ ArrayHandle() [1/5]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::cont::ArrayHandle< T, StorageTag_ >::ArrayHandle ( )
inline

Constructs an empty ArrayHandle.

◆ ArrayHandle() [2/5]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::cont::ArrayHandle< T, StorageTag_ >::ArrayHandle ( const vtkm::cont::ArrayHandle< ValueType, StorageTag > &  src)
inline

Copy constructor.

Implemented so that it is defined exclusively in the control environment. If there is a separate device for the execution environment (for example, with CUDA), then the automatically generated copy constructor could be created for all devices, and it would not be valid for all devices.

◆ ArrayHandle() [3/5]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::cont::ArrayHandle< T, StorageTag_ >::ArrayHandle ( vtkm::cont::ArrayHandle< ValueType, StorageTag > &&  src)
inlinenoexcept

Move constructor.

Implemented so that it is defined exclusively in the control environment. If there is a separate device for the execution environment (for example, with CUDA), then the automatically generated move constructor could be created for all devices, and it would not be valid for all devices.

◆ ArrayHandle() [4/5]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::cont::ArrayHandle< T, StorageTag_ >::ArrayHandle ( const std::vector< vtkm::cont::internal::Buffer > &  buffers)
inline

Special constructor for subclass specializations that need to set the initial state array. Used when pulling data from other sources.

◆ ArrayHandle() [5/5]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::cont::ArrayHandle< T, StorageTag_ >::ArrayHandle ( std::vector< vtkm::cont::internal::Buffer > &&  buffers)
inlinenoexcept

Special constructor for subclass specializations that need to set the initial state array. Used when pulling data from other sources.

◆ ~ArrayHandle()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::cont::ArrayHandle< T, StorageTag_ >::~ArrayHandle ( )
inline

Destructs an empty ArrayHandle.

Implemented so that it is defined exclusively in the control environment. If there is a separate device for the execution environment (for example, with CUDA), then the automatically generated destructor could be created for all devices, and it would not be valid for all devices.

Member Function Documentation

◆ Allocate() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::Allocate ( vtkm::Id  numberOfValues,
vtkm::CopyFlag  preserve,
vtkm::cont::Token token 
) const
inline

Allocates an array large enough to hold the given number of values.

The allocation may be done on an already existing array. If so, then the data are preserved as best as possible if the preserve flag is set to vtkm::CopyFlag::On. If the preserve flag is set to vtkm::CopyFlag::Off (the default), any existing data could be wiped out.

This method can throw ErrorBadAllocation if the array cannot be allocated or ErrorBadValue if the allocation is not feasible (for example, the array storage is read-only).

◆ Allocate() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::Allocate ( vtkm::Id  numberOfValues,
vtkm::CopyFlag  preserve = vtkm::CopyFlag::Off 
) const
inline

Allocates an array large enough to hold the given number of values.

The allocation may be done on an already existing array. If so, then the data are preserved as best as possible if the preserve flag is set to vtkm::CopyFlag::On. If the preserve flag is set to vtkm::CopyFlag::Off (the default), any existing data could be wiped out.

This method can throw ErrorBadAllocation if the array cannot be allocated or ErrorBadValue if the allocation is not feasible (for example, the array storage is read-only).

◆ AllocateAndFill() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::AllocateAndFill ( vtkm::Id  numberOfValues,
const ValueType fillValue,
vtkm::CopyFlag  preserve,
vtkm::cont::Token token 
) const
inline

Allocates an array and fills it with an initial value.

AllocateAndFill behaves similar to Allocate except that after allocation it fills the array with a given fillValue. This method is convenient when you wish to initialize the array.

If the preserve flag is vtkm::CopyFlag::On, then any data that existed before the call to AllocateAndFill will remain after the call (assuming the new array size is large enough). If the array size is expanded, then the new values at the end will be filled.

If the preserve flag is vtkm::CopyFlag::Off (the default), the entire array is filled with the given fillValue.

◆ AllocateAndFill() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::AllocateAndFill ( vtkm::Id  numberOfValues,
const ValueType fillValue,
vtkm::CopyFlag  preserve = vtkm::CopyFlag::Off 
) const
inline

Allocates an array and fills it with an initial value.

AllocateAndFill behaves similar to Allocate except that after allocation it fills the array with a given fillValue. This method is convenient when you wish to initialize the array.

If the preserve flag is vtkm::CopyFlag::On, then any data that existed before the call to AllocateAndFill will remain after the call (assuming the new array size is large enough). If the array size is expanded, then the new values at the end will be filled.

If the preserve flag is vtkm::CopyFlag::Off (the default), the entire array is filled with the given fillValue.

◆ DeepCopyFrom()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::DeepCopyFrom ( const vtkm::cont::ArrayHandle< ValueType, StorageTag > &  source) const
inline

Deep copies the data in the array.

Takes the data that is in source and copies that data into this array.

◆ Enqueue()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::Enqueue ( const vtkm::cont::Token token) const
inline

Enqueue a token for access to this ArrayHandle.

This method places the given Token into the queue of Tokens waiting for access to this ArrayHandle and then returns immediately. When this token is later used to get data from this ArrayHandle (for example, in a call to PrepareForInput), it will use this place in the queue while waiting for access.

This method is to be used to ensure that a set of accesses to an ArrayHandle that happen on multiple threads occur in a specified order. For example, if you spawn of a job to modify data in an ArrayHandle and then spawn off a job that reads that same data, you need to make sure that the first job gets access to the ArrayHandle before the second. If they both just attempt to call their respective Prepare methods, there is no guarantee which order they will occur. Having the spawning thread first call this method will ensure the order.

Warning
After calling this method it is required to subsequently call a method like one of the Prepare methods that attaches the token to this ArrayHandle. Otherwise, the enqueued token will block any subsequent access to the ArrayHandle, even if the Token is destroyed.

◆ Fill() [1/3]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::Fill ( const ValueType fillValue,
vtkm::Id  startIndex,
vtkm::Id  endIndex 
) const
inline

Fills the array with a given value.

After calling this method, every entry in the array from startIndex to endIndex. of the array is set to fillValue. If startIndex or endIndex is not specified, then the fill happens from the begining or end, respectively.

◆ Fill() [2/3]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::Fill ( const ValueType fillValue,
vtkm::Id  startIndex,
vtkm::Id  endIndex,
vtkm::cont::Token token 
) const
inline

Fills the array with a given value.

After calling this method, every entry in the array from startIndex to endIndex. of the array is set to fillValue. If startIndex or endIndex is not specified, then the fill happens from the begining or end, respectively.

◆ Fill() [3/3]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::Fill ( const ValueType fillValue,
vtkm::Id  startIndex = 0 
) const
inline

Fills the array with a given value.

After calling this method, every entry in the array from startIndex to endIndex. of the array is set to fillValue. If startIndex or endIndex is not specified, then the fill happens from the begining or end, respectively.

◆ GetBuffers() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT std::vector<vtkm::cont::internal::Buffer>& vtkm::cont::ArrayHandle< T, StorageTag_ >::GetBuffers ( )
inline

◆ GetBuffers() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
const VTKM_CONT std::vector<vtkm::cont::internal::Buffer>& vtkm::cont::ArrayHandle< T, StorageTag_ >::GetBuffers ( ) const
inline

Returns the internal Buffer structures that hold the data.

Note that great care should be taken when modifying buffers outside of the ArrayHandle.

◆ GetNumberOfValues()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::Id vtkm::cont::ArrayHandle< T, StorageTag_ >::GetNumberOfValues ( ) const
inline

Returns the number of entries in the array.

◆ GetStorage()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT StorageType vtkm::cont::ArrayHandle< T, StorageTag_ >::GetStorage ( ) const
inline

Get the storage.

◆ IsOnDevice()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT bool vtkm::cont::ArrayHandle< T, StorageTag_ >::IsOnDevice ( vtkm::cont::DeviceAdapterId  device) const
inline

Returns true if the ArrayHandle's data is on the given device.

If the data are on the given device, then preparing for that device should not require any data movement.

◆ IsOnHost()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT bool vtkm::cont::ArrayHandle< T, StorageTag_ >::IsOnHost ( ) const
inline

Returns true if the ArrayHandle's data is on the host.

If the data are on the given device, then calling ReadPortal or WritePortal should not require any data movement.

◆ operator!=() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT bool vtkm::cont::ArrayHandle< T, StorageTag_ >::operator!= ( const ArrayHandle< ValueType, StorageTag > &  rhs) const
inline

◆ operator!=() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
template<typename VT , typename ST >
VTKM_CONT bool vtkm::cont::ArrayHandle< T, StorageTag_ >::operator!= ( const ArrayHandle< VT, ST > &  ) const
inline

◆ operator=() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::cont::ArrayHandle<ValueType, StorageTag>& vtkm::cont::ArrayHandle< T, StorageTag_ >::operator= ( const vtkm::cont::ArrayHandle< ValueType, StorageTag > &  src)
inline

Copies an ArrayHandle.

◆ operator=() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT vtkm::cont::ArrayHandle<ValueType, StorageTag>& vtkm::cont::ArrayHandle< T, StorageTag_ >::operator= ( vtkm::cont::ArrayHandle< ValueType, StorageTag > &&  src)
inlinenoexcept

Move and Assignment of an ArrayHandle.

◆ operator==() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT bool vtkm::cont::ArrayHandle< T, StorageTag_ >::operator== ( const ArrayHandle< ValueType, StorageTag > &  rhs) const
inline

Like a pointer, two ArrayHandles are considered equal if they point to the same location in memory.

◆ operator==() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
template<typename VT , typename ST >
VTKM_CONT bool vtkm::cont::ArrayHandle< T, StorageTag_ >::operator== ( const ArrayHandle< VT, ST > &  ) const
inline

◆ PrepareForInPlace()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT WritePortalType vtkm::cont::ArrayHandle< T, StorageTag_ >::PrepareForInPlace ( vtkm::cont::DeviceAdapterId  device,
vtkm::cont::Token token 
) const
inline

Prepares this array to be used in an in-place operation (both as input and output) in the execution environment.

If necessary, copies data to the execution environment. Can throw an exception if this array does not yet contain any data. Returns a portal that can be used in code running in the execution environment.

The Token object provided will be attached to this ArrayHandle. The returned portal is guaranteed to be valid while the Token is still attached and in scope. Other operations on this ArrayHandle that would invalidate the returned portal will block until the Token is released. Likewise, this method will block if another Token is already attached. This can potentially lead to deadlocks.

◆ PrepareForInput()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT ReadPortalType vtkm::cont::ArrayHandle< T, StorageTag_ >::PrepareForInput ( vtkm::cont::DeviceAdapterId  device,
vtkm::cont::Token token 
) const
inline

Prepares this array to be used as an input to an operation in the execution environment.

If necessary, copies data to the execution environment. Can throw an exception if this array does not yet contain any data. Returns a portal that can be used in code running in the execution environment.

The Token object provided will be attached to this ArrayHandle. The returned portal is guaranteed to be valid while the Token is still attached and in scope. Other operations on this ArrayHandle that would invalidate the returned portal will block until the Token is released. Likewise, this method will block if another Token is already attached. This can potentially lead to deadlocks.

◆ PrepareForOutput()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT WritePortalType vtkm::cont::ArrayHandle< T, StorageTag_ >::PrepareForOutput ( vtkm::Id  numberOfValues,
vtkm::cont::DeviceAdapterId  device,
vtkm::cont::Token token 
) const
inline

Prepares (allocates) this array to be used as an output from an operation in the execution environment.

The internal state of this class is set to have valid data in the execution array with the assumption that the array will be filled soon (i.e. before any other methods of this object are called). Returns a portal that can be used in code running in the execution environment.

The Token object provided will be attached to this ArrayHandle. The returned portal is guaranteed to be valid while the Token is still attached and in scope. Other operations on this ArrayHandle that would invalidate the returned portal will block until the Token is released. Likewise, this method will block if another Token is already attached. This can potentially lead to deadlocks.

◆ ReadPortal() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT ReadPortalType vtkm::cont::ArrayHandle< T, StorageTag_ >::ReadPortal ( ) const
inline

Get an array portal that can be used in the control environment.

The returned array can be used in the control environment to read values from the array. (It is not possible to write to the returned portal. That is Get will work on the portal, but Set will not.)

Note: The returned portal cannot be used in the execution environment. This is because the portal will not work on some devices like GPUs. To get a portal that will work in the execution environment, use PrepareForInput.

◆ ReadPortal() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT ReadPortalType vtkm::cont::ArrayHandle< T, StorageTag_ >::ReadPortal ( vtkm::cont::Token token) const
inline

Get an array portal that can be used in the control environment.

The returned array can be used in the control environment to read values from the array. (It is not possible to write to the returned portal. That is Get will work on the portal, but Set will not.)

Note: The returned portal cannot be used in the execution environment. This is because the portal will not work on some devices like GPUs. To get a portal that will work in the execution environment, use PrepareForInput.

◆ ReleaseResources()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::ReleaseResources ( ) const
inline

Releases all resources in both the control and execution environments.

◆ ReleaseResourcesExecution()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::ReleaseResourcesExecution ( ) const
inline

Releases any resources being used in the execution environment (that are not being shared by the control environment).

◆ SetBuffer()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::SetBuffer ( vtkm::IdComponent  index,
const vtkm::cont::internal::Buffer &  buffer 
)
inlineprotected

◆ SetBuffers() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::SetBuffers ( const std::vector< vtkm::cont::internal::Buffer > &  buffers)
inlineprotected

◆ SetBuffers() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::SetBuffers ( std::vector< vtkm::cont::internal::Buffer > &&  buffers)
inlineprotected

◆ SyncControlArray()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT void vtkm::cont::ArrayHandle< T, StorageTag_ >::SyncControlArray ( ) const
inline

Synchronizes the control array with the execution array.

If either the user array or control array is already valid, this method does nothing (because the data is already available in the control environment). Although the internal state of this class can change, the method is declared const because logically the data does not.

◆ VTKM_STATIC_ASSERT_MSG()

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
vtkm::cont::ArrayHandle< T, StorageTag_ >::VTKM_STATIC_ASSERT_MSG ( (internal::IsValidArrayHandle< T, StorageTag_ >::value)  ,
"Attempted to create an ArrayHandle< T, StorageTag_ > with an invalid type/storage combination."   
)
private

◆ WritePortal() [1/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT WritePortalType vtkm::cont::ArrayHandle< T, StorageTag_ >::WritePortal ( ) const
inline

Get an array portal that can be used in the control environment.

The returned array can be used in the control environment to reand and write values to the array.

Note: The returned portal cannot be used in the execution environment. This is because the portal will not work on some devices like GPUs. To get a portal that will work in the execution environment, use PrepareForInput.

◆ WritePortal() [2/2]

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
VTKM_CONT WritePortalType vtkm::cont::ArrayHandle< T, StorageTag_ >::WritePortal ( vtkm::cont::Token token) const
inline

Member Data Documentation

◆ Buffers

template<typename T , typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
std::vector<vtkm::cont::internal::Buffer> vtkm::cont::ArrayHandle< T, StorageTag_ >::Buffers
mutableprivate

The documentation for this class was generated from the following file: