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>
<space_param>
<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-->
<dimension value="1"/>
<size x="39" y="0" z="0"/>
<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-->
<boundaries/> <!-- TODO -->
</space_param>
@ -39,13 +36,13 @@
<!-- Model objects definition -->
<objects>
<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="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>
@ -64,7 +61,7 @@
</space>
<!-- 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>
@ -95,10 +92,10 @@
</transitions>
<!-- 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
</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.
</quote>

View File

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

View File

@ -63,6 +63,84 @@ int parseStubFieldXML (xmlDocPtr doc,
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 //
// -------------------------------------------------------------------------- //
@ -267,7 +345,7 @@ int ParseModelXML(Model_t *model)
{(const xmlChar *)"then", parseParentFieldXML, model},
// ARROW
{(const xmlChar *)"arrow", parseStubFieldXML, model},
{(const xmlChar *)"arrow", parseArrowFieldXML, model},
// REF
{(const xmlChar *)"ref", parseStubFieldXML, model},