![]() |
|
|||
File indexing completed on 2025-09-15 08:59:52
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 geocel/GeantUtils.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include "corecel/Config.hh" 0010 0011 #include "corecel/Assert.hh" 0012 0013 class G4ParticleDefinition; 0014 class G4RunManager; 0015 0016 namespace celeritas 0017 { 0018 //---------------------------------------------------------------------------// 0019 // Clear Geant4's signal handlers that get installed when linking 11+ 0020 void disable_geant_signal_handler(); 0021 0022 //---------------------------------------------------------------------------// 0023 // Get the number of threads in a version-portable way 0024 int get_geant_num_threads(G4RunManager const&); 0025 0026 //---------------------------------------------------------------------------// 0027 // Get the number of threads using the global G4 run manager 0028 int get_geant_num_threads(); 0029 0030 //---------------------------------------------------------------------------// 0031 // Get the current thread ID (zero if serial) 0032 int get_geant_thread_id(); 0033 0034 //---------------------------------------------------------------------------// 0035 //! Wrap around a G4ParticleDefinition to get a descriptive output. 0036 struct PrintablePD 0037 { 0038 G4ParticleDefinition const* pd{nullptr}; 0039 }; 0040 0041 // Print the particle definition name and PDG 0042 std::ostream& operator<<(std::ostream& os, PrintablePD const& pd); 0043 0044 //---------------------------------------------------------------------------// 0045 // INLINE DEFINITIONS 0046 //---------------------------------------------------------------------------// 0047 #if !CELERITAS_USE_GEANT4 0048 inline void disable_geant_signal_handler() {} 0049 0050 inline int get_geant_num_threads(G4RunManager const&) 0051 { 0052 CELER_NOT_CONFIGURED("Geant4"); 0053 } 0054 0055 inline int get_geant_num_threads() 0056 { 0057 CELER_NOT_CONFIGURED("Geant4"); 0058 } 0059 0060 inline int get_geant_thread_id() 0061 { 0062 CELER_NOT_CONFIGURED("Geant4"); 0063 } 0064 0065 inline std::ostream& operator<<(std::ostream&, PrintablePD const&) 0066 { 0067 CELER_NOT_CONFIGURED("Geant4"); 0068 } 0069 #endif 0070 //---------------------------------------------------------------------------// 0071 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |