From 3517e73de45123873fbe9c1fb4b5a7c33278dfdd Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sat, 11 Dec 2021 19:01:38 +0100 Subject: [PATCH] WIP: nettoyage + TODO list --- schemas/models_0.2.1.xmls | 20 ++++---- src/__pycache__/model.cpython-39.pyc | Bin 16854 -> 16858 bytes src/glimpse.py | 72 +++++++++++++++------------ src/model.py | 5 +- 4 files changed, 52 insertions(+), 45 deletions(-) diff --git a/schemas/models_0.2.1.xmls b/schemas/models_0.2.1.xmls index 669244b..edbd775 100644 --- a/schemas/models_0.2.1.xmls +++ b/schemas/models_0.2.1.xmls @@ -36,8 +36,8 @@ - - + + @@ -112,14 +112,14 @@ - - - - - - - - + + + + + + + + diff --git a/src/__pycache__/model.cpython-39.pyc b/src/__pycache__/model.cpython-39.pyc index 6002d349f3a5b48d86d14321aaa2e5118e9b9b02..79fb21d4670374b5810e01c7a021356cafc79ee0 100644 GIT binary patch delta 408 zcmY+9PbfnH0LJ&NoyL3QUn3>v-`IF&vlliTl#?i>NzL;oW_shjMPuWz#DU0H{*>ax zfs5WQlyc?b=AbybDW#klDZbNJ-`DT!dr09i1wj!6tLaO%_i5$oLMU{=OuJ(p0?!?B z zYJF~Ub8+G3;Na)xs>IcH(Y&X(-lyk%R`8@ikOiSclZ*9Al@GE)r3IkbvV}5USW?il z(YgTxPpxTG(ri;;=U{=ee)w;UJO9CallsuhruKV`^0R#b pas de doublon - # TODO 2) un node_parent_id existe toujours +# TODO Contrôles de cohérence des données +# 1) node_id <> pas de doublon +# 2) pas de node sans un node_parent_id -for i in range (0, len(model.testmodel.get_conditions().get_condition_array())): +conditions_set = set() + +for i in range (0, len(model.testmodel.get_conditions().get_conditions_array())): cnd = model.testmodel.get_conditions().get_condition(i) - cset.add((cnd.get_node_self_id(), cnd.get_node_parent_id(), cnd.get_weight())) # TODO coord - + conditions_set.add((cnd.get_node_self_id(), + cnd.get_node_parent_id(), + cnd.get_coord("x"), +# TODO cnd.get_coord("y"),... + cnd.get_site(), + cnd.get_weight())) class TreeNode(object): - def __init__(self, id, parent, weight, coord): + def __init__(self, id, parent, x, site, weight): self.id = id self.parent = parent - self.children = None - self.weight = weight - self.coord = coord self.ch = [] + self.x = x +# TODO self.y = y,... + self.site = site + self.weight = weight def id(self): return id @@ -27,24 +35,20 @@ class TreeNode(object): self.ch.append(ch_id) self.ch = sorted(self.ch, key=id) - l = [] -tnn = TreeNode(0, 0, 0, 0) - -for i in cset: # sorted(cset, key=id): - cndt = TreeNode(i[0], i[1], i[2], 0) +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,... l.append(cndt) for i in l: for j in l: if (i.id == j.parent): i.add_child(j) - else: - i.add_child(tnn) for i in l: - print(i.id,' ',i.parent,' [',i.ch[0].id,' ',i.ch[1].id,' ',i.ch[2].id,' ',i.ch[3].id,' ',i.ch[4].id,']') + cnd = str(i.id) + ' ' + str(i.parent) + ' [' + str(len(i.ch)) + ']' + print(cnd) @@ -53,30 +57,32 @@ for i in l: + + + + + + + + +""" ## - - - - - - - - - - sp = model.testmodel.get_states().get_space(0) 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()) weight = int (model.testmodel.get_states().get_space(0).get_arrow(0).get_weight()) -# TODO Contrôles cohérence des données (module à prévoir) - # pour condition et arrow : weight < weight_max (à définir) - # pour condition et arrow : arrow.site < site_multiplicity - # pour condition et arrow : arrow.x < space-param.dimension.x (idem autres axes) - # condition.parent <= condition.node_id max value (donc deux lectures) +# 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 space = [] cells = [] @@ -116,4 +122,4 @@ print (cells) print() print (space) - +""" diff --git a/src/model.py b/src/model.py index 3328bc7..0c09a78 100644 --- a/src/model.py +++ b/src/model.py @@ -263,6 +263,7 @@ class Condition: self.node = node def get_coord(self, axis): +# print(self.node.get(axis)) return int(self.node.get(axis)) def set_coord(self, axis, value): @@ -305,7 +306,7 @@ class Conditions: def get_condition(self, i): return self.__conditions[i] - def get_condition_array(self): + def get_conditions_array(self): return self.__conditions class Transition: @@ -333,7 +334,7 @@ class Transitions: def get_transition(self, i): return self.__transitions[i] - def get_transition_array(self): + def get_transitiosn_array(self): return self.__transitions ## Model