ffc.uflacs.language package

Submodules

ffc.uflacs.language.cnodes module

class ffc.uflacs.language.cnodes.Add(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '+'
precedence = 5
class ffc.uflacs.language.cnodes.AddressOf(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = '&'
precedence = 3
class ffc.uflacs.language.cnodes.And(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '&&'
precedence = 11
class ffc.uflacs.language.cnodes.ArrayAccess(array, indices)[source]

Bases: ffc.uflacs.language.cnodes.CExprOperator

array
ce_format(precision=None)[source]
indices
precedence = 2
class ffc.uflacs.language.cnodes.ArrayDecl(typename, symbol, sizes=None, values=None, alignas=None, padlen=0)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

A declaration or definition of an array.

Note that just setting values=0 is sufficient to initialize the entire array to zero.

Otherwise use nested lists of lists to represent multidimensional array values to initialize to.

alignas
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = False
padlen
sizes
symbol
typename
values
class ffc.uflacs.language.cnodes.Assign(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '='
class ffc.uflacs.language.cnodes.AssignAdd(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '+='
class ffc.uflacs.language.cnodes.AssignAnd(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '&&='
class ffc.uflacs.language.cnodes.AssignBitAnd(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '&='
class ffc.uflacs.language.cnodes.AssignBitOr(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '|='
class ffc.uflacs.language.cnodes.AssignBitXor(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '^='
class ffc.uflacs.language.cnodes.AssignDiv(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '/='
class ffc.uflacs.language.cnodes.AssignLShift(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '<<='
class ffc.uflacs.language.cnodes.AssignMod(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '%='
class ffc.uflacs.language.cnodes.AssignMul(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '*='
class ffc.uflacs.language.cnodes.AssignOp(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

Base class for assignment operators.

precedence = 13
sideeffect = True
class ffc.uflacs.language.cnodes.AssignOr(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '||='
class ffc.uflacs.language.cnodes.AssignRShift(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '>>='
class ffc.uflacs.language.cnodes.AssignSub(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.AssignOp

op = '-='
class ffc.uflacs.language.cnodes.BinOp(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.CExprOperator

ce_format(precision=None)[source]
lhs
rhs
class ffc.uflacs.language.cnodes.BitAnd(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '&'
precedence = 8
class ffc.uflacs.language.cnodes.BitNot(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = '~'
precedence = 3
class ffc.uflacs.language.cnodes.BitOr(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '|'
precedence = 10
class ffc.uflacs.language.cnodes.BitXor(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '^'
precedence = 9
class ffc.uflacs.language.cnodes.Break[source]

Bases: ffc.uflacs.language.cnodes.CStatement

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.CExpr[source]

Bases: ffc.uflacs.language.cnodes.CNode

Base class for all C expressions.

All subtypes should define a ‘precedence’ class attribute.

ce_format(precision=None)[source]
class ffc.uflacs.language.cnodes.CExprLiteral[source]

Bases: ffc.uflacs.language.cnodes.CExprTerminal

A float or int literal value.

precedence = 0
class ffc.uflacs.language.cnodes.CExprOperator[source]

Bases: ffc.uflacs.language.cnodes.CExpr

Base class for all C expression operator.

sideeffect = False
class ffc.uflacs.language.cnodes.CExprTerminal[source]

Bases: ffc.uflacs.language.cnodes.CExpr

Base class for all C expression terminals.

sideeffect = False
class ffc.uflacs.language.cnodes.CNode[source]

Bases: object

Base class for all C AST nodes.

debug = False
class ffc.uflacs.language.cnodes.CStatement[source]

Bases: ffc.uflacs.language.cnodes.CNode

Base class for all C statements.

Subtypes do _not_ define a ‘precedence’ class attribute.

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = False
class ffc.uflacs.language.cnodes.Call(function, arguments=None)[source]

Bases: ffc.uflacs.language.cnodes.CExprOperator

arguments
ce_format(precision=None)[source]
function
precedence = 2
sideeffect = True
class ffc.uflacs.language.cnodes.Case(value)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = False
value
class ffc.uflacs.language.cnodes.Comment(comment)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

Line comment(s) used for annotating the generated code with human readable remarks.

comment
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.Conditional(condition, true, false)[source]

Bases: ffc.uflacs.language.cnodes.CExprOperator

ce_format(precision=None)[source]
condition
false
precedence = 13
true
class ffc.uflacs.language.cnodes.Continue[source]

Bases: ffc.uflacs.language.cnodes.CStatement

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.Default[source]

Bases: ffc.uflacs.language.cnodes.CStatement

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = False
class ffc.uflacs.language.cnodes.Dereference(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = '*'
precedence = 3
class ffc.uflacs.language.cnodes.Div(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '/'
precedence = 4
class ffc.uflacs.language.cnodes.Do(condition, body)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

body
condition
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.EQ(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '=='
precedence = 7
class ffc.uflacs.language.cnodes.Else(body)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

body
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.ElseIf(condition, body)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

body
condition
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.FlattenedArray(array, dummy=None, dims=None, strides=None, offset=None)[source]

Bases: object

Syntax carrying object only, will get translated on __getitem__ to ArrayAccess.

array
dims
offset
strides
class ffc.uflacs.language.cnodes.For(init, check, update, body, pragma=None)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

body
check
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

init
is_scoped = True
pragma
update
class ffc.uflacs.language.cnodes.ForRange(index, begin, end, body, index_type='int', vectorize=None)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

Slightly higher-level for loop assuming incrementing an index over a range.

begin
body
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

end
index
index_type
is_scoped = True
pragma
ffc.uflacs.language.cnodes.ForRanges(*ranges, **kwargs)[source]
class ffc.uflacs.language.cnodes.GE(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '>='
precedence = 6
class ffc.uflacs.language.cnodes.GT(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '>'
precedence = 6
class ffc.uflacs.language.cnodes.If(condition, body)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

body
condition
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.LE(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '<='
precedence = 6
class ffc.uflacs.language.cnodes.LT(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '<'
precedence = 6
class ffc.uflacs.language.cnodes.LiteralBool(value)[source]

Bases: ffc.uflacs.language.cnodes.CExprLiteral

A boolean literal value.

ce_format(precision=None)[source]
precedence = 0
value
class ffc.uflacs.language.cnodes.LiteralFloat(value)[source]

Bases: ffc.uflacs.language.cnodes.CExprLiteral

A floating point literal value.

ce_format(precision=None)[source]
precedence = 0
value
class ffc.uflacs.language.cnodes.LiteralInt(value)[source]

Bases: ffc.uflacs.language.cnodes.CExprLiteral

An integer literal value.

ce_format(precision=None)[source]
precedence = 0
value
class ffc.uflacs.language.cnodes.LiteralString(value)[source]

Bases: ffc.uflacs.language.cnodes.CExprLiteral

A boolean literal value.

ce_format(precision=None)[source]
precedence = 0
value
ffc.uflacs.language.cnodes.MemCopy(src, dst, size)[source]
ffc.uflacs.language.cnodes.MemZero(name, size)[source]
ffc.uflacs.language.cnodes.MemZeroRange(name, begin, end)[source]
class ffc.uflacs.language.cnodes.Mod(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '%'
precedence = 4
class ffc.uflacs.language.cnodes.Mul(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '*'
precedence = 4
class ffc.uflacs.language.cnodes.NE(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '!='
precedence = 7
class ffc.uflacs.language.cnodes.Namespace(name, body)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

body
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
name
class ffc.uflacs.language.cnodes.NaryOp(args)[source]

Bases: ffc.uflacs.language.cnodes.CExprOperator

Base class for special n-ary operators.

args
ce_format(precision=None)[source]
class ffc.uflacs.language.cnodes.Neg(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = '-'
precedence = 3
class ffc.uflacs.language.cnodes.New(typename)[source]

Bases: ffc.uflacs.language.cnodes.CExpr

ce_format(precision=None)[source]
typename
ffc.uflacs.language.cnodes.NoOp()[source]
class ffc.uflacs.language.cnodes.Not(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = '!'
precedence = 3
class ffc.uflacs.language.cnodes.Null[source]

Bases: ffc.uflacs.language.cnodes.CExprLiteral

A null pointer literal.

ce_format(precision=None)[source]
precedence = 0
class ffc.uflacs.language.cnodes.Or(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '||'
precedence = 12
class ffc.uflacs.language.cnodes.Pos(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = '+'
precedence = 3
class ffc.uflacs.language.cnodes.PostDecrement(arg)[source]

Bases: ffc.uflacs.language.cnodes.PostfixUnaryOp

op = '--'
precedence = 2
sideeffect = True
class ffc.uflacs.language.cnodes.PostIncrement(arg)[source]

Bases: ffc.uflacs.language.cnodes.PostfixUnaryOp

op = '++'
precedence = 2
sideeffect = True
class ffc.uflacs.language.cnodes.PostfixUnaryOp(arg)[source]

Bases: ffc.uflacs.language.cnodes.UnaryOp

Base class for postfix unary operators.

ce_format(precision=None)[source]
class ffc.uflacs.language.cnodes.Pragma(comment)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

Pragma comments used for compiler-specific annotations.

comment
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.PreDecrement(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = '--'
precedence = 3
sideeffect = True
class ffc.uflacs.language.cnodes.PreIncrement(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = '++'
precedence = 3
sideeffect = True
class ffc.uflacs.language.cnodes.PrefixUnaryOp(arg)[source]

Bases: ffc.uflacs.language.cnodes.UnaryOp

Base class for prefix unary operators.

ce_format(precision=None)[source]
class ffc.uflacs.language.cnodes.Product(args)[source]

Bases: ffc.uflacs.language.cnodes.NaryOp

Product of any number of operands.

op = '*'
precedence = 4
class ffc.uflacs.language.cnodes.Return(value=None)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
value
class ffc.uflacs.language.cnodes.Scope(body)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

body
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
class ffc.uflacs.language.cnodes.SizeOf(arg)[source]

Bases: ffc.uflacs.language.cnodes.PrefixUnaryOp

op = 'sizeof'
precedence = 3
ffc.uflacs.language.cnodes.Sqrt(x)[source]
class ffc.uflacs.language.cnodes.Statement(expr)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

Make an expression into a statement.

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

expr
is_scoped = False
class ffc.uflacs.language.cnodes.StatementList(statements)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

A simple sequence of statements. No new scopes are introduced.

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

statements
class ffc.uflacs.language.cnodes.Sub(lhs, rhs)[source]

Bases: ffc.uflacs.language.cnodes.BinOp

op = '-'
precedence = 5
class ffc.uflacs.language.cnodes.Sum(args)[source]

Bases: ffc.uflacs.language.cnodes.NaryOp

Sum of any number of operands.

op = '+'
precedence = 5
class ffc.uflacs.language.cnodes.Switch(arg, cases, default=None, autobreak=True, autoscope=True)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

arg
autobreak
autoscope
cases
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

default
is_scoped = True
class ffc.uflacs.language.cnodes.Symbol(name)[source]

Bases: ffc.uflacs.language.cnodes.CExprTerminal

A named symbol.

ce_format(precision=None)[source]
name
precedence = 0
class ffc.uflacs.language.cnodes.Throw(exception, message)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

exception
is_scoped = True
message
class ffc.uflacs.language.cnodes.UnaryOp(arg)[source]

Bases: ffc.uflacs.language.cnodes.CExprOperator

Base class for unary operators.

arg
class ffc.uflacs.language.cnodes.Using(name)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
name
class ffc.uflacs.language.cnodes.VariableDecl(typename, symbol, value=None)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

Declare a variable, optionally define initial value.

cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = False
symbol
typename
value
class ffc.uflacs.language.cnodes.VerbatimExpr(codestring)[source]

Bases: ffc.uflacs.language.cnodes.CExprTerminal

A verbatim copy of an expression source string.

Handled as having the lowest precedence which will introduce parentheses around it most of the time.

ce_format(precision=None)[source]
codestring
precedence = 15
class ffc.uflacs.language.cnodes.VerbatimStatement(codestring)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

Wraps a source code string to be pasted verbatim into the source code.

codestring
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = False
class ffc.uflacs.language.cnodes.While(condition, body)[source]

Bases: ffc.uflacs.language.cnodes.CStatement

body
condition
cs_format(precision=None)[source]

Return S: string | list(S) | Indented(S).

is_scoped = True
ffc.uflacs.language.cnodes.accumulate_loop(dst, src, ranges)[source]

Generate a nested loop over a list of ranges, adding src to dst in the innermost loop.

Ranges is a list on the format [(index, begin, end),…].

ffc.uflacs.language.cnodes.as_cexpr(node)[source]

Typechecks and wraps an object as a valid CExpr.

Accepts CExpr nodes, treats int and float as literals, and treats a string as a symbol.

ffc.uflacs.language.cnodes.as_cexpr_or_literal(node)[source]
ffc.uflacs.language.cnodes.as_cexpr_or_string_symbol(node)[source]
ffc.uflacs.language.cnodes.as_cexpr_or_verbatim(node)[source]
ffc.uflacs.language.cnodes.as_cstatement(node)[source]

Perform type checking on node and wrap in a suitable statement type if necessary.

ffc.uflacs.language.cnodes.as_pragma(pragma)[source]
ffc.uflacs.language.cnodes.as_symbol(symbol)[source]
ffc.uflacs.language.cnodes.assign_loop(dst, src, ranges)[source]

Generate a nested loop over a list of ranges, assigning src to dst in the innermost loop.

Ranges is a list on the format [(index, begin, end),…].

ffc.uflacs.language.cnodes.build_1d_initializer_list(values, formatter, padlen=0, precision=None)[source]

Return a list containing a single line formatted like “{ 0.0, 1.0, 2.0 }”

ffc.uflacs.language.cnodes.build_initializer_lists(values, sizes, level, formatter, padlen=0, precision=None)[source]

Return a list of lines with initializer lists for a multidimensional array.

Example output:

{ { 0.0, 0.1 },
  { 1.0, 1.1 } }
ffc.uflacs.language.cnodes.commented_code_list(code, comments)[source]

Convenience wrapper for adding comment to code list if the list is not empty.

ffc.uflacs.language.cnodes.flattened_indices(indices, shape)[source]

Given a tuple of indices and a shape tuple, return CNode expression for flattened indexing into multidimensional array.

Indices and shape entries can be int values, str symbol names, or CNode expressions.

ffc.uflacs.language.cnodes.float_product(factors)[source]

Build product of float factors, simplifying ones and zeros and returning 1.0 if empty sequence.

ffc.uflacs.language.cnodes.is_negative_one_cexpr(cexpr)[source]
ffc.uflacs.language.cnodes.is_one_cexpr(cexpr)[source]
ffc.uflacs.language.cnodes.is_simple_inner_loop(code)[source]
ffc.uflacs.language.cnodes.is_zero_cexpr(cexpr)[source]
ffc.uflacs.language.cnodes.leftover(size, padlen)[source]

Return minimum integer to add to size to make it divisible by padlen.

ffc.uflacs.language.cnodes.pad_dim(dim, padlen)[source]

Make dim divisible by padlen.

ffc.uflacs.language.cnodes.pad_innermost_dim(shape, padlen)[source]

Make the last dimension in shape divisible by padlen.

ffc.uflacs.language.cnodes.scale_loop(dst, factor, ranges)[source]

Generate a nested loop over a list of ranges, multiplying dst with factor in the innermost loop.

Ranges is a list on the format [(index, begin, end),…].

ffc.uflacs.language.format_lines module

Tools for indentation-aware code string stitching.

When formatting an AST into a string, it’s better to collect lists of snippets and then join them than adding the pieces continually, which gives O(n^2) behaviour w.r.t. AST size n.

class ffc.uflacs.language.format_lines.Indented(body)[source]

Bases: object

Class to mark a collection of snippets for indentation.

This way nested indentations can be handled by adding the prefix spaces only once to each line instead of splitting and indenting substrings repeatedly.

body
ffc.uflacs.language.format_lines.format_indented_lines(snippets, level=0)[source]

Format recursive sequences of indented lines as one string.

ffc.uflacs.language.format_lines.iter_indented_lines(snippets, level=0)[source]

Iterate over indented string lines from a snippets data structure.

The snippets object can be built recursively using the following types:

  • str: Split and yield as one line at a time indented to the appropriate level.
  • Indented: Yield the lines within this object indented by one level.
  • tuple,list: Yield lines from recursive application of this function to list items.

ffc.uflacs.language.format_value module

ffc.uflacs.language.format_value.format_float(x, precision=None)[source]

Format a float value according to given precision.

ffc.uflacs.language.format_value.format_int(x, precision=None)[source]
ffc.uflacs.language.format_value.format_value(value, precision=None)[source]

Format a literal value as s tring.

  • float: Formatted according to current precision configuration.
  • int: Formatted as regular base 10 int literal.
  • str: Wrapped in “quotes”.

ffc.uflacs.language.precedence module

class ffc.uflacs.language.precedence.PRECEDENCE[source]

Bases: object

An enum-like class for C operator precedence levels.

ADD = 5
ADDRESSOF = 3
AND = 11
ASSIGN = 13
BIT_AND = 8
BIT_NOT = 3
BIT_OR = 10
BIT_XOR = 9
CALL = 2
CONDITIONAL = 13
DEREFERENCE = 3
DIV = 4
EQ = 7
GE = 6
GT = 6
HIGHEST = 0
LE = 6
LITERAL = 0
LOWEST = 15
LT = 6
MOD = 4
MUL = 4
NE = 7
NEG = 3
NOT = 3
OR = 12
POS = 3
POST_DEC = 2
POST_INC = 2
PRE_DEC = 3
PRE_INC = 3
SIZEOF = 3
SUB = 5
SUBSCRIPT = 2
SYMBOL = 0

ffc.uflacs.language.ufl_to_cnodes module

Tools for C/C++ expression formatting.

class ffc.uflacs.language.ufl_to_cnodes.RulesForC[source]

Bases: object

abs(o, op)[source]
max_value(o, a, b)[source]
min_value(o, a, b)[source]
power(o, a, b)[source]
class ffc.uflacs.language.ufl_to_cnodes.RulesForCpp[source]

Bases: object

abs(o, op)[source]
bessel_i(o, n, v)[source]
bessel_j(o, n, v)[source]
bessel_k(o, n, v)[source]
bessel_y(o, n, v)[source]
max_value(o, a, b)[source]
min_value(o, a, b)[source]
power(o, a, b)[source]
class ffc.uflacs.language.ufl_to_cnodes.UFL2CNodesMixin(language)[source]

Bases: object

Rules collection mixin for a UFL to CNodes translator class.

acos(o, op)[source]
and_condition(o, a, b)[source]
asin(o, op)[source]
atan(o, op)[source]
atan_2(o, y, x)[source]
conditional(o, c, t, f)[source]
cos(o, op)[source]
cosh(o, op)[source]
division(o, a, b)[source]
eq(o, a, b)[source]
erf(o, op)[source]
exp(o, op)[source]
expr(o)[source]

Generic fallback with error message for missing rules.

float_value(o)[source]
ge(o, a, b)[source]
gt(o, a, b)[source]
int_value(o)[source]
le(o, a, b)[source]
ln(o, op)[source]
lt(o, a, b)[source]
math_function(o, op)[source]
ne(o, a, b)[source]
not_condition(o, a)[source]
or_condition(o, a, b)[source]
product(o, a, b)[source]
sin(o, op)[source]
sinh(o, op)[source]
sqrt(o, op)[source]
sum(o, a, b)[source]
tan(o, op)[source]
tanh(o, op)[source]
zero(o)[source]
class ffc.uflacs.language.ufl_to_cnodes.UFL2CNodesTranslatorC(language)[source]

Bases: ufl.corealg.multifunction.MultiFunction, ffc.uflacs.language.ufl_to_cnodes.UFL2CNodesMixin, ffc.uflacs.language.ufl_to_cnodes.RulesForC

UFL to CNodes translator class.

class ffc.uflacs.language.ufl_to_cnodes.UFL2CNodesTranslatorCpp(language)[source]

Bases: ufl.corealg.multifunction.MultiFunction, ffc.uflacs.language.ufl_to_cnodes.UFL2CNodesMixin, ffc.uflacs.language.ufl_to_cnodes.RulesForCpp

UFL to CNodes translator class.

Module contents