Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:27:18

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file accel/IntegrationBase.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 
0011 #include "Types.hh"
0012 
0013 class G4Run;
0014 
0015 namespace celeritas
0016 {
0017 //---------------------------------------------------------------------------//
0018 struct SetupOptions;
0019 class CoreStateInterface;
0020 class CoreParams;
0021 
0022 //---------------------------------------------------------------------------//
0023 /*!
0024  * Common interface for integrating Celeritas into user applications.
0025  *
0026  * This implements common functionality for the Celeritas integration classes.
0027  * The \c GetParams and \c GetState methods may only be used during a run with
0028  * Celeritas offloading enabled. It cannot be accessed before the run manager
0029  * is created (this requirement may be relaxed in the future).
0030  *
0031  * \sa celeritas::UserActionIntegration
0032  * \sa celeritas::TrackingManagerIntegration
0033  *
0034  * \note For developers: this and the integration daughters all share common
0035  * data in \c detail::IntegrationSingleton.
0036  */
0037 class IntegrationBase
0038 {
0039   public:
0040     // Access whether celeritas is set up, enabled, or uninitialized
0041     OffloadMode GetMode() const;
0042 
0043     // Set options before starting the run
0044     void SetOptions(SetupOptions&& opts);
0045 
0046     // REMOVE in v0.7
0047     [[deprecated]] void BuildForMaster() {}
0048 
0049     // REMOVE in v0.7
0050     [[deprecated]] void Build() {}
0051 
0052     // Start the run
0053     virtual void BeginOfRunAction(G4Run const* run) = 0;
0054 
0055     // End the run
0056     void EndOfRunAction(G4Run const* run);
0057 
0058     //// ACCESSORS ////
0059 
0060     // Access Celeritas shared params
0061     CoreParams const& GetParams();
0062 
0063     // Access THREAD-LOCAL Celeritas core state data for user diagnostics
0064     CoreStateInterface& GetState();
0065 
0066   protected:
0067     IntegrationBase();
0068     ~IntegrationBase() = default;
0069     CELER_DEFAULT_COPY_MOVE(IntegrationBase);
0070 };
0071 
0072 //---------------------------------------------------------------------------//
0073 }  // namespace celeritas