gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
Gambit::Spec< DerivedSpec > Class Template Reference

Need to forward declare Spec class. More...

#include <spec_head.hpp>

Inheritance diagram for Gambit::Spec< DerivedSpec >:
Collaboration diagram for Gambit::Spec< DerivedSpec >:

Public Types

typedef DerivedSpec D
 
typedef Spec< DSelf
 
typedef SpecTraits< D >::Contents Contents
 Note: Wrapper need to define a specialisation of SpecTraits, which typedefs Model and Input. More...
 
typedef SpecTraits< D >::Model Model
 
typedef SpecTraits< D >::Input Input
 
typedef MapTypes< D, MapTag::GetMTget
 
typedef MapTypes< D, MapTag::SetMTset
 
typedef std::map< Par::Tags, MapCollection< MTget > > GetterMaps
 Will need a map of map collections for both the getters and setters, containing the map collections for the permitted parameter types. More...
 
typedef std::map< Par::Tags, MapCollection< MTset > > SetterMaps
 

Public Member Functions

std::string getName () const
 Main public interface functions. More...
 
 Spec ()
 Constructor This uses the "Contents" class to verify (once, not every construction) that this wrapper provides all the basic functionality that it is supposed to. More...
 
virtual ~Spec ()
 Virtual destructor. More...
 
virtual std::unique_ptr< SubSpectrumclone () const
 CRTP-style polymorphic clone function Now derived classes will not need to re-implement the clone function. More...
 
bool has (const Par::Tags, const str &, const SpecOverrideOptions=use_overrides, const SafeBool=SafeBool(true)) const
 Spec member function definitions. More...
 
double get (const Par::Tags, const str &, const SpecOverrideOptions=use_overrides, const SafeBool=SafeBool(true)) const
 
void set (const Par::Tags, const double, const str &, const SafeBool=SafeBool(true))
 
bool has (const Par::Tags, const str &, const int, const SpecOverrideOptions=use_overrides, const SafeBool=SafeBool(true)) const
 One index. More...
 
double get (const Par::Tags, const str &, const int, const SpecOverrideOptions=use_overrides, const SafeBool=SafeBool(true)) const
 
void set (const Par::Tags, const double, const str &, const int, const SafeBool=SafeBool(true))
 
bool has (const Par::Tags, const str &, const int, const int, const SpecOverrideOptions=use_overrides) const
 Two indices. More...
 
double get (const Par::Tags, const str &, const int, const int, const SpecOverrideOptions=use_overrides) const
 
void set (const Par::Tags, const double, const str &, const int, const int)
 
- Public Member Functions inherited from Gambit::SubSpectrum
virtual const std::map< int, int > & PDG_translator () const
 TODO: extra PDB overloads to handle all the one and two index cases (well all the ones that are feasible...) More...
 
 SubSpectrum ()
 Constructors/destructors. More...
 
virtual ~SubSpectrum ()
 
virtual void writeSLHAfile (int, const str &) const
 Dump out spectrum information to an SLHA file (if possible) More...
 
virtual SLHAstruct getSLHAea (int) const
 Get spectrum information in SLHAea format (if possible) More...
 
virtual void add_to_SLHAea (int, SLHAstruct &) const
 Add spectrum information to an SLHAea object (if possible) More...
 
virtual int get_numbers_stable_particles () const
 There may be more than one new stable particle this method will tell you how many. More...
 
virtual double hard_upper () const
 Limits to RGE running; warning/error raised if running beyond these is attempted. More...
 
virtual double soft_upper () const
 
virtual double soft_lower () const
 
virtual double hard_lower () const
 
virtual void RunToScaleOverride (double)
 Run spectrum to new scale. More...
 
virtual double GetScale () const
 Returns the renormalisation scale of parameters. More...
 
virtual void SetScale (double)
 Manually set the renormalisation scale of parameters somewhat dangerous to allow this but may be needed. More...
 
void RunToScale (double scale, const int behave=0)
 Run spectrum to a new scale This function is a wrapper for RunToScaleOverride which automatically checks limits and raises warnings. More...
 
void set_override (const Par::Tags, const double, const str &, const bool allow_new=false, const bool decouple=false)
 Parameter override functions. More...
 
void set_override (const Par::Tags, const double, const str &, const int, const bool allow_new=false, const bool decouple=false)
 
void set_override (const Par::Tags, const double, const str &, const int, const int, const bool allow_new=false)
 
void set_override_vector (const Par::Tags, const double, const std::vector< str > &, const bool allow_new=false, const bool decouple=false)
 Vector override functions. More...
 
void set_override_vector (const Par::Tags, const double, const std::vector< str > &, const std::vector< int >, const bool allow_new=false, const bool decouple=false)
 
void set_override_vector (const Par::Tags, const double, const std::vector< str > &, const int, const bool allow_new=false, const bool decouple=false)
 
void set_override_vector (const Par::Tags, const double, const str &, const std::vector< int >, const bool allow_new=false, const bool decouple=false)
 
double safeget (const Par::Tags, const str &, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 safeget functions, by Abram More...
 
double safeget (const Par::Tags, const str &, const int, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 
double safeget (const Par::Tags, const str &, const int, const int, const SpecOverrideOptions=use_overrides) const
 
double safeget (const Par::Tags, const int, const int, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 
double safeget (const Par::Tags, const std::pair< int, int >, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 
double safeget (const Par::Tags, const std::pair< str, int >, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 
void set_override (const Par::Tags, const double, const int, const int, const bool allow_new=false, const bool decouple=false)
 PDB overloads for setters. More...
 
void set_override (const Par::Tags, const double, const std::pair< int, int >, const bool allow_new=false, const bool decouple=false)
 
void set_override (const Par::Tags, const double, const std::pair< str, int >, const bool allow_new=false, const bool decouple=false)
 PDB overloads of set_override functions. More...
 
bool has (const Par::Tags, const int, const int, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 PDB getter/checker overloads. More...
 
double get (const Par::Tags, const int, const int, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 
bool has (const Par::Tags, const std::pair< int, int >, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 
double get (const Par::Tags, const std::pair< int, int >, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 
bool has (const Par::Tags, const std::pair< str, int >, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 
double get (const Par::Tags, const std::pair< str, int >, const SpecOverrideOptions=use_overrides, const SafeBool check_antiparticle=SafeBool(true)) const
 

Static Public Attributes

static const GetterMaps getter_maps
 Initialise maps (uses filler overrides from DerivedSpec if defined) More...
 
static const SetterMaps setter_maps
 

Static Private Member Functions

static const std::map< Par::Tags, MapCollection< MTget > > final_fill_getter_maps ()
 
static const std::map< Par::Tags, MapCollection< MTset > > final_fill_setter_maps ()
 

Friends

template<class , class >
class FptrFinder
 
static const std::map< Par::Tags, MapCollection< MTget > > fill_getter_maps ()
 
static const std::map< Par::Tags, MapCollection< MTset > > fill_setter_maps ()
 
static int index_offset ()
 Get integer offset convention used by internal model class (needed by getters which take indices) By default assume no offset. More...
 
static int get_index_offset ()
 Function to retrieve the possibly overridden index offset from the derived class via CRTP. More...
 
static void getter_maps_fill_tags (std::map< Par::Tags, MapCollection< MTget >> &in)
 
static void setter_maps_fill_tags (std::map< Par::Tags, MapCollection< MTset >> &in)
 
DummyModel dummymodel
 Default "null" versions of get_Model and get_Input, to be used if wrapper does not override them. More...
 
DummyInput dummyinput
 
Modelget_Model ()
 
Inputget_Input ()
 
const Modelget_Model () const
 
const Inputget_Input () const
 
Modelmodel ()
 Get model object on which to call function pointers. More...
 
const Modelmodel () const
 Return it as const if we are a const object. More...
 
Inputinput ()
 Get struct containing any extra data input on SubSpectrum object creation. More...
 
const Inputinput () const
 Return it as const if we are a const object. More...
 

Additional Inherited Members

- Protected Attributes inherited from Gambit::SubSpectrum
std::map< Par::Tags, OverrideMapsoverride_maps
 Map of override maps. More...
 

Detailed Description

template<class DerivedSpec>
class Gambit::Spec< DerivedSpec >

Need to forward declare Spec class.

Definition at line 39 of file spec_head.hpp.

Member Typedef Documentation

◆ Contents

template<class DerivedSpec>
typedef SpecTraits<D>::Contents Gambit::Spec< DerivedSpec >::Contents

Note: Wrapper need to define a specialisation of SpecTraits, which typedefs Model and Input.

"Grab" these typedefs here to simplify notation

Definition at line 105 of file spec_head.hpp.

◆ D

template<class DerivedSpec>
typedef DerivedSpec Gambit::Spec< DerivedSpec >::D

Definition at line 99 of file spec_head.hpp.

◆ GetterMaps

template<class DerivedSpec>
typedef std::map<Par::Tags,MapCollection<MTget> > Gambit::Spec< DerivedSpec >::GetterMaps

Will need a map of map collections for both the getters and setters, containing the map collections for the permitted parameter types.

Definition at line 248 of file spec_head.hpp.

◆ Input

template<class DerivedSpec>
typedef SpecTraits<D>::Input Gambit::Spec< DerivedSpec >::Input

Definition at line 107 of file spec_head.hpp.

◆ Model

template<class DerivedSpec>
typedef SpecTraits<D>::Model Gambit::Spec< DerivedSpec >::Model

Definition at line 106 of file spec_head.hpp.

◆ MTget

template<class DerivedSpec>
typedef MapTypes<D,MapTag::Get> Gambit::Spec< DerivedSpec >::MTget

Definition at line 109 of file spec_head.hpp.

◆ MTset

template<class DerivedSpec>
typedef MapTypes<D,MapTag::Set> Gambit::Spec< DerivedSpec >::MTset

Definition at line 110 of file spec_head.hpp.

◆ Self

template<class DerivedSpec>
typedef Spec<D> Gambit::Spec< DerivedSpec >::Self

Definition at line 100 of file spec_head.hpp.

◆ SetterMaps

template<class DerivedSpec>
typedef std::map<Par::Tags,MapCollection<MTset> > Gambit::Spec< DerivedSpec >::SetterMaps

Definition at line 249 of file spec_head.hpp.

Constructor & Destructor Documentation

◆ Spec()

template<class DerivedSpec>
Gambit::Spec< DerivedSpec >::Spec ( )
inline

Constructor This uses the "Contents" class to verify (once, not every construction) that this wrapper provides all the basic functionality that it is supposed to.

Definition at line 205 of file spec_head.hpp.

205 { static VerifyContents<Contents> runonce(*this); };

◆ ~Spec()

template<class DerivedSpec>
virtual Gambit::Spec< DerivedSpec >::~Spec ( )
inlinevirtual

Virtual destructor.

Definition at line 208 of file spec_head.hpp.

208 {};

Member Function Documentation

◆ clone()

template<class DerivedSpec>
virtual std::unique_ptr<SubSpectrum> Gambit::Spec< DerivedSpec >::clone ( ) const
inlinevirtual

CRTP-style polymorphic clone function Now derived classes will not need to re-implement the clone function.

Implements Gambit::SubSpectrum.

Definition at line 212 of file spec_head.hpp.

213  {
214  return std::unique_ptr<SubSpectrum>(
215  new DerivedSpec(static_cast<DerivedSpec const &>(*this))
216  );
217  }

◆ fill_getter_maps()

template<class DerivedSpec>
static const std::map<Par::Tags,MapCollection<MTget> > Gambit::Spec< DerivedSpec >::fill_getter_maps ( )
inlinestatic

Default (empty) map filler functions Override as needed in derived classes

Definition at line 133 of file spec_head.hpp.

134  {
135  std::map<Par::Tags,MapCollection<MTget>> tmp;
136  return tmp;
137  }

◆ fill_setter_maps()

template<class DerivedSpec>
static const std::map<Par::Tags,MapCollection<MTset> > Gambit::Spec< DerivedSpec >::fill_setter_maps ( )
inlinestatic

Definition at line 138 of file spec_head.hpp.

139  {
140  std::map<Par::Tags,MapCollection<MTset>> tmp;
141  return tmp;
142  }

◆ final_fill_getter_maps()

template<class DerivedSpec>
static const std::map<Par::Tags,MapCollection<MTget> > Gambit::Spec< DerivedSpec >::final_fill_getter_maps ( )
inlinestaticprivate

Filler functions that are actually directly used to fill the maps Combines the (possibly overriden) map filler, plus the fill_tags functions to fill in any unused tag keys. DO NOT override these!

Definition at line 180 of file spec_head.hpp.

181  {
182  // Fill from (possibly overriden) derived class filler function
183  std::map<Par::Tags,MapCollection<MTget>> tmp = D::fill_getter_maps();
184  // Add in any missing tags
185  getter_maps_fill_tags(tmp);
186  return tmp;
187  }
static void getter_maps_fill_tags(std::map< Par::Tags, MapCollection< MTget >> &in)
Definition: spec_head.hpp:156

◆ final_fill_setter_maps()

template<class DerivedSpec>
static const std::map<Par::Tags,MapCollection<MTset> > Gambit::Spec< DerivedSpec >::final_fill_setter_maps ( )
inlinestaticprivate

Definition at line 188 of file spec_head.hpp.

189  {
190  // Fill from (possibly overriden) derived class filler function
191  std::map<Par::Tags,MapCollection<MTset>> tmp = D::fill_setter_maps();
192  // Add in any missing tags
193  setter_maps_fill_tags(tmp);
194  return tmp;
195  }
static void setter_maps_fill_tags(std::map< Par::Tags, MapCollection< MTset >> &in)
Definition: spec_head.hpp:164

◆ get() [1/3]

template<class DerivedSpec >
double Spec::get ( const Par::Tags  partype,
const str name,
const SpecOverrideOptions  check_overrides = use_overrides,
const SafeBool  check_antiparticle = SafeBool(true) 
) const
virtual

Implements Gambit::SubSpectrum.

Definition at line 72 of file spec.hpp.

73  {
74  //typedef typename DerivedSpec::MTget MTget;
75 
76  bool overrides=true;
77  bool override_only=false;
78  if (check_overrides == use_overrides) { overrides=true; override_only=false; }
79  else if(check_overrides == overrides_only){ overrides=true; override_only=true; }
80  else if(check_overrides == ignore_overrides){overrides=false; override_only=false;}
81 
82  /* Create finder object, tell it what maps to search, and do the search */
83  const OverrideMaps overridecoll = override_maps.at(partype);
84  const MapCollection<MTget> mapcoll = getter_maps.at(partype);
85  FptrFinder<Spec<DerivedSpec>,MapTag::Get> finder =
86  SetMaps<Spec<DerivedSpec>,MapTag::Get>(Par::toString.at(partype),this)
87  .omap0( overridecoll.m0 )
88  .omap1( overridecoll.m1 )
89  .map0( mapcoll.map0 )
90  .map1( mapcoll.map1 )
91  .map0W( mapcoll.map0W )
92  .map1W( mapcoll.map1W )
93  .map0M( mapcoll.map0_extraM )
94  .map1M( mapcoll.map1_extraM )
95  .map0I( mapcoll.map0_extraI )
96  .map1I( mapcoll.map1_extraI )
97  .override_only(override_only)
98  .no_overrides(not overrides);
99  if( finder.find(name,true,check_antiparticle) ){ return finder.callfcn(); }
100  finder.raise_error(LOCAL_INFO);
101  return 0;
102  }
static const GetterMaps getter_maps
Initialise maps (uses filler overrides from DerivedSpec if defined)
Definition: spec_head.hpp:250
#define LOCAL_INFO
Definition: local_info.hpp:34
std::map< Par::Tags, OverrideMaps > override_maps
Map of override maps.

◆ get() [2/3]

template<class DerivedSpec >
double Spec::get ( const Par::Tags  partype,
const str name,
const int  i,
const SpecOverrideOptions  check_overrides = use_overrides,
const SafeBool  check_antiparticle = SafeBool(true) 
) const
virtual

Implements Gambit::SubSpectrum.

Definition at line 176 of file spec.hpp.

177  {
178  //typedef typename DerivedSpec::MTget MTget;
179 
180  bool overrides=true;
181  bool override_only=false;
182  if (check_overrides == use_overrides) { overrides=true; override_only=false; }
183  else if(check_overrides == overrides_only){ overrides=true; override_only=true; }
184  else if(check_overrides == ignore_overrides){overrides=false; override_only=false;}
185 
186  /* Create finder object, tell it what maps to search, and do the search */
187  const OverrideMaps overridecoll = override_maps.at(partype);
188  const MapCollection<MTget> mapcoll = getter_maps.at(partype);
189  FptrFinder<Spec<DerivedSpec>,MapTag::Get> finder =
190  SetMaps<Spec<DerivedSpec>,MapTag::Get>(Par::toString.at(partype),this)
191  .omap0( overridecoll.m0 )
192  .omap1( overridecoll.m1 )
193  .map0( mapcoll.map0 )
194  .map1( mapcoll.map1 )
195  .map0W( mapcoll.map0W )
196  .map1W( mapcoll.map1W )
197  .map0M( mapcoll.map0_extraM )
198  .map1M( mapcoll.map1_extraM )
199  .map0I( mapcoll.map0_extraI )
200  .map1I( mapcoll.map1_extraI )
201  .override_only(override_only)
202  .no_overrides(not overrides);
203  if( finder.find(name,i,true,check_antiparticle) ){ return finder.callfcn(); }
204  finder.raise_error(LOCAL_INFO);
205  return 0;
206  }
static const GetterMaps getter_maps
Initialise maps (uses filler overrides from DerivedSpec if defined)
Definition: spec_head.hpp:250
#define LOCAL_INFO
Definition: local_info.hpp:34
std::map< Par::Tags, OverrideMaps > override_maps
Map of override maps.

◆ get() [3/3]

template<class DerivedSpec >
double Spec::get ( const Par::Tags  partype,
const str name,
const int  i,
const int  j,
const SpecOverrideOptions  check_overrides = use_overrides 
) const
virtual

Implements Gambit::SubSpectrum.

Definition at line 277 of file spec.hpp.

278  {
279  //typedef typename DerivedSpec::MTget MTget;
280 
281  bool overrides=true;
282  bool override_only=false;
283  if (check_overrides == use_overrides) { overrides=true; override_only=false; }
284  else if(check_overrides == overrides_only){ overrides=true; override_only=true; }
285  else if(check_overrides == ignore_overrides){overrides=false; override_only=false;}
286 
287  /* Create finder object, tell it what maps to search, and do the search */
288  const OverrideMaps overridecoll = override_maps.at(partype);
289  const MapCollection<MTget> mapcoll = getter_maps.at(partype);
290  FptrFinder<Spec<DerivedSpec>,MapTag::Get> finder =
291  SetMaps<Spec<DerivedSpec>,MapTag::Get>(Par::toString.at(partype),this)
292  .omap2( overridecoll.m2 )
293  .map2( mapcoll.map2 )
294  .map2W( mapcoll.map2W )
295  .map2M( mapcoll.map2_extraM )
296  .map2I( mapcoll.map2_extraI )
297  .override_only(override_only)
298  .no_overrides(not overrides);
299  if( finder.find(name,i,j) ){ return finder.callfcn(); }
300  finder.raise_error(LOCAL_INFO);
301  return 0;
302  }
static const GetterMaps getter_maps
Initialise maps (uses filler overrides from DerivedSpec if defined)
Definition: spec_head.hpp:250
#define LOCAL_INFO
Definition: local_info.hpp:34
std::map< Par::Tags, OverrideMaps > override_maps
Map of override maps.

◆ get_index_offset()

template<class DerivedSpec>
static int Gambit::Spec< DerivedSpec >::get_index_offset ( )
inlinestaticprivate

Function to retrieve the possibly overridden index offset from the derived class via CRTP.

Definition at line 151 of file spec_head.hpp.

151 { return D::index_offset(); }

◆ get_Input() [1/2]

template<class DerivedSpec>
Input& Gambit::Spec< DerivedSpec >::get_Input ( )
inline

Definition at line 229 of file spec_head.hpp.

229 { return dummyinput; }
DummyInput dummyinput
Definition: spec_head.hpp:227

◆ get_Input() [2/2]

template<class DerivedSpec>
const Input& Gambit::Spec< DerivedSpec >::get_Input ( ) const
inline

Definition at line 231 of file spec_head.hpp.

231 { return dummyinput; }
DummyInput dummyinput
Definition: spec_head.hpp:227

◆ get_Model() [1/2]

template<class DerivedSpec>
Model& Gambit::Spec< DerivedSpec >::get_Model ( )
inline

Definition at line 228 of file spec_head.hpp.

228 { return dummymodel; }
DummyModel dummymodel
Default "null" versions of get_Model and get_Input, to be used if wrapper does not override them...
Definition: spec_head.hpp:226

◆ get_Model() [2/2]

template<class DerivedSpec>
const Model& Gambit::Spec< DerivedSpec >::get_Model ( ) const
inline

Definition at line 230 of file spec_head.hpp.

230 { return dummymodel; }
DummyModel dummymodel
Default "null" versions of get_Model and get_Input, to be used if wrapper does not override them...
Definition: spec_head.hpp:226

◆ getName()

template<class DerivedSpec>
std::string Gambit::Spec< DerivedSpec >::getName ( ) const
inlinevirtual

Main public interface functions.

Get name

Implements Gambit::SubSpectrum.

Definition at line 112 of file spec_head.hpp.

112 { return SpecTraits<D>::name(); };

◆ getter_maps_fill_tags()

template<class DerivedSpec>
static void Gambit::Spec< DerivedSpec >::getter_maps_fill_tags ( std::map< Par::Tags, MapCollection< MTget >> &  in)
inlinestaticprivate

Functions to ensure that all the possible tags exist in the final map, even if no getters/setters are stored under those tags.

Definition at line 156 of file spec_head.hpp.

157  {
158  std::vector<Par::Tags> all = Par::get_all();
159  for(std::vector<Par::Tags>::iterator it = all.begin(); it!=all.end(); ++it)
160  {
161  in[*it]; // insert tag key if missing
162  }
163  }
std::vector< Tags > get_all()

◆ has() [1/3]

template<class DerivedSpec >
bool Spec::has ( const Par::Tags  partype,
const str name,
const SpecOverrideOptions  check_overrides = use_overrides,
const SafeBool  check_antiparticle = SafeBool(true) 
) const
virtual

Spec member function definitions.

No indices

TODO: Could avoid dismantling the MapCollection struct by just letting the SetMaps class do it, but one step at a time... Could also reduce duplication between getter and checker functions by making the 'has' function take an optional argument to return an FptrFinder, which can then just be used to call the found function.

Implements Gambit::SubSpectrum.

Definition at line 36 of file spec.hpp.

37  {
38  //typedef typename DerivedSpec::MTget MTget;
44 
45  bool overrides=true;
46  bool override_only=false;
47  if (check_overrides == use_overrides) { overrides=true; override_only=false; }
48  else if(check_overrides == overrides_only){ overrides=true; override_only=true; }
49  else if(check_overrides == ignore_overrides){overrides=false; override_only=false;}
50 
51  /* Create finder object, tell it what maps to search, and do the search */
52  const OverrideMaps overridecoll = override_maps.at(partype);
53  const MapCollection<MTget> mapcoll = getter_maps.at(partype);
54  FptrFinder<Spec<DerivedSpec>,MapTag::Get> finder =
55  SetMaps<Spec<DerivedSpec>,MapTag::Get>(Par::toString.at(partype),this)
56  .omap0( overridecoll.m0 )
57  .omap1( overridecoll.m1 )
58  .map0( mapcoll.map0 )
59  .map1( mapcoll.map1 )
60  .map0W( mapcoll.map0W )
61  .map1W( mapcoll.map1W )
62  .map0M( mapcoll.map0_extraM )
63  .map1M( mapcoll.map1_extraM )
64  .map0I( mapcoll.map0_extraI )
65  .map1I( mapcoll.map1_extraI )
66  .override_only(override_only)
67  .no_overrides(not overrides);
68  return finder.find(name,true,check_antiparticle);
69  }
static const GetterMaps getter_maps
Initialise maps (uses filler overrides from DerivedSpec if defined)
Definition: spec_head.hpp:250
std::map< Par::Tags, OverrideMaps > override_maps
Map of override maps.

◆ has() [2/3]

template<class DerivedSpec >
bool Spec::has ( const Par::Tags  partype,
const str name,
const int  i,
const SpecOverrideOptions  check_overrides = use_overrides,
const SafeBool  check_antiparticle = SafeBool(true) 
) const
virtual

One index.

Implements Gambit::SubSpectrum.

Definition at line 145 of file spec.hpp.

146  {
147  //typedef typename DerivedSpec::MTget MTget;
148 
149  bool overrides=true;
150  bool override_only=false;
151  if (check_overrides == use_overrides) { overrides=true; override_only=false; }
152  else if(check_overrides == overrides_only){ overrides=true; override_only=true; }
153  else if(check_overrides == ignore_overrides){overrides=false; override_only=false;}
154 
155  /* Create finder object, tell it what maps to search, and do the search */
156  const OverrideMaps overridecoll = override_maps.at(partype);
157  const MapCollection<MTget> mapcoll = getter_maps.at(partype);
158  FptrFinder<Spec<DerivedSpec>,MapTag::Get> finder =
159  SetMaps<Spec<DerivedSpec>,MapTag::Get>(Par::toString.at(partype),this)
160  .omap0( overridecoll.m0 )
161  .omap1( overridecoll.m1 )
162  .map0( mapcoll.map0 )
163  .map1( mapcoll.map1 )
164  .map0W( mapcoll.map0W )
165  .map1W( mapcoll.map1W )
166  .map0M( mapcoll.map0_extraM )
167  .map1M( mapcoll.map1_extraM )
168  .map0I( mapcoll.map0_extraI )
169  .map1I( mapcoll.map1_extraI )
170  .override_only(override_only)
171  .no_overrides(not overrides);
172  return finder.find(name,i,true,check_antiparticle);
173  }
static const GetterMaps getter_maps
Initialise maps (uses filler overrides from DerivedSpec if defined)
Definition: spec_head.hpp:250
std::map< Par::Tags, OverrideMaps > override_maps
Map of override maps.

◆ has() [3/3]

template<class DerivedSpec >
bool Spec::has ( const Par::Tags  partype,
const str name,
const int  i,
const int  j,
const SpecOverrideOptions  check_overrides = use_overrides 
) const
virtual

Two indices.

Implements Gambit::SubSpectrum.

Definition at line 251 of file spec.hpp.

252  {
253  //typedef typename DerivedSpec::MTget MTget;
254 
255  bool overrides=true;
256  bool override_only=false;
257  if (check_overrides == use_overrides) { overrides=true; override_only=false; }
258  else if(check_overrides == overrides_only){ overrides=true; override_only=true; }
259  else if(check_overrides == ignore_overrides){overrides=false; override_only=false;}
260 
261  /* Create finder object, tell it what maps to search, and do the search */
262  const OverrideMaps overridecoll = override_maps.at(partype);
263  const MapCollection<MTget> mapcoll = getter_maps.at(partype);
264  FptrFinder<Spec<DerivedSpec>,MapTag::Get> finder =
265  SetMaps<Spec<DerivedSpec>,MapTag::Get>(Par::toString.at(partype),this)
266  .omap2( overridecoll.m2 )
267  .map2( mapcoll.map2 )
268  .map2W( mapcoll.map2W )
269  .map2M( mapcoll.map2_extraM )
270  .map2I( mapcoll.map2_extraI )
271  .override_only(override_only)
272  .no_overrides(not overrides);
273  return finder.find(name,i,j);
274  }
static const GetterMaps getter_maps
Initialise maps (uses filler overrides from DerivedSpec if defined)
Definition: spec_head.hpp:250
std::map< Par::Tags, OverrideMaps > override_maps
Map of override maps.

◆ index_offset()

template<class DerivedSpec>
static int Gambit::Spec< DerivedSpec >::index_offset ( )
inlinestatic

Get integer offset convention used by internal model class (needed by getters which take indices) By default assume no offset.

Overrride as needed in derived class.

Definition at line 146 of file spec_head.hpp.

146 { return 0; }

◆ input() [1/2]

template<class DerivedSpec>
Input& Gambit::Spec< DerivedSpec >::input ( )
inline

Get struct containing any extra data input on SubSpectrum object creation.

Definition at line 239 of file spec_head.hpp.

239 { return static_cast<DerivedSpec*>(this)->get_Input(); }
Input & get_Input()
Definition: spec_head.hpp:229

◆ input() [2/2]

template<class DerivedSpec>
const Input& Gambit::Spec< DerivedSpec >::input ( ) const
inline

Return it as const if we are a const object.

Definition at line 241 of file spec_head.hpp.

241 { return static_cast<const DerivedSpec*>(this)->get_Input(); }
Input & get_Input()
Definition: spec_head.hpp:229

◆ model() [1/2]

template<class DerivedSpec>
Model& Gambit::Spec< DerivedSpec >::model ( )
inline

Get model object on which to call function pointers.

Definition at line 234 of file spec_head.hpp.

234 { return static_cast<DerivedSpec*>(this)->get_Model(); }
Model & get_Model()
Definition: spec_head.hpp:228

◆ model() [2/2]

template<class DerivedSpec>
const Model& Gambit::Spec< DerivedSpec >::model ( ) const
inline

Return it as const if we are a const object.

Definition at line 236 of file spec_head.hpp.

236 { return static_cast<const DerivedSpec*>(this)->get_Model(); }
Model & get_Model()
Definition: spec_head.hpp:228

◆ set() [1/3]

template<class DerivedSpec >
void Spec::set ( const Par::Tags  partype,
const double  set_value,
const str name,
const SafeBool  check_antiparticle = SafeBool(true) 
)
virtual

Implements Gambit::SubSpectrum.

Definition at line 105 of file spec.hpp.

106  {
107  typedef typename DerivedSpec::MTset MTset;
108 
109  /* Before trying to set parameter, check if there is an override defined
110  for it, so that we can warn people that the value they are trying to
111  set will be masked by the override */
112  const OverrideMaps overridecoll = override_maps.at(partype);
113  FptrFinder<Spec<DerivedSpec>,MapTag::Set> override_finder =
114  SetMaps<Spec<DerivedSpec>,MapTag::Set>(Par::toString.at(partype),this)
115  .omap0( overridecoll.m0 )
116  .omap1( overridecoll.m1 )
117  .override_only(true); // switch to permit search of only override maps
118  if( override_finder.find(name,true,check_antiparticle) )
119  {
120  std::ostringstream errmsg;
121  errmsg << "Warning from SubSpectrum object while trying to manually set a parameter!" << std::endl;
122  errmsg << "An override entry was detected for "<<Par::toString.at(partype)<<" with string reference '"<<name<<"'. The override value will hide the value I have been instructed to set." <<std::endl;
123  utils_warning().raise(LOCAL_INFO,errmsg.str());
124  }
125  // else no problem
126 
127  /* Create finder object, tell it what maps to search, and do the search */
128  const MapCollection<MTset> mapcoll = setter_maps.at(partype);
129  FptrFinder<Spec<DerivedSpec>,MapTag::Set> finder =
130  SetMaps<Spec<DerivedSpec>,MapTag::Set>(Par::toString.at(partype),this)
131  .map0( mapcoll.map0 )
132  .map1( mapcoll.map1 )
133  .map0W( mapcoll.map0W )
134  .map1W( mapcoll.map1W )
135  .map0M( mapcoll.map0_extraM )
136  .map1M( mapcoll.map1_extraM )
137  .map0I( mapcoll.map0_extraI )
138  .map1I( mapcoll.map1_extraI );
139  if( finder.find(name,true,check_antiparticle) ){ finder.callfcn(set_value); }
140  else { finder.raise_error(LOCAL_INFO); }
141  }
#define LOCAL_INFO
Definition: local_info.hpp:34
MapTypes< D, MapTag::Set > MTset
Definition: spec_head.hpp:110
static const SetterMaps setter_maps
Definition: spec_head.hpp:251
EXPORT_SYMBOLS warning & utils_warning()
Utility warnings.
std::map< Par::Tags, OverrideMaps > override_maps
Map of override maps.

◆ set() [2/3]

template<class DerivedSpec >
void Spec::set ( const Par::Tags  partype,
const double  set_value,
const str name,
const int  i,
const SafeBool  check_antiparticle = SafeBool(true) 
)
virtual

Implements Gambit::SubSpectrum.

Definition at line 209 of file spec.hpp.

210  {
211  typedef typename DerivedSpec::MTset MTset;
212 
213  /* Before trying to set parameter, check if there is an override defined
214  for it, so that we can warn people that the value they are trying to
215  set will be masked by the override */
216  const OverrideMaps overridecoll = override_maps.at(partype);
217  FptrFinder<Spec<DerivedSpec>,MapTag::Set> override_finder =
218  SetMaps<Spec<DerivedSpec>,MapTag::Set>(Par::toString.at(partype),this)
219  .omap0( overridecoll.m0 )
220  .omap1( overridecoll.m1 )
221  .override_only(true); // switch to permit search of only override maps
222  if( override_finder.find(name,i,true,check_antiparticle) )
223  {
224  std::ostringstream errmsg;
225  errmsg << "Warning from SubSpectrum object while trying to manually set a parameter!" << std::endl;
226  errmsg << "An override entry was detected for "<<Par::toString.at(partype)<<" with string reference '"<<name<<"', index '"<<i<<"'. The override value will hide the value I have been instructed to set." <<std::endl;
227  utils_warning().raise(LOCAL_INFO,errmsg.str());
228  }
229  // else no problem
230 
231  /* Create finder object, tell it what maps to search, and do the search */
232  const MapCollection<MTset> mapcoll = setter_maps.at(partype);
233  FptrFinder<Spec<DerivedSpec>,MapTag::Set> finder =
234  SetMaps<Spec<DerivedSpec>,MapTag::Set>(Par::toString.at(partype),this)
235  .map0( mapcoll.map0 )
236  .map1( mapcoll.map1 )
237  .map0W( mapcoll.map0W )
238  .map1W( mapcoll.map1W )
239  .map0M( mapcoll.map0_extraM )
240  .map1M( mapcoll.map1_extraM )
241  .map0I( mapcoll.map0_extraI )
242  .map1I( mapcoll.map1_extraI );
243  if( finder.find(name,i,true,check_antiparticle) ){ finder.callfcn(set_value); }
244  else { finder.raise_error(LOCAL_INFO); }
245  }
#define LOCAL_INFO
Definition: local_info.hpp:34
MapTypes< D, MapTag::Set > MTset
Definition: spec_head.hpp:110
static const SetterMaps setter_maps
Definition: spec_head.hpp:251
EXPORT_SYMBOLS warning & utils_warning()
Utility warnings.
std::map< Par::Tags, OverrideMaps > override_maps
Map of override maps.

◆ set() [3/3]

template<class DerivedSpec >
void Spec::set ( const Par::Tags  partype,
const double  set_value,
const str name,
const int  i,
const int  j 
)
virtual

Implements Gambit::SubSpectrum.

Definition at line 305 of file spec.hpp.

306  {
307  typedef typename DerivedSpec::MTset MTset;
308 
309  /* Create finder object, tell it what maps to search, and do the search */
310  const MapCollection<MTset> mapcoll = setter_maps.at(partype);
311  FptrFinder<Spec<DerivedSpec>,MapTag::Set> finder =
312  SetMaps<Spec<DerivedSpec>,MapTag::Set>(Par::toString.at(partype),this)
313  .map2( mapcoll.map2 )
314  .map2W( mapcoll.map2W )
315  .map2M( mapcoll.map2_extraM )
316  .map2I( mapcoll.map2_extraI );
317  if( finder.find(name,i,j) ){ finder.callfcn(set_value); }
318  else { finder.raise_error(LOCAL_INFO); }
319  }
#define LOCAL_INFO
Definition: local_info.hpp:34
MapTypes< D, MapTag::Set > MTset
Definition: spec_head.hpp:110
static const SetterMaps setter_maps
Definition: spec_head.hpp:251

◆ setter_maps_fill_tags()

template<class DerivedSpec>
static void Gambit::Spec< DerivedSpec >::setter_maps_fill_tags ( std::map< Par::Tags, MapCollection< MTset >> &  in)
inlinestaticprivate

Definition at line 164 of file spec_head.hpp.

165  {
166  std::vector<Par::Tags> all = Par::get_all();
167  for(std::vector<Par::Tags>::iterator it = all.begin(); it!=all.end(); ++it)
168  {
169  in[*it]; // insert tag key if missing
170  }
171  }
std::vector< Tags > get_all()

Friends And Related Function Documentation

◆ FptrFinder

template<class DerivedSpec>
template<class , class >
friend class FptrFinder
friend

Definition at line 96 of file spec_head.hpp.

Member Data Documentation

◆ dummyinput

template<class DerivedSpec>
DummyInput Gambit::Spec< DerivedSpec >::dummyinput

Definition at line 227 of file spec_head.hpp.

◆ dummymodel

template<class DerivedSpec>
DummyModel Gambit::Spec< DerivedSpec >::dummymodel

Default "null" versions of get_Model and get_Input, to be used if wrapper does not override them.

Getters for wrapped data; be sure to define the 'get_Model' and 'get_Input' functions in the wrappers (with public access) Might as well use static polymorphism rather than virtual functions, since we are using the CRTP already anyway.

Definition at line 226 of file spec_head.hpp.

◆ getter_maps

template<class DerivedSpec>
const Spec< D >::GetterMaps Spec::getter_maps
static

Initialise maps (uses filler overrides from DerivedSpec if defined)

Definition at line 250 of file spec_head.hpp.

◆ setter_maps

template<class DerivedSpec>
const Spec< D >::SetterMaps Spec::setter_maps
static

Definition at line 251 of file spec_head.hpp.


The documentation for this class was generated from the following files: