Class representing the MathML <divide> operator.
Definition at line 5600 of file pycml.py.
def CellMLToNektar.pycml.mathml_divide._reduce |
( |
|
self | ) |
|
|
private |
Reduce this expression by evaluating its static parts.
If the whole expression is static, proceed as normal for an
<apply>. If just the denominator is static, transform the
expression into a multiplication.
Definition at line 5612 of file pycml.py.
References CellMLToNektar.pycml.mathml_operator.wrong_number_of_operands().
5613 """Reduce this expression by evaluating its static parts. 5615 If the whole expression is static, proceed as normal for an 5616 <apply>. If just the denominator is static, transform the 5617 expression into a multiplication. 5619 app = self.xml_parent
5620 bt = app._get_binding_time()
5621 if bt == BINDING_TIMES.static:
5623 app._reduce(check_operator=
False)
5626 ops = list(app.operands())
5628 self.wrong_number_of_operands(len(ops), [2])
5629 bt = app._get_element_binding_time(ops[1])
5630 if bt == BINDING_TIMES.static:
5632 dummy = self.xml_create_element(
u'dummy', NSS[
u'm'])
5633 app.replace_child(ops[1], dummy)
5634 new_expr = mathml_apply.create_new(
5635 self,
u'divide', [(
u'1',
u'dimensionless'),
5637 app.replace_child(dummy, new_expr)
5638 app._reduce_elt(new_expr)
5640 times = self.xml_create_element(
u'times', NSS[
u'm'])
5641 app.replace_child(self, times)
5643 app._reduce(check_operator=
False)
5646 app._reduce(check_operator=
False)