File indexing completed on 2025-09-18 09:15:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef G4RunManagerFactory_hh
0035 #define G4RunManagerFactory_hh 1
0036
0037 #include "G4MTRunManager.hh"
0038 #include "G4RunManager.hh"
0039 #include "G4TaskRunManager.hh"
0040 #include "G4Types.hh"
0041 #include "G4VUserTaskQueue.hh"
0042
0043 #include <map>
0044 #include <regex>
0045 #include <set>
0046 #include <string>
0047
0048
0049
0050 enum class G4RunManagerType : G4int
0051 {
0052 Serial = 0,
0053 SerialOnly = 1,
0054 MT = 2,
0055 MTOnly = 3,
0056 Tasking = 4,
0057 TaskingOnly = 5,
0058 TBB = 6,
0059 TBBOnly = 7,
0060 SubEvt = 8,
0061 SubEvtOnly = 9,
0062 Default
0063 };
0064
0065
0066
0067 class G4RunManagerFactory
0068 {
0069 public:
0070 static G4RunManager* CreateRunManager(G4RunManagerType _type = G4RunManagerType::Default,
0071 G4VUserTaskQueue* _queue = nullptr,
0072 G4bool fail_if_unavail = true, G4int nthreads = 0);
0073
0074
0075 static G4RunManager* CreateRunManager(G4RunManagerType _type, G4bool fail_if_unavail,
0076 G4int nthreads = 0, G4VUserTaskQueue* _queue = nullptr)
0077 {
0078 return CreateRunManager(_type, _queue, fail_if_unavail, nthreads);
0079 }
0080
0081 static G4RunManager* CreateRunManager(G4RunManagerType _type, G4int nthreads,
0082 G4bool fail_if_unavail = true,
0083 G4VUserTaskQueue* _queue = nullptr)
0084 {
0085 return CreateRunManager(_type, _queue, fail_if_unavail, nthreads);
0086 }
0087
0088
0089 template<typename... Args>
0090 static G4RunManager* CreateRunManager(std::string type, Args&&... args)
0091 {
0092 return CreateRunManager(GetType(type), std::forward<Args>(args)...);
0093 }
0094
0095 static std::string GetDefault();
0096 static std::string GetName(G4RunManagerType);
0097 static G4RunManagerType GetType(const std::string&);
0098 static std::set<std::string> GetOptions();
0099 static G4RunManager* GetMasterRunManager();
0100 static G4MTRunManager* GetMTMasterRunManager();
0101 static G4RunManagerKernel* GetMasterRunManagerKernel();
0102 };
0103
0104 #endif