gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
models.hpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
28 
29 
30 #ifndef __models_hpp__
31 #define __models_hpp__
32 
33 #include <string>
34 #include <vector>
35 #include <set>
36 #include <map>
37 
38 //#include "gambit/Elements/functors.hpp"
39 //#include "gambit/Utils/util_types.hpp"
40 //#include "gambit/Utils/standalone_error_handlers.hpp"
41 
42 namespace Gambit
43 {
44  class primary_model_functor;
45 
46  namespace Models
47  {
48 
49  typedef std::string str;
50  typedef std::vector<primary_model_functor*> primodel_vec;
51  typedef std::map<str, primary_model_functor *> activemodel_map;
52 
56  {
57 
58  private:
59 
61  typedef bool (*LineageFunction)(const str, const ModelFunctorClaw*);
62 
64  std::set<str> activemodels;
65 
68  std::set<str> allmodelnames;
69  std::map<str, str> myParentsDB;
70  std::map<str, std::vector<str> > myLineageDB;
71  std::map<str, std::vector<str> > myDescendantsDB;
72  std::map<str, LineageFunction > myIsDescendantOfDB;
73  std::map<str, std::set<str> > myFriendsDB;
74  std::map<str, std::set<str> > myBestFriendsDB;
76 
77  public:
78 
83 
87  primodel_vec getPrimaryModelFunctorsToActivate (std::set<str>, const primodel_vec&);
88 
94  void checkPrimaryModelFunctorUsage(const activemodel_map&) const;
95 
97  void declare_model (const str&, const str&);
98 
100  void add_friend (const str &model, const str &newfriend);
101 
103  bool model_exists (const str &) const;
104 
106  str list_models() const;
107 
109  void verify_model(const str&) const;
110 
112  const std::set<str>& get_allmodels() const;
113 
115  std::set<str> get_activemodels() const;
116 
118  std::vector<str> get_lineage (const str &) const;
119 
121  std::set<str> get_friends (const str &model) const;
122 
124  std::set<str> get_best_friends (const str &model) const;
125 
127  std::vector<str> get_descendants (const str &) const;
128 
130  str get_parent (const str&) const;
131 
133  bool descended_from (const str &, const str &) const;
134 
136  bool ancestor_of (const str &, const str &) const;
137 
139  bool downstream_of (const str&, const str&) const;
140 
142  bool upstream_of (const str&, const str&) const;
143 
144  };
145 
146  }
147 
148 }
149 
150 #endif
151 
152 
153 
std::map< str, std::set< str > > myBestFriendsDB
Definition: models.hpp:74
bool upstream_of(const str &, const str &) const
Check if model 1 exists somewhere upstream of model 2, allowing model 2 to be interpreted as model 1...
Definition: models.cpp:298
std::vector< primary_model_functor * > primodel_vec
Definition: models.hpp:50
std::map< str, std::set< str > > myFriendsDB
Definition: models.hpp:73
str list_models() const
List all the models recognised by GAMBIT.
Definition: models.cpp:215
void checkPrimaryModelFunctorUsage(const activemodel_map &) const
Active model functor "usefulness" checker.
Definition: models.cpp:113
ModelFunctorClaw()
Constructor.
Definition: models.hpp:80
std::map< str, str > myParentsDB
Definition: models.hpp:69
void verify_model(const str &) const
Verify that a string matches a model recognised by GAMBIT, crash otherwise.
Definition: models.cpp:226
std::set< str > allmodelnames
Definition: models.hpp:68
std::set< str > get_friends(const str &model) const
Retrieve the friends for a given model.
Definition: models.cpp:256
str get_parent(const str &) const
Retrieve the parent model for a given model.
Definition: models.cpp:244
bool downstream_of(const str &, const str &) const
Check if model 1 exists somewhere downstream of (and can be therefore be interpreted as a) model 2...
Definition: models.cpp:286
primodel_vec getPrimaryModelFunctorsToActivate(std::set< str >, const primodel_vec &)
Model activation function.
Definition: models.cpp:52
std::set< str > activemodels
Internal record of the active models.
Definition: models.hpp:64
const std::set< str > & get_allmodels() const
Return set of all models recognised by GAMBIT.
Definition: models.cpp:103
Models object that performs initialisation and checking operations on a primary_model_functor list...
Definition: models.hpp:55
std::string str
Definition: models.hpp:49
std::set< str > get_activemodels() const
Return the set of active models;.
Definition: models.cpp:106
std::map< str, LineageFunction > myIsDescendantOfDB
Definition: models.hpp:72
void add_friend(const str &model, const str &newfriend)
Add a friend, and all its friends and ancestors, to a model&#39;s list of friends.
Definition: models.cpp:189
std::map< str, std::vector< str > > myLineageDB
Definition: models.hpp:70
bool ancestor_of(const str &, const str &) const
Check if model 1 is an ancestor of model 2.
Definition: models.cpp:280
std::map< str, primary_model_functor * > activemodel_map
Definition: models.hpp:51
bool model_exists(const str &) const
Indicate whether a model is recognised by GAMBIT or not.
Definition: models.cpp:209
bool(* LineageFunction)(const str, const ModelFunctorClaw *)
Function pointer type.
Definition: models.hpp:61
~ModelFunctorClaw()
Destructor.
Definition: models.hpp:82
bool descended_from(const str &, const str &) const
Check if model 1 is descended from model 2.
Definition: models.cpp:268
std::set< str > get_best_friends(const str &model) const
Retrieve the best friends for a given model.
Definition: models.cpp:262
std::map< str, std::vector< str > > myDescendantsDB
Definition: models.hpp:71
std::vector< str > get_lineage(const str &) const
Retrieve the lineage for a given model.
Definition: models.cpp:250
void declare_model(const str &, const str &)
Add a new model to the model database.
Definition: models.cpp:151
std::vector< str > get_descendants(const str &) const
Retrieve the descendants for a given model.
Definition: models.cpp:238
TODO: see if we can use this one:
Definition: Analysis.hpp:33