PyFoam.LogAnalysis.FoamLogAnalyzer module

Analyze OpenFOAM logs

class PyFoam.LogAnalysis.FoamLogAnalyzer.FoamLogAnalyzer(progress=False)[source]

Bases: object

Base class for all analyzers

Administrates and calls a number of LogLineAnlayzers for each line

__dict__ = mappingproxy({'__module__': 'PyFoam.LogAnalysis.FoamLogAnalyzer', '__doc__': 'Base class for all analyzers\n\n Administrates and calls a number of LogLineAnlayzers for each\n line', '__init__': <function FoamLogAnalyzer.__init__>, 'tearDown': <function FoamLogAnalyzer.tearDown>, 'collectData': <function FoamLogAnalyzer.collectData>, 'summarizeData': <function FoamLogAnalyzer.summarizeData>, 'setTime': <function FoamLogAnalyzer.setTime>, 'resetFile': <function FoamLogAnalyzer.resetFile>, 'writeProgress': <function FoamLogAnalyzer.writeProgress>, 'addTimeListener': <function FoamLogAnalyzer.addTimeListener>, 'addResetFileTrigger': <function FoamLogAnalyzer.addResetFileTrigger>, 'listAnalyzers': <function FoamLogAnalyzer.listAnalyzers>, 'hasAnalyzer': <function FoamLogAnalyzer.hasAnalyzer>, 'getAnalyzer': <function FoamLogAnalyzer.getAnalyzer>, 'addAnalyzer': <function FoamLogAnalyzer.addAnalyzer>, 'analyzeLine': <function FoamLogAnalyzer.analyzeLine>, 'analyze': <function FoamLogAnalyzer.analyze>, 'goOn': <function FoamLogAnalyzer.goOn>, 'getTime': <function FoamLogAnalyzer.getTime>, 'isPastTime': <function FoamLogAnalyzer.isPastTime>, 'setDirectory': <function FoamLogAnalyzer.setDirectory>, 'getDirectory': <function FoamLogAnalyzer.getDirectory>, 'addTrigger': <function FoamLogAnalyzer.addTrigger>, 'checkTriggers': <function FoamLogAnalyzer.checkTriggers>, '__dict__': <attribute '__dict__' of 'FoamLogAnalyzer' objects>, '__weakref__': <attribute '__weakref__' of 'FoamLogAnalyzer' objects>})
__init__(progress=False)[source]
Parameters

progress – Print time progress on console?

__module__ = 'PyFoam.LogAnalysis.FoamLogAnalyzer'
__weakref__

list of weak references to the object (if defined)

addAnalyzer(name, obj)[source]

Adds an analyzer

obj - A LogLineAnalyzer name - the name of the analyzer

addResetFileTrigger(f)[source]
addTimeListener(listener)[source]
Parameters

listener – An object that is notified when the time changes. Has to

implement a timeChanged method

addTrigger(time, func, once=True, until=None)[source]

Adds a trigger function that is to be called as soon as the simulation time exceeds a certain value :param time: the time at which the function should be triggered :param func: the trigger function :param once: Should this function be called once or at every time-step :param until: The time until which the trigger should be called

analyze(fh)[source]

Analyzes a file (one line at a time)

fh - handle of the file

analyzeLine(line)[source]

Calls all the anlyzers for a line

checkTriggers()[source]

Check for and execute the triggered functions

collectData(structured=False)[source]

Collect dictionaries of collected data (current state) from the analyzers :return: the dictionary

getAnalyzer(name)[source]

Get the LogLineAnalyzer name

getDirectory()[source]

Gets the output directory

getTime()[source]

Gets the current time

goOn()[source]

Checks with all the analyzers

If one analyzer returns False it returns False

hasAnalyzer(name)[source]

Is this LogLineAnalyzer name there

isPastTime(check)[source]

Are we past a given Time?

listAnalyzers()[source]
Returns

A list with the names of the Analyzers

resetFile()[source]

Propagate a reset to the actual analyzers

setDirectory(d)[source]

Sets the output directory for all the analyzers

setTime(time)[source]

Sets the time and alert all the LineAnalyzers that the time has changed :param time: the new value of the time

summarizeData(col=80)[source]

Get a summary of the data

tearDown()[source]

Remove reference to self in children (hoping to remove circular dependencies)

writeProgress(msg)[source]

Write a message to the progress output