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

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

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']
class PyFoam.Basics.DataStructures.Codestream[source]

Bases: str

A class that encapsulates an codestream string

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

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

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

Bases: PyFoam.Basics.DataStructures.FoamDataType

class PyFoam.Basics.DataStructures.Field(val, name=None, length=None)[source]

Bases: PyFoam.Basics.DataStructures.FoamDataType

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

class PyFoam.Basics.DataStructures.FoamDataType[source]

Bases: object

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

Bases: PyFoam.Basics.DataStructures.FixedLength

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

Bases: PyFoam.Basics.DataStructures.FixedLength

class PyFoam.Basics.DataStructures.TupleProxy(tup=())[source]

Bases: list

Enables Tuples to be manipulated

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

Bases: object

A class that encapsulates an unparsed string

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

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

Bases: PyFoam.Basics.DataStructures.FixedLength

PyFoam.Basics.DataStructures.cmp(a, b)[source]
PyFoam.Basics.DataStructures.makePrimitiveString(val)[source]

Make strings of types that might get written to a directory