commit 4897b75e4babb914d7c34d3bba4e468910bbe681
parent 14af57f70adbbaabdc1c16de7b7ed5dbe524c206
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 28 Sep 2017 12:25:54 +0200
Rename the 'theta_max' pillbox parameter in half_angle
Diffstat:
6 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/doc/solstice-input.5.txt b/doc/solstice-input.5.txt
@@ -253,7 +253,7 @@ _______
csr: REAL # in [1e-6, 0.849]
<pillbox> ::= pillbox:
- theta_max: REAL # in ]0, 90]
+ half_angle: REAL # in ]0, 90]
----------------------------------------
@@ -318,8 +318,8 @@ shapes are:
*pillbox*::
The *pillbox* distribution defines an uniform intensity over the sun's disk.
- Its single *theta_max* parameter is the sun's disk half-angle in degrees, that
- is linked to the apparent size of the sun. A typical theta_max is 0.2664.
+ Its single *half_angle* parameter is the sun's disk half-angle in degrees, that
+ is linked to the apparent size of the sun. A typical half_angle is 0.2664.
*buie*::
The *buie* distribution, as first discribed in [3]. Its single *csr*
@@ -877,12 +877,12 @@ is 1 and its center is positioned at {0,0,2}:
.......
Define a circular diffuse reflector surrounded by a virtual sphere and a
-pillbox-shaped sun whose theta_max is 0.1 degree. Use anchors and tags of the
+pillbox-shaped sun whose *half_angle* is 0.1 degree. Use anchors and tags of the
YAML format to reference into the entities a pre-declared geometry. Rely on
the YAML compact notation to reduce the number of lines required to describe
the scene:
.......
-- sun: {dni: 1000, pillbox: {theta_max: 0.1}}
+- sun: {dni: 1000, pillbox: {half_angle: 0.1}}
- geometry: &small-circle
- material: {matte: {reflectivity: 1}}
diff --git a/src/parser/solparser_sun.c b/src/parser/solparser_sun.c
@@ -93,7 +93,7 @@ parse_pillbox
const yaml_node_t* pillbox,
struct solparser_sun_pillbox* sun)
{
- enum { THETA_MAX };
+ enum { HALF_ANGLE };
intptr_t i, n;
int mask = 0; /* Register the parsed attributes */
res_T res = RES_OK;
@@ -118,14 +118,14 @@ parse_pillbox
res = RES_BAD_ARG;
goto error;
}
- if(!strcmp((char*)key->data.scalar.value, "theta_max")) {
- if(mask & BIT(THETA_MAX)) {
- log_err(parser, key, "the pillbox `theta_max' is already defined.\n");
+ if(!strcmp((char*)key->data.scalar.value, "half_angle")) {
+ if(mask & BIT(HALF_ANGLE)) {
+ log_err(parser, key, "the pillbox `half_angle' is already defined.\n");
res = RES_BAD_ARG;
goto error;
}
- mask |= BIT(THETA_MAX);
- res = parse_real(parser, val, nextafter(0, 1), 90, &sun->theta_max);
+ mask |= BIT(HALF_ANGLE);
+ res = parse_real(parser, val, nextafter(0, 1), 90, &sun->half_angle);
} else {
log_err(parser, pillbox, "unknown pillbox parameter `%s'.\n",
key->data.scalar.value);
@@ -138,8 +138,8 @@ parse_pillbox
}
}
- if(!(mask & BIT(THETA_MAX))) {
- log_err(parser, pillbox, "the pillbox theta_max parameter is missing.\n");
+ if(!(mask & BIT(HALF_ANGLE))) {
+ log_err(parser, pillbox, "the pillbox half_angle parameter is missing.\n");
res = RES_BAD_ARG;
goto error;
}
diff --git a/src/parser/solparser_sun.h b/src/parser/solparser_sun.h
@@ -26,7 +26,7 @@ enum solparser_sun_radang_distrib_type { /* Radial Angular distribution */
};
struct solparser_sun_buie { double csr; };
-struct solparser_sun_pillbox { double theta_max; };
+struct solparser_sun_pillbox { double half_angle; };
struct solparser_sun {
double dni; /* In ]0, INF) */
diff --git a/src/parser/yaml/test_ko_0.yaml b/src/parser/yaml/test_ko_0.yaml
@@ -72,26 +72,26 @@
#
# <pillbox> ::=
# pillbox:
-# aperture: REAL # in ]0, 90]
+# half_angle: REAL # in ]0, 90]
#
# missing pillbox definition
- sun: { pillbox: }
---
-# missing aperture value
-- sun: { pillbox: { aperture: } }
+# missing half_angle value
+- sun: { pillbox: { half_angle: } }
---
-# aperture should be a number
-- sun: { pillbox: { aperture: "dummy"} }
+# half_angle should be a number
+- sun: { pillbox: { half_angle: "dummy"} }
---
# 0 invalid
-- sun: { pillbox: { aperture: 0} }
+- sun: { pillbox: { half_angle: 0} }
---
# 91 invalid
-- sun: { pillbox: { aperture: 91} }
+- sun: { pillbox: { half_angle: 91} }
---
-# 2x aperture
-- sun: { pillbox: { aperture: 1, aperture: 1} }
+# 2x half_angle
+- sun: { pillbox: { half_angle: 1, half_angle: 1} }
---
# unknown dummy parameter
- sun: { pillbox: { dummy: 1} }
@@ -152,7 +152,7 @@
---
# 2x radial-angular-distribution
- sun:
- pillbox: { aperture: 1}
+ pillbox: { half_angle: 1}
buie: { csr: 0.5}
---
diff --git a/src/parser/yaml/test_ok_1.yaml b/src/parser/yaml/test_ok_1.yaml
@@ -38,7 +38,10 @@
primary: 0
geometry: *cylinder
---
-- sun: { dni: 1, spectrum: [{wavelength: 1, data: 1}] }
+- sun:
+ dni: 1
+ pillbox: {half_angle: 0.064}
+
- entity:
name: entity
primary: 1
diff --git a/src/solstice_sun.c b/src/solstice_sun.c
@@ -105,10 +105,10 @@ create_sun_pillbox
goto error;
}
- res = ssol_sun_pillbox_set_theta_max
- (sun, MDEG2RAD(solparser_sun->radang_distrib.pillbox.theta_max));
+ res = ssol_sun_pillbox_set_half_angle
+ (sun, MDEG2RAD(solparser_sun->radang_distrib.pillbox.half_angle));
if(res != RES_OK) {
- fprintf(stderr, "Could not setup theta_max for the solver pillbox sun.\n");
+ fprintf(stderr, "Could not setup half_angle for the solver pillbox sun.\n");
goto error;
}