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

Class ListFile

source code


Represents a OpenFOAM file with only a list

Instance Methods [hide private]
 
__init__(self, place, name)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
getSize(self)
Returns: the size of the list
source code

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

    Inherited from SolutionFile.SolutionFile
 
dimensionPattern(self)
pattern for the dimension string
source code
 
getContent(self, treatBinaryAsASCII=False, listLengthUnparsed=None, doMacroExpansion=False)
Returns the parsed content of the file
source code
 
getDimensionString(self)
builds a dimension string from the dimension information in the file
source code
 
internalPattern(self)
pattern for internal fields
source code
 
internalPatternGeneral(self)
general pattern for internal fields
source code
 
internalPatternUniform(self)
pattern for internal fields
source code
 
readBoundary(self, name)
read the value at a boundary
source code
 
readDimension(self)
read the dimension of the field
source code
 
readInternal(self)
read the value of the internal field
source code
 
readInternalUniform(self)
read the value of the internal field
source code
 
replaceBoundary(self, name, newval)
write the value at a boundary
source code
 
replaceInternal(self, newval)
overwrite the value of the internal field
source code
 
stopPattern(self)
pattern that ends a boundary
source code
 
valuePattern(self)
pattern for values
source code
    Inherited from FileBasis.FileBasis
 
__str__(self)
Build a string from self.content, to be overriden by sub-classes
source code
 
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
 
parse(self, cnt)
Parse a string that is to be the content, to be overriden by the sub-classes
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.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, place, name)
(Constructor)

source code 

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

Parameters:
  • place - directory of the file
  • name - The name of the list file
Overrides: object.__init__

getSize(self)

source code 
Returns:
the size of the list