PyFoam.Applications.Comparator module

Application class that implements pyFoamComparator

class PyFoam.Applications.Comparator.BoundaryCommand(c)[source]

Bases: PyFoam.Applications.Comparator.FieldSetterCommand

Sets a boundary condition

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.ChangeEnvironmentCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Changes Environment variables by executing a script-file

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.Command(c)[source]

Bases: object

__dict__ = mappingproxy({'__module__': 'PyFoam.Applications.Comparator', 'parallel': None, '__init__': <function Command.__init__>, 'doIt': <function Command.doIt>, 'execute': <function Command.execute>, '__dict__': <attribute '__dict__' of 'Command' objects>, '__weakref__': <attribute '__weakref__' of 'Command' objects>, '__doc__': None})
__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
__weakref__

list of weak references to the object (if defined)

doIt(para)[source]
execute(vals, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

parallel = None

Abstract base class of all commands

class PyFoam.Applications.Comparator.CommandChain(c)[source]

Bases: object

Abstract base class for a number of commands

__dict__ = mappingproxy({'__module__': 'PyFoam.Applications.Comparator', '__doc__': 'Abstract base class for a number of commands', '__init__': <function CommandChain.__init__>, 'execute': <function CommandChain.execute>, 'hasObjectOfType': <function CommandChain.hasObjectOfType>, '__dict__': <attribute '__dict__' of 'CommandChain' objects>, '__weakref__': <attribute '__weakref__' of 'CommandChain' objects>})
__init__(c)[source]
Parameters

c – XML-Subtree that represents the chain

__module__ = 'PyFoam.Applications.Comparator'
__weakref__

list of weak references to the object (if defined)

execute(para, log)[source]

Executes the chain :param para:A dictionary with the parameters :param log: Logfile to write to

hasObjectOfType(typ)[source]

Checks whether there is an object of a specific type

class PyFoam.Applications.Comparator.Comparator(args=None, **kwargs)[source]

Bases: PyFoam.Applications.PyFoamApplication.PyFoamApplication

__init__(args=None, **kwargs)[source]
Parameters
  • description – description of the command

  • epilog – text to be printed after the options-help

  • examples – usage examples to be printed after the epilog

  • usage – Usage

  • interspersed – Is the command line allowed to be interspersed (options after the arguments)

  • args – Command line arguments when using the Application as a ‘class’ from a script

  • nr – Number of required arguments

  • changeVersion – May this application change the version of OF used?

  • exactNr – Must not have more than the required number of arguments

  • subcommands – parse and use subcommands from the command line. Either True or a list with subcommands

  • inputApp – Application with input data. Used to allow a ‘pipe-like’ behaviour if the class is used from a Script

  • localConfigurationFile – Use this file (or list of files) as a local configuration

  • findLocalConfigurationFile – Method to find a configuration file BEFORE the actual parameters are parsed

  • allowCurses – This application can wrap the output in a curses-window

__module__ = 'PyFoam.Applications.Comparator'
addOptions()[source]

Add options to the parser

run()[source]

Run the real application

class PyFoam.Applications.Comparator.ComparatorData(doc)[source]

Bases: object

The object that holds the actual data

_ComparatorData__parseBase(e)
Parameters

e – The ‘base’-element

__dict__ = mappingproxy({'__module__': 'PyFoam.Applications.Comparator', '__doc__': ' The object that holds the actual data', '__init__': <function ComparatorData.__init__>, '_ComparatorData__parseBase': <function ComparatorData.__parseBase>, '__len__': <function ComparatorData.__len__>, '__getitem__': <function ComparatorData.__getitem__>, '__dict__': <attribute '__dict__' of 'ComparatorData' objects>, '__weakref__': <attribute '__weakref__' of 'ComparatorData' objects>})
__getitem__(nr)[source]
Parameters

nr – Number of the variation

Returns

dictionary with the variation

__init__(doc)[source]
Parameters

doc – the parsed XML-data from which the object is constructed

__len__()[source]
Returns

The total number of variations

__module__ = 'PyFoam.Applications.Comparator'
__weakref__

list of weak references to the object (if defined)

class PyFoam.Applications.Comparator.CopyLogCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Copies the log file to the results

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.DecomposeCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Decomposes a case and generates the LAM

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.DerivedCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Derives an additional value

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.DictWriteCommand(c)[source]

Bases: PyFoam.Applications.Comparator.SetterCommand

Writes a value to a dictionary

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.DictionaryCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Returns values from the chains dictionaries

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.EvaluationChain(c)[source]

Bases: PyFoam.Applications.Comparator.CommandChain

Chain of evaluation commands

__init__(c)[source]
Parameters

c – XML-Subtree that represents the chain

__module__ = 'PyFoam.Applications.Comparator'
class PyFoam.Applications.Comparator.FieldSetterCommand(c)[source]

Bases: PyFoam.Applications.Comparator.SetterCommand

Common class for commands that set values on fields

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
class PyFoam.Applications.Comparator.FoamCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Executes a OpenFOAM-utility

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.FoamUtilityCommand(c)[source]

Bases: PyFoam.Applications.Comparator.FoamCommand

Executes a OpenFOAM-utility and extracts information

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.FoamVersionCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Changes the used OpenFOAM-version

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.GenericCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Executes a shell command

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.InitialCommand(c)[source]

Bases: PyFoam.Applications.Comparator.FieldSetterCommand

Sets an initial condition

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.LastResultCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Copies the result of the last time-step to the resultsd directory

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.PreparationChain(c)[source]

Bases: PyFoam.Applications.Comparator.CommandChain

Chain of Preparation commands

__init__(c)[source]
Parameters

c – XML-Subtree that represents the chain

__module__ = 'PyFoam.Applications.Comparator'
class PyFoam.Applications.Comparator.ReconstructCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Reconstructs a case and deleted the LAM

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.SetDictionaryCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Sets value in the chains dictionaries

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.SetEnvironmentCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Sets an environment variable

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.SetterCommand(c)[source]

Bases: PyFoam.Applications.Comparator.Command

Common class for commands that operate on dictionaries

__init__(c)[source]

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

__module__ = 'PyFoam.Applications.Comparator'
execute(para, log)[source]
Parameters

vals – Dictionary with the keywords

Returns

A boolean whether it completed successfully and a list with results (None if no results are generated)

class PyFoam.Applications.Comparator.Variation(e)[source]

Bases: object

Represents one variation

__dict__ = mappingproxy({'__module__': 'PyFoam.Applications.Comparator', '__doc__': 'Represents one variation', '__init__': <function Variation.__init__>, '__str__': <function Variation.__str__>, '__len__': <function Variation.__len__>, '__getitem__': <function Variation.__getitem__>, '__dict__': <attribute '__dict__' of 'Variation' objects>, '__weakref__': <attribute '__weakref__' of 'Variation' objects>})
__getitem__(key)[source]
__init__(e)[source]
Parameters

e – the XML-data from which it is created

__len__()[source]
Returns

number of values

__module__ = 'PyFoam.Applications.Comparator'
__str__()[source]

Return str(self).

__weakref__

list of weak references to the object (if defined)

PyFoam.Applications.Comparator.getNonEmpty(e, name, default=None)[source]
PyFoam.Applications.Comparator.replaceValues(orig, para)[source]

Replaces all strings enclosed by $$ with the parameters :param orig: the original string :param para: dictionary with the parameters