These small examples demonstrate how to offload tracks to Celeritas in a serial or multithreaded environment using:
- A concrete G4UserTrackingAction user action class
- A concrete G4VFastSimulationModel
The :ref:`accel` library is the only part of Celeritas that needs to be understood. The key components are global SetupOptions and SharedParams, coupled to thread-local SimpleOffload and LocalTransporter. The SimpleOffload provides all of the core methods needed to integrate into a Geant4 application's UserActions or other user classes.
.. literalinclude:: ../../../example/accel/CMakeLists.txt :language: cmake :start-at: project( :end-before: END EXAMPLE CODE
The executables are less robust (and minimally documented) versions of the :ref:`celer-g4` app. The use of global variables rather than shared pointers is easier to implement but may be more problematic with experiment frameworks or other apps that use a task-based runner.
.. literalinclude:: ../../../example/accel/simple-offload.cc :start-at: #include
.. literalinclude:: ../../../example/accel/fastsim-offload.cc :start-at: #include