Nektar++
Public Member Functions | Private Member Functions | List of all members
CellMLToNektar.pycml.mathml_root Class Reference
Inheritance diagram for CellMLToNektar.pycml.mathml_root:
[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 _set_in_units (self, units, no_act=False)
 

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 <root> operator.

Definition at line 5760 of file pycml.py.

Member Function Documentation

◆ _set_in_units()

def CellMLToNektar.pycml.mathml_root._set_in_units (   self,
  units,
  no_act = False 
)
private
Set the units of the application of this operator.

Set the degree to have units of dimensionless, and the operand to
have an arbitrary member of its possible units set.

Where these mean the <apply> doesn't have the given units, wrap it
in suitable units conversion mathematics.

Definition at line 5762 of file pycml.py.

5762 def _set_in_units(self, units, no_act=False):
5763 """Set the units of the application of this operator.
5764
5765 Set the degree to have units of dimensionless, and the operand to
5766 have an arbitrary member of its possible units set.
5767
5768 Where these mean the <apply> doesn't have the given units, wrap it
5769 in suitable units conversion mathematics.
5770 """
5771 app = self.xml_parent
5772 defn_units_set = app.get_units()
5773 defn_units = defn_units_set.extract()
5774 app._add_units_conversion(app, defn_units, units, no_act)
5775 # Record which member of the set we used
5776 if not no_act:
5777 app._cml_units = defn_units
5778 # Set degree units
5779 if hasattr(app, u'degree'):
5780 dimensionless = app.model.get_units_by_name('dimensionless')
5781 self._set_element_in_units(_child1(app.degree), dimensionless, no_act)
5782 # Set operand units
5783 for src_units_set, src_units in defn_units_set._get_sources(defn_units):
5784 expr = src_units_set.get_expression()
5785 self._set_element_in_units(expr, src_units, no_act)
5786
def _child1(elt)
Definition: pycml.py:3460

References CellMLToNektar.pycml._child1(), and CellMLToNektar.pycml.mathml_units_mixin._set_element_in_units().

◆ evaluate()

def CellMLToNektar.pycml.mathml_root.evaluate (   self)
Return the operand to the given degree, if present.
Otherwise return the square root of the operand.

Definition at line 5787 of file pycml.py.

5787 def evaluate(self):
5788 """
5789 Return the operand to the given degree, if present.
5790 Otherwise return the square root of the operand.
5791 """
5792 app = self.xml_parent
5793 ops = list(app.operands())
5794 if len(ops) != 1:
5795 self.wrong_number_of_operands(len(ops), [1])
5796 if hasattr(app, u'degree'):
5797 degree = self.eval(app.degree)
5798 else:
5799 degree = 2
5800 return self.eval(ops[0]) ** (1/degree)
5801

References CellMLToNektar.pycml.mathml.eval(), and CellMLToNektar.pycml.mathml_operator.wrong_number_of_operands().

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