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) 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)

View File

@ -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)