PyFoam.LogAnalysis.LogLineAnalyzer module

Base class for analyzing lines

class PyFoam.LogAnalysis.LogLineAnalyzer.LogLineAnalyzer[source]

Bases: object

Base class for the analysis of all lines from a OpenFOAM-log

Lines are available one at a time

__dict__ = mappingproxy({'__module__': 'PyFoam.LogAnalysis.LogLineAnalyzer', '__doc__': 'Base class for the analysis of all lines from a OpenFOAM-log\n\n Lines are available one at a time', 'allRegexp': [], 'floatRegExp': '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?', 'registerRegexp': <classmethod object>, '__init__': <function LogLineAnalyzer.__init__>, 'doAnalysis': <function LogLineAnalyzer.doAnalysis>, 'timeChanged': <function LogLineAnalyzer.timeChanged>, 'setParent': <function LogLineAnalyzer.setParent>, 'writeProgress': <function LogLineAnalyzer.writeProgress>, 'setDirectory': <function LogLineAnalyzer.setDirectory>, 'goOn': <function LogLineAnalyzer.goOn>, 'getTime': <function LogLineAnalyzer.getTime>, 'addListener': <function LogLineAnalyzer.addListener>, 'notify': <function LogLineAnalyzer.notify>, 'tearDown': <function LogLineAnalyzer.tearDown>, 'getCurrentData': <function LogLineAnalyzer.getCurrentData>, 'resetFile': <function LogLineAnalyzer.resetFile>, '__dict__': <attribute '__dict__' of 'LogLineAnalyzer' objects>, '__weakref__': <attribute '__weakref__' of 'LogLineAnalyzer' objects>})
__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'PyFoam.LogAnalysis.LogLineAnalyzer'
__weakref__

list of weak references to the object (if defined)

addListener(func)[source]
Parameters

func – a new listener-function that gets notified every time

the line-analyzer encounters something interesting

allRegexp = []
doAnalysis(line)[source]

Analyze a line

line - the line to be analyzed

This method carries the main functionality in the sub-classes

floatRegExp = '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?'
getCurrentData(structured=False)[source]

Give back the current analyzed data in a dictionary

To be overwritten by subclasses

getTime()[source]
Returns

current time

goOn()[source]

If the analyzer thinks the simulation should be stopped (for instance because of convergence) it returns false

notify(*data)[source]

Notifys the event listeners of an event :param data: The data of the event. Everything is possible

classmethod registerRegexp(exp)[source]
resetFile()[source]

Restart the analysis because we’re using a new input file

setDirectory(oDir)[source]

Set the directory to which output is to be written (if any output is written)

setParent(parent)[source]

Introduces the LineAnalyzer to its supervisor

Parameters

parent – The Analyzer class of which this is a part

tearDown()[source]

Hook to let every analyzer give its stuff back when the analysis has ended

timeChanged()[source]

The value of the time has changed in the Log-file

For subclasses that need to know the current time

writeProgress(msg)[source]

Let the parent write an additional progress message