commit 78550d4bf7830c8c1db643f79b393c8334be39ea
parent ac075b7a5d6c7be763d0128c1eae6c1f5fa34a2b
Author: Eduardo Fontana Lazzari <edufonlaz@gmail.com>
Date: Fri, 16 Jan 2026 17:27:30 +0100
Test: ensure config definition follows the sphin rules
Star-phor-input has evolved to handle spectral property descriptions.
This commit makes the photoreactor configuration used in
test_sphor_lib.c compliant with the new rules by adding a simple
emission spectrum to the source defined in this file.
Diffstat:
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -3,6 +3,7 @@
.config
.test
file.txt
+spec.txt
*.pc
*.so
*.swp
diff --git a/Makefile b/Makefile
@@ -219,5 +219,5 @@ test_sphor_lib\
$(CC) $(CFLAGS_TEST) -o $@ src/$@.o $(LDFLAGS_TEST)
clean_test:
- rm -f $(TEST_DEP) $(TEST_OBJ) $(TEST_TGT) input cube.stl
+ rm -f $(TEST_DEP) $(TEST_OBJ) $(TEST_TGT) input cube.stl spec.txt
for i in $(TEST_SRC); do rm -f "$$(basename "$${i}" ".c")"; done
diff --git a/src/test_sphor_lib.c b/src/test_sphor_lib.c
@@ -82,16 +82,32 @@ write_cube(const char* filename)
}
static void
+write_spectral_file(const char* filename)
+{
+ FILE* fp = NULL;
+
+ fp = fopen(filename, "w");
+ CHK(NULL != fp);
+
+ fprintf(fp, "100 1\n");
+ fprintf(fp, "1000 1\n");
+ CHK(fclose(fp) == 0);
+}
+
+
+static void
write_input_file(FILE* fp)
{
const char* geom_filename = "cube.stl";
+ const char* spectral_filename = "spec.txt";
write_cube(geom_filename);
+ write_spectral_file(spectral_filename);
fprintf(fp, "surface: \"test surface\"\n");
fprintf(fp, "\tgeometry: BACK %s\n", geom_filename);
fprintf(fp, "\tsource:\t #commentaire\n");
- fprintf(fp, "\tflux_density: 1e3 umol/m^2/s\t\n");
+ fprintf(fp, "\tflux_density: 1e3 umol/m^2/s spec.txt nm nm^-1\t\n");
fprintf(fp, "\tdirection: COLLIM NORMAL\n");
CHK(fflush(fp) == 0);
}