From ea93bd0aad87d92e53099a3bd0eb8b477ff4185e Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Tue, 14 Dec 2021 19:56:00 +0100 Subject: [PATCH] WIP: Struggling to slide through pipeline (II) --- src/glimpse.py | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/glimpse.py b/src/glimpse.py index 8760062..45714a3 100644 --- a/src/glimpse.py +++ b/src/glimpse.py @@ -26,7 +26,7 @@ for i in range(0, len(model.testmodel.get_conditions().get_conditions_array())): class TreeNode(object): -# TODO self.y = y,... + # TODO self.y = y,... def __init__(self, id, parent, x, site, weight): self.id = id self.parent = parent @@ -42,9 +42,10 @@ class TreeNode(object): self.ch.append(ch_id) self.ch = sorted(self.ch, key=id) + lll = [] -for i in conditions_set: # sorted(conditions_set, key=id): +for i in conditions_set: # sorted(conditions_set, key=id): cndt = TreeNode(i[0], i[1], i[2], i[3], i[4]) # TODO y,z,... lll.append(cndt) @@ -60,7 +61,7 @@ affichage = '' for i in lll: affichage = str(i.id) + ' ' + str(i.parent) + ' n=' + str(len(i.ch)) + ' ' 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) + ', ' print(affichage) @@ -95,11 +96,6 @@ with open('input.txt', 'r') as f: for pre, _, node in RenderTree(root): print("%s%s" % (pre, node.name)) """ -## - - - - ## @@ -116,18 +112,20 @@ 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()) + print("space size = ", size, " nb de sites par cellule = ", nb_sites, " nb total de flèches dans l'espace = ", nb_arrows) -print(' | ',end=' ') + +print(' | ', end=' ') # TODO Contrôles de cohérence des données -# condition et arrow -# 1) weight < weight_max (à définir) -# 2) arrow.site < site_multiplicity -# 3) arrow.x < space-param.dimension.x (idem autres axes) -# condition -# 1) parent <= condition.node_id max value (donc deux lectures) -# 2) pas de node sans un node_parent_id +# condition et arrow +# 1) weight < weight_max (à définir) +# 2) arrow.site < site_multiplicity +# 3) arrow.x < space-param.dimension.x (idem autres axes) +# condition +# 1) parent <= condition.node_id max value (donc deux lectures) +# 2) pas de node sans un node_parent_id for n in range(0, size + 1): @@ -138,12 +136,15 @@ for n in range(0, size + 1): and sp.get_arrow(a).get_site() == s): arr = sp.get_arrow(a).get_weight() if arr > 0: - print(str(arr),end=' ') + print(str(arr), end = ' ') else: - print('.',end=' ') - print(' | ',end=' ') -print('\n ' + ' ' * nb_sites * 2,end='') + print('.', end = ' ') + + print(' | ', end = ' ') + +print('\n ' + ' ' * nb_sites * 2, end = '') + for k in range(0, size + 1): - if k < 9: print(k+1,end=' '+ ' ' * nb_sites * 2) - else: 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)