Celeritas  0.5.0-86+4a8eea4
Public Member Functions | Static Public Member Functions | List of all members
celeritas::ActionDiagnostic Class Referencefinal

Tally post-step actions for each particle type. More...

#include <ActionDiagnostic.hh>

Inheritance diagram for celeritas::ActionDiagnostic:
Inheritance graph
[legend]

Public Types

Type aliases
using WPConstActionRegistry = std::weak_ptr< ActionRegistry const >
 
using WPConstParticle = std::weak_ptr< ParticleParams const >
 
using MapStringCount = std::map< std::string, size_type >
 
using VecCount = std::vector< size_type >
 
using VecVecCount = std::vector< VecCount >
 
- Public Types inherited from celeritas::ActionTypeTraits< P, S >
using CoreParams = P
 
using CoreStateHost = S< MemSpace::host >
 
using CoreStateDevice = S< MemSpace::device >
 
using SpanCoreStateHost = Span< S< MemSpace::host > *const >
 
using SpanCoreStateDevice = Span< S< MemSpace::device > *const >
 
- Public Types inherited from celeritas::OutputInterface
enum class  Category {
  input , result , system , internal ,
  size_
}
 Output category (TODO: could replace with string/cstring?)
 

Public Member Functions

 ActionDiagnostic (ActionId id)
 Construct with the action ID. More...
 
 ~ActionDiagnostic () final
 Default destructor.
 
MapStringCount calc_actions_map () const
 Get the nonzero diagnostic results accumulated over all streams. More...
 
VecVecCount calc_actions () const
 Get the diagnostic results accumulated over all streams.
 
size_type state_size () const
 Diagnostic state data size (number of particles times number of actions).
 
void clear ()
 Reset diagnostic results.
 
Action interface

ID of the action

ActionId action_id () const final
 Short name for the action.
 
std::string_view label () const final
 Short name for the action.
 
std::string_view description () const final
 Get a long description of the action.
 
StepActionOrder order () const final
 Dependency ordering of the action.
 
BeginRunAction interface
void begin_run (CoreParams const &, CoreStateHost &) final
 Build the storage for diagnostic parameters and stream-dependent states. More...
 
void begin_run (CoreParams const &, CoreStateDevice &) final
 Build the storage for diagnostic parameters and stream-dependent states. More...
 
ExplicitAction interface
void step (CoreParams const &, CoreStateHost &) const final
 Execute action with host data.
 
void step (CoreParams const &, CoreStateDevice &) const final
 Execute action with device data.
 
Output interface

Category of data to write

Category category () const final
 Write output to the given JSON object.
 
void output (JsonPimpl *) const final
 Write output to the given JSON object.
 
- Public Member Functions inherited from celeritas::StepActionInterface< P, S >
virtual void step (P const &, S< MemSpace::host > &) const =0
 Execute the action with host data.
 
virtual void step (P const &, S< MemSpace::device > &) const =0
 Execute the action with device data.
 
- Public Member Functions inherited from celeritas::ActionInterface
virtual ~ActionInterface () noexcept=0
 Default destructor.
 
- Public Member Functions inherited from celeritas::BeginRunActionInterface< P, S >
virtual void begin_run (P const &, S< MemSpace::host > &)=0
 Set host data at the beginning of a run.
 
virtual void begin_run (P const &, S< MemSpace::device > &)=0
 Set device data at the beginning of a run.
 

Static Public Member Functions

static std::shared_ptr< ActionDiagnosticmake_and_insert (CoreParams const &core)
 Construct and add to core params.
 

Additional Inherited Members

- Protected Member Functions inherited from celeritas::ActionInterface
 ActionInterface ()=default
 
 CELER_DEFAULT_COPY_MOVE (ActionInterface)
 

Detailed Description

Tally post-step actions for each particle type.

This adds an action-diagnostic entry to the result category of the main Celeritas output that has the number of times a post-step action was selected, grouped by particle type. It integrates over all steps and all events.

Constructor & Destructor Documentation

◆ ActionDiagnostic()

celeritas::ActionDiagnostic::ActionDiagnostic ( ActionId  id)
explicit

Construct with the action ID.

Other required attributes are deferred until beginning-of-run.

Member Function Documentation

◆ begin_run() [1/2]

void celeritas::ActionDiagnostic::begin_run ( CoreParams const &  params,
CoreStateDevice &   
)
final

Build the storage for diagnostic parameters and stream-dependent states.

Since the stream store is (currently) lazily constructed, we can call the same begin_run as host.

◆ begin_run() [2/2]

void celeritas::ActionDiagnostic::begin_run ( CoreParams const &  params,
CoreStateHost &   
)
final

Build the storage for diagnostic parameters and stream-dependent states.

This must be done lazily (after construction!) because the action diagnostic will be created before all actions are defined in the ActionRegistry.

◆ calc_actions_map()

auto celeritas::ActionDiagnostic::calc_actions_map ( ) const

Get the nonzero diagnostic results accumulated over all streams.

This builds a map of particle/action combinations to the number of occurrences over all events.


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