MOOSE - Multiscale Object Oriented Simulation Environment
|
#include <Function.h>
Public Member Functions | |
unsigned int | addVar () |
Function () | |
Function (const Function &rhs) | |
double | getConst (string name) const |
double | getDerivative () const |
bool | getDoEvalAtReinit () const |
string | getExpr (const Eref &e) const |
string | getIndependent () const |
unsigned int | getMode () const |
unsigned int | getNumVar () const |
double | getRate () const |
bool | getUseTrigger () const |
double | getValue () const |
Variable * | getVar (unsigned int ii) |
vector< string > | getVars () const |
vector< double > | getY () const |
virtual void | innerSetExpr (const Eref &e, string expr) |
Function & | operator= (const Function rhs) |
void | process (const Eref &e, ProcPtr p) |
void | reinit (const Eref &e, ProcPtr p) |
void | setConst (string name, double value) |
void | setDoEvalAtReinit (bool doEvalAtReinit) |
void | setExpr (const Eref &e, string expr) |
void | setIndependent (string index) |
void | setMode (unsigned int mode) |
void | setNumVar (unsigned int num) |
void | setUseTrigger (bool useTrigger) |
void | setVar (unsigned int index, double value) |
void | setVarValues (vector< string > vars, vector< double > vals) |
~Function () | |
Static Public Member Functions | |
static const Cinfo * | initCinfo () |
Static Public Attributes | |
static const int | VARMAX |
Protected Member Functions | |
void | _clearBuffer () |
void | _showError (mu::Parser::exception_type &e) const |
Protected Attributes | |
map< string, double * > | _constbuf |
bool | _doEvalAtReinit |
string | _independent |
double | _lastValue |
unsigned int | _mode |
unsigned int | _numVar |
mu::Parser | _parser |
vector< double * > | _pullbuf |
double | _rate |
char * | _stoich |
double | _t |
bool | _useTrigger |
bool | _valid |
double | _value |
vector< Variable * > | _varbuf |
Friends | |
double * | _functionAddVar (const char *name, void *data) |
Definition at line 60 of file Function.h.
Function::Function | ( | ) |
Definition at line 329 of file Function.cpp.
References _clearBuffer(), _functionAddVar, _independent, _parser, _showError(), and _valid.
Function::Function | ( | const Function & | rhs | ) |
Definition at line 360 of file Function.cpp.
References _functionAddVar, _independent, _parser, _pullbuf, _varbuf, getExpr(), and setExpr().
Function::~Function | ( | ) |
Definition at line 428 of file Function.cpp.
References _clearBuffer().
|
protected |
Definition at line 435 of file Function.cpp.
References _numVar, _parser, _pullbuf, and _varbuf.
Referenced by Function(), innerSetExpr(), operator=(), setNumVar(), and ~Function().
|
protected |
Definition at line 453 of file Function.cpp.
Referenced by Function(), getDerivative(), getValue(), and innerSetExpr().
unsigned int Function::addVar | ( | ) |
This function is for automatically adding variables when setVar messages are connected.
There are two ways new variables can be created :
(1) When the user sets the expression, muParser calls _functionAddVar to get the address of the storage for each variable name in the expression.
(2) When the user connects a setVar message to a Variable. ??
This is called by Variable::addMsgCallback - which is unused.
Definition at line 539 of file Function.cpp.
double Function::getConst | ( | string | name | ) | const |
Definition at line 729 of file Function.cpp.
References _parser.
Referenced by initCinfo().
double Function::getDerivative | ( | ) | const |
Definition at line 668 of file Function.cpp.
References _independent, _parser, _showError(), _valid, and value.
Referenced by initCinfo(), and process().
bool Function::getDoEvalAtReinit | ( | ) | const |
Definition at line 621 of file Function.cpp.
References _doEvalAtReinit.
Referenced by initCinfo().
string Function::getExpr | ( | const Eref & | e | ) | const |
Definition at line 587 of file Function.cpp.
References _parser, _valid, Eref::objId(), and ObjId::path().
Referenced by Function(), initCinfo(), and operator=().
string Function::getIndependent | ( | ) | const |
Definition at line 654 of file Function.cpp.
References _independent.
Referenced by initCinfo().
unsigned int Function::getMode | ( | ) | const |
Definition at line 601 of file Function.cpp.
References _mode.
Referenced by initCinfo().
unsigned int Function::getNumVar | ( | ) | const |
Definition at line 697 of file Function.cpp.
References _numVar.
Referenced by initCinfo().
double Function::getRate | ( | ) | const |
Definition at line 641 of file Function.cpp.
Referenced by initCinfo().
bool Function::getUseTrigger | ( | ) | const |
Definition at line 611 of file Function.cpp.
References _useTrigger.
Referenced by initCinfo().
double Function::getValue | ( | ) | const |
Definition at line 626 of file Function.cpp.
References _parser, _showError(), _valid, and value.
Referenced by initCinfo(), process(), and reinit().
Variable * Function::getVar | ( | unsigned int | ii | ) |
Definition at line 712 of file Function.cpp.
References _varbuf, and dummy.
Referenced by initCinfo().
vector<string> Function::getVars | ( | ) | const |
vector< double > Function::getY | ( | ) | const |
Definition at line 659 of file Function.cpp.
References _pullbuf.
Referenced by initCinfo().
|
static |
Definition at line 91 of file Function.cpp.
References derivativeOut(), functionCinfo, getConst(), getDerivative(), getDoEvalAtReinit(), getExpr(), getIndependent(), getMode(), getNumVar(), getRate(), getUseTrigger(), getValue(), getVar(), getY(), Variable::initCinfo(), Neutral::initCinfo(), process(), rateOut(), reinit(), requestOut(), setConst(), setDoEvalAtReinit(), setExpr(), setIndependent(), setMode(), setNumVar(), setUseTrigger(), value, and valueOut().
Referenced by ZombieFunction::initCinfo().
|
virtual |
Reimplemented in ZombieFunction.
Definition at line 562 of file Function.cpp.
References _clearBuffer(), _numVar, _parser, _showError(), _valid, _varbuf, Eref::objId(), and ObjId::path().
Referenced by ZombieFunction::innerSetExpr(), and setExpr().
Definition at line 395 of file Function.cpp.
References _clearBuffer(), _independent, _lastValue, _mode, _parser, _pullbuf, _rate, _value, _varbuf, getExpr(), and setExpr().
Definition at line 741 of file Function.cpp.
References _lastValue, _mode, _pullbuf, _rate, _t, _useTrigger, _valid, _value, ProcInfo::currTime, derivativeOut(), ProcInfo::dt, getDerivative(), getValue(), rateOut(), requestOut(), TriggerThreshold, and valueOut().
Referenced by initCinfo().
Definition at line 783 of file Function.cpp.
References _doEvalAtReinit, _lastValue, _mode, _parser, _rate, _t, _valid, _value, ProcInfo::currTime, derivativeOut(), getValue(), rateOut(), setExpr(), moose::trim(), and valueOut().
Referenced by initCinfo().
void Function::setConst | ( | string | name, |
double | value | ||
) |
Definition at line 724 of file Function.cpp.
References _parser.
Referenced by initCinfo().
void Function::setDoEvalAtReinit | ( | bool | doEvalAtReinit | ) |
Definition at line 616 of file Function.cpp.
References _doEvalAtReinit.
Referenced by initCinfo().
void Function::setExpr | ( | const Eref & | e, |
string | expr | ||
) |
Definition at line 556 of file Function.cpp.
References innerSetExpr().
Referenced by Function(), initCinfo(), operator=(), and reinit().
void Function::setIndependent | ( | string | index | ) |
Definition at line 649 of file Function.cpp.
References _independent.
Referenced by initCinfo().
void Function::setMode | ( | unsigned int | mode | ) |
Definition at line 596 of file Function.cpp.
References _mode.
Referenced by initCinfo().
void Function::setNumVar | ( | unsigned int | num | ) |
Definition at line 687 of file Function.cpp.
References _clearBuffer(), _functionAddVar, and name.
Referenced by initCinfo().
void Function::setUseTrigger | ( | bool | useTrigger | ) |
Definition at line 606 of file Function.cpp.
References _useTrigger.
Referenced by initCinfo().
void Function::setVar | ( | unsigned int | index, |
double | value | ||
) |
void Function::setVarValues | ( | vector< string > | vars, |
vector< double > | vals | ||
) |
|
friend |
Call-back to add variables to parser automatically.
We use different storage for constants and variables. Variables are stored in a vector of Variable object pointers. They must have the name x{index} where index is any non-negative integer. Note that the vector is resized to whatever the maximum index is. It is up to the user to make sure that indices are sequential without any gap. In case there is a gap in indices, those entries will remain unused.
If the name starts with anything other than x
or y
, then it is taken to be a named constant, which must be set before any expression or variables and error is thrown.
NOTE: this is called not on setting expression but on first attempt at evaluation of the same, i.e. when you access value
of the Function object.
Simple function parser and evaluator for MOOSE. This can take a mathematical expression in standard C form and a list of variables values and evaluate the results.
Definition at line 482 of file Function.cpp.
Referenced by Function(), and setNumVar().
|
protected |
Definition at line 155 of file Function.h.
|
protected |
Definition at line 150 of file Function.h.
Referenced by getDoEvalAtReinit(), reinit(), and setDoEvalAtReinit().
|
protected |
Definition at line 156 of file Function.h.
Referenced by Function(), getDerivative(), getIndependent(), operator=(), and setIndependent().
|
protected |
Definition at line 145 of file Function.h.
Referenced by operator=(), process(), and reinit().
|
protected |
Definition at line 148 of file Function.h.
Referenced by getMode(), operator=(), process(), reinit(), and setMode().
|
protected |
Definition at line 144 of file Function.h.
Referenced by _clearBuffer(), getNumVar(), and innerSetExpr().
|
protected |
Definition at line 157 of file Function.h.
Referenced by _clearBuffer(), Function(), getConst(), getDerivative(), getExpr(), getValue(), innerSetExpr(), operator=(), reinit(), and setConst().
|
protected |
Definition at line 154 of file Function.h.
Referenced by _clearBuffer(), Function(), getY(), operator=(), and process().
|
protected |
Definition at line 147 of file Function.h.
Referenced by getRate(), operator=(), process(), and reinit().
|
protected |
Definition at line 160 of file Function.h.
Referenced by ZombieFunction::innerSetExpr(), and ZombieFunction::setSolver().
|
protected |
Definition at line 142 of file Function.h.
Referenced by ZombieFunction::process(), process(), and reinit().
|
protected |
Definition at line 149 of file Function.h.
Referenced by getUseTrigger(), process(), and setUseTrigger().
|
mutableprotected |
Definition at line 143 of file Function.h.
Referenced by Function(), getDerivative(), getExpr(), getRate(), getValue(), innerSetExpr(), process(), and reinit().
|
protected |
Definition at line 146 of file Function.h.
Referenced by operator=(), process(), and reinit().
|
protected |
Definition at line 152 of file Function.h.
Referenced by _clearBuffer(), Function(), getVar(), innerSetExpr(), operator=(), and setVar().
|
static |
Definition at line 63 of file Function.h.