#include <NFfunction.hh>
This small class is a small wrapper for the mu parser that allows the System to keep track of functions that will be used throughout the course of the simulation. These functions are only evaluated as needed to either output the value or when recomputing the rate of some reaction.
Public Member Functions | |
GlobalFunction (string name, string funcExpression, vector< string > &varRefNames, vector< string > &varRefTypes, vector< string > ¶mNames, System *s) | |
~GlobalFunction () | |
void | prepareForSimulation (System *s) |
void | updateParameters (System *s) |
string | getNiceName () const |
string | getName () const |
void | printDetails () |
void | printDetails (System *s) |
void | attatchRxn (ReactionClass *r) |
int | getNumOfVarRefs () const |
string | getVarRefName (int varRefIndex) const |
string | getVarRefType (int varRefIndex) const |
Public Attributes | |
mu::Parser * | p |
Protected Attributes | |
string | name |
string | funcExpression |
unsigned int | n_varRefs |
string * | varRefNames |
string * | varRefTypes |
unsigned int | n_params |
string * | paramNames |
GlobalFunction::GlobalFunction | ( | string | name, | |
string | funcExpression, | |||
vector< string > & | varRefNames, | |||
vector< string > & | varRefTypes, | |||
vector< string > & | paramNames, | |||
System * | s | |||
) |
Creates a GlobalFunction with the given variables (which should be Observable objects that the System has) as well as a set of parameter values. Note that creating a GlobalFunction does not initialize its parser. The initialize, you have to call the prepareForSimulation() function which is currently handled by the System.
GlobalFunction::~GlobalFunction | ( | ) |
Deletes the GlobalFunction along with all of its associated variable and constant parameter information.
void GlobalFunction::prepareForSimulation | ( | System * | s | ) |
This actually initializes the Function Parser so that it can be used.
void GlobalFunction::updateParameters | ( | System * | s | ) |
string NFcore::GlobalFunction::getNiceName | ( | ) | const [inline] |
Simply gives the name of the function nicely (meaning something like func1()) for debugging / outputing.
string NFcore::GlobalFunction::getName | ( | ) | const [inline] |
Simply gives the name of the function only (without the open and close parentheses) .
void GlobalFunction::printDetails | ( | ) |
For Debugging, prints out the details of the function including the defined variables and constant parameters as well as what the function currently evaluates to.
void GlobalFunction::printDetails | ( | System * | s | ) |
void GlobalFunction::attatchRxn | ( | ReactionClass * | r | ) |
When a reaction uses this function, we have to keep track of it here so that we can notify it to update is propensity when this function changes...
int NFcore::GlobalFunction::getNumOfVarRefs | ( | ) | const [inline] |
string NFcore::GlobalFunction::getVarRefName | ( | int | varRefIndex | ) | const [inline] |
string NFcore::GlobalFunction::getVarRefType | ( | int | varRefIndex | ) | const [inline] |
mu::Parser* NFcore::GlobalFunction::p |
This is the actual Parser object that keeps track of the function and has references to all of its arguments. It is publicly visible, so be careful with it! Use this variable to evaluate the function. See the mu parser documentation and the FuncFactory class for details on how to use this.
string NFcore::GlobalFunction::name [protected] |
string NFcore::GlobalFunction::funcExpression [protected] |
unsigned int NFcore::GlobalFunction::n_varRefs [protected] |
string* NFcore::GlobalFunction::varRefNames [protected] |
string* NFcore::GlobalFunction::varRefTypes [protected] |
unsigned int NFcore::GlobalFunction::n_params [protected] |
string* NFcore::GlobalFunction::paramNames [protected] |