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

Functor derived class for module functions. More...

#include <functors.hpp>

Inheritance diagram for Gambit::module_functor_common:
Collaboration diagram for Gambit::module_functor_common:

Public Member Functions

 module_functor_common (str, str, str, str, Models::ModelFunctorClaw &)
 Constructor. More...
 
virtual ~module_functor_common ()
 Destructor. More...
 
double getRuntimeAverage ()
 Getter for averaged runtime. More...
 
void reset ()
 Reset functor. More...
 
void notifyOfInvalidation (const str &)
 Tell the functor that it invalidated the current point in model space, pass a message explaining why, and throw an exception. More...
 
double getInvalidationRate ()
 Getter for invalidation rate. More...
 
void setFadeRate (double)
 Setter for the fade rate. More...
 
void setTimingPrintRequirement (bool)
 Setter for indicating if the timing data for this function's execution should be printed. More...
 
bool requiresTimingPrinting () const
 Getter indicating if the timing data for this function's execution should be printed. More...
 
bool getActiveModelFlag (str)
 Indicate whether or not a known model is activated or not. More...
 
safe_ptr< strgetChosenReqFromGroup (str)
 Return a safe pointer to a string indicating which backend requirement has been activated for a given backend group. More...
 
virtual void iterate (long long iteration)
 Execute a single iteration in the loop managed by this functor. More...
 
virtual void init_myCurrentIteration_if_NULL ()
 Initialise the array holding the current iteration(s) of this functor. More...
 
virtual void setIteration (long long iteration)
 Setter for setting the iteration number in the loop in which this functor runs. More...
 
virtual omp_safe_ptr< long long > iterationPtr ()
 Return a safe pointer to the iteration number in the loop in which this functor runs. More...
 
virtual void setCanBeLoopManager (bool canManage)
 Setter for specifying whether this is permitted to be a manager functor, which runs other functors nested in a loop. More...
 
virtual bool canBeLoopManager ()
 Getter for revealing whether this is permitted to be a manager functor. More...
 
virtual void setLoopManagerCapType (str cap, str t)
 Setter for specifying the capability required of a manager functor, if it is to run this functor nested in a loop. 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 breakLoopFromManagedFunctor ()
 Tell the manager of the loop in which this functor runs that it is time to break the loop. More...
 
virtual safe_ptr< bool > loopIsDone ()
 Return a safe pointer to the flag indicating that a loop managed by this functor should break now. More...
 
virtual void resetLoop ()
 Provide a way to reset the flag indicating that a loop managed by this functor should break. 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 quant)
 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 req, str type, str be, str ver)
 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 *be_functor)
 Getter for backend-specific conditional dependencies (backend functor pointer version) More...
 
virtual std::set< sspairmodel_conditional_dependencies (str model)
 Getter for listing model-specific conditional dependencies. More...
 
virtual std::set< sspairmodel_conditional_backend_reqs (str model)
 Getter for listing model-specific conditional backend requirements. More...
 
void setDependency (str, str, void(*)(functor *, module_functor_common *), str purpose="")
 Add and activate unconditional dependencies. More...
 
void setConditionalDependency (str, str)
 Add conditional dependency-type pairs in advance of later conditions. More...
 
void setBackendConditionalDependency (str, str, str, str, void(*)(functor *, module_functor_common *))
 Add a backend conditional dependency for multiple backend versions. More...
 
void setBackendConditionalDependencySingular (str, str, str, str, void(*)(functor *, module_functor_common *))
 Add a backend conditional dependency for a single backend version. More...
 
void setModelConditionalDependency (str, str, void(*)(functor *, module_functor_common *))
 Add a model conditional dependency for multiple models. More...
 
void setModelConditionalDependencySingular (str, str, void(*)(functor *, module_functor_common *))
 Add a model conditional dependency for a single model. More...
 
void makeBackendRuleForModel (str, str)
 Add a rule for activating backend requirements according to the model being scanned. More...
 
void setBackendReq (str, str, str, str, void(*)(functor *))
 Add an unconditional backend requirement The info gets updated later if this turns out to be contitional on a model. More...
 
void setModelConditionalBackendReq (str model, str req, str type)
 Add a model conditional backend requirement for multiple models. More...
 
void setModelConditionalBackendReqSingular (str model, str req, str type)
 Add a model conditional backend requirement for a single model. More...
 
void makeBackendOptionRule (str, str)
 Add a rule for dictating which backends can be used to fulfill which backend requirements. More...
 
void setPermittedBackend (str req, str be, str ver)
 Add a single permitted backend version. More...
 
void makeBackendMatchingRule (str tag)
 Add one or more rules for forcing backends reqs with the same tags to always be resolved from the same backend. More...
 
void setRequiredClassloader (str, str, str)
 Add a rule indicating that classes from a given backend must be available. More...
 
void notifyOfBackends (std::map< str, std::set< str > >)
 Indicate to the functor which backends are actually loaded and working. More...
 
virtual void setNestedList (std::vector< functor *> &newNestedList)
 Set the ordered list of pointers to other functors that should run nested in a loop managed by this one. More...
 
virtual void resolveDependency (functor *dep_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 *be_functor)
 Resolve a backend requirement using a pointer to another functor object. More...
 
virtual void notifyOfModel (str model)
 Notify the functor that a certain model is being scanned, so that it can activate its dependencies and backend reqs accordingly. More...
 
virtual void notifyOfDependee (functor *)
 Notify the functor that another functor depends on it. 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...
 
- Public Member Functions inherited from Gambit::functor
 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 void setPrintRequirement (bool)
 Setter for indicating if the wrapped function's result should to be printed. 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...
 
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...
 

Protected Member Functions

void reset (int)
 Reset functor for one thread only. More...
 
virtual void acknowledgeInvalidation (invalid_point_exception &, functor *f=NULL)
 Acknowledge that this functor invalidated the current point in model space. More...
 
virtual void startTiming (int)
 Do pre-calculate timing things. More...
 
virtual void finishTiming (int)
 Do post-calculate timing things. More...
 
virtual void init_memory ()
 Initialise the memory of this functor. More...
 
void fill_activeModelFlags ()
 Construct the list of known models only if it doesn't yet exist. More...
 
sspair retrieve_conditional_dep_type_pair (str)
 Retrieve full conditional dependency-type pair from conditional dependency only. More...
 
void check_missing_LogTag ()
 Check if an appropriate LogTag for this functor is missing from the logging system. More...
 
void entering_multithreaded_region ()
 
void leaving_multithreaded_region ()
 
- Protected Member Functions inherited from Gambit::functor
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...
 

Protected Attributes

bool myTimingPrintFlag
 Flag to select whether or not the timing data for this function's execution should be printed;. More...
 
std::chrono::time_point< std::chrono::system_clock > * start
 Beginning and end timing points. More...
 
std::chrono::time_point< std::chrono::system_clock > * end
 
bool point_exception_raised
 A flag indicating whether or not this functor has invalidated the current point. More...
 
invalid_point_exception raised_point_exception
 An exception raised because this functor has invalidated the current point. More...
 
double runtime_average
 Averaged runtime in ns. More...
 
double fadeRate
 Fade rate for average runtime. More...
 
double pInvalidation
 Probability that functors invalidates point in model parameter space. More...
 
bool * needs_recalculating
 Needs recalculating or not? More...
 
bool * already_printed
 Has result already been sent to the printer? More...
 
bool * already_printed_timing
 Has timing data already been sent to the printer? More...
 
bool iCanManageLoops
 Flag indicating whether this function can manage a loop over other functions. More...
 
bool myLoopIsDone
 Flag indicating whether this function is ready to finish its loop (only relevant if iCanManageLoops = true) More...
 
bool iRunNested
 Flag indicating whether this function can run nested in a loop over functions. More...
 
str myLoopManagerCapability
 Capability of a function that mangages a loop that this function can run inside of. More...
 
str myLoopManagerType
 Capability of a function that mangages a loop that this function can run inside of. More...
 
functormyLoopManager
 Pointer to the functor that mangages the loop that this function runs inside of. More...
 
std::vector< functor * > myNestedFunctorList
 Vector of functors that have been set up to run nested within this one. More...
 
long long * myCurrentIteration
 Pointer to counters for iterations of nested functor loop. More...
 
const int globlMaxThreads
 Maximum number of OpenMP threads this MPI process is permitted to launch in total. More...
 
std::set< strmyGroups
 Internal list of backend groups that this functor's requirements fall into. More...
 
std::map< str, strchosenReqsFromGroups
 Map from groups to backend reqs, indicating which backend req has been activated for which backend group. More...
 
std::set< sspairmyBackendReqs
 Set of all backend requirement-type string pairs. More...
 
std::set< sspairmyResolvableBackendReqs
 Set of all backend requirement-type string pairs currently available for resolution. More...
 
std::map< str, std::set< sspair > > myGroupedBackendReqs
 Set of backend requirement-type string pairs for specific backend groups. More...
 
std::set< sspairmyDependencies
 Vector of dependency-type string pairs. More...
 
std::map< str, strmyConditionalDependencies
 Map of conditional dependencies to their types. More...
 
std::map< std::vector< str >, std::set< sspair > > myBackendConditionalDependencies
 Map from (vector with 4 strings: backend req, type, backend, version) to (set of {conditional dependency-type} pairs) More...
 
std::map< str, std::set< sspair > > myModelConditionalDependencies
 Map from models to (set of {conditional dependency-type} pairs) More...
 
std::map< str, std::set< sspair > > myModelConditionalBackendReqs
 Map from models to (set of {conditional backend requirement-type} pairs) More...
 
std::map< str, bool > activeModelFlags
 Map from known models to flags indicating if they are activated or not (known = allowed, in allowed groups or conditions for conditional dependencies) More...
 
std::map< sspair, void(*)(functor *, module_functor_common *)> dependency_map
 Map from (dependency-type pairs) to (pointers to templated void functions that set dependency functor pointers) More...
 
std::map< sspair, functor * > dependency_functor_map
 Map from (dependency-type pairs) to pointers to functors used to resolve them that set dependency functor pointers) More...
 
std::map< str, strbackendreq_types
 Map from backend requirements to their required types. More...
 
std::map< sspair, strbackendreq_groups
 Map from backend requirements to their designated groups. More...
 
std::map< sspair, std::set< str > > backendreq_tagmap
 Map from backend requirements to their rule tags. More...
 
std::map< sspair, void(*)(functor *)> backendreq_map
 Map from (backend requirement-type pairs) to (pointers to templated void functions that set backend requirement functor pointers) More...
 
std::map< sspair, std::set< sspair > > permitted_map
 Map from (backend requirement-type pairs) to (set of permitted {backend-version} pairs) More...
 
std::map< str, std::set< sspair > > myForcedMatches
 Map from tags to sets of matching (backend requirement-type pairs) that are forced to use the same backend. More...
 
std::map< str, std::set< str > > required_classloading_backends
 Map from required classloading backends to their versions. More...
 
std::vector< strmissing_backends
 Vector of required backends currently missing. More...
 
timespec tp
 Internal timespec object. More...
 
int myLogTag
 Integer LogTag, for tagging log messages. More...
 
bool signal_mode_locked = true
 While locked, prevent this function switching off threadsafe* emergency signal handling. More...
 
- Protected Attributes inherited from Gambit::functor
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...
 

Friends

void FunctorHelp::entering_multithreaded_region (module_functor_common &)
 Connectors to external helper functions (to decouple signal handling from this class) More...
 
void FunctorHelp::leaving_multithreaded_region (module_functor_common &)
 

Additional Inherited Members

- Static Protected Member Functions inherited from Gambit::functor
static void failBigTime (str method)
 Attempt to retrieve a dependency or model parameter that has not been resolved. More...
 

Detailed Description

Functor derived class for module functions.

Definition at line 399 of file functors.hpp.

Constructor & Destructor Documentation

◆ module_functor_common()

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

Constructor.

Definition at line 637 of file functors.cpp.

References check_missing_LogTag(), globlMaxThreads, LOCAL_INFO, Gambit::Models::ModelFunctorClaw::model_exists(), myLogTag, Gambit::functor::myOrigin, Gambit::Logging::str2tag(), and Gambit::utils_error().

642  : functor (func_name, func_capability, result_type, origin_name, claw),
643  myTimingPrintFlag (false),
644  start (NULL),
645  end (NULL),
646  point_exception_raised (false),
647  runtime_average (FUNCTORS_RUNTIME_INIT), // default 1 micro second
648  fadeRate (FUNCTORS_FADE_RATE), // can be set individually for each functor
650  needs_recalculating (NULL),
651  already_printed (NULL),
652  already_printed_timing (NULL),
653  iCanManageLoops (false),
654  iRunNested (false),
655  myLoopManagerCapability ("none"),
656  myLoopManagerType ("none"),
657  myLoopManager (NULL),
658  myCurrentIteration (NULL),
659  globlMaxThreads (omp_get_max_threads()),
660  myLogTag (-1)
661  {
662  if (globlMaxThreads == 0) utils_error().raise(LOCAL_INFO,"Cannot determine number of hardware threads available on this system.");
663  // Determine LogTag number
665  if (not claw.model_exists(origin_name)) check_missing_LogTag();
666  }
bool iCanManageLoops
Flag indicating whether this function can manage a loop over other functions.
Definition: functors.hpp:624
bool point_exception_raised
A flag indicating whether or not this functor has invalidated the current point.
Definition: functors.hpp:600
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 FUNCTORS_BASE_INVALIDATION_RATE
Minimum invaldiation rate (should be 0<...<<1)
Definition: functors.hpp:58
#define LOCAL_INFO
Definition: local_info.hpp:34
functor(str, str, str, str, Models::ModelFunctorClaw &)
Constructor.
Definition: functors.cpp:57
int str2tag(const std::string &)
Definition: logging.cpp:152
#define FUNCTORS_FADE_RATE
Decay rate of average runtime estimate [(number of functor evaluations)^-1].
Definition: functors.hpp:56
bool myTimingPrintFlag
Flag to select whether or not the timing data for this function&#39;s execution should be printed;...
Definition: functors.hpp:585
bool * needs_recalculating
Needs recalculating or not?
Definition: functors.hpp:615
double pInvalidation
Probability that functors invalidates point in model parameter space.
Definition: functors.hpp:612
bool * already_printed
Has result already been sent to the printer?
Definition: functors.hpp:618
#define FUNCTORS_RUNTIME_INIT
Initial runtime estimate (s)
Definition: functors.hpp:60
long long * myCurrentIteration
Pointer to counters for iterations of nested functor loop.
Definition: functors.hpp:643
double fadeRate
Fade rate for average runtime.
Definition: functors.hpp:609
functor * myLoopManager
Pointer to the functor that mangages the loop that this function runs inside of.
Definition: functors.hpp:637
bool * already_printed_timing
Has timing data already been sent to the printer?
Definition: functors.hpp:621
std::chrono::time_point< std::chrono::system_clock > * end
Definition: functors.hpp:597
str myLoopManagerCapability
Capability of a function that mangages a loop that this function can run inside of.
Definition: functors.hpp:633
std::chrono::time_point< std::chrono::system_clock > * start
Beginning and end timing points.
Definition: functors.hpp:597
double runtime_average
Averaged runtime in ns.
Definition: functors.hpp:606
void check_missing_LogTag()
Check if an appropriate LogTag for this functor is missing from the logging system.
Definition: functors.cpp:680
bool iRunNested
Flag indicating whether this function can run nested in a loop over functions.
Definition: functors.hpp:630
str myLoopManagerType
Capability of a function that mangages a loop that this function can run inside of.
Definition: functors.hpp:635
const int globlMaxThreads
Maximum number of OpenMP threads this MPI process is permitted to launch in total.
Definition: functors.hpp:646
int myLogTag
Integer LogTag, for tagging log messages.
Definition: functors.hpp:718
Here is the call graph for this function:

◆ ~module_functor_common()

Gambit::module_functor_common::~module_functor_common ( )
virtual

Destructor.

Definition at line 669 of file functors.cpp.

References already_printed, already_printed_timing, end, myCurrentIteration, needs_recalculating, and start.

670  {
671  if (start != NULL) delete [] start;
672  if (end != NULL) delete [] end;
673  if (needs_recalculating != NULL) delete [] needs_recalculating;
674  if (already_printed != NULL) delete [] already_printed;
675  if (already_printed_timing != NULL) delete [] already_printed_timing;
676  if (myCurrentIteration != NULL) delete [] myCurrentIteration;
677  }
bool * needs_recalculating
Needs recalculating or not?
Definition: functors.hpp:615
bool * already_printed
Has result already been sent to the printer?
Definition: functors.hpp:618
long long * myCurrentIteration
Pointer to counters for iterations of nested functor loop.
Definition: functors.hpp:643
bool * already_printed_timing
Has timing data already been sent to the printer?
Definition: functors.hpp:621
std::chrono::time_point< std::chrono::system_clock > * end
Definition: functors.hpp:597
std::chrono::time_point< std::chrono::system_clock > * start
Beginning and end timing points.
Definition: functors.hpp:597

Member Function Documentation

◆ acknowledgeInvalidation()

void Gambit::module_functor_common::acknowledgeInvalidation ( invalid_point_exception e,
functor f = NULL 
)
protectedvirtual

Acknowledge that this functor invalidated the current point in model space.

Definition at line 741 of file functors.cpp.

References breakLoop(), fadeRate, FUNCTORS_BASE_INVALIDATION_RATE, pInvalidation, point_exception_raised, raised_point_exception, and Gambit::invalid_point_exception::set_thrower().

Referenced by Gambit::module_functor< void >::calculate(), iterate(), and notifyOfInvalidation().

742  {
743  #pragma omp atomic
745  if (f==NULL) f = this;
746  #pragma omp critical (raised_point_exception)
747  {
748  e.set_thrower(f);
750  point_exception_raised = true;
751  }
752  if (omp_get_level()!=0) breakLoop();
753  }
bool point_exception_raised
A flag indicating whether or not this functor has invalidated the current point.
Definition: functors.hpp:600
#define FUNCTORS_BASE_INVALIDATION_RATE
Minimum invaldiation rate (should be 0<...<<1)
Definition: functors.hpp:58
double pInvalidation
Probability that functors invalidates point in model parameter space.
Definition: functors.hpp:612
double fadeRate
Fade rate for average runtime.
Definition: functors.hpp:609
invalid_point_exception raised_point_exception
An exception raised because this functor has invalidated the current point.
Definition: functors.hpp:603
virtual void breakLoop()
Tell the functor that the loop it manages should break now.
Definition: functors.cpp:871
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::module_functor_common::backend_conditional_dependencies ( str  req,
str  type,
str  be,
str  ver 
)
virtual

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

Reimplemented from Gambit::functor.

Definition at line 989 of file functors.cpp.

References myBackendConditionalDependencies.

Referenced by backend_conditional_dependencies(), and resolveBackendReq().

990  {
991  std::set<sspair> generic_deps, specific_deps, total_deps;
992  std::vector<str> quad;
993  quad.push_back(req);
994  quad.push_back(type);
995  quad.push_back(be);
996  quad.push_back(ver);
997  //Check first what conditional dependencies exist for all versions of this backend
998  if (ver != "any")
999  {
1000  generic_deps = backend_conditional_dependencies(req, type, be, "any");
1001  }
1002  //Now see if there are any for this specific version
1004  {
1005  specific_deps = myBackendConditionalDependencies[quad];
1006  }
1007  //Now put them together
1008  total_deps.insert(generic_deps.begin(), generic_deps.end());
1009  total_deps.insert(specific_deps.begin(), specific_deps.end());
1010  return total_deps;
1011  }
virtual std::set< sspair > backend_conditional_dependencies(str req, str type, str be, str ver)
Getter for listing backend-specific conditional dependencies (4-string version)
Definition: functors.cpp:989
str type() const
Getter for the wrapped function&#39;s reported return type.
Definition: functors.cpp:119
std::map< std::vector< str >, std::set< sspair > > myBackendConditionalDependencies
Map from (vector with 4 strings: backend req, type, backend, version) to (set of {conditional depende...
Definition: functors.hpp:670
Here is the caller graph for this function:

◆ backend_conditional_dependencies() [2/3]

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

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

Reimplemented from Gambit::functor.

Definition at line 1014 of file functors.cpp.

References backend_conditional_dependencies().

1015  {
1016  return backend_conditional_dependencies(req, type, be, "any");
1017  }
virtual std::set< sspair > backend_conditional_dependencies(str req, str type, str be, str ver)
Getter for listing backend-specific conditional dependencies (4-string version)
Definition: functors.cpp:989
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::module_functor_common::backend_conditional_dependencies ( functor be_functor)
virtual

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

Reimplemented from Gambit::functor.

Definition at line 1020 of file functors.cpp.

References backend_conditional_dependencies(), Gambit::functor::capability(), Gambit::functor::origin(), Gambit::functor::type(), and Gambit::functor::version().

1021  {
1022  return backend_conditional_dependencies (be_functor->capability(), be_functor->type(),
1023  be_functor->origin(), be_functor->version());
1024  }
virtual std::set< sspair > backend_conditional_dependencies(str req, str type, str be, str ver)
Getter for listing backend-specific conditional dependencies (4-string version)
Definition: functors.cpp:989
Here is the call graph for this function:

◆ backendgroups()

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

Getter for listing backend requirement groups.

Reimplemented from Gambit::functor.

Definition at line 932 of file functors.cpp.

References myGroups.

932 { return myGroups; }
std::set< str > myGroups
Internal list of backend groups that this functor&#39;s requirements fall into.
Definition: functors.hpp:649

◆ backendreq_tags()

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

Getter for listing tags associated with backend requirements.

Reimplemented from Gambit::functor.

Definition at line 962 of file functors.cpp.

References backendreq_tagmap.

963  {
964  if (backendreq_tagmap.find(quant) != backendreq_tagmap.end())
965  {
966  return backendreq_tagmap[quant];
967  }
968  else
969  {
970  std::set<str> empty;
971  return empty;
972  }
973  }
std::map< sspair, std::set< str > > backendreq_tagmap
Map from backend requirements to their rule tags.
Definition: functors.hpp:696

◆ backendreqs() [1/2]

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

Getter for listing all backend requirements.

Reimplemented from Gambit::functor.

Definition at line 934 of file functors.cpp.

References myResolvableBackendReqs.

934 { return myResolvableBackendReqs; }
std::set< sspair > myResolvableBackendReqs
Set of all backend requirement-type string pairs currently available for resolution.
Definition: functors.hpp:658

◆ backendreqs() [2/2]

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

Getter for listing backend requirements from a specific group.

Reimplemented from Gambit::functor.

Definition at line 936 of file functors.cpp.

References combine_hdf5::group, and myGroupedBackendReqs.

937  {
939  {
940  return myGroupedBackendReqs[group];
941  }
942  else
943  {
944  std::set<sspair> empty;
945  return empty;
946  }
947  }
std::map< str, std::set< sspair > > myGroupedBackendReqs
Set of backend requirement-type string pairs for specific backend groups.
Definition: functors.hpp:661

◆ backendspermitted()

std::set< sspair > Gambit::module_functor_common::backendspermitted ( sspair  quant)
virtual

Getter for listing permitted backends.

Reimplemented from Gambit::functor.

Definition at line 949 of file functors.cpp.

References permitted_map.

950  {
951  if (permitted_map.find(quant) != permitted_map.end())
952  {
953  return permitted_map[quant];
954  }
955  else
956  {
957  std::set<sspair> empty;
958  return empty;
959  }
960  }
std::map< sspair, std::set< sspair > > permitted_map
Map from (backend requirement-type pairs) to (set of permitted {backend-version} pairs) ...
Definition: functors.hpp:703

◆ breakLoop()

void Gambit::module_functor_common::breakLoop ( )
virtual

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

Reimplemented from Gambit::functor.

Definition at line 871 of file functors.cpp.

References myLoopIsDone.

Referenced by acknowledgeInvalidation(), and iterate().

872  {
873  #pragma omp critical (myLoopIsDone)
874  {
875  myLoopIsDone = true;
876  }
877  }
bool myLoopIsDone
Flag indicating whether this function is ready to finish its loop (only relevant if iCanManageLoops =...
Definition: functors.hpp:627
Here is the caller graph for this function:

◆ breakLoopFromManagedFunctor()

void Gambit::module_functor_common::breakLoopFromManagedFunctor ( )
virtual

Tell the manager of the loop in which this functor runs that it is time to break the loop.

Definition at line 855 of file functors.cpp.

References Gambit::functor::breakLoop(), LOCAL_INFO, myLoopManager, Gambit::functor::name(), Gambit::functor::origin(), and Gambit::utils_error().

856  {
857  if (myLoopManager == NULL)
858  {
859  str errmsg = "Problem whilst attempting to break out of loop:";
860  errmsg += "\n Loop Manager not properly defined."
861  "\n This is " + this->name() + " in " + this->origin() + ".";
862  utils_error().raise(LOCAL_INFO,errmsg);
863  }
864  else
865  {
867  }
868  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
str origin() const
Getter for the wrapped function&#39;s origin (module or backend name)
Definition: functors.cpp:121
str name() const
Getter for the wrapped function&#39;s name.
Definition: functors.cpp:115
virtual void breakLoop()
Tell the functor that the loop it manages should break now.
Definition: functors.cpp:276
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
functor * myLoopManager
Pointer to the functor that mangages the loop that this function runs inside of.
Definition: functors.hpp:637
Here is the call graph for this function:

◆ canBeLoopManager()

bool Gambit::module_functor_common::canBeLoopManager ( )
virtual

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

Reimplemented from Gambit::functor.

Definition at line 911 of file functors.cpp.

References iCanManageLoops.

911 { return iCanManageLoops; }
bool iCanManageLoops
Flag indicating whether this function can manage a loop over other functions.
Definition: functors.hpp:624

◆ check_missing_LogTag()

void Gambit::module_functor_common::check_missing_LogTag ( )
protected

Check if an appropriate LogTag for this functor is missing from the logging system.

Definition at line 680 of file functors.cpp.

References LOCAL_INFO, myLogTag, Gambit::functor::myName, Gambit::functor::myOrigin, and Gambit::utils_warning().

Referenced by module_functor_common().

681  {
682  if(myLogTag==-1)
683  {
684  std::ostringstream ss;
685  ss << "Cannot retrieve LogTag number; no match for module name in tag2str map." << endl
686  << "Module: " << myOrigin << endl
687  << "Function: " << myName << endl
688  << "This is probably because there is no log specified for " << myOrigin << " in your yaml file.";
689  utils_warning().raise(LOCAL_INFO,ss.str());
690  }
691  }
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
EXPORT_SYMBOLS warning & utils_warning()
Utility warnings.
str myName
Internal storage of the function name.
Definition: functors.hpp:320
int myLogTag
Integer LogTag, for tagging log messages.
Definition: functors.hpp:718
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dependencies()

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

Getter for listing currently activated dependencies.

Reimplemented from Gambit::functor.

Definition at line 930 of file functors.cpp.

References myDependencies.

930 { return myDependencies; }
std::set< sspair > myDependencies
Vector of dependency-type string pairs.
Definition: functors.hpp:664

◆ entering_multithreaded_region()

void Gambit::module_functor_common::entering_multithreaded_region ( )
inlineprotected

Definition at line 737 of file functors.hpp.

References Gambit::FunctorHelp::entering_multithreaded_region().

Referenced by Gambit::module_functor< void >::calculate().

void entering_multithreaded_region(module_functor_common &functor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_activeModelFlags()

void Gambit::module_functor_common::fill_activeModelFlags ( )
protected

Construct the list of known models only if it doesn't yet exist.

Definition at line 1544 of file functors.cpp.

References activeModelFlags, Gambit::functor::allowedModels, Gambit::functor::modelGroups, myModelConditionalBackendReqs, and myModelConditionalDependencies.

Referenced by Gambit::module_functor< void >::calculate(), and notifyOfModel().

1545  {
1546  // Construct the list of known models only if it doesn't yet exist
1547  if (activeModelFlags.empty())
1548  {
1549  // First get all the explicitly allowed models.
1550  for (auto it = allowedModels.begin(); it != allowedModels.end(); ++it) { activeModelFlags[*it] = false; }
1551  // Next get all the models in groups
1552  for (auto it = modelGroups.begin(); it != modelGroups.end(); ++it)
1553  { for (auto jt = it->second.begin(); jt != it->second.end(); ++jt) { activeModelFlags[*jt] = false; } }
1554  // Next get all the models mentioned in conditional dependencies and backend reqs
1555  for (auto it = myModelConditionalDependencies.begin(); it != myModelConditionalDependencies.end(); ++it) { activeModelFlags[it->first] = false; }
1556  for (auto it = myModelConditionalBackendReqs.begin(); it != myModelConditionalBackendReqs.end(); ++it) { activeModelFlags[it->first] = false; }
1557  }
1558  }
std::map< str, std::set< str > > modelGroups
Map from model group names to group contents.
Definition: functors.hpp:370
std::map< str, bool > activeModelFlags
Map from known models to flags indicating if they are activated or not (known = allowed, in allowed groups or conditions for conditional dependencies)
Definition: functors.hpp:679
std::map< str, std::set< sspair > > myModelConditionalBackendReqs
Map from models to (set of {conditional backend requirement-type} pairs)
Definition: functors.hpp:676
std::set< str > allowedModels
List of allowed models.
Definition: functors.hpp:364
std::map< str, std::set< sspair > > myModelConditionalDependencies
Map from models to (set of {conditional dependency-type} pairs)
Definition: functors.hpp:673
Here is the caller graph for this function:

◆ finishTiming()

void Gambit::module_functor_common::finishTiming ( int  thread_num)
protectedvirtual

Do post-calculate timing things.

Definition at line 1677 of file functors.cpp.

References end, fadeRate, FUNCTORS_BASE_INVALIDATION_RATE, needs_recalculating, pInvalidation, runtime_average, and start.

Referenced by Gambit::module_functor< void >::calculate().

1678  {
1679  end[thread_num] = std::chrono::system_clock::now();
1680  std::chrono::duration<double> runtime = end[thread_num] - start[thread_num];
1681  #pragma omp critical(module_functor_common_finishTiming)
1682  {
1683  runtime_average = runtime_average*(1-fadeRate) + fadeRate*runtime.count();
1685  }
1686  needs_recalculating[thread_num] = false;
1687  }
#define FUNCTORS_BASE_INVALIDATION_RATE
Minimum invaldiation rate (should be 0<...<<1)
Definition: functors.hpp:58
bool * needs_recalculating
Needs recalculating or not?
Definition: functors.hpp:615
double pInvalidation
Probability that functors invalidates point in model parameter space.
Definition: functors.hpp:612
double fadeRate
Fade rate for average runtime.
Definition: functors.hpp:609
std::chrono::time_point< std::chrono::system_clock > * end
Definition: functors.hpp:597
std::chrono::time_point< std::chrono::system_clock > * start
Beginning and end timing points.
Definition: functors.hpp:597
double runtime_average
Averaged runtime in ns.
Definition: functors.hpp:606
Here is the caller graph for this function:

◆ forcematchingbackend()

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

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

Reimplemented from Gambit::functor.

Definition at line 975 of file functors.cpp.

References myForcedMatches.

976  {
977  if (myForcedMatches.find(tag) != myForcedMatches.end())
978  {
979  return myForcedMatches[tag];
980  }
981  else
982  {
983  std::set<sspair> empty;
984  return empty;
985  }
986  }
std::map< str, std::set< sspair > > myForcedMatches
Map from tags to sets of matching (backend requirement-type pairs) that are forced to use the same ba...
Definition: functors.hpp:706

◆ getActiveModelFlag()

bool Gambit::module_functor_common::getActiveModelFlag ( str  model)

Indicate whether or not a known model is activated or not.

Definition at line 780 of file functors.cpp.

References activeModelFlags, LOCAL_INFO, Gambit::model_error(), Gambit::functor::myName, and Gambit::functor::myOrigin.

781  {
782  if (activeModelFlags.find(model) == activeModelFlags.end())
783  {
784  std::ostringstream ss;
785  ss << "Problem with ModelInUse(\"" << model << "\")." << endl
786  << "This model is not known by " << myOrigin << "::" << myName << "." << endl
787  << "Please make sure that it has been mentioned in some context in the" << endl
788  << "rollcall header declaration of this function.";
789  model_error().raise(LOCAL_INFO,ss.str());
790  }
791  return activeModelFlags.at(model);
792  }
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
std::map< str, bool > activeModelFlags
Map from known models to flags indicating if they are activated or not (known = allowed, in allowed groups or conditions for conditional dependencies)
Definition: functors.hpp:679
str myName
Internal storage of the function name.
Definition: functors.hpp:320
error & model_error()
Model errors.
Here is the call graph for this function:

◆ getChosenReqFromGroup()

safe_ptr< str > Gambit::module_functor_common::getChosenReqFromGroup ( str  group)

Return a safe pointer to a string indicating which backend requirement has been activated for a given backend group.

Definition at line 795 of file functors.cpp.

References chosenReqsFromGroups, and combine_hdf5::group.

796  {
797  chosenReqsFromGroups[group] = "none";
798  return safe_ptr<str>(&chosenReqsFromGroups[group]);
799  }
std::map< str, str > chosenReqsFromGroups
Map from groups to backend reqs, indicating which backend req has been activated for which backend gr...
Definition: functors.hpp:652

◆ getInvalidationRate()

double Gambit::module_functor_common::getInvalidationRate ( )
virtual

Getter for invalidation rate.

Reimplemented from Gambit::functor.

Definition at line 768 of file functors.cpp.

References pInvalidation.

769  {
770  return pInvalidation;
771  }
double pInvalidation
Probability that functors invalidates point in model parameter space.
Definition: functors.hpp:612

◆ getRuntimeAverage()

double Gambit::module_functor_common::getRuntimeAverage ( )
virtual

Getter for averaged runtime.

Reimplemented from Gambit::functor.

Definition at line 694 of file functors.cpp.

References runtime_average.

695  {
696  return runtime_average;
697  }
double runtime_average
Averaged runtime in ns.
Definition: functors.hpp:606

◆ init_memory()

void Gambit::module_functor_common::init_memory ( )
protectedvirtual

Initialise the memory of this functor.

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

Definition at line 1617 of file functors.cpp.

References already_printed, already_printed_timing, end, globlMaxThreads, iRunNested, generate_raster_scan_settings::n, needs_recalculating, and start.

Referenced by reset().

1618  {
1619  int n = (iRunNested ? globlMaxThreads : 1);
1620  // Reserve enough space to hold as many timing points and recalculation flags as there are slots (threads) allowed
1621  if(start==NULL)
1622  {
1623  #pragma omp critical(module_functor_common_init_memory_start)
1624  {
1625  if(start==NULL) start = new std::chrono::time_point<std::chrono::system_clock>[n];
1626  }
1627  }
1628  if(end==NULL)
1629  {
1630  #pragma omp critical(module_functor_common_init_memory_end)
1631  {
1632  if(end==NULL) end = new std::chrono::time_point<std::chrono::system_clock>[n];
1633  }
1634  }
1635  if(needs_recalculating==NULL)
1636  {
1637  #pragma omp critical(module_functor_common_init_memory_needs_recalculating)
1638  {
1639  if(needs_recalculating==NULL)
1640  {
1641  needs_recalculating = new bool[n];
1642  std::fill(needs_recalculating, needs_recalculating+n, true);
1643  }
1644  }
1645  }
1646  if(already_printed==NULL)
1647  {
1648  #pragma omp critical(module_functor_common_init_memory_already_printed)
1649  {
1650  if(already_printed==NULL)
1651  {
1652  already_printed = new bool[n];
1653  std::fill(already_printed, already_printed+n, false);
1654  }
1655  }
1656  }
1657  if(already_printed_timing==NULL)
1658  {
1659  #pragma omp critical(module_functor_common_init_memory_already_printed_timing)
1660  {
1661  if(already_printed_timing==NULL)
1662  {
1663  already_printed_timing = new bool[n];
1664  std::fill(already_printed_timing, already_printed_timing+n, false);
1665  }
1666  }
1667  }
1668  }
bool * needs_recalculating
Needs recalculating or not?
Definition: functors.hpp:615
bool * already_printed
Has result already been sent to the printer?
Definition: functors.hpp:618
bool * already_printed_timing
Has timing data already been sent to the printer?
Definition: functors.hpp:621
std::chrono::time_point< std::chrono::system_clock > * end
Definition: functors.hpp:597
std::chrono::time_point< std::chrono::system_clock > * start
Beginning and end timing points.
Definition: functors.hpp:597
bool iRunNested
Flag indicating whether this function can run nested in a loop over functions.
Definition: functors.hpp:630
const int globlMaxThreads
Maximum number of OpenMP threads this MPI process is permitted to launch in total.
Definition: functors.hpp:646
Here is the caller graph for this function:

◆ init_myCurrentIteration_if_NULL()

void Gambit::module_functor_common::init_myCurrentIteration_if_NULL ( )
virtual

Initialise the array holding the current iteration(s) of this functor.

Definition at line 835 of file functors.cpp.

References globlMaxThreads, iRunNested, and myCurrentIteration.

Referenced by iterationPtr(), and setIteration().

836  {
837  if(myCurrentIteration==NULL)
838  {
839  #pragma omp critical(module_functor_init_myCurrentIteration_if_NULL)
840  {
841  if(myCurrentIteration==NULL) // Check again in case two threads managed to get this far in sequence.
842  {
843  // Set the number of slots to the max number of threads allowed iff this functor can run in parallel
844  int nslots = (iRunNested ? globlMaxThreads : 1);
845  // Reserve enough space to hold as many iteration numbers as there are slots (threads) allowed
846  myCurrentIteration = new long long[nslots];
847  // Zero them to start off
848  std::fill(myCurrentIteration, myCurrentIteration+nslots, 0);
849  }
850  }
851  }
852  }
long long * myCurrentIteration
Pointer to counters for iterations of nested functor loop.
Definition: functors.hpp:643
bool iRunNested
Flag indicating whether this function can run nested in a loop over functions.
Definition: functors.hpp:630
const int globlMaxThreads
Maximum number of OpenMP threads this MPI process is permitted to launch in total.
Definition: functors.hpp:646
Here is the caller graph for this function:

◆ iterate()

void Gambit::module_functor_common::iterate ( long long  iteration)
virtual

Execute a single iteration in the loop managed by this functor.

Definition at line 802 of file functors.cpp.

References acknowledgeInvalidation(), breakLoop(), and myNestedFunctorList.

803  {
804  if (not myNestedFunctorList.empty())
805  {
806  for (std::vector<functor*>::iterator it = myNestedFunctorList.begin();
807  it != myNestedFunctorList.end(); ++it)
808  {
809  (*it)->setIteration(iteration); // Tell the nested functor what iteration this is.
810  try
811  {
812  (*it)->reset_and_calculate(); // Reset the nested functor so that it recalculates, then set it off
813  }
814  catch (invalid_point_exception& e)
815  {
817  if (omp_get_level()==0) throw(e); // If not in an OpenMP parallel block, inform of invalidation and throw onwards
818  }
819  catch (halt_loop_exception& e)
820  {
821  // Skip the rest of the iteration, without trying to evaluate the rest of the loop, and wrap it up.
822  breakLoop();
823  break;
824  }
825  catch (invalid_loop_iteration_exception& e)
826  {
827  // Just skip on to the next iteration, without trying to evaluate the rest of the loop.
828  break;
829  }
830  }
831  }
832  }
virtual void acknowledgeInvalidation(invalid_point_exception &, functor *f=NULL)
Acknowledge that this functor invalidated the current point in model space.
Definition: functors.cpp:741
std::vector< functor * > myNestedFunctorList
Vector of functors that have been set up to run nested within this one.
Definition: functors.hpp:640
virtual void breakLoop()
Tell the functor that the loop it manages should break now.
Definition: functors.cpp:871
Here is the call graph for this function:

◆ iterationPtr()

omp_safe_ptr< long long > Gambit::module_functor_common::iterationPtr ( )
virtual

Return a safe pointer to the iteration number in the loop in which this functor runs.

Definition at line 902 of file functors.cpp.

References init_myCurrentIteration_if_NULL(), and myCurrentIteration.

Referenced by Gambit::register_function_nesting().

903  {
904  init_myCurrentIteration_if_NULL(); // Init memory if this is the first run through.
905  return omp_safe_ptr<long long>(myCurrentIteration);
906  }
virtual void init_myCurrentIteration_if_NULL()
Initialise the array holding the current iteration(s) of this functor.
Definition: functors.cpp:835
long long * myCurrentIteration
Pointer to counters for iterations of nested functor loop.
Definition: functors.hpp:643
Here is the call graph for this function:
Here is the caller graph for this function:

◆ leaving_multithreaded_region()

void Gambit::module_functor_common::leaving_multithreaded_region ( )
inlineprotected

Definition at line 738 of file functors.hpp.

References Gambit::FunctorHelp::leaving_multithreaded_region().

Referenced by Gambit::module_functor< void >::calculate().

void leaving_multithreaded_region(module_functor_common &functor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loopIsDone()

safe_ptr< bool > Gambit::module_functor_common::loopIsDone ( )
virtual

Return a safe pointer to the flag indicating that a loop managed by this functor should break now.

Definition at line 880 of file functors.cpp.

References myLoopIsDone.

Referenced by Gambit::register_function().

881  {
882  return safe_ptr<bool>(&myLoopIsDone);
883  }
bool myLoopIsDone
Flag indicating whether this function is ready to finish its loop (only relevant if iCanManageLoops =...
Definition: functors.hpp:627
Here is the caller graph for this function:

◆ loopManagerCapability()

str Gambit::module_functor_common::loopManagerCapability ( )
virtual

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

Reimplemented from Gambit::functor.

Definition at line 921 of file functors.cpp.

References myLoopManagerCapability.

Referenced by Gambit::dep_bucket< TYPE >::use_thread_index().

921 { return myLoopManagerCapability; }
str myLoopManagerCapability
Capability of a function that mangages a loop that this function can run inside of.
Definition: functors.hpp:633
Here is the caller graph for this function:

◆ loopManagerName()

str Gambit::module_functor_common::loopManagerName ( )
virtual

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

Reimplemented from Gambit::functor.

Definition at line 925 of file functors.cpp.

References myLoopManager, and Gambit::functor::name().

Referenced by Gambit::dep_bucket< TYPE >::use_thread_index().

925 { return (myLoopManager == NULL ? "none" : myLoopManager->name()); }
str name() const
Getter for the wrapped function&#39;s name.
Definition: functors.cpp:115
functor * myLoopManager
Pointer to the functor that mangages the loop that this function runs inside of.
Definition: functors.hpp:637
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loopManagerOrigin()

str Gambit::module_functor_common::loopManagerOrigin ( )
virtual

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

Reimplemented from Gambit::functor.

Definition at line 927 of file functors.cpp.

References myLoopManager, and Gambit::functor::origin().

Referenced by Gambit::dep_bucket< TYPE >::use_thread_index().

927 { return (myLoopManager == NULL ? "none" : myLoopManager->origin()); }
str origin() const
Getter for the wrapped function&#39;s origin (module or backend name)
Definition: functors.cpp:121
functor * myLoopManager
Pointer to the functor that mangages the loop that this function runs inside of.
Definition: functors.hpp:637
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loopManagerType()

str Gambit::module_functor_common::loopManagerType ( )
virtual

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

Reimplemented from Gambit::functor.

Definition at line 923 of file functors.cpp.

References myLoopManagerType.

923 { return myLoopManagerType; }
str myLoopManagerType
Capability of a function that mangages a loop that this function can run inside of.
Definition: functors.hpp:635

◆ makeBackendMatchingRule()

void Gambit::module_functor_common::makeBackendMatchingRule ( str  tag)

Add one or more rules for forcing backends reqs with the same tags to always be resolved from the same backend.

Add one or more rules that force backends reqs with the same tag to always be resolved from the same backend.

Definition at line 1287 of file functors.cpp.

References backendreq_tagmap, Gambit::Utils::delimiterSplit(), LOCAL_INFO, myBackendReqs, myForcedMatches, Gambit::functor::name(), Gambit::functor::origin(), Gambit::Utils::strip_parentheses(), and Gambit::utils_error().

Referenced by Gambit::apply_backend_matching_rule().

1288  {
1289  //Strip the tag string of any parentheses, then split it
1291  std::vector<str> tags = Utils::delimiterSplit(tag, ",");
1292 
1293  //Die if no tags were given.
1294  if (tags.empty())
1295  {
1296  str errmsg = "Problem whilst attempting to set backend-matching rule:";
1297  errmsg += "\nA call to FORCE_SAME_BACKEND must include at least one tag!"
1298  "\nThis is " + this->name() + " in " + this->origin() + ".";
1299  utils_error().raise(LOCAL_INFO,errmsg);
1300  }
1301 
1302  //Work with one tag at a time
1303  for (std::vector<str>::iterator tagit = tags.begin(); tagit != tags.end(); ++tagit)
1304  {
1305  std::set<sspair> matches;
1306  //Find all declared backend requirements that fit the current tag
1307  for (std::set<sspair>::iterator it = myBackendReqs.begin(); it != myBackendReqs.end(); ++it)
1308  {
1309  //Test if the current tag is amongst the tags listed for the current backend requirement
1310  std::set<str> its_tags = backendreq_tagmap[*it];
1311  if ( std::find(its_tags.begin(), its_tags.end(), *tagit) != its_tags.end() )
1312  {
1313  //It is; now place the current backend requirement into the set of matches
1314  matches.insert(*it);
1315  }
1316  }
1317  //Save the matched set of backend requirements as needing to be filled using the same backend.
1318  myForcedMatches[*tagit] = matches;
1319  }
1320 
1321  //Note that overlapping sets are explicitly left unmerged, as the common elements
1322  //may or may not be activated in a given scan, making the disjointedness of the
1323  //different sets determinable only at resolution time, not initialisation time.
1324 
1325  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
EXPORT_SYMBOLS void strip_parentheses(str &)
Strips leading and/or trailing parentheses from a string.
std::map< str, std::set< sspair > > myForcedMatches
Map from tags to sets of matching (backend requirement-type pairs) that are forced to use the same ba...
Definition: functors.hpp:706
std::set< sspair > myBackendReqs
Set of all backend requirement-type string pairs.
Definition: functors.hpp:655
str origin() const
Getter for the wrapped function&#39;s origin (module or backend name)
Definition: functors.cpp:121
std::map< sspair, std::set< str > > backendreq_tagmap
Map from backend requirements to their rule tags.
Definition: functors.hpp:696
str name() const
Getter for the wrapped function&#39;s name.
Definition: functors.cpp:115
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
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:

◆ makeBackendOptionRule()

void Gambit::module_functor_common::makeBackendOptionRule ( str  be_and_ver,
str  tag 
)

Add a rule for dictating which backends can be used to fulfill which backend requirements.

Definition at line 1222 of file functors.cpp.

References backendreq_tagmap, Gambit::Utils::delimiterSplit(), Gambit::Utils::is_disjoint(), LOCAL_INFO, myBackendReqs, Gambit::functor::name(), Gambit::functor::origin(), setPermittedBackend(), Gambit::Utils::strip_parentheses(), and Gambit::utils_error().

Referenced by Gambit::apply_backend_option_rule().

1223  {
1224  //Strip the tag and be-ver strings of their parentheses, then split them
1226  Utils::strip_parentheses(be_and_ver);
1227  std::vector<str> v = Utils::delimiterSplit(tag, ",");
1228  std::set<str> tags(v.begin(), v.end());
1229  std::vector<str> be_plus_versions = Utils::delimiterSplit(be_and_ver, ",");
1230 
1231  //Die if no backend and/or no tags were given.
1232  if (tags.empty() or be_plus_versions.empty())
1233  {
1234  str errmsg = "Error whilst attempting to set permitted backends:";
1235  errmsg += "\nA BACKEND_OPTION must include a backend name and at least one tag."
1236  "\nThis is " + this->name() + " in " + this->origin() + ".";
1237  utils_error().raise(LOCAL_INFO,errmsg);
1238  }
1239 
1240  //Seperate the backend from the versions
1241  str be = be_plus_versions.at(0);
1242  std::vector<str> versions(be_plus_versions.begin()+1,be_plus_versions.end());
1243  if (versions.empty()) versions.push_back("any");
1244 
1245  //Find all declared backend requirements that fit one of the tags within the passed tag set.
1246  for (std::set<sspair>::iterator it = myBackendReqs.begin(); it != myBackendReqs.end(); ++it)
1247  {
1248  std::set<str> tagset = backendreq_tagmap[*it];
1249  if (not Utils::is_disjoint(tags, tagset))
1250  {
1251  // For each of the matching backend requirements, set the chosen backend-version pairs as permitted
1252  for (std::vector<str>::iterator vit = versions.begin() ; vit != versions.end(); ++vit)
1253  {
1254  setPermittedBackend(it->first, be, *vit);
1255  }
1256  }
1257  }
1258 
1259  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
EXPORT_SYMBOLS void strip_parentheses(str &)
Strips leading and/or trailing parentheses from a string.
std::set< sspair > myBackendReqs
Set of all backend requirement-type string pairs.
Definition: functors.hpp:655
str origin() const
Getter for the wrapped function&#39;s origin (module or backend name)
Definition: functors.cpp:121
std::map< sspair, std::set< str > > backendreq_tagmap
Map from backend requirements to their rule tags.
Definition: functors.hpp:696
str name() const
Getter for the wrapped function&#39;s name.
Definition: functors.cpp:115
bool is_disjoint(const Set1 &set1, const Set2 &set2)
Test if two sets are disjoint (works on any sorted std container I think)
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
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...
void setPermittedBackend(str req, str be, str ver)
Add a single permitted backend version.
Definition: functors.cpp:1262
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeBackendRuleForModel()

void Gambit::module_functor_common::makeBackendRuleForModel ( str  model,
str  tag 
)

Add a rule for activating backend requirements according to the model being scanned.

Definition at line 1165 of file functors.cpp.

References backendreq_tagmap, Gambit::Utils::delimiterSplit(), Gambit::Utils::is_disjoint(), myBackendReqs, setModelConditionalBackendReq(), and Gambit::Utils::strip_parentheses().

1166  {
1167  //Strip the tag and model strings of their parentheses
1169  Utils::strip_parentheses(model);
1170 
1171  //Split the tag string and sort it.
1172  std::vector<str> v = Utils::delimiterSplit(tag, ",");
1173  std::set<str> tags(v.begin(), v.end());
1174 
1175  //Find all declared backend requirements that fit one of the tags within the passed tag set.
1176  for (std::set<sspair>::iterator it = myBackendReqs.begin(); it != myBackendReqs.end(); ++it)
1177  {
1178  std::set<str> tagset = backendreq_tagmap[*it];
1179  if (not Utils::is_disjoint(tags, tagset))
1180  {
1181  // Make each of the matching backend requirements conditional on the models passed in.
1182  setModelConditionalBackendReq(model,it->first,it->second);
1183  }
1184  }
1185 
1186  }
EXPORT_SYMBOLS void strip_parentheses(str &)
Strips leading and/or trailing parentheses from a string.
std::set< sspair > myBackendReqs
Set of all backend requirement-type string pairs.
Definition: functors.hpp:655
std::map< sspair, std::set< str > > backendreq_tagmap
Map from backend requirements to their rule tags.
Definition: functors.hpp:696
bool is_disjoint(const Set1 &set1, const Set2 &set2)
Test if two sets are disjoint (works on any sorted std container I think)
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...
void setModelConditionalBackendReq(str model, str req, str type)
Add a model conditional backend requirement for multiple models.
Definition: functors.cpp:1190
Here is the call graph for this function:

◆ model_conditional_backend_reqs()

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

Getter for listing model-specific conditional backend requirements.

Reimplemented from Gambit::functor.

Definition at line 1036 of file functors.cpp.

References Gambit::functor::find_friend_or_parent_model_in_map(), and myModelConditionalBackendReqs.

Referenced by notifyOfModel().

1037  {
1039  if (parent != "") return myModelConditionalBackendReqs[parent];
1040  std::set<sspair> empty;
1041  return empty;
1042  }
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...
Definition: functors.cpp:607
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
std::map< str, std::set< sspair > > myModelConditionalBackendReqs
Map from models to (set of {conditional backend requirement-type} pairs)
Definition: functors.hpp:676
Here is the call graph for this function:
Here is the caller graph for this function:

◆ model_conditional_dependencies()

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

Getter for listing model-specific conditional dependencies.

Reimplemented from Gambit::functor.

Definition at line 1027 of file functors.cpp.

References Gambit::functor::find_friend_or_parent_model_in_map(), and myModelConditionalDependencies.

Referenced by notifyOfModel().

1028  {
1030  if (parent != "") return myModelConditionalDependencies[parent];
1031  std::set<sspair> empty;
1032  return empty;
1033  }
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...
Definition: functors.cpp:607
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
std::map< str, std::set< sspair > > myModelConditionalDependencies
Map from models to (set of {conditional dependency-type} pairs)
Definition: functors.hpp:673
Here is the call graph for this function:
Here is the caller graph for this function:

◆ notifyOfBackends()

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

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

Reimplemented from Gambit::functor.

Definition at line 1341 of file functors.cpp.

References missing_backends, Gambit::functor::myStatus, and required_classloading_backends.

1342  {
1343  missing_backends.clear();
1344  // Loop over all the backends that are needed for this functor to work.
1345  for (auto it = required_classloading_backends.begin(); it != required_classloading_backends.end(); ++it)
1346  {
1347  // Check to make sure some version of the backend in question is connected.
1348  if (be_ver_map.find(it->first) == be_ver_map.end())
1349  {
1350  this->myStatus = -3;
1351  missing_backends.push_back(it->first);
1352  }
1353  else
1354  { // Loop over all the versions of the backend that are needed for this functor to work.
1355  for (auto jt = it->second.begin(); jt != it->second.end(); ++jt)
1356  {
1357  std::set<str> versions = be_ver_map.at(it->first);
1358  // Check that the specific version needed is connected.
1359  if (versions.find(*jt) == versions.end())
1360  {
1361  this->myStatus = -3;
1362  missing_backends.push_back(it->first + ", v" + *jt);
1363  }
1364  }
1365  }
1366  }
1367  }
std::map< str, std::set< str > > required_classloading_backends
Map from required classloading backends to their versions.
Definition: functors.hpp:709
std::vector< str > missing_backends
Vector of required backends currently missing.
Definition: functors.hpp:712
int myStatus
Status: -4 = required backend absent (backend ini functions) -3 = required classes absent -2 = functi...
Definition: functors.hpp:346

◆ notifyOfDependee()

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

Notify the functor that another functor depends on it.

Reimplemented from Gambit::functor.

Definition at line 1410 of file functors.cpp.

References dependency_functor_map, Gambit::functor::getDependees(), Gambit::functor::getSubCaps(), Gambit::functor::myDependees, Gambit::functor::notifyOfSubCaps(), and Gambit::functor::quantity().

1411  {
1412  // Add the dependent functor's capability-type pair to the list of dependees
1413  myDependees.insert(dependent_functor->quantity());
1414  // Inherit the dependent functor's own dependees
1415  for (const sspair& q : *(dependent_functor->getDependees())) { myDependees.insert(q); }
1416  // Inherit the dependent functor's subcaps
1417  notifyOfSubCaps(*(dependent_functor->getSubCaps()));
1418  // Notify all functors on which this one depends that they also now have a new dependent
1419  for (auto entry : dependency_functor_map) entry.second->notifyOfDependee(dependent_functor);
1420  }
void notifyOfSubCaps(const Options &)
Notify the functor about an instance of the options class that contains sub-capability information...
Definition: functors.cpp:381
std::set< sspair > myDependees
List of all capability,type pairs of functors downstream of this one in the dependency tree...
Definition: functors.hpp:361
std::map< sspair, functor * > dependency_functor_map
Map from (dependency-type pairs) to pointers to functors used to resolve them that set dependency fun...
Definition: functors.hpp:687
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
Here is the call graph for this function:

◆ notifyOfInvalidation()

void Gambit::module_functor_common::notifyOfInvalidation ( const str msg)
virtual

Tell the functor that it invalidated the current point in model space, pass a message explaining why, and throw an exception.

Reimplemented from Gambit::functor.

Definition at line 734 of file functors.cpp.

References acknowledgeInvalidation(), Gambit::invalid_point(), Gambit::invalid_point_exception::raise(), and retrieve_invalid_point_exception().

735  {
738  }
virtual invalid_point_exception * retrieve_invalid_point_exception()
Retrieve the previously saved exception generated when this functor invalidated the current point in ...
Definition: functors.cpp:756
virtual void acknowledgeInvalidation(invalid_point_exception &, functor *f=NULL)
Acknowledge that this functor invalidated the current point in model space.
Definition: functors.cpp:741
virtual void raise(const std::string &)
Raise the exception, i.e. throw it. Exact override of base method.
Definition: exceptions.cpp:422
invalid_point_exception & invalid_point()
Invalid point exceptions.
Here is the call graph for this function:

◆ notifyOfModel()

void Gambit::module_functor_common::notifyOfModel ( str  model)
virtual

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

Reimplemented from Gambit::functor.

Definition at line 1561 of file functors.cpp.

References activeModelFlags, backendreq_groups, Gambit::Models::ModelFunctorClaw::downstream_of(), fill_activeModelFlags(), model_conditional_backend_reqs(), model_conditional_dependencies(), Gambit::Models::ModelFunctorClaw::model_exists(), Gambit::functor::myClaw, myDependencies, myGroupedBackendReqs, myResolvableBackendReqs, and Gambit::functor::verbose.

1562  {
1563  // If activeModels hasn't been populated yet, make sure it is.
1565 
1566  // Now activate the flags for the models that are being used.
1567  for (auto it = activeModelFlags.begin(); it != activeModelFlags.end(); ++it)
1568  {
1569  str activation_candidate = it->first;
1570  if (myClaw->model_exists(activation_candidate))
1571  {
1572  if (myClaw->downstream_of(model, activation_candidate))
1573  {
1574  // Found an activation candidate that the model being scanned can be cast to.
1575  // Assume for now that the candidate will indeed be activated.
1576  it->second = true;
1577  // Compare with models that have already been activated, to avoid activating multiple models of the same lineage.
1578  for (auto jt = activeModelFlags.begin(); jt != activeModelFlags.end(); ++jt)
1579  {
1580  str active_model = jt->first;
1581  if (activation_candidate != active_model and myClaw->model_exists(active_model) and jt->second)
1582  {
1583  // If the already active model can be upcast to the activation candidate, abort the activiation of the candidate.
1584  if (myClaw->downstream_of(active_model, activation_candidate)) it->second = false;
1585  // If the candidate can be upcast to the already active model, activate the candidate instead of the already active model.
1586  if (myClaw->downstream_of(activation_candidate, active_model)) jt->second = false;
1587  if (verbose)
1588  {
1589  cout << "model: " << model << " " << "model to be activated: " << activation_candidate << "(" << it->second << ") active model: " << active_model << "(" << jt->second << ")" << endl;
1590  cout << "active model lives below:" << myClaw->downstream_of(active_model, activation_candidate) << endl;
1591  cout << "activation candidate lives below:" << myClaw->downstream_of(activation_candidate, active_model) << endl;
1592  }
1593  }
1594  }
1595  if (verbose) cout << "Activate candidate " << activation_candidate << "?" << it->second << endl;
1596  }
1597  }
1598  }
1599 
1600  // If this model fits any conditional dependencies (or descended from one that can be interpreted as one that fits any), then activate them.
1601  std::set<sspair> deps_to_activate = model_conditional_dependencies(model);
1602  for (std::set<sspair>::iterator it = deps_to_activate.begin() ; it != deps_to_activate.end(); ++it)
1603  {
1604  myDependencies.insert(*it);
1605  }
1606  // If this model fits any conditional backend requirements (or descended from one that can be interpreted as one that fits any), then activate them.
1607  std::set<sspair> backend_reqs_to_activate = model_conditional_backend_reqs(model);
1608  for (std::set<sspair>::iterator it = backend_reqs_to_activate.begin() ; it != backend_reqs_to_activate.end(); ++it)
1609  {
1610  if (verbose) cout << "req: " << it->first << " " << it->second << endl;
1611  myResolvableBackendReqs.insert(*it);
1612  myGroupedBackendReqs.at(backendreq_groups.at(*it)).insert(*it);
1613  }
1614  }
void fill_activeModelFlags()
Construct the list of known models only if it doesn&#39;t yet exist.
Definition: functors.cpp:1544
bool verbose
Debug flag.
Definition: functors.hpp:352
std::map< sspair, str > backendreq_groups
Map from backend requirements to their designated groups.
Definition: functors.hpp:693
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::set< sspair > myResolvableBackendReqs
Set of all backend requirement-type string pairs currently available for resolution.
Definition: functors.hpp:658
virtual std::set< sspair > model_conditional_dependencies(str model)
Getter for listing model-specific conditional dependencies.
Definition: functors.cpp:1027
std::map< str, bool > activeModelFlags
Map from known models to flags indicating if they are activated or not (known = allowed, in allowed groups or conditions for conditional dependencies)
Definition: functors.hpp:679
std::set< sspair > myDependencies
Vector of dependency-type string pairs.
Definition: functors.hpp:664
virtual std::set< sspair > model_conditional_backend_reqs(str model)
Getter for listing model-specific conditional backend requirements.
Definition: functors.cpp:1036
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
std::map< str, std::set< sspair > > myGroupedBackendReqs
Set of backend requirement-type string pairs for specific backend groups.
Definition: functors.hpp:661
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:

◆ requiresTimingPrinting()

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

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

Reimplemented from Gambit::functor.

Definition at line 706 of file functors.cpp.

References myTimingPrintFlag.

707  {
708  return myTimingPrintFlag;
709  }
bool myTimingPrintFlag
Flag to select whether or not the timing data for this function&#39;s execution should be printed;...
Definition: functors.hpp:585

◆ reset() [1/2]

void Gambit::module_functor_common::reset ( )
virtual

Reset functor.

Reset functor for all threads.

Reimplemented from Gambit::functor.

Definition at line 712 of file functors.cpp.

References already_printed, already_printed_timing, globlMaxThreads, iCanManageLoops, init_memory(), iRunNested, generate_raster_scan_settings::n, needs_recalculating, point_exception_raised, and resetLoop().

713  {
714  init_memory();
715  int n = (iRunNested ? globlMaxThreads : 1);
716  std::fill(needs_recalculating, needs_recalculating+n, true);
717  std::fill(already_printed, already_printed+n, false);
718  std::fill(already_printed_timing, already_printed_timing+n, false);
719  if (iCanManageLoops) resetLoop();
720  point_exception_raised = false;
721  }
bool iCanManageLoops
Flag indicating whether this function can manage a loop over other functions.
Definition: functors.hpp:624
bool point_exception_raised
A flag indicating whether or not this functor has invalidated the current point.
Definition: functors.hpp:600
virtual void init_memory()
Initialise the memory of this functor.
Definition: functors.cpp:1617
bool * needs_recalculating
Needs recalculating or not?
Definition: functors.hpp:615
bool * already_printed
Has result already been sent to the printer?
Definition: functors.hpp:618
virtual void resetLoop()
Provide a way to reset the flag indicating that a loop managed by this functor should break...
Definition: functors.cpp:886
bool * already_printed_timing
Has timing data already been sent to the printer?
Definition: functors.hpp:621
bool iRunNested
Flag indicating whether this function can run nested in a loop over functions.
Definition: functors.hpp:630
const int globlMaxThreads
Maximum number of OpenMP threads this MPI process is permitted to launch in total.
Definition: functors.hpp:646
Here is the call graph for this function:

◆ reset() [2/2]

void Gambit::module_functor_common::reset ( int  thread_num)
protectedvirtual

Reset functor for one thread only.

Reimplemented from Gambit::functor.

Definition at line 724 of file functors.cpp.

References already_printed, already_printed_timing, iCanManageLoops, init_memory(), needs_recalculating, and resetLoop().

725  {
726  init_memory();
727  needs_recalculating[thread_num] = true;
728  already_printed[thread_num] = false;
729  already_printed_timing[thread_num] = false;
730  if (iCanManageLoops) resetLoop();
731  }
bool iCanManageLoops
Flag indicating whether this function can manage a loop over other functions.
Definition: functors.hpp:624
virtual void init_memory()
Initialise the memory of this functor.
Definition: functors.cpp:1617
bool * needs_recalculating
Needs recalculating or not?
Definition: functors.hpp:615
bool * already_printed
Has result already been sent to the printer?
Definition: functors.hpp:618
virtual void resetLoop()
Provide a way to reset the flag indicating that a loop managed by this functor should break...
Definition: functors.cpp:886
bool * already_printed_timing
Has timing data already been sent to the printer?
Definition: functors.hpp:621
Here is the call graph for this function:

◆ resetLoop()

void Gambit::module_functor_common::resetLoop ( )
virtual

Provide a way to reset the flag indicating that a loop managed by this functor should break.

Definition at line 886 of file functors.cpp.

References myLoopIsDone.

Referenced by reset().

887  {
888  #pragma omp critical (myLoopIsDone)
889  {
890  myLoopIsDone = false;
891  }
892  }
bool myLoopIsDone
Flag indicating whether this function is ready to finish its loop (only relevant if iCanManageLoops =...
Definition: functors.hpp:627
Here is the caller graph for this function:

◆ resolveBackendReq()

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

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

Reimplemented from Gambit::functor.

Definition at line 1446 of file functors.cpp.

References backend_conditional_dependencies(), backendreq_groups, backendreq_map, chosenReqsFromGroups, end, combine_hdf5::group, LOCAL_INFO, myDependencies, Gambit::functor::myName, Gambit::functor::myOrigin, Gambit::functor::origin(), permitted_map, Gambit::functor::quantity(), Gambit::functor::safe_version(), Gambit::functor::setStatus(), Gambit::utils_error(), and Gambit::functor::version().

1447  {
1448 
1449  sspair key (be_functor->quantity());
1450 
1451  //First make sure that the proposed backend function fulfills a known requirement of the module function.
1452  if (backendreq_map.find(key) != backendreq_map.end())
1453  {
1454 
1455  sspair proposal (be_functor->origin(), be_functor->version()); //Proposed backend-version pair
1456  sspair generic_proposal (be_functor->origin(), "any"); //Proposed backend, any version
1457 
1458  if ( //Check for a condition under which the proposed backend function is an acceptable fit for this requirement.
1459  //Check whether there are have been any permitted backends stated for this requirement (if not, anything goes).
1460  (permitted_map.find(key) == permitted_map.end()) ||
1461  //Iterate over the vector of backend-version pairs for this requirement to see if all versions of the
1462  //proposed backend have been explicitly permitted.
1463  (std::find(permitted_map[key].begin(), permitted_map[key].end(), generic_proposal) != permitted_map[key].end()) ||
1464  //Iterate over the vector of backend-version pairs again to see if the specific backend version
1465  //proposed had been explicitly permitted.
1466  (std::find(permitted_map[key].begin(), permitted_map[key].end(), proposal) != permitted_map[key].end()) )
1467  {
1468 
1469  //One of the conditions was met, so do the resolution.
1470  (*backendreq_map[key])(be_functor);
1471 
1472  //Set this backend functor's status to active.
1473  be_functor->setStatus(2);
1474 
1475  //If this is also the condition under which any backend-conditional dependencies should be activated, do it.
1476  std::set<sspair> deps_to_activate = backend_conditional_dependencies(be_functor);
1477  for (std::set<sspair>::iterator it = deps_to_activate.begin() ; it != deps_to_activate.end(); ++it)
1478  {
1479  myDependencies.insert(*it);
1480  }
1481 
1482  // Add a dependency on the initialisation function of the backend that this backend function hails from (if not done already).
1483  sspair be_ini_quantity(be_functor->origin() + "_" + be_functor->safe_version() + "_init", "void");
1484  if (std::find(myDependencies.begin(), myDependencies.end(), be_ini_quantity) == myDependencies.end())
1485  {
1486  myDependencies.insert(be_ini_quantity);
1487  }
1488 
1489  //Check if this backend requirement is part of a group.
1490  str group = backendreq_groups[key];
1491  if (group != "none")
1492  {
1493  //If it is part of a group, make sure that group has actually been declared.
1494  if (chosenReqsFromGroups.find(group) != chosenReqsFromGroups.end() )
1495  {
1496  //If it is part of a group, make sure another backend requirement from the same group has not already been activated.
1497  if (chosenReqsFromGroups[group] == "none")
1498  {
1499  //If not, then this this specific backend requirement is now the active one within its group.
1500  chosenReqsFromGroups[group] = key.first;
1501  }
1502  else //This backend requirement is not the first from its group to be resolved.
1503  {
1504  str errmsg = "Cannot resolve backend requirement in group " + group + ":";
1505  errmsg += "\nFunction " + myName + " in " + myOrigin + " has already had backend "
1506  "\nrequirement " + chosenReqsFromGroups[group] + " from the same group filled.";
1507  utils_error().raise(LOCAL_INFO,errmsg);
1508  }
1509  }
1510  else //This backend requirement is part of group that was not declared.
1511  {
1512  str errmsg = "Cannot resolve backend requirement in group " + group + ":";
1513  errmsg += "\nThis group has not been declared. Please add"
1514  "\n BACKEND_GROUP("+group+")"
1515  "\nTo the rollcall declaration of " + myName + " in " + myOrigin + ".";
1516  utils_error().raise(LOCAL_INFO,errmsg);
1517  }
1518  }
1519 
1520  }
1521 
1522  else //The proposed backend function is not an acceptable fit for this requirement.
1523  {
1524  str errmsg = "Cannot resolve backend requirement:";
1525  errmsg += "\nBackend capability " + key.first + " with type " + key.second +
1526  "\nrequired by function " + myName + " in " + myOrigin + " is not permitted"
1527  "\nto use " + proposal.first + ", version " + proposal.second + ".";
1528  utils_error().raise(LOCAL_INFO,errmsg);
1529  }
1530 
1531  }
1532 
1533  else //The proposed backend function does not fulfill any known requirement of the module function.
1534  {
1535  str errmsg = "Cannot resolve backend requirement:";
1536  errmsg += "\nFunction " + myName + " in " + myOrigin + " does not require"
1537  "\nbackend capability " + key.first + " with type " + key.second + ".";
1538  utils_error().raise(LOCAL_INFO,errmsg);
1539  }
1540 
1541  }
std::map< sspair, void(*)(functor *)> backendreq_map
Map from (backend requirement-type pairs) to (pointers to templated void functions that set backend r...
Definition: functors.hpp:700
virtual std::set< sspair > backend_conditional_dependencies(str req, str type, str be, str ver)
Getter for listing backend-specific conditional dependencies (4-string version)
Definition: functors.cpp:989
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
std::map< sspair, str > backendreq_groups
Map from backend requirements to their designated groups.
Definition: functors.hpp:693
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
std::set< sspair > myDependencies
Vector of dependency-type string pairs.
Definition: functors.hpp:664
std::map< sspair, std::set< sspair > > permitted_map
Map from (backend requirement-type pairs) to (set of permitted {backend-version} pairs) ...
Definition: functors.hpp:703
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
std::chrono::time_point< std::chrono::system_clock > * end
Definition: functors.hpp:597
str myName
Internal storage of the function name.
Definition: functors.hpp:320
std::map< str, str > chosenReqsFromGroups
Map from groups to backend reqs, indicating which backend req has been activated for which backend gr...
Definition: functors.hpp:652
Here is the call graph for this function:

◆ resolveDependency()

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

Resolve a dependency using a pointer to another functor object.

Reimplemented from Gambit::functor.

Definition at line 1386 of file functors.cpp.

References dependency_functor_map, dependency_map, LOCAL_INFO, myDependencies, Gambit::functor::myName, Gambit::functor::myOrigin, Gambit::functor::myPurpose, Gambit::functor::notifyOfDependee(), Gambit::functor::quantity(), Gambit::functor::setPurpose(), and Gambit::utils_error().

Referenced by resolveLoopManager().

1387  {
1388  sspair key (dep_functor->quantity());
1389  if (std::find(myDependencies.begin(), myDependencies.end(), key) == myDependencies.end())
1390  {
1391  str errmsg = "Cannot resolve dependency:";
1392  errmsg += "\nFunction " + myName + " in " + myOrigin + " does not depend on"
1393  "\ncapability " + key.first + " with type = " + key.second + ".";
1394  utils_error().raise(LOCAL_INFO,errmsg);
1395  }
1396  else
1397  {
1398  // resolve the dependency
1399  if (dependency_map.find(key) != dependency_map.end()) (*dependency_map[key])(dep_functor,this);
1400  // propagate purpose from next to next-to-output nodes
1401  dep_functor->setPurpose(this->myPurpose);
1402  // propagate this functor's dependees and subcaps on to the resolving functor
1403  dep_functor->notifyOfDependee(this);
1404  // save the pointer to the resolving functor to allow this functor to notify it of future dependees
1405  dependency_functor_map[key] = dep_functor;
1406  }
1407  }
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
str myPurpose
Purpose of the function (relevant for output and next-to-output functors)
Definition: functors.hpp:330
std::map< sspair, void(*)(functor *, module_functor_common *)> dependency_map
Map from (dependency-type pairs) to (pointers to templated void functions that set dependency functor...
Definition: functors.hpp:683
std::map< sspair, functor * > dependency_functor_map
Map from (dependency-type pairs) to pointers to functors used to resolve them that set dependency fun...
Definition: functors.hpp:687
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
std::set< sspair > myDependencies
Vector of dependency-type string pairs.
Definition: functors.hpp:664
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
str myName
Internal storage of the function name.
Definition: functors.hpp:320
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolveLoopManager()

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

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

Reimplemented from Gambit::functor.

Definition at line 1423 of file functors.cpp.

References Gambit::functor::canBeLoopManager(), Gambit::functor::capability(), LOCAL_INFO, myLoopManager, myLoopManagerCapability, myLoopManagerType, Gambit::functor::myName, Gambit::functor::myOrigin, resolveDependency(), Gambit::functor::type(), and Gambit::utils_error().

1424  {
1425  if (dep_functor->capability() != myLoopManagerCapability or not dep_functor->canBeLoopManager())
1426  {
1427  utils_error().raise(LOCAL_INFO, "Cannot set loop manager for nested functor:\n"
1428  "Function " + myName + " in " + myOrigin + " does not need a loop manager with\n"
1429  "capability " + dep_functor->capability() + ".");
1430  }
1431  // Do type checking only if the need for a manger was declared with a specific type
1432  if (myLoopManagerType != "any")
1433  {
1434  if (dep_functor->type() != myLoopManagerType)
1435  {
1436  utils_error().raise(LOCAL_INFO, "Cannot set loop manager for nested functor:\n"
1437  "Function " + myName + " in " + myOrigin + " requires a manager with\n"
1438  "type " + dep_functor->type() + ".");
1439  }
1440  resolveDependency(dep_functor);
1441  }
1442  myLoopManager = dep_functor;
1443  }
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
virtual void resolveDependency(functor *dep_functor)
Resolve a dependency using a pointer to another functor object.
Definition: functors.cpp:1386
functor * myLoopManager
Pointer to the functor that mangages the loop that this function runs inside of.
Definition: functors.hpp:637
str myLoopManagerCapability
Capability of a function that mangages a loop that this function can run inside of.
Definition: functors.hpp:633
str myLoopManagerType
Capability of a function that mangages a loop that this function can run inside of.
Definition: functors.hpp:635
str myName
Internal storage of the function name.
Definition: functors.hpp:320
Here is the call graph for this function:

◆ retrieve_conditional_dep_type_pair()

sspair Gambit::module_functor_common::retrieve_conditional_dep_type_pair ( str  dep)
protected

Retrieve full conditional dependency-type pair from conditional dependency only.

Definition at line 1060 of file functors.cpp.

References LOCAL_INFO, myConditionalDependencies, Gambit::functor::name(), Gambit::functor::origin(), setBackendConditionalDependency(), and Gambit::utils_error().

Referenced by setBackendConditionalDependencySingular(), and setModelConditionalDependencySingular().

1061  {
1063  {
1064  str errmsg = "Problem whilst attempting to set conditional dependency:";
1065  errmsg += "\nThe conditional dependency " + dep + " appears not to have"
1066  "\nbeen fully declared; START_CONDITIONAL_DEPENDENCY() is missing."
1067  "\nThis is " + this->name() + " in " + this->origin() + ".";
1068  utils_error().raise(LOCAL_INFO,errmsg);
1069  }
1070  return sspair(dep, myConditionalDependencies.at(dep));
1071  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
std::map< str, str > myConditionalDependencies
Map of conditional dependencies to their types.
Definition: functors.hpp:667
str origin() const
Getter for the wrapped function&#39;s origin (module or backend name)
Definition: functors.cpp:121
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
str name() const
Getter for the wrapped function&#39;s name.
Definition: functors.cpp:115
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retrieve_invalid_point_exception()

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

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

Reimplemented from Gambit::functor.

Definition at line 756 of file functors.cpp.

References f, myNestedFunctorList, point_exception_raised, and raised_point_exception.

Referenced by notifyOfInvalidation().

757  {
759  for (auto f = myNestedFunctorList.begin(); f != myNestedFunctorList.end(); ++f)
760  {
761  invalid_point_exception* e = (*f)->retrieve_invalid_point_exception();
762  if (e != NULL) return e;
763  }
764  return NULL;
765  }
bool point_exception_raised
A flag indicating whether or not this functor has invalidated the current point.
Definition: functors.hpp:600
std::vector< functor * > myNestedFunctorList
Vector of functors that have been set up to run nested within this one.
Definition: functors.hpp:640
invalid_point_exception raised_point_exception
An exception raised because this functor has invalidated the current point.
Definition: functors.hpp:603
Here is the caller graph for this function:

◆ setBackendConditionalDependency()

void Gambit::module_functor_common::setBackendConditionalDependency ( str  req,
str  be,
str  ver,
str  dep,
void(*)(functor *, module_functor_common *)  resolver 
)

Add a backend conditional dependency for multiple backend versions.

Definition at line 1075 of file functors.cpp.

References Gambit::Utils::delimiterSplit(), and setBackendConditionalDependencySingular().

Referenced by Gambit::register_backend_conditional_dependency(), and retrieve_conditional_dep_type_pair().

1076  {
1077  // Split the version string and send each version to be registered
1078  std::vector<str> versions = Utils::delimiterSplit(ver, ",");
1079  for (std::vector<str>::iterator it = versions.begin() ; it != versions.end(); ++it)
1080  {
1081  setBackendConditionalDependencySingular(req, be, *it, dep, resolver);
1082  }
1083  }
void setBackendConditionalDependencySingular(str, str, str, str, void(*)(functor *, module_functor_common *))
Add a backend conditional dependency for a single backend version.
Definition: functors.cpp:1087
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:

◆ setBackendConditionalDependencySingular()

void Gambit::module_functor_common::setBackendConditionalDependencySingular ( str  req,
str  be,
str  ver,
str  dep,
void(*)(functor *, module_functor_common *)  resolver 
)

Add a backend conditional dependency for a single backend version.

Definition at line 1087 of file functors.cpp.

References backendreq_types, dependency_map, LOCAL_INFO, myBackendConditionalDependencies, Gambit::functor::name(), Gambit::functor::origin(), retrieve_conditional_dep_type_pair(), setModelConditionalDependency(), and Gambit::utils_error().

Referenced by setBackendConditionalDependency().

1088  {
1090  std::vector<str> quad;
1091  if (backendreq_types.find(req) != backendreq_types.end())
1092  {
1093  quad.push_back(req);
1094  quad.push_back(backendreq_types[req]);
1095  quad.push_back(be);
1096  quad.push_back(ver);
1097  }
1098  else
1099  {
1100  str errmsg = "Problem whilst attempting to set backend-conditional dependency:";
1101  errmsg += "\nThe type of the backend requirement " + req + "on which the"
1102  "\ndependency " + dep + " is conditional has not been set. This"
1103  "\nis " + this->name() + " in " + this->origin() + ".";
1104  utils_error().raise(LOCAL_INFO,errmsg);
1105  }
1107  {
1108  std::set<sspair> newvec;
1109  myBackendConditionalDependencies[quad] = newvec;
1110  }
1111  myBackendConditionalDependencies[quad].insert(key);
1112  dependency_map[key] = resolver;
1113  }
sspair retrieve_conditional_dep_type_pair(str)
Retrieve full conditional dependency-type pair from conditional dependency only.
Definition: functors.cpp:1060
std::map< str, str > backendreq_types
Map from backend requirements to their required types.
Definition: functors.hpp:690
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
str origin() const
Getter for the wrapped function&#39;s origin (module or backend name)
Definition: functors.cpp:121
std::map< sspair, void(*)(functor *, module_functor_common *)> dependency_map
Map from (dependency-type pairs) to (pointers to templated void functions that set dependency functor...
Definition: functors.hpp:683
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
str name() const
Getter for the wrapped function&#39;s name.
Definition: functors.cpp:115
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
std::map< std::vector< str >, std::set< sspair > > myBackendConditionalDependencies
Map from (vector with 4 strings: backend req, type, backend, version) to (set of {conditional depende...
Definition: functors.hpp:670
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBackendReq()

void Gambit::module_functor_common::setBackendReq ( str  group,
str  req,
str  tags,
str  type,
void(*)(functor *)  resolver 
)

Add an unconditional backend requirement The info gets updated later if this turns out to be contitional on a model.

Add an unconditional backend requirement The info gets updated later if this turns out to be conditional on a model.

Definition at line 1143 of file functors.cpp.

References backendreq_groups, backendreq_map, backendreq_tagmap, backendreq_types, Gambit::Utils::delimiterSplit(), Gambit::Utils::fix_type(), combine_hdf5::group, myBackendReqs, myGroupedBackendReqs, myGroups, myResolvableBackendReqs, Gambit::Utils::strip_parentheses(), and Gambit::functor::type().

Referenced by Gambit::register_backend_requirement().

1144  {
1146  sspair key (req, type);
1147  backendreq_types[req] = type;
1148  myBackendReqs.insert(key);
1149  myResolvableBackendReqs.insert(key);
1150  if ( std::find(myGroups.begin(), myGroups.end(), group) == myGroups.end() )
1151  {
1152  myGroups.insert(group);
1153  std::set<sspair> empty;
1154  myGroupedBackendReqs[group] = empty;
1155  }
1156  myGroupedBackendReqs[group].insert(key);
1157  backendreq_map[key] = resolver;
1159  std::vector<str> v = Utils::delimiterSplit(tags, ",");
1160  backendreq_tagmap[key] = std::set<str>(v.begin(), v.end());
1161  backendreq_groups[key] = group;
1162  }
std::map< sspair, void(*)(functor *)> backendreq_map
Map from (backend requirement-type pairs) to (pointers to templated void functions that set backend r...
Definition: functors.hpp:700
std::map< str, str > backendreq_types
Map from backend requirements to their required types.
Definition: functors.hpp:690
EXPORT_SYMBOLS void strip_parentheses(str &)
Strips leading and/or trailing parentheses from a string.
std::set< sspair > myBackendReqs
Set of all backend requirement-type string pairs.
Definition: functors.hpp:655
std::map< sspair, str > backendreq_groups
Map from backend requirements to their designated groups.
Definition: functors.hpp:693
std::map< sspair, std::set< str > > backendreq_tagmap
Map from backend requirements to their rule tags.
Definition: functors.hpp:696
std::set< sspair > myResolvableBackendReqs
Set of all backend requirement-type string pairs currently available for resolution.
Definition: functors.hpp:658
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
str type() const
Getter for the wrapped function&#39;s reported return type.
Definition: functors.cpp:119
std::map< str, std::set< sspair > > myGroupedBackendReqs
Set of backend requirement-type string pairs for specific backend groups.
Definition: functors.hpp:661
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...
std::set< str > myGroups
Internal list of backend groups that this functor&#39;s requirements fall into.
Definition: functors.hpp:649
str fix_type(str)
Clean out whitespace and strip Gambit and default BOSSed class namespaces.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCanBeLoopManager()

void Gambit::module_functor_common::setCanBeLoopManager ( bool  canManage)
virtual

Setter for specifying whether this is permitted to be a manager functor, which runs other functors nested in a loop.

Definition at line 909 of file functors.cpp.

References iCanManageLoops.

Referenced by Gambit::register_function().

909 { iCanManageLoops = canManage; }
bool iCanManageLoops
Flag indicating whether this function can manage a loop over other functions.
Definition: functors.hpp:624
Here is the caller graph for this function:

◆ setConditionalDependency()

void Gambit::module_functor_common::setConditionalDependency ( str  dep,
str  dep_type 
)

Add conditional dependency-type pairs in advance of later conditions.

Definition at line 1054 of file functors.cpp.

References myConditionalDependencies.

Referenced by Gambit::register_conditional_dependency().

1055  {
1056  myConditionalDependencies[dep] = dep_type;
1057  }
std::map< str, str > myConditionalDependencies
Map of conditional dependencies to their types.
Definition: functors.hpp:667
Here is the caller graph for this function:

◆ setDependency()

void Gambit::module_functor_common::setDependency ( str  dep,
str  dep_type,
void(*)(functor *, module_functor_common *)  resolver,
str  purpose = "" 
)

Add and activate unconditional dependencies.

Definition at line 1045 of file functors.cpp.

References dependency_map, Gambit::Utils::fix_type(), myDependencies, Gambit::functor::myPurpose, and Gambit::functor::purpose().

Referenced by Gambit::register_dependency().

1046  {
1047  sspair key (dep, Utils::fix_type(dep_type));
1048  myDependencies.insert(key);
1049  dependency_map[key] = resolver;
1050  this->myPurpose = purpose; // only relevant for output nodes
1051  }
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
std::map< sspair, void(*)(functor *, module_functor_common *)> dependency_map
Map from (dependency-type pairs) to (pointers to templated void functions that set dependency functor...
Definition: functors.hpp:683
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
std::set< sspair > myDependencies
Vector of dependency-type string pairs.
Definition: functors.hpp:664
str fix_type(str)
Clean out whitespace and strip Gambit and default BOSSed class namespaces.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFadeRate()

void Gambit::module_functor_common::setFadeRate ( double  new_rate)
virtual

Setter for the fade rate.

Reimplemented from Gambit::functor.

Definition at line 774 of file functors.cpp.

References fadeRate.

775  {
776  fadeRate = new_rate;
777  }
double fadeRate
Fade rate for average runtime.
Definition: functors.hpp:609

◆ setIteration()

void Gambit::module_functor_common::setIteration ( long long  iteration)
virtual

Setter for setting the iteration number in the loop in which this functor runs.

Reimplemented from Gambit::functor.

Definition at line 895 of file functors.cpp.

References init_myCurrentIteration_if_NULL(), and myCurrentIteration.

896  {
897  init_myCurrentIteration_if_NULL(); // Init memory if this is the first run through.
898  myCurrentIteration[omp_get_thread_num()] = iteration;
899  }
virtual void init_myCurrentIteration_if_NULL()
Initialise the array holding the current iteration(s) of this functor.
Definition: functors.cpp:835
long long * myCurrentIteration
Pointer to counters for iterations of nested functor loop.
Definition: functors.hpp:643
Here is the call graph for this function:

◆ setLoopManagerCapType()

void Gambit::module_functor_common::setLoopManagerCapType ( str  cap,
str  t 
)
virtual

Setter for specifying the capability required of a manager functor, if it is to run this functor nested in a loop.

Setter for specifying the capability and type required of a manager functor, if it is to run this functor nested in a loop.

Definition at line 914 of file functors.cpp.

References iRunNested, myLoopManagerCapability, and myLoopManagerType.

Referenced by Gambit::register_function_nesting().

915  {
916  iRunNested = true;
918  myLoopManagerType = t;
919  }
str myLoopManagerCapability
Capability of a function that mangages a loop that this function can run inside of.
Definition: functors.hpp:633
bool iRunNested
Flag indicating whether this function can run nested in a loop over functions.
Definition: functors.hpp:630
str myLoopManagerType
Capability of a function that mangages a loop that this function can run inside of.
Definition: functors.hpp:635
Here is the caller graph for this function:

◆ setModelConditionalBackendReq()

void Gambit::module_functor_common::setModelConditionalBackendReq ( str  model,
str  req,
str  type 
)

Add a model conditional backend requirement for multiple models.

Definition at line 1190 of file functors.cpp.

References Gambit::Utils::delimiterSplit(), Gambit::LogTags::models, and setModelConditionalBackendReqSingular().

Referenced by makeBackendRuleForModel().

1191  {
1192  // Split the model string and send each model to be registered
1193  std::vector<str> models = Utils::delimiterSplit(model, ",");
1194  for (std::vector<str>::iterator it = models.begin() ; it != models.end(); ++it)
1195  {
1197  }
1198  }
str type() const
Getter for the wrapped function&#39;s reported return type.
Definition: functors.cpp:119
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...
void setModelConditionalBackendReqSingular(str model, str req, str type)
Add a model conditional backend requirement for a single model.
Definition: functors.cpp:1202
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModelConditionalBackendReqSingular()

void Gambit::module_functor_common::setModelConditionalBackendReqSingular ( str  model,
str  req,
str  type 
)

Add a model conditional backend requirement for a single model.

Definition at line 1202 of file functors.cpp.

References backendreq_groups, Gambit::Utils::fix_type(), myGroupedBackendReqs, myModelConditionalBackendReqs, and myResolvableBackendReqs.

Referenced by setModelConditionalBackendReq().

1203  {
1204  sspair key (req, Utils::fix_type(type));
1205 
1206  // Remove the entry from the resolvable backend reqs list...
1207  myResolvableBackendReqs.erase(key);
1208 
1209  // Remove the entry from the grouped backend reqs list...
1210  myGroupedBackendReqs.at(backendreq_groups.at(key)).erase(key);
1211 
1212  // Check that the model is not already in the conditional backend reqs list, then add it
1214  {
1215  std::set<sspair> newvec;
1216  myModelConditionalBackendReqs[model] = newvec;
1217  }
1218  myModelConditionalBackendReqs[model].insert(key);
1219  }
std::map< sspair, str > backendreq_groups
Map from backend requirements to their designated groups.
Definition: functors.hpp:693
std::set< sspair > myResolvableBackendReqs
Set of all backend requirement-type string pairs currently available for resolution.
Definition: functors.hpp:658
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
str type() const
Getter for the wrapped function&#39;s reported return type.
Definition: functors.cpp:119
std::map< str, std::set< sspair > > myGroupedBackendReqs
Set of backend requirement-type string pairs for specific backend groups.
Definition: functors.hpp:661
std::map< str, std::set< sspair > > myModelConditionalBackendReqs
Map from models to (set of {conditional backend requirement-type} pairs)
Definition: functors.hpp:676
str fix_type(str)
Clean out whitespace and strip Gambit and default BOSSed class namespaces.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModelConditionalDependency()

void Gambit::module_functor_common::setModelConditionalDependency ( str  model,
str  dep,
void(*)(functor *, module_functor_common *)  resolver 
)

Add a model conditional dependency for multiple models.

Definition at line 1117 of file functors.cpp.

References Gambit::Utils::delimiterSplit(), Gambit::LogTags::models, and setModelConditionalDependencySingular().

Referenced by Gambit::register_model_conditional_dependency(), and setBackendConditionalDependencySingular().

1118  {
1119  // Split the model string and send each model to be registered
1120  std::vector<str> models = Utils::delimiterSplit(model, ",");
1121  for (std::vector<str>::iterator it = models.begin() ; it != models.end(); ++it)
1122  {
1123  setModelConditionalDependencySingular(*it, dep, resolver);
1124  }
1125  }
void setModelConditionalDependencySingular(str, str, void(*)(functor *, module_functor_common *))
Add a model conditional dependency for a single model.
Definition: functors.cpp:1129
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:

◆ setModelConditionalDependencySingular()

void Gambit::module_functor_common::setModelConditionalDependencySingular ( str  model,
str  dep,
void(*)(functor *, module_functor_common *)  resolver 
)

Add a model conditional dependency for a single model.

Definition at line 1129 of file functors.cpp.

References dependency_map, myModelConditionalDependencies, and retrieve_conditional_dep_type_pair().

Referenced by setModelConditionalDependency().

1130  {
1133  {
1134  std::set<sspair> newvec;
1135  myModelConditionalDependencies[model] = newvec;
1136  }
1137  myModelConditionalDependencies[model].insert(key);
1138  dependency_map[key] = resolver;
1139  }
sspair retrieve_conditional_dep_type_pair(str)
Retrieve full conditional dependency-type pair from conditional dependency only.
Definition: functors.cpp:1060
std::map< sspair, void(*)(functor *, module_functor_common *)> dependency_map
Map from (dependency-type pairs) to (pointers to templated void functions that set dependency functor...
Definition: functors.hpp:683
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
std::map< str, std::set< sspair > > myModelConditionalDependencies
Map from models to (set of {conditional dependency-type} pairs)
Definition: functors.hpp:673
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNestedList()

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

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

Reimplemented from Gambit::functor.

Definition at line 1370 of file functors.cpp.

References iCanManageLoops, LOCAL_INFO, myNestedFunctorList, Gambit::functor::name(), Gambit::functor::origin(), and Gambit::utils_error().

1371  {
1372  if (iCanManageLoops)
1373  {
1374  myNestedFunctorList = newNestedList;
1375  }
1376  else
1377  {
1378  str errmsg = "This module functor is not permitted to manage";
1379  errmsg += "\nloops, so you cannot set its nested functor list."
1380  "\nThis is " + this->name() + " in " + this->origin() + ".";
1381  utils_error().raise(LOCAL_INFO,errmsg);
1382  }
1383  }
bool iCanManageLoops
Flag indicating whether this function can manage a loop over other functions.
Definition: functors.hpp:624
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
std::vector< functor * > myNestedFunctorList
Vector of functors that have been set up to run nested within this one.
Definition: functors.hpp:640
str origin() const
Getter for the wrapped function&#39;s origin (module or backend name)
Definition: functors.cpp:121
str name() const
Getter for the wrapped function&#39;s name.
Definition: functors.cpp:115
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
Here is the call graph for this function:

◆ setPermittedBackend()

void Gambit::module_functor_common::setPermittedBackend ( str  req,
str  be,
str  ver 
)

Add a single permitted backend version.

Definition at line 1262 of file functors.cpp.

References backendreq_types, LOCAL_INFO, Gambit::functor::name(), Gambit::functor::origin(), permitted_map, and Gambit::utils_error().

Referenced by makeBackendOptionRule().

1263  {
1264  sspair key;
1265  if (backendreq_types.find(req) != backendreq_types.end())
1266  {
1267  key = std::make_pair(req, backendreq_types[req]);
1268  }
1269  else
1270  {
1271  str errmsg = "Error whilst attempting to set permitted backend:";
1272  errmsg += "\nThe return type of the backend requirement " + req + "is not set."
1273  "\nThis probably means the backend requirement has not been declared."
1274  "\nThis is " + this->name() + " in " + this->origin() + ".";
1275  utils_error().raise(LOCAL_INFO,errmsg);
1276  }
1277  sspair vector_entry (be, ver);
1278  if (permitted_map.find(key) == permitted_map.end())
1279  {
1280  std::set<sspair> newvec;
1281  permitted_map[key] = newvec;
1282  }
1283  permitted_map[key].insert(vector_entry);
1284  }
std::map< str, str > backendreq_types
Map from backend requirements to their required types.
Definition: functors.hpp:690
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
str origin() const
Getter for the wrapped function&#39;s origin (module or backend name)
Definition: functors.cpp:121
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
str name() const
Getter for the wrapped function&#39;s name.
Definition: functors.cpp:115
std::map< sspair, std::set< sspair > > permitted_map
Map from (backend requirement-type pairs) to (set of permitted {backend-version} pairs) ...
Definition: functors.hpp:703
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRequiredClassloader()

void Gambit::module_functor_common::setRequiredClassloader ( str  be,
str  ver,
str  safe_ver 
)

Add a rule indicating that classes from a given backend must be available.

Definition at line 1328 of file functors.cpp.

References myDependencies, and required_classloading_backends.

1329  {
1330  // Add the rule.
1331  required_classloading_backends[be].insert(ver);
1332  // Add a dependency on the backend's initialisation function.
1333  sspair be_ini_quantity(be + "_" + safe_ver + "_init", "void");
1334  if (std::find(myDependencies.begin(), myDependencies.end(), be_ini_quantity) == myDependencies.end())
1335  {
1336  myDependencies.insert(be_ini_quantity);
1337  }
1338  }
std::map< str, std::set< str > > required_classloading_backends
Map from required classloading backends to their versions.
Definition: functors.hpp:709
std::pair< str, str > sspair
Shorthand for a pair of standard strings.
Definition: util_types.hpp:64
std::set< sspair > myDependencies
Vector of dependency-type string pairs.
Definition: functors.hpp:664

◆ setTimingPrintRequirement()

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

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

Reimplemented from Gambit::functor.

Definition at line 700 of file functors.cpp.

References myTimingPrintFlag.

701  {
702  myTimingPrintFlag = flag;
703  }
bool myTimingPrintFlag
Flag to select whether or not the timing data for this function&#39;s execution should be printed;...
Definition: functors.hpp:585

◆ startTiming()

void Gambit::module_functor_common::startTiming ( int  thread_num)
protectedvirtual

Do pre-calculate timing things.

Definition at line 1671 of file functors.cpp.

References start.

Referenced by Gambit::module_functor< void >::calculate().

1672  {
1673  start[thread_num] = std::chrono::system_clock::now();
1674  }
std::chrono::time_point< std::chrono::system_clock > * start
Beginning and end timing points.
Definition: functors.hpp:597
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ FunctorHelp::entering_multithreaded_region

Connectors to external helper functions (to decouple signal handling from this class)

◆ FunctorHelp::leaving_multithreaded_region

Member Data Documentation

◆ activeModelFlags

std::map<str, bool> Gambit::module_functor_common::activeModelFlags
protected

Map from known models to flags indicating if they are activated or not (known = allowed, in allowed groups or conditions for conditional dependencies)

Definition at line 679 of file functors.hpp.

Referenced by fill_activeModelFlags(), getActiveModelFlag(), and notifyOfModel().

◆ already_printed

bool* Gambit::module_functor_common::already_printed
protected

Has result already been sent to the printer?

Definition at line 618 of file functors.hpp.

Referenced by init_memory(), reset(), and ~module_functor_common().

◆ already_printed_timing

bool* Gambit::module_functor_common::already_printed_timing
protected

Has timing data already been sent to the printer?

Definition at line 621 of file functors.hpp.

Referenced by init_memory(), reset(), and ~module_functor_common().

◆ backendreq_groups

std::map<sspair, str> Gambit::module_functor_common::backendreq_groups
protected

Map from backend requirements to their designated groups.

Definition at line 693 of file functors.hpp.

Referenced by notifyOfModel(), resolveBackendReq(), setBackendReq(), and setModelConditionalBackendReqSingular().

◆ backendreq_map

std::map<sspair, void(*)(functor*)> Gambit::module_functor_common::backendreq_map
protected

Map from (backend requirement-type pairs) to (pointers to templated void functions that set backend requirement functor pointers)

Definition at line 700 of file functors.hpp.

Referenced by resolveBackendReq(), and setBackendReq().

◆ backendreq_tagmap

std::map<sspair, std::set<str> > Gambit::module_functor_common::backendreq_tagmap
protected

Map from backend requirements to their rule tags.

Definition at line 696 of file functors.hpp.

Referenced by backendreq_tags(), makeBackendMatchingRule(), makeBackendOptionRule(), makeBackendRuleForModel(), and setBackendReq().

◆ backendreq_types

std::map<str, str> Gambit::module_functor_common::backendreq_types
protected

Map from backend requirements to their required types.

Definition at line 690 of file functors.hpp.

Referenced by setBackendConditionalDependencySingular(), setBackendReq(), and setPermittedBackend().

◆ chosenReqsFromGroups

std::map<str,str> Gambit::module_functor_common::chosenReqsFromGroups
protected

Map from groups to backend reqs, indicating which backend req has been activated for which backend group.

Definition at line 652 of file functors.hpp.

Referenced by getChosenReqFromGroup(), and resolveBackendReq().

◆ dependency_functor_map

std::map<sspair, functor*> Gambit::module_functor_common::dependency_functor_map
protected

Map from (dependency-type pairs) to pointers to functors used to resolve them that set dependency functor pointers)

Definition at line 687 of file functors.hpp.

Referenced by notifyOfDependee(), and resolveDependency().

◆ dependency_map

std::map<sspair, void(*)(functor*, module_functor_common*)> Gambit::module_functor_common::dependency_map
protected

Map from (dependency-type pairs) to (pointers to templated void functions that set dependency functor pointers)

Definition at line 683 of file functors.hpp.

Referenced by resolveDependency(), setBackendConditionalDependencySingular(), setDependency(), and setModelConditionalDependencySingular().

◆ end

std::chrono::time_point<std::chrono::system_clock> * Gambit::module_functor_common::end
protected

Definition at line 597 of file functors.hpp.

Referenced by finishTiming(), init_memory(), resolveBackendReq(), and ~module_functor_common().

◆ fadeRate

double Gambit::module_functor_common::fadeRate
protected

Fade rate for average runtime.

Definition at line 609 of file functors.hpp.

Referenced by acknowledgeInvalidation(), finishTiming(), and setFadeRate().

◆ globlMaxThreads

const int Gambit::module_functor_common::globlMaxThreads
protected

Maximum number of OpenMP threads this MPI process is permitted to launch in total.

Definition at line 646 of file functors.hpp.

Referenced by init_memory(), init_myCurrentIteration_if_NULL(), module_functor_common(), and reset().

◆ iCanManageLoops

bool Gambit::module_functor_common::iCanManageLoops
protected

Flag indicating whether this function can manage a loop over other functions.

Definition at line 624 of file functors.hpp.

Referenced by canBeLoopManager(), Gambit::FunctorHelp::entering_multithreaded_region(), Gambit::FunctorHelp::leaving_multithreaded_region(), reset(), setCanBeLoopManager(), and setNestedList().

◆ iRunNested

bool Gambit::module_functor_common::iRunNested
protected

Flag indicating whether this function can run nested in a loop over functions.

Definition at line 630 of file functors.hpp.

Referenced by init_memory(), init_myCurrentIteration_if_NULL(), reset(), and setLoopManagerCapType().

◆ missing_backends

std::vector<str> Gambit::module_functor_common::missing_backends
protected

Vector of required backends currently missing.

Definition at line 712 of file functors.hpp.

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

◆ myBackendConditionalDependencies

std::map< std::vector<str>, std::set<sspair> > Gambit::module_functor_common::myBackendConditionalDependencies
protected

Map from (vector with 4 strings: backend req, type, backend, version) to (set of {conditional dependency-type} pairs)

Definition at line 670 of file functors.hpp.

Referenced by backend_conditional_dependencies(), and setBackendConditionalDependencySingular().

◆ myBackendReqs

std::set<sspair> Gambit::module_functor_common::myBackendReqs
protected

Set of all backend requirement-type string pairs.

Definition at line 655 of file functors.hpp.

Referenced by makeBackendMatchingRule(), makeBackendOptionRule(), makeBackendRuleForModel(), and setBackendReq().

◆ myConditionalDependencies

std::map<str,str> Gambit::module_functor_common::myConditionalDependencies
protected

Map of conditional dependencies to their types.

Definition at line 667 of file functors.hpp.

Referenced by retrieve_conditional_dep_type_pair(), and setConditionalDependency().

◆ myCurrentIteration

long long* Gambit::module_functor_common::myCurrentIteration
protected

Pointer to counters for iterations of nested functor loop.

Definition at line 643 of file functors.hpp.

Referenced by init_myCurrentIteration_if_NULL(), iterationPtr(), setIteration(), and ~module_functor_common().

◆ myDependencies

std::set<sspair> Gambit::module_functor_common::myDependencies
protected

Vector of dependency-type string pairs.

Definition at line 664 of file functors.hpp.

Referenced by dependencies(), notifyOfModel(), resolveBackendReq(), resolveDependency(), setDependency(), and setRequiredClassloader().

◆ myForcedMatches

std::map< str, std::set<sspair> > Gambit::module_functor_common::myForcedMatches
protected

Map from tags to sets of matching (backend requirement-type pairs) that are forced to use the same backend.

Definition at line 706 of file functors.hpp.

Referenced by forcematchingbackend(), and makeBackendMatchingRule().

◆ myGroupedBackendReqs

std::map<str,std::set<sspair> > Gambit::module_functor_common::myGroupedBackendReqs
protected

Set of backend requirement-type string pairs for specific backend groups.

Definition at line 661 of file functors.hpp.

Referenced by backendreqs(), notifyOfModel(), setBackendReq(), and setModelConditionalBackendReqSingular().

◆ myGroups

std::set<str> Gambit::module_functor_common::myGroups
protected

Internal list of backend groups that this functor's requirements fall into.

Definition at line 649 of file functors.hpp.

Referenced by backendgroups(), and setBackendReq().

◆ myLogTag

int Gambit::module_functor_common::myLogTag
protected

Integer LogTag, for tagging log messages.

Definition at line 718 of file functors.hpp.

Referenced by Gambit::module_functor< void >::calculate(), check_missing_LogTag(), and module_functor_common().

◆ myLoopIsDone

bool Gambit::module_functor_common::myLoopIsDone
protected

Flag indicating whether this function is ready to finish its loop (only relevant if iCanManageLoops = true)

Definition at line 627 of file functors.hpp.

Referenced by breakLoop(), loopIsDone(), and resetLoop().

◆ myLoopManager

functor* Gambit::module_functor_common::myLoopManager
protected

Pointer to the functor that mangages the loop that this function runs inside of.

Definition at line 637 of file functors.hpp.

Referenced by breakLoopFromManagedFunctor(), loopManagerName(), loopManagerOrigin(), and resolveLoopManager().

◆ myLoopManagerCapability

str Gambit::module_functor_common::myLoopManagerCapability
protected

Capability of a function that mangages a loop that this function can run inside of.

Definition at line 633 of file functors.hpp.

Referenced by loopManagerCapability(), resolveLoopManager(), and setLoopManagerCapType().

◆ myLoopManagerType

str Gambit::module_functor_common::myLoopManagerType
protected

Capability of a function that mangages a loop that this function can run inside of.

Definition at line 635 of file functors.hpp.

Referenced by loopManagerType(), resolveLoopManager(), and setLoopManagerCapType().

◆ myModelConditionalBackendReqs

std::map< str, std::set<sspair> > Gambit::module_functor_common::myModelConditionalBackendReqs
protected

Map from models to (set of {conditional backend requirement-type} pairs)

Definition at line 676 of file functors.hpp.

Referenced by fill_activeModelFlags(), model_conditional_backend_reqs(), and setModelConditionalBackendReqSingular().

◆ myModelConditionalDependencies

std::map< str, std::set<sspair> > Gambit::module_functor_common::myModelConditionalDependencies
protected

Map from models to (set of {conditional dependency-type} pairs)

Definition at line 673 of file functors.hpp.

Referenced by fill_activeModelFlags(), model_conditional_dependencies(), and setModelConditionalDependencySingular().

◆ myNestedFunctorList

std::vector<functor*> Gambit::module_functor_common::myNestedFunctorList
protected

Vector of functors that have been set up to run nested within this one.

Definition at line 640 of file functors.hpp.

Referenced by iterate(), retrieve_invalid_point_exception(), and setNestedList().

◆ myResolvableBackendReqs

std::set<sspair> Gambit::module_functor_common::myResolvableBackendReqs
protected

Set of all backend requirement-type string pairs currently available for resolution.

Definition at line 658 of file functors.hpp.

Referenced by backendreqs(), notifyOfModel(), setBackendReq(), and setModelConditionalBackendReqSingular().

◆ myTimingPrintFlag

bool Gambit::module_functor_common::myTimingPrintFlag
protected

Flag to select whether or not the timing data for this function's execution should be printed;.

Definition at line 585 of file functors.hpp.

Referenced by requiresTimingPrinting(), and setTimingPrintRequirement().

◆ needs_recalculating

bool* Gambit::module_functor_common::needs_recalculating
protected

Needs recalculating or not?

Definition at line 615 of file functors.hpp.

Referenced by Gambit::module_functor< void >::calculate(), finishTiming(), init_memory(), reset(), and ~module_functor_common().

◆ permitted_map

std::map< sspair, std::set<sspair> > Gambit::module_functor_common::permitted_map
protected

Map from (backend requirement-type pairs) to (set of permitted {backend-version} pairs)

Definition at line 703 of file functors.hpp.

Referenced by backendspermitted(), resolveBackendReq(), and setPermittedBackend().

◆ pInvalidation

double Gambit::module_functor_common::pInvalidation
protected

Probability that functors invalidates point in model parameter space.

Definition at line 612 of file functors.hpp.

Referenced by acknowledgeInvalidation(), finishTiming(), and getInvalidationRate().

◆ point_exception_raised

bool Gambit::module_functor_common::point_exception_raised
protected

A flag indicating whether or not this functor has invalidated the current point.

Definition at line 600 of file functors.hpp.

Referenced by acknowledgeInvalidation(), Gambit::module_functor< void >::calculate(), reset(), and retrieve_invalid_point_exception().

◆ raised_point_exception

invalid_point_exception Gambit::module_functor_common::raised_point_exception
protected

An exception raised because this functor has invalidated the current point.

Definition at line 603 of file functors.hpp.

Referenced by acknowledgeInvalidation(), and retrieve_invalid_point_exception().

◆ required_classloading_backends

std::map< str, std::set<str> > Gambit::module_functor_common::required_classloading_backends
protected

Map from required classloading backends to their versions.

Definition at line 709 of file functors.hpp.

Referenced by notifyOfBackends(), and setRequiredClassloader().

◆ runtime_average

double Gambit::module_functor_common::runtime_average
protected

Averaged runtime in ns.

Definition at line 606 of file functors.hpp.

Referenced by finishTiming(), and getRuntimeAverage().

◆ signal_mode_locked

bool Gambit::module_functor_common::signal_mode_locked = true
protected

While locked, prevent this function switching off threadsafe* emergency signal handling.

*The emergency signal handling cannot be made completely threadsafe; it can still cause lockups and memory corruption if it occurs at an inopportune time. "soft" shutdown is always preferable.

Definition at line 727 of file functors.hpp.

Referenced by Gambit::FunctorHelp::entering_multithreaded_region(), and Gambit::FunctorHelp::leaving_multithreaded_region().

◆ start

std::chrono::time_point<std::chrono::system_clock>* Gambit::module_functor_common::start
protected

Beginning and end timing points.

Definition at line 597 of file functors.hpp.

Referenced by finishTiming(), init_memory(), startTiming(), and ~module_functor_common().

◆ tp

timespec Gambit::module_functor_common::tp
protected

Internal timespec object.

Definition at line 715 of file functors.hpp.


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