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

Class BlockMesh

source code


Represents a blockMeshDict-file

Instance Methods [hide private]
 
__endProcess(self, newMesh, getContent=True) source code
 
__init__(self, name, backup=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__startProcess(self) source code
 
_getVertexes(self)
Get a dictionary with the 3 components of each vertex as keys and the 'raw' line as the value
source code
 
mergeVertices(self, other)
Merge in the vertexes from another mesh after our own vertexes
source code
 
normalizePatches(self)
Rotate patches so that they start with the lowest number vertex
source code
 
numberVertices(self, prefix='')
Add comments with the number of the vertex after them
source code
 
refineMesh(self, factors, offset=(0, 0, 0), getContent=False, addOld=True)
Refine the Mesh by multiplying the number of cells in the blocks
source code
 
renumberVertices(self, other)
Renumber the vertices in the current mesh according to another mesh
source code
 
stripVertexNumber(self)
Remove comments after vertices
source code

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

    Inherited from FileBasis.FileBasisBackup
 
restore(self)
if a backup-copy was made the file is restored from this
source code
    Inherited from FileBasis.FileBasis
 
__enter__(self)
Making the 'with'-statement happy
source code
 
__exit__(self, typ, value, traceback)
Making the 'with'-statement happy
source code
 
__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, force=False)
Encapsulates the shutil copytree and provides an alternative for old Python-version
source code
 
diskUsage(self, fpath)
Calculate the disk space used at the specified path in bytes
source code
 
execute(self, cmd, debug=False, workdir=None, echo=None)
Execute the command cmd.
source code
 
find(self, pattern, path, directoriesToo=True)
Find all files whose names match
source code
 
humanReadableSize(self, num)
Lifted from http://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size Gets a number in bytes and returns a human readable string
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, dst, 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)
(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
Overrides: object.__init__

numberVertices(self, prefix='')

source code 

Add comments with the number of the vertex after them

Parameters:
  • prefix - a string to add before the number

refineMesh(self, factors, offset=(0, 0, 0), getContent=False, addOld=True)

source code 

Refine the Mesh by multiplying the number of cells in the blocks

Parameters:
  • factors - either a scalar to scale in all directions or a tuple with the value for each direction
  • offset - an optional tuple for an additionnal offset value for each direction
  • getContent - Return the contents instead of writing a fil. Main purpose of this parameter is not to break compatibility with old versions