Celeritas  0.5.0-56+6b053cd
Public Member Functions | List of all members
celeritas::CollectionStateStore< S, M > Class Template Reference

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>
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 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.
 

Detailed Description

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

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:

CollectionStateStore<ParticleStateData, MemSpace::device> pstates(
*particle_params, num_tracks);
state_data.particle = pstates.ref();

Constructor & Destructor Documentation

◆ CollectionStateStore() [1/3]

template<template< Ownership, MemSpace > class S, MemSpace M>
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/3]

template<template< Ownership, MemSpace > class S, MemSpace M>
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/3]

template<template< Ownership, MemSpace > class S, MemSpace M>
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: