gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
core.hpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
16 
17 #ifndef __gambit_core_hpp__
18 #define __gambit_core_hpp__
19 
20 #include <map>
21 #include <vector>
22 
23 #include "gambit/Backends/backend_info.hpp"
26 #include "gambit/Models/models.hpp"
28 
29 #include "yaml-cpp/yaml.h"
30 
31 namespace Gambit
32 {
33 
36  {
37 
38  private:
41  typedef std::vector<functor *> fVec;
42  typedef std::vector<primary_model_functor *> pmfVec;
43  typedef std::map<str, primary_model_functor *> pmfMap;
45 
48 
50  const Backends::backend_info *backendData;
51 
53  std::set<str> modules;
54 
56  std::map<str, std::set<str>> backend_versions;
57 
59  std::set<str> capabilities;
60 
62  std::set<str> models;
63 
66 
69 
72 
75 
78 
83 
85  const int outprec;
86 
89 
92  void module_diagnostic();
93  void backend_diagnostic();
94  void capability_diagnostic();
95  void model_diagnostic();
96  void scanner_diagnostic();
98  void prior_diagnostic();
99 
102  void ff_module_diagnostic(const str &);
103  void ff_backend_diagnostic(const str &);
104  void ff_capability_diagnostic(const str &);
105  void ff_model_diagnostic(const str &);
106  void ff_scanner_diagnostic(const str &);
107  void ff_test_function_diagnostic(const str &);
108  void ff_prior_diagnostic(const str &);
110 
112  str backend_status(const str &, const str &, bool &);
113 
115  int launch_diagnostic_MPI();
116 
118  void quit_diagnostic_MPI();
119 
120  public:
122  gambit_core(const Models::ModelFunctorClaw &, const Backends::backend_info &);
123 
126 
130 
132  bool resume;
133 
135  // Set 'true' by '--verbose'
137 
140 
142  void bail(int mpirank = -1);
143 
145  str process_primary_options(int, char **);
146 
148  str run_diagnostic(int, char **);
149 
151  void registerModule(str);
152 
154  void registerBackend(str, str);
155 
158 
161 
164 
167 
169  void registerActiveModelFunctors(const pmfVec &);
170 
172  const fVec &getModuleFunctors() const;
173 
175  const fVec &getNestedModuleFunctors() const;
176 
178  const fVec &getBackendFunctors() const;
179 
181  const pmfVec &getPrimaryModelFunctors() const;
182 
184  const pmfMap &getActiveModelFunctors() const;
185 
187  void accountForMissingClasses() const;
188 
190  capability_info get_capability_info(const str &) const;
191 
193  model_info get_model_info(const str &) const;
194 
196  int get_outprec() const;
197 
199  void check_databases();
200 
203 
206 
208  std::vector<capability_info> capability_dbase;
209 
211  std::vector<model_info> model_dbase;
212  };
213 
214 } // namespace Gambit
215 
216 #endif // defined __gambit_core_hpp__
void ff_capability_diagnostic(const str &)
Free-form capability diagnostic function.
std::map< str, std::set< str > > backend_versions
Map from backend names to a list of all registered versions of the backend.
Definition: core.hpp:56
int launch_diagnostic_MPI()
Launch MPI and return the rank, for limiting diagnostic output to master node.
str backend_status(const str &, const str &, bool &)
Compute the status of a given backend.
Definition: core.cpp:530
void registerPrimaryModelFunctor(primary_model_functor &)
Add a new primary model functor to primaryModelFunctorList.
Definition: core.cpp:219
Model helper declarations.
std::vector< capability_info > capability_dbase
Vector of all capability_info objects.
Definition: core.hpp:208
void capability_diagnostic()
Basic capability diagnostic function.
Helper struct to carry around model information.
void ff_prior_diagnostic(const str &)
Functors specific to primary ModelParameters objects.
Definition: functors.hpp:1001
const pmfVec & getPrimaryModelFunctors() const
Get a reference to the list of primary model functors.
Definition: core.cpp:241
bool verbose_flag
Verbosity mode.
Definition: core.hpp:136
capability_info get_capability_info(const str &) const
Get the description (and other info) of the named item from the capability database.
Definition: core.cpp:491
void quit_diagnostic_MPI()
Quit MPI used for diagnostic mode.
void registerActiveModelFunctors(const pmfVec &)
Add entries to the map of activated primary model functors.
Definition: core.cpp:226
Function wrapper (functor) base class.
Definition: functors.hpp:87
void ff_module_diagnostic(const str &)
Free-form diagnostic functions.
void model_diagnostic()
Basic model diagnostic function.
General small utility classes, typedefs, etc.
void check_databases()
Check the named database for conflicts and missing descriptions.
Definition: core.cpp:278
std::set< str > models
List of all declared models.
Definition: core.hpp:62
model_info get_model_info(const str &) const
Get the description (and other info) of the named item from the model database.
Definition: core.cpp:510
void ff_model_diagnostic(const str &)
Free-form model diagnostic function.
void backend_diagnostic()
Basic backend diagnostic function.
Definition: diagnostics.cpp:84
const fVec & getBackendFunctors() const
Get a reference to the list of backend model functors.
Definition: core.cpp:238
Small wrapper object for parsing and emitting capability/model etc.
const fVec & getNestedModuleFunctors() const
Get a reference to the list of nested module functors.
Definition: core.cpp:235
fVec functorList
List of all declared module functors.
Definition: core.hpp:65
std::set< str > capabilities
List of all declared capabilities.
Definition: core.hpp:59
const fVec & getModuleFunctors() const
Get a reference to the list of module functors.
Definition: core.cpp:232
void registerModule(str)
Add a new module to modules list.
Definition: core.cpp:196
void registerNestedModuleFunctor(functor &)
Add a new module functor to nestFunctorList.
Definition: core.cpp:206
Models object that performs initialisation and checking operations on a primary_model_functor list...
Definition: models.hpp:55
Master driver class for a GAMBIT scan.
Definition: core.hpp:35
void ff_scanner_diagnostic(const str &)
Free-form scanner diagnostic function.
std::vector< primary_model_functor * > pmfVec
Definition: core.hpp:42
const pmfMap & getActiveModelFunctors() const
Get a reference to the map of all user-activated primary model functors.
Definition: core.cpp:244
Functor class definitions.
gambit_core(const Models::ModelFunctorClaw &, const Backends::backend_info &)
Constructor.
Definition: core.cpp:63
void bail(int mpirank=-1)
Command-line info function.
Definition: core.cpp:76
const str input_model_descriptions
Filename of the file from which to harvest model descriptions.
Definition: core.hpp:82
bool found_inifile
Flag recording whether an inifile has been supplied.
Definition: core.hpp:139
bool processed_options
Flag specifying whether command line options have been processed yet.
Definition: core.hpp:88
std::set< str > modules
Set of all declared modules.
Definition: core.hpp:53
void ff_test_function_diagnostic(const str &)
Free-form test function diagnostic function.
bool resume
Flag to trigger "resume" mode.
Definition: core.hpp:132
pmfVec primaryModelFunctorList
List of all declared primary model functors.
Definition: core.hpp:74
~gambit_core()
Destructor.
Definition: core.hpp:125
const str input_capability_descriptions
Filename of the file from which to harvest capability descriptions.
Definition: core.hpp:80
int get_outprec() const
Getter for precision to use for cout.
Definition: core.cpp:73
str process_primary_options(int, char **)
Process default command line options.
Definition: core.cpp:123
std::vector< functor * > fVec
Internal typedefs to keep things readable.
Definition: core.hpp:41
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
void test_function_diagnostic()
Basic test function diagnostic function.
fVec nestedFunctorList
List of all module functors that are declared as nested (i.e. require loop managers) ...
Definition: core.hpp:68
Helper struct to carry around capability information.
void scanner_diagnostic()
Basic scanner diagnostic function.
int show_runorder
Flags set by command line options Flag to trigger dependency resolver to report functor run order...
Definition: core.hpp:129
void ff_backend_diagnostic(const str &)
Free-form backend diagnostic function.
const Models::ModelFunctorClaw * modelInfo
Internal model claw pointer.
Definition: core.hpp:47
void accountForMissingClasses() const
Tell the module functors which backends are actually present.
Definition: core.cpp:249
bool missing_capability_description
set to true if capability descriptions missing
Definition: core.hpp:202
void module_diagnostic()
Basic diagnostic functions.
Definition: diagnostics.cpp:41
std::map< str, primary_model_functor * > pmfMap
Definition: core.hpp:43
void registerBackend(str, str)
Register a new backend.
Definition: core.cpp:216
std::vector< model_info > model_dbase
Vector of all model_info objects.
Definition: core.hpp:211
fVec backendFunctorList
List of all declared backend functors.
Definition: core.hpp:71
void registerModuleFunctor(functor &)
Add a new module functor to functorList.
Definition: core.cpp:199
TODO: see if we can use this one:
Definition: Analysis.hpp:33
pmfMap activeModelFunctorList
A map of all user-activated primary model functors.
Definition: core.hpp:77
void check_capability_descriptions()
Check for missing capability descriptions (after reading in runtime flags)
Definition: core.cpp:476
void registerBackendFunctor(functor &)
Add a new backend functor to backendFunctorList.
Definition: core.cpp:209
const int outprec
Precision to use for cout.
Definition: core.hpp:85
const Backends::backend_info * backendData
Internal backend info pointer.
Definition: core.hpp:50
str run_diagnostic(int, char **)
Diagnostics function.
Definition: core.cpp:568