Class Variable
Defined in File Variable.hpp
Class Documentation
-
class Variable
The Variable class is used to store the unknowns of the system and define abstract elementary algebra.
- Author
Stefan Klus
- Author
Slaven Peles
Public Functions
-
inline Variable()
Default constructor.
-
inline explicit Variable(double value)
Constructor which initializes the value.
-
inline Variable(double value, size_t variable_number)
Constructor which initializes the value and variable number.
-
inline ~Variable()
Destructor deletes the dependency map.
-
inline Variable &operator=(const double &rhs)
Assignment operator. Assigning double value to Variable removes its dependencies. Use only if you know what you are doing.
-
inline Variable &operator=(const Variable &rhs)
Assignment operator.
This operator:
assigns value from the right hand side
leaves variable ID unchanged
clears any existing and adds new dependencies from rhs
-
inline double &operator()()
Operator () returns the value of a variable.
This is just short notation to avoid using getValue and setValue.
-
inline const double &operator()() const
Operator() returns the value of a variable (const version).
This is just short notation to avoid using getValue.
-
inline double getValue() const
Return the current value of the variable.
-
inline void setValue(double value)
Overwrite the current value of the variable.
-
inline double der(size_t i) const
Return derivative of *this with respect to dependency i.
-
inline size_t getVariableNumber() const
Returns the variable number.
This number is assigned to state variables (variables updated directly by the solver) only.
-
inline void setVariableNumber(size_t variable_number)
Sets the variable number.
-
inline bool isRegistered() const
Checks whether the variable was registered as an unknown of the system.
INVALID_VAR_NUMBER is used to mark parameters and temporary variables
-
inline bool is_fixed() const
Checks whether the variable is fixed or not.
-
inline void setFixed(bool b = false)
Turns variable into parameter, or vice versa.
-
inline const DependencyMap &getDependencies() const
Returns the list of derivatives.
-
inline void registerVariable(std::vector<Variable*> &x, const size_t &offset)
Registers a variable as an unknown of the system and adds a pointer to the global x vector.
-
inline void scaleDependencies(double c)
Multiplies each partial derivative of this by c.
-
inline void print(std::ostream &os) const
Prints the value and input set of the variable.
-
inline Variable &operator+=(const double &rhs)
Compound addition-assignment operator. Right hand side is a built-in double type.
-
inline Variable &operator+=(const Variable &rhs)
Compound addition-assignment operator. Right hand side is Variable type.
-
inline Variable &operator-=(const double &rhs)
Compound subtraction-assignment operator. Right hand side is a built-in double type.
-
inline Variable &operator-=(const Variable &rhs)
Compound subtraction-assignment operator. Right hand side is a Variable type.
-
inline Variable &operator*=(const double &rhs)
Compound multiplication-assignment operator. Right hand side is a built-in double type.
-
inline Variable &operator*=(const Variable &rhs)
Compound multiplication-assignment operator. Right hand side is a Variable type.