PyFoam.Basics.FoamFileGenerator module

Transform a Python data-structure into a OpenFOAM-File-Representation

class PyFoam.Basics.FoamFileGenerator.FoamFileGenerator(data, header=None, longListThreshold=20, useFixedType=True)[source]

Bases: object

Class that generates a OpenFOAM-compatible representation of a data-structure

_FoamFileGenerator__quoteString(val)

Quote the string if it contains illegal characters

__dict__ = mappingproxy({'__weakref__': <attribute '__weakref__' of 'FoamFileGenerator' objects>, '__init__': <function FoamFileGenerator.__init__>, '__doc__': 'Class that generates a OpenFOAM-compatible representation of a\n data-structure', 'strList': <function FoamFileGenerator.strList>, '_FoamFileGenerator__quoteString': <function FoamFileGenerator.__quoteString>, '__str__': <function FoamFileGenerator.__str__>, 'strDict': <function FoamFileGenerator.strDict>, '__dict__': <attribute '__dict__' of 'FoamFileGenerator' objects>, 'makeString': <function FoamFileGenerator.makeString>, '__module__': 'PyFoam.Basics.FoamFileGenerator', 'strTuple': <function FoamFileGenerator.strTuple>, 'primitiveTypes': [<class 'PyFoam.Basics.DataStructures.SymmTensor'>, <class 'PyFoam.Basics.DataStructures.Tensor'>, <class 'PyFoam.Basics.DataStructures.Vector'>, <class 'PyFoam.Basics.DataStructures.Dimension'>, <class 'PyFoam.Basics.DataStructures.Field'>, <class 'PyFoam.Basics.DataStructures.Unparsed'>], 'strPrimitive': <function FoamFileGenerator.strPrimitive>})
__init__(data, header=None, longListThreshold=20, useFixedType=True)[source]
Parameters:data – data structure that will be turned into a

Foam-compatible file :param header: header information that is to be prepended :param longListThreshold: Threshold for lists before they are considered long. This means that they are prefixed with the number of elements. If the threshold is 0 or None then no list is considered long

__module__ = 'PyFoam.Basics.FoamFileGenerator'
__str__()[source]
__weakref__

list of weak references to the object (if defined)

makeString(firstLevel=False)[source]

turns the data into a string

primitiveTypes = [<class 'PyFoam.Basics.DataStructures.SymmTensor'>, <class 'PyFoam.Basics.DataStructures.Tensor'>, <class 'PyFoam.Basics.DataStructures.Vector'>, <class 'PyFoam.Basics.DataStructures.Dimension'>, <class 'PyFoam.Basics.DataStructures.Field'>, <class 'PyFoam.Basics.DataStructures.Unparsed'>]
strDict(dic, indent=0, firstLevel=False)[source]
strList(lst, indent=0)[source]
strPrimitive(pri)[source]
strTuple(lst, indent=0)[source]
exception PyFoam.Basics.FoamFileGenerator.FoamFileGeneratorError(descr)[source]

Bases: PyFoam.Error.PyFoamException

__init__(descr)[source]
__module__ = 'PyFoam.Basics.FoamFileGenerator'
PyFoam.Basics.FoamFileGenerator.makeString(data)[source]