Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
CellMLToNektar.optimize.ExpressionMatcher.R Class Reference
Inheritance diagram for CellMLToNektar.optimize.ExpressionMatcher.R:
Inheritance graph
[legend]
Collaboration diagram for CellMLToNektar.optimize.ExpressionMatcher.R:
Collaboration graph
[legend]

Public Member Functions

def __init__
 
def match
 
- Public Member Functions inherited from CellMLToNektar.optimize.ExpressionMatcher.Pattern
def match
 

Public Attributes

 sub_pattern
 

Detailed Description

A container that matches any number of levels of indirection/recursion.

This can be used to wrap a pattern where we wish to allow for variable mappings
or equations such as "var1 = var2" before we reach the 'interesting' equation.
If the expression we're matching is a ci element we recursively find the
ultimate non-ci defining expression and match our sub-pattern against that.  If
the expression isn't a ci, or the ultimate definition isn't an expression, we
match our sub-pattern against it directly.

Definition at line 1401 of file optimize.py.

Constructor & Destructor Documentation

def CellMLToNektar.optimize.ExpressionMatcher.R.__init__ (   self,
  pat 
)

Member Function Documentation

def CellMLToNektar.optimize.ExpressionMatcher.R.match (   self,
  expr 
)

Definition at line 1414 of file optimize.py.

1415  def match(self, expr):
1416  while isinstance(expr, mathml_ci):
1417  # Find this variable's defining expression, if it is an equation
1418  var = expr.variable.get_source_variable(recurse=True)
1419  defn = var.get_dependencies()
1420  if defn and isinstance(defn[0], mathml_apply):
1421  expr = defn[0].eq.rhs
1422  return self.sub_pattern.match(expr)
1423 
@staticmethod

Member Data Documentation

CellMLToNektar.optimize.ExpressionMatcher.R.sub_pattern

Definition at line 1412 of file optimize.py.