Commit f40b0951 authored by Karol Actun's avatar Karol Actun
Browse files

renamed grid modules and adjusted the loading in the config.py

parent 73a64719
......@@ -40,7 +40,7 @@ gui = default_gui
;# Triangular grid default configs:
grid_class = TriangularGrid
grid_class = triangular.TriangularGrid
particle_model_file = 2d_particle.obj
tile_model_file = 2d_hex_tile.obj
location_model_file = 2d_location.obj
......@@ -49,20 +49,20 @@ grid_size = 100
;# cubic grid default configs:
;grid_class = CubicGrid
;grid_class = cubic.CubicGrid
;particle_model_file = 3d_particle.obj
;tile_model_file = 3d_cube_tile.obj
;location_model_file = 3d_location.obj
;grid_size = 10
;grid_size = 5
;# end of cubic grid configs
# ccp grid default configs:
;grid_class = CCPGrid
;grid_class = ccp.CCPGrid
;particle_model_file = 3d_particle.obj
;tile_model_file = 3d_ccp_tile.obj
;location_model_file = 3d_location.obj
;grid_size = 0
;grid_size = 5
# end of ccp grid configs
......
from grids.Grid import Grid
from grids.grid import Grid
class CCPGrid(Grid):
......
from grids.Grid import Grid
from grids.grid import Grid
class CubicGrid(Grid):
......
from grids.Grid import Grid
from grids.grid import Grid
class QuadraticGrid(Grid):
......
import math
from grids.Grid import Grid
from grids.grid import Grid
class TriangularGrid(Grid):
......
......@@ -35,7 +35,8 @@ class ConfigData:
except configparser.NoOptionError:
raise RuntimeError("Fatal Error: no grid size defined in config.ini!")
test = getattr(importlib.import_module("grids.%s" % self.grid_class), self.grid_class)
grid_module, grid_class = self.grid_class.rsplit(".", 1)
test = getattr(importlib.import_module("grids.%s" % grid_module), grid_class)
self.grid = test(self.grid_size)
self.particle_model_file = config.get("Visualization", "particle_model_file")
......
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