51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
import model
|
|
|
|
sp = model.testmodel.get_states().get_space(0)
|
|
size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x()
|
|
sites = int(model.testmodel.get_parameters().spaceparam.get_site_multiplicity())
|
|
nb_arrows = int(model.testmodel.get_states().get_space(0).get_nb_arrows())
|
|
|
|
|
|
print("\n space size = ", size, " nb de sites par cellule = ", sites,
|
|
" nb total de flèches dans l'espace = ", nb_arrows)
|
|
|
|
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
|
|
|
|
|
|
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 ' + ' ' * sites * 2, end='')
|
|
|
|
|
|
for k in range(0, size + 1):
|
|
if k < 9:
|
|
print(k + 1, end=' ' + ' ' * sites * 2)
|
|
else:
|
|
print(k + 1, end=' ' + ' ' * sites * 2)
|
|
|
|
print('\n', end = "")
|
|
|