From bf94103cb77178a8f50bf8adff9e6499b4e82da3 Mon Sep 17 00:00:00 2001 From: Anders Kvellestad Date: Tue, 30 Aug 2022 13:08:10 +0200 Subject: [PATCH 1/3] BOSS: Now writing typedefs to a separate header file, backend_types/typedefs.hpp --- Backends/scripts/BOSS/boss.py | 12 +++- Backends/scripts/BOSS/modules/filehandling.py | 59 +++++++++++++++++-- Backends/scripts/BOSS/modules/utils.py | 1 + 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/Backends/scripts/BOSS/boss.py b/Backends/scripts/BOSS/boss.py index 97e0dc5f27..f56605180d 100755 --- a/Backends/scripts/BOSS/boss.py +++ b/Backends/scripts/BOSS/boss.py @@ -286,7 +286,6 @@ def main(): # Check if backend source tree has already been BOSSed. (Look for the backend_undefs.hpp header file.) # check_file = os.path.join(cfg.header_files_to, gb.gambit_backend_incl_dir, 'backend_undefs.hpp') - print('File: ', check_file) if os.path.isfile(check_file): print() print( utils.modifyText('The backend source tree seems to already have been BOSSed.','yellow')) @@ -808,6 +807,17 @@ def main(): sys.exit() + # + # Generate header file 'typedefs.hpp' + # + + print() + print() + print( utils.modifyText('Generating file typedefs.hpp:','underline')) + print() + + filehandling.createTypedefsHeader() + # # Generate header file 'loaded_types.hpp' diff --git a/Backends/scripts/BOSS/modules/filehandling.py b/Backends/scripts/BOSS/modules/filehandling.py index 1de3286cc9..82fc396c70 100644 --- a/Backends/scripts/BOSS/modules/filehandling.py +++ b/Backends/scripts/BOSS/modules/filehandling.py @@ -582,6 +582,59 @@ def copyFilesToSourceTree(verbose=False): +# ====== createTypedefsHeader ======== + +# Generate the header file typedefs.hpp. This header +# will contain typedefs for loaded classes, +# from ::BACKENDNAME_SAFE_VERSION::class_name +# to ::Gambit::Backends::BACKENDNAME_SAFE_VERSION::class_name + +def createTypedefsHeader(): + + # Construct the typedefs code + outer_namespace_list = ['Gambit', 'Backends', gb.gambit_backend_name_full] + + typedefs_header_content = '' + typedefs_header_content += utils.constrNamespace(outer_namespace_list, 'open', indent=cfg.indent) + + # Loop over all classes + for class_name in gb.classes_done: + + if not class_name['long'] in gb.factory_info.keys(): + continue + else: + + class_typedef_code = '' + + class_namespace, class_name_short = utils.removeNamespace(class_name['long'], return_namespace=True) + + if class_namespace == '': + class_typedef_code += 'typedef ::' + gb.gambit_backend_name_full + '::' + class_name['long'] + ' ' + class_name['short'] + ';\n' + else: + class_namespace_list = class_namespace.split('::') + + class_typedef_code += utils.constrNamespace(class_namespace_list, 'open', indent=cfg.indent) + class_typedef_code += ' '*cfg.indent*len(class_namespace_list) + 'typedef ::' + gb.gambit_backend_name_full + '::' + class_name['long'] + ' ' + class_name['short'] + ';\n' + class_typedef_code += utils.constrNamespace(class_namespace_list, 'close', indent=cfg.indent) + + class_typedef_code = utils.addIndentation(class_typedef_code, 3*cfg.indent) + typedefs_header_content += class_typedef_code + + typedefs_header_content += utils.constrNamespace(outer_namespace_list, 'close', indent=cfg.indent) + + # Add include guards + typedefs_header_content = utils.addIncludeGuard(typedefs_header_content, 'typedefs.hpp', prefix='', suffix=gb.gambit_backend_name_full) + + # Write to file + typedefs_header_output_path = os.path.join(gb.for_gambit_backend_types_dir_complete, 'typedefs.hpp') + f = open(typedefs_header_output_path, 'w') + f.write(typedefs_header_content) + f.close() + +# ====== END: createTypedefsHeader ======== + + + # ====== createLoadedTypesHeader ======== # Generate the header file loaded_types.hpp. This header will @@ -766,21 +819,19 @@ def createFrontendHeader(function_xml_files_dict): # - Include statement for the identification header frontend_content += '\n' frontend_content += '#include "' + os.path.join(gb.gambit_backend_incl_dir, gb.backend_types_basedir, gb.gambit_backend_name_full, 'identification.hpp') + '"\n' + frontend_content += '#include "' + os.path.join(gb.gambit_backend_incl_dir, gb.backend_types_basedir, gb.gambit_backend_name_full, 'typedefs.hpp') + '"\n' # - LOAD_LIBRARY macro frontend_content += '\n' frontend_content += 'LOAD_LIBRARY\n' - # - Class typedefs - frontend_content += '\n' - frontend_content += typedef_code - # - BE_FUNCTION macros frontend_content += '\n' frontend_content += '// Functions\n' frontend_content += be_function_macro_code # - Descriptions of different things that can go into a frontend header + frontend_content += '\n' frontend_content += '// Variables\n' frontend_content += '\n' frontend_content += '// Initialisation function (dependencies)\n' diff --git a/Backends/scripts/BOSS/modules/utils.py b/Backends/scripts/BOSS/modules/utils.py index 2322eef480..a65ad74a72 100755 --- a/Backends/scripts/BOSS/modules/utils.py +++ b/Backends/scripts/BOSS/modules/utils.py @@ -2079,6 +2079,7 @@ def constrLoadedTypesHeaderContent(): namespace, class_name_short = removeNamespace(class_name['long'], return_namespace=True) incl_statements_code += '#include "' + gb.wrapper_header_prefix + class_name['short'] + cfg.header_extension + '"\n' incl_statements_code += '#include "identification.hpp"\n' + incl_statements_code += '#include "typedefs.hpp"\n' for pragma_directive in cfg.pragmas_end: incl_statements_code += pragma_directive.strip() + '\n' From dc70ed2e2f7f30b915403b1c18c79cb3c1b6f235 Mon Sep 17 00:00:00 2001 From: Anders Kvellestad Date: Tue, 30 Aug 2022 13:48:41 +0200 Subject: [PATCH 2/3] Changes to header files for existing BOSSed backeds, resulting from BOSS now writing typedefs to separate file --- .../HepLike_1_2/loaded_types.hpp | 1 + .../backend_types/HepLike_1_2/typedefs.hpp | 23 +++ .../Pythia_8_212/loaded_types.hpp | 1 + .../backend_types/Pythia_8_212/typedefs.hpp | 142 ++++++++++++++++++ .../gm2calc_1_2_0/loaded_types.hpp | 1 + .../backend_types/gm2calc_1_2_0/typedefs.hpp | 58 +++++++ .../gm2calc_1_3_0/loaded_types.hpp | 1 + .../backend_types/gm2calc_1_3_0/typedefs.hpp | 58 +++++++ .../vevacious_1_0/loaded_types.hpp | 1 + .../backend_types/vevacious_1_0/typedefs.hpp | 18 +++ .../gambit/Backends/frontends/HepLike_1_2.hpp | 21 +-- .../Backends/frontends/Pythia_8_212.hpp | 140 +---------------- .../Backends/frontends/gm2calc_1_2_0.hpp | 56 +------ .../Backends/frontends/gm2calc_1_3_0.hpp | 56 +------ .../Backends/frontends/vevacious_1_0.hpp | 16 +- 15 files changed, 314 insertions(+), 279 deletions(-) create mode 100644 Backends/include/gambit/Backends/backend_types/HepLike_1_2/typedefs.hpp create mode 100644 Backends/include/gambit/Backends/backend_types/Pythia_8_212/typedefs.hpp create mode 100644 Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/typedefs.hpp create mode 100644 Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/typedefs.hpp create mode 100644 Backends/include/gambit/Backends/backend_types/vevacious_1_0/typedefs.hpp diff --git a/Backends/include/gambit/Backends/backend_types/HepLike_1_2/loaded_types.hpp b/Backends/include/gambit/Backends/backend_types/HepLike_1_2/loaded_types.hpp index 09f0545137..e134f50d87 100644 --- a/Backends/include/gambit/Backends/backend_types/HepLike_1_2/loaded_types.hpp +++ b/Backends/include/gambit/Backends/backend_types/HepLike_1_2/loaded_types.hpp @@ -13,6 +13,7 @@ #include "wrapper_HL_nDimGaussian.h" #include "wrapper_HL_nDimLikelihood.h" #include "identification.hpp" +#include "typedefs.hpp" #pragma GCC diagnostic pop // Indicate which types are provided by this backend, and what the symbols of their factories are. diff --git a/Backends/include/gambit/Backends/backend_types/HepLike_1_2/typedefs.hpp b/Backends/include/gambit/Backends/backend_types/HepLike_1_2/typedefs.hpp new file mode 100644 index 0000000000..2eb0b73a44 --- /dev/null +++ b/Backends/include/gambit/Backends/backend_types/HepLike_1_2/typedefs.hpp @@ -0,0 +1,23 @@ +#ifndef __typedefs_HepLike_1_2_hpp__ +#define __typedefs_HepLike_1_2_hpp__ + +namespace Gambit +{ + namespace Backends + { + namespace HepLike_1_2 + { + typedef ::HepLike_1_2::HL_Data HL_Data; + typedef ::HepLike_1_2::HL_Gaussian HL_Gaussian; + typedef ::HepLike_1_2::HL_BifurGaussian HL_BifurGaussian; + typedef ::HepLike_1_2::HL_ExpPoints HL_ExpPoints; + typedef ::HepLike_1_2::HL_Limit HL_Limit; + typedef ::HepLike_1_2::HL_ProfLikelihood HL_ProfLikelihood; + typedef ::HepLike_1_2::HL_nDimBifurGaussian HL_nDimBifurGaussian; + typedef ::HepLike_1_2::HL_nDimGaussian HL_nDimGaussian; + typedef ::HepLike_1_2::HL_nDimLikelihood HL_nDimLikelihood; + } + } +} + +#endif /* __typedefs_HepLike_1_2_hpp__ */ diff --git a/Backends/include/gambit/Backends/backend_types/Pythia_8_212/loaded_types.hpp b/Backends/include/gambit/Backends/backend_types/Pythia_8_212/loaded_types.hpp index 5f088cd552..fe7cd10eac 100644 --- a/Backends/include/gambit/Backends/backend_types/Pythia_8_212/loaded_types.hpp +++ b/Backends/include/gambit/Backends/backend_types/Pythia_8_212/loaded_types.hpp @@ -34,6 +34,7 @@ #include "wrapper_Vec4.h" #include "wrapper_Hist.h" #include "identification.hpp" +#include "typedefs.hpp" // Indicate which types are provided by this backend, and what the symbols of their factories are. #define Pythia_8_212_all_data \ diff --git a/Backends/include/gambit/Backends/backend_types/Pythia_8_212/typedefs.hpp b/Backends/include/gambit/Backends/backend_types/Pythia_8_212/typedefs.hpp new file mode 100644 index 0000000000..97ab17b756 --- /dev/null +++ b/Backends/include/gambit/Backends/backend_types/Pythia_8_212/typedefs.hpp @@ -0,0 +1,142 @@ +#ifndef __typedefs_Pythia_8_212_hpp__ +#define __typedefs_Pythia_8_212_hpp__ + +namespace Gambit +{ + namespace Backends + { + namespace Pythia_8_212 + { + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::GAMBIT_hepmc_writer GAMBIT_hepmc_writer; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Pythia Pythia; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::UserHooks UserHooks; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::PartonLevel PartonLevel; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::ResonanceDecays ResonanceDecays; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::ParticleDecays ParticleDecays; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::SigmaProcess SigmaProcess; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::SLHAinterface SLHAinterface; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::ParticleData ParticleData; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::CoupSUSY CoupSUSY; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::LHdecayChannel LHdecayChannel; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::LHdecayTable LHdecayTable; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::SusyLesHouches SusyLesHouches; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::SigmaTotal SigmaTotal; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::DecayChannel DecayChannel; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::ParticleDataEntry ParticleDataEntry; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Couplings Couplings; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::ResonanceWidths ResonanceWidths; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::ResonanceGmZ ResonanceGmZ; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::BeamParticle BeamParticle; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::SlowJet SlowJet; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Event Event; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Particle Particle; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::AlphaStrong AlphaStrong; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::AlphaEM AlphaEM; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::CoupSM CoupSM; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Parm Parm; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Settings Settings; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Info Info; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Rndm Rndm; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Vec4 Vec4; + } + namespace Pythia8 + { + typedef ::Pythia_8_212::Pythia8::Hist Hist; + } + } + } +} + +#endif /* __typedefs_Pythia_8_212_hpp__ */ diff --git a/Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/loaded_types.hpp b/Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/loaded_types.hpp index 662f9a234c..b4e4af8c8d 100644 --- a/Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/loaded_types.hpp +++ b/Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/loaded_types.hpp @@ -14,6 +14,7 @@ #include "wrapper_EPhysicalProblem.hpp" #include "wrapper_EReadError.hpp" #include "identification.hpp" +#include "typedefs.hpp" #include "gambit/Utils/end_ignore_warnings.hpp" // Indicate which types are provided by this backend, and what the symbols of their factories are. diff --git a/Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/typedefs.hpp b/Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/typedefs.hpp new file mode 100644 index 0000000000..aa5463a8f0 --- /dev/null +++ b/Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/typedefs.hpp @@ -0,0 +1,58 @@ +#ifndef __typedefs_gm2calc_1_2_0_hpp__ +#define __typedefs_gm2calc_1_2_0_hpp__ + +namespace Gambit +{ + namespace Backends + { + namespace gm2calc_1_2_0 + { + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_susy_parameters MSSMNoFV_onshell_susy_parameters; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell MSSMNoFV_onshell; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_mass_eigenstates MSSMNoFV_onshell_mass_eigenstates; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_problems MSSMNoFV_onshell_problems; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_physical MSSMNoFV_onshell_physical; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_soft_parameters MSSMNoFV_onshell_soft_parameters; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::Error Error; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::ESetupError ESetupError; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::EInvalidInput EInvalidInput; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::EPhysicalProblem EPhysicalProblem; + } + namespace gm2calc + { + typedef ::gm2calc_1_2_0::gm2calc::EReadError EReadError; + } + } + } +} + +#endif /* __typedefs_gm2calc_1_2_0_hpp__ */ diff --git a/Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/loaded_types.hpp b/Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/loaded_types.hpp index 105466e3a5..708f67bf27 100644 --- a/Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/loaded_types.hpp +++ b/Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/loaded_types.hpp @@ -14,6 +14,7 @@ #include "wrapper_EPhysicalProblem.hpp" #include "wrapper_EReadError.hpp" #include "identification.hpp" +#include "typedefs.hpp" #include "gambit/Utils/end_ignore_warnings.hpp" // Indicate which types are provided by this backend, and what the symbols of their factories are. diff --git a/Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/typedefs.hpp b/Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/typedefs.hpp new file mode 100644 index 0000000000..1a0bbcec84 --- /dev/null +++ b/Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/typedefs.hpp @@ -0,0 +1,58 @@ +#ifndef __typedefs_gm2calc_1_3_0_hpp__ +#define __typedefs_gm2calc_1_3_0_hpp__ + +namespace Gambit +{ + namespace Backends + { + namespace gm2calc_1_3_0 + { + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_susy_parameters MSSMNoFV_onshell_susy_parameters; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell MSSMNoFV_onshell; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_mass_eigenstates MSSMNoFV_onshell_mass_eigenstates; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_problems MSSMNoFV_onshell_problems; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_physical MSSMNoFV_onshell_physical; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_soft_parameters MSSMNoFV_onshell_soft_parameters; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::Error Error; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::ESetupError ESetupError; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::EInvalidInput EInvalidInput; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::EPhysicalProblem EPhysicalProblem; + } + namespace gm2calc + { + typedef ::gm2calc_1_3_0::gm2calc::EReadError EReadError; + } + } + } +} + +#endif /* __typedefs_gm2calc_1_3_0_hpp__ */ diff --git a/Backends/include/gambit/Backends/backend_types/vevacious_1_0/loaded_types.hpp b/Backends/include/gambit/Backends/backend_types/vevacious_1_0/loaded_types.hpp index 7dc78c1e1b..efa6c7191b 100644 --- a/Backends/include/gambit/Backends/backend_types/vevacious_1_0/loaded_types.hpp +++ b/Backends/include/gambit/Backends/backend_types/vevacious_1_0/loaded_types.hpp @@ -3,6 +3,7 @@ #include "wrapper_VevaciousPlusPlus.hpp" #include "identification.hpp" +#include "typedefs.hpp" // Indicate which types are provided by this backend, and what the symbols of their factories are. #define vevacious_1_0_all_data \ diff --git a/Backends/include/gambit/Backends/backend_types/vevacious_1_0/typedefs.hpp b/Backends/include/gambit/Backends/backend_types/vevacious_1_0/typedefs.hpp new file mode 100644 index 0000000000..332e07ad54 --- /dev/null +++ b/Backends/include/gambit/Backends/backend_types/vevacious_1_0/typedefs.hpp @@ -0,0 +1,18 @@ +#ifndef __typedefs_vevacious_1_0_hpp__ +#define __typedefs_vevacious_1_0_hpp__ + +namespace Gambit +{ + namespace Backends + { + namespace vevacious_1_0 + { + namespace VevaciousPlusPlus + { + typedef ::vevacious_1_0::VevaciousPlusPlus::VevaciousPlusPlus VevaciousPlusPlus; + } + } + } +} + +#endif /* __typedefs_vevacious_1_0_hpp__ */ diff --git a/Backends/include/gambit/Backends/frontends/HepLike_1_2.hpp b/Backends/include/gambit/Backends/frontends/HepLike_1_2.hpp index 54443fab6f..beadbaa466 100644 --- a/Backends/include/gambit/Backends/frontends/HepLike_1_2.hpp +++ b/Backends/include/gambit/Backends/frontends/HepLike_1_2.hpp @@ -3,29 +3,12 @@ // #include "gambit/Backends/backend_types/HepLike_1_2/identification.hpp" +#include "gambit/Backends/backend_types/HepLike_1_2/typedefs.hpp" LOAD_LIBRARY -namespace Gambit -{ - namespace Backends - { - namespace HepLike_1_2 - { - typedef ::HepLike_1_2::HL_Data HL_Data; - typedef ::HepLike_1_2::HL_Gaussian HL_Gaussian; - typedef ::HepLike_1_2::HL_BifurGaussian HL_BifurGaussian; - typedef ::HepLike_1_2::HL_ExpPoints HL_ExpPoints; - typedef ::HepLike_1_2::HL_Limit HL_Limit; - typedef ::HepLike_1_2::HL_ProfLikelihood HL_ProfLikelihood; - typedef ::HepLike_1_2::HL_nDimBifurGaussian HL_nDimBifurGaussian; - typedef ::HepLike_1_2::HL_nDimGaussian HL_nDimGaussian; - typedef ::HepLike_1_2::HL_nDimLikelihood HL_nDimLikelihood; - } - } -} - // Functions + // Variables // Initialisation function (dependencies) diff --git a/Backends/include/gambit/Backends/frontends/Pythia_8_212.hpp b/Backends/include/gambit/Backends/frontends/Pythia_8_212.hpp index 8547fba0d1..b7881814fb 100644 --- a/Backends/include/gambit/Backends/frontends/Pythia_8_212.hpp +++ b/Backends/include/gambit/Backends/frontends/Pythia_8_212.hpp @@ -3,148 +3,12 @@ // #include "gambit/Backends/backend_types/Pythia_8_212/identification.hpp" +#include "gambit/Backends/backend_types/Pythia_8_212/typedefs.hpp" LOAD_LIBRARY -namespace Gambit -{ - namespace Backends - { - namespace Pythia_8_212 - { - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::GAMBIT_hepmc_writer GAMBIT_hepmc_writer; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Pythia Pythia; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::UserHooks UserHooks; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::PartonLevel PartonLevel; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::ResonanceDecays ResonanceDecays; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::ParticleDecays ParticleDecays; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::SigmaProcess SigmaProcess; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::SLHAinterface SLHAinterface; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::ParticleData ParticleData; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::CoupSUSY CoupSUSY; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::LHdecayChannel LHdecayChannel; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::LHdecayTable LHdecayTable; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::SusyLesHouches SusyLesHouches; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::SigmaTotal SigmaTotal; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::DecayChannel DecayChannel; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::ParticleDataEntry ParticleDataEntry; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Couplings Couplings; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::ResonanceWidths ResonanceWidths; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::ResonanceGmZ ResonanceGmZ; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::BeamParticle BeamParticle; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::SlowJet SlowJet; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Event Event; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Particle Particle; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::AlphaStrong AlphaStrong; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::AlphaEM AlphaEM; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::CoupSM CoupSM; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Parm Parm; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Settings Settings; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Info Info; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Rndm Rndm; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Vec4 Vec4; - } - namespace Pythia8 - { - typedef ::Pythia_8_212::Pythia8::Hist Hist; - } - } - } -} - // Functions + // Variables // Initialisation function (dependencies) diff --git a/Backends/include/gambit/Backends/frontends/gm2calc_1_2_0.hpp b/Backends/include/gambit/Backends/frontends/gm2calc_1_2_0.hpp index aabc5ffb19..f5878cdf86 100644 --- a/Backends/include/gambit/Backends/frontends/gm2calc_1_2_0.hpp +++ b/Backends/include/gambit/Backends/frontends/gm2calc_1_2_0.hpp @@ -3,69 +3,17 @@ // #include "gambit/Backends/backend_types/gm2calc_1_2_0/identification.hpp" +#include "gambit/Backends/backend_types/gm2calc_1_2_0/typedefs.hpp" LOAD_LIBRARY -namespace Gambit -{ - namespace Backends - { - namespace gm2calc_1_2_0 - { - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_susy_parameters MSSMNoFV_onshell_susy_parameters; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell MSSMNoFV_onshell; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_mass_eigenstates MSSMNoFV_onshell_mass_eigenstates; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_problems MSSMNoFV_onshell_problems; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_physical MSSMNoFV_onshell_physical; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell_soft_parameters MSSMNoFV_onshell_soft_parameters; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::Error Error; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::ESetupError ESetupError; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::EInvalidInput EInvalidInput; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::EPhysicalProblem EPhysicalProblem; - } - namespace gm2calc - { - typedef ::gm2calc_1_2_0::gm2calc::EReadError EReadError; - } - } - } -} - // Functions BE_FUNCTION(calculate_amu_1loop, double, (const gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell&), "calculate_amu_1loop__BOSS_10", "calculate_amu_1loop") BE_FUNCTION(calculate_amu_1loop_non_tan_beta_resummed, double, (const gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell&), "calculate_amu_1loop_non_tan_beta_resummed__BOSS_11", "calculate_amu_1loop_non_tan_beta_resummed") BE_FUNCTION(calculate_amu_2loop, double, (const gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell&), "calculate_amu_2loop__BOSS_12", "calculate_amu_2loop") BE_FUNCTION(calculate_amu_2loop_non_tan_beta_resummed, double, (const gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell&), "calculate_amu_2loop_non_tan_beta_resummed__BOSS_13", "calculate_amu_2loop_non_tan_beta_resummed") BE_FUNCTION(calculate_uncertainty_amu_2loop, double, (const gm2calc_1_2_0::gm2calc::MSSMNoFV_onshell&), "calculate_uncertainty_amu_2loop__BOSS_19", "calculate_uncertainty_amu_2loop") + // Variables // Initialisation function (dependencies) diff --git a/Backends/include/gambit/Backends/frontends/gm2calc_1_3_0.hpp b/Backends/include/gambit/Backends/frontends/gm2calc_1_3_0.hpp index f3fe421a3c..71ff47e164 100644 --- a/Backends/include/gambit/Backends/frontends/gm2calc_1_3_0.hpp +++ b/Backends/include/gambit/Backends/frontends/gm2calc_1_3_0.hpp @@ -3,69 +3,17 @@ // #include "gambit/Backends/backend_types/gm2calc_1_3_0/identification.hpp" +#include "gambit/Backends/backend_types/gm2calc_1_3_0/typedefs.hpp" LOAD_LIBRARY -namespace Gambit -{ - namespace Backends - { - namespace gm2calc_1_3_0 - { - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_susy_parameters MSSMNoFV_onshell_susy_parameters; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell MSSMNoFV_onshell; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_mass_eigenstates MSSMNoFV_onshell_mass_eigenstates; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_problems MSSMNoFV_onshell_problems; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_physical MSSMNoFV_onshell_physical; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell_soft_parameters MSSMNoFV_onshell_soft_parameters; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::Error Error; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::ESetupError ESetupError; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::EInvalidInput EInvalidInput; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::EPhysicalProblem EPhysicalProblem; - } - namespace gm2calc - { - typedef ::gm2calc_1_3_0::gm2calc::EReadError EReadError; - } - } - } -} - // Functions BE_FUNCTION(calculate_amu_1loop, double, (const gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell&), "calculate_amu_1loop__BOSS_10", "calculate_amu_1loop") BE_FUNCTION(calculate_amu_1loop_non_tan_beta_resummed, double, (const gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell&), "calculate_amu_1loop_non_tan_beta_resummed__BOSS_11", "calculate_amu_1loop_non_tan_beta_resummed") BE_FUNCTION(calculate_amu_2loop, double, (const gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell&), "calculate_amu_2loop__BOSS_12", "calculate_amu_2loop") BE_FUNCTION(calculate_amu_2loop_non_tan_beta_resummed, double, (const gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell&), "calculate_amu_2loop_non_tan_beta_resummed__BOSS_13", "calculate_amu_2loop_non_tan_beta_resummed") BE_FUNCTION(calculate_uncertainty_amu_2loop, double, (const gm2calc_1_3_0::gm2calc::MSSMNoFV_onshell&), "calculate_uncertainty_amu_2loop__BOSS_19", "calculate_uncertainty_amu_2loop") + // Variables // Initialisation function (dependencies) diff --git a/Backends/include/gambit/Backends/frontends/vevacious_1_0.hpp b/Backends/include/gambit/Backends/frontends/vevacious_1_0.hpp index 859a0a84c0..b7a167a6b7 100644 --- a/Backends/include/gambit/Backends/frontends/vevacious_1_0.hpp +++ b/Backends/include/gambit/Backends/frontends/vevacious_1_0.hpp @@ -3,24 +3,12 @@ // #include "gambit/Backends/backend_types/vevacious_1_0/identification.hpp" +#include "gambit/Backends/backend_types/vevacious_1_0/typedefs.hpp" LOAD_LIBRARY -namespace Gambit -{ - namespace Backends - { - namespace vevacious_1_0 - { - namespace VevaciousPlusPlus - { - typedef ::vevacious_1_0::VevaciousPlusPlus::VevaciousPlusPlus VevaciousPlusPlus; - } - } - } -} - // Functions + // Variables // Initialisation function (dependencies) From fbdc7a6eceb0d9d6574f231a89c039104492b9e9 Mon Sep 17 00:00:00 2001 From: Anders Kvellestad Date: Tue, 22 Nov 2022 02:34:26 +0100 Subject: [PATCH 3/3] Backend type harvester now harvests the typedefs.hpp file for a BOSSed backend and includes it in backend_types_rollcall.hpp modified: Backends/scripts/backend_harvester.py modified: Utils/scripts/harvesting_tools.py --- Backends/scripts/backend_harvester.py | 12 ++++++++++++ Utils/scripts/harvesting_tools.py | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Backends/scripts/backend_harvester.py b/Backends/scripts/backend_harvester.py index e7ae2a31da..3951f36b21 100644 --- a/Backends/scripts/backend_harvester.py +++ b/Backends/scripts/backend_harvester.py @@ -27,6 +27,10 @@ # (b.farmer@imperial.ac.uk) # \date 2018 Oct # +# \author Anders Kvellestad +# (anders.kvellestad@fys.uio.no) +# \date 2022 Nov +# #********************************************* import os @@ -38,6 +42,7 @@ def main(argv): frontend_headers=set([]) backend_type_headers = set([]) bossed_backend_type_headers = set([]) + bossed_backend_typedef_headers = set([]) exclude_backends=set([]) # Handle command line options @@ -62,6 +67,7 @@ def main(argv): # Get list of backend type header files backend_type_headers.update(retrieve_generic_headers(verbose,"./Backends/include/gambit/Backends/backend_types","backend type",set([]))) bossed_backend_type_headers.update(retrieve_generic_headers(verbose,"./Backends/include/gambit/Backends/backend_types","BOSSed type",set([]))) + bossed_backend_typedef_headers.update(retrieve_generic_headers(verbose,"./Backends/include/gambit/Backends/backend_types","BOSSed typedef",set([]))) if verbose: print("Frontend headers identified:") @@ -72,6 +78,8 @@ def main(argv): print(' gambit/Backends/backend_types/'+h) for h in bossed_backend_type_headers: print(' gambit/Backends/backend_types/'+h) + for h in bossed_backend_typedef_headers: + print(' gambit/Backends/backend_types/'+h) # Generate a c++ header containing all the frontend headers we have just harvested. towrite = "\ @@ -168,6 +176,10 @@ def main(argv): for h in bossed_backend_type_headers: towrite+='#include \"gambit/Backends/backend_types/{0}\"\n'.format(h) + towrite += "\n// BOSSed backend typedefs.\n" + for h in bossed_backend_typedef_headers: + towrite+='#include \"gambit/Backends/backend_types/{0}\"\n'.format(h) + towrite+="\n#endif // defined __backend_types_rollcall_hpp__\n" with open("./Backends/include/gambit/Backends/backend_types_rollcall.hpp","w") as f: diff --git a/Utils/scripts/harvesting_tools.py b/Utils/scripts/harvesting_tools.py index 1cb0892b23..fdb05d90f6 100644 --- a/Utils/scripts/harvesting_tools.py +++ b/Utils/scripts/harvesting_tools.py @@ -28,6 +28,10 @@ # \date 2018 Oct # \date 2021 Mar # +# \author Anders Kvellestad +# (anders.kvellestad@fys.uio.no) +# \date 2022 Nov +# #********************************************* import os import re @@ -555,11 +559,12 @@ def retrieve_generic_headers(verbose,starting_dir,kind,excludes,exclude_list=[]) for x in excludes: if name.startswith(x): exclude = True if kind == "BOSSed type" and not name.startswith("loaded_types"): exclude = True + if kind == "BOSSed typedef" and not name.startswith("typedefs"): exclude = True if not exclude and (name.endswith(".hpp") or name.endswith(".h") or name.endswith(".hh")): if verbose: print( " Located "+kind+" header '{0}' at path '{1}'".format(name,os.path.join(root,name)) ) rel_name = re.sub(".*?/include/", "", os.path.relpath(os.path.join(root,name),starting_dir)) headers+=[rel_name] - if kind != "BOSSed type": break + if kind not in ["BOSSed type", "BOSSed typedef"]: break return headers # Check whether or not two files differ in their contents except for the date line