WIP : a first approach of space data strucures.
This commit is contained in:
parent
f068ca6731
commit
0fd3966433
|
@ -34,7 +34,7 @@
|
|||
<!-- Each site points towards a neighbouring space unit. -->
|
||||
<!-- Several arrows can be stacked in the same site. -->
|
||||
|
||||
<site_multiplicity>3</site_multiplicity>
|
||||
<site_multiplicity>6</site_multiplicity>
|
||||
|
||||
</space-param>
|
||||
|
||||
|
@ -55,15 +55,18 @@
|
|||
|
||||
<states id="texte" date="1630000000" author="Here, states are spaces.">
|
||||
<space id="initial" date="1630000000" author="Une souris verte,">
|
||||
<arrow site="0" weight="8" x="0"/>
|
||||
<arrow site="1" weight="1" x="0"/>
|
||||
<arrow site="2" weight="1" x="1"/>
|
||||
<arrow site="1" weight="1" x="10"/>
|
||||
<arrow site="2" weight="1" x="11"/>
|
||||
<arrow site="1" weight="1" x="20"/>
|
||||
<arrow site="2" weight="1" x="21"/>
|
||||
<arrow site="2" weight="7" x="1"/>
|
||||
<arrow site="1" weight="1" x="6"/>
|
||||
<arrow site="2" weight="1" x="7"/>
|
||||
<arrow site="1" weight="8" x="15"/>
|
||||
<arrow site="2" weight="1" x="16"/>
|
||||
<arrow site="1" weight="9" x="28"/>
|
||||
<arrow site="5" weight="9" x="29"/>
|
||||
|
||||
<!-- Three dimers 1-1 are drawn in the global space
|
||||
at locations (0,1) (10,11) and (20,21) -->
|
||||
at locations (0,1) (6,7) and (15,16) -->
|
||||
|
||||
</space>
|
||||
|
||||
|
|
Binary file not shown.
|
@ -5,30 +5,41 @@ 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())
|
||||
|
||||
space = []
|
||||
cells = []
|
||||
sites = []
|
||||
weights = []
|
||||
arrows = []
|
||||
extremite = 1
|
||||
|
||||
for x in range (0, nb_arrows):
|
||||
arrows.append(sp.get_arrow(x).get_coord("x"))
|
||||
sites.append(sp.get_arrow(x).get_site())
|
||||
weights.append(sp.get_arrow(x).get_weight())
|
||||
|
||||
for i in range (0, (size + 1) * (nb_sites + 1) + extremite): space.append(0)
|
||||
|
||||
print()
|
||||
# print (sites)
|
||||
print("space size = ", size, " nb de sites par cellule = ", nb_sites,
|
||||
" nb total de flèches dans l'espace = ", nb_arrows)
|
||||
print()
|
||||
print (sites)
|
||||
print (weights)
|
||||
print (arrows)
|
||||
print()
|
||||
|
||||
for i in range (0, size + 1): cells.append('')
|
||||
for i in range (0,121): space.append(0)
|
||||
|
||||
for i in range (0, size + nb_sites - 1):
|
||||
if i <= size + extremite: # ad hoc ! (j'en conviens...)
|
||||
space[i * (nb_sites + 1)] = ''
|
||||
for k in range (0, nb_arrows):
|
||||
if arrows[k] == i:
|
||||
cells[i] = i # cette cellule contient au moins une flèche
|
||||
space[i * (nb_sites + 1) + sites[k] + 1] = 1 # nombre de flèches dans ce site
|
||||
space[i * (nb_sites + 1) + sites[k] + 1] = weights[k]
|
||||
# nombre de flèches dans ce site
|
||||
|
||||
print (cells)
|
||||
print()
|
||||
|
|
Loading…
Reference in New Issue