commit 7cb9951e904afd882f83891983a8d44e3c357dbd parent 64ab36de46d54413324dab33309e8b14dfc95760 Author: Christophe Coustet <christophe.coustet@meso-star.com> Date: Tue, 19 May 2026 16:33:38 +0200 Merge branch 'release_0.10' Diffstat:
80 files changed, 622 insertions(+), 334 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -1,12 +1,14 @@ -.gitignore -CMakeCache.txt -CMakeFiles -Makefile tmp [Bb]uild* *.sw[po] -*.[ao] +*.[aodt] *.orig +*.so *~ tags - +*.pc +test_ssol_* +!test_ssol_*.[ch] +src/ssol_version.h +src/.config +src/.config_test diff --git a/Makefile b/Makefile @@ -0,0 +1,294 @@ +# Copyright (C) 2016-2018 CNRS, 2018-2026 |Meso|Star> +# +# 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/>. + +.POSIX: +.SUFFIXES: # Clean up default inference rules + +include config.mk + +LIBNAME_STATIC = libssol.a +LIBNAME_SHARED = libssol.so +LIBNAME = $(LIBNAME_$(LIB_TYPE)) + +default: library +all: default tests + +################################################################################ +# Library building +################################################################################ +SRC =\ + src/ssol_atmosphere.c\ + src/ssol_camera.c\ + src/ssol_data.c\ + src/ssol_device.c\ + src/ssol_draw.c\ + src/ssol_draw_pt.c\ + src/ssol_draw_draft.c\ + src/ssol_estimator.c\ + src/ssol_image.c\ + src/ssol_material.c\ + src/ssol_mc_receiver.c\ + src/ssol_object.c\ + src/ssol_instance.c\ + src/ssol_param_buffer.c\ + src/ssol_ranst_sun_dir.c\ + src/ssol_ranst_sun_wl.c\ + src/ssol_scene.c\ + src/ssol_shape.c\ + src/ssol_spectrum.c\ + src/ssol_solver.c\ + src/ssol_sun.c +OBJ = $(SRC:.c=.o) +DEP = $(SRC:.c=.d) + +# Headers to configure +HDR=\ + src/ssol_version.h + +CFLAGS_LIB = $(CFLAGS_SO) $(INCS) -DSSOL_SHARED_BUILD +LDFLAGS_LIB = $(LDFLAGS_SO) $(LIBS) + +$(DEP) $(OBJ): src/.config + +library: $(DEP) + @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) \ + $$(if [ -n "$(LIBNAME)" ]; then \ + echo "$(LIBNAME)"; \ + else \ + echo "$(LIBNAME_SHARED)"; \ + fi) + +$(LIBNAME_SHARED): $(OBJ) + $(CC) $(CFLAGS_LIB) -o $@ $(OBJ) $(LDFLAGS_LIB) + +$(LIBNAME_STATIC): src/libssol.o + $(AR) -rc $@ $? + $(RANLIB) $@ + +src/libssol.o: $(DEP) $(OBJ) + $(LD) -r $(OBJ) -o $@ + $(OBJCOPY) $(OCPFLAGS) $@ + +src/.config: config.mk + $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys + $(PKG_CONFIG) --atleast-version $(S3D_VERSION) s3d + $(PKG_CONFIG) --atleast-version $(S3DUT_VERSION) s3dut + $(PKG_CONFIG) --atleast-version $(SCPR_VERSION) scpr + $(PKG_CONFIG) --atleast-version $(SSF_VERSION) ssf + $(PKG_CONFIG) --atleast-version $(SSP_VERSION) star-sp + @echo "config done" > $@ + +$(DEP) : $(HDR) + @$(CC) $(CFLAGS_LIB) -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ + +$(OBJ) : $(HDR) + $(CC) $(CFLAGS_LIB) -c $(@:.o=.c) -o $@ + +################################################################################ +# Installation +################################################################################ +pkg: src/ssol.pc + +src/ssol.pc: ssol.pc.in + sed -e 's#@PREFIX@#$(PREFIX)#g'\ + -e 's#@VERSION@#$(VERSION)#g'\ + -e 's#@RSYS_VERSION@#$(RSYS_VERSION)#g'\ + -e 's#@S3D_VERSION@#$(S3D_VERSION)#g'\ + -e 's#@S3DUT_VERSION@#$(S3DUT_VERSION)#g'\ + -e 's#@SCPR_VERSION@#$(SCPR_VERSION)#g'\ + -e 's#@SSF_VERSION@#$(SSF_VERSION)#g'\ + -e 's#@SSP_VERSION@#$(SSP_VERSION)#g'\ + ssol.pc.in > $@ + +src/ssol-local.pc: ssol.pc.in + sed -e '1d'\ + -e 's#^includedir=.*#includedir=./src/#'\ + -e 's#^libdir=.*#libdir=./#'\ + -e 's#@RSYS_VERSION@#$(RSYS_VERSION)#g'\ + -e 's#@S3D_VERSION@#$(S3D_VERSION)#g'\ + -e 's#@S3DUT_VERSION@#$(S3DUT_VERSION)#g'\ + -e 's#@SCPR_VERSION@#$(SCPR_VERSION)#g'\ + -e 's#@SSF_VERSION@#$(SSF_VERSION)#g'\ + -e 's#@SSP_VERSION@#$(SSP_VERSION)#g'\ + ssol.pc.in > $@ + +src/ssol_version.h: src/ssol_version.h.in + sed -e 's#@VERSION_MAJOR@#$(VERSION_MAJOR)#g' \ + -e 's#@VERSION_MINOR@#$(VERSION_MINOR)#g' \ + -e 's#@VERSION_PATCH@#$(VERSION_PATCH)#g' \ + src/ssol_version.h.in > $@ + +install: library pkg + install() { mode="$$1"; prefix="$$2"; shift 2; \ + mkdir -p "$${prefix}"; \ + cp "$$@" "$${prefix}"; \ + chmod "$${mode}" "$${prefix}/$${@##*/}"; \ + }; \ + if [ "$(LIB_TYPE)" = "STATIC" ]; then mode=644; else mode=755; fi; \ + install "$${mode}" "$(DESTDIR)$(LIBPREFIX)" $(LIBNAME); \ + install 644 "$(DESTDIR)$(LIBPREFIX)/pkgconfig" src/ssol.pc; \ + install 644 "$(DESTDIR)$(INCPREFIX)/solstice" src/ssol.h; \ + install 644 "$(DESTDIR)$(INCPREFIX)/solstice" src/ssol_version.h; \ + install 644 "$(DESTDIR)$(PREFIX)/share/doc/solstice-solver" COPYING; \ + install 644 "$(DESTDIR)$(PREFIX)/share/doc/solstice-solver" README.md + +uninstall: + rm -f "$(DESTDIR)$(LIBPREFIX)/$(LIBNAME)" + rm -f "$(DESTDIR)$(LIBPREFIX)/pkgconfig/ssol.pc" + rm -f "$(DESTDIR)$(INCPREFIX)/solstice/ssol.h" + rm -f "$(DESTDIR)$(INCPREFIX)/solstice/ssol_version.h" + rm -f "$(DESTDIR)$(PREFIX)/share/doc/solstice-solver/COPYING" + rm -f "$(DESTDIR)$(PREFIX)/share/doc/solstice-solver/README.md" + +clean: clean_test + rm -f $(HDR) $(DEP) $(OBJ) $(LIBNAME) + rm -f src/.config src/libssol.o src/ssol.pc src/ssol-local.pc + +################################################################################ +# Tests +################################################################################ +TEST_SRC =\ + src/test_ssol_atmosphere.c\ + src/test_ssol_by_receiver_integration.c\ + src/test_ssol_camera.c\ + src/test_ssol_data.c\ + src/test_ssol_device.c\ + src/test_ssol_image.c\ + src/test_ssol_material.c\ + src/test_ssol_object.c\ + src/test_ssol_param_buffer.c\ + src/test_ssol_instance.c\ + src/test_ssol_scene.c\ + src/test_ssol_shape.c\ + src/test_ssol_spectrum.c\ + src/test_ssol_solver1.c\ + src/test_ssol_solver2.c\ + src/test_ssol_solver2b.c\ + src/test_ssol_solver3.c\ + src/test_ssol_solver4.c\ + src/test_ssol_solver5.c\ + src/test_ssol_solver6.c\ + src/test_ssol_solver7.c\ + src/test_ssol_solver8.c\ + src/test_ssol_solver9.c\ + src/test_ssol_solver10.c\ + src/test_ssol_solver11.c\ + src/test_ssol_solver12.c\ + src/test_ssol_sun.c\ + src/test_ssol_draw.c +TEST_OBJ =\ + $(TEST_SRC:.c=.o) +TEST_DEP =\ + $(TEST_SRC:.c=.d) +TEST_TGT =\ + $(TEST_SRC:.c=.t) + +$(TEST_DEP) $(TEST_OBJ): src/.config_test + +# Regular cflags +PKG_CONFIG_LOCAL = PKG_CONFIG_PATH="./src:$${PKG_CONFIG_PATH}" $(PKG_CONFIG) +INCS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --cflags rsys star-sp ssol-local) +LIBS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --libs rsys star-sp ssol-local)\ + -lm + +tests: library src/ssol-local.pc $(TEST_DEP) $(TEST_TGT) + @$(MAKE) -fMakefile \ + $$(for i in $(TEST_DEP); do echo -f"$${i}"; done) \ + $$(for i in $(TEST_TGT); do echo -f"$${i}"; done) \ + test_list + +$(TEST_TGT): + @{ \ + exe="$$(basename "$@" ".t")"; \ + printf '%s: %s\n' "$${exe}" $(@:.t=.o); \ + printf 'test_list: %s\n' "$${exe}"; \ + } > $@ + +src/.config_test: config.mk + $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys + $(PKG_CONFIG) --atleast-version $(SSP_VERSION) star-sp + @echo "config done" > $@ + +clean_test: + rm -f $(TEST_DEP) $(TEST_OBJ) $(TEST_TGT) + for i in $(TEST_SRC); do rm -f "$$(basename "$${i}" ".c")"; done + rm -f src/.config_test + +test: tests + @err=0; \ + check() { name="$$1"; prog="$$2"; shift 2; \ + printf '%s' "$${name}"; \ + if PATH=./:"$${PATH}" "$${prog}" $$@ > /dev/null 2>&1; then \ + printf '\n'; \ + else \ + printf ': error %s\n' "$$?"; \ + err=$$((err+1)); \ + fi; \ + }; \ + \ + for i in $(TEST_SRC); do \ + test="$$(basename "$${i}" ".c")"; \ + if [ "$${test}" != "test_ssol_draw" ]; then \ + check "$${test}" "$${test}"; \ + else \ + check test_ssol_draw_draft test_ssol_draw draft; \ + check test_ssol_draw_pt test_ssol_draw pt; \ + fi \ + done; \ + \ + [ "$${err}" -eq 0 ] + +################################################################################ +# Regular tests +################################################################################ +CFLAGS_TEST = $(CFLAGS_EXE) $(INCS_TEST) +LDFLAGS_TEST = $(LDFLAGS_EXE) $(LIBS_TEST) + +$(TEST_DEP) : src/.config_test src/ssol-local.pc + @$(CC) $(CFLAGS_TEST) -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ + +$(TEST_OBJ) : src/.config_test src/ssol-local.pc + $(CC) $(CFLAGS_TEST) -c $(@:.o=.c) -o $@ + +test_ssol_atmosphere \ +test_ssol_by_receiver_integration \ +test_ssol_camera \ +test_ssol_data \ +test_ssol_device \ +test_ssol_image \ +test_ssol_material \ +test_ssol_object \ +test_ssol_param_buffer \ +test_ssol_instance \ +test_ssol_scene \ +test_ssol_shape \ +test_ssol_spectrum \ +test_ssol_solver1 \ +test_ssol_solver2 \ +test_ssol_solver2b \ +test_ssol_solver3 \ +test_ssol_solver4 \ +test_ssol_solver5 \ +test_ssol_solver6 \ +test_ssol_solver7 \ +test_ssol_solver8 \ +test_ssol_solver9 \ +test_ssol_solver10 \ +test_ssol_solver11 \ +test_ssol_solver12 \ +test_ssol_sun \ +test_ssol_draw \ +: src/.config_test src/ssol-local.pc $(LIBNAME) + $(CC) $(CFLAGS_TEST) -o $@ src/$@.o $(LDFLAGS_TEST) diff --git a/README.md b/README.md @@ -1,17 +1,22 @@ # Solstice Solver The purpose of this library is to integrate the solar flux in complex solar -facilities. It has been developed in the scope of the Solstice project, in -collaboration with the -[Laboratory of Excellence Solstice](http://www.labex-solstice.fr) and the -[PROMES](http://www.promes.cnrs.fr/index.php?page=home-en) laboratory of the -National Center for Scientific Research ([CNRS](http://www.cnrs.fr/index.php)). +facilities. It was developed as part of the +[Solstice](https://gitlab.com/meso-star/solstice) project, in collaboration with +the [Laboratory of Excellence Solstice](http://www.labex-solstice.fr) and the +[PROMES](http://www.promes.cnrs.fr/) laboratory of the National Center for +Scientific Research ([CNRS](http://www.cnrs.fr)). Starting in 2026, a new +development effort founded by [Ademe](https://www.ademe.fr/) is ongoing. ## How to build -The Solstice-Solver library relies on the [CMake](http://www.cmake.org) and the -[RCMake](https://gitlab.com/vaplv/rcmake/) package to build. -It also depends on the +This library, as part of the Solstice app, can be built on any POSIX system. + +Note that you will most likely want to build the entire Solstice app rather than +this library alone. If so, a good starting point is the +[start-build](https://gitlab.com/meso-star/star-build) build system. + +The Solstice-Solver library depends on the [RSys](https://gitlab.com/vaplv/rsys/), [Star-3D](https://gitlab.com/meso-star/star-3d/), [Star-3DUT](https://gitlab.com/meso-star/star-3dut), @@ -21,20 +26,39 @@ It also depends on the [OpenMP](http://www.openmp.org) 1.2 specification to parallelize its computations. -First ensure that CMake and a compiler that implements the OpenMP 1.2 -specification are installed on your system. Then install the RCMake package as -well as all the aforementioned prerequisites. Finally generate the project from -the `cmake/CMakeLists.txt` file by appending to the `CMAKE_PREFIX_PATH` -variable the install directories of its dependencies. +First ensure that the make utility and a compiler that implements the OpenMP 1.2 +specification are installed on your system. Then install the above +prerequisites. Finally, edit the config.mk file to meet your needs and build +the project by running: + + make clean install ## Release notes +### Version 0.10 + +Replace CMake with a POSIX Makefile + +The build procedure is now written in POSIX make and can be configured via +the config.mk file. A pkg-config file is also provided to link the +library as an external dependency. + +Compared to the CMake alternative, this Makefile adds support for static +libraries and an uninstall target. It also enables compiler and linker +flags for various hardening features, improving the security and +robustness of generated binaries. More broadly, the motivation for this +rewrite is to rely on a well-established standard with a simple feature +set, available on all UNIX systems - reducing portability concerns and +maintenance burden while remaining significantly lighter. + +Also raise the minimum required version of dependencies. + ### Version 0.9 - Fix self-intersection on meshed mirrors. -- Sets the required version of Star-SampPling to 0.12. This version fixes +- Raise the minimum required Star-SampPling to 0.12. This version fixes compilation errors with gcc 11 but introduces API breaks. -- Sets the required version of Star-3D to 0.8. +- Raise the minimum required Star-3D to 0.8. - Fix compilation warnings detected by gcc 11. ### Version 0.8 @@ -45,7 +69,7 @@ state. ### Version 0.7.3 -- Update the version of the RSys and StarSP dependencies. +- Update the version of the RSys and StarSP dependencies. - Fix a compilation warning with GCC7 and above. ### Version 0.7.2 @@ -76,7 +100,7 @@ Fix the creation of a glossy BSDF that uses a pillbox microfacet distribution. must be taken into account in the bounces of the optical paths only, not in the energy computations. - Fix the distribution of the pillbox sun: the pdf was wrong. -- Fix the `ssol_sun_pillbox_aperture` function and rename it in +- Fix the `ssol_sun_pillbox_aperture` function and rename it to `ssol_sun_pillbox_set_theta_max`. The submitted parameter, i.e. `theta_max`, is the angular radius but was treated as the angular diameter. - Update the `ssol_solve` API: add a parameter that controls the number of @@ -84,15 +108,15 @@ Fix the creation of a glossy BSDF that uses a pillbox microfacet distribution. ### Version 0.5 -- Improve the performances up to 50% by optimising the allocation of the BSDF - during the optical paths. Performance gains are mainly observed in situations +- Improve performance by up to 50% by optimizing the allocation of the BSDF + along the optical paths. Performance gains are mainly observed in situations where the optical paths are deep, i.e. when they bounce on many surfaces. ### Version 0.4.2 - Energy conservation property might not be ensured when the optical paths were fully absorbed. -- Handle infinite optical paths, i.e. paths that bounces infinitely due to the +- Handle infinite optical paths, i.e. paths that bounce infinitely due to the material properties and/or numerical inaccuracies. Use a Russian roulette to stop the optical random walk without bias. @@ -113,8 +137,8 @@ Fix the creation of a glossy BSDF that uses a pillbox microfacet distribution. ### Version 0.3 - Full rewrite of the estimated values. The global results report the cosine - factor, and the overall flux that is: absorbed by the receivers, atmosphere - or others entities; occluded before it reaches a primary entity; missed + factor, and the overall flux that is: absorbed by the receivers, atmosphere, + or other entities; occluded before it reaches a primary entity; missed because it does not reaches any surface. The per receiver results include the incoming/absorbed flux in 3 situations: all phenomenons are taken into account; the atmosphere is disabled; the material propagate the whole @@ -136,7 +160,7 @@ Fix the creation of a glossy BSDF that uses a pillbox microfacet distribution. ## License -Copyright (C) 2018, 2019, 2021 |Meso|Star> (<contact@meso-star.com>). +Copyright (C) 2018-2026 |Meso|Star> (<contact@meso-star.com>). Copyright (C) 2016, 2018 CNRS. Solstice-Solver is free software released under the GPL v3+ license: GNU GPL diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -1,204 +0,0 @@ -# Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) -# Copyright (C) 2016, 2018 CNRS -# -# 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/>. - -cmake_minimum_required(VERSION 3.1) -project(solstice-solver C) -enable_testing() - -set(SSOL_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) -option(NO_TEST "Do not build tests" OFF) - -################################################################################ -# Check dependencies -################################################################################ -find_package(RCMake 0.4 REQUIRED) -find_package(RSys 0.10 REQUIRED) -find_package(Star3D 0.8 REQUIRED) -find_package(Star3DUT 0.3.1 REQUIRED) -find_package(StarCPR 0.1.2 REQUIRED) -find_package(StarSF 0.6 REQUIRED) -find_package(StarSP 0.12 REQUIRED) -find_package(OpenMP 1.2 REQUIRED) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR}) -include(rcmake) -include(rcmake_runtime) - -include_directories( - ${RSys_INCLUDE_DIR} - ${Star3D_INCLUDE_DIR} - ${Star3DUT_INCLUDE_DIR} - ${StarCPR_INCLUDE_DIR} - ${StarSF_INCLUDE_DIR} - ${StarSP_INCLUDE_DIR}) - -rcmake_append_runtime_dirs(_runtime_dirs RSys Star3D Star3DUT StarCPR StarSF StarSP) - -################################################################################ -# Configure and define targets -################################################################################ -set(VERSION_MAJOR 0) -set(VERSION_MINOR 9) -set(VERSION_PATCH 0) -set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) - -set(SSOL_FILES_SRC - ssol_atmosphere.c - ssol_camera.c - ssol_data.c - ssol_device.c - ssol_draw.c - ssol_draw_pt.c - ssol_draw_draft.c - ssol_estimator.c - ssol_image.c - ssol_material.c - ssol_mc_receiver.c - ssol_object.c - ssol_instance.c - ssol_param_buffer.c - ssol_ranst_sun_dir.c - ssol_ranst_sun_wl.c - ssol_scene.c - ssol_shape.c - ssol_spectrum.c - ssol_solver.c - ssol_sun.c) - -set(SSOL_FILES_INC_API - ssol.h) - -set(SSOL_FILES_INC - ssol_atmosphere_c.h - ssol_c.h - ssol_camera.h - ssol_device_c.h - ssol_draw.h - ssol_estimator_c.h - ssol_image_c.h - ssol_material_c.h - ssol_object_c.h - ssol_instance_c.h - ssol_ranst_sun_dir.h - ssol_ranst_sun_wl.h - ssol_scene_c.h - ssol_shape_c.h - ssol_spectrum_c.h - ssol_sun_c.h) - -set(SSOL_FILES_DOC COPYING README.md) - -# Prepend each file in the `SSOL_FILES_<SRC|INC>' list by `SSOL_SOURCE_DIR' -rcmake_prepend_path(SSOL_FILES_SRC ${SSOL_SOURCE_DIR}) -rcmake_prepend_path(SSOL_FILES_INC ${SSOL_SOURCE_DIR}) -rcmake_prepend_path(SSOL_FILES_INC_API ${SSOL_SOURCE_DIR}) -rcmake_prepend_path(SSOL_FILES_DOC ${PROJECT_SOURCE_DIR}/../) - -add_library(solstice-solver SHARED ${SSOL_FILES_SRC} ${SSOL_FILES_INC} ${SSOL_FILES_INC_API}) -target_link_libraries(solstice-solver RSys Star3D Star3DUT StarCPR StarSF StarSP) - -if(CMAKE_COMPILER_IS_GNUCC) - target_link_libraries(solstice-solver m) -endif() - -set_target_properties(solstice-solver PROPERTIES - DEFINE_SYMBOL SSOL_SHARED_BUILD - COMPILE_FLAGS ${OpenMP_C_FLAGS} - VERSION ${VERSION} - SOVERSION ${VERSION_MAJOR}) -rcmake_copy_runtime_libraries(solstice-solver) - -if(CMAKE_COMPILER_IS_GNUCC) - set_target_properties(solstice-solver PROPERTIES LINK_FLAGS ${OpenMP_C_FLAGS}) -endif() - -rcmake_setup_devel(solstice-solver SolSolver ${VERSION} solstice/ssol_version.h) - -################################################################################ -# Add tests -################################################################################ -if(NOT NO_TEST) - set(SSOL_TEST_FILES_INC - test_ssol_circ2D_geometry.h - test_ssol_geometries.h - test_ssol_rect_geometry.h - test_ssol_utils.h - test_ssol_cube_geometry.h - test_ssol_materials.h - test_ssol_rect2D_geometry.h - ) - - rcmake_prepend_path(SSOL_TEST_FILES_INC ${SSOL_SOURCE_DIR}) - - function(build_test _name) - add_executable(${_name} ${SSOL_SOURCE_DIR}/${_name}.c ${SSOL_TEST_FILES_INC}) - target_link_libraries(${_name} - solstice-solver RSys Star3D StarSP) - endfunction() - - function(register_test _name) - add_test(${_name} ${ARGN}) - rcmake_set_test_runtime_dirs(${_name} _runtime_dirs) - endfunction() - - function(new_test _name) - build_test(${_name}) - register_test(${_name} ${_name}) - endfunction() - - new_test(test_ssol_atmosphere) - new_test(test_ssol_by_receiver_integration) - new_test(test_ssol_camera) - new_test(test_ssol_data) - new_test(test_ssol_device) - new_test(test_ssol_image) - new_test(test_ssol_material) - new_test(test_ssol_object) - new_test(test_ssol_param_buffer) - new_test(test_ssol_instance) - new_test(test_ssol_scene) - new_test(test_ssol_shape) - new_test(test_ssol_spectrum) - new_test(test_ssol_solver1) - new_test(test_ssol_solver2) - new_test(test_ssol_solver2b) - new_test(test_ssol_solver3) - new_test(test_ssol_solver4) - new_test(test_ssol_solver5) - new_test(test_ssol_solver6) - new_test(test_ssol_solver7) - new_test(test_ssol_solver8) - new_test(test_ssol_solver9) - new_test(test_ssol_solver10) - new_test(test_ssol_solver11) - new_test(test_ssol_solver12) - new_test(test_ssol_sun) - - build_test(test_ssol_draw) - register_test(test_ssol_draw_draft test_ssol_draw draft) - register_test(test_ssol_draw_pt test_ssol_draw pt) -endif() - -################################################################################ -# Define output & install directories -################################################################################ -install(TARGETS solstice-solver - ARCHIVE DESTINATION bin - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) -install(FILES ${SSOL_FILES_INC_API} DESTINATION include/solstice) -install(FILES ${SSOL_FILES_DOC} DESTINATION share/doc/solstice-solver) - diff --git a/config.mk b/config.mk @@ -0,0 +1,91 @@ +VERSION_MAJOR = 0 +VERSION_MINOR = 10 +VERSION_PATCH = 0 +VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) + +PREFIX = /usr/local +LIBPREFIX = $(PREFIX)/lib +INCPREFIX = $(PREFIX)/include + +LIB_TYPE = SHARED +#LIB_TYPE = STATIC + +BUILD_TYPE = RELEASE +#BUILD_TYPE = DEBUG + +################################################################################ +# Tools +################################################################################ +AR = ar +CC = cc +LD = ld +OBJCOPY = objcopy +PKG_CONFIG = pkg-config +RANLIB = ranlib + +################################################################################ +# Dependencies +################################################################################ +PCFLAGS_SHARED = +PCFLAGS_STATIC = --static +PCFLAGS = $(PCFLAGS_$(LIB_TYPE)) + +RSYS_VERSION = 0.15 +S3D_VERSION = 0.10 +S3DUT_VERSION = 0.4 +SCPR_VERSION = 0.5 +SSF_VERSION = 0.10 +SSP_VERSION = 0.15 + +INCS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys s3d s3dut scpr ssf star-sp)\ + -fopenmp +LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys s3d s3dut scpr ssf star-sp)\ + -fopenmp -lm + +################################################################################ +# Compilation options +################################################################################ +WFLAGS =\ + -Wall\ + -Wcast-align\ + -Wconversion\ + -Wextra\ + -Wmissing-declarations\ + -Wmissing-prototypes\ + -Wshadow + +CFLAGS_HARDENED =\ + -D_FORTIFY_SOURCES=2\ + -fcf-protection=full\ + -fstack-clash-protection\ + -fstack-protector-strong + +CFLAGS_COMMON =\ + -std=c89\ + -pedantic\ + -fvisibility=hidden\ + -fstrict-aliasing\ + $(CFLAGS_HARDENED)\ + $(WFLAGS) + +CFLAGS_RELEASE = -O2 -DNDEBUG $(CFLAGS_COMMON) +CFLAGS_DEBUG = -g $(CFLAGS_COMMON) +CFLAGS = $(CFLAGS_$(BUILD_TYPE)) + +CFLAGS_SO = $(CFLAGS) -fPIC +CFLAGS_EXE = $(CFLAGS) -fPIE + +################################################################################ +# Linker options +################################################################################ +LDFLAGS_HARDENED = -Wl,-z,relro,-z,now +LDFLAGS_DEBUG = $(LDFLAGS_HARDENED) +LDFLAGS_RELEASE = -s $(LDFLAGS_HARDENED) +LDFLAGS = $(LDFLAGS_$(BUILD_TYPE)) + +LDFLAGS_SO = $(LDFLAGS) -shared -Wl,--no-undefined +LDFLAGS_EXE = $(LDFLAGS) -pie + +OCPFLAGS_DEBUG = --localize-hidden +OCPFLAGS_RELEASE = --localize-hidden --strip-unneeded +OCPFLAGS = $(OCPFLAGS_$(BUILD_TYPE)) diff --git a/src/ssol.h b/src/ssol.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_atmosphere.c b/src/ssol_atmosphere.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_atmosphere_c.h b/src/ssol_atmosphere_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_c.h b/src/ssol_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_camera.c b/src/ssol_camera.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_camera.h b/src/ssol_camera.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_data.c b/src/ssol_data.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_device.c b/src/ssol_device.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -59,6 +59,7 @@ device_release(ref_T* ref) } if(dev->s3d) S3D(device_ref_put(dev->s3d)); if(dev->scpr_mesh) SCPR(mesh_ref_put(dev->scpr_mesh)); + if(dev->scpr_device) SCPR(device_ref_put(dev->scpr_device)); MEM_RM(dev->allocator, dev); } @@ -76,6 +77,7 @@ ssol_device_create struct ssol_device* dev = NULL; struct mem_allocator* allocator; unsigned i; + struct scpr_device_create_args scpr_args = SCPR_DEVICE_CREATE_ARGS_DEFAULT; res_T res = RES_OK; if(nthreads_hint == 0 || !out_dev) { @@ -93,7 +95,7 @@ ssol_device_create darray_tile_init(allocator, &dev->tiles); dev->logger = logger ? logger : LOGGER_DEFAULT; dev->allocator = allocator; - dev->verbose = verbose; + dev->verbose = verbose; /* TODO: check if verbosity levels match */ dev->nthreads = MMIN(nthreads_hint, (unsigned)omp_get_num_procs()); omp_set_num_threads((int)dev->nthreads); @@ -109,12 +111,17 @@ ssol_device_create (&dev->bsdf_allocators[i], dev->allocator, 4096); if(res != RES_OK) goto error; } - + res = darray_tile_resize(&dev->tiles, dev->nthreads); if(res != RES_OK) goto error; res = s3d_device_create(logger, mem_allocator, 0, &dev->s3d); if(res != RES_OK) goto error; - res = scpr_mesh_create(mem_allocator, &dev->scpr_mesh); + scpr_args.allocator = allocator; + scpr_args.logger = logger; + scpr_args.verbosity_level = dev->verbose; + res = scpr_device_create(&scpr_args, &dev->scpr_device); + if(res != RES_OK) goto error; + res = scpr_mesh_create(dev->scpr_device, &dev->scpr_mesh); if(res != RES_OK) goto error; exit: diff --git a/src/ssol_device_c.h b/src/ssol_device_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -49,6 +49,7 @@ struct ssol_device { struct s3d_device* s3d; struct scpr_mesh* scpr_mesh; /* Use to clip quadric mesh */ + struct scpr_device* scpr_device; ref_T ref; }; diff --git a/src/ssol_draw.c b/src/ssol_draw.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_draw.h b/src/ssol_draw.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_draw_draft.c b/src/ssol_draw_draft.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_draw_pt.c b/src/ssol_draw_pt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_estimator.c b/src/ssol_estimator.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_estimator_c.h b/src/ssol_estimator_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_image.c b/src/ssol_image.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_image_c.h b/src/ssol_image_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_instance.c b/src/ssol_instance.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_instance_c.h b/src/ssol_instance_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_material.c b/src/ssol_material.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_material_c.h b/src/ssol_material_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_mc_receiver.c b/src/ssol_mc_receiver.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_object.c b/src/ssol_object.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_object_c.h b/src/ssol_object_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_param_buffer.c b/src/ssol_param_buffer.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_ranst_sun_dir.c b/src/ssol_ranst_sun_dir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_ranst_sun_dir.h b/src/ssol_ranst_sun_dir.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_ranst_sun_wl.c b/src/ssol_ranst_sun_wl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_ranst_sun_wl.h b/src/ssol_ranst_sun_wl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_scene.c b/src/ssol_scene.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -475,7 +475,7 @@ hit_filter_function switch(sshape->shape->type) { case SHAPE_MESH: if(hit->distance <= 1.e-6 /* FIXME hack */ - || hit->distance <= rangef[0] + || hit->distance <= rangef[0] || S3D_PRIMITIVE_EQ(&hit->prim, &rdata->prim_from)) { /* Discard self intersection for mesh, i.e. when the intersected * primitive is the primitive from which the ray starts */ diff --git a/src/ssol_scene_c.h b/src/ssol_scene_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_shape.c b/src/ssol_shape.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -539,19 +539,44 @@ error: goto exit; } +static void +get_carving_count + (const size_t ic, + size_t *count, + void* ctx) +{ + const struct ssol_carving* carving = (const struct ssol_carving*)ctx; + ASSERT(ic == 0 && count); (void)ic; + *count = carving->nb_vertices; +} + +static void +get_carving_pos + (const size_t ic, + const size_t iv, + double pos[2], + void* ctx) +{ + struct ssol_carving* carving = (struct ssol_carving*)ctx; + ASSERT(ic == 0); (void)ic; + carving->get(iv, pos, carving->context); +} + static res_T clip_triangulated_sheet (struct darray_double* coords, struct darray_size_t* ids, struct scpr_mesh* mesh, const struct ssol_carving* carvings, - const size_t ncarvings) + const size_t ncarvings, + struct scpr_device* scpr) { struct mesh_context msh; size_t nverts; size_t ntris; size_t icarving; size_t i; + struct scpr_polygon* polygon = NULL; res_T res = RES_OK; ASSERT(coords && ids && carvings && ncarvings); ASSERT(darray_double_size_get(coords) % 2 == 0); @@ -570,15 +595,19 @@ clip_triangulated_sheet /* Apply each carving operation to the Star-CliPpeR mesh */ FOR_EACH(icarving, 0, ncarvings) { - struct scpr_polygon polygon; enum scpr_operation op = ssol_to_scpr_clip_op(carvings[icarving].operation); - polygon.get_position = carvings[icarving].get; - polygon.nvertices = carvings[icarving].nb_vertices; - polygon.context = carvings[icarving].context; + SCPR(polygon_create(scpr, &polygon)); + res = scpr_polygon_setup_indexed_vertices(polygon, 1, + get_carving_count, + get_carving_pos, + (void*)&carvings[icarving]); + if(res != RES_OK) goto error; - res = scpr_mesh_clip(mesh, op, &polygon); + res = scpr_mesh_clip(mesh, op, polygon); if(res != RES_OK) goto error; + SCPR(polygon_ref_put(polygon)); + polygon = NULL; } /* Reserve the output index/vertex buffer memory space */ @@ -611,6 +640,9 @@ clip_triangulated_sheet exit: return res; error: + if(polygon) { + SCPR(polygon_ref_put(polygon)); + } goto exit; } @@ -1536,7 +1568,7 @@ ssol_punched_surface_setup nslices = psurf->quadric->slices_count_hint; } else if(psurf->quadric->type == SSOL_QUADRIC_HEMISPHERE) { nslices = hemisphere_compute_slices_count - (&shape->private_data.hemisphere, radius); + (&shape->private_data.hemisphere, radius); } else { nslices = priv_quadric_data_compute_slices_count (shape->quadric_type, &shape->private_data, lower, upper); @@ -1553,7 +1585,8 @@ ssol_punched_surface_setup /* Clip the quadric mesh if necessary */ if(psurf->nb_carvings) { res = clip_triangulated_sheet - (&coords, &ids, shape->dev->scpr_mesh, psurf->carvings, psurf->nb_carvings); + (&coords, &ids, shape->dev->scpr_mesh, psurf->carvings, psurf->nb_carvings, + shape->dev->scpr_device); if(res != RES_OK) goto error; } diff --git a/src/ssol_shape_c.h b/src/ssol_shape_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_solver.c b/src/ssol_solver.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_spectrum.c b/src/ssol_spectrum.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_spectrum_c.h b/src/ssol_spectrum_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/ssol_sun.c b/src/ssol_sun.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -255,7 +255,7 @@ sun_create_wavelength_distribution (struct ssol_sun* sun, struct ranst_sun_wl** out_ran_wl) { struct ranst_sun_wl* ran_wl = NULL; - res_T res = RES_OK; + res_T res = RES_OK; ASSERT(sun && out_ran_wl); res = ranst_sun_wl_create(sun->dev->allocator, &ran_wl); diff --git a/src/ssol_sun_c.h b/src/ssol_sun_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -32,7 +32,7 @@ enum sun_type { SUN_TYPES_COUNT__ }; -struct pillbox { +struct pillbox { double half_angle; }; diff --git a/src/ssol_version.h.in b/src/ssol_version.h.in @@ -0,0 +1,23 @@ +/* Copyright (C) 2016-2018 CNRS, 2018-2026 |Meso|Star> + * + * 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 SSOL_VERSION_H +#define SSOL_VERSION_H + +#define SSOL_VERSION_MAJOR @VERSION_MAJOR@ +#define SSOL_VERSION_MINOR @VERSION_MINOR@ +#define SSOL_VERSION_PATCH @VERSION_PATCH@ + +#endif /* SSOL_VERSION_H */ diff --git a/src/test_ssol_atmosphere.c b/src/test_ssol_atmosphere.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -72,7 +72,7 @@ main(int argc, char** argv) CHK(ssol_atmosphere_set_extinction(atm, &extinction) == RES_BAD_ARG); CHK(ssol_spectrum_setup(spectrum, get_wlen, 3, NULL) == RES_OK); CHK(ssol_atmosphere_set_extinction(atm, &extinction2) == RES_BAD_ARG); - + CHK(ssol_spectrum_ref_put(extinction2.value.spectrum) == RES_OK); CHK(ssol_device_ref_put(dev) == RES_OK); CHK(ssol_atmosphere_ref_put(atm) == RES_OK); diff --git a/src/test_ssol_by_receiver_integration.c b/src/test_ssol_by_receiver_integration.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_camera.c b/src/test_ssol_camera.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_circ2D_geometry.h b/src/test_ssol_circ2D_geometry.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_cube_geometry.h b/src/test_ssol_cube_geometry.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_data.c b/src/test_ssol_data.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_device.c b/src/test_ssol_device.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_draw.c b/src/test_ssol_draw.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_geometries.h b/src/test_ssol_geometries.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_image.c b/src/test_ssol_image.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_instance.c b/src/test_ssol_instance.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_material.c b/src/test_ssol_material.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -55,7 +55,7 @@ test_mirror(struct ssol_device* dev) == RES_BAD_ARG); CHK(ssol_mirror_setup(NULL, &mirror, SSOL_MICROFACET_DISTRIBUTIONS_COUNT__) == RES_BAD_ARG); - CHK(ssol_mirror_setup(material, &mirror, SSOL_MICROFACET_DISTRIBUTIONS_COUNT__) + CHK(ssol_mirror_setup(material, &mirror, SSOL_MICROFACET_DISTRIBUTIONS_COUNT__) == RES_BAD_ARG); CHK(ssol_mirror_setup(NULL, NULL, SSOL_MICROFACET_BECKMANN) == RES_BAD_ARG); CHK(ssol_mirror_setup(material, NULL, SSOL_MICROFACET_BECKMANN) == RES_BAD_ARG); @@ -68,7 +68,7 @@ test_mirror(struct ssol_device* dev) CHK(ssol_material_set_param_buffer(material, pbuf) == RES_OK); mirror.normal = NULL; - CHK(ssol_mirror_setup(material, &mirror, SSOL_MICROFACET_BECKMANN) + CHK(ssol_mirror_setup(material, &mirror, SSOL_MICROFACET_BECKMANN) == RES_BAD_ARG); mirror.normal = get_shader_normal; diff --git a/src/test_ssol_materials.h b/src/test_ssol_materials.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -46,7 +46,7 @@ get_shader_reflectivity *val = 1; } -#ifdef REFLECTIVITY +#ifdef REFLECTIVITY static INLINE void get_shader_reflectivity_2 (struct ssol_device* dev, diff --git a/src/test_ssol_object.c b/src/test_ssol_object.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_param_buffer.c b/src/test_ssol_param_buffer.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_rect2D_geometry.h b/src/test_ssol_rect2D_geometry.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_rect_geometry.h b/src/test_ssol_rect_geometry.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_scene.c b/src/test_ssol_scene.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -235,7 +235,7 @@ main(int argc, char** argv) CHK(lower[0] > upper[0]); CHK(lower[1] > upper[1]); CHK(lower[2] > upper[2]); - + CHK(ssol_scene_attach_instance(scene, instance) == RES_OK); CHK(ssol_scene_compute_aabb(scene, lower, upper) == RES_OK); CHK(f3_eq_eps(lower, f3(tmp, 265.f, 247.f, 0.f), 1.e-6f) == 1); diff --git a/src/test_ssol_shape.c b/src/test_ssol_shape.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -152,7 +152,7 @@ main(int argc, char** argv) CHK(ssol_shape_create_punched_surface(dev, NULL) == RES_BAD_ARG); CHK(ssol_shape_create_punched_surface(NULL, &shape) == RES_BAD_ARG); CHK(ssol_shape_create_punched_surface(dev, &shape) == RES_OK); - + carving.get = get_polygon_vertices; carving.operation = SSOL_AND; carving.nb_vertices = npolygon_verts; @@ -194,7 +194,7 @@ main(int argc, char** argv) punched_surface.nb_carvings = 0; CHK(ssol_punched_surface_setup(shape, &punched_surface) == RES_BAD_ARG); punched_surface.nb_carvings = 1; - + quadric.data.parabol.focal = 0; CHK(ssol_punched_surface_setup(shape, &punched_surface) == RES_BAD_ARG); quadric.data.parabol.focal = 1; @@ -239,7 +239,7 @@ main(int argc, char** argv) quadric.data.hemisphere.radius = 0; CHK(ssol_punched_surface_setup(shape, &punched_surface) == RES_BAD_ARG); quadric.data.hemisphere.radius = 10; - + CHK(ssol_shape_ref_put(shape) == RES_OK); CHK(ssol_device_ref_put(dev) == RES_OK); diff --git a/src/test_ssol_solver1.c b/src/test_ssol_solver1.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver10.c b/src/test_ssol_solver10.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver11.c b/src/test_ssol_solver11.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver12.c b/src/test_ssol_solver12.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver2.c b/src/test_ssol_solver2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver2b.c b/src/test_ssol_solver2b.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver3.c b/src/test_ssol_solver3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -79,7 +79,7 @@ main(int argc, char** argv) d3_splat(transform + 9, 0); d33_rotation_pitch(transform, PI); /* flip faces: invert normal */ transform[11] = 2; /* +2 offset along Z axis */ - + mem_init_proxy_allocator(&allocator, &mem_default_allocator); CHK(ssol_device_create @@ -153,7 +153,7 @@ main(int argc, char** argv) CHK(eq_eps(mc_global.cos_factor.E, COS, 1e-4) == 1); CHK(ssol_estimator_get_mc_receiver (estimator, target, SSOL_FRONT, &mc_rcv) == RES_OK); - printf("Ir(target) = %g +/- %g\n", + printf("Ir(target) = %g +/- %g\n", mc_rcv.incoming_flux.E, mc_rcv.incoming_flux.SE); CHK(eq_eps(mc_rcv.incoming_flux.E, m, 2 * std) == 1); CHK(eq_eps(mc_rcv.incoming_flux.SE, std, 10) == 1); diff --git a/src/test_ssol_solver4.c b/src/test_ssol_solver4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver5.c b/src/test_ssol_solver5.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver6.c b/src/test_ssol_solver6.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_solver7.c b/src/test_ssol_solver7.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -201,12 +201,12 @@ main(int argc, char** argv) CHK(GET_MC_RCV(estimator, target, SSOL_FRONT, &mc_rcv) == RES_OK); printf("Abs(target1) = %g +/- %g\n", - mc_rcv.absorbed_flux.E, + mc_rcv.absorbed_flux.E, mc_rcv.absorbed_flux.SE); printf("Ir(target1) = %g +/- %g\n", mc_rcv.incoming_flux.E, mc_rcv.incoming_flux.SE); CHK(eq_eps(mc_rcv.incoming_flux.E, TOTAL, TOTAL * 1e-4)); - CHK(eq_eps(mc_rcv.absorbed_flux.E, + CHK(eq_eps(mc_rcv.absorbed_flux.E, (1 - REFLECTIVITY) * TOTAL, (1 - REFLECTIVITY) *TOTAL * 1e-4)); CHK(eq_eps(mc_rcv.incoming_flux.SE, 0, 1e-2) == 1); diff --git a/src/test_ssol_solver8.c b/src/test_ssol_solver8.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -151,7 +151,7 @@ main(int argc, char** argv) printf("Shadows = %g +/- %g\n", mc_global.shadowed.E, mc_global.shadowed.SE); printf("Missing = %g +/- %g\n", mc_global.missing.E, mc_global.missing.SE); CHK(eq_eps(mc_global.shadowed.E, 0, 1e-4) == 1); - CHK(eq_eps(mc_global.missing.E, S * DNI, + CHK(eq_eps(mc_global.missing.E, S * DNI, 3 * mc_global.missing.SE)); /* nothing absorbed */ CHK(GET_MC_RCV(estimator, target, SSOL_FRONT, &mc_rcv) == RES_OK); printf("Ir(target1) = %g +/- %g\n", diff --git a/src/test_ssol_solver9.c b/src/test_ssol_solver9.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify @@ -145,7 +145,7 @@ main(int argc, char** argv) print_global(&mc_global); CHK(eq_eps(mc_global.cos_factor.E, 1./3., 3 * mc_global.cos_factor.SE)); CHK(eq_eps(mc_global.shadowed.E, DNI_S, 3 * mc_global.shadowed.SE)); - CHK(eq_eps(mc_global.missing.E, MMAX(DNI_S, DNI_TGT_S), + CHK(eq_eps(mc_global.missing.E, MMAX(DNI_S, DNI_TGT_S), 3 * mc_global.missing.SE)); CHK(GET_MC_RCV(estimator, target, SSOL_FRONT, &mc_rcv) == RES_OK); printf("Ir(target1) = %g +/- %g\n", diff --git a/src/test_ssol_spectrum.c b/src/test_ssol_spectrum.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_sun.c b/src/test_ssol_sun.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/src/test_ssol_utils.h b/src/test_ssol_utils.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2016, 2018 CNRS * * This program is free software: you can redistribute it and/or modify diff --git a/ssol.pc.in b/ssol.pc.in @@ -0,0 +1,17 @@ +prefix=@PREFIX@ +includedir=${prefix}/include +libdir=${prefix}/lib + +Requires: \ + rsys >= @RSYS_VERSION@ +Requires.private:\ + s3d >= @S3D_VERSION@,\ + star-sp >= @SSP_VERSION@,\ + scpr >= @SCPR_VERSION@,\ + ssf >= @SSF_VERSION@ +Name: ssol +Description: Solstice Solver +Version: @VERSION@ +Libs: -L${libdir} -lssol +Libs.private: -fopenmp -lm +CFlags: -I${includedir} -fopenmp