Nektar++
Public Member Functions | Private Member Functions | List of all members
CellMLToNektar.pycml.mathml_or Class Reference
Inheritance diagram for CellMLToNektar.pycml.mathml_or:
[legend]

Public Member Functions

def evaluate (self)
 
- Public Member Functions inherited from CellMLToNektar.pycml.mathml_operator
def wrong_number_of_operands (self, found, wanted)
 
- 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)
 

Private Member Functions

def _get_binding_time (self)
 

Additional Inherited Members

- Static Public Member Functions inherited from CellMLToNektar.pycml.mathml
def clone (expr)
 
- Public Attributes inherited from CellMLToNektar.pycml.element_base
 xml_attributes
 
- Properties inherited from CellMLToNektar.pycml.mathml
 component = property(get_component)
 

Detailed Description

Class representing the MathML <or> operator.

Definition at line 5841 of file pycml.py.

Member Function Documentation

◆ _get_binding_time()

def CellMLToNektar.pycml.mathml_or._get_binding_time (   self)
private
Return the binding time of the enclosing <apply> element.

Short-circuit if a static True operand occurs before any dynamic
operands, returning static.  Otherwise return the least upper bound
of operand binding times, as usual.

Definition at line 5857 of file pycml.py.

5857 def _get_binding_time(self):
5858 """Return the binding time of the enclosing <apply> element.
5859
5860 Short-circuit if a static True operand occurs before any dynamic
5861 operands, returning static. Otherwise return the least upper bound
5862 of operand binding times, as usual.
5863 """
5864 app = self.xml_parent
5865 bts = [BINDING_TIMES.static]
5866 for operand in app.operands():
5867 bt = app._get_element_binding_time(operand)
5868 if bt is BINDING_TIMES.static:
5869 value = self.eval(operand)
5870 if value and len(bts) == 1:
5871 # Short-circuit
5872 break
5873 else:
5874 bts.append(bt)
5875 # Take least upper bound
5876 return max(bts)
5877

References CellMLToNektar.pycml.mathml.eval().

Referenced by 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().

◆ evaluate()

def CellMLToNektar.pycml.mathml_or.evaluate (   self)
Return the logical disjunction of the operands.

Evaluates operands in the order given in the file, and will
short-circuit at the first which evaluates to True.

Definition at line 5843 of file pycml.py.

5843 def evaluate(self):
5844 """Return the logical disjunction of the operands.
5845
5846 Evaluates operands in the order given in the file, and will
5847 short-circuit at the first which evaluates to True.
5848 """
5849 app = self.xml_parent
5850 ops = app.operands()
5851 value = False
5852 for operand in ops:
5853 value = value or self.eval(operand)
5854 if value: break
5855 return value
5856

References CellMLToNektar.pycml.mathml.eval().

Referenced by CellMLToNektar.pycml.mathml_constructor._eval_self(), and CellMLToNektar.pycml.mathml_ci._reduce().