diff --git a/models/dimers random walk.xml b/models/dimers random walk.xml index 299346b..4311d2e 100644 --- a/models/dimers random walk.xml +++ b/models/dimers random walk.xml @@ -57,16 +57,21 @@ + + + + - + + diff --git a/src/__pycache__/model.cpython-39.pyc b/src/__pycache__/model.cpython-39.pyc index 7f96f55..c5cff16 100644 Binary files a/src/__pycache__/model.cpython-39.pyc and b/src/__pycache__/model.cpython-39.pyc differ diff --git a/src/glimpse.py b/src/glimpse.py index f175303..3c5030f 100644 --- a/src/glimpse.py +++ b/src/glimpse.py @@ -1,4 +1,6 @@ import model + +""" # from anytree import Node, AnyNode, NodeMixin, RenderTree, find_by_attr # from anytree.exporter import DotExporter from ete3 import Tree @@ -67,7 +69,7 @@ for i in lll: ## -""" + A = Node("A") A1 = Node("A1", parent=A) A2 = Node("A2", parent=A) @@ -95,7 +97,7 @@ with open('input.txt', 'r') as f: for pre, _, node in RenderTree(root): print("%s%s" % (pre, node.name)) -""" + ## @@ -105,7 +107,7 @@ print("\n") print(model.testmodel.get_conditions().get_condition(0).get_coord('x')) print("\n") print() - +""" sp = model.testmodel.get_states().get_space(0) size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x() @@ -113,7 +115,7 @@ 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 = ", sites, +print("\n space size = ", size, " nb de sites par cellule = ", sites, " nb total de flèches dans l'espace = ", nb_arrows) print(' | ', end=' ') @@ -152,3 +154,24 @@ for k in range(0, size + 1): print(k + 1, end=' ' + ' ' * sites * 2) else: print(k + 1, end=' ' + ' ' * sites * 2) + +print('\n', ' | ', end = "") + +for n in range(0, size + 1): + for s in range(0, sites): + arr = 0 + for a in range(0, nb_arrows): + if ( + sp.get_arrow(a).get_coord("x") == n + and sp.get_arrow(a).get_site() == s + ): + arr = sp.get_arrow(a).get_weight() + if arr > 0: + print(str(arr), end=' ') + else: + print('.', end=' ') + + print(' | ', end=' ') + +print('\n\n', model.testmodel.get_space(0, 0, 0)) + diff --git a/src/model.py b/src/model.py index 289f39c..0997c05 100644 --- a/src/model.py +++ b/src/model.py @@ -268,6 +268,9 @@ class Space: def get_nb_arrows(self): return self.nb_arrows + def get_weight(self, cell, site): + return 4096 + class States: __space = [] @@ -442,6 +445,9 @@ class Model: if(child.tag == "transitions"): self.__transitions = child + def get_space(self, space_id, x_val, site_val): + return testmodel.get_states().get_space(space_id).get_weight(x_val, site_val) + def get_identity(self): return Identity(self.__identity) @@ -467,8 +473,8 @@ class Model: self.tree.write("../models/" + name + ".xml", encoding="utf-8") -modelPath = "../models/dimers random walk.automat.xml" -schemaPath = "../schemas/models_0.2.1.automat.xmls" +modelPath = "../models/dimers random walk.xml" +schemaPath = "../schemas/models_0.2.1.xmls" testmodel = Model(modelPath, schemaPath)