PyFoam.Basics.DataStructures module

Data structures in Foam-Files that can’t be directly represented by Python-Structures

class PyFoam.Basics.DataStructures.BinaryBlob(data)[source]

Bases: PyFoam.Basics.DataStructures.Unparsed

Represents a part of the file with binary data in it

__init__(data)[source]
__module__ = 'PyFoam.Basics.DataStructures'
class PyFoam.Basics.DataStructures.BinaryList(lngth, data)[source]

Bases: PyFoam.Basics.DataStructures.UnparsedList

A class that represents a list that is saved as binary data

__init__(lngth, data)[source]
__module__ = 'PyFoam.Basics.DataStructures'
class PyFoam.Basics.DataStructures.BoolProxy(val=None, textual=None)[source]

Bases: object

Wraps a boolean parsed from a file. Optionally stores a textual representation

FalseStrings = ['off', 'no', 'false', 'invalid']
TrueStrings = ['on', 'yes', 'true']
__bool__()[source]
__dict__ = mappingproxy({'__module__': 'PyFoam.Basics.DataStructures', '__weakref__': <attribute '__weakref__' of 'BoolProxy' objects>, '__doc__': 'Wraps a boolean parsed from a file. Optionally stores a textual\n representation\n ', '__dict__': <attribute '__dict__' of 'BoolProxy' objects>, '__nonzero__': <function BoolProxy.__nonzero__>, '__bool__': <function BoolProxy.__bool__>, '__repr__': <function BoolProxy.__repr__>, 'TrueStrings': ['on', 'yes', 'true'], '__str__': <function BoolProxy.__str__>, 'FalseStrings': ['off', 'no', 'false', 'invalid'], '__eq__': <function BoolProxy.__eq__>, '__init__': <function BoolProxy.__init__>, '__hash__': None})
__eq__(o)[source]
__hash__ = None
__init__(val=None, textual=None)[source]
__module__ = 'PyFoam.Basics.DataStructures'
__nonzero__()[source]
__repr__()[source]
__str__()[source]
__weakref__

list of weak references to the object (if defined)

class PyFoam.Basics.DataStructures.Codestream[source]

Bases: str

A class that encapsulates an codestream string

__dict__ = mappingproxy({'__dict__': <attribute '__dict__' of 'Codestream' objects>, '__str__': <function Codestream.__str__>, '__doc__': 'A class that encapsulates an codestream string', '__module__': 'PyFoam.Basics.DataStructures', '__weakref__': <attribute '__weakref__' of 'Codestream' objects>})
__module__ = 'PyFoam.Basics.DataStructures'
__str__()[source]
__weakref__

list of weak references to the object (if defined)

class PyFoam.Basics.DataStructures.DictProxy[source]

Bases: dict

A class that acts like a dictionary, but preserves the order of the entries. Used to beautify the output

_DictProxy__enforceString(v, toString)
__contains__(key)[source]
__deepcopy__(memo)[source]
__delitem__(key)[source]
__dict__ = mappingproxy({'__delitem__': <function DictProxy.__delitem__>, 'items': <function DictProxy.items>, '__module__': 'PyFoam.Basics.DataStructures', '_DictProxy__enforceString': <function DictProxy.__enforceString>, '__setitem__': <function DictProxy.__setitem__>, '__init__': <function DictProxy.__init__>, 'keys': <function DictProxy.keys>, '__iter__': <function DictProxy.__iter__>, 'isRegexp': <function DictProxy.isRegexp>, 'getRegexpValue': <function DictProxy.getRegexpValue>, 'iteritems': <function DictProxy.iteritems>, '__weakref__': <attribute '__weakref__' of 'DictProxy' objects>, '__doc__': 'A class that acts like a dictionary, but preserves the order\n of the entries. Used to beautify the output', '__dict__': <attribute '__dict__' of 'DictProxy' objects>, 'addRedirection': <function DictProxy.addRedirection>, 'getDecoration': <function DictProxy.getDecoration>, '__getitem__': <function DictProxy.__getitem__>, '__contains__': <function DictProxy.__contains__>, '__deepcopy__': <function DictProxy.__deepcopy__>, '__str__': <function DictProxy.__str__>, 'update': <function DictProxy.update>, 'addDecoration': <function DictProxy.addDecoration>})
__getitem__(key)[source]
__init__()[source]
__iter__()[source]
__module__ = 'PyFoam.Basics.DataStructures'
__setitem__(key, value)[source]
__str__()[source]
__weakref__

list of weak references to the object (if defined)

addDecoration(key, text)[source]
addRedirection(redir)[source]
getDecoration(key)[source]
getRegexpValue(key)[source]
isRegexp(key)[source]
items()[source]
iteritems()[source]
keys()[source]
update(other=None, toString=False, **kwargs)[source]

Emulate the regular update of dict

class PyFoam.Basics.DataStructures.DictRedirection(fullCopy, reference, name)[source]

Bases: object

This class is in charge of handling redirections to other directories

__call__()[source]
__dict__ = mappingproxy({'__module__': 'PyFoam.Basics.DataStructures', '__weakref__': <attribute '__weakref__' of 'DictRedirection' objects>, 'useAsRedirect': <function DictRedirection.useAsRedirect>, '__doc__': 'This class is in charge of handling redirections to other directories', '__dict__': <attribute '__dict__' of 'DictRedirection' objects>, 'getContent': <function DictRedirection.getContent>, '__call__': <function DictRedirection.__call__>, '__str__': <function DictRedirection.__str__>, 'keys': <function DictRedirection.keys>, '__float__': <function DictRedirection.__float__>, '__init__': <function DictRedirection.__init__>})
__float__()[source]
__init__(fullCopy, reference, name)[source]
__module__ = 'PyFoam.Basics.DataStructures'
__str__()[source]
__weakref__

list of weak references to the object (if defined)

getContent()[source]
keys()[source]
useAsRedirect()[source]
class PyFoam.Basics.DataStructures.Dimension(*dims)[source]

Bases: PyFoam.Basics.DataStructures.FoamDataType

__cmp__(other)[source]
__getitem__(key)[source]
__init__(*dims)[source]
__module__ = 'PyFoam.Basics.DataStructures'
__setitem__(key, value)[source]
__str__()[source]
class PyFoam.Basics.DataStructures.Field(val, name=None, length=None)[source]

Bases: PyFoam.Basics.DataStructures.FoamDataType

__cmp__(other)[source]
__getitem__(key)[source]
__init__(val, name=None, length=None)[source]
__len__()[source]
__module__ = 'PyFoam.Basics.DataStructures'
__setitem__(key, value)[source]
__str__()[source]
binaryString()[source]
isBinary()[source]
isUniform()[source]
setUniform(data)[source]
toNumpy(regexp, dtypes)[source]

Convert to numpy-structured array (with one entry) @param regexp: Ignored. Just for compatibility with Unparsed @param dtypes: lsit of data types

value()[source]
class PyFoam.Basics.DataStructures.FixedLength(vals)[source]

Bases: PyFoam.Basics.DataStructures.FoamDataType

__cmp__(other)[source]
__getitem__(key)[source]
__init__(vals)[source]
__len__()[source]
__module__ = 'PyFoam.Basics.DataStructures'
__setitem__(key, value)[source]
__str__()[source]
class PyFoam.Basics.DataStructures.FoamDataType[source]

Bases: object

__dict__ = mappingproxy({'__le__': <function FoamDataType.__le__>, '__dict__': <attribute '__dict__' of 'FoamDataType' objects>, '__ge__': <function FoamDataType.__ge__>, '__gt__': <function FoamDataType.__gt__>, '__weakref__': <attribute '__weakref__' of 'FoamDataType' objects>, '__module__': 'PyFoam.Basics.DataStructures', '__ne__': <function FoamDataType.__ne__>, '__repr__': <function FoamDataType.__repr__>, '__lt__': <function FoamDataType.__lt__>, '__eq__': <function FoamDataType.__eq__>, '__doc__': None, '__hash__': None})
__eq__(other)[source]

Implementation to make __cmp__ work again in Python3

Implementing this method means that these objects are not hashable. But that is OK

__ge__(other)[source]
__gt__(other)[source]
__hash__ = None
__le__(other)[source]
__lt__(other)[source]

Implementation to make __cmp__ work again in Python3

__module__ = 'PyFoam.Basics.DataStructures'
__ne__(other)[source]
__repr__()[source]
__weakref__

list of weak references to the object (if defined)

class PyFoam.Basics.DataStructures.SymmTensor(v1, v2, v3, v4, v5, v6)[source]

Bases: PyFoam.Basics.DataStructures.FixedLength

__init__(v1, v2, v3, v4, v5, v6)[source]
__module__ = 'PyFoam.Basics.DataStructures'
class PyFoam.Basics.DataStructures.Tensor(v1, v2, v3, v4, v5, v6, v7, v8, v9)[source]

Bases: PyFoam.Basics.DataStructures.FixedLength

__init__(v1, v2, v3, v4, v5, v6, v7, v8, v9)[source]
__module__ = 'PyFoam.Basics.DataStructures'
class PyFoam.Basics.DataStructures.TupleProxy(tup=())[source]

Bases: list

Enables Tuples to be manipulated

__dict__ = mappingproxy({'__dict__': <attribute '__dict__' of 'TupleProxy' objects>, '__weakref__': <attribute '__weakref__' of 'TupleProxy' objects>, '__doc__': 'Enables Tuples to be manipulated', '__module__': 'PyFoam.Basics.DataStructures', '__init__': <function TupleProxy.__init__>})
__init__(tup=())[source]
__module__ = 'PyFoam.Basics.DataStructures'
__weakref__

list of weak references to the object (if defined)

class PyFoam.Basics.DataStructures.Unparsed(data)[source]

Bases: object

A class that encapsulates an unparsed string

__dict__ = mappingproxy({'__module__': 'PyFoam.Basics.DataStructures', '__hash__': <function Unparsed.__hash__>, '__doc__': 'A class that encapsulates an unparsed string', '__dict__': <attribute '__dict__' of 'Unparsed' objects>, '__weakref__': <attribute '__weakref__' of 'Unparsed' objects>, '__lt__': <function Unparsed.__lt__>, '__str__': <function Unparsed.__str__>, '__init__': <function Unparsed.__init__>, 'toNumpy': <function Unparsed.toNumpy>})
__hash__()[source]
__init__(data)[source]
__lt__(other)[source]
__module__ = 'PyFoam.Basics.DataStructures'
__str__()[source]
__weakref__

list of weak references to the object (if defined)

toNumpy(regexp, dtypes)[source]

Assume that the unparsed data contains line-wise data and transform it to a numpy-array. @param regexp: regular expression where the groups correspond to the dtypes, @param dtypes: list with dtypes

class PyFoam.Basics.DataStructures.UnparsedList(lngth, data)[source]

Bases: object

A class that encapsulates a list that was not parsed for performance reasons

__cmp__(other)[source]
__dict__ = mappingproxy({'__len__': <function UnparsedList.__len__>, '__dict__': <attribute '__dict__' of 'UnparsedList' objects>, '__weakref__': <attribute '__weakref__' of 'UnparsedList' objects>, '__doc__': 'A class that encapsulates a list that was not parsed for\n performance reasons', '__module__': 'PyFoam.Basics.DataStructures', '__cmp__': <function UnparsedList.__cmp__>, '__hash__': None, '__lt__': <function UnparsedList.__lt__>, '__eq__': <function UnparsedList.__eq__>, '__init__': <function UnparsedList.__init__>, 'toNumpy': <function UnparsedList.toNumpy>})
__eq__(other)[source]
__hash__ = None
__init__(lngth, data)[source]
__len__()[source]
__lt__(other)[source]
__module__ = 'PyFoam.Basics.DataStructures'
__weakref__

list of weak references to the object (if defined)

toNumpy(regexp, dtypes)[source]
class PyFoam.Basics.DataStructures.Vector(x, y, z)[source]

Bases: PyFoam.Basics.DataStructures.FixedLength

__abs__()[source]
__add__(y)[source]
__div__(y)[source]
__init__(x, y, z)[source]
__module__ = 'PyFoam.Basics.DataStructures'
__mul__(y)[source]
__neg__()[source]
__pos__()[source]
__radd__(y)[source]
__rmul__(y)[source]
__rsub__(y)[source]
__sub__(y)[source]
__truediv__(y)[source]
__xor__(y)[source]
PyFoam.Basics.DataStructures.cmp(a, b)[source]
PyFoam.Basics.DataStructures.makePrimitiveString(val)[source]

Make strings of types that might get written to a directory