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

Construct and manage portable dynamic data. More...

#include <AuxParams.hh>

Inheritance diagram for celeritas::AuxParams< P, S >:
Inheritance graph
[legend]

Public Types

Type aliases
template<MemSpace M>
using StateRefT = S< Ownership::reference, M >
 
- Public Types inherited from celeritas::AuxParamsInterface
using UPState = std::unique_ptr< AuxStateInterface >
 Default destructor.
 
- Public Types inherited from celeritas::ParamsDataInterface< P >
using HostRef = HostCRef< P >
 
using DeviceRef = DeviceCRef< P >
 

Public Member Functions

UPState create_state (MemSpace, StreamId, size_type size) const final
 Build a multithread state for a stream.
 
template<MemSpace M>
StateRefT< M > conststate_ref (AuxStateVec const &v) const
 
template<MemSpace M>
StateRefT< M > & state_ref (AuxStateVec &v) const
 
template<MemSpace M>
auto state_ref (AuxStateVec const &v) const -> StateRefT< M > const &
 Access the state ref (const).
 
template<MemSpace M>
auto state_ref (AuxStateVec &v) const -> StateRefT< M > &
 Access the state ref (mutable).
 
- Public Member Functions inherited from celeritas::AuxParamsInterface
virtual ~AuxParamsInterface ()
 Default destructor.
 
virtual AuxId aux_id () const =0
 Index of this class instance in its registry.
 
virtual std::string_view label () const =0
 Label for the auxiliary data.
 
- Public Member Functions inherited from celeritas::ParamsDataInterface< P >
virtual HostRef consthost_ref () const =0
 Reference CPU geometry data.
 
virtual DeviceRef constdevice_ref () const =0
 Reference managed GPU geometry data.
 
template<MemSpace M>
P< Ownership::const_reference, M > constref () const
 
template<MemSpace M>
P< Ownership::const_reference, M > constref () const
 Dispatch a "ref" call to host or device data.
 

Additional Inherited Members

- Protected Member Functions inherited from celeritas::AuxParamsInterface
 AuxParamsInterface ()=default
 
 CELER_DEFAULT_COPY_MOVE (AuxParamsInterface)
 Default destructor.
 
- Protected Member Functions inherited from celeritas::ParamsDataInterface< P >
 CELER_DEFAULT_COPY_MOVE (ParamsDataInterface)
 

Detailed Description

template<template< Ownership, MemSpace > class P, template< Ownership, MemSpace > class S>
class celeritas::AuxParams< P, S >

Construct and manage portable dynamic data.

Template Parameters
PParams collection group
SState collection group

This generalization of the Celeritas data model (api_data_model in user manual) manages some of the boilerplate code for the common use case of having portable "params" data (e.g., model data) and "state" data (e.g., temporary values used across multiple kernels or processed into user space). Each state/stream will have an instance of AuxState accessible by this class. An instance of this class can be shared among multiple actions, or an action could inherit from it. 

Example:
The StepParams inherits from this class to provide access to host and state data. The execution inside StepGatherAction provides views to both the params and state data classes:
// Extract the local step state data
auto const& step_params = params_->ref<MemSpace::native>();
auto& step_state = params_->ref<MemSpace::native>(state.aux());
// Run the action
auto execute = TrackExecutor{
params.ptr<MemSpace::native>(),
state.ptr(),
detail::StepGatherExecutor<P>{step_params, step_state}};
Call a CoreTrackView executor for a given ThreadId.
Definition TrackExecutor.hh:51
Note
For the case where the aux state data contains host-side classes and data (e.g., an open file handle) you must manually set up the params/state data using AuxStateInterface and AuxParamsInterface .

Member Function Documentation

◆ create_state()

auto celeritas::AuxParams< P, S >::create_state ( MemSpace  m,
StreamId  sid,
size_type  size 
) const
inlinefinalvirtual

Build a multithread state for a stream.

See AuxState .

Implements celeritas::AuxParamsInterface.


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