Commit 933e246a authored by Wouter Kessels's avatar Wouter Kessels

First steps to store progress

parent 1f121b88
This diff is collapsed.
......@@ -72,6 +72,10 @@ def pipeline(bodies, settings):
def calc(bodies, settings):
# Calculate movements
if settings.proceed:
pass
else:
pass
positions, velocities, times = dynamics(bodies, settings.dimensions, settings.timestep, settings.time, settings.barneshut, settings.theta)
for i, body in enumerate(bodies):
if isinstance(body, Body):
......@@ -149,7 +153,8 @@ def save_results(bodies, info, settings, overwrite, name=None, folder=None, temp
if temp_name == None:
raise IOError("Specify what temporary file to replace")
else:
del_temp(temp_name)
os.remove(name)
else:
raise ValueError("File path {} already exists. Define a unique file name".format(name))
......@@ -167,18 +172,6 @@ def save_results(bodies, info, settings, overwrite, name=None, folder=None, temp
def del_temp(name):
"""Delete specified temporary file.
Parameter
---------
name: str
File path and name of temporary file to delete
"""
os.remove(name)
def del_temps():
"""Delete all temporary files in directory, characterized by '/temp_' in the path."""
dir_path = os.path.dirname(os.path.realpath(__file__))
......
......@@ -350,6 +350,21 @@ class Settings:
def __init__(self, sets, bodies=None):
# Proceed where calculations ended
try:
self.proceed = sets['proceed']
except:
self.proceed = False
# Number of time steps after which to store progress data
try:
self.n_store_progress = int(sets['n_store_progress'])
except:
if self.proceed:
self.n_store_progress = 500
else:
pass
# Location of origin
try:
origin = sets['origin']
......
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