PyFoam.RunDictionary.FileBasis module¶
Basis for the handling of OpenFOAM-files
Transparently accepts gnuzipped files
-
class
PyFoam.RunDictionary.FileBasis.
CleanCharactersFile
(name, charsToRemove)[source]¶ Bases:
PyFoam.RunDictionary.FileBasis.FileBasis
Read file and remove characters from the content
-
class
PyFoam.RunDictionary.FileBasis.
FileBasis
(name, createZipped=True, useBinary=False)[source]¶ Bases:
PyFoam.Basics.Utilities.Utilities
Base class for the other OpenFOAM–file-classes
-
addedString
= '//PyFoamAdded'¶ Comment for lines that were added by PyFoam-routines
-
copyRest
(l, out)[source]¶ Copy the rest of the file
Parameters: - l – a LineReader object
- out – filehandle to echo the lines to
-
getCaseDir
()[source]¶ Return the path to the case of this file (if any valid case is found). Else return None
-
goMatch
(l, exp, out=None, stop=None)[source]¶ Read lines until a regular expression is matched
Parameters: - l – a LineReader object
- exp – the expression to look for
- out – filehandle to echo the lines to
- stop – pattern that indicates that exp will never be found
Returns: match-object if exp is found, the line if stop is found and None if the end of the file is reached
-
goTo
(l, s, out=None, echoLast=False, stop=None)[source]¶ Read lines until a token is found
Parameters: - l – a LineReader object
- s – the string to look for
- out – filehandle to echo the lines to
- stop – pattern that indicates that exp will never be found (only passed through to goMatch)
- echoLast – echo the line with the string
-
purgeFile
()[source]¶ Undo all the manipulations done by PyFOAM
Goes through the file and removes all lines that were added
-
removedString
= '//PyFoamRemoved: '¶ Comment for lines that were overwritten by PyFoam-routines
-
-
class
PyFoam.RunDictionary.FileBasis.
FileBasisBackup
(name, backup=False, createZipped=True, useBinary=False)[source]¶ Bases:
PyFoam.RunDictionary.FileBasis.FileBasis
A file with a backup-copy
-
counter
= {}¶
-