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

Print diagnostic output about what's in what slots. More...

#include <SlotDiagnostic.hh>

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

Classes

struct  State
 

Public Member Functions

 SlotDiagnostic (ActionId action_id, AuxId aux_id, std::string filename_base, size_type num_stream, std::shared_ptr< ParticleParams const > particle)
 Construct with IDs and filename base. More...
 
Metadata interface
std::string_view label () const final
 Label for the auxiliary data.
 
std::string_view description () const final
 Description of the action.
 
Step action interface

Index of this class instance in its registry

ActionId action_id () const final
 Index of this class instance in its registry.
 
StepActionOrder order () const final
 Index of this class instance in its registry.
 
void step (CoreParams const &params, CoreStateHost &state) const final
 Execute with with the last action's ID and the state. More...
 
void step (CoreParams const &params, CoreStateDevice &state) const final
 Index of this class instance in its registry.
 
Aux params interface

Index of this class instance in its registry

AuxId aux_id () const final
 Build state data for a stream.
 
UPState create_state (MemSpace m, StreamId id, size_type size) const final
 Build state data for a stream.
 
- 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::AuxParamsInterface
virtual ~AuxParamsInterface ()
 Default destructor.
 

Static Public Member Functions

static std::shared_ptr< SlotDiagnosticmake_and_insert (CoreParams const &core, std::string filename_base)
 Construct and add to core params.
 

Additional Inherited Members

- 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::AuxParamsInterface
using UPState = std::unique_ptr< AuxStateInterface >
 Default destructor.
 
- Protected Member Functions inherited from celeritas::ActionInterface
 ActionInterface ()=default
 
 CELER_DEFAULT_COPY_MOVE (ActionInterface)
 
- Protected Member Functions inherited from celeritas::AuxParamsInterface
 AuxParamsInterface ()=default
 
 CELER_DEFAULT_COPY_MOVE (AuxParamsInterface)
 Default destructor.
 

Detailed Description

Print diagnostic output about what's in what slots.

Currently this only prints the particle ID as a function of track slot, which can later be combined with postprocessing data to print the charge of each particle. We could in the future extend the class to use thread ID and/or write action ID or any other ID/status instead. Special IDs are:

A "JSON lines" file (one line per step) is opened for each stream, and a separate file is opened once during construction to write appropriate metadata.

The filename base is appended with the stream ID or metadata. If the filename is a directory, that directory must already exist. For example, you could pass a filename base of slot-diag- to get filenames slot-diag-metadata.json, slot-diag-0.jsonl, etc.

Todo:
Instead of writing separate files, we should probably use a multi-stream output manager (not yet implemented) to save the result for the end.
Note
To plot the resulting files, see scripts/user/plot-slot-diagnostic.py

Constructor & Destructor Documentation

◆ SlotDiagnostic()

celeritas::SlotDiagnostic::SlotDiagnostic ( ActionId  action_id,
AuxId  aux_id,
std::string  filename_base,
size_type  num_streams,
std::shared_ptr< ParticleParams const >  particle 
)

Construct with IDs and filename base.

This also writes to the "metadata" JSON suffix.

Member Function Documentation

◆ step()

void celeritas::SlotDiagnostic::step ( CoreParams const &  params,
CoreStateHost &  state 
) const
final

Execute with with the last action's ID and the state.

This must be called after both create_state and begin_run .


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