ufl.formatting package

Submodules

ufl.formatting.ufl2unicode module

UFL to unicode.

class ufl.formatting.ufl2unicode.Expression2UnicodeHandler(argument_names=None, coefficient_names=None, colorama_bold=False)[source]

Bases: MultiFunction

Convert expressions to unicode.

abs(o, a)[source]

Format an ans.

and_condition(o, a, b)[source]

Format an and_condition.

argument(o)[source]

Format an argument.

atan2(o, f1, f2)[source]

Format a atan2.

base_form_operator(o)[source]

Format a base_form_operator.

bessel_K(o, nu, f)[source]

Format a bessel_K.

bessel_i(o, nu, f)[source]

Format a bessel_i.

bessel_j(o, nu, f)[source]

Format a bessel_j.

bessel_y(o, nu, f)[source]

Format a bessel_y.

cell_avg(o, f)[source]

Format a cell_avg.

coefficient(o)[source]

Format a coefficient.

coefficient_derivative(o, f, w, v, cd)[source]

Format a coefficient_derivative.

cofactor(o, A)[source]

Format a cofactor.

component_tensor(o, A, ii)[source]

Format a component_tensor.

conditional(o, c, t, f)[source]

Format a conditional.

conj(o, a)[source]

Format a conj.

constant(o)[source]

Format a constant.

cross(o, a, b)[source]

Format a cross.

curl(o, f)[source]

Format a curl.

determinant(o, A)[source]

Format a determinant.

deviatoric(o, A)[source]

Format a deviatoric.

div(o, f)[source]

Format a div.

division(o, a, b)[source]

Format a division.

dot(o, a, b)[source]

Format a dot.

eq(o, a, b)[source]

Format an eq.

exp(o, f)[source]

Format a exp.

expr(o)[source]

Format an expr.

expr_list(o, *ops)[source]

Format an expr_list.

expr_mapping(o, *ops)[source]

Format an expr_mapping.

facet_avg(o, f)[source]

Format a facet_avg.

facet_normal(o)[source]

Format a facet_normal.

ge(o, a, b)[source]

Format a ge.

grad(o, f)[source]

Format a grad.

gt(o, a, b)[source]

Format a gt.

identity(o)[source]

Format a identity.

imag(o, a)[source]

Format a imag.

index_sum(o, f, i)[source]

Format a index_sum.

indexed(o, A, ii)[source]

Format an indexed.

inner(o, a, b)[source]

Format an inner.

inverse(o, A)[source]

Format an inverse.

label(o)[source]

Format a label.

le(o, a, b)[source]

Format a le.

list_tensor(o, *ops)[source]

Format a list_tensor.

lt(o, a, b)[source]

Format a lt.

math_function(o, f)[source]

Format a math_function.

max_value(o, a, b)[source]

Format an max_value.

min_value(o, a, b)[source]

Format an min_value.

multi_index(o)[source]

Format a multi_index.

nabla_div(o, f)[source]

Format a nabla_div.

nabla_grad(o, f)[source]

Format a nabla_grad.

ne(o, a, b)[source]

Format a ne.

negative_restricted(o, f)[source]

Format a negative_restriced.

not_condition(o, a)[source]

Format a not_condition.

or_condition(o, a, b)[source]

Format an or_condition.

outer(o, a, b)[source]

Format an outer.

permutation_symbol(o)[source]

Format a permutation_symbol.

positive_restricted(o, f)[source]

Format a positive_restriced.

power(o, a, b)[source]

Format a power.

product(o, a, b)[source]

Format a product.

real(o, a)[source]

Format a real.

scalar_value(o)[source]

Format a scalar_value.

skew(o, A)[source]

Format a skew.

spatial_coordinate(o)[source]

Format a spatial_coordinate.

sqrt(o, f)[source]

Format a sqrt.

sum(o, a, b)[source]

Format a sum.

sym(o, A)[source]

Format a sym.

trace(o, A)[source]

Format a trace.

transposed(o, a)[source]

Format a transposed.

variable(o, f, a)[source]

Format a variable.

variable_derivative(o, f, v)[source]

Format a variable_derivative.

zero(o)[source]

Format a zero.

class ufl.formatting.ufl2unicode.PrecedenceRules[source]

Bases: MultiFunction

An enum-like class for C operator precedence levels.

add(o)[source]

Return precedence of an add.

and_condition(o)[source]

Return precedence of an and_condition.

bessel_function(o)

Return precedence of a call.

call(o)[source]

Return precedence of a call.

cell_avg(o)

Return precedence of a restriced.

cofactor(o)

Return precedence of a mathop.

component_tensor(o)

Return the highest precendence.

conditional(o)[source]

Return precedence of a conditional.

cross(o)

Return precedence of a product.

derivative(o)

Return precedence of a mathop.

deviatoric(o)

Return precedence of a mathop.

division(o)

Return precedence of a product.

dot(o)

Return precedence of a product.

eq(o)[source]

Return precedence of an eq.

facet_avg(o)

Return precedence of a restriced.

ge(o)

Return precedence of a lt.

gt(o)

Return precedence of a lt.

highest(o)[source]

Return the highest precendence.

index_sum(o)

Return precedence of an add.

indexed(o)

Return precedence of a call.

inner(o)

Return precedence of a product.

le(o)

Return precedence of a lt.

list_tensor(o)

Return the highest precendence.

lowest(o)[source]

Return precedence of a lowest.

lt(o)[source]

Return precedence of a lt.

math_function(o)

Return precedence of a call.

mathop(o)[source]

Return precedence of a mathop.

max_value(o)

Return precedence of a call.

min_value(o)

Return precedence of a call.

ne(o)

Return precedence of an eq.

not_condition(o)[source]

Return precedence of a not_condition.

operator(o)

Return precedence of a lowest.

or_condition(o)[source]

Return precedence of an or_condition.

outer(o)

Return precedence of a product.

power(o)[source]

Return precedence of a power.

product(o)[source]

Return precedence of a product.

restricted(o)[source]

Return precedence of a restriced.

skew(o)

Return precedence of a mathop.

sym(o)

Return precedence of a mathop.

terminal(o)

Return the highest precendence.

trace(o)

Return precedence of a mathop.

class ufl.formatting.ufl2unicode.UC[source]

Bases: object

An enum-like class for unicode characters.

Gamma = 'Γ'
Omega = 'Ω'
bold_math_A = '𝐀'
bold_math_a = '𝐚'
circled_times = '⊗'
combining_overline = '̅'
combining_right_arrow_above = '⃗'
cross_product = '⨯'
division_slash = '∕'
dot = '⋅'
element_of = '∈'
epsilon = 'ε'
for_all = '∀'
gamma = 'γ'
ge = '≥'
gt = '>'
integral = '∫'
integral_contour = '∮'
integral_double = '∬'
integral_surface = '∯'
integral_triple = '∭'
integral_volume = '∰'
le = '≤'
left_angled_bracket = '⟨'
left_double_angled_bracket = '⟪'
left_white_square_bracket = '⟦'
logical_and = '∧'
logical_not = '¬'
logical_or = '∨'
lt = '<'
nabla = '∇'
nary_product = '∏'
ne = '≠'
not_element_of = '∉'
omega = 'ω'
partial = '∂'
right_angled_bracket = '⟩'
right_double_angled_bracket = '⟫'
right_white_squared_bracket = '⟧'
sqrt = '√'
subscript_digits = ['₀', '₁', '₂', '₃', '₄', '₅', '₆', '₇', '₈', '₉']
subscript_equals = '₌'
subscript_left_paren = '₍'
subscript_minus = '₋'
subscript_plus = '₊'
subscript_right_paren = '₎'
sum = '∑'
superscript_digits = ['⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹']
superscript_equals = '⁼'
superscript_left_paren = '⁽'
superscript_minus = '⁻'
superscript_plus = '⁺'
superscript_right_paren = '⁾'
thin_space = '\u2009'
transpose = 'ᵀ'
ufl.formatting.ufl2unicode.binop(expr, a, b, op, sep=' ')[source]

Format a binary operation.

ufl.formatting.ufl2unicode.bolden_letter(c)[source]

Bolden a letter.

ufl.formatting.ufl2unicode.bolden_string(s)[source]

Bolden a string.

ufl.formatting.ufl2unicode.expression2unicode(expression, argument_names=None, coefficient_names=None)[source]

Generate Unicode string for a UFL expression.

ufl.formatting.ufl2unicode.form2unicode(form, formdata)[source]

Generate Unicode string for a UFL form.

ufl.formatting.ufl2unicode.format_index(ii)[source]

Format an index.

ufl.formatting.ufl2unicode.get_integral_symbol(integral_type, domain, subdomain_id)[source]

Get the symbol for an integral.

ufl.formatting.ufl2unicode.is_int(s)[source]

Check if a value is an integer.

ufl.formatting.ufl2unicode.mathop(expr, arg, opname)[source]

Format a math operation.

ufl.formatting.ufl2unicode.measure_font(dx)[source]

Use the font for measures.

ufl.formatting.ufl2unicode.opfont(opname)[source]

Use the font for operators.

ufl.formatting.ufl2unicode.overline_string(f)[source]

Overline a string.

ufl.formatting.ufl2unicode.par(s)[source]

Wrap in parentheses.

ufl.formatting.ufl2unicode.precedence(expr)[source]

Get the precedence of an expr.

ufl.formatting.ufl2unicode.subscript_digit(digit)[source]

Make a digit subscript.

ufl.formatting.ufl2unicode.subscript_number(number)[source]

Make a number subscript.

ufl.formatting.ufl2unicode.superscript_digit(digit)[source]

Make a digit superscript.

ufl.formatting.ufl2unicode.superscript_number(number)[source]

Make a number superscript.

ufl.formatting.ufl2unicode.ufl2unicode(expression)[source]

Generate Unicode string for a UFL expression or form.

Module contents

Formatting.