star-phor-input

File format for describing photoreactor configurations
git clone https://www.edstar.cnrs.fr/git/star-phor-input.git
Log | Files | Refs | README | LICENSE

commit 100a169767e29adb5b1e29b3e494d79f9dddd3cd
parent 103fe1e5906610a0dfbf16054c13ba9e87714fd5
Author: Eduardo Fontana Lazzari <edufonlaz@gmail.com>
Date:   Tue,  4 Mar 2025 19:12:13 +0100

Extend sphin API with new functions

Diffstat:
M.gitignore | 1+
MMakefile | 2+-
Msrc/sphin.h | 10++++++++++
Msrc/sphin_brdf.c | 1+
Msrc/sphin_config.c | 1-
Msrc/sphin_geometry.c | 2+-
Msrc/sphin_sensor.c | 11+++++++++++
Msrc/sphin_sensor.h | 6+++---
Msrc/sphin_surface.c | 2+-
Msrc/sphin_volume.c | 12++++++++++++
10 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -6,6 +6,7 @@ file.txt *.pc *.so *.swp +*.stl tags test_sphin test_sphin_load_volume diff --git a/Makefile b/Makefile @@ -92,7 +92,7 @@ uninstall: clean: clean_test rm -f file.txt sphin-local.pc sphin.pc .test test_0.stl test_1.stl test_2.stl test_3.stl - rm -f $(OBJ) $(LIBNAME) $(TEST_OBJ) $(DEP) .config + rm -f $(OBJ) $(LIBNAME) $(TEST_OBJ) $(TEST_DEP) $(DEP) .config ################################################################################ diff --git a/src/sphin.h b/src/sphin.h @@ -279,6 +279,11 @@ SPHIN_API res_T sphin_volume_get_ka (struct sphin_volume* volume, double* ka); + +SPHIN_API res_T +sphin_volume_get_sensor +(struct sphin_volume* volume, + struct sphin_sensor** sensor); /******************************************************************************* * API of the surface ******************************************************************************/ @@ -359,6 +364,11 @@ SPHIN_API res_T sphin_sensor_ref_put (struct sphin_sensor* sensor); +SPHIN_API res_T +sphin_sensor_get_response_function + (struct sphin_sensor* sensor, + double* response_function); + /******************************************************************************* * API of the geometry ******************************************************************************/ diff --git a/src/sphin_brdf.c b/src/sphin_brdf.c @@ -137,6 +137,7 @@ parse_brdf brdf->specular.reflectivity = reflectivity; break; default: FATAL("Unreachable code\n"); break; + } exit: diff --git a/src/sphin_config.c b/src/sphin_config.c @@ -160,7 +160,6 @@ load_stream token = strtok_r(str_get(&line), ":", &token_ptr); keyword = trim_keyword(token); if (NULL == keyword){ res = RES_BAD_ARG; goto error; } - /* parse value (name) */ token = strtok_r(NULL, "", &token_ptr); if (NULL == token){ res = RES_BAD_ARG; goto error; } diff --git a/src/sphin_geometry.c b/src/sphin_geometry.c @@ -104,12 +104,12 @@ geometry_parse char* side = NULL; char* filename = NULL; char* token_ptr = NULL; - res_T res = RES_OK; struct sphin_geometry* geom = NULL; struct sstl* sstl = NULL; struct sstl_desc sstl_desc; double* coords = NULL; size_t* indices = NULL; + res_T res = RES_OK; /* Create the SSTL device using the same allocator and logger as the sphin * handler. We intentionally instantiate and free the SSTL struct for diff --git a/src/sphin_sensor.c b/src/sphin_sensor.c @@ -211,3 +211,14 @@ sphin_sensor_ref_put(struct sphin_sensor* sensor) ref_put(&sensor->ref, release_sensor); return RES_OK; } + +res_T +sphin_sensor_get_response_function + (struct sphin_sensor* sensor, + double* response_function) +{ + if (NULL == sensor){ return RES_BAD_ARG; } + + *response_function = sensor->response_function; + return RES_OK; +} diff --git a/src/sphin_sensor.h b/src/sphin_sensor.h @@ -22,8 +22,8 @@ * 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 SPHIN_SOURCE_H -#define SPHIN_SOURCE_H +#ifndef SPHIN_SENSOR_H +#define SPHIN_SENSOR_H #include <rsys/rsys.h> @@ -37,4 +37,4 @@ parse_sensor const char* name, struct sphin_sensor** out_sensor); -#endif /* SPHIN_SOURCE */ +#endif /* SPHIN_SENSOR */ diff --git a/src/sphin_surface.c b/src/sphin_surface.c @@ -210,7 +210,7 @@ parse_surface } else if (0 == strcmp(keyword, "source")) { token = trim_string(token); - // res = parse_source(surface->sphin, txtrdr, name, &surface->source); + res = parse_source(surface->sphin, txtrdr, name, &surface->source); } else if (0 == strcmp(keyword, "sensor")) { token = trim_string(token); diff --git a/src/sphin_volume.c b/src/sphin_volume.c @@ -306,3 +306,15 @@ sphin_volume_get_ka *ka = volume->ka; return RES_OK; } + +res_T +sphin_volume_get_sensor + (struct sphin_volume* volume, + struct sphin_sensor** sensor) +{ + if (NULL == volume) { + return RES_BAD_ARG; + } + *sensor = volume->sensor; + return RES_OK; +}