ufl.utils package¶
Submodules¶
ufl.utils.counted module¶
Mixin class for types with a global unique counter attached to each object.
ufl.utils.formatting module¶
Various string formatting utilities.
- ufl.utils.formatting.camel2underscore(name)[source]¶
Convert a CamelCaps string to underscore_syntax.
ufl.utils.indexflattening module¶
Collection of utilities for mapping between multiindices and a flattened index space.
- ufl.utils.indexflattening.flatten_multiindex(ii, strides)[source]¶
Return the flat index corresponding to the given multiindex.
ufl.utils.sequences module¶
Various sequence manipulation utilities.
ufl.utils.sorting module¶
Utilites for sorting.
- ufl.utils.sorting.canonicalize_metadata(metadata)[source]¶
Assuming metadata to be a dict with string keys and builtin python types as values.
Transform dict to a tuple of (key, value) item tuples ordered by key, with dict, list and tuple values converted the same way recursively. Lists and tuples are converted to tuples. Other values are converted using str(). This is such that the end result can be hashed and sorted using regular <, because python 3 doesn’t allow e.g. (3 < “auto”) which occurs regularly in metadata.
- ufl.utils.sorting.sorted_by_key(mapping)[source]¶
Sort dict items by key, allowing different key types.
- ufl.utils.sorting.topological_sorting(nodes, edges)[source]¶
Return a topologically sorted list of the nodes.
Implemented algorithm from Wikipedia (http://en.wikipedia.org/wiki/Topological_sorting).
No error for cyclic edges…
ufl.utils.stacks module¶
Various utility data structures.
Module contents¶
Utilities.