PyFoam.Basics.OutFileCollection module

Collections of output files

class PyFoam.Basics.OutFileCollection.OutFileCollection(basename, titles=[], singleFile=False)[source]

Bases: object

Collection of output files

The files are stored in a common directory and are created on first access

Each file can be identified by a unique name. If a file is accessed a second time at the same simulation-time a file with the ending _2 is created (incrementing with each access)

__dict__ = mappingproxy({'__module__': 'PyFoam.Basics.OutFileCollection', '__doc__': 'Collection of output files\n\n The files are stored in a common directory and are created on\n first access\n\n Each file can be identified by a unique name. If a file is\n accessed a second time at the same simulation-time a file with the\n ending _2 is created (incrementing with each access)', 'maxOpenFiles': 100, '__init__': <function OutFileCollection.__init__>, 'setTitles': <function OutFileCollection.setTitles>, 'checkTime': <function OutFileCollection.checkTime>, 'getFile': <function OutFileCollection.getFile>, 'addToOpenList': <function OutFileCollection.addToOpenList>, 'removeFromOpenList': <function OutFileCollection.removeFromOpenList>, 'prevCalls': <function OutFileCollection.prevCalls>, 'incrementCalls': <function OutFileCollection.incrementCalls>, 'write': <function OutFileCollection.write>, 'close': <function OutFileCollection.close>, '__dict__': <attribute '__dict__' of 'OutFileCollection' objects>, '__weakref__': <attribute '__weakref__' of 'OutFileCollection' objects>})
__init__(basename, titles=[], singleFile=False)[source]
Parameters
  • basename – name of the base directory

  • titles – names of the data columns

  • singleFile – don’t split into multiple files if more than one

datum is insert per time-step

__module__ = 'PyFoam.Basics.OutFileCollection'
__weakref__

list of weak references to the object (if defined)

addToOpenList(name)[source]

Adds a file to the list of open files. Closes another file if limit is reached

checkTime(time)[source]

check whether the time has changed

close()[source]

Force all files to be closed

getFile(name)[source]

get a OutputFile-object

incrementCalls(name)[source]

increments the access counter for name

maxOpenFiles = 100
prevCalls(name)[source]

checks whether the name was used previously at that time-step

removeFromOpenList(name)[source]

Adds a file to the list of open files. Closes another file if limit is reached

setTitles(titles)[source]

Sets the titles anew

Parameters

titles – the new titles

write(name, time, data)[source]

writes data to file

name - name of the file time - simulation time data - tuple with the data