WIP : a first glimpse on cells ans sites

This commit is contained in:
Jean Sirmai 2021-12-09 11:05:48 +01:00
parent 393303dbc5
commit f068ca6731
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 32 additions and 24 deletions

Binary file not shown.

View File

@ -2,24 +2,34 @@ import model
sp = model.testmodel.get_states().get_space(0)
arrows= []
for x in range (0,6):
arrows.append(sp.get_arrow(x).get_coord("x"))
print (arrows)
size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x()
nb_sites = int (model.testmodel.get_parameters().spaceparam.get_site_multiplicity())
nb_arrows = int (model.testmodel.get_states().get_space(0).get_nb_arrows())
space = []
cells = []
sites = []
arrows = []
for i in range (0,30):
for k in range (0,6):
for x in range (0, nb_arrows):
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:
space.append(1)
else:
pass
space.append(0)
cells[i] = i # cette cellule contient au moins une flèche
space[i * (nb_sites + 1) + sites[k] + 1] = 1 # nombre de flèches dans ce site
print (cells)
print()
print (space)

View File

@ -160,12 +160,9 @@ class Dimension:
def __init__(self, node):
self.node = node
for child in node:
if(child.tag == "axis"):
self.__axis.append(Axis(child))
def get_axis(self, i):
return self.__axis[i]
def get_x(self):
return int(self.node.get("x"))
class Parameters:
@ -230,16 +227,21 @@ class Objects:
class Space:
__arrows = []
nb_arrows = 0
def __init__(self, node):
self.node = node
for child in node:
if(child.tag == "arrow"):
self.nb_arrows += 1
self.__arrows.append(Arrow(child))
def get_arrow(self, i):
return self.__arrows[i]
def get_nb_arrows(self):
return self.nb_arrows
class States:
__space = []
@ -412,7 +414,3 @@ modelPath = "../models/dimers random walk.xml"
schemaPath = "../schemas/models_0.2.1.xmls"
testmodel = Model(modelPath, schemaPath)
state_size = testmodel.get_parameters().spaceparam.get_dimension()#.get_axis(0).get_size()
print(state_size)