WIP: Struggling to slide through pipeline (II)

This commit is contained in:
Jean Sirmai 2021-12-14 19:56:00 +01:00
parent f445d4d534
commit ea93bd0aad
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 23 additions and 22 deletions

View File

@ -26,7 +26,7 @@ for i in range(0, len(model.testmodel.get_conditions().get_conditions_array())):
class TreeNode(object): class TreeNode(object):
# TODO self.y = y,... # TODO self.y = y,...
def __init__(self, id, parent, x, site, weight): def __init__(self, id, parent, x, site, weight):
self.id = id self.id = id
self.parent = parent self.parent = parent
@ -42,6 +42,7 @@ class TreeNode(object):
self.ch.append(ch_id) self.ch.append(ch_id)
self.ch = sorted(self.ch, key=id) self.ch = sorted(self.ch, key=id)
lll = [] lll = []
for i in conditions_set: # sorted(conditions_set, key=id): for i in conditions_set: # sorted(conditions_set, key=id):
@ -60,7 +61,7 @@ affichage = ''
for i in lll: for i in lll:
affichage = str(i.id) + ' ' + str(i.parent) + ' n=' + str(len(i.ch)) + ' ' affichage = str(i.id) + ' ' + str(i.parent) + ' n=' + str(len(i.ch)) + ' '
if len(i.ch) > 0: if len(i.ch) > 0:
for c in range (0, len(i.ch)): for c in range(0, len(i.ch)):
affichage += str(i.ch[c].id) + ', ' affichage += str(i.ch[c].id) + ', '
print(affichage) print(affichage)
@ -95,11 +96,6 @@ with open('input.txt', 'r') as f:
for pre, _, node in RenderTree(root): for pre, _, node in RenderTree(root):
print("%s%s" % (pre, node.name)) print("%s%s" % (pre, node.name))
""" """
##
## ##
@ -116,9 +112,11 @@ size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x()
nb_sites = int(model.testmodel.get_parameters().spaceparam.get_site_multiplicity()) nb_sites = int(model.testmodel.get_parameters().spaceparam.get_site_multiplicity())
nb_arrows = int(model.testmodel.get_states().get_space(0).get_nb_arrows()) nb_arrows = int(model.testmodel.get_states().get_space(0).get_nb_arrows())
print("space size = ", size, " nb de sites par cellule = ", nb_sites, print("space size = ", size, " nb de sites par cellule = ", nb_sites,
" nb total de flèches dans l'espace = ", nb_arrows) " nb total de flèches dans l'espace = ", nb_arrows)
print(' | ',end=' ')
print(' | ', end=' ')
# TODO Contrôles de cohérence des données # TODO Contrôles de cohérence des données
# condition et arrow # condition et arrow
@ -138,12 +136,15 @@ for n in range(0, size + 1):
and sp.get_arrow(a).get_site() == s): and sp.get_arrow(a).get_site() == s):
arr = sp.get_arrow(a).get_weight() arr = sp.get_arrow(a).get_weight()
if arr > 0: if arr > 0:
print(str(arr),end=' ') print(str(arr), end = ' ')
else: else:
print('.',end=' ') print('.', end = ' ')
print(' | ',end=' ')
print('\n ' + ' ' * nb_sites * 2,end='') print(' | ', end = ' ')
print('\n ' + ' ' * nb_sites * 2, end = '')
for k in range(0, size + 1): for k in range(0, size + 1):
if k < 9: print(k+1,end=' '+ ' ' * nb_sites * 2) if k < 9: print(k + 1, end=' '+ ' ' * nb_sites * 2)
else: print(k+1,end=' '+ ' ' * nb_sites * 2) else: print(k + 1, end=' '+ ' ' * nb_sites * 2)