Nektar++
|
Public Member Functions | |
def | __init__ (self) |
def | variable (self) |
def | get_units (self, return_set=True) |
def | evaluate (self) |
def | classify_variables (self, dependencies_only=False, needs_special_treatment=lambda n:None) |
Public Member Functions inherited from CellMLToNektar.pycml.mathml | |
def | __init__ (self) |
def | __repr__ (self) |
def | __deepcopy__ (self, memo) |
def | clone_self (self, register=False) |
def | get_original_of_clone (self) |
def | get_component (self) |
def | model (self) |
def | eval (self, elt) |
Public Member Functions inherited from CellMLToNektar.pycml.element_base | |
def | __init__ (self) |
def | __delattr__ (self, key) |
def | __setattr__ (self, key, value) |
def | rootNode (self) |
def | cmeta_id (self) |
def | xml_remove_child_at (self, index=-1) |
def | xml_doc (self) |
def | xml_properties (self) |
Static Public Member Functions | |
def | create_new (elt, variable_name) |
Static Public Member Functions inherited from CellMLToNektar.pycml.mathml | |
def | clone (expr) |
Private Member Functions | |
def | _unset_cached_links (self, elt=None) |
def | _set_variable_obj (self, var) |
def | _get_binding_time (self) |
def | _rename (self, new_name=None) |
def | _reduce (self) |
Private Attributes | |
_cml_variable | |
_cml_units | |
Additional Inherited Members | |
Public Attributes inherited from CellMLToNektar.pycml.element_base | |
xml_attributes | |
Properties inherited from CellMLToNektar.pycml.mathml | |
component = property(get_component) | |
def CellMLToNektar.pycml.mathml_ci.__init__ | ( | self | ) |
Reimplemented from CellMLToNektar.pycml.mathml.
Definition at line 4220 of file pycml.py.
References CellMLToNektar.pycml.mathml_ci.__init__().
Referenced by CellMLToNektar.pycml.mathml_ci.__init__().
|
private |
Return the binding time of this expression. The binding time of a <ci> element is that of the variable it represents.
Definition at line 4266 of file pycml.py.
References CellMLToNektar.pycml.mathml_ci._get_binding_time(), Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >.variable, and CellMLToNektar.pycml.mathml_ci.variable().
Referenced by CellMLToNektar.pycml.mathml_ci._get_binding_time(), CellMLToNektar.pycml.mathml_ci._reduce(), CellMLToNektar.pycml.mathml_apply._reduce(), CellMLToNektar.pycml.mathml_piecewise._reduce(), CellMLToNektar.pycml.cellml_variable.get_value(), and CellMLToNektar.pycml.cellml_variable.is_statically_const().
|
private |
Reduce this expression by evaluating its static parts. If this is a static variable, replace by its value (as a <cn> element). Otherwise the behaviour depends on the number of uses of this variable. If there is only one, instantiate the definition of this variable here in place of the <ci> element, otherwise leave the element unchanged to avoid code duplication.
Definition at line 4282 of file pycml.py.
References CellMLToNektar.pycml.cellml_variable._get_binding_time(), CellMLToNektar.pycml.mathml_cn._get_binding_time(), CellMLToNektar.pycml.mathml_ci._get_binding_time(), CellMLToNektar.pycml.mathml_piecewise._get_binding_time(), CellMLToNektar.pycml.mathml_diff._get_binding_time(), CellMLToNektar.pycml.mathml_and._get_binding_time(), CellMLToNektar.pycml.mathml_or._get_binding_time(), CellMLToNektar.pycml.mathml_eq._get_binding_time(), CellMLToNektar.pycml.mathml_apply._get_binding_time(), CellMLToNektar.pycml.mathml_ci._reduce(), CellMLToNektar.utilities.DEBUG(), CellMLToNektar.pycml.mathml_cn.evaluate(), CellMLToNektar.pycml.mathml_ci.evaluate(), CellMLToNektar.pycml.mathml_apply.evaluate(), CellMLToNektar.pycml.mathml_piecewise.evaluate(), CellMLToNektar.pycml.mathml_plus.evaluate(), CellMLToNektar.pycml.mathml_minus.evaluate(), CellMLToNektar.pycml.mathml_times.evaluate(), CellMLToNektar.pycml.mathml_divide.evaluate(), CellMLToNektar.pycml.mathml_exp.evaluate(), CellMLToNektar.pycml.mathml_ln.evaluate(), CellMLToNektar.pycml.mathml_log.evaluate(), CellMLToNektar.pycml.mathml_abs.evaluate(), CellMLToNektar.pycml.mathml_power.evaluate(), CellMLToNektar.pycml.mathml_root.evaluate(), CellMLToNektar.pycml.mathml_and.evaluate(), CellMLToNektar.pycml.mathml_or.evaluate(), CellMLToNektar.pycml.mathml_leq.evaluate(), CellMLToNektar.pycml.mathml_lt.evaluate(), CellMLToNektar.pycml.mathml_geq.evaluate(), CellMLToNektar.pycml.mathml_gt.evaluate(), CellMLToNektar.pycml.mathml_neq.evaluate(), CellMLToNektar.pycml.mathml_eq.evaluate(), CellMLToNektar.pycml.mathml_rem.evaluate(), CellMLToNektar.pycml.mathml_logbase.evaluate(), CellMLToNektar.pycml.mathml_degree.evaluate(), CellMLToNektar.pycml.mathml_sin.evaluate(), CellMLToNektar.pycml.mathml_cos.evaluate(), CellMLToNektar.pycml.mathml_tan.evaluate(), CellMLToNektar.pycml.mathml_arcsin.evaluate(), CellMLToNektar.pycml.mathml_arccos.evaluate(), CellMLToNektar.pycml.mathml_arctan.evaluate(), CellMLToNektar.pycml.element_base.rootNode(), Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >.variable, and CellMLToNektar.pycml.mathml_ci.variable().
Referenced by CellMLToNektar.pycml.mathml_ci._reduce().
|
private |
Update the variable reference to use a canonical name.
Definition at line 4274 of file pycml.py.
References Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >.variable, and CellMLToNektar.pycml.mathml_ci.variable().
Referenced by CellMLToNektar.pycml.mathml_ci.variable().
|
private |
Set the variable object referred to by this element.
Definition at line 4244 of file pycml.py.
References CellMLToNektar.pycml.mathml_ci._cml_variable.
|
private |
Forget cached component and variable references in this MathML tree. Used by partial evaluator when moving maths to a new component, and by simulation protocols.
Reimplemented from CellMLToNektar.pycml.mathml.
Definition at line 4226 of file pycml.py.
References CellMLToNektar.pycml.mathml_ci._cml_variable, and CellMLToNektar.pycml.mathml_ci._unset_cached_links().
Referenced by CellMLToNektar.pycml.mathml._unset_cached_links(), and CellMLToNektar.pycml.mathml_ci._unset_cached_links().
def CellMLToNektar.pycml.mathml_ci.classify_variables | ( | self, | |
dependencies_only = False , |
|||
needs_special_treatment = lambda n: None |
|||
) |
Classify variables in this expression according to how they are used. For ci elements we just return a set containing the referenced variable as the single dependency. If dependencies_only is False, we also mark the variable as used.
Definition at line 4352 of file pycml.py.
References Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >.variable, and CellMLToNektar.pycml.mathml_ci.variable().
|
static |
Create a new <ci> element with the given variable name.
Definition at line 4366 of file pycml.py.
def CellMLToNektar.pycml.mathml_ci.evaluate | ( | self | ) |
Evaluate this expression by returning the value of the variable it represents.
Definition at line 4259 of file pycml.py.
References Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >.variable, and CellMLToNektar.pycml.mathml_ci.variable().
Referenced by CellMLToNektar.pycml.mathml_constructor._eval_self(), and CellMLToNektar.pycml.mathml_ci._reduce().
def CellMLToNektar.pycml.mathml_ci.get_units | ( | self, | |
return_set = True |
|||
) |
Return the units of the variable represented by this element.
Definition at line 4248 of file pycml.py.
References CellMLToNektar.pycml.cellml_model._cml_units, CellMLToNektar.pycml.cellml_component._cml_units, CellMLToNektar.pycml.mathml_units_mixin_tokens._cml_units, CellMLToNektar.pycml.mathml_units_mixin_container._cml_units, CellMLToNektar.pycml.mathml_cn._cml_units, CellMLToNektar.pycml.mathml_ci._cml_units, CellMLToNektar.pycml.mathml_apply._cml_units, CellMLToNektar.pycml.mathml_piecewise._cml_units, CellMLToNektar.pycml.cellml_variable.component, CellMLToNektar.pycml.mathml.component, CellMLToNektar.pycml.extract(), CellMLToNektar.pycml.get_units_by_name(), Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >.variable, and CellMLToNektar.pycml.mathml_ci.variable().
Referenced by CellMLToNektar.pycml.mathml._ensure_units_exist(), CellMLToNektar.pycml.mathml_units_mixin_tokens._set_in_units(), and CellMLToNektar.pycml.mathml_apply._set_in_units().
def CellMLToNektar.pycml.mathml_ci.variable | ( | self | ) |
Cache & return the variable object refered to by this element.
Definition at line 4236 of file pycml.py.
References CellMLToNektar.pycml.mathml_ci._cml_variable, CellMLToNektar.pycml.mathml_ci._rename(), CellMLToNektar.pycml.cellml_variable.component, and CellMLToNektar.pycml.mathml.component.
Referenced by CellMLToNektar.pycml.mathml_ci._get_binding_time(), CellMLToNektar.pycml.mathml_ci._reduce(), CellMLToNektar.pycml.mathml_ci._rename(), CellMLToNektar.pycml.mathml_ci.classify_variables(), CellMLToNektar.pycml.mathml_ci.evaluate(), and CellMLToNektar.pycml.mathml_ci.get_units().
|
private |
Definition at line 4223 of file pycml.py.
Referenced by CellMLToNektar.pycml.cellml_model._build_units_dictionary(), CellMLToNektar.pycml.cellml_component._build_units_dictionary(), CellMLToNektar.pycml.mathml_apply._set_in_units(), CellMLToNektar.pycml.mathml_piecewise._set_in_units(), CellMLToNektar.pycml.cellml_model.add_units(), CellMLToNektar.pycml.cellml_component.add_units(), CellMLToNektar.pycml.cellml_model.get_all_units(), CellMLToNektar.pycml.cellml_component.get_all_units(), CellMLToNektar.pycml.mathml_apply.get_units(), CellMLToNektar.pycml.mathml_piecewise.get_units(), CellMLToNektar.pycml.mathml_cn.get_units(), CellMLToNektar.pycml.mathml_ci.get_units(), CellMLToNektar.pycml.cellml_model.get_units_by_name(), CellMLToNektar.pycml.cellml_component.get_units_by_name(), and CellMLToNektar.pycml.cellml_model.has_units().
|
private |
Definition at line 4222 of file pycml.py.
Referenced by CellMLToNektar.pycml.mathml_ci._set_variable_obj(), CellMLToNektar.pycml.mathml_ci._unset_cached_links(), and CellMLToNektar.pycml.mathml_ci.variable().