File indexing completed on 2025-01-18 09:59:03
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 Default
0061 };
0062
0063
0064
0065 class G4RunManagerFactory
0066 {
0067 public:
0068 static G4RunManager* CreateRunManager(G4RunManagerType _type = G4RunManagerType::Default,
0069 G4VUserTaskQueue* _queue = nullptr,
0070 G4bool fail_if_unavail = true, G4int nthreads = 0);
0071
0072
0073 static G4RunManager* CreateRunManager(G4RunManagerType _type, G4bool fail_if_unavail,
0074 G4int nthreads = 0, G4VUserTaskQueue* _queue = nullptr)
0075 {
0076 return CreateRunManager(_type, _queue, fail_if_unavail, nthreads);
0077 }
0078
0079 static G4RunManager* CreateRunManager(G4RunManagerType _type, G4int nthreads,
0080 G4bool fail_if_unavail = true,
0081 G4VUserTaskQueue* _queue = nullptr)
0082 {
0083 return CreateRunManager(_type, _queue, fail_if_unavail, nthreads);
0084 }
0085
0086
0087 template<typename... Args>
0088 static G4RunManager* CreateRunManager(std::string type, Args&&... args)
0089 {
0090 return CreateRunManager(GetType(type), std::forward<Args>(args)...);
0091 }
0092
0093 static std::string GetDefault();
0094 static std::string GetName(G4RunManagerType);
0095 static G4RunManagerType GetType(const std::string&);
0096 static std::set<std::string> GetOptions();
0097 static G4RunManager* GetMasterRunManager();
0098 static G4MTRunManager* GetMTMasterRunManager();
0099 static G4RunManagerKernel* GetMasterRunManagerKernel();
0100 };
0101
0102 #endif