gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
model_parameters.hpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
38 
39 
40 #ifndef __model_parameters_hpp__
41 #define __model_parameters_hpp__
42 
43 #include <map>
44 #include <vector>
45 #include <iostream>
47 
48 namespace Gambit {
49 
50  // Model parameter map type; used by all models
51  typedef std::map<std::string, double> parameterMap;
52 
54  {
55 
56  protected:
57 
59  void assert_contains(std::string) const;
60 
61  public:
62 
65 
67  ModelParameters(const std::vector<std::string>&);
68 
70  ModelParameters(const char**);
71 
73  double getValue(std::string const & inkey) const;
74 
76  const std::map<std::string, double>& getValues() const;
77 
79  std::map<std::string, double>::const_iterator begin() const;
80 
82  std::map<std::string, double>::const_iterator end() const;
83 
85  int getNumberOfPars() const;
86 
88  const double & operator[](std::string const & inkey) const;
89 
91  const double & at(std::string const & inkey) const;
92 
94  void setValue(std::string const &inkey,double const&value);
95 
97  void setValues(std::map<std::string,double> const &params_map, bool missing_is_error = true);
98 
100  void setValues(ModelParameters const& donor, bool missing_is_error = true);
101 
103  std::vector<std::string> getKeys() const;
104 
106  void print() const;
107 
109  friend std::ostream &operator<<(std::ostream &strm, const ModelParameters &me)
110  {
111  strm << "ModelParameters: Printing: "<<std::endl;
112  for (std::map<std::string,double>::const_iterator it=me._values.begin();it!=me._values.end();it++)
113  {
114  strm << "parameter: " << it->first << " value: "<<it->second ;
115  }
116  return strm;
117  }
118 
120  void _definePar(const std::string &newkey);
121 
123  void _definePars(const std::vector<std::string> &v);
124 
126  void _definePars(const char** array);
127 
129  std::string getModelName() const;
130  std::string getOutputName() const;
131  void setModelName (const std::string&);
132  void setOutputName(const std::string&);
133 
134  private:
135 
137  std::map<std::string,double> _values;
138 
140  std::string modelname;
141 
144  std::string outputname;
145 
146  };
147 
148 }
149 #endif //ifdef __model_parameters_hpp__
std::string outputname
Output name (string used for labelling in output, related to the model_functor which produced these p...
void print(MixMatrix A)
Helper function to print a matrix.
#define EXPORT_SYMBOLS
std::map< std::string, double > _values
Internal map representation of parameters and their values.
std::map< std::string, double > parameterMap
std::string modelname
Name of the model; intended mainly for more helpful error messages.
friend std::ostream & operator<<(std::ostream &strm, const ModelParameters &me)
Dump parameter names and values to stream (again for debugging only I think)
Helper macro for controlling symbol visibility in shared libraries.
TODO: see if we can use this one:
Definition: Analysis.hpp:33