Commit b788fdd6 authored by peastman's avatar peastman
Browse files

Merge pull request #66 from rmcgibbo/buffering

StateDataReporter buffering
parents 99df6758 bc9f1c6a
......@@ -67,7 +67,7 @@ class StateDataReporter(object):
self._reportInterval = reportInterval
self._openedFile = isinstance(file, str)
if self._openedFile:
self._out = open(file, 'w')
self._out = open(file, 'w', 0)
else:
self._out = file
self._step = step
......@@ -109,6 +109,7 @@ class StateDataReporter(object):
self._initializeConstants(simulation)
headers = self._constructHeaders()
print >>self._out, '#"%s"' % ('"'+self._separator+'"').join(headers)
self._out.flush()
self._hasInitialized = True
# Check for errors.
......@@ -119,6 +120,7 @@ class StateDataReporter(object):
# Write the values.
print >>self._out, self._separator.join(str(v) for v in values)
self._out.flush()
def _constructReportValues(self, simulation, state):
"""Query the simulation for the current state of our observables of interest.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment