|
Celeritas 0.7.0-dev.300+develop.32ea7d6f
|
Store all state data for a single thread. More...
#include <CoreState.hh>

Public Types | |
Type aliases | |
| template<template< Ownership, MemSpace > class S> | |
| using | StateRef = S< Ownership::reference, M > |
| using | Ref = StateRef< CoreStateData > |
| using | Ptr = ObserverPtr< Ref, M > |
Public Types inherited from celeritas::optical::CoreStateBase | |
| using | SPAuxStateVec = std::shared_ptr< AuxStateVec > |
Public Types inherited from celeritas::optical::CoreStateInterface | |
| using | size_type = TrackSlotId::size_type |
Public Types inherited from celeritas::AuxStateInterface | |
| using | SPState = std::shared_ptr< AuxStateInterface > |
| Default destructor. | |
Public Member Functions | |
| CoreState (CoreParams const ¶ms, StreamId stream_id, size_type num_track_slots) | |
| Construct from CoreParams. | |
| StreamId | stream_id () const final |
| Thread/stream ID. | |
| size_type | size () const final |
| Number of track slots. | |
| CoreStateCounters | sync_get_counters () const final |
| Synchronize and copy track initialization counters from device to host. | |
| void | sync_put_counters (CoreStateCounters const &) final |
| Synchronize and copy track initialization counters from host to device For host-only code, this copies the local CoreStateCounters back to the class, since sync_get_counters() doesn't return a reference. | |
| bool | warming_up () const |
| Whether the state is being transported with no active particles. | |
| Ref & | ref () |
| Get a reference to the mutable state data. | |
| Ref const & | ref () const |
| Get a reference to the mutable state data. | |
| Ptr | ptr () |
| Get a native-memspace pointer to the mutable state data. | |
| void | reset () |
| Reset the state data. | |
| void | reseed (std::shared_ptr< RngParams const >, UniqueEventId) final |
| Reseed RNGs at the start of an event for reproducibility. | |
| void | insert_primaries (Span< TrackInitializer const > host_primaries) final |
| Inject primaries to be turned into TrackInitializers. | |
Public Member Functions inherited from celeritas::optical::CoreStateBase | |
| CounterAccumStats const & | accum () const |
| Optical loop statistics. | |
| CounterAccumStats & | accum () |
| Optical loop statistics. | |
| SPAuxStateVec const & | aux () const |
| Access auxiliary core state data. | |
| SPAuxStateVec & | aux () |
| Access auxiliary core state data (mutable) | |
Public Member Functions inherited from celeritas::optical::CoreStateInterface | |
| ~CoreStateInterface () override | |
| Support polymorphic deletion, anchoring to avoid bugs. | |
Public Member Functions inherited from celeritas::AuxStateInterface | |
| virtual | ~AuxStateInterface () |
| Default destructor. | |
Additional Inherited Members | |
Protected Member Functions inherited from celeritas::optical::CoreStateBase | |
| ~CoreStateBase () override | |
| Default destructor, anchoring to avoid bugs. | |
Protected Member Functions inherited from celeritas::optical::CoreStateInterface | |
| CoreStateInterface (CoreStateInterface const &)=default | |
| CoreStateInterface & | operator= (CoreStateInterface const &)=default |
| CoreStateInterface (CoreStateInterface &&)=default | |
| CoreStateInterface & | operator= (CoreStateInterface &&)=default |
Protected Member Functions inherited from celeritas::AuxStateInterface | |
| AuxStateInterface ()=default | |
| AuxStateInterface (AuxStateInterface const &)=default | |
| Default destructor. | |
| AuxStateInterface & | operator= (AuxStateInterface const &)=default |
| Default destructor. | |
| AuxStateInterface (AuxStateInterface &&)=default | |
| Default destructor. | |
| AuxStateInterface & | operator= (AuxStateInterface &&)=default |
| Default destructor. | |
Store all state data for a single thread.
When the state lives on the device, we maintain a separate copy of the device "ref" in device memory: otherwise we'd have to copy the entire state in launch arguments and access it through constant memory.
|
finalvirtual |
Inject primaries to be turned into TrackInitializers.
These will be converted by the ProcessPrimaries action.
Implements celeritas::optical::CoreStateInterface.
|
finalvirtual |
Reseed RNGs at the start of an event for reproducibility.
This reinitializes the RNG states using a single seed and unique subsequence for each thread. It ensures that given an event identification, the random number sequence for the event (and thus the event's behavior) can be reproduced.
Implements celeritas::optical::CoreStateInterface.
| void celeritas::optical::CoreState< M >::reset | ( | ) |
Reset the state data.
This clears the state counters and initializes the necessary state data so the state can be reused for the next step in the core stepping loop. This should only be necessary if the previous event aborted early.
|
inlinefinalvirtual |
Number of track slots.
Implements celeritas::optical::CoreStateInterface.
|
inlinefinalvirtual |
Thread/stream ID.
Implements celeritas::optical::CoreStateInterface.
|
finalvirtual |
Synchronize and copy track initialization counters from device to host.
Copy the core state counters from the device to the host.
For host-only code, the counters reside on the host, so this just returns a CoreStateCounters object. Note that it does not return a reference, so sync_put_counters() must be used if any counters change.
Implements celeritas::optical::CoreStateInterface.
|
finalvirtual |
Synchronize and copy track initialization counters from host to device For host-only code, this copies the local CoreStateCounters back to the class, since sync_get_counters() doesn't return a reference.
Copy the core state counters from the host to the device.
For host-only code, this function copies a CoreStateCounter object into the CoreState object, which is needed when any of the counters change, because sync_get_counters() doesn't return a reference.
Implements celeritas::optical::CoreStateInterface.
| bool celeritas::optical::CoreState< M >::warming_up | ( | ) | const |
Whether the state is being transported with no active particles.
The warmup stage is useful for profiling and debugging since the first step iteration can do the following: