Celeritas 0.7.0-dev.205+develop.57aed2a38
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
celeritas::LocalTransporter Class Referencefinal

Manage offloading of tracks to Celeritas. More...

#include <LocalTransporter.hh>

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

Public Member Functions

 LocalTransporter (SetupOptions const &options, SharedParams &params)
 Construct with shared (MT) params.
 
void Push (G4Track &)
 Convert a Geant4 track to a Celeritas primary and add to buffer.
 
void SetEventId (int id)
 
CoreStateInterface constGetState () const
 Access core state data for user diagnostics.
 
CoreStateInterfaceGetState ()
 Access core state data for user diagnostics.
 
 operator bool () const
 Whether the class instance is initialized.
 
LocalOffload interface
void Initialize (SetupOptions const &options, SharedParams &params) final
 Helper for making initialization more obvious from user code.
 
void InitializeEvent (int) final
 Set the event ID and reseed the Celeritas RNG at the start of an event.
 
void Flush () final
 Transport the buffered tracks and all secondaries produced.
 
void Finalize () final
 Clear local data.
 
bool Initialized () const final
 Helper for making initialization more obvious from user code.
 
size_type GetBufferSize () const final
 Helper for making initialization more obvious from user code.
 
MapStrDbl GetActionTime () const final
 Get the accumulated action times.
 
- Public Member Functions inherited from celeritas::LocalOffloadInterface
 operator bool () const
 Whether the class instance is initialized.
 

Additional Inherited Members

- Public Types inherited from celeritas::LocalOffloadInterface
using MapStrDbl = std::unordered_map< std::string, double >
 
- Protected Member Functions inherited from celeritas::LocalOffloadInterface
 CELER_DEFAULT_COPY_MOVE (LocalOffloadInterface)
 

Detailed Description

Manage offloading of tracks to Celeritas.

This class must be constructed locally on each worker thread/task/stream, usually as a shared pointer that's accessible to:

Warning
Due to Geant4 thread-local allocators, this class must be finalized or destroyed on the same CPU thread in which is created and used!
Todo:
Rename LocalOffload or something?

Member Function Documentation

◆ Finalize()

void celeritas::LocalTransporter::Finalize ( )
finalvirtual

Clear local data.

This may need to be executed on the same thread it was created in order to safely deallocate some Geant4 objects under the hood...

Implements celeritas::LocalOffloadInterface.

◆ Flush()

void celeritas::LocalTransporter::Flush ( )
finalvirtual

Transport the buffered tracks and all secondaries produced.

Abort cleanly for interrupt and user-defined (i.e., job manager) signals.

Todo:
The signal handler is not thread safe. We may need to set an atomic/volatile bit so all local transporters abort.

Implements celeritas::LocalOffloadInterface.

◆ GetActionTime()

auto celeritas::LocalTransporter::GetActionTime ( ) const
finalvirtual

Get the accumulated action times.

Implements celeritas::LocalOffloadInterface.

◆ GetBufferSize()

size_type celeritas::LocalTransporter::GetBufferSize ( ) const
inlinefinalvirtual

Helper for making initialization more obvious from user code.

This gives it some symmetry with Finalize, which is provided as an exception-friendly destructor.

Implements celeritas::LocalOffloadInterface.

◆ Initialize()

void celeritas::LocalTransporter::Initialize ( SetupOptions const options,
SharedParams params 
)
inlinefinalvirtual

Helper for making initialization more obvious from user code.

This gives it some symmetry with Finalize, which is provided as an exception-friendly destructor.

Implements celeritas::LocalOffloadInterface.

◆ Initialized()

bool celeritas::LocalTransporter::Initialized ( ) const
inlinefinalvirtual

Helper for making initialization more obvious from user code.

This gives it some symmetry with Finalize, which is provided as an exception-friendly destructor.

Implements celeritas::LocalOffloadInterface.

◆ InitializeEvent()

void celeritas::LocalTransporter::InitializeEvent ( int  id)
finalvirtual

Set the event ID and reseed the Celeritas RNG at the start of an event.

Implements celeritas::LocalOffloadInterface.

◆ Push()

void celeritas::LocalTransporter::Push ( G4Track g4track)

Convert a Geant4 track to a Celeritas primary and add to buffer.

Todo:
Eliminate event ID from primary.

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