Definition at line 5524 of file pycml.py.
◆ _reduce()
def CellMLToNektar.pycml.reduce_commutative_nary._reduce |
( |
|
self | ) |
|
|
private |
Reduce this expression by evaluating its static parts.
If the whole expression is static, proceed as normal for an
<apply>. Otherwise check if we have more than one static
operand. If we do, we can combine them in a new static
expression and evaluate that as a whole.
Definition at line 5525 of file pycml.py.
5526 """Reduce this expression by evaluating its static parts.
5528 If the whole expression is static, proceed as normal for an
5529 <apply>. Otherwise check if we have more than one static
5530 operand. If we do, we can combine them in a new static
5531 expression and evaluate that as a whole.
5533 app = self.xml_parent
5534 bt = app._get_binding_time()
5535 if bt == BINDING_TIMES.static
or not self.model.get_option(
'partial_pe_commutative'):
5537 app._reduce(check_operator=
False)
5540 static_opers = filter(
lambda e: app._get_element_binding_time(e) == BINDING_TIMES.static,
5542 if len(static_opers) > 1:
5544 for oper
in static_opers:
5545 app.safe_remove_child(oper)
5547 new_expr = mathml_apply.create_new(self, self.localName, static_opers)
5549 app.xml_append(new_expr)
5552 app._reduce(check_operator=
False)
References CellMLToNektar.processors.ModelModifier.model, CellMLToNektar.pycml.cellml_variable.model(), CellMLToNektar.pycml.mathml.model(), and CellMLToNektar.translators.CellMLTranslator.model.