commit 7ab28f8e0eb1b9720a6a432ff3866a5c4d99c4fa
parent 234fa63a889def80fee455b0e0303891762da95f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 30 Nov 2016 10:18:33 +0100
Update the input fileformat
Replace the "entity-template" item keyword by "template"
Diffstat:
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/doc/input b/doc/input
@@ -40,7 +40,7 @@
- cylinder: { height: 5, radius: 0.5 }
material: *mirror
-- entity-template: &composition
+- template: &composition
name: "composition"
transform: { translation: [1, 2, 3 ] }
geometry:
@@ -87,7 +87,7 @@
<geometry>
| <material>
| <entity>
- | <entity-template>
+ | <template>
| <sun>
----------------------------------------
@@ -204,8 +204,8 @@
entity:
<entity-data>
-<entity-template> ::=
- entity-template:
+<template> ::=
+ template:
<entity-data>
<entity-data> ::=
diff --git a/src/parser/solstice_parser.c b/src/parser/solstice_parser.c
@@ -2842,8 +2842,10 @@ parse_item
res = parse_material(parser, doc, val, &mtl2);
} else if(!strcmp((char*)key->data.scalar.value, "entity")) {
res = parse_entity(parser, doc, val, &parser->str2entities, &entity);
- } else if(!strcmp((char*)key->data.scalar.value, "entity-template")) {
- /* Deferred the parsing */
+ } else if(!strcmp((char*)key->data.scalar.value, "template")) {
+ /* The parsing of the template data is deferred to its explicit used in the
+ * definition of an entity. If the parsing of the template becomes a
+ * bottleneck, parse the data only once here and cache them for reuse. */
} else if(!strcmp((char*)key->data.scalar.value, "geometry")) {
res = parse_geometry(parser, doc, val, &geometry);
} else if(!strcmp((char*)key->data.scalar.value, "sun")) {
diff --git a/src/parser/test_solstice_parser4.c b/src/parser/test_solstice_parser4.c
@@ -27,7 +27,7 @@ static const char* input[] = {
"- geometry: &cuboid\n",
" - cuboid: { size: [1, 2, 3] }\n",
" material: *lambertian\n",
- "- entity-template: &template\n",
+ "- template: &template\n",
" name: template0\n",
" geometry: *cuboid\n",
"- entity:\n",
diff --git a/src/parser/yaml/test_ok_3.yaml b/src/parser/yaml/test_ok_3.yaml
@@ -11,7 +11,7 @@
material: *lambertian
transform: { translation: [ 1, 2, 3 ] }
-- entity-template: &template
+- template: &template
name: "template"
geometry: *geom
children:
@@ -19,7 +19,7 @@
geometry: *geom
transform: { rotation: [1, 2, 3] }
-- entity-template: &template2
+- template: &template2
name: "template2"
transform: { translation: [ -1.0E-6, -2.e-6, -3.e-6 ] }
children: [ *template ]