Arrows readable. Got a space soon

This commit is contained in:
Adrien Bourmault 2021-09-19 19:13:10 +02:00
parent c26ad4d3e9
commit e910a2958f
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
3 changed files with 89 additions and 14 deletions

View File

@ -24,13 +24,10 @@
</modelization> </modelization>
<space_param> <space_param>
<dimension value="1"/> <!-- TODO redundancy here: dimension is given by the zero values of z and y--> <dimension value="1"/>
<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--> <size x="39" y="0" z="0"/>
<site_multiplicity value="2"/> <!-- Indicates that there are two sites per cell--> <site_multiplicity value="2"/> <!-- Indicates that there are two sites per cell-->
<boundaries/> <!-- TODO a proposition for boundaries encoding: --> <boundaries/> <!-- TODO -->
<!-- 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_param> </space_param>
@ -39,13 +36,13 @@
<!-- Model objects definition --> <!-- Model objects definition -->
<objects> <objects>
<object id="dimer" date="1629830000" author="Jean Sirmai"> <object id="dimer" date="1629830000" author="Jean Sirmai">
<!-- 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.-->
<arrow x="0" y="0" z="0" site="0" weight="0"/> <arrow x="0" y="0" z="0" site="0" weight="0"/>
<arrow x="0" y="0" z="0" site="1" weight="1"/> <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="0" weight="1"/>
<arrow x="1" y="0" z="0" site="1" weight="0"/> <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> </object>
@ -64,7 +61,7 @@
</space> </space>
<!-- Saved space description (saved states) --> <!-- Saved space description (saved states) -->
<savestates id="test" date="1629830000" author="Jean Sirmai"> <!-- TODO or NOT TODO (not today...)--> <savestates id="test" date="1629830000" author="Jean Sirmai">
<space id="test" date="1629830000" author="Jean Sirmai"> <space id="test" date="1629830000" author="Jean Sirmai">
</space> </space>
@ -95,10 +92,10 @@
</transitions> </transitions>
<!-- Non context-specific tags --> <!-- Non context-specific tags -->
<ref id="Best reference!" date="1629830000" author="Jean Sirmai" lang=""> <ref id="Best reference!" date="1629830000" author="Jean Sirmai" lang="fr">
https://www.a-lec.org https://www.a-lec.org
</ref> </ref>
<quote id="Best quote" date="1629830000" author="Jean Sirmai" lang=""> <quote id="Best quote" date="1629830000" author="Jean Sirmai" lang="fr">
This is a quote. This is a quote.
</quote> </quote>

View File

@ -166,7 +166,7 @@ struct Model_t {
char *version; char *version;
char *filename; char *filename;
// Parameters // Parameters
int space_xMax; int space_xMax; // TODO more than 3 dimension ?
int space_yMax; int space_yMax;
int space_zMax; int space_zMax;
int nmaxThread; int nmaxThread;

View File

@ -63,6 +63,84 @@ int parseStubFieldXML (xmlDocPtr doc,
return 0; return 0;
} }
// -------------------------------------------------------------------------- //
// Parsing an arrow (but yeah that prints) //
// -------------------------------------------------------------------------- //
int parseArrowFieldXML (xmlDocPtr doc,
ModelParserTableXML_t *ModelTable,
int currentParser,
xmlNodePtr currentNode)
{
xmlChar *x, *y, *z;
x = xmlGetProp(currentNode, (xmlChar*)"x");
y = xmlGetProp(currentNode, (xmlChar*)"x");
z = xmlGetProp(currentNode, (xmlChar*)"x");
// Detect children
if (currentNode->xmlChildrenNode) {
printLog("%s (stub) has children\n",
ModelTable->table[currentParser].tag);
}
printLog("%s: x:%s, y:%s, z:%s\n", ModelTable->table[currentParser].tag,
x, y, z);
if (!x || !y || !z) {
xmlFree(x);
xmlFree(y);
xmlFree(z);
return -1;
}
// TODO create arrow in model
xmlFree(x);
xmlFree(y);
xmlFree(z);
return 0;
}
// -------------------------------------------------------------------------- //
// Parsing an arrow (but yeah that prints) //
// -------------------------------------------------------------------------- //
int parseSpaceSizeFieldXML (xmlDocPtr doc,
ModelParserTableXML_t *ModelTable,
int currentParser,
xmlNodePtr currentNode)
{
xmlChar *x, *y, *z;
x = xmlGetProp(currentNode, (xmlChar*)"x");
y = xmlGetProp(currentNode, (xmlChar*)"x");
z = xmlGetProp(currentNode, (xmlChar*)"x");
// Detect children
if (currentNode->xmlChildrenNode) {
printLog("%s (stub) has children\n",
ModelTable->table[currentParser].tag);
}
printLog("%s: x:%s, y:%s, z:%s\n", ModelTable->table[currentParser].tag,
x, y, z);
if (!x || !y || !z) {
xmlFree(x);
xmlFree(y);
xmlFree(z);
return -1;
}
// TODO store space size and creates it
xmlFree(x);
xmlFree(y);
xmlFree(z);
return 0;
}
// -------------------------------------------------------------------------- // // -------------------------------------------------------------------------- //
// Parsing a text field // // Parsing a text field //
// -------------------------------------------------------------------------- // // -------------------------------------------------------------------------- //
@ -267,7 +345,7 @@ int ParseModelXML(Model_t *model)
{(const xmlChar *)"then", parseParentFieldXML, model}, {(const xmlChar *)"then", parseParentFieldXML, model},
// ARROW // ARROW
{(const xmlChar *)"arrow", parseStubFieldXML, model}, {(const xmlChar *)"arrow", parseArrowFieldXML, model},
// REF // REF
{(const xmlChar *)"ref", parseStubFieldXML, model}, {(const xmlChar *)"ref", parseStubFieldXML, model},