loki.expression.operations module

Sub-classes of Pymbolic’s native operations that allow us to inject Fortran-specific features, such as case-insensitive string comparison and bracket-aware and sub-expression grouping. Here we also add additional technical operations, such as cast and references.

class Sum(children)

Bases: StrCompareMixin, Sum

Representation of a sum.

class Product(children)

Bases: StrCompareMixin, Product

Representation of a product.

class Quotient(numerator, denominator=1)

Bases: StrCompareMixin, Quotient

Representation of a quotient.

class Power(base, exponent)

Bases: StrCompareMixin, Power

Representation of a power.

class Comparison(left, operator, right)

Bases: StrCompareMixin, Comparison

Representation of a comparison operation.

class LogicalAnd(children)

Bases: StrCompareMixin, LogicalAnd

Representation of an ‘and’ in a logical expression.

class LogicalOr(children)

Bases: StrCompareMixin, LogicalOr

Representation of an ‘or’ in a logical expression.

class LogicalNot(child)

Bases: StrCompareMixin, LogicalNot

Representation of a negation in a logical expression.

class StringConcat(children)

Bases: _MultiChildExpression

Implements string concatenation in a way similar to Sum.

mapper_method = 'map_string_concat'
class Cast(name, expression, kind=None, **kwargs)

Bases: StrCompareMixin, Call

Internal representation of a data type cast.

init_arg_names = ('name', 'expression', 'kind')
mapper_method = 'map_cast'
property name
property expression
class Reference(expression)

Bases: StrCompareMixin, Expression

Internal representation of a Reference.

Warning

Experimental! Allowing compound Reference(Variable(...)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

C/C++ only, no corresponding concept in Fortran. Referencing refers to taking the address of an existing variable (to set a pointer variable).

init_arg_names = ('expression',)
property name

Allowing the compound Reference(Variable(name)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

property type

Allowing the compound Reference(Variable(type)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

property scope

Allowing the compound Reference(Variable(scope)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

property initial

Allowing the compound Reference(Variable(initial)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

mapper_method = 'map_c_reference'
class Dereference(expression)

Bases: StrCompareMixin, Expression

Internal representation of a Dereference.

Warning

Experimental! Allowing compound Dereference(Variable(...)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

C/C++ only, no corresponding concept in Fortran. Dereferencing (a pointer) refers to retrieving the value from a memory address (that is pointed by the pointer).

init_arg_names = ('expression',)
property name

Allowing the compound Dereference(Variable(name)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

property type

Allowing the compound Dereference(Variable(type)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

property scope

Allowing the compound Dereference(Variable(scope)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

property initial

Allowing the compound Dereference(Variable(initial)) to appear with behaviour akin to a symbol itself for easier processing in mappers.

mapper_method = 'map_c_dereference'