1
0
mirror of https://github.com/gsi-upm/soil synced 2024-11-14 23:42:29 +00:00
soil/visualization.py

41 lines
1.0 KiB
Python
Raw Normal View History

2017-12-15 16:59:50 +00:00
import os
from server import VisualizationElement
from soil.simulation import SoilSimulation
from xml.etree import ElementTree
class Model():
2018-02-02 14:01:17 +00:00
def __init__(self, dump=False, dir_path='output'):
2018-02-01 18:37:10 +00:00
self.name = 'soil'
self.dump = dump
self.dir_path = dir_path
2018-02-02 14:01:17 +00:00
self.simulation = list()
2017-12-15 16:59:50 +00:00
2018-02-01 18:37:10 +00:00
def run(self, config):
name = config['name']
print('Using config(s): {name}'.format(name=name))
2017-12-15 16:59:50 +00:00
2018-02-01 18:37:10 +00:00
sim = SoilSimulation(**config)
sim.dir_path = os.path.join(self.dir_path, name)
sim.dump = self.dump
2017-12-15 16:59:50 +00:00
2018-02-01 18:37:10 +00:00
print('Dumping results to {} : {}'.format(sim.dir_path, sim.dump))
2018-02-02 14:01:17 +00:00
return sim.run_simulation()
2017-12-15 16:59:50 +00:00
2018-02-01 18:37:10 +00:00
def reset(self):
pass
2017-12-15 16:59:50 +00:00
class GraphVisualization(VisualizationElement):
2018-02-01 18:37:10 +00:00
package_includes = []
2017-12-15 16:59:50 +00:00
2018-02-01 18:37:10 +00:00
# TODO: esta por definir todos los ajustes de simulacion
def __init__(self, params=None):
new_element = ("new funcion()")
self.js_code = "elements.push(" + new_element + ");"
2017-12-15 16:59:50 +00:00
2018-02-01 18:37:10 +00:00
def render(self, model):
pass