WIP : a first glimpse on cells ans sites
This commit is contained in:
parent
393303dbc5
commit
f068ca6731
Binary file not shown.
|
@ -2,24 +2,34 @@ import model
|
||||||
|
|
||||||
|
|
||||||
sp = model.testmodel.get_states().get_space(0)
|
sp = model.testmodel.get_states().get_space(0)
|
||||||
|
size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x()
|
||||||
arrows= []
|
nb_sites = int (model.testmodel.get_parameters().spaceparam.get_site_multiplicity())
|
||||||
|
nb_arrows = int (model.testmodel.get_states().get_space(0).get_nb_arrows())
|
||||||
for x in range (0,6):
|
|
||||||
arrows.append(sp.get_arrow(x).get_coord("x"))
|
|
||||||
|
|
||||||
print (arrows)
|
|
||||||
|
|
||||||
space = []
|
space = []
|
||||||
|
cells = []
|
||||||
|
sites = []
|
||||||
|
arrows = []
|
||||||
|
|
||||||
for i in range (0,30):
|
for x in range (0, nb_arrows):
|
||||||
for k in range (0,6):
|
arrows.append(sp.get_arrow(x).get_coord("x"))
|
||||||
|
sites.append(sp.get_arrow(x).get_site())
|
||||||
|
|
||||||
|
print()
|
||||||
|
# print (sites)
|
||||||
|
print (arrows)
|
||||||
|
print()
|
||||||
|
|
||||||
|
for i in range (0, size + 1): cells.append('')
|
||||||
|
for i in range (0,121): space.append(0)
|
||||||
|
|
||||||
|
for i in range (0, size + nb_sites - 1):
|
||||||
|
space[i * (nb_sites + 1)] = ''
|
||||||
|
for k in range (0, nb_arrows):
|
||||||
if arrows[k] == i:
|
if arrows[k] == i:
|
||||||
space.append(1)
|
cells[i] = i # cette cellule contient au moins une flèche
|
||||||
else:
|
space[i * (nb_sites + 1) + sites[k] + 1] = 1 # nombre de flèches dans ce site
|
||||||
pass
|
|
||||||
space.append(0)
|
|
||||||
|
|
||||||
|
print (cells)
|
||||||
|
print()
|
||||||
print (space)
|
print (space)
|
||||||
|
|
||||||
|
|
||||||
|
|
16
src/model.py
16
src/model.py
|
@ -160,12 +160,9 @@ class Dimension:
|
||||||
|
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.node = node
|
self.node = node
|
||||||
for child in node:
|
|
||||||
if(child.tag == "axis"):
|
|
||||||
self.__axis.append(Axis(child))
|
|
||||||
|
|
||||||
def get_axis(self, i):
|
def get_x(self):
|
||||||
return self.__axis[i]
|
return int(self.node.get("x"))
|
||||||
|
|
||||||
|
|
||||||
class Parameters:
|
class Parameters:
|
||||||
|
@ -230,16 +227,21 @@ class Objects:
|
||||||
|
|
||||||
class Space:
|
class Space:
|
||||||
__arrows = []
|
__arrows = []
|
||||||
|
nb_arrows = 0
|
||||||
|
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.node = node
|
self.node = node
|
||||||
for child in node:
|
for child in node:
|
||||||
if(child.tag == "arrow"):
|
if(child.tag == "arrow"):
|
||||||
|
self.nb_arrows += 1
|
||||||
self.__arrows.append(Arrow(child))
|
self.__arrows.append(Arrow(child))
|
||||||
|
|
||||||
def get_arrow(self, i):
|
def get_arrow(self, i):
|
||||||
return self.__arrows[i]
|
return self.__arrows[i]
|
||||||
|
|
||||||
|
def get_nb_arrows(self):
|
||||||
|
return self.nb_arrows
|
||||||
|
|
||||||
|
|
||||||
class States:
|
class States:
|
||||||
__space = []
|
__space = []
|
||||||
|
@ -412,7 +414,3 @@ modelPath = "../models/dimers random walk.xml"
|
||||||
schemaPath = "../schemas/models_0.2.1.xmls"
|
schemaPath = "../schemas/models_0.2.1.xmls"
|
||||||
|
|
||||||
testmodel = Model(modelPath, schemaPath)
|
testmodel = Model(modelPath, schemaPath)
|
||||||
|
|
||||||
state_size = testmodel.get_parameters().spaceparam.get_dimension()#.get_axis(0).get_size()
|
|
||||||
|
|
||||||
print(state_size)
|
|
||||||
|
|
Loading…
Reference in New Issue