Nektar++
|
Partial Evaluation #. More...
Public Member Functions | |
def | is_instantiable |
def | parteval |
Public Attributes | |
doc | |
solver_info | |
lookup_tables_analyser | |
Private Member Functions | |
def | _debug |
def | _expr_lhs |
def | _describe_expr |
def | _process_ci_elts |
def | _rename_var |
def | _do_reduce_eval_loop |
def | _reduce_evaluate_expression |
def | _get_assignment_exprs |
def | _is_source_of |
def | _check_retargetting |
Partial Evaluation #.
Perform partial evaluation of a CellML model.
Definition at line 57 of file optimize.py.
|
private |
Check if this new variable reference means a retarget needs to change. A retarget occurs when a kept dynamic mapped variable is changed to computed because its source variable(s) are only used once and are not kept. But new mathematics may use one or more of those sources, in which case we need to revert the retarget.
Definition at line 207 of file optimize.py.
References CellMLToNektar.optimize.PartialEvaluator._debug(), CellMLToNektar.cellml_metadata.RdfProcessor._debug(), and CellMLToNektar.optimize.PartialEvaluator._is_source_of().
|
private |
Output debug info from the PE process.
Definition at line 59 of file optimize.py.
Referenced by CellMLToNektar.optimize.PartialEvaluator._check_retargetting(), CellMLToNektar.optimize.PartialEvaluator._do_reduce_eval_loop(), CellMLToNektar.optimize.PartialEvaluator._reduce_evaluate_expression(), and CellMLToNektar.optimize.PartialEvaluator._rename_var().
|
private |
Describe this expression for debug info.
Definition at line 72 of file optimize.py.
References CellMLToNektar.optimize.PartialEvaluator._expr_lhs().
Referenced by CellMLToNektar.optimize.PartialEvaluator._reduce_evaluate_expression().
|
private |
Do the reduce/evaluate loop. expr_source is a callable that returns an iterable over expressions.
Definition at line 103 of file optimize.py.
References CellMLToNektar.optimize.PartialEvaluator._debug(), CellMLToNektar.cellml_metadata.RdfProcessor._debug(), and CellMLToNektar.optimize.PartialEvaluator._reduce_evaluate_expression().
|
private |
Display the LHS of this expression.
Definition at line 64 of file optimize.py.
Referenced by CellMLToNektar.optimize.PartialEvaluator._describe_expr().
|
private |
Get an iterable over all assignments in the model that are mathml_apply instances.
Definition at line 160 of file optimize.py.
|
private |
Test if v1 is a source of the mapped variable v2.
Definition at line 198 of file optimize.py.
References CellMLToNektar.optimize.PartialEvaluator._is_source_of().
Referenced by CellMLToNektar.optimize.PartialEvaluator._check_retargetting(), and CellMLToNektar.optimize.PartialEvaluator._is_source_of().
|
private |
Apply func to all ci elements in the tree rooted at elt.
Definition at line 86 of file optimize.py.
References CellMLToNektar.optimize.PartialEvaluator._process_ci_elts().
Referenced by CellMLToNektar.translators.ConfigurationStore._find_transmembrane_currents_from_voltage_ode(), CellMLToNektar.optimize.PartialEvaluator._process_ci_elts(), CellMLToNektar.translators.ConfigurationStore._process_ci_elts(), and CellMLToNektar.optimize.PartialEvaluator.is_instantiable().
|
private |
Reduce or evaluate a single expression.
Definition at line 117 of file optimize.py.
References CellMLToNektar.optimize.PartialEvaluator._debug(), CellMLToNektar.cellml_metadata.RdfProcessor._debug(), and CellMLToNektar.optimize.PartialEvaluator._describe_expr().
Referenced by CellMLToNektar.optimize.PartialEvaluator._do_reduce_eval_loop().
|
private |
Change this ci element to use a canonical name.
Definition at line 94 of file optimize.py.
References CellMLToNektar.optimize.PartialEvaluator._debug(), and CellMLToNektar.cellml_metadata.RdfProcessor._debug().
def CellMLToNektar.optimize.PartialEvaluator.is_instantiable | ( | self, | |
expr | |||
) |
Determine whether special conditions mean that this assignment can be instantiated. Normally an assignment can only be instantiated if the assigned-to variable is used only once, in order to avoid code duplication. However, if the definition under consideration for instantiation is a function only of a single LT keying variable (and we will do LT) then code duplication doesn't really matter, since the whole expression will be converted to a table anyway. So we should instantiate regardless of multiple uses in this case. Note: this does check that only a single keying variable appears, but doesn't check for the presence of expensive functions. Of course, if there aren't any expensive functions, the code duplication isn't that worrying.
Definition at line 171 of file optimize.py.
References CellMLToNektar.optimize.PartialEvaluator._process_ci_elts(), and CellMLToNektar.optimize.PartialEvaluator.lookup_tables_analyser.
def CellMLToNektar.optimize.PartialEvaluator.parteval | ( | self, | |
doc, | |||
solver_info, | |||
lookup_tables_analyser = None |
|||
) |
Do the partial evaluation.
Definition at line 245 of file optimize.py.
CellMLToNektar.optimize.PartialEvaluator.doc |
Definition at line 247 of file optimize.py.
Referenced by CellMLToNektar.optimize.LookupTableAnalyser.analyse_model(), CellMLToNektar.translators.CellMLTranslator.config(), CellMLToNektar.optimize.LookupTableAnalyser.config(), and CellMLToNektar.translators.CellMLTranslator.scan_for_lookup_tables().
CellMLToNektar.optimize.PartialEvaluator.lookup_tables_analyser |
Definition at line 249 of file optimize.py.
Referenced by CellMLToNektar.optimize.PartialEvaluator.is_instantiable().
CellMLToNektar.optimize.PartialEvaluator.solver_info |
Definition at line 248 of file optimize.py.