Celeritas 0.7.0-dev.207+develop.58f3b23a7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::CollectionStateStore< S, M > Class Template Reference

Store and reference stateful collection groups on host and 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

 CollectionStateStore ()=default
 The default constructor initializes as empty.
 
template<template< Ownership, MemSpace > class P>
 CollectionStateStore (HostCRef< P > const &p, StreamId stream_id, size_type size)
 Construct from parameter data.
 
template<template< Ownership, MemSpace > class P>
 CollectionStateStore (HostCRef< P > const &p, size_type size)
 Construct from parameter data.
 
 CollectionStateStore (StreamId stream_id, size_type size)
 Construct with stream ID and without parameters.
 
 CollectionStateStore (size_type size)
 Construct without parameters.
 
 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>
CollectionStateStoreoperator= (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 mutable reference to the mutable state data.
 
Ref constref () const
 Get a const reference to the state data.
 
template<Ownership W2, MemSpace M2>
auto operator= (S< W2, M2 > const &other) -> CollectionStateStore< S, M > &
 Copy assign from a state.
 

Detailed Description

template<template< Ownership, MemSpace > class S, MemSpace M>
class celeritas::CollectionStateStore< S, M >

Store and reference stateful collection groups on host and device.

Template Parameters
SState data collection group

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:

Example:
*particle_params, num_tracks);
state_data.particle = pstates.ref();
Store and reference stateful collection groups on host and device.
Definition CollectionStateStore.hh:46
Todo:
Rename StateDataStore

Constructor & Destructor Documentation

◆ CollectionStateStore() [1/4]

template<template< Ownership, MemSpace > class P>
celeritas::CollectionStateStore< S, M >::CollectionStateStore ( HostCRef< P > const p,
StreamId  sid,
size_type  size 
)
inline

Construct from parameter data.

Most states are constructed with a resize function that takes host parameter data and the number of states.

◆ CollectionStateStore() [2/4]

template<template< Ownership, MemSpace > class P>
celeritas::CollectionStateStore< S, M >::CollectionStateStore ( HostCRef< P > const p,
size_type  size 
)
inline

Construct from parameter data.

Most states are constructed with a resize function that takes host parameter data and the number of states.

◆ CollectionStateStore() [3/4]

celeritas::CollectionStateStore< S, M >::CollectionStateStore ( StreamId  sid,
size_type  size 
)
inlineexplicit

Construct with stream ID and without parameters.

A few states are constructed with a resize function that doesn't depend on any parameter data.

◆ CollectionStateStore() [4/4]

celeritas::CollectionStateStore< S, M >::CollectionStateStore ( size_type  size)
inlineexplicit

Construct without parameters.

A few states are constructed with a resize function that doesn't depend on any parameter data.


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