PyFoam.Infrastructure.FoamServer module¶
A XMLRPC-Server that answeres about the current state of a Foam-Run
-
class
PyFoam.Infrastructure.FoamServer.FoamAnswerer(run=None, master=None, lines=100, foamserver=None)[source]¶ Bases:
objectThe class that handles the actual requests (only needed to hide the Thread-methods from the world
-
getDictionaryContents(directory, name)[source]¶ Parameters: - directory – Sub-directory of the case
- name – name of the dictionary file
Returns: the contents of the file as a python data-structure
-
getDictionaryText(directory, name)[source]¶ Parameters: - directory – Sub-directory of the case
- name – name of the dictionary file
Returns: the contents of the file as a big string
-
getEnviron(name)[source]¶ Parameters: name – name of an environment variable Returns: value of the variable, empty string if non-existing
-
listFiles(directory)[source]¶ Parameters: directory – Sub-directory of the case Returns: List of the filenames (not directories) in that case
-
setRemark(remark)[source]¶ Overwrite the user-defined remark :return: True if the remark was set previously
-
solutionFiles(time)[source]¶ Parameters: time – name of the timestep Returns: list of the solution files at that timestep
-
writeDictionaryContents(directory, name, contents)[source]¶ Writes the contents of a dictionary :param directory: Sub-directory of the case :param name: name of the dictionary file :param contents: Python-dictionary with the dictionary contents
-
-
class
PyFoam.Infrastructure.FoamServer.FoamServer(run=None, master=None, lines=100)[source]¶ Bases:
threading.ThreadThis is the class that serves the requests about the FOAM-Run
-
PyFoam.Infrastructure.FoamServer.findFreePort(useSSL=None)[source]¶ Finds a free server port on this machine and returns it
Valid server ports are in the range 18000 upward (the function tries to find the lowest possible port number
ATTENTION: this part may introduce race conditions
-
PyFoam.Infrastructure.FoamServer.random() → x in the interval [0, 1).¶