PyFoam.Applications.PrepareCase module

Application-class that implements pyFoamPrepareCase.py

class PyFoam.Applications.PrepareCase.PrepareCase(args=None, exactNr=True, interspersed=True, usage='%prog <caseDirectory>', examples=None, nr=1, description=None, **kwargs)[source]

Bases: PyFoam.Applications.PyFoamApplication.PyFoamApplication, PyFoam.Applications.CommonTemplateBehaviour.CommonTemplateBehaviour, PyFoam.Applications.CommonTemplateFormat.CommonTemplateFormat

_PrepareCase__strip(val)

Strip extra ” from strings

_PrepareCase__writeToStateFile(sol, message)

Write a message to a state file

__init__(args=None, exactNr=True, interspersed=True, usage='%prog <caseDirectory>', examples=None, nr=1, description=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.PrepareCase'
addDictValues(name, description, values)[source]

Add values from a dictionary

addOptions()[source]

Add options to the parser

checkCorrectOptions(values, meta=None)[source]
cleanExtension(startDir, ext)[source]

Go recursivly through directories and remove all files that have a specific extension

copyOriginals(startDir, extension=None, recursive=True)[source]

Go recursivly through directories and copy foo.org to foo

executeScript(scriptName, workdir, echo, allrun=None)[source]

Execute a script and write a corresponding logfile

getDefaultValues(cName)[source]

Process the file with the default values - if present Returns a dictionary with the values and a dictionary with the meta-data about the parameters

info(*args)[source]

Information output

listdir(d, ext)[source]

Private copy of listdir. Returns a list of pairs: first element is the real file-name. Second the name with the extensions stripped off or None if the file doesn’t match any extensions

makeReport(values, level=2, meta=None)[source]
overloadDir(here, there)[source]

Copy files recursively. Overwrite local copies if they exist

parameterOutFile = 'PyFoamPrepareCaseParameters'
prepare(sol, cName=None, overrideParameters=None, numberOfProcessors=None)[source]

Do the actual preparing :param numberOfProcessors: If set this overrides the value set in the command line

processDefault(raw)[source]

Process a dictionary and return a ‘flattened’ dictionary with the values and a dictionary with the meta-data

run()[source]

Run the real application

searchAndReplaceTemplates(startDir, values, templateExt, ignoreDirectories=[])[source]

Go through the directory recursively and replate foo.template with foo after inserting the values

PyFoam.Applications.PrepareCase.buildFilenameExtension(paraList, valueStrings)[source]