Package PyFoam :: Package RunDictionary :: Module ParsedParameterFile :: Class WriteParameterFile
[hide private]
[frames] | no frames]

Class WriteParameterFile

source code


A specialization that is used to only write to the file

Instance Methods [hide private]
 
__init__(self, name, backup=False, className='dictionary', objectName=None, createZipped=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

    Inherited from ParsedParameterFile
 
__contains__(self, key) source code
 
__delitem__(self, key) source code
 
__getitem__(self, key) source code
 
__iter__(self) source code
 
__len__(self) source code
 
__setitem__(self, key, value) source code
 
__str__(self)
Generates a string from the contents in memory Used to be called makeString
source code
 
getValueDict(self)
Get a dictionary with the values with the decorators removed
source code
 
parse(self, content)
Constructs a representation of the file
source code
    Inherited from FileBasis.FileBasisBackup
 
restore(self)
if a backup-copy was made the file is restored from this
source code
    Inherited from FileBasis.FileBasis
 
baseName(self)
Returns the basic file name (without .gz)
source code
 
closeFile(self)
closes the file
source code
 
copyRest(self, l, out)
Copy the rest of the file
source code
 
encode(self, txt)
Encode a string to byte if necessary (for Python3)
source code
 
getCaseDir(self)
Return the path to the case of this file (if any valid case is found).
source code
 
goMatch(self, l, exp, out=None, stop=None)
Read lines until a regular expression is matched
source code
 
goTo(self, l, s, out=None, echoLast=False, stop=None)
Read lines until a token is found
source code
 
makeTemp(self)
creates a temporary file
source code
 
openFile(self, keepContent=False, mode='r')
opens the file.
source code
 
purgeFile(self)
Undo all the manipulations done by PyFOAM
source code
 
readFile(self)
read the whole File into memory
source code
 
realName(self)
The full filename with appended .gz (if zipped)
source code
 
writeEncoded(self, out, txt)
Convert the text to 'bytes' is we encounter a zipped file
source code
 
writeFile(self, content=None)
write the whole File from memory
source code
 
writeFileAs(self, name)
Writes a copy of the file.
source code
    Inherited from Basics.Utilities.Utilities
 
copyfile(self, src, dst)
Encapsulates the shutil copyfile and provides an alternative for old Python-version
source code
 
copytree(self, src, dst, symlinks=False)
Encapsulates the shutil copytree and provides an alternative for old Python-version
source code
 
execute(self, cmd, debug=False)
Execute the command cmd
source code
 
find(self, pattern, path, directoriesToo=True)
Find all files whose names match
source code
 
listDirectory(self, d)
Lists the files in a directory, but excludes certain names and files with certain endings
source code
 
remove(self, f)
Remove a file if it exists.
source code
 
rmtree(self, path, ignore_errors=False)
Encapsulates the shutil rmtree and provides an alternative for old Python-version
source code
 
which(self, progname)
Get the full path.
source code
 
writeDictionaryHeader(self, f)
Writes a dummy header so OpenFOAM accepts the file as a dictionary
source code
Class Variables [hide private]
    Inherited from FileBasis.FileBasisBackup
  counter = {}
    Inherited from FileBasis.FileBasis
  addedString = '//PyFoamAdded'
  removedString = '//PyFoamRemoved: '
    Inherited from Basics.Utilities.Utilities
  excludeNames = ['^.svn$', '~$']
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, backup=False, className='dictionary', objectName=None, createZipped=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • name - The name of the parameter file
  • backup - create a backup-copy of the file
  • boundaryDict - the file to parse is a boundary file
  • listDict - the file only contains a list
  • listDictWithHeader - the file only contains a list and a header
  • listLengthUnparsed - Lists longer than that length are not parsed
  • binaryMode - Parse long lists in binary mode (to be overridden by the settings in the header).
  • treatBinaryAsASCII - even if the header says that this is a binary file treat it like an ASCII-file
  • noHeader - don't expect a header
  • noBody - don't read the body of the file (only the header)
  • doMacroExpansion - expand #include and $var
  • noVectorOrTensor - short lists of length 3, 6 an 9 are NOT interpreted as vectors or tensors
  • dontRead - Do not read the file during construction
  • longListOutputThreshold - Lists that are longer than this are prefixed with a length
  • dictStack - dictionary stack for lookup (only used for include)
Overrides: object.__init__
(inherited documentation)