Celeritas
0.5.0-56+6b053cd
|
Helper class for storing Collection classes on host or device. More...
#include <CollectionStateStore.hh>
Public Types | |
Type aliases | |
using | Value = S< Ownership::value, M > |
using | Ref = S< Ownership::reference, M > |
using | size_type = TrackSlotId::size_type |
Public Member Functions | |
template<template< Ownership, MemSpace > class P> | |
CollectionStateStore (HostCRef< P > const &p, StreamId stream_id, size_type size) | |
Construct from parameter data. More... | |
template<template< Ownership, MemSpace > class P> | |
CollectionStateStore (HostCRef< P > const &p, size_type size) | |
Construct from parameter data. More... | |
CollectionStateStore (size_type size) | |
Construct without parameters. More... | |
CollectionStateStore (S< Ownership::value, M > &&other) | |
Construct from values by capture. | |
template<Ownership W2, MemSpace M2> | |
CollectionStateStore (S< W2, M2 > const &other) | |
Construct from a state. | |
template<Ownership W2, MemSpace M2> | |
CollectionStateStore & | operator= (S< W2, M2 > const &other) |
CELER_DEFAULT_MOVE_DELETE_COPY (CollectionStateStore) | |
Default move, delete copy (since ref "points to" val) | |
operator bool () const | |
Whether any data is being stored. | |
size_type | size () const |
Number of elements. | |
Ref & | ref () |
Get a reference to the mutable state data. | |
Ref const & | ref () const |
Get a reference to the mutable state data. | |
template<Ownership W2, MemSpace M2> | |
auto | operator= (S< W2, M2 > const &other) -> CollectionStateStore< S, M > & |
Copy assign from a state. | |
Helper class for storing Collection classes on host or device.
This can be used for unit tests (MemSpace is host) as well as production code. States generally shouldn't be copied between host and device, so the only "production use case" construction argument is the size. Other constructors are implemented for convenience in unit tests.
The State class must be templated on ownership and memory space, and additionally must have an operator bool(), a templated operator=, and a size() accessor. It must also define a free function "resize" that takes:
Ownership::value
semanticsOwnership::const_reference
instance of MemSpace::host
params dataStreamId
for setting up thread/task-local datasize_type
for specifying the size of the new state.
|
inline |
Construct from parameter data.
Most states are constructed with a resize
function that takes host parameter data and the number of states.
|
inline |
Construct from parameter data.
Most states are constructed with a resize
function that takes host parameter data and the number of states.
|
inlineexplicit |
Construct without parameters.
A few states are constructed with a resize
function that doesn't depend on any parameter data.