formatting Package¶
graph
Module¶
Algorithms for working with linearized computational graphs.
-
class
ufl.formatting.graph.
Graph
(expression)¶ Graph class which computes connectivity on demand.
-
E
()¶
-
Ein
()¶
-
Eout
()¶
-
V
()¶
-
Vin
()¶
-
Vout
()¶
-
-
class
ufl.formatting.graph.
StringDependencyDefiner
(argument_deps=None, coefficient_deps=None)¶ Bases:
ufl.corealg.multifunction.MultiFunction
Given an expr, returns a frozenset of its dependencies.
- Possible dependency values are:
- “c” - depends on runtime information like the cell, local<->global coordinate mappings, facet normals, or coefficients “x” - depends on local coordinates “v%d” % i - depends on argument i, for i in [0,rank)
-
argument
(x)¶
-
coefficient
(x)¶
-
expr
(o)¶
-
facet_normal
(o)¶
-
geometric_quantity
(x)¶
-
spatial_derivative
(o)¶
-
ufl.formatting.graph.
build_graph
(expr)¶ Build a linearized graph from an UFL Expr.
Returns G = (V, E), with V being a list of graph nodes (Expr objects) in post traversal ordering and E being a list of edges. Each edge is represented as a (i, j) tuple where i and j are vertex indices into V.
-
ufl.formatting.graph.
depth_first_ordering
(G)¶
-
ufl.formatting.graph.
extract_incoming_edges
(G)¶ Build lists of incoming edges to each vertex in a linearized graph.
-
ufl.formatting.graph.
extract_incoming_vertex_connections
(G)¶ Build lists of vertices in incoming and outgoing edges to and from each vertex in a linearized graph.
Returns lists Vin and Vout.
-
ufl.formatting.graph.
extract_outgoing_edges
(G)¶ Build list of outgoing edges from each vertex in a linearized graph.
-
ufl.formatting.graph.
extract_outgoing_vertex_connections
(G)¶ Build lists of vertices in incoming and outgoing edges to and from each vertex in a linearized graph.
Returns lists Vin and Vout.
-
ufl.formatting.graph.
len_items
(sequence)¶
-
ufl.formatting.graph.
lists
(n)¶
-
ufl.formatting.graph.
partition
(G, criteria=<function string_set_criteria>)¶
-
ufl.formatting.graph.
string_set_criteria
(v, keys)¶
latextools
Module¶
This module defines basic utilities for stitching together LaTeX documents.
-
ufl.formatting.latextools.
align
(lines)¶
-
ufl.formatting.latextools.
document
(title, sections)¶
-
ufl.formatting.latextools.
itemize
(items)¶
-
ufl.formatting.latextools.
section
(s)¶
-
ufl.formatting.latextools.
subsection
(s)¶
-
ufl.formatting.latextools.
subsubsection
(s)¶
-
ufl.formatting.latextools.
testdocument
()¶
-
ufl.formatting.latextools.
verbatim
(string)¶
printing
Module¶
A collection of utility algorithms for printing of UFL objects, mostly intended for debugging purposes.
-
ufl.formatting.printing.
form_info
(form)¶
-
ufl.formatting.printing.
integral_info
(integral)¶
-
ufl.formatting.printing.
tree_format
(expression, indentation=0, parentheses=True)¶
ufl2dot
Module¶
A collection of utility algorithms for printing of UFL objects in the DOT graph visualization language, mostly intended for debugging purposers.
-
class
ufl.formatting.ufl2dot.
CompactLabeller
(function_mapping=None)¶ Bases:
ufl.formatting.ufl2dot.ReprLabeller
-
cell_avg
(e)¶
-
component_tensor
(e)¶
-
curl
(e)¶
-
determinant
(e)¶
-
dev
(e)¶
-
diff
(e)¶
-
div
(e)¶
-
division
(e)¶
-
dot
(e)¶
-
facet_avg
(e)¶
-
form_argument
(e)¶
-
geometric_quantity
(e)¶
-
grad
(e)¶
-
identity
(e)¶
-
index_sum
(e)¶
-
indexed
(e)¶
-
inner
(e)¶
-
math_function
(e)¶
-
multi_index
(e)¶
-
nabla_div
(e)¶
-
nabla_grad
(e)¶
-
negative_restricted
(e)¶
-
outer
(e)¶
-
positive_restricted
(e)¶
-
power
(e)¶
-
product
(e)¶
-
scalar_value
(e)¶
-
skew
(e)¶
-
sum
(e)¶
-
trace
(e)¶
-
transposed
(e)¶
-
zero
(e)¶
-
-
class
ufl.formatting.ufl2dot.
FancyLabeller
(function_mapping=None)¶
-
class
ufl.formatting.ufl2dot.
ReprLabeller
¶ Bases:
ufl.corealg.multifunction.MultiFunction
-
operator
(e)¶
-
terminal
(e)¶
-
-
ufl.formatting.ufl2dot.
build_entities
(e, nodes, edges, nodeoffset, prefix='', labeller=None)¶
-
ufl.formatting.ufl2dot.
format_entities
(nodes, edges)¶
-
ufl.formatting.ufl2dot.
ufl2dot
(expression, formname='a', nodeoffset=0, begin=True, end=True, labeling='repr', object_names=None)¶
ufl2latex
Module¶
This module defines expression transformation utilities, either converting UFL expressions to new UFL expressions or converting UFL expressions to other representations.
-
class
ufl.formatting.ufl2latex.
Expression2LatexHandler
(argument_names=None, coefficient_names=None)¶ Bases:
ufl.algorithms.transformer.Transformer
-
abs
(o, a)¶
-
acos
(o, f)¶
-
and_condition
(o, a, b)¶
-
argument
(o)¶
-
asin
(o, f)¶
-
atan
(o, f)¶
-
atan2
(o, f1, f2)¶
-
bessel_K
(o, nu, f)¶
-
bessel_i
(o, nu, f)¶
-
bessel_j
(o, nu, f)¶
-
bessel_y
(o, nu, f)¶
-
cell_avg
(o, f)¶
-
coefficient
(o)¶
-
coefficient_derivative
(o, f, w, v)¶
-
cofactor
(o, A)¶
-
component_tensor
(o, *ops)¶
-
conditional
(o, c, t, f)¶
-
constant
(o)¶
-
cos
(o, f)¶
-
cosh
(o, f)¶
-
cross
(o, a, b)¶
-
curl
(o, f)¶
-
determinant
(o, A)¶
-
deviatoric
(o, A)¶
-
div
(o, f)¶
-
division
(o, a, b)¶
-
dot
(o, a, b)¶
-
eq
(o, a, b)¶
-
erf
(o, f)¶
-
exp
(o, f)¶
-
expr
(o)¶
-
facet_normal
(o)¶
-
ge
(o, a, b)¶
-
grad
(o, f)¶
-
gt
(o, a, b)¶
-
identity
(o)¶
-
index_sum
(o, f, i)¶
-
indexed
(o, a, b)¶
-
inner
(o, a, b)¶
-
inverse
(o, A)¶
-
le
(o, a, b)¶
-
list_tensor
(o)¶
-
ln
(o, f)¶
-
lt
(o, a, b)¶
-
max_value
(o, a, b)¶
-
min_value
(o, a, b)¶
-
multi_index
(o)¶
-
nabla_div
(o, f)¶
-
nabla_grad
(o, f)¶
-
ne
(o, a, b)¶
-
negative_restricted
(o, f)¶
-
not_condition
(o, a)¶
-
or_condition
(o, a, b)¶
-
outer
(o, a, b)¶
-
permutation_symbol
(o)¶
-
positive_restricted
(o, f)¶
-
power
(o, a, b)¶
-
product
(o, *ops)¶
-
scalar_value
(o)¶
-
sin
(o, f)¶
-
sinh
(o, f)¶
-
skew
(o, A)¶
-
sqrt
(o, f)¶
-
sum
(o, *ops)¶
-
sym
(o, A)¶
-
tan
(o, f)¶
-
tanh
(o, f)¶
-
trace
(o, A)¶
-
transposed
(o, a)¶
-
variable
(o)¶
-
variable_derivative
(o, f, v)¶
-
zero
(o)¶
-
-
ufl.formatting.ufl2latex.
bfname
(i, p)¶
-
ufl.formatting.ufl2latex.
build_precedence_map
()¶
-
ufl.formatting.ufl2latex.
cfname
(i)¶
-
ufl.formatting.ufl2latex.
code2latex
(G, partitions, formdata)¶ TODO: Document me
-
ufl.formatting.ufl2latex.
dependency_sorting
(deplist, rank)¶
-
ufl.formatting.ufl2latex.
deps2latex
(deps)¶
-
ufl.formatting.ufl2latex.
element2latex
(element)¶
-
ufl.formatting.ufl2latex.
expression2latex
(expression, argument_names=None, coefficient_names=None)¶
-
ufl.formatting.ufl2latex.
form2code2latex
(formdata)¶
-
ufl.formatting.ufl2latex.
form2latex
(form, formdata)¶
-
ufl.formatting.ufl2latex.
format_index
(ii)¶
-
ufl.formatting.ufl2latex.
format_multi_index
(ii, formatstring='%s')¶
-
ufl.formatting.ufl2latex.
formdata2latex
(formdata)¶
-
ufl.formatting.ufl2latex.
forms2latexdocument
(forms, uflfilename, compile=False)¶ Render forms from a .ufl file as a LaTeX document.
-
ufl.formatting.ufl2latex.
integrand2code
(integrand, formdata)¶
-
ufl.formatting.ufl2latex.
par
(s, condition=True)¶
-
ufl.formatting.ufl2latex.
tex2pdf
(latexfilename, pdffilename)¶ Compile a .pdf file from a .tex file.
-
ufl.formatting.ufl2latex.
ufl2latex
(expression)¶ Generate LaTeX code for a UFL expression or form (wrapper for form2latex and expression2latex).
-
ufl.formatting.ufl2latex.
ufl2pdf
(uflfilename, latexfilename, pdffilename, compile=False)¶ Compile a .pdf file from a .ufl file.
-
ufl.formatting.ufl2latex.
ufl2tex
(uflfilename, latexfilename, compile=False)¶ Compile a .tex file from a .ufl file.