Merge branch 'master' of git.a-lec.org:gem-graph/gem-graph-server

This commit is contained in:
Adrien Bourmault 2021-09-16 21:30:49 +02:00
commit 1342b445af
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
2 changed files with 121 additions and 1 deletions

120
debian/var/models/example_II.xml vendored Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- TODO DTD or XML Schema-->
<gem-graph-model version="0.1">
<!-- Model identity informations -->
<identity>
<name>Modèle de test</name>
<author>Adrien Bourmault, Jean Sirmai</author>
<author_id>1,2</author_id>
<date>1629830000</date> <!--Warning: it's an arbitrary unchecked date...-->
<version>1.0</version>
</identity>
<!-- Model parameters -->
<parameters id="" date="" author="">
<modelization>
<max_thread value="0"/> <!--Why "0" ?-->
<max_cycles value="13"/>
</modelization>
<space>
<dimension value="1"/> <!-- TODO redundancy here: dimension is given by the zero values of z and y-->
<size x="39" y="0" z="0"/> <!-- In this example of random walk, I wish I could see the whole space in a single line of the monitoring CLI-->
<site_multiplicity value="2"/> <!-- Indicates that there are two sites per cell-->
<boundaries/> <!-- TODO a proposition for boundaries encoding: -->
<!-- X="00" no boundaries X="||" boundaries west and east X="|0" boundary west only X="0|" boundary east-->
<!-- X="|0" indicates that: a particle which moves beyond the east boundary will reenter on the west side-->
<!-- X="|0" : no particle can move beyond the west boundary-->
</space>
</parameters>
<!-- Model objects definition -->
<objects>
<object id="dimer" date="" author="">
<arrow x="0" y="0" z="0" site="0" weight="0"/>
<arrow x="0" y="0" z="0" site="1" weight="1"/>
<arrow x="1" y="0" z="0" site="0" weight="1"/>
<arrow x="1" y="0" z="0" site="1" weight="0"/>
<!-- A dimer is made of two linked adjacent particles.-->
<!-- Site 1 of particle 0 points at east to next particle.-->
<!-- Site 0 of particle 1 points at west to previous particle.-->
</object>
</objects>
<!-- Space description (initial state) -->
<space id="" date="" author="">
<arrow x="0" y="0" z="0" site="1" weight="1"/>
<arrow x="1" y="0" z="0" site="0" weight="1"/>
<arrow x="10" y="0" z="0" site="1" weight="1"/>
<arrow x="11" y="0" z="0" site="0" weight="1"/>
<arrow x="20" y="0" z="0" site="1" weight="1"/>
<arrow x="21" y="0" z="0" site="0" weight="1"/>
<!-- three dimers have been defined-->
</space>
<!-- Saved space description (saved states) -->
<savestates id="" date="" author=""> <!-- TODO or NOT TODO (not today...)-->
<space id="" date="">
</space>
</savestates>
<!-- Model transitions definition (rules) -->
<transitions id="" date="" author="">
<transition id="0" date="" author="" probability="1"> <!-- moves a dimer to east-->
<if>
<arrow x="0" y="0" z="0" site="1" weight="1"/>
<arrow x="1" y="0" z="0" site="0" weight="1"/> <!-- a dimer is identified-->
<!-- the local space origin is its "west" particule-->
<arrow x="2" y="0" z="0" site="1" weight="0"/> <!-- the east location next this dimer is empty-->
<arrow x="3" y="0" z="0" site="0" weight="0"/> <!-- In this very simple model, I do not need to check this condition-->
</if>
<then> <!-- Therefore I can (and I want to) move it to its next east location-->
<arrow x="0" y="0" z="0" site="1" weight="0"/>
<arrow x="1" y="0" z="0" site="0" weight="0"/> <!-- The identified dimer no more exists ( :-(( -->
<arrow x="1" y="0" z="0" site="1" weight="1"/>
<arrow x="2" y="0" z="0" site="0" weight="1"/> <!-- Happily, it is now rebuilt at its east location ( ;-))-->
</then>
</transition>
<transition id="0" date="" author="" probability="1"> <!-- moves a dimer to west-->
<if>
<arrow x="0" y="0" z="0" site="1" weight="1"/>
<arrow x="1" y="0" z="0" site="0" weight="1"/> <!-- a dimer is identified-->
<!-- the local space origin is its "east" particule-->
<arrow x="-1" y="0" z="0" site="0" weight="0"/> <!-- the west location next this dimer is empty-->
<arrow x="-2" y="0" z="0" site="1" weight="0"/> <!-- In this very simple model, I do not need to check this condition-->
</if>
<then> <!-- Therefore I can (and I want to) move it to its next west location-->
<arrow x="0" y="0" z="0" site="1" weight="0"/>
<arrow x="1" y="0" z="0" site="0" weight="0"/> <!-- The identified dimer no more exists ( :-(( -->
<arrow x="0" y="0" z="0" site="0" weight="1"/>
<arrow x="-1" y="0" z="0" site="1" weight="1"/> <!-- Happily, it is now rebuilt at its west location ( ;-))-->
</then>
</transition>
</transitions>
<!-- Non context-specific tags -->
<ref id="" date="">https://www.a-lec.org</ref>
<quote id="" date="" author="" lang="">Quote</quote>
</gem-graph-model>

View File

@ -293,7 +293,7 @@ void ModelSystemInit(Parameters_t *parameters)
// Ask to parse the new model // Ask to parse the new model
if (ParseModelXML(newModel) != 0) { if (ParseModelXML(newModel) != 0) {
ModelDelete(newModel->id); ModelDelete(newModel->id);
continue; continue;XMAX
}; };
// Check model is valid and/or parsed // Check model is valid and/or parsed