Viskores  1.0
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
viskores::cont::BitField Class Reference

#include <BitField.h>

Classes

struct  ExecutionTypes
 

Public Types

using WritePortalType = detail::BitPortal
 The BitPortal used in the control environment. More...
 
using ReadPortalType = detail::BitPortalConst
 A read-only BitPortal used in the control environment. More...
 
using WordTypePreferred = viskores::AtomicTypePreferred
 
template<typename WordType >
using IsValidWordType = detail::BitFieldTraits::IsValidWordType< WordType >
 Check whether a word type is valid for non-atomic operations. More...
 
template<typename WordType , typename Device = void>
using IsValidWordTypeAtomic = detail::BitFieldTraits::IsValidWordTypeAtomic< WordType >
 Check whether a word type is valid for atomic operations. More...
 

Public Member Functions

 BitField ()
 
 BitField (const BitField &)=default
 
 BitField (BitField &&) noexcept=default
 
 ~BitField ()=default
 
BitFieldoperator= (const BitField &)=default
 
BitFieldoperator= (BitField &&) noexcept=default
 
bool operator== (const BitField &rhs) const
 
bool operator!= (const BitField &rhs) const
 
viskores::cont::internal::Buffer GetBuffer () const
 Return the internal Buffer used to store the BitField. More...
 
viskores::Id GetNumberOfBits () const
 Return the number of bits stored by this BitField. More...
 
template<typename WordType >
viskores::Id GetNumberOfWords () const
 Return the number of words (of WordType) stored in this bit fields. More...
 
void Allocate (viskores::Id numberOfBits, viskores::CopyFlag preserve, viskores::cont::Token &token) const
 Allocate the requested number of bits. More...
 
void Allocate (viskores::Id numberOfBits, viskores::CopyFlag preserve=viskores::CopyFlag::Off) const
 Allocate the requested number of bits. More...
 
template<typename ValueType >
void AllocateAndFill (viskores::Id numberOfBits, ValueType value, viskores::cont::Token &token) const
 Allocate the requested number of bits and fill with the requested bit or word. More...
 
template<typename ValueType >
void AllocateAndFill (viskores::Id numberOfBits, ValueType value) const
 
template<typename WordType >
void Fill (WordType word, viskores::cont::Token &token) const
 Set subsequent words to the given word of bits. More...
 
template<typename WordType >
void Fill (WordType word) const
 
void Fill (bool value, viskores::cont::Token &token) const
 Set all the bits to the given value. More...
 
void Fill (bool value) const
 
void ReleaseResourcesExecution ()
 Release all execution-side resources held by this BitField. More...
 
void ReleaseResources ()
 Release all resources held by this BitField and reset to empty. More...
 
void SyncControlArray () const
 Force the control array to sync with the last-used device. More...
 
bool IsOnDevice (viskores::cont::DeviceAdapterId device) const
 Returns true if the BitField's data is on the given device. More...
 
bool IsOnHost () const
 Returns true if the BitField's data is on the host. More...
 
WritePortalType WritePortal () const
 Get a portal to the data that is usable from the control environment. More...
 
ReadPortalType ReadPortal () const
 Get a read-only portal to the data that is usable from the control environment. More...
 
ReadPortalType PrepareForInput (viskores::cont::DeviceAdapterId device, viskores::cont::Token &token) const
 Prepares this BitField to be used as an input to an operation in the execution environment. More...
 
WritePortalType PrepareForOutput (viskores::Id numBits, viskores::cont::DeviceAdapterId device, viskores::cont::Token &token) const
 Prepares (allocates) this BitField to be used as an output from an operation in the execution environment. More...
 
WritePortalType PrepareForInPlace (viskores::cont::DeviceAdapterId device, viskores::cont::Token &token) const
 Prepares this BitField to be used in an in-place operation (both as input and output) in the execution environment. More...
 

Private Member Functions

void FillImpl (const void *word, viskores::BufferSizeType wordSize, viskores::cont::Token &token) const
 

Private Attributes

viskores::cont::internal::Buffer Buffer
 

Static Private Attributes

static constexpr viskores::Id BlockSize = detail::BitFieldTraits::BlockSize
 

Member Typedef Documentation

◆ IsValidWordType

template<typename WordType >
using viskores::cont::BitField::IsValidWordType = detail::BitFieldTraits::IsValidWordType<WordType>

Check whether a word type is valid for non-atomic operations.

◆ IsValidWordTypeAtomic

template<typename WordType , typename Device = void>
using viskores::cont::BitField::IsValidWordTypeAtomic = detail::BitFieldTraits::IsValidWordTypeAtomic<WordType>

Check whether a word type is valid for atomic operations.

◆ ReadPortalType

using viskores::cont::BitField::ReadPortalType = detail::BitPortalConst

A read-only BitPortal used in the control environment.

◆ WordTypePreferred

◆ WritePortalType

using viskores::cont::BitField::WritePortalType = detail::BitPortal

The BitPortal used in the control environment.

Constructor & Destructor Documentation

◆ BitField() [1/3]

viskores::cont::BitField::BitField ( )

◆ BitField() [2/3]

viskores::cont::BitField::BitField ( const BitField )
default

◆ BitField() [3/3]

viskores::cont::BitField::BitField ( BitField &&  )
defaultnoexcept

◆ ~BitField()

viskores::cont::BitField::~BitField ( )
default

Member Function Documentation

◆ Allocate() [1/2]

void viskores::cont::BitField::Allocate ( viskores::Id  numberOfBits,
viskores::CopyFlag  preserve,
viskores::cont::Token token 
) const

Allocate the requested number of bits.

◆ Allocate() [2/2]

void viskores::cont::BitField::Allocate ( viskores::Id  numberOfBits,
viskores::CopyFlag  preserve = viskores::CopyFlag::Off 
) const
inline

Allocate the requested number of bits.

◆ AllocateAndFill() [1/2]

template<typename ValueType >
void viskores::cont::BitField::AllocateAndFill ( viskores::Id  numberOfBits,
ValueType  value 
) const
inline

◆ AllocateAndFill() [2/2]

template<typename ValueType >
void viskores::cont::BitField::AllocateAndFill ( viskores::Id  numberOfBits,
ValueType  value,
viskores::cont::Token token 
) const
inline

Allocate the requested number of bits and fill with the requested bit or word.

◆ Fill() [1/4]

void viskores::cont::BitField::Fill ( bool  value) const
inline

◆ Fill() [2/4]

void viskores::cont::BitField::Fill ( bool  value,
viskores::cont::Token token 
) const
inline

Set all the bits to the given value.

◆ Fill() [3/4]

template<typename WordType >
void viskores::cont::BitField::Fill ( WordType  word) const
inline

◆ Fill() [4/4]

template<typename WordType >
void viskores::cont::BitField::Fill ( WordType  word,
viskores::cont::Token token 
) const
inline

Set subsequent words to the given word of bits.

◆ FillImpl()

void viskores::cont::BitField::FillImpl ( const void *  word,
viskores::BufferSizeType  wordSize,
viskores::cont::Token token 
) const
private

◆ GetBuffer()

viskores::cont::internal::Buffer viskores::cont::BitField::GetBuffer ( ) const
inline

Return the internal Buffer used to store the BitField.

◆ GetNumberOfBits()

viskores::Id viskores::cont::BitField::GetNumberOfBits ( ) const

Return the number of bits stored by this BitField.

◆ GetNumberOfWords()

template<typename WordType >
viskores::Id viskores::cont::BitField::GetNumberOfWords ( ) const
inline

Return the number of words (of WordType) stored in this bit fields.

◆ IsOnDevice()

bool viskores::cont::BitField::IsOnDevice ( viskores::cont::DeviceAdapterId  device) const

Returns true if the BitField'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()

bool viskores::cont::BitField::IsOnHost ( ) const
inline

Returns true if the BitField'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!=()

bool viskores::cont::BitField::operator!= ( const BitField rhs) const
inline

◆ operator=() [1/2]

BitField& viskores::cont::BitField::operator= ( BitField &&  )
defaultnoexcept

◆ operator=() [2/2]

BitField& viskores::cont::BitField::operator= ( const BitField )
default

◆ operator==()

bool viskores::cont::BitField::operator== ( const BitField rhs) const
inline

◆ PrepareForInPlace()

WritePortalType viskores::cont::BitField::PrepareForInPlace ( viskores::cont::DeviceAdapterId  device,
viskores::cont::Token token 
) const

Prepares this BitField 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 BitField does not yet contain any data. Returns a portal that can be used in code running in the execution environment.

◆ PrepareForInput()

ReadPortalType viskores::cont::BitField::PrepareForInput ( viskores::cont::DeviceAdapterId  device,
viskores::cont::Token token 
) const

Prepares this BitField 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 BitField does not yet contain any data. Returns a portal that can be used in code running in the execution environment.

◆ PrepareForOutput()

WritePortalType viskores::cont::BitField::PrepareForOutput ( viskores::Id  numBits,
viskores::cont::DeviceAdapterId  device,
viskores::cont::Token token 
) const

Prepares (allocates) this BitField 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 BitField 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.

◆ ReadPortal()

ReadPortalType viskores::cont::BitField::ReadPortal ( ) const

Get a read-only portal to the data that is usable from the control environment.

As long as this portal is in scope, no one else will be able to write in the BitField.

◆ ReleaseResources()

void viskores::cont::BitField::ReleaseResources ( )

Release all resources held by this BitField and reset to empty.

◆ ReleaseResourcesExecution()

void viskores::cont::BitField::ReleaseResourcesExecution ( )

Release all execution-side resources held by this BitField.

◆ SyncControlArray()

void viskores::cont::BitField::SyncControlArray ( ) const

Force the control array to sync with the last-used device.

◆ WritePortal()

WritePortalType viskores::cont::BitField::WritePortal ( ) const

Get a portal to the data that is usable from the control environment.

As long as this portal is in scope, no one else will be able to read or write the BitField.

Member Data Documentation

◆ BlockSize

constexpr viskores::Id viskores::cont::BitField::BlockSize = detail::BitFieldTraits::BlockSize
staticconstexprprivate

◆ Buffer

viskores::cont::internal::Buffer viskores::cont::BitField::Buffer
mutableprivate

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