Function Class Reference

#include <Function.h>

Inheritance diagram for Function:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Function ()
 Function (const Function &rhs)
 ~Function ()
void setExpr (const Eref &e, string expr)
string getExpr (const Eref &e) const
vector< string > getVars () const
void setVarValues (vector< string > vars, vector< double > vals)
void setVar (unsigned int index, double value)
VariablegetVar (unsigned int ii)
double getValue () const
double getRate () const
void setMode (unsigned int mode)
unsigned int getMode () const
void setNumVar (unsigned int num)
unsigned int getNumVar () const
void setConst (string name, double value)
double getConst (string name) const
void setIndependent (string index)
string getIndependent () const
vector< double > getY () const
double getDerivative () const
Functionoperator= (const Function rhs)
unsigned int addVar ()
void process (const Eref &e, ProcPtr p)
void reinit (const Eref &e, ProcPtr p)

Static Public Member Functions

static const CinfoinitCinfo ()

Static Public Attributes

static const int VARMAX

Protected Member Functions

void _clearBuffer ()
void _showError (mu::Parser::exception_type &e) const

Protected Attributes

bool _valid
unsigned int _numVar
double _lastValue
double _value
double _rate
unsigned int _mode
vector< Variable * > _varbuf
vector< double * > _pullbuf
map< string, double * > _constbuf
string _independent
mu::Parser _parser
char * _stoich

Friends

double * _functionAddVar (const char *name, void *data)

Constructor & Destructor Documentation

Function::Function (  ) 

References _clearBuffer(), _functionAddVar, _independent, _parser, _showError(), _valid, M_E, and M_PI.

Here is the call graph for this function:

Function::Function ( const Function rhs  ) 

References _functionAddVar, _independent, _parser, _pullbuf, _varbuf, getExpr(), M_E, M_PI, and setExpr().

Here is the call graph for this function:

Function::~Function (  ) 

References _clearBuffer().

Here is the call graph for this function:


Member Function Documentation

void Function::_clearBuffer (  )  [protected]

References _numVar, _parser, _pullbuf, and _varbuf.

Referenced by Function(), operator=(), setNumVar(), and ~Function().

void Function::_showError ( mu::Parser::exception_type &  e  )  const [protected]

Referenced by Function(), getDerivative(), and getValue().

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.

double Function::getConst ( string  name  )  const

Referenced by initCinfo().

double Function::getDerivative (  )  const

References _independent, _parser, _showError(), and _valid.

Referenced by initCinfo(), and process().

Here is the call graph for this function:

string Function::getExpr ( const Eref e  )  const

References _parser, _valid, Eref::objId(), and ObjId::path().

Referenced by Function(), ZombieFunction::initCinfo(), initCinfo(), and operator=().

Here is the call graph for this function:

string Function::getIndependent (  )  const

References _independent.

Referenced by initCinfo().

unsigned int Function::getMode (  )  const

References _mode.

Referenced by initCinfo().

unsigned int Function::getNumVar (  )  const

References _numVar.

Referenced by initCinfo().

double Function::getRate (  )  const

References _rate, and _valid.

Referenced by initCinfo().

double Function::getValue (  )  const

References _parser, _showError(), and _valid.

Referenced by initCinfo(), and process().

Here is the call graph for this function:

Variable * Function::getVar ( unsigned int  ii  ) 

References _varbuf, and dummy().

Referenced by initCinfo().

Here is the call graph for this function:

vector<string> Function::getVars (  )  const
vector< double > Function::getY (  )  const

References _pullbuf.

Referenced by initCinfo().

const Cinfo * Function::initCinfo (  )  [static]
Function & Function::operator= ( const Function  rhs  ) 

References _clearBuffer(), _independent, _lastValue, _mode, _parser, _pullbuf, _rate, _value, _varbuf, getExpr(), M_E, M_PI, and setExpr().

Here is the call graph for this function:

void Function::process ( const Eref e,
ProcPtr  p 
)

Reimplemented in ZombieFunction.

References _lastValue, _mode, _pullbuf, _rate, _valid, _value, ProcInfo::dt, getDerivative(), and getValue().

Referenced by initCinfo().

Here is the call graph for this function:

void Function::reinit ( const Eref e,
ProcPtr  p 
)

Reimplemented in ZombieFunction.

References _lastValue, _mode, _parser, _rate, _valid, _value, setExpr(), and trim().

Referenced by initCinfo().

Here is the call graph for this function:

void Function::setConst ( string  name,
double  value 
)

Referenced by initCinfo().

void Function::setExpr ( const Eref e,
string  expr 
)

Reimplemented in ZombieFunction.

Referenced by Function(), initCinfo(), operator=(), and reinit().

void Function::setIndependent ( string  index  ) 

Referenced by initCinfo().

void Function::setMode ( unsigned int  mode  ) 

References _mode.

Referenced by initCinfo().

void Function::setNumVar ( unsigned int  num  ) 

References _clearBuffer(), and _functionAddVar.

Referenced by initCinfo().

Here is the call graph for this function:

void Function::setVar ( unsigned int  index,
double  value 
)

References _varbuf.

void Function::setVarValues ( vector< string >  vars,
vector< double >  vals 
)

Friends And Related Function Documentation

double* _functionAddVar ( const char *  name,
void *  data 
) [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.

Referenced by Function(), and setNumVar().


Member Data Documentation

map< string, double *> Function::_constbuf [protected]
string Function::_independent [protected]
double Function::_lastValue [protected]

Referenced by operator=(), process(), and reinit().

unsigned int Function::_mode [protected]
unsigned int Function::_numVar [protected]
mu::Parser Function::_parser [protected]
vector< double * > Function::_pullbuf [protected]
double Function::_rate [protected]

Referenced by getRate(), operator=(), process(), and reinit().

char* Function::_stoich [protected]
bool Function::_valid [mutable, protected]
double Function::_value [protected]

Referenced by operator=(), process(), and reinit().

vector<Variable *> Function::_varbuf [protected]
const int Function::VARMAX [static]

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

Generated on 1 Jul 2015 for MOOSE by  doxygen 1.6.1