Definition at line 5524 of file pycml.py.
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.
5527 """Reduce this expression by evaluating its static parts.
5529 If the whole expression is static, proceed as normal for an
5530 <apply>. Otherwise check if we have more than one static
5531 operand. If we do, we can combine them in a new static
5532 expression and evaluate that as a whole.
5534 app = self.xml_parent
5535 bt = app._get_binding_time()
5536 if bt == BINDING_TIMES.static
or not self.model.get_option(
'partial_pe_commutative'):
5538 app._reduce(check_operator=
False)
5541 static_opers = filter(
lambda e: app._get_element_binding_time(e) == BINDING_TIMES.static,
5543 if len(static_opers) > 1:
5545 for oper
in static_opers:
5546 app.safe_remove_child(oper)
5548 new_expr = mathml_apply.create_new(self, self.localName, static_opers)
5550 app.xml_append(new_expr)
5553 app._reduce(check_operator=
False)