commit 569b918122248322ae9741c8870f7548413a1b05
parent 9066c8cbf9cc15b7292628991d054562649184b1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 23 May 2017 16:13:54 +0200
Minor fix of how the parsed atmoshpere is managed
Diffstat:
5 files changed, 52 insertions(+), 46 deletions(-)
diff --git a/src/parser/solparser.c b/src/parser/solparser.c
@@ -291,6 +291,9 @@ parser_release(ref_T* ref)
/* Sun */
solparser_sun_release(&parser->sun);
+ /* Atmosphere */
+ solparser_atmosphere_release(&parser->atmosphere);
+
/* Entities */
htable_str2sols_release(&parser->str2entities);
darray_entity_release(&parser->entities);
@@ -626,6 +629,9 @@ solparser_create
/* Sun */
solparser_sun_init(mem_allocator, &parser->sun);
+ /* Atmosphere */
+ solparser_atmosphere_init(mem_allocator, &parser->atmosphere);
+
/* Entities */
htable_str2sols_init(mem_allocator, &parser->str2entities);
darray_entity_init(mem_allocator, &parser->entities);
diff --git a/src/parser/solparser_atmosphere.c b/src/parser/solparser_atmosphere.c
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016-2017
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define _POSIX_C_SOURCE 200112L /* nextafter support */
@@ -19,8 +19,8 @@
#include <math.h> /* nextafter */
/*******************************************************************************
-* Local function
-******************************************************************************/
+ * Local function
+ ******************************************************************************/
res_T
parse_atmosphere
(struct solparser* parser,
@@ -68,14 +68,14 @@ parse_atmosphere
res = RES_BAD_ARG;
goto error;
}
- #define SETUP_MASK(Flag, Name) { \
- if(mask & BIT(Flag)) { \
- log_err(parser, key, \
- "the "Name" of the atmosphere is already defined.\n"); \
- res = RES_BAD_ARG; \
- goto error; \
- } \
- mask |= BIT(Flag); \
+ #define SETUP_MASK(Flag, Name) { \
+ if(mask & BIT(Flag)) { \
+ log_err(parser, key, \
+ "the "Name" of the atmosphere is already defined.\n"); \
+ res = RES_BAD_ARG; \
+ goto error; \
+ } \
+ mask |= BIT(Flag); \
} (void)0
if(!strcmp((char*)key->data.scalar.value, "absorption")) {
SETUP_MASK(ABSORPTION, "absorption");
@@ -94,15 +94,15 @@ parse_atmosphere
#undef SETUP_MASK
}
- #define CHECK_PARAM(Flag, Name) \
- if(!(mask & BIT(Flag))) { \
- log_err(parser, atm, "the "Name" of the atmosphere is missing.\n"); \
- res = RES_BAD_ARG; \
- goto error; \
+ #define CHECK_PARAM(Flag, Name) \
+ if(!(mask & BIT(Flag))) { \
+ log_err(parser, atm, "the "Name" of the atmosphere is missing.\n"); \
+ res = RES_BAD_ARG; \
+ goto error; \
} (void)0
CHECK_PARAM(ABSORPTION, "absorption");
#undef CHECK_PARAM
-
+
exit:
*out_solatm = solatm;
return res;
diff --git a/src/parser/solparser_atmosphere.h b/src/parser/solparser_atmosphere.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016-2017
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SOLPARSER_ATMOSPHERE_H
#define SOLPARSER_ATMOSPHERE_H
@@ -27,7 +27,7 @@ solparser_atmosphere_init
(struct mem_allocator* allocator, struct solparser_atmosphere* atmosphere)
{
ASSERT(atmosphere);
- (void)allocator;
+ (void)allocator, (void)atmosphere;
/* Do nothing */
}
@@ -43,7 +43,9 @@ static INLINE void
solparser_atmosphere_clear(struct solparser_atmosphere* atmosphere)
{
ASSERT(atmosphere);
+ (void)atmosphere;
/* Do nothing */
}
+
#endif /* SOLPARSER_ATMOSPHERE_H */
diff --git a/src/parser/solparser_c.h b/src/parser/solparser_c.h
@@ -267,8 +267,7 @@ struct solparser {
struct solparser_sun sun; /* The loaded sun */
/* Atmosphere. Note that at most one atmosphere is supported */
- const yaml_node_t* atmosphere_key;
- /* yaml_node_t ptr used to spawn the atmosphere; can be NULL */
+ const yaml_node_t* atmosphere_key; /* ptr of the atmosphere. Can be NULL */
struct solparser_atmosphere atmosphere; /* The loaded atmosphere, if any */
/* Entity */
diff --git a/src/solstice_solve.c b/src/solstice_solve.c
@@ -478,7 +478,6 @@ solstice_solve(struct solstice* solstice)
goto error;
}
-
res = ssol_solve(solstice->scene, rng, solstice->nexperiments,
solstice->dump_paths ? &solstice->path_tracker : NULL, NULL, &estimator);
if(res != RES_OK) {