gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool

Function wrapper (functor) base class. More...

#include <functors.hpp>

Inheritance diagram for Gambit::functor:
Collaboration diagram for Gambit::functor:

Public Member Functions

 functor (str, str, str, str, Models::ModelFunctorClaw &)
 Constructor. More...
 
virtual ~functor ()
 
virtual void calculate ()
 Virtual calculate(); needs to be redefined in daughters. More...
 
virtual void reset_and_calculate ()
 Reset-then-recalculate method. More...
 
void setStatus (int)
 Setter for status: -6 = required external tool absent (pybind11) -5 = required external tool absent (Mathematica) -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active. More...
 
virtual void setInUse (bool)
 Set the inUse flag (must be overridden in derived class to have any effect). More...
 
void setPurpose (str)
 Setter for purpose (relevant only for next-to-output functors) More...
 
void setVertexID (int)
 Setter for vertex ID (used in printer system) More...
 
void setTimingVertexID (int)
 Set ID for timing 'vertex' (used in printer system) More...
 
str name () const
 Getter for the wrapped function's name. More...
 
str capability () const
 Getter for the wrapped function's reported capability. More...
 
str type () const
 Getter for the wrapped function's reported return type. More...
 
str origin () const
 Getter for the wrapped function's origin (module or backend name) More...
 
str version () const
 Getter for the version of the wrapped function's origin (module or backend) More...
 
virtual str safe_version () const
 Getter for the 'safe' incarnation of the version of the wrapped function's origin (module or backend) More...
 
int status () const
 Getter for the wrapped function current status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active. More...
 
sspair quantity () const
 Getter for the overall quantity provided by the wrapped function (capability-type pair) More...
 
str purpose () const
 Getter for purpose (relevant for output nodes, aka helper structures for the dep. resolution) More...
 
int vertexID () const
 Getter for vertex ID. More...
 
int timingVertexID () const
 Getter for timing vertex ID. More...
 
str label () const
 Getter for string label. More...
 
str timingLabel () const
 Getter for the printer timing label. More...
 
virtual bool requiresPrinting () const
 Getter indicating if the wrapped function's result should to be printed. More...
 
virtual bool requiresTimingPrinting () const
 Getter indicating if the timing data for this function's execution should be printed. More...
 
virtual void setPrintRequirement (bool)
 Setter for indicating if the wrapped function's result should to be printed. More...
 
virtual void setTimingPrintRequirement (bool)
 Setter for indicating if the timing data for this function's execution should be printed. More...
 
virtual void setNestedList (std::vector< functor *> &)
 Set the ordered list of pointers to other functors that should run nested in a loop managed by this one. More...
 
virtual void setIteration (long long)
 Set the iteration number in a loop in which this functor runs. More...
 
virtual bool canBeLoopManager ()
 Getter for revealing whether this is permitted to be a manager functor. More...
 
virtual str loopManagerCapability ()
 Getter for revealing the required capability of the wrapped function's loop manager. More...
 
virtual str loopManagerType ()
 Getter for revealing the required type of the wrapped function's loop manager. More...
 
virtual str loopManagerName ()
 Getter for revealing the name of the wrapped function's assigned loop manager. More...
 
virtual str loopManagerOrigin ()
 Getter for revealing the module of the wrapped function's assigned loop manager. More...
 
virtual void breakLoop ()
 Tell the functor that the loop it manages should break now. More...
 
virtual std::set< sspairdependencies ()
 Getter for listing currently activated dependencies. More...
 
virtual std::set< strbackendgroups ()
 Getter for listing backend requirement groups. More...
 
virtual std::set< sspairbackendreqs ()
 Getter for listing all backend requirements. More...
 
virtual std::set< sspairbackendreqs (str)
 Getter for listing backend requirements from a specific group. More...
 
virtual std::set< sspairbackendspermitted (sspair)
 Getter for listing permitted backends. More...
 
virtual std::set< strbackendreq_tags (sspair)
 Getter for listing tags associated with backend requirements. More...
 
virtual std::set< sspairforcematchingbackend (str)
 Getter for listing backend requirements that must be resolved from the same backend. More...
 
virtual std::set< sspairbackend_conditional_dependencies (str, str, str, str)
 Getter for listing backend-specific conditional dependencies (4-string version) More...
 
virtual std::set< sspairbackend_conditional_dependencies (str req, str type, str be)
 Getter for backend-specific conditional dependencies (3-string version) More...
 
virtual std::set< sspairbackend_conditional_dependencies (functor *)
 Getter for backend-specific conditional dependencies (backend functor pointer version) More...
 
virtual std::set< sspairmodel_conditional_dependencies (str)
 Getter for listing model-specific conditional dependencies. More...
 
virtual std::set< sspairmodel_conditional_backend_reqs (str)
 Getter for listing model-specific conditional backend requirements. More...
 
virtual void resolveDependency (functor *)
 Resolve a dependency using a pointer to another functor object. More...
 
virtual void resolveLoopManager (functor *)
 Set this functor's loop manager (if it has one) More...
 
virtual void resolveBackendReq (functor *)
 Resolve a backend requirement using a pointer to another functor object. More...
 
virtual void notifyOfModel (str)
 Notify the functor that a certain model is being scanned, so that it can activate itself accordingly. More...
 
virtual void notifyOfDependee (functor *)
 Notify the functor that it is being used to fill a dependency of another functor. More...
 
virtual void notifyOfBackends (std::map< str, std::set< str > >)
 Indicate to the functor which backends are actually loaded and working. More...
 
virtual void print (Printers::BasePrinter *printer, const int pointID, int thread_num)
 Printer function. More...
 
virtual void print (Printers::BasePrinter *printer, const int pointID)
 Printer function (no-thread-index short-circuit) More...
 
virtual invalid_point_exceptionretrieve_invalid_point_exception ()
 Retrieve the previously saved exception generated when this functor invalidated the current point in model space. More...
 
void notifyOfIniOptions (const Options &)
 Notify the functor about an instance of the options class that contains information from its corresponding ini-file entry in the auxiliaries or observables section. More...
 
template<typename TYPE >
void setOption (const str &key, const TYPE val)
 Set an option for the functor directly (for use in standalone executables). More...
 
safe_ptr< OptionsgetOptions ()
 Return a safe pointer to the options that this functor is supposed to run with (e.g. from the ini file). More...
 
void notifyOfSubCaps (const Options &)
 Notify the functor about an instance of the options class that contains sub-capability information. More...
 
template<typename TYPE >
void setSubCap (const str &key, const TYPE val)
 Set a sub-capability (subcap)for the functor directly (for use in standalone executables). More...
 
safe_ptr< OptionsgetSubCaps ()
 Return a safe pointer to the subcaps that this functor realises it is supposed to facilitate downstream calculation of. More...
 
safe_ptr< std::set< sspair > > getDependees ()
 Return a safe pointer to the vector of all capability,type pairs of functors arranged downstream of this one in the dependency tree. More...
 
bool allModelsAllowed ()
 Test whether the functor is allowed to be used with all models. More...
 
bool modelAllowed (str model)
 Test whether the functor is always allowed (either explicitly or implicitly) to be used with a given model. More...
 
bool modelExplicitlyAllowed (str model)
 Test whether the functor is explictly always allowed to be used with a given model. More...
 
void setAllowedModel (str model)
 Add a model to the internal list of models for which this functor is allowed to be used. More...
 
bool modelComboAllowed (std::set< str > combo)
 Test whether the functor is allowed (either explicitly or implicitly) to be used with a given combination of models. More...
 
bool modelComboExplicitlyAllowed (std::set< str > combo)
 Test whether the functor has been explictly allowed to be used with a given combination of models. More...
 
void setModelGroup (str group, str contents)
 Add a model group definition to the internal list of model groups. More...
 
void setAllowedModelGroupCombo (str groups)
 Add a combination of model groups to the internal list of combinations for which this functor is allowed to be used. More...
 
virtual double getRuntimeAverage ()
 Interfaces for runtime optimization Need to be implemented by daughters. More...
 
virtual double getInvalidationRate ()
 
virtual void setFadeRate (double)
 
virtual void notifyOfInvalidation (const str &)
 
virtual void reset ()
 

Protected Member Functions

bool allowed_parent_or_friend_exists (str model)
 Test if there is a model in the functor's allowedModels list as which this model can be interpreted. More...
 
bool in_allowed_combo (str model)
 Check that a model is actually part of a combination that is allowed to be used with this functor. More...
 
bool contains_anything_interpretable_as_member_of (std::set< str > combo, str group)
 Test whether any of the entries in a given model group is a valid interpretation of any members in a given combination. More...
 
bool has_common_elements (std::set< str > combo, str group)
 Work out whether a given combination of models and a model group have any elements in common. More...
 
str find_friend_or_parent_model_in_map (str model, std::map< str, std::set< sspair > > karta)
 Try to find a parent or friend model in some user-supplied map from models to sspair vectors. More...
 
virtual void reset (int)
 Reset functor for one thread only. More...
 

Static Protected Member Functions

static void failBigTime (str method)
 Attempt to retrieve a dependency or model parameter that has not been resolved. More...
 

Protected Attributes

str myName
 Internal storage of the function name. More...
 
str myCapability
 Internal storage of exactly what the function calculates. More...
 
str myType
 Internal storage of the type of what the function calculates. More...
 
str myOrigin
 Internal storage of the name of the module or backend to which the function belongs. More...
 
str myVersion
 Internal storage of the version of the module or backend to which the function belongs. More...
 
str myPurpose
 Purpose of the function (relevant for output and next-to-output functors) More...
 
const Models::ModelFunctorClawmyClaw
 Bound model functor claw, for checking relationships between models. More...
 
const str myLabel
 String label, used to label functor results for printer system. More...
 
const str myTimingLabel
 String label, used to label functor timing data for printer system. More...
 
int myStatus
 Status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active. More...
 
int myVertexID
 Internal storage of the vertex ID number used by the printer system to identify functors. More...
 
int myTimingVertexID
 ID assigned by printers to the timing data output stream. More...
 
bool verbose
 Debug flag. More...
 
Options myOptions
 Internal storage of function options, as a YAML node. More...
 
Options mySubCaps
 Internal storage of function sub-capabilities, as a YAML node. More...
 
std::set< sspairmyDependees
 List of all capability,type pairs of functors downstream of this one in the dependency tree. More...
 
std::set< strallowedModels
 List of allowed models. More...
 
std::set< std::set< str > > allowedGroupCombos
 List of allowed model group combinations. More...
 
std::map< str, std::set< str > > modelGroups
 Map from model group names to group contents. More...
 

Detailed Description

Function wrapper (functor) base class.

Definition at line 87 of file functors.hpp.

Constructor & Destructor Documentation

◆ functor()

Gambit::functor::functor ( str  func_name,
str  func_capability,
str  result_type,
str  origin_name,
Models::ModelFunctorClaw claw 
)

Constructor.

Definition at line 57 of file functors.cpp.

61  :
62  myName (func_name),
63  myCapability (func_capability),
64  myType (Utils::fix_type(result_type)),
65  myOrigin (origin_name),
66  myClaw (&claw),
67  myLabel ("#"+func_capability+" @"+origin_name+"::"+func_name),
68  myTimingLabel ("Runtime(ns) for "+myLabel),
69  myStatus (0),
70  myVertexID (-1), // (Note: myVertexID = -1 is intended to mean that no vertexID has been assigned)
71  myTimingVertexID(-1), // Not actually a graph vertex; ID assigned by "get_main_param_id" function.
72  verbose (false) // For debugging.
73  {}
str myCapability
Internal storage of exactly what the function calculates.
Definition: functors.hpp:322
const str myTimingLabel
String label, used to label functor timing data for printer system.
Definition: functors.hpp:337
str myOrigin
Internal storage of the name of the module or backend to which the function belongs.
Definition: functors.hpp:326
bool verbose
Debug flag.
Definition: functors.hpp:352
str myType
Internal storage of the type of what the function calculates.
Definition: functors.hpp:324
const str myLabel
String label, used to label functor results for printer system.
Definition: functors.hpp:335
str myName
Internal storage of the function name.
Definition: functors.hpp:320
int myVertexID
Internal storage of the vertex ID number used by the printer system to identify functors.
Definition: functors.hpp:348
int myStatus
Status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = functi...
Definition: functors.hpp:346
const Models::ModelFunctorClaw * myClaw
Bound model functor claw, for checking relationships between models.
Definition: functors.hpp:332
str fix_type(str)
Clean out whitespace and strip Gambit and default BOSSed class namespaces.
int myTimingVertexID
ID assigned by printers to the timing data output stream.
Definition: functors.hpp:350

◆ ~functor()

virtual Gambit::functor::~functor ( )
inlinevirtual

Definition at line 96 of file functors.hpp.

96 {}

Member Function Documentation

◆ allModelsAllowed()

bool Gambit::functor::allModelsAllowed ( )

Test whether the functor is allowed to be used with all models.

Definition at line 444 of file functors.cpp.

References allowedGroupCombos, and allowedModels.

445  {
446  return allowedModels.empty() and allowedGroupCombos.empty();
447  }
std::set< std::set< str > > allowedGroupCombos
List of allowed model group combinations.
Definition: functors.hpp:367
std::set< str > allowedModels
List of allowed models.
Definition: functors.hpp:364

◆ allowed_parent_or_friend_exists()

bool Gambit::functor::allowed_parent_or_friend_exists ( str  model)
inlineprotected

Test if there is a model in the functor's allowedModels list as which this model can be interpreted.

Definition at line 534 of file functors.cpp.

References allowedModels, Gambit::Models::ModelFunctorClaw::downstream_of(), Gambit::Models::ModelFunctorClaw::model_exists(), and myClaw.

Referenced by modelAllowed().

535  {
536  for (std::set<str>::reverse_iterator it = allowedModels.rbegin() ; it != allowedModels.rend(); ++it)
537  {
538  if (myClaw->model_exists(*it))
539  {
540  if (myClaw->downstream_of(model, *it)) return true;
541  }
542  }
543  return false;
544  }
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
bool model_exists(const str &) const
Indicate whether a model is recognised by GAMBIT or not.
Definition: models.cpp:209
const Models::ModelFunctorClaw * myClaw
Bound model functor claw, for checking relationships between models.
Definition: functors.hpp:332
std::set< str > allowedModels
List of allowed models.
Definition: functors.hpp:364
Here is the call graph for this function:
Here is the caller graph for this function:

◆ backend_conditional_dependencies() [1/3]

std::set< sspair > Gambit::functor::backend_conditional_dependencies ( str  ,
str  ,
str  ,
str   
)
virtual

Getter for listing backend-specific conditional dependencies (4-string version)

Reimplemented in Gambit::module_functor_common.

Definition at line 268 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

Referenced by backend_conditional_dependencies().

269  {
270  utils_error().raise(LOCAL_INFO,"The backend_conditional_dependencies method has not been defined in this class.");
271  std::set<sspair> empty;
272  return empty;
273  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ backend_conditional_dependencies() [2/3]

std::set< sspair > Gambit::functor::backend_conditional_dependencies ( str  req,
str  type,
str  be 
)
virtual

Getter for backend-specific conditional dependencies (3-string version)

Reimplemented in Gambit::module_functor_common.

Definition at line 282 of file functors.cpp.

References backend_conditional_dependencies().

283  {
284  return backend_conditional_dependencies(req, type, be, "any");
285  }
virtual std::set< sspair > backend_conditional_dependencies(str, str, str, str)
Getter for listing backend-specific conditional dependencies (4-string version)
Definition: functors.cpp:268
str type() const
Getter for the wrapped function&#39;s reported return type.
Definition: functors.cpp:119
Here is the call graph for this function:

◆ backend_conditional_dependencies() [3/3]

std::set< sspair > Gambit::functor::backend_conditional_dependencies ( functor be_functor)
virtual

Getter for backend-specific conditional dependencies (backend functor pointer version)

Reimplemented in Gambit::module_functor_common.

Definition at line 288 of file functors.cpp.

References backend_conditional_dependencies(), capability(), origin(), type(), and version().

289  {
290  return backend_conditional_dependencies (be_functor->capability(), be_functor->type(),
291  be_functor->origin(), be_functor->version());
292  }
virtual std::set< sspair > backend_conditional_dependencies(str, str, str, str)
Getter for listing backend-specific conditional dependencies (4-string version)
Definition: functors.cpp:268
Here is the call graph for this function:

◆ backendgroups()

std::set< str > Gambit::functor::backendgroups ( )
virtual

Getter for listing backend requirement groups.

Reimplemented in Gambit::module_functor_common.

Definition at line 225 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

226  {
227  utils_error().raise(LOCAL_INFO,"The backendgroups method has not been defined in this class.");
228  std::set<str> empty;
229  return empty;
230  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ backendreq_tags()

std::set< str > Gambit::functor::backendreq_tags ( sspair  )
virtual

Getter for listing tags associated with backend requirements.

Reimplemented in Gambit::module_functor_common.

Definition at line 253 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

254  {
255  utils_error().raise(LOCAL_INFO,"The backendreq_tags method has not been defined in this class.");
256  std::set<str> empty;
257  return empty;
258  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ backendreqs() [1/2]

std::set< sspair > Gambit::functor::backendreqs ( )
virtual

Getter for listing all backend requirements.

Reimplemented in Gambit::module_functor_common.

Definition at line 232 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

233  {
234  utils_error().raise(LOCAL_INFO,"The backendreqs method has not been defined in this class.");
235  std::set<sspair> empty;
236  return empty;
237  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ backendreqs() [2/2]

std::set< sspair > Gambit::functor::backendreqs ( str  )
virtual

Getter for listing backend requirements from a specific group.

Reimplemented in Gambit::module_functor_common.

Definition at line 239 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

240  {
241  utils_error().raise(LOCAL_INFO,"The backendreqs method has not been defined in this class.");
242  std::set<sspair> empty;
243  return empty;
244  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ backendspermitted()

std::set< sspair > Gambit::functor::backendspermitted ( sspair  )
virtual

Getter for listing permitted backends.

Reimplemented in Gambit::module_functor_common.

Definition at line 246 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

247  {
248  utils_error().raise(LOCAL_INFO,"The backendspermitted method has not been defined in this class.");
249  std::set<sspair> empty;
250  return empty;
251  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ breakLoop()

void Gambit::functor::breakLoop ( )
virtual

Tell the functor that the loop it manages should break now.

Reimplemented in Gambit::module_functor_common.

Definition at line 276 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

Referenced by Gambit::module_functor_common::breakLoopFromManagedFunctor().

277  {
278  utils_error().raise(LOCAL_INFO,"The breakLoop method has not been defined in this class.");
279  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculate()

void Gambit::functor::calculate ( )
virtual

Virtual calculate(); needs to be redefined in daughters.

Reimplemented in Gambit::module_functor< void >, Gambit::module_functor< TYPE >, and Gambit::module_functor< ModelParameters >.

Definition at line 76 of file functors.cpp.

Referenced by reset_and_calculate().

76 {}
Here is the caller graph for this function:

◆ canBeLoopManager()

bool Gambit::functor::canBeLoopManager ( )
virtual

Getter for revealing whether this is permitted to be a manager functor.

Reimplemented in Gambit::module_functor_common.

Definition at line 183 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

Referenced by Gambit::module_functor_common::resolveLoopManager().

184  {
185  utils_error().raise(LOCAL_INFO,"The canBeLoopManager method has not been defined in this class.");
186  return false;
187  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ capability()

str Gambit::functor::capability ( ) const

◆ contains_anything_interpretable_as_member_of()

bool Gambit::functor::contains_anything_interpretable_as_member_of ( std::set< str combo,
str  group 
)
inlineprotected

Test whether any of the entries in a given model group is a valid interpretation of any members in a given combination.

Definition at line 572 of file functors.cpp.

References Gambit::Models::ModelFunctorClaw::downstream_of(), Gambit::Models::ModelFunctorClaw::model_exists(), modelGroups, Gambit::LogTags::models, and myClaw.

Referenced by modelComboAllowed().

573  {
574  // Work through the members of the model group
575  std::set<str> models = modelGroups.at(group);
576  for (std::set<str>::const_iterator it = models.begin() ; it != models.end(); ++it)
577  {
578  if (myClaw->model_exists(*it))
579  {
580  // Work through the members of the combination
581  for (std::set<str>::const_iterator jt = combo.begin() ; jt != combo.end(); ++jt)
582  {
583  if (myClaw->model_exists(*jt))
584  {
585  if (myClaw->downstream_of(*jt, *it)) return true;
586  }
587  }
588  }
589  }
590  return false;
591  }
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
std::map< str, std::set< str > > modelGroups
Map from model group names to group contents.
Definition: functors.hpp:370
bool model_exists(const str &) const
Indicate whether a model is recognised by GAMBIT or not.
Definition: models.cpp:209
const Models::ModelFunctorClaw * myClaw
Bound model functor claw, for checking relationships between models.
Definition: functors.hpp:332
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dependencies()

std::set< sspair > Gambit::functor::dependencies ( )
virtual

Getter for listing currently activated dependencies.

Reimplemented in Gambit::module_functor_common.

Definition at line 218 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

219  {
220  utils_error().raise(LOCAL_INFO,"The dependencies method has not been defined in this class.");
221  std::set<sspair> empty;
222  return empty;
223  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ failBigTime()

void Gambit::functor::failBigTime ( str  method)
staticprotected

Attempt to retrieve a dependency or model parameter that has not been resolved.

Definition at line 522 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

523  {
524  str error_msg = "Attempted to use a functor method from a null pointer.";
525  error_msg += "\nProbably you tried to use a conditional dependency that has"
526  "\nnot been activated, or a model parameter that is not defined"
527  "\nin the model for which this function has been invoked."
528  "\nPlease check your module function source code."
529  "\nMethod invoked: " + method + ".";
530  utils_error().raise(LOCAL_INFO,error_msg);
531  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
const int method
Definition: Axions.cpp:646
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
Here is the call graph for this function:

◆ find_friend_or_parent_model_in_map()

str Gambit::functor::find_friend_or_parent_model_in_map ( str  model,
std::map< str, std::set< sspair > >  karta 
)
protected

Try to find a parent or friend model in some user-supplied map from models to sspair vectors.

Try to find a parent or friend model in some user-supplied map from models to sspair vectors Preferentially returns the 'least removed' parent or friend, i.e.

less steps back in the model lineage.

Definition at line 607 of file functors.cpp.

References Gambit::Models::ModelFunctorClaw::downstream_of(), Gambit::Models::ModelFunctorClaw::model_exists(), and myClaw.

Referenced by Gambit::module_functor_common::model_conditional_backend_reqs(), and Gambit::module_functor_common::model_conditional_dependencies().

608  {
609  std::vector<str> candidates;
610  for (std::map< str, std::set<sspair> >::reverse_iterator it = karta.rbegin() ; it != karta.rend(); ++it)
611  {
612  if (myClaw->model_exists(it->first))
613  {
614  if (myClaw->downstream_of(model, it->first)) candidates.push_back(it->first);
615  }
616  }
617  // If found no candidates, return the empty string.
618  if (candidates.empty()) return "";
619  // If found just one, return it with no further questions.
620  if (candidates.size() == 1) return candidates[0];
621  // If found more than one, choose the one closest to the model passed in.
622  str result = candidates.front();
623  for (std::vector<str>::iterator it = candidates.begin()+1; it != candidates.end(); ++it)
624  {
625  if (myClaw->downstream_of(*it, result)) result = *it;
626  }
627  return result;
628  }
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
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
bool model_exists(const str &) const
Indicate whether a model is recognised by GAMBIT or not.
Definition: models.cpp:209
const Models::ModelFunctorClaw * myClaw
Bound model functor claw, for checking relationships between models.
Definition: functors.hpp:332
Here is the call graph for this function:
Here is the caller graph for this function:

◆ forcematchingbackend()

std::set< sspair > Gambit::functor::forcematchingbackend ( str  )
virtual

Getter for listing backend requirements that must be resolved from the same backend.

Reimplemented in Gambit::module_functor_common.

Definition at line 260 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

261  {
262  utils_error().raise(LOCAL_INFO,"The forcematchingbackend method has not been defined in this class.");
263  std::set<sspair> empty;
264  return empty;
265  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ getDependees()

safe_ptr< std::set< sspair > > Gambit::functor::getDependees ( )

Return a safe pointer to the vector of all capability,type pairs of functors arranged downstream of this one in the dependency tree.

Definition at line 413 of file functors.cpp.

References myDependees.

Referenced by Gambit::module_functor_common::notifyOfDependee(), and Gambit::register_function().

414  {
415  return safe_ptr<std::set<sspair>>(&myDependees);
416  }
std::set< sspair > myDependees
List of all capability,type pairs of functors downstream of this one in the dependency tree...
Definition: functors.hpp:361
Here is the caller graph for this function:

◆ getInvalidationRate()

double Gambit::functor::getInvalidationRate ( )
virtual

Reimplemented in Gambit::module_functor_common.

Definition at line 82 of file functors.cpp.

82 { return 0; }

◆ getOptions()

safe_ptr< Options > Gambit::functor::getOptions ( )

Return a safe pointer to the options that this functor is supposed to run with (e.g. from the ini file).

Definition at line 375 of file functors.cpp.

References myOptions.

Referenced by Gambit::register_function().

376  {
377  return safe_ptr<Options>(&myOptions);
378  }
Options myOptions
Internal storage of function options, as a YAML node.
Definition: functors.hpp:355
Here is the caller graph for this function:

◆ getRuntimeAverage()

double Gambit::functor::getRuntimeAverage ( )
virtual

Interfaces for runtime optimization Need to be implemented by daughters.

Reimplemented in Gambit::module_functor_common.

Definition at line 81 of file functors.cpp.

81 { return 0; }

◆ getSubCaps()

safe_ptr< Options > Gambit::functor::getSubCaps ( )

Return a safe pointer to the subcaps that this functor realises it is supposed to facilitate downstream calculation of.

Definition at line 407 of file functors.cpp.

References mySubCaps.

Referenced by Gambit::module_functor_common::notifyOfDependee(), and Gambit::register_function().

408  {
409  return safe_ptr<Options>(&mySubCaps);
410  }
Options mySubCaps
Internal storage of function sub-capabilities, as a YAML node.
Definition: functors.hpp:358
Here is the caller graph for this function:

◆ has_common_elements()

bool Gambit::functor::has_common_elements ( std::set< str combo,
str  group 
)
inlineprotected

Work out whether a given combination of models and a model group have any elements in common.

Definition at line 594 of file functors.cpp.

References modelGroups, and Gambit::LogTags::models.

Referenced by modelComboExplicitlyAllowed().

595  {
596  // Work through the members of the model group
597  std::set<str> models = modelGroups.at(group);
598  for (std::set<str>::reverse_iterator it = models.rbegin() ; it != models.rend(); ++it)
599  {
600  if ( std::find(combo.begin(), combo.end(), *it) == combo.end() ) return true;
601  }
602  return false;
603  }
std::map< str, std::set< str > > modelGroups
Map from model group names to group contents.
Definition: functors.hpp:370
Here is the caller graph for this function:

◆ in_allowed_combo()

bool Gambit::functor::in_allowed_combo ( str  model)
inlineprotected

Check that a model is actually part of a combination that is allowed to be used with this functor.

Definition at line 547 of file functors.cpp.

References allowedGroupCombos, Gambit::Models::ModelFunctorClaw::downstream_of(), combine_hdf5::group, Gambit::Models::ModelFunctorClaw::model_exists(), modelAllowed(), modelGroups, Gambit::LogTags::models, and myClaw.

548  {
549  // If the model is allowed on its own, just give the thumbs up immediately.
550  if (modelAllowed(model)) return true;
551  // Loop over the allowed combinations, and check if the passed model matches anything in any of them
552  for(std::set<std::set<str> >::const_iterator group_combo = allowedGroupCombos.begin(); group_combo != allowedGroupCombos.end(); group_combo++)
553  {
554  //Loop over each group in the allowed group combination, and check if the model is interpretable as a model in the group.
555  for(std::set<str>::const_iterator group = group_combo->begin(); group != group_combo->end(); group++)
556  {
557  // Work through the members of the model group
558  std::set<str> models = modelGroups.at(*group);
559  for (std::set<str>::reverse_iterator it = models.rbegin() ; it != models.rend(); ++it)
560  {
561  if (myClaw->model_exists(*it))
562  {
563  if (myClaw->downstream_of(model, *it)) return true;
564  }
565  }
566  }
567  }
568  return false;
569  }
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
std::map< str, std::set< str > > modelGroups
Map from model group names to group contents.
Definition: functors.hpp:370
bool model_exists(const str &) const
Indicate whether a model is recognised by GAMBIT or not.
Definition: models.cpp:209
std::set< std::set< str > > allowedGroupCombos
List of allowed model group combinations.
Definition: functors.hpp:367
const Models::ModelFunctorClaw * myClaw
Bound model functor claw, for checking relationships between models.
Definition: functors.hpp:332
bool modelAllowed(str model)
Test whether the functor is always allowed (either explicitly or implicitly) to be used with a given ...
Definition: functors.cpp:419
Here is the call graph for this function:

◆ label()

str Gambit::functor::label ( ) const

Getter for string label.

Getter for the printer label.

Definition at line 148 of file functors.cpp.

References myLabel.

148 { return myLabel; }
const str myLabel
String label, used to label functor results for printer system.
Definition: functors.hpp:335

◆ loopManagerCapability()

str Gambit::functor::loopManagerCapability ( )
virtual

Getter for revealing the required capability of the wrapped function's loop manager.

Reimplemented in Gambit::module_functor_common.

Definition at line 190 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

191  {
192  utils_error().raise(LOCAL_INFO,"The loopManagerCapability method has not been defined in this class.");
193  return "none";
194  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ loopManagerName()

str Gambit::functor::loopManagerName ( )
virtual

Getter for revealing the name of the wrapped function's assigned loop manager.

Reimplemented in Gambit::module_functor_common.

Definition at line 204 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

205  {
206  utils_error().raise(LOCAL_INFO,"The loopManagerName method has not been defined in this class.");
207  return "none";
208  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ loopManagerOrigin()

str Gambit::functor::loopManagerOrigin ( )
virtual

Getter for revealing the module of the wrapped function's assigned loop manager.

Reimplemented in Gambit::module_functor_common.

Definition at line 211 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

212  {
213  utils_error().raise(LOCAL_INFO,"The loopManagerOrigin method has not been defined in this class.");
214  return "none";
215  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ loopManagerType()

str Gambit::functor::loopManagerType ( )
virtual

Getter for revealing the required type of the wrapped function's loop manager.

Reimplemented in Gambit::module_functor_common.

Definition at line 197 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

198  {
199  utils_error().raise(LOCAL_INFO,"The loopManagerType method has not been defined in this class.");
200  return "none";
201  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ model_conditional_backend_reqs()

std::set< sspair > Gambit::functor::model_conditional_backend_reqs ( str  )
virtual

Getter for listing model-specific conditional backend requirements.

Reimplemented in Gambit::module_functor_common.

Definition at line 303 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

304  {
305  utils_error().raise(LOCAL_INFO,"The model_conditional_backend_reqs method has not been defined in this class.");
306  std::set<sspair> empty;
307  return empty;
308  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ model_conditional_dependencies()

std::set< sspair > Gambit::functor::model_conditional_dependencies ( str  )
virtual

Getter for listing model-specific conditional dependencies.

Reimplemented in Gambit::module_functor_common.

Definition at line 295 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

296  {
297  utils_error().raise(LOCAL_INFO,"The model_conditional_dependencies method has not been defined in this class.");
298  std::set<sspair> empty;
299  return empty;
300  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ modelAllowed()

bool Gambit::functor::modelAllowed ( str  model)

Test whether the functor is always allowed (either explicitly or implicitly) to be used with a given model.

Test whether the functor is allowed (either explicitly or implicitly) to be used with a given model.

Definition at line 419 of file functors.cpp.

References allowed_parent_or_friend_exists(), allowedGroupCombos, allowedModels, myLabel, and verbose.

Referenced by in_allowed_combo(), and modelComboAllowed().

420  {
421  bool allowed = false;
422  if (verbose)
423  {
424  std::cout << "Checking allowedModels set for functor "<<myLabel<<std::endl;
425  for(std::set<str>::iterator it = allowedModels.begin(); it != allowedModels.end(); ++it)
426  {
427  std::cout << " "<< *it << std::endl;
428  }
429  }
430  if (allowedModels.empty() and allowedGroupCombos.empty()) allowed=true;
431  if (allowed_parent_or_friend_exists(model)) allowed=true;
432  if (verbose) std::cout << " Allowed to be used with model "<<model<<"? "<<allowed<<std::endl;
433  return allowed;
434  }
bool verbose
Debug flag.
Definition: functors.hpp:352
bool allowed_parent_or_friend_exists(str model)
Test if there is a model in the functor&#39;s allowedModels list as which this model can be interpreted...
Definition: functors.cpp:534
const str myLabel
String label, used to label functor results for printer system.
Definition: functors.hpp:335
std::set< std::set< str > > allowedGroupCombos
List of allowed model group combinations.
Definition: functors.hpp:367
std::set< str > allowedModels
List of allowed models.
Definition: functors.hpp:364
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modelComboAllowed()

bool Gambit::functor::modelComboAllowed ( std::set< str combo)

Test whether the functor is allowed (either explicitly or implicitly) to be used with a given combination of models.

Definition at line 453 of file functors.cpp.

References allowedGroupCombos, contains_anything_interpretable_as_member_of(), combine_hdf5::group, and modelAllowed().

454  {
455  // If any model in the combo is always allowed, then give the combo a thumbs up.
456  for(std::set<str>::const_iterator model = combo.begin(); model != combo.end(); model++)
457  {
458  if (modelAllowed(*model)) return true;
459  }
460  // Loop over the allowed combinations, and check if the passed combo matches any of them
461  for(std::set<std::set<str> >::const_iterator group_combo = allowedGroupCombos.begin(); group_combo != allowedGroupCombos.end(); group_combo++)
462  {
463  bool matches = true;
464  //Loop over each group in the allowed group combination, and check if one of the entries in the passed model combination matches it somehow.
465  for(std::set<str>::const_iterator group = group_combo->begin(); group != group_combo->end(); group++)
466  {
467  matches = matches and contains_anything_interpretable_as_member_of(combo, *group);
468  if (not matches) break;
469  }
470  //Return true immediately if all entries in the allowed group combination have been matched.
471  if (matches) return true;
472  }
473  return false;
474  }
bool contains_anything_interpretable_as_member_of(std::set< str > combo, str group)
Test whether any of the entries in a given model group is a valid interpretation of any members in a ...
Definition: functors.cpp:572
std::set< std::set< str > > allowedGroupCombos
List of allowed model group combinations.
Definition: functors.hpp:367
bool modelAllowed(str model)
Test whether the functor is always allowed (either explicitly or implicitly) to be used with a given ...
Definition: functors.cpp:419
Here is the call graph for this function:

◆ modelComboExplicitlyAllowed()

bool Gambit::functor::modelComboExplicitlyAllowed ( std::set< str combo)

Test whether the functor has been explictly allowed to be used with a given combination of models.

Definition at line 477 of file functors.cpp.

References allowedGroupCombos, combine_hdf5::group, has_common_elements(), and modelExplicitlyAllowed().

478  {
479  // If any model in the combo is always explicitly allowed, then give the combo a thumbs up.
480  for(std::set<str>::const_iterator model = combo.begin(); model != combo.end(); model++)
481  {
482  if (modelExplicitlyAllowed(*model)) return true;
483  }
484  // Loop over the allowed combinations, and check if the passed combo matches any of them
485  for(std::set<std::set<str> >::const_iterator group_combo = allowedGroupCombos.begin(); group_combo != allowedGroupCombos.end(); group_combo++)
486  {
487  bool matches = true;
488  //Loop over each group in the allowed group combination, and check if one of the entries in the passed model combination matches it explicitly.
489  for(std::set<str>::const_iterator group = group_combo->begin(); group != group_combo->end(); group++)
490  {
491  matches = matches and has_common_elements(combo, *group);
492  if (not matches) break;
493  }
494  //Return true immediately if all entries in the allowed group combination have been matched.
495  if (matches) return true;
496  }
497  return false;
498  }
bool modelExplicitlyAllowed(str model)
Test whether the functor is explictly always allowed to be used with a given model.
Definition: functors.cpp:437
bool has_common_elements(std::set< str > combo, str group)
Work out whether a given combination of models and a model group have any elements in common...
Definition: functors.cpp:594
std::set< std::set< str > > allowedGroupCombos
List of allowed model group combinations.
Definition: functors.hpp:367
Here is the call graph for this function:

◆ modelExplicitlyAllowed()

bool Gambit::functor::modelExplicitlyAllowed ( str  model)

Test whether the functor is explictly always allowed to be used with a given model.

Test whether the functor has been explictly allowed to be used with a given model.

Definition at line 437 of file functors.cpp.

References allowedModels.

Referenced by modelComboExplicitlyAllowed().

438  {
439  if (allowedModels.find(model) != allowedModels.end()) return true;
440  return false;
441  }
std::set< str > allowedModels
List of allowed models.
Definition: functors.hpp:364
Here is the caller graph for this function:

◆ name()

◆ notifyOfBackends()

void Gambit::functor::notifyOfBackends ( std::map< str, std::set< str > >  )
virtual

Indicate to the functor which backends are actually loaded and working.

Reimplemented in Gambit::module_functor_common.

Definition at line 341 of file functors.cpp.

References LOCAL_INFO, print(), Gambit::utils_error(), and Gambit::utils_warning().

342  {
343  utils_error().raise(LOCAL_INFO,"The notifyOfBackends method has not been defined in this class.");
344  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ notifyOfDependee()

void Gambit::functor::notifyOfDependee ( functor )
virtual

Notify the functor that it is being used to fill a dependency of another functor.

Reimplemented in Gambit::module_functor_common.

Definition at line 335 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

Referenced by Gambit::module_functor_common::resolveDependency().

336  {
337  utils_error().raise(LOCAL_INFO,"The notifyOfDependee method has not been defined in this class.");
338  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ notifyOfIniOptions()

void Gambit::functor::notifyOfIniOptions ( const Options opt)

Notify the functor about an instance of the options class that contains information from its corresponding ini-file entry in the auxiliaries or observables section.

Definition at line 369 of file functors.cpp.

References myOptions.

370  {
371  myOptions = opt;
372  }
Options myOptions
Internal storage of function options, as a YAML node.
Definition: functors.hpp:355

◆ notifyOfInvalidation()

void Gambit::functor::notifyOfInvalidation ( const str )
virtual

Reimplemented in Gambit::module_functor_common.

Definition at line 84 of file functors.cpp.

84 {}

◆ notifyOfModel()

void Gambit::functor::notifyOfModel ( str  )
virtual

Notify the functor that a certain model is being scanned, so that it can activate itself accordingly.

Notify the functor that a certain model is being scanned, so that it can activate its dependencies accordingly.

Reimplemented in Gambit::module_functor_common.

Definition at line 329 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

330  {
331  utils_error().raise(LOCAL_INFO,"The notifyOfModel method has not been defined in this class.");
332  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ notifyOfSubCaps()

void Gambit::functor::notifyOfSubCaps ( const Options subcaps)

Notify the functor about an instance of the options class that contains sub-capability information.

Definition at line 381 of file functors.cpp.

References Gambit::Options::getValue(), Gambit::Options::hasKey(), LOCAL_INFO, myName, myOrigin, mySubCaps, Gambit::Options::setValue(), and Gambit::utils_error().

Referenced by Gambit::module_functor_common::notifyOfDependee().

382  {
383  for (auto entry : subcaps)
384  {
385  str key = entry.first.as<std::string>();
386  if (not mySubCaps.hasKey(key)) mySubCaps.setValue(key, entry.second);
387  else
388  {
389  std::ostringstream ss1, ss2;
390  ss1 << mySubCaps.getValue<YAML::Node>(key);
391  ss2 << entry.second.as<YAML::Node>();
392  if (not (ss1.str() == ss2.str()))
393  {
394  std::ostringstream ss;
395  ss << "Duplicate sub_capability clash. " << endl
396  << "Your ObsLike section of the YAML file contains both " << endl
397  << key << ": " << ss1.str() << endl << "and" << endl << key << ": " << ss2.str() << endl
398  << "GAMBIT does not know which value to choose when trying to determine the sub-capabilities" << endl
399  << "served by " << myOrigin << "::" << myName << ", as both ObsLike entries depend on this function.";
400  utils_error().raise(LOCAL_INFO, ss.str());
401  }
402  }
403  }
404  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
str myOrigin
Internal storage of the name of the module or backend to which the function belongs.
Definition: functors.hpp:326
#define LOCAL_INFO
Definition: local_info.hpp:34
bool hasKey(const args &... keys) const
Getters for key/value pairs (which is all the options node should contain)
TYPE getValue(const args &... keys) const
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
str myName
Internal storage of the function name.
Definition: functors.hpp:320
void setValue(const KEYTYPE &key, const VALTYPE &val)
Basic setter, for adding extra options.
Options mySubCaps
Internal storage of function sub-capabilities, as a YAML node.
Definition: functors.hpp:358
Here is the call graph for this function:
Here is the caller graph for this function:

◆ origin()

◆ print() [1/2]

void Gambit::functor::print ( Printers::BasePrinter *  printer,
const int  pointID,
int  thread_num 
)
virtual

Printer function.

Print function.

Reimplemented in Gambit::module_functor< void >, Gambit::module_functor< TYPE >, and Gambit::module_functor< ModelParameters >.

Definition at line 348 of file functors.cpp.

Referenced by notifyOfBackends(), and print().

349  {
350  str warn_msg = "This is the functor base class print function! This should not\n";
351  warn_msg += "be used; the print function should be redefined in daughter\n"
352  "functor classes. If this is running there is a problem somewhere.\n"
353  "Currently only functors derived from module_functor_common<!=void>\n"
354  "are allowed to try to print themselves; i.e. backend and void\n"
355  "functors may not do this (they inherit this default message).";
356  utils_warning().raise(LOCAL_INFO,warn_msg);
357  }
#define LOCAL_INFO
Definition: local_info.hpp:34
EXPORT_SYMBOLS warning & utils_warning()
Utility warnings.
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
Here is the caller graph for this function:

◆ print() [2/2]

void Gambit::functor::print ( Printers::BasePrinter *  printer,
const int  pointID 
)
virtual

Printer function (no-thread-index short-circuit)

Reimplemented in Gambit::module_functor< void >, Gambit::module_functor< TYPE >, and Gambit::module_functor< ModelParameters >.

Definition at line 360 of file functors.cpp.

References print().

361  {
362  print(printer,pointID,0);
363  }
Printers::BaseBasePrinter printer
Type of the printer objects.
virtual void print(Printers::BasePrinter *printer, const int pointID, int thread_num)
Printer function.
Definition: functors.cpp:348
Here is the call graph for this function:

◆ purpose()

str Gambit::functor::purpose ( ) const

Getter for purpose (relevant for output nodes, aka helper structures for the dep. resolution)

Definition at line 138 of file functors.cpp.

References myPurpose.

Referenced by Gambit::module_functor_common::setDependency(), and setPurpose().

138 { return myPurpose; }
str myPurpose
Purpose of the function (relevant for output and next-to-output functors)
Definition: functors.hpp:330
Here is the caller graph for this function:

◆ quantity()

sspair Gambit::functor::quantity ( ) const

Getter for the overall quantity provided by the wrapped function (capability-type pair)

Definition at line 136 of file functors.cpp.

References myCapability, and myType.

Referenced by Gambit::module_functor_common::notifyOfDependee(), Gambit::module_functor_common::resolveBackendReq(), and Gambit::module_functor_common::resolveDependency().

136 { return std::make_pair(myCapability, myType); }
str myCapability
Internal storage of exactly what the function calculates.
Definition: functors.hpp:322
str myType
Internal storage of the type of what the function calculates.
Definition: functors.hpp:324
Here is the caller graph for this function:

◆ requiresPrinting()

bool Gambit::functor::requiresPrinting ( ) const
virtual

Getter indicating if the wrapped function's result should to be printed.

Reimplemented in Gambit::module_functor< TYPE >, and Gambit::module_functor< ModelParameters >.

Definition at line 144 of file functors.cpp.

144 { return false; }

◆ requiresTimingPrinting()

bool Gambit::functor::requiresTimingPrinting ( ) const
virtual

Getter indicating if the timing data for this function's execution should be printed.

Reimplemented in Gambit::module_functor_common.

Definition at line 146 of file functors.cpp.

146 { return false; }

◆ reset() [1/2]

void Gambit::functor::reset ( )
virtual

Reimplemented in Gambit::module_functor_common.

Definition at line 85 of file functors.cpp.

Referenced by reset_and_calculate().

85 {}
Here is the caller graph for this function:

◆ reset() [2/2]

void Gambit::functor::reset ( int  )
protectedvirtual

Reset functor for one thread only.

Reimplemented in Gambit::module_functor_common.

Definition at line 86 of file functors.cpp.

86 {}

◆ reset_and_calculate()

void Gambit::functor::reset_and_calculate ( )
virtual

Reset-then-recalculate method.

Definition at line 90 of file functors.cpp.

References calculate(), and reset().

90 { this->reset(omp_get_thread_num()); this->calculate(); }
virtual void reset()
Definition: functors.cpp:85
virtual void calculate()
Virtual calculate(); needs to be redefined in daughters.
Definition: functors.cpp:76
Here is the call graph for this function:

◆ resolveBackendReq()

void Gambit::functor::resolveBackendReq ( functor )
virtual

Resolve a backend requirement using a pointer to another functor object.

Reimplemented in Gambit::module_functor_common.

Definition at line 323 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

324  {
325  utils_error().raise(LOCAL_INFO,"The resolveBackendReq method has not been defined in this class.");
326  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ resolveDependency()

void Gambit::functor::resolveDependency ( functor )
virtual

Resolve a dependency using a pointer to another functor object.

Reimplemented in Gambit::module_functor_common.

Definition at line 311 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

312  {
313  utils_error().raise(LOCAL_INFO,"The resolveDependency method has not been defined in this class.");
314  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ resolveLoopManager()

void Gambit::functor::resolveLoopManager ( functor )
virtual

Set this functor's loop manager (if it has one)

Reimplemented in Gambit::module_functor_common.

Definition at line 317 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

318  {
319  utils_error().raise(LOCAL_INFO,"The resolveLoopManager method has not been defined in this class.");
320  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ retrieve_invalid_point_exception()

invalid_point_exception * Gambit::functor::retrieve_invalid_point_exception ( )
virtual

Retrieve the previously saved exception generated when this functor invalidated the current point in model space.

Reimplemented in Gambit::module_functor_common.

Definition at line 631 of file functors.cpp.

631 { return NULL; }

◆ safe_version()

str Gambit::functor::safe_version ( ) const
virtual

Getter for the 'safe' incarnation of the version of the wrapped function's origin (module or backend)

Reimplemented in Gambit::backend_functor_common< PTR_TYPE, TYPE, ARGS >, Gambit::backend_functor_common< void(*)(ARGS...), void, ARGS... >, Gambit::backend_functor_common< variadic_ptr< void, ARGS... >::type, void, ARGS... >, Gambit::backend_functor_common< variadic_ptr< TYPE, ARGS... >::type, TYPE, ARGS... >, and Gambit::backend_functor_common< TYPE(*)(ARGS...), TYPE, ARGS... >.

Definition at line 125 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

Referenced by Gambit::module_functor_common::resolveBackendReq().

125 { utils_error().raise(LOCAL_INFO,"The safe_version method is only defined for backend functors."); return ""; }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAllowedModel()

void Gambit::functor::setAllowedModel ( str  model)

Add a model to the internal list of models for which this functor is allowed to be used.

Definition at line 450 of file functors.cpp.

References allowedModels.

Referenced by Gambit::register_model_singly().

450 { allowedModels.insert(model); }
std::set< str > allowedModels
List of allowed models.
Definition: functors.hpp:364
Here is the caller graph for this function:

◆ setAllowedModelGroupCombo()

void Gambit::functor::setAllowedModelGroupCombo ( str  groups)

Add a combination of model groups to the internal list of combinations for which this functor is allowed to be used.

Add a model group combination to the internal list of combinations for which this functor is allowed to be used.

Definition at line 511 of file functors.cpp.

References allowedGroupCombos, Gambit::Utils::delimiterSplit(), Gambit::Utils::strip_parentheses(), and Gambit::Utils::strip_whitespace_except_after_const().

Referenced by Gambit::register_model_combination().

512  {
513  //Strip the group combo of its parentheses and whitespace, then split it and save it in the vector of allowed combos
514  Utils::strip_parentheses(groups);
516  std::vector<str> v = Utils::delimiterSplit(groups, ",");
517  std::set<str> group_combo(v.begin(), v.end());
518  allowedGroupCombos.insert(group_combo);
519  }
EXPORT_SYMBOLS void strip_parentheses(str &)
Strips leading and/or trailing parentheses from a string.
EXPORT_SYMBOLS void strip_whitespace_except_after_const(str &)
Strip all whitespace except that following "const", in which case the whitespace is replaced by a sin...
std::set< std::set< str > > allowedGroupCombos
List of allowed model group combinations.
Definition: functors.hpp:367
EXPORT_SYMBOLS std::vector< str > delimiterSplit(str s, str delim)
Split a string into a vector of strings, using a delimiter, and removing any whitespace around the de...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFadeRate()

void Gambit::functor::setFadeRate ( double  )
virtual

Reimplemented in Gambit::module_functor_common.

Definition at line 83 of file functors.cpp.

83 {}

◆ setInUse()

virtual void Gambit::functor::setInUse ( bool  )
inlinevirtual

◆ setIteration()

void Gambit::functor::setIteration ( long long  )
virtual

Set the iteration number in a loop in which this functor runs.

Reimplemented in Gambit::module_functor_common.

Definition at line 177 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

178  {
179  utils_error().raise(LOCAL_INFO,"The setIteration method has not been defined in this class.");
180  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ setModelGroup()

void Gambit::functor::setModelGroup ( str  group,
str  contents 
)

Add a model group definition to the internal list of model groups.

Definition at line 501 of file functors.cpp.

References Gambit::Utils::delimiterSplit(), combine_hdf5::group, modelGroups, and Gambit::Utils::strip_parentheses().

Referenced by Gambit::register_model_group().

502  {
503  //Strip the group contents of its parentheses, then split it, turn it into a set and save it in the map
504  Utils::strip_parentheses(contents);
505  std::vector<str> v = Utils::delimiterSplit(contents, ",");
506  std::set<str> combo(v.begin(), v.end());
507  modelGroups[group] = combo;
508  }
EXPORT_SYMBOLS void strip_parentheses(str &)
Strips leading and/or trailing parentheses from a string.
std::map< str, std::set< str > > modelGroups
Map from model group names to group contents.
Definition: functors.hpp:370
EXPORT_SYMBOLS std::vector< str > delimiterSplit(str s, str delim)
Split a string into a vector of strings, using a delimiter, and removing any whitespace around the de...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNestedList()

void Gambit::functor::setNestedList ( std::vector< functor *> &  )
virtual

Set the ordered list of pointers to other functors that should run nested in a loop managed by this one.

Reimplemented in Gambit::module_functor_common.

Definition at line 171 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

172  {
173  utils_error().raise(LOCAL_INFO,"The setNestedList method has not been defined in this class.");
174  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ setOption()

template<typename TYPE >
void Gambit::functor::setOption ( const str key,
const TYPE  val 
)
inline

Set an option for the functor directly (for use in standalone executables).

Definition at line 269 of file functors.hpp.

270  {
271  myOptions.setValue<str,TYPE>(key, val);
272  }
Options myOptions
Internal storage of function options, as a YAML node.
Definition: functors.hpp:355
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
void setValue(const KEYTYPE &key, const VALTYPE &val)
Basic setter, for adding extra options.

◆ setPrintRequirement()

void Gambit::functor::setPrintRequirement ( bool  flag)
virtual

Setter for indicating if the wrapped function's result should to be printed.

Reimplemented in Gambit::module_functor< TYPE >, and Gambit::module_functor< ModelParameters >.

Definition at line 153 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

154  {
155  if (flag)
156  {
157  utils_error().raise(LOCAL_INFO,"The setPrintRequirement method has not been defined in this class.");
158  }
159  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ setPurpose()

void Gambit::functor::setPurpose ( str  purpose)

Setter for purpose (relevant only for next-to-output functors)

Definition at line 93 of file functors.cpp.

References myPurpose, and purpose().

Referenced by Gambit::module_functor_common::resolveDependency().

93 { myPurpose = purpose; }
str purpose() const
Getter for purpose (relevant for output nodes, aka helper structures for the dep. resolution) ...
Definition: functors.cpp:138
str myPurpose
Purpose of the function (relevant for output and next-to-output functors)
Definition: functors.hpp:330
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStatus()

void Gambit::functor::setStatus ( int  stat)

Setter for status: -6 = required external tool absent (pybind11) -5 = required external tool absent (Mathematica) -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active.

Setter for status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active.

Definition at line 108 of file functors.cpp.

References myStatus, and setInUse().

Referenced by Gambit::module_functor_common::resolveBackendReq().

109  {
110  myStatus = stat;
111  setInUse(myStatus == 2);
112  }
virtual void setInUse(bool)
Set the inUse flag (must be overridden in derived class to have any effect).
Definition: functors.hpp:130
int myStatus
Status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = functi...
Definition: functors.hpp:346
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSubCap()

template<typename TYPE >
void Gambit::functor::setSubCap ( const str key,
const TYPE  val 
)
inline

Set a sub-capability (subcap)for the functor directly (for use in standalone executables).

Definition at line 282 of file functors.hpp.

References combine_hdf5::group.

283  {
284  mySubCaps.setValue<str,TYPE>(key, val);
285  }
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
void setValue(const KEYTYPE &key, const VALTYPE &val)
Basic setter, for adding extra options.
Options mySubCaps
Internal storage of function sub-capabilities, as a YAML node.
Definition: functors.hpp:358

◆ setTimingPrintRequirement()

void Gambit::functor::setTimingPrintRequirement ( bool  flag)
virtual

Setter for indicating if the timing data for this function's execution should be printed.

Setter for indicating if the timing data for this functor should be printed.

Reimplemented in Gambit::module_functor_common.

Definition at line 162 of file functors.cpp.

References LOCAL_INFO, and Gambit::utils_error().

163  {
164  if (flag)
165  {
166  utils_error().raise(LOCAL_INFO,"The setTimingPrintRequirement method has not been defined in this class.");
167  }
168  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ setTimingVertexID()

void Gambit::functor::setTimingVertexID ( int  ID)

Set ID for timing 'vertex' (used in printer system)

Acquire ID for timing 'vertex' (used in printer system)

Definition at line 99 of file functors.cpp.

References myTimingVertexID.

99 { myTimingVertexID = ID; }
int myTimingVertexID
ID assigned by printers to the timing data output stream.
Definition: functors.hpp:350

◆ setVertexID()

void Gambit::functor::setVertexID ( int  ID)

Setter for vertex ID (used in printer system)

Definition at line 96 of file functors.cpp.

References myVertexID.

96 { myVertexID = ID; }
int myVertexID
Internal storage of the vertex ID number used by the printer system to identify functors.
Definition: functors.hpp:348

◆ status()

int Gambit::functor::status ( ) const

Getter for the wrapped function current status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active.

Definition at line 134 of file functors.cpp.

References myStatus.

Referenced by Gambit::Models::ModelFunctorClaw::checkPrimaryModelFunctorUsage().

134 { return myStatus; }
int myStatus
Status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = functi...
Definition: functors.hpp:346
Here is the caller graph for this function:

◆ timingLabel()

str Gambit::functor::timingLabel ( ) const

Getter for the printer timing label.

Definition at line 150 of file functors.cpp.

References myTimingLabel.

150 { return myTimingLabel; }
const str myTimingLabel
String label, used to label functor timing data for printer system.
Definition: functors.hpp:337

◆ timingVertexID()

int Gambit::functor::timingVertexID ( ) const

Getter for timing vertex ID.

Definition at line 142 of file functors.cpp.

References myTimingVertexID.

142 { return myTimingVertexID; }
int myTimingVertexID
ID assigned by printers to the timing data output stream.
Definition: functors.hpp:350

◆ type()

str Gambit::functor::type ( ) const

Getter for the wrapped function's reported return type.

Definition at line 119 of file functors.cpp.

References myType.

Referenced by backend_conditional_dependencies(), Gambit::module_functor_common::backend_conditional_dependencies(), Gambit::DRes::backendFuncMatchesIniEntry(), Gambit::DRes::moduleFuncMatchesIniEntry(), Gambit::module_functor_common::resolveLoopManager(), and Gambit::module_functor_common::setBackendReq().

119 { return myType; }
str myType
Internal storage of the type of what the function calculates.
Definition: functors.hpp:324
Here is the caller graph for this function:

◆ version()

str Gambit::functor::version ( ) const

Getter for the version of the wrapped function's origin (module or backend)

Definition at line 123 of file functors.cpp.

References myVersion.

Referenced by backend_conditional_dependencies(), Gambit::module_functor_common::backend_conditional_dependencies(), Gambit::DRes::backendFuncMatchesIniEntry(), Gambit::module_functor_common::resolveBackendReq(), Gambit::DRes::DependencyResolver::resolveRequirement(), and Gambit::BE_bucket_base::version().

123 { return myVersion; }
str myVersion
Internal storage of the version of the module or backend to which the function belongs.
Definition: functors.hpp:328
Here is the caller graph for this function:

◆ vertexID()

int Gambit::functor::vertexID ( ) const

Getter for vertex ID.

Definition at line 140 of file functors.cpp.

References myVertexID.

140 { return myVertexID; }
int myVertexID
Internal storage of the vertex ID number used by the printer system to identify functors.
Definition: functors.hpp:348

Member Data Documentation

◆ allowedGroupCombos

std::set<std::set<str> > Gambit::functor::allowedGroupCombos
protected

List of allowed model group combinations.

Definition at line 367 of file functors.hpp.

Referenced by allModelsAllowed(), in_allowed_combo(), modelAllowed(), modelComboAllowed(), modelComboExplicitlyAllowed(), and setAllowedModelGroupCombo().

◆ allowedModels

std::set<str> Gambit::functor::allowedModels
protected

◆ modelGroups

std::map<str, std::set<str> > Gambit::functor::modelGroups
protected

◆ myCapability

str Gambit::functor::myCapability
protected

Internal storage of exactly what the function calculates.

Definition at line 322 of file functors.hpp.

Referenced by capability(), and quantity().

◆ myClaw

const Models::ModelFunctorClaw* Gambit::functor::myClaw
protected

◆ myDependees

std::set<sspair> Gambit::functor::myDependees
protected

List of all capability,type pairs of functors downstream of this one in the dependency tree.

Definition at line 361 of file functors.hpp.

Referenced by getDependees(), and Gambit::module_functor_common::notifyOfDependee().

◆ myLabel

const str Gambit::functor::myLabel
protected

String label, used to label functor results for printer system.

Definition at line 335 of file functors.hpp.

Referenced by label(), and modelAllowed().

◆ myName

◆ myOptions

Options Gambit::functor::myOptions
protected

Internal storage of function options, as a YAML node.

Definition at line 355 of file functors.hpp.

Referenced by getOptions(), and notifyOfIniOptions().

◆ myOrigin

◆ myPurpose

str Gambit::functor::myPurpose
protected

Purpose of the function (relevant for output and next-to-output functors)

Definition at line 330 of file functors.hpp.

Referenced by purpose(), Gambit::module_functor_common::resolveDependency(), Gambit::module_functor_common::setDependency(), and setPurpose().

◆ myStatus

int Gambit::functor::myStatus
protected

Status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = function absent -1 = origin absent 0 = model incompatibility (default) 1 = available 2 = active.

Definition at line 346 of file functors.hpp.

Referenced by Gambit::module_functor< void >::calculate(), Gambit::module_functor_common::notifyOfBackends(), setStatus(), and status().

◆ mySubCaps

Options Gambit::functor::mySubCaps
protected

Internal storage of function sub-capabilities, as a YAML node.

Definition at line 358 of file functors.hpp.

Referenced by getSubCaps(), and notifyOfSubCaps().

◆ myTimingLabel

const str Gambit::functor::myTimingLabel
protected

String label, used to label functor timing data for printer system.

Definition at line 337 of file functors.hpp.

Referenced by timingLabel().

◆ myTimingVertexID

int Gambit::functor::myTimingVertexID
protected

ID assigned by printers to the timing data output stream.

Definition at line 350 of file functors.hpp.

Referenced by setTimingVertexID(), and timingVertexID().

◆ myType

str Gambit::functor::myType
protected

Internal storage of the type of what the function calculates.

Definition at line 324 of file functors.hpp.

Referenced by quantity(), and type().

◆ myVersion

str Gambit::functor::myVersion
protected

Internal storage of the version of the module or backend to which the function belongs.

Definition at line 328 of file functors.hpp.

Referenced by version().

◆ myVertexID

int Gambit::functor::myVertexID
protected

Internal storage of the vertex ID number used by the printer system to identify functors.

Definition at line 348 of file functors.hpp.

Referenced by setVertexID(), and vertexID().

◆ verbose

bool Gambit::functor::verbose
protected

Debug flag.

Definition at line 352 of file functors.hpp.

Referenced by modelAllowed(), and Gambit::module_functor_common::notifyOfModel().


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