commit e125e6b9d0e6d649e8abdd74892047d2b3972e9a
parent 8cadcc8ab4b0583f220e88d1fd89fd49889801db
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 31 Oct 2023 16:09:20 +0100
Merge branch 'release_0.10'
Diffstat:
54 files changed, 3894 insertions(+), 3326 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,11 +1,18 @@
.gitignore
-CMakeCache.txt
-CMakeFiles
-Makefile
-tmp
[Bb]uild*
*.sw[po]
-*.[ao]
-*.orig
+*.[aod]
+*.so
*~
+.config*
tags
+*.pc
+htrdr_*args.h
+htrdr_version.h
+htrdr
+htrdr-atmosphere
+htrdr-atmosphere.1
+htrdr-combustion
+htrdr-combustion.1
+htrdr-planeto
+htrdr-planeto.1
diff --git a/Makefile b/Makefile
@@ -0,0 +1,710 @@
+# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+# Copyright (C) 2022-2023 Observatoire de Paris
+# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+#
+# 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
+
+ATMOSPHERE_LIBNAME = libhtrdr-atmosphere.a
+COMBUSTION_LIBNAME = libhtrdr-combustion.a
+PLANETO_LIBNAME = libhtrdr-planeto.a
+
+PKG_CONFIG_LOCAL = PKG_CONFIG_PATH="./:$${PKG_CONFIG_PATH}" $(PKG_CONFIG)
+
+# Define macros when ATMOSPHERE is set to ENABLE
+ATMOSPHERE_CFLAGS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --cflags htrdr-atmosphere)
+ATMOSPHERE_LIBS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --libs htrdr-atmosphere)
+ATMOSPHERE_BUILD_LIB_ENABLE = build_atmosphere
+ATMOSPHERE_BUILD_CMD_ENABLE = build_htrdr_atmosphere
+ATMOSPHERE_LIBNAME_ENABLE = $(ATMOSPHERE_LIBNAME)
+
+# Define macros when COMBUSTION is set to ENABLE
+COMBUSTION_CFLAGS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --cflags htrdr-combustion)
+COMBUSTION_LIBS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --libs htrdr-combustion)
+COMBUSTION_BUILD_LIB_ENABLE = build_combustion
+COMBUSTION_BUILD_CMD_ENABLE = build_htrdr_combustion
+COMBUSTION_LIBNAME_ENABLE = $(COMBUSTION_LIBNAME)
+
+# Define macros when PLANETO is set to ENABLE
+PLANETO_CFLAGS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --cflags htrdr-planeto)
+PLANETO_LIBS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --libs htrdr-planeto)
+PLANETO_BUILD_LIB_ENABLE = build_planeto
+PLANETO_BUILD_CMD_ENABLE = build_htrdr_planeto
+PLANETO_LIBNAME_ENABLE = $(PLANETO_LIBNAME)
+
+# Default target
+all:\
+ build_htrdr\
+ build_htrdr_atmosphere\
+ build_htrdr_combustion\
+ build_htrdr_planeto\
+ man
+
+# Check commands dependencies
+.config_commands: config.mk
+ @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
+ echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
+ @echo "config done" > $@
+
+# Inference rules for command build
+.SUFFIXES: .c .d .o
+.c.d:
+ @$(CC) $(CFLAGS_EXE) $(HTRDR_DPDC_CFLAGS) -MM -MT "$(@:.d=.o) $@" \
+ $< -MF $@
+
+.c.o:
+ $(CC) $(CFLAGS_EXE) $(HTRDR_DPDC_CFLAGS) -c $< -o $@
+
+################################################################################
+# Build the htrdr command
+################################################################################
+HTRDR_SRC = src/commands/htrdr_cmd.c
+HTRDR_OBJ = $(HTRDR_SRC:.c=.o)
+HTRDR_DEP = $(HTRDR_SRC:.c=.d)
+
+HTRDR_DPDC_CFLAGS =\
+ $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --cflags htrdr-core)\
+ $(ATMOSPHERE_CFLAGS_$(ATMOSPHERE))\
+ $(COMBUSTION_CFLAGS_$(COMBUSTION))\
+ $(PLANETO_CFLAGS_$(PLANETO))\
+ $(RSYS_CFLAGS)
+
+HTRDR_DPDC_LIBS =\
+ $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --libs htrdr-core)\
+ $(ATMOSPHERE_LIBS_$(ATMOSPHERE))\
+ $(COMBUSTION_LIBS_$(COMBUSTION))\
+ $(PLANETO_LIBS_$(PLANETO))\
+ $(RSYS_LIBS)
+
+HTRDR_DPDC_BUILD =\
+ build_core\
+ $(ATMOSPHERE_BUILD_LIB_$(ATMOSPHERE))\
+ $(COMBUSTION_BUILD_LIB_$(COMBUSTION))\
+ $(PLANETO_BUILD_LIB_$(PLANETO))
+
+HTRDR_DPDC_PREREQ =\
+ $(CORE_LIBNAME)\
+ $(ATMOSPHERE_LIBNAME_$(ATMOSPHERE))\
+ $(COMBUSTION_LIBNAME_$(COMBUSTION))\
+ $(PLANETO_LIBNAME_$(PLANETO))
+
+build_htrdr: .config_commands $(HTRDR_DPDC_BUILD) $(HTRDR_DEP)
+ @$(MAKE) -fMakefile -f $(HTRDR_DEP) htrdr
+
+htrdr: config.mk $(HTRDR_OBJ) $(HTRDR_DPDC_PREREQ)
+ $(CC) $(CFLAGS_EXE) $(HTRDR_DPDC_CFLAGS) -o $@ \
+ $(HTRDR_OBJ) $(LDFLAGS_EXE) $(HTRDR_DPDC_LIBS)
+
+$(HTRDR_OBJ) $(HTRDR_DEP): config.mk
+
+clean_htrdr:
+ rm -f $(HTRDR_OBJ) htrdr .config_commands
+
+distclean_htrdr: clean_htrdr
+ rm -f $(HTRDR_DEP)
+
+################################################################################
+# Build the htrdr-atmosphere command
+################################################################################
+HTRDR_ATMOSPHERE_SRC = src/commands/htrdr_atmosphere_cmd.c
+HTRDR_ATMOSPHERE_OBJ = $(HTRDR_ATMOSPHERE_SRC:.c=.o)
+HTRDR_ATMOSPHERE_DEP = $(HTRDR_ATMOSPHERE_SRC:.c=.d)
+
+HTRDR_ATMOSPHERE_DPDC_LIBS = $(ATMOSPHERE_LIBS_$(ATMOSPHERE))
+HTRDR_ATMOSPHERE_DPDC_BUILD = build_core $(ATMOSPHERE_BUILD_LIB_$(ATMOSPHERE))
+HTRDR_ATMOSPHERE_DPDC_PREREQ = $(CORE_LIBNAME) $(ATMOSPHERE_LIBNAME_$(ATMOSPHERE))
+
+build_htrdr_atmosphere:\
+ .config_commands\
+ $(HTRDR_ATMOSPHERE_DPDC_BUILD)\
+ $(HTRDR_ATMOSPHERE_DEP)
+ @$(MAKE) -fMakefile -f $(HTRDR_ATMOSPHERE_DEP) htrdr-atmosphere
+
+htrdr-atmosphere: config.mk $(HTRDR_ATMOSPHERE_OBJ) $(HTRDR_ATMOSPHERE_DPDC_PREREQ)
+ $(CC) $(CFLAGS_EXE) $(HTRDR_DPDC_CFLAGS) -o $@ \
+ $(HTRDR_ATMOSPHERE_OBJ) $(LDFLAGS_EXE) $(HTRDR_ATMOSPHERE_DPDC_LIBS)
+
+$(HTRDR_ATMOSPHERE_OBJ) $(HTRDR_ATMOSPHERE_DEP): config.mk
+
+clean_htrdr-atmosphere:
+ rm -f $(HTRDR_ATMOSPHERE_OBJ) htrdr-atmosphere
+
+distclean_htrdr-atmosphere: clean_htrdr-atmosphere
+ rm -f $(HTRDR_ATMOSPHERE_DEP) .config_commands
+
+################################################################################
+# Build the htrdr-combustion command
+################################################################################
+HTRDR_COMBUSTION_SRC = src/commands/htrdr_combustion_cmd.c
+HTRDR_COMBUSTION_OBJ = $(HTRDR_COMBUSTION_SRC:.c=.o)
+HTRDR_COMBUSTION_DEP = $(HTRDR_COMBUSTION_SRC:.c=.d)
+
+HTRDR_COMBUSTION_DPDC_LIBS = $(COMBUSTION_LIBS_$(COMBUSTION))
+HTRDR_COMBUSTION_DPDC_BUILD = build_core $(COMBUSTION_BUILD_LIB_$(COMBUSTION))
+HTRDR_COMBUSTION_DPDC_PREREQ = $(CORE_LIBNAME) $(COMBUSTION_LIBNAME_$(COMBUSTION))
+
+build_htrdr_combustion:\
+ .config_commands\
+ $(HTRDR_COMBUSTION_DPDC_BUILD)\
+ $(HTRDR_COMBUSTION_DEP)
+ @$(MAKE) -fMakefile -f $(HTRDR_COMBUSTION_DEP) htrdr-combustion
+
+htrdr-combustion: config.mk $(HTRDR_COMBUSTION_OBJ) $(HTRDR_COMBUSTION_DPDC_PREREQ)
+ $(CC) $(CFLAGS_EXE) $(HTRDR_DPDC_CFLAGS) -o $@ \
+ $(HTRDR_COMBUSTION_OBJ) $(LDFLAGS_EXE) $(HTRDR_COMBUSTION_DPDC_LIBS)
+
+$(HTRDR_COMBUSTION_OBJ) $(HTRDR_COMBUSTION_DEP): config.mk
+
+clean_htrdr-combustion:
+ rm -f $(HTRDR_COMBUSTION_OBJ) htrdr-combustion
+
+distclean_htrdr-combustion: clean_htrdr-combustion
+ rm -f $(HTRDR_COMBUSTION_DEP) .config_commands
+
+################################################################################
+# Build the htrdr-planeto command
+################################################################################
+HTRDR_PLANETO_SRC = src/commands/htrdr_planeto_cmd.c
+HTRDR_PLANETO_OBJ = $(HTRDR_PLANETO_SRC:.c=.o)
+HTRDR_PLANETO_DEP = $(HTRDR_PLANETO_SRC:.c=.d)
+
+HTRDR_PLANETO_DPDC_LIBS = $(PLANETO_LIBS_$(PLANETO))
+HTRDR_PLANETO_DPDC_BUILD = build_core $(PLANETO_BUILD_LIB_$(PLANETO))
+HTRDR_PLANETO_DPDC_PREREQ = $(CORE_LIBNAME) $(PLANETO_LIBNAME_$(PLANETO))
+
+build_htrdr_planeto:\
+ .config_commands\
+ $(HTRDR_PLANETO_DPDC_BUILD)\
+ $(HTRDR_PLANETO_DEP)
+ @$(MAKE) -fMakefile -f $(HTRDR_PLANETO_DEP) htrdr-planeto
+
+htrdr-planeto: config.mk $(HTRDR_PLANETO_OBJ) $(HTRDR_PLANETO_DPDC_PREREQ)
+ $(CC) $(CFLAGS_EXE) $(HTRDR_DPDC_CFLAGS) -o $@ \
+ $(HTRDR_PLANETO_OBJ) $(LDFLAGS_EXE) $(HTRDR_PLANETO_DPDC_LIBS)
+
+$(HTRDR_PLANETO_OBJ) $(HTRDR_PLANETO_DEP): config.mk
+
+clean_htrdr-planeto:
+ rm -f $(HTRDR_PLANETO_OBJ) htrdr-planeto
+
+distclean_htrdr-planeto: clean_htrdr-planeto
+ rm -f $(HTRDR_PLANETO_DEP) .config_commands
+
+################################################################################
+# Building the core
+################################################################################
+CORE_LIBNAME_STATIC = libhtrdr-core.a
+CORE_LIBNAME_SHARED = libhtrdr-core.so
+CORE_LIBNAME = $(CORE_LIBNAME_$(LIB_TYPE))
+
+CORE_SRC =\
+ src/core/htrdr.c\
+ src/core/htrdr_args.c\
+ src/core/htrdr_buffer.c\
+ src/core/htrdr_draw_map.c\
+ src/core/htrdr_geometry.c\
+ src/core/htrdr_log.c\
+ src/core/htrdr_materials.c\
+ src/core/htrdr_ran_wlen_cie_xyz.c\
+ src/core/htrdr_ran_wlen_discrete.c\
+ src/core/htrdr_ran_wlen_planck.c\
+ src/core/htrdr_rectangle.c\
+ src/core/htrdr_slab.c\
+ src/core/htrdr_spectral.c
+CORE_OBJ = $(CORE_SRC:.c=.o)
+CORE_DEP = $(CORE_SRC:.c=.d)
+
+build_core: .config_core htrdr-core.pc $(CORE_DEP)
+ @$(MAKE) -fMakefile $$(for i in $(CORE_DEP); do echo -f $${i}; done) \
+ $$(if [ -n "$(CORE_LIBNAME)" ]; then \
+ echo "$(CORE_LIBNAME)"; \
+ else \
+ echo "$(CORE_LIBNAME_SHARED)"; \
+ fi)
+
+$(CORE_DEP) $(CORE_OBJ): config.mk src/core/htrdr_args.h src/core/htrdr_version.h
+
+$(CORE_LIBNAME_SHARED): $(CORE_OBJ)
+ $(CC) $(CFLAGS_SO) $(CORE_DPDC_CFLAGS) -o $@ $(CORE_OBJ) $(LDFLAGS_SO) $(CORE_DPDC_LIBS)
+
+$(CORE_LIBNAME_STATIC): libhtrdr-core.o
+ $(AR) -rc $@ $?
+ $(RANLIB) $@
+
+libhtrdr-core.o: $(CORE_OBJ)
+ $(LD) -r $(CORE_OBJ) -o $@
+ $(OBJCOPY) $(OCPFLAGS) $@
+
+.config_core: config.mk
+ @if ! $(PKG_CONFIG) --atleast-version $(AW_VERSION) aw; then \
+ echo "aw $(AW_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(MPI_VERSION) $(MPI_PC); then \
+ echo "$(MPI_PC) $(MPI_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(MRUMTL_VERSION) mrumtl; then \
+ echo "mrumtl $(MRUMTL_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
+ echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(S3D_VERSION) s3d; then \
+ echo "s3d $(S3D_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SCAM_VERSION) scam; then \
+ echo "scam $(SCAM_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SSF_VERSION) ssf; then \
+ echo "ssf $(SSF_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SSP_VERSION) star-sp; then \
+ echo "star-sp $(SSP_VERSION) not found" >&2; exit 1; fi
+ @echo "config done" > $@
+
+src/core/htrdr_args.h: config.mk src/core/htrdr_args.h.in
+ sed -e 's/@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@/$(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN)/g' \
+ -e 's/@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@/$(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_POS@/$(HTRDR_ARGS_DEFAULT_CAMERA_POS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_TGT@/$(HTRDR_ARGS_DEFAULT_CAMERA_TGT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_UP@/$(HTRDR_ARGS_DEFAULT_CAMERA_UP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_ORTHOGRAPHIC_HEIGHT@/$(HTRDR_ARGS_DEFAULT_CAMERA_ORTHOGRAPHIC_HEIGHT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_POS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_TGT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_UP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_SZ)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_WIDTH@/$(HTRDR_ARGS_DEFAULT_IMG_WIDTH)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@/$(HTRDR_ARGS_DEFAULT_IMG_HEIGHT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_SPP@/$(HTRDR_ARGS_DEFAULT_IMG_SPP)/g' \
+ $@.in > $@
+
+src/core/htrdr_version.h: config.mk src/core/htrdr_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' \
+ $@.in > $@
+
+$(CORE_DEP):
+ @$(CC) $(CFLAGS_SO) $(CORE_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
+
+$(CORE_OBJ):
+ $(CC) $(CFLAGS_SO) $(CORE_DPDC_CFLAGS) -Isrc -DHTRDR_SHARED_BUILD -c $(@:.o=.c) -o $@
+
+htrdr-core.pc: config.mk htrdr-core.pc.in
+ sed -e 's/@VERSION@/$(VERSION)/g' \
+ -e 's/@AW_VERSION@/$(AW_VERSION)/g' \
+ -e 's/@MPI_PC@/$(MPI_PC)/g' \
+ -e 's/@MPI_VERSION@/$(MPI_VERSION)/g' \
+ -e 's/@MRUMTL_VERSION@/$(MRUMTL_VERSION)/g' \
+ -e 's/@RSYS_VERSION@/$(RSYS_VERSION)/g' \
+ -e 's/@S3D_VERSION@/$(S3D_VERSION)/g' \
+ -e 's/@SCAM_VERSION@/$(SCAM_VERSION)/g' \
+ -e 's/@SSF_VERSION@/$(SSF_VERSION)/g' \
+ -e 's/@SSP_VERSION@/$(SSP_VERSION)/g' \
+ $@.in > $@
+
+clean_core:
+ rm -f $(CORE_OBJ) $(CORE_LIBNAME) libhtrdr-core.o
+ rm -f .config_core mobhtrdr-core.o htrdr-core.pc
+ rm -f src/core/htrdr_args.h src/core/htrdr_version.h
+
+distclean_core: clean_core
+ rm -f $(CORE_DEP)
+
+################################################################################
+# Building the atmosphere library
+################################################################################
+ATMOSPHERE_SRC =\
+ src/atmosphere/htrdr_atmosphere_args.c\
+ src/atmosphere/htrdr_atmosphere.c\
+ src/atmosphere/htrdr_atmosphere_compute_radiance_lw.c\
+ src/atmosphere/htrdr_atmosphere_compute_radiance_sw.c\
+ src/atmosphere/htrdr_atmosphere_draw_map.c\
+ src/atmosphere/htrdr_atmosphere_ground.c\
+ src/atmosphere/htrdr_atmosphere_main.c\
+ src/atmosphere/htrdr_atmosphere_sun.c
+ATMOSPHERE_OBJ = $(ATMOSPHERE_SRC:.c=.o)
+ATMOSPHERE_DEP = $(ATMOSPHERE_SRC:.c=.d)
+
+build_atmosphere: build_core .config_atmosphere htrdr-atmosphere.pc $(ATMOSPHERE_DEP)
+ @$(MAKE) -fMakefile $$(for i in $(ATMOSPHERE_DEP); do echo -f $${i}; done) \
+ $(ATMOSPHERE_LIBNAME)
+
+$(ATMOSPHERE_DEP) $(ATMOSPHERE_OBJ): config.mk src/atmosphere/htrdr_atmosphere_args.h
+
+$(ATMOSPHERE_LIBNAME): libhtrdr-atmosphere.o
+ $(AR) -rc $@ $?
+ $(RANLIB) $@
+
+libhtrdr-atmosphere.o: $(ATMOSPHERE_OBJ)
+ $(LD) -r $(ATMOSPHERE_OBJ) -o $@
+ $(OBJCOPY) $(OCPFLAGS) $@
+
+.config_atmosphere: config.mk
+ @if ! $(PKG_CONFIG) --atleast-version $(HTSKY_VERSION) htsky; then \
+ echo "htsky $(HTSKY_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
+ echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(S3D_VERSION) s3d; then \
+ echo "s3d $(S3D_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SCAM_VERSION) scam; then \
+ echo "scam $(SCAM_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SSF_VERSION) ssf; then \
+ echo "ssf $(SSF_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SSP_VERSION) star-sp; then \
+ echo "star-sp $(SSP_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SVX_VERSION) svx; then \
+ echo "svx $(SVX_VERSION) not found" >&2; exit 1; fi
+ @echo "config done" > $@
+
+src/atmosphere/htrdr_atmosphere_args.h: config.mk src/atmosphere/htrdr_atmosphere_args.h.in
+ sed -e 's/@HTRDR_ATMOSPHERE_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@/$(HTRDR_ATMOSPHERE_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD)/g' \
+ -e 's/@HTRDR_ATMOSPHERE_ARGS_DEFAULT_SKY_MTL_NAME@/$(HTRDR_ATMOSPHERE_ARGS_DEFAULT_SKY_MTL_NAME)/g' \
+ $@.in > $@
+
+$(ATMOSPHERE_DEP):
+ @$(CC) $(CFLAGS_SO) $(ATMOSPHERE_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
+
+$(ATMOSPHERE_OBJ):
+ $(CC) $(CFLAGS_SO) $(ATMOSPHERE_DPDC_CFLAGS) -Isrc -DHTRDR_SHARED_BUILD -c $(@:.o=.c) -o $@
+
+htrdr-atmosphere.pc: config.mk htrdr-atmosphere.pc.in
+ sed -e 's/@VERSION@/$(VERSION)/g' \
+ -e 's/@HTSKY_VERSION@/$(HTSKY_VERSION)/g' \
+ -e 's/@RSYS_VERSION@/$(RSYS_VERSION)/g' \
+ -e 's/@S3D_VERSION@/$(S3D_VERSION)/g' \
+ -e 's/@SCAM_VERSION@/$(SCAM_VERSION)/g' \
+ -e 's/@SSF_VERSION@/$(SSF_VERSION)/g' \
+ -e 's/@SSP_VERSION@/$(SSP_VERSION)/g' \
+ -e 's/@SVX_VERSION@/$(SVX_VERSION)/g' \
+ $@.in > $@
+
+clean_atmosphere:
+ rm -f $(ATMOSPHERE_OBJ) $(ATMOSPHERE_LIBNAME)
+ rm -f .config_atmosphere libhtrdr-atmosphere.o htrdr-atmosphere.pc
+ rm -f src/atmosphere/htrdr_atmosphere_args.h
+
+distclean_atmosphere: clean_atmosphere
+ rm -f $(ATMOSPHERE_DEP)
+
+################################################################################
+# Building the combustion library
+################################################################################
+COMBUSTION_SRC =\
+ src/combustion/htrdr_combustion.c\
+ src/combustion/htrdr_combustion_args.c\
+ src/combustion/htrdr_combustion_draw_map.c\
+ src/combustion/htrdr_combustion_compute_radiance_sw.c\
+ src/combustion/htrdr_combustion_geometry_ray_filter.c\
+ src/combustion/htrdr_combustion_laser.c\
+ src/combustion/htrdr_combustion_main.c\
+ src/combustion/htrdr_combustion_phase_func.c
+COMBUSTION_OBJ = $(COMBUSTION_SRC:.c=.o)
+COMBUSTION_DEP = $(COMBUSTION_SRC:.c=.d)
+
+build_combustion: build_core .config_combustion htrdr-combustion.pc $(COMBUSTION_DEP)
+ @$(MAKE) -fMakefile $$(for i in $(COMBUSTION_DEP); do echo -f $${i}; done) \
+ $(COMBUSTION_LIBNAME)
+
+$(COMBUSTION_DEP) $(COMBUSTION_OBJ): config.mk src/combustion/htrdr_combustion_args.h
+
+$(COMBUSTION_LIBNAME): libhtrdr-combustion.o
+ $(AR) -rc $@ $?
+ $(RANLIB) $@
+
+libhtrdr-combustion.o: $(COMBUSTION_OBJ)
+ $(LD) -r $(COMBUSTION_OBJ) -o $@
+ $(OBJCOPY) $(OCPFLAGS) $@
+
+.config_combustion: config.mk
+ @if ! $(PKG_CONFIG) --atleast-version $(ATRSTM_VERSION) atrstm; then \
+ echo "atrstm $(ATRSTM_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
+ echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(S3D_VERSION) s3d; then \
+ echo "s3d $(S3D_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SCAM_VERSION) scam; then \
+ echo "scam $(SCAM_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SSF_VERSION) ssf; then \
+ echo "ssf $(SSF_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SSP_VERSION) star-sp; then \
+ echo "star-sp $(SSP_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SVX_VERSION) svx; then \
+ echo "svx $(SVX_VERSION) not found" >&2; exit 1; fi
+ @echo "config done" > $@
+
+src/combustion/htrdr_combustion_args.h: config.mk src/combustion/htrdr_combustion_args.h.in
+ sed -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_LASER_FLUX_DENSITY@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_LASER_FLUX_DENSITY)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_DIMENSION@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_DIMENSION)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_PREFACTOR@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_PREFACTOR)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_GRID_DEFINITION_HINT@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_GRID_DEFINITION_HINT)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_WAVELENGTH@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_WAVELENGTH)/g' \
+ $@.in > $@
+
+$(COMBUSTION_DEP):
+ @$(CC) $(CFLAGS_SO) $(COMBUSTION_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
+
+$(COMBUSTION_OBJ):
+ $(CC) $(CFLAGS_SO) $(COMBUSTION_DPDC_CFLAGS) -Isrc -DHTRDR_SHARED_BUILD -c $(@:.o=.c) -o $@
+
+htrdr-combustion.pc: config.mk htrdr-combustion.pc.in
+ sed -e 's/@VERSION@/$(VERSION)/g' \
+ -e 's/@ATRSTM_VERSION@/$(ATRSTM_VERSION)/g' \
+ -e 's/@RSYS_VERSION@/$(RSYS_VERSION)/g' \
+ -e 's/@S3D_VERSION@/$(S3D_VERSION)/g' \
+ -e 's/@SCAM_VERSION@/$(SCAM_VERSION)/g' \
+ -e 's/@SSF_VERSION@/$(SSF_VERSION)/g' \
+ -e 's/@SSP_VERSION@/$(SSP_VERSION)/g' \
+ -e 's/@SVX_VERSION@/$(SVX_VERSION)/g' \
+ $@.in > $@
+
+clean_combustion:
+ rm -f $(COMBUSTION_OBJ) $(COMBUSTION_LIBNAME)
+ rm -f .config_combustion libhtrdr-combustion.o htrdr-combustion.pc
+ rm -f src/combustion/htrdr_combustion_args.h
+
+distclean_combustion: clean_combustion
+ rm -f $(COMBUSTION_DEP)
+
+################################################################################
+# Building the planeto library
+################################################################################
+PLANETO_LIBNAME = libhtrdr-planeto.a
+
+PLANETO_SRC =\
+ src/planeto/htrdr_planeto.c\
+ src/planeto/htrdr_planeto_args.c\
+ src/planeto/htrdr_planeto_compute_radiance.c\
+ src/planeto/htrdr_planeto_draw_map.c\
+ src/planeto/htrdr_planeto_main.c\
+ src/planeto/htrdr_planeto_source.c
+PLANETO_OBJ = $(PLANETO_SRC:.c=.o)
+PLANETO_DEP = $(PLANETO_SRC:.c=.d)
+
+build_planeto: build_core .config_planeto htrdr-planeto.pc $(PLANETO_DEP)
+ @$(MAKE) -fMakefile $$(for i in $(PLANETO_DEP); do echo -f $${i}; done) \
+ $(PLANETO_LIBNAME)
+
+$(PLANETO_DEP) $(PLANETO_OBJ): config.mk src/planeto/htrdr_planeto_args.h
+
+$(PLANETO_LIBNAME): libhtrdr-planeto.o
+ $(AR) -rc $@ $?
+ $(RANLIB) $@
+
+libhtrdr-planeto.o: $(PLANETO_OBJ)
+ $(LD) -r $(PLANETO_OBJ) -o $@
+ $(OBJCOPY) $(OCPFLAGS) $@
+
+.config_planeto: config.mk
+ @if ! $(PKG_CONFIG) --atleast-version $(RNATM_VERSION) rnatm; then \
+ echo "rnatm $(RNATM_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(RNGRD_VERSION) rngrd; then \
+ echo "rngrd $(RNGRD_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
+ echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(S3D_VERSION) s3d; then \
+ echo "s3d $(S3D_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SBUF_VERSION) sbuf; then \
+ echo "sbuf $(SBUF_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SCAM_VERSION) scam; then \
+ echo "scam $(SCAM_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SSF_VERSION) ssf; then \
+ echo "ssf $(SSF_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SSP_VERSION) star-sp; then \
+ echo "star-sp $(SSP_VERSION) not found" >&2; exit 1; fi
+ @if ! $(PKG_CONFIG) --atleast-version $(SVX_VERSION) svx; then \
+ echo "svx $(SVX_VERSION) not found" >&2; exit 1; fi
+ @echo "config done" > $@
+
+src/planeto/htrdr_planeto_args.h: config.mk src/planeto/htrdr_planeto_args.h.in
+ sed -e 's/@HTRDR_PLANETO_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@/$(HTRDR_PLANETO_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD)/g' \
+ -e 's/@HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT@/$(HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT)/g' \
+ $@.in > $@
+
+$(PLANETO_DEP):
+ @$(CC) $(CFLAGS_SO) $(PLANETO_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
+
+$(PLANETO_OBJ):
+ $(CC) $(CFLAGS_SO) $(PLANETO_DPDC_CFLAGS) -Isrc -DHTRDR_SHARED_BUILD -c $(@:.o=.c) -o $@
+
+htrdr-planeto.pc: config.mk htrdr-planeto.pc.in
+ sed -e 's/@VERSION@/$(VERSION)/g' \
+ -e 's/@RNATM_VERSION@/$(RNATM_VERSION)/g' \
+ -e 's/@RNGRD_VERSION@/$(RNGRD_VERSION)/g' \
+ -e 's/@RSYS_VERSION@/$(RSYS_VERSION)/g' \
+ -e 's/@S3D_VERSION@/$(S3D_VERSION)/g' \
+ -e 's/@SBUF_VERSION@/$(SBUF_VERSION)/g' \
+ -e 's/@SCAM_VERSION@/$(SCAM_VERSION)/g' \
+ -e 's/@SSF_VERSION@/$(SSF_VERSION)/g' \
+ -e 's/@SSP_VERSION@/$(SSP_VERSION)/g' \
+ -e 's/@SVX_VERSION@/$(SVX_VERSION)/g' \
+ $@.in > $@
+
+clean_planeto:
+ rm -f $(PLANETO_OBJ) $(PLANETO_LIBNAME)
+ rm -f .config_planeto libhtrdr-planeto.o htrdr-planeto.pc
+ rm -f src/planeto/htrdr_planeto_args.h
+
+distclean_planeto: clean_planeto
+ rm -f $(PLANETO_DEP)
+
+################################################################################
+# Man pages
+################################################################################
+man: doc/htrdr-atmosphere.1 doc/htrdr-combustion.1 doc/htrdr-planeto.1
+
+doc/htrdr-atmosphere.1: doc/htrdr-atmosphere.1.in
+ sed -e 's/@HTRDR_ATMOSPHERE_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@/$(HTRDR_ATMOSPHERE_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD)/g' \
+ -e 's/@HTRDR_ATMOSPHERE_ARGS_DEFAULT_SKY_MTL_NAME@/$(HTRDR_ATMOSPHERE_ARGS_DEFAULT_SKY_MTL_NAME)/g' \
+ -e 's/@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@/$(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN)/g' \
+ -e 's/@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@/$(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_POS@/$(HTRDR_ARGS_DEFAULT_CAMERA_POS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_TGT@/$(HTRDR_ARGS_DEFAULT_CAMERA_TGT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_UP@/$(HTRDR_ARGS_DEFAULT_CAMERA_UP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_WIDTH@/$(HTRDR_ARGS_DEFAULT_IMG_WIDTH)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@/$(HTRDR_ARGS_DEFAULT_IMG_HEIGHT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_SPP@/$(HTRDR_ARGS_DEFAULT_IMG_SPP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_POS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_TGT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_UP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_SZ)/g'\
+ $@.in > $@
+
+doc/htrdr-combustion.1: doc/htrdr-combustion.1.in
+ sed -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_LASER_FLUX_DENSITY@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_LASER_FLUX_DENSITY)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_DIMENSION@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_DIMENSION)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_PREFACTOR@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_PREFACTOR)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_GRID_DEFINITION_HINT@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_GRID_DEFINITION_HINT)/g' \
+ -e 's/@HTRDR_COMBUSTION_ARGS_DEFAULT_WAVELENGTH@/$(HTRDR_COMBUSTION_ARGS_DEFAULT_WAVELENGTH)/g' \
+ -e 's/@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@/$(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN)/g' \
+ -e 's/@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@/$(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_POS@/$(HTRDR_ARGS_DEFAULT_CAMERA_POS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_TGT@/$(HTRDR_ARGS_DEFAULT_CAMERA_TGT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_UP@/$(HTRDR_ARGS_DEFAULT_CAMERA_UP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_WIDTH@/$(HTRDR_ARGS_DEFAULT_IMG_WIDTH)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@/$(HTRDR_ARGS_DEFAULT_IMG_HEIGHT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_SPP@/$(HTRDR_ARGS_DEFAULT_IMG_SPP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_POS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_TGT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_UP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@/$(HTRDR_ARGS_DEFAULT_RECTANGLE_SZ)/g'\
+ $@.in > $@
+
+doc/htrdr-planeto.1: doc/htrdr-planeto.1.in
+ sed -e 's/@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@/$(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN)/g' \
+ -e 's/@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@/$(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@/$(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_POS@/$(HTRDR_ARGS_DEFAULT_CAMERA_POS)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_TGT@/$(HTRDR_ARGS_DEFAULT_CAMERA_TGT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_CAMERA_UP@/$(HTRDR_ARGS_DEFAULT_CAMERA_UP)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_WIDTH@/$(HTRDR_ARGS_DEFAULT_IMG_WIDTH)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@/$(HTRDR_ARGS_DEFAULT_IMG_HEIGHT)/g' \
+ -e 's/@HTRDR_ARGS_DEFAULT_IMG_SPP@/$(HTRDR_ARGS_DEFAULT_IMG_SPP)/g' \
+ -e 's/@HTRDR_PLANETO_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@/$(HTRDR_PLANETO_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD)/g' \
+ -e 's/@HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT@/$(HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT)/g' \
+ $@.in > $@
+
+clean_man:
+ rm -f doc/htrdr-atmosphere.1 doc/htrdr-combustion.1 doc/htrdr-planeto.1
+
+################################################################################
+# Installation
+################################################################################
+install: all
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/bin" htrdr
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/bin" htrdr-atmosphere
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/bin" htrdr-combustion
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/bin" htrdr-planeto
+ @if [ "$(LIB_TYPE)" = "SHARED" ]; then \
+ $(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/lib" $(CORE_LIBNAME_SHARED); fi
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/doc/htrdr" COPYING README.md
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man1" doc/htrdr.1
+ @if [ "$(ATMOSPHERE)" = "ENABLE" ]; then \
+ $(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man1" doc/htrdr-atmosphere.1; fi
+ @if [ "$(COMBUSTION)" = "ENABLE" ]; then \
+ $(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man1" doc/htrdr-combustion.1; fi
+ @if [ "$(PLANETO)" = "ENABLE" ]; then \
+ $(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man1" doc/htrdr-planeto.1; fi
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man5" doc/htrdr-image.5
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man5" doc/htrdr-materials.5
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man5" doc/htrdr-obj.5
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man5" doc/rnrl.5
+
+uninstall:
+ rm -f "$(DESTDIR)$(PREFIX)/bin/htrdr"
+ rm -f "$(DESTDIR)$(PREFIX)/bin/htrdr-atmosphere"
+ rm -f "$(DESTDIR)$(PREFIX)/bin/htrdr-combustion"
+ rm -f "$(DESTDIR)$(PREFIX)/bin/htrdr-planeto"
+ rm -f "$(DESTDIR)$(PREFIX)/lib/$(CORE_LIBNAME_SHARED)"
+ rm -f "$(DESTDIR)$(PREFIX)/share/doc/htrdr/COPYING"
+ rm -f "$(DESTDIR)$(PREFIX)/share/doc/htrdr/README.md"
+ rm -f "$(DESTDIR)$(PREFIX)/share/man/man1/htrdr.1"
+ rm -f "$(DESTDIR)$(PREFIX)/share/man/man1/htrdr-atmosphere.1"
+ rm -f "$(DESTDIR)$(PREFIX)/share/man/man1/htrdr-combustion.1"
+ rm -f "$(DESTDIR)$(PREFIX)/share/man/man1/htrdr-planeto.1"
+ rm -f "$(DESTDIR)$(PREFIX)/share/man/man5/htrdr-image.5"
+ rm -f "$(DESTDIR)$(PREFIX)/share/man/man5/htrdr-materials.5"
+ rm -f "$(DESTDIR)$(PREFIX)/share/man/man5/htrdr-obj.5"
+ rm -f "$(DESTDIR)$(PREFIX)/share/man/man5/rnrl.5"
+
+################################################################################
+# Miscellaneous targets
+################################################################################
+clean:\
+ clean_htrdr\
+ clean_htrdr-atmosphere\
+ clean_htrdr-combustion\
+ clean_htrdr-planeto\
+ clean_atmosphere\
+ clean_combustion\
+ clean_planeto\
+ clean_core\
+ clean_man
+
+distclean:\
+ distclean_htrdr\
+ distclean_htrdr-atmosphere\
+ distclean_htrdr-combustion\
+ distclean_htrdr-planeto\
+ distclean_atmosphere\
+ distclean_combustion\
+ distclean_planeto\
+ distclean_core\
+ clean_man
+
+lint: doc/htrdr-atmosphere.1 doc/htrdr-combustion.1 doc/htrdr-planeto.1
+ shellcheck -o all make.sh
+ mandoc -Tlint -Wall doc/htrdr.1 || [ $$? -le 1 ]
+ mandoc -Tlint -Wall doc/htrdr-atmosphere.1 || [ $$? -le 1 ]
+ mandoc -Tlint -Wall doc/htrdr-combustion.1 || [ $$? -le 1 ]
+ mandoc -Tlint -Wall doc/htrdr-planeto.1 || [ $$? -le 1 ]
+ mandoc -Tlint -Wall doc/htrdr-image.5 || [ $$? -le 1 ]
+ mandoc -Tlint -Wall doc/htrdr-materials.5 || [ $$? -le 1 ]
+ mandoc -Tlint -Wall doc/htrdr-obj.5 || [ $$? -le 1 ]
+ mandoc -Tlint -Wall doc/rnrl.5 || [ $$? -le 1 ]
diff --git a/README.md b/README.md
@@ -1,120 +1,159 @@
# `htrdr`
-`htrdr` evaluates the intensity at any position (probe) of the scene, in any
-direction, in the presence of *surfaces* and an *absorbing and diffusing
-semi-transparent medium*, for both *internal* (longwave) or *external*
-(shortwave) *radiation sources*. The intensity is calculated using the
-*Monte-Carlo* method: a number of optical paths are simulated backward, from the
-probe position and into the medium. Various algorithms are used, depending on
-the specificities of the nature and shape of the radiation source.
-
-Applications are theoretically possible to any configuration. However, it all
-eventually comes down to the possibility of using the physical data of
-interest, in their most common formats, in each scientific community. `htrdr` is
-currently suitable for three main application fields:
-
-1. *Atmospheric radiative transfer:* a clear-sky atmosphere is vertically
- stratified, neglecting Earth sphericity, and described in terms of
- absorption coefficients as a function of height and spectral quadrature
- point as per a correlated-k model. Cloud physical properties are provided on
- a 3D rectangular grid. Surface geometrical and optical properties can be
- provided for an arbitrary number of geometries. Internal radiation and solar
- radiation are taken into account.
-
-2. *Combustion* processes: thermodynamic data is provided at the nodes of an
- unstructured tetrahedral mesh, while surface properties can still be
- provided for various materials. The radiation source is only external: a
- monochromatic laser sheet illuminates the inside of the combustion chamber
- for diagnostic purposes.
-
-3. *Planetology*: takes into account the geometry of a "ground" of arbitrary
- shape, described by a triangular mesh, with the possibility of using an
- arbitrary number of materials. The radiative properties of a gas mixture
- must be provided on a tetrahedral mesh, using the k-distribution spectral
- model. The radiative properties of an arbitrary number of aerosol and
- hydrometeores can also be provided on their individual tetrahedral mesh.
- Calculations can be made for both internal and external radiation sources.
- In the case of an external source, a sphere of arbitrary size and position
- is used. This sphere can radiate as a Planck source at a specified
- brightness temperature, or be associated with a high-resolution radiance
- spectrum.
-
-Since any radiative transfer observable is expressed as an integral of the
-intensity, and since there is a strict equivalence between the integral to be
-solved and the underlying Monte-Carlo algorithm (each integral results in the
-sampling of a random variable), the algorithms that calculate the radiance are
-used for computing various quantities:
+`htrdr` evaluates the intensity at any position (probe) of the scene, in
+any direction, in the presence of *surfaces* and an *absorbing and
+diffusing semi-transparent medium*, for both *internal* (longwave) or
+*external* (shortwave) *radiation sources*. The intensity is calculated
+using the *Monte Carlo* method: a number of optical paths are simulated
+backward, from the probe position and into the medium. Various
+algorithms are used, depending on the specificities of the nature and
+shape of the radiation source.
+
+Applications are theoretically possible to any configuration. However,
+it all eventually comes down to the possibility of using the physical
+data of interest, in their most common formats, in each scientific
+community. `htrdr` is currently suitable for three main application
+fields:
+
+1. *Atmospheric radiative transfer:* a clear-sky atmosphere is
+ vertically stratified, neglecting Earth sphericity, and described in
+ terms of absorption coefficients as a function of height and spectral
+ quadrature point as per a correlated-k model. Cloud physical
+ properties are provided on a 3D rectangular grid. Surface geometrical
+ and optical properties can be provided for an arbitrary number of
+ geometries. Internal radiation and solar radiation are taken into
+ account.
+
+2. *Combustion* processes: thermodynamic data is provided at the nodes
+ of an unstructured tetrahedral mesh, while surface properties can
+ still be provided for various materials. The radiation source is only
+ external: a monochromatic laser sheet illuminates the inside of the
+ combustion chamber for diagnostic purposes.
+
+3. *Planetology*: takes into account the geometry of a "ground" of
+ arbitrary shape, described by a triangular mesh, with the possibility
+ of using an arbitrary number of materials. The radiative properties
+ of a gas mixture must be provided on a tetrahedral mesh, using the
+ k-distribution spectral model. The radiative properties of an
+ arbitrary number of aerosol and hydrometeores can also be provided on
+ their individual tetrahedral mesh. Calculations can be made for both
+ internal and external radiation sources. In the case of an external
+ source, a sphere of arbitrary size and position is used. This sphere
+ can radiate as a Planck source at a specified brightness temperature,
+ or be associated with a high-resolution radiance spectrum.
+
+Since any radiative transfer observable is expressed as an integral of
+the intensity, and since there is a strict equivalence between the
+integral to be solved and the underlying Monte Carlo algorithm (each
+integral results in the sampling of a random variable), the algorithms
+that calculate the radiance are used for computing various quantities:
- *Images* on a camera sensor, in a given field of view. For combustion
applications, only monochromatic images are supported. In atmospheres,
- spectral integration is also possible, both for solar and thermal images: CIE
- colorimetry is used for solar images, while thermal images are in fact
- brightness temperature maps, obtained from the incoming radiative flux over a
- specified spectral interval.
+ spectral integration is also possible, both for solar and thermal
+ images: CIE colorimetry is used for solar images, while thermal images
+ are in fact brightness temperature maps, obtained from the incoming
+ radiative flux over a specified spectral interval.
- *Flux density maps*, on a sensor grid, integrated over an entire
- hemisphere. In the case of combustion chambers, only monochromatic flux maps
- can be calculated, while spectrally integrated flux density maps (both on the
- visible part of the spectrum and on the infrared) are possible for
- atmospheric applications.
-
-## How to build
-
-This program is compatible GNU/Linux 64-bits. It relies on the
-[CMake](http://www.cmake.org) and the
-[RCMake](https://gitlab.com/vaplv/rcmake/) packages to build. It also depends
-on the
-[AW](https://gitlab.com/vaplv/loader_aw/#tab-readme),
-[MruMtl](https://gitlab.com/meso-star/mrumtl/),
-[RSys](https://gitlab.com/vaplv/rsys/),
-[Star-3D](https://gitlab.com/meso-star/star-3d/),
-[Star-Camera](https://gitlab.com/meso-star/star-camera),
-[Star-SF](https://gitlab.com/meso-star/star-sf/),
-[Star-SP](https://gitlab.com/meso-star/stat-sp/) and
-[Star-VX](https://gitlab.com/meso-star/star-vx/) libraries and on
-[OpenMP](http://www.openmp.org) 1.2 and the
-[MPI](https://www.mpi-forum.org/) 2 specification to parallelize its
-computations. It optionally depends on [scdoc](https://sr.ht/~sircmpwn/scdoc/)
-which, if available, is used to generate the man pages.
-
-`htrdr` finally depends on the [HTSky](https://gitlab.com/meso-star/htsky/)
-library if the `HTRDR_BUILD_ATMOSPHERE` option is set, on
-[AtrSTM](https://gitlab.com/meso-star/atrstm/) when `HTRDR_BUILD_COMBUSTION` is
-set, and on [RNAtm](https://gitlab.com/meso-star/rnatm/),
-[RNGrd](https://gitlab.com/meso-star/rngrd/) and
-[Star-Buffer](https://gitlab.com/meso-star/star-buffer/) if
-`HTRDR_BUILD_PLANETO` is enabled. These compilation options enable/disable the
-build of the atmospheric, combustion, and planetology parts of `htrdr`. By
-default, all options are enabled.
-
-To build `htrdr`, first ensure that CMake is installed on your system. Then
-install the RCMake package as well as 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. The
-resulting project can be edited, built, tested and installed as any CMake
-project. Refer to the [CMake](https://cmake.org/documentation) for further
-informations on CMake.
+ hemisphere. In the case of combustion chambers, only monochromatic
+ flux maps can be calculated, while spectrally integrated flux density
+ maps (both on the visible part of the spectrum and on the infrared)
+ are possible for atmospheric applications.
+
+## Requirements
+
+- C compiler with OpenMP support
+- POSIX make
+- pkg-config
+- Message Passing Interface (MPI)
+- [mandoc](https://mandoc.bsd.lv)
+- [AW](https://gitlab.com/vaplv/loader_aw)
+- [Astoria: Semi-Transparent Medium](https://gitlab.com/meso-star/atrstm)
+ (optional; required by COMBUSTION)
+- [High-Tune: Sky](https://gitlab.com/meso-star/htsky)
+ (optional; required by ATMOSHPERE)
+- [ModRadUrb: MaTeriaL](https://gitlab.com/meso-star/mrumtl)
+- [Rad-Net ATMopshere](https://gitlab.com/meso-star/rnatm)
+ (optional; required by PLANETO)
+- [Rad-Net GRounD](https://gitlab.com/meso-star/rngrd)
+ (optional; required by PLANETO)
+- [RSys](https://gitlab.com/vaplv/rsys)
+- [Star 3D](https://gitlab.com/meso-star/star-3d)
+- [Star Buffer](https://gitlab.com/meso-star/star-buffer)
+ (optional; required by PLANETO)
+- [Star Camera](https://gitlab.com/meso-star/star-camera)
+- [Star Scattering Functions](https://gitlab.com/meso-star/star-sf)
+- [Star SamPling](https://gitlab.com/meso-star/star-sp)
+- [Star VoXel](https://gitlab.com/meso-star/star-vx)
+
+## Installation
+
+Edit config.mk as needed, then run:
+
+ make clean install
## Release notes
+### Version 0.10
+
+#### Use POSIX make as a build system
+
+The build procedure is now written in POSIX make instead of CMake.
+In addition to the features already provided by its CMake alternative,
+the Makefile supports the use of static libraries and provides an
+uninstall target. In any case, the main motivation behind its writing is
+to use a good old well-established standard with simple features,
+available on all UNIX systems, thus simplifying its portability and
+support while being much lighter
+
+#### Proof-reading and editing manual pages
+
+Write the man pages directly in mdoc's roff macros, instead of using the
+scdoc markup language as a source for man pages.
+
+Unlike writing manuals with man's roff macros, and even more so with
+scdoc, mdoc macros take care of layout, font handling and all the other
+typesetting details which, by construction, guarantee the consistency of
+all manuals without leaving the responsibility to the individual author.
+This also facilitates translation into other formats and documentation
+tools. These are the main reasons for writing manual pages with mdoc
+macros.
+
+A complete re-reading of the manual pages was carried out during the
+translation into mdoc, with several corrections and rewrites to make the
+manual clearer.
+
+#### Bug fixes
+
+- Fix the construction of the planck/CIE cumulative: the memory space
+ required could be prohibitive, leading to a shortage of memory space.
+- Update error handling in `htrdr_ran_wlen_planck_create` to avoid
+ freeing up the same memory space several times, and thus causing a
+ crash.
+- All dependencies have been updated. In particular, the `htmi` and
+ `rnatm` libraries have been updated to version 0.1. They fixe several
+ problems with the atmosphere and planeto commands. See their release
+ note for more information.
+
### Version 0.9.2
-- Update the `rnatm` library to version 0.0.1. This versions fixes several
- bugs when different atmospheric components do not have the same volumetric
- meshes.
+- Update the `rnatm` library to version 0.0.1. This versions fixes
+ several bugs when different atmospheric components do not have the
+ same volumetric meshes.
- Display an error message when parsing unknown arguments to the
`htrdr-planeto` command.
-- Fix `htrdr-planeto` man page: there was an error in the `csplit` command
- provided as an example to extract octrees from the output of `htrdr-planeto`
- when the -d option is used.
+- Fix `htrdr-planeto` man page: there was an error in the `csplit`
+ command provided as an example to extract octrees from the output of
+ `htrdr-planeto` when the -d option is used.
### Version 0.9.1
- Fix invalid read/write memory access when ray tracing the ground in
`htrdr-atmopshere`.
- Fix compilation warning detected by GCC 12.
-- Fix `htrdr-planeto` man page (-S option): the unit of the
- radius and the distance from the source is not the meter but the kilometer.
+- Fix `htrdr-planeto` man page (-S option): the unit of the radius and
+ the distance from the source is not the meter but the kilometer.
- Fix `htrdr` man page: replaced long options with short options.
- Reference and install the rnrl fileformat man page.
- Proofreading the README and man pages: correcting typos, spelling and
@@ -124,26 +163,28 @@ informations on CMake.
#### Adds radiative transfer simulation in 3D planetary atmospheres
-The new `htrdr-planeto` command simulates radiative transfer in planetology
-context, i.e. in the 3D atmosphere of a telluric planet. Both infrared and
-visible computations are supported. `htrdr-planeto` is actually a renderer that
-calculates an image for a given observation position. Its internal rendering
-algorithm is based on Monte-Carlo integration, which consists for each pixel in
-simulating a given number of optical paths from the sensor, taking into account
-the phenomena of light absorption and scattering.
+The new `htrdr-planeto` command simulates radiative transfer in
+planetology context, i.e. in the 3D atmosphere of a telluric planet.
+Both infrared and visible computations are supported. `htrdr-planeto` is
+actually a renderer that calculates an image for a given observation
+position. Its internal rendering algorithm is based on Monte Carlo
+integration, which consists for each pixel in simulating a given number
+of optical paths from the sensor, taking into account the phenomena of
+light absorption and scattering.
-The planet's ground can be any set of triangles with BRDFs and temperatures
-defined per triangle. The atmosphere is composed of a gas mixture and a
-potentially empty set of aerosols. Both can have arbitrary tetrahedral meshes
-with per-node radiative properties.
+The planet's ground can be any set of triangles with BRDFs and
+temperatures defined per triangle. The atmosphere is composed of a gas
+mixture and a potentially empty set of aerosols. Both can have arbitrary
+tetrahedral meshes with per-node radiative properties.
#### Miscellaneous
- Use scdoc rather than asciidoc as file format for man sources.
- Update all dependencies. More notably, use
- [MruMtl 0.1](https://gitlab.com/meso-star/mrumtl/-/tree/0.1) which introduces
- API breaks.
-- Add the discrete wavelength distribution currently used in `htrdr-planeto` only.
+ [MruMtl 0.1](https://gitlab.com/meso-star/mrumtl/-/tree/0.1)
+ which introduces API breaks.
+- Add the discrete wavelength distribution currently used in
+ `htrdr-planeto` only.
### Version 0.8.1
@@ -152,125 +193,133 @@ compilation errors with gcc 11 but introduces API breaks.
### Version 0.8
-- Adds support for a thin lens camera model and an orthographic camera model
- for combustion and atmosphere modes.
-- Updates the size of a tile from 32x32 pixels to 8x8 pixels. A tile is a
- block of pixels rendered by a thread. However, a size of 32x32 pixels could
- be too large when rendering on several dozen threads: the image definition
- could be insufficient to give tiles to all threads.
-- Fixes the calculation of shortwave radiance by `htrdr-combustion` and the
- calculation of longwave radiance by `htrdr-atmosphere`. At each scattering
- position, the range of the traced ray could be incorrect.
+- Adds support for a thin lens camera model and an orthographic camera
+ model for combustion and atmosphere modes.
+- Updates the size of a tile from 32x32 pixels to 8x8 pixels. A tile is
+ a block of pixels rendered by a thread. However, a size of 32x32
+ pixels could be too large when rendering on several dozen threads: the
+ image definition could be insufficient to give tiles to all threads.
+- Fixes the calculation of shortwave radiance by `htrdr-combustion` and
+ the calculation of longwave radiance by `htrdr-atmosphere`. At each
+ scattering position, the range of the traced ray could be incorrect.
### Version 0.7
#### Adds the simulation of radiative transfer in combustion media
-The new `htrdr-combustion` command performs radiative transfer computations in
-a scene representing a semi-transparent medium enlightened by a laser sheet. It
-uses Monte-Carlo to calculate a monochromatic image of the medium or the
-radiative flux density. Both computations are performed in the visible at a
-given frequency.
+The new `htrdr-combustion` command performs radiative transfer
+computations in a scene representing a semi-transparent medium
+enlightened by a laser sheet. It uses Monte Carlo to calculate a
+monochromatic image of the medium or the radiative flux density. Both
+computations are performed in the visible at a given frequency.
-The medium data are defined on the vertices of an unstructured tetrahedral mesh
-that may be surrounded by a triangular surface mesh representing the inner
-limits of the combustion chamber.
+The medium data are defined on the vertices of an unstructured
+tetrahedral mesh that may be surrounded by a triangular surface mesh
+representing the inner limits of the combustion chamber.
#### Updates the `htrdr` command
-The previous `htrdr` command is renamed to `htrdr-atmosphere`. `htrdr` becomes
-a proxy for the `htrdr-atmosphere` command or the `htrdr-combustion` command:
-calling `htrdr` with the `<atmosphere|combustion>` options is equivalent to
-directly calling the `htrdr-<atmosphere|combustion>` commands.
+The previous `htrdr` command is renamed to `htrdr-atmosphere`. `htrdr`
+becomes a proxy for the `htrdr-atmosphere` command or the
+`htrdr-combustion` command: calling `htrdr` with the
+`<atmosphere|combustion>` options is equivalent to directly calling the
+`htrdr-<atmosphere|combustion>` commands.
#### Miscellaneous
-- Major update of the entire codebase to add multiple applications to `htrdr`:
- It was originally designed to handle atmospheric applications only.
-- Always displays the number of processes and the number of threads: previously
- they were only printed on multi-node executions.
+- Major update of the entire codebase to add multiple applications to
+ `htrdr`: It was originally designed to handle atmospheric applications
+ only.
+- Always displays the number of processes and the number of threads:
+ previously they were only printed on multi-node executions.
- Fixed auto intersection issue on surfaces not facing the sun.
- Fixed writing of pixel data: assumed pixel layout could be wrong.
### Version 0.6.1
-- Fix the self-intersection issue in shortwave computations introduced by
- the 0.6 version.
+- Fix the self-intersection issue in shortwave computations introduced
+ by the 0.6 version.
### Version 0.6
#### New features
-- Add support of flux map computation for both shortwave and longwave. The flux
- is computed for the part of the flux map lying outside any geometry. The new
- command line option `-p` defines the rectangle in the scene onto which the
- flux is going to be integrated. The flux map resolution and the realisations
- count per pixel is controlled by the `-i` option.
-- Add support of thin materials, i.e. materials without geometric thickness as
- for instance the leaves of the trees.
+- Add support of flux map computation for both shortwave and longwave.
+ The flux is computed for the part of the flux map lying outside any
+ geometry. The new command line option `-p` defines the rectangle in
+ the scene onto which the flux is going to be integrated. The flux map
+ resolution and the realisations count per pixel is controlled by the
+ `-i` option.
+- Add support of thin materials, i.e. materials without geometric
+ thickness as for instance the leaves of the trees.
- Add the temperature property to the materials and used it as the limit
- condition during longwave computations. Previously, the surface temperatures
- were fetched from the atmosphere at the given surface position.
-- Add the `-n` option to fix the name of the material defining the atmosphere.
+ condition during longwave computations. Previously, the surface
+ temperatures were fetched from the atmosphere at the given surface
+ position.
+- Add the `-n` option to fix the name of the material defining the
+ atmosphere.
#### Fix
-- In shortwave, fix how direct contribution is handled for purely specular
- BRDF.
+- In shortwave, fix how direct contribution is handled for purely
+ specular BRDF.
### Version 0.5.1
-- Fix the `undefined strtok_r symbol` issue exhibited by some GCC versions that
- leads to memory corruption and segmentation fault when parsing the ground
- interfaces.
+- Fix the `undefined strtok_r symbol` issue exhibited by some GCC
+ versions that leads to memory corruption and segmentation fault when
+ parsing the ground interfaces.
- Fix typos in the man pages.
### Version 0.5
#### New feature
-Add support of shortwave integration with respect to the Planck function for a
-reference temperature whose default value is the blackbody temperature of the
-sun. Actually this is the counterpart of the longwave integration introduced by
-the "infrared rendering" in the 0.4 version. The main difference is that the
-source of radiation is the sun rather than the medium and its boundaries.
+Add support of shortwave integration with respect to the Planck function
+for a reference temperature whose default value is the blackbody
+temperature of the sun. Actually this is the counterpart of the longwave
+integration introduced by the "infrared rendering" in the 0.4 version.
+The main difference is that the source of radiation is the sun rather
+than the medium and its boundaries.
-The option `-l` that enabled the infrared rendering is now replaced by the new
-`-s` option that controls the spectral integration that can be CIE XYZ (i.e.
-regular image rendering), longwave or shortwave.
+The option `-l` that enabled the infrared rendering is now replaced by
+the new `-s` option that controls the spectral integration that can be
+CIE XYZ (i.e. regular image rendering), longwave or shortwave.
#### Fixes
- Fix the returned sun radiance: the precomputed per spectral band solar
- incoming flux is removed and the sun radiance is now retrieved by directly
- evaluating the monochromatic Planck for the blackbody temperature of the sun.
-- Fix CIE XYZ spectral integration: the pdf used to sample the CIE tristimulus
- values was not correctly handled in the Monte-Carlo weight.
-- Fix the longwave spectral integration: the Monte-Carlo weight was wrong
- leading to overestimated temperatures.
+ incoming flux is removed and the sun radiance is now retrieved by
+ directly evaluating the monochromatic Planck for the blackbody
+ temperature of the sun.
+- Fix CIE XYZ spectral integration: the pdf used to sample the CIE
+ tristimulus values was not correctly handled in the Monte Carlo
+ weight.
+- Fix the longwave spectral integration: the Monte Carlo weight was
+ wrong leading to overestimated temperatures.
### Version 0.4
#### New features
-- Add support of infrared rendering: when defined, the new `-l` option setups
- the range of longwave into which the rendering is performed. In infrared
- rendering, each pixel stores the radiance per pixel and its associated
- brightness temperature. Spectral integration is done with respect to the
- Planck function for a reference temperature of 290 K.
-- The ground geometry can now have several materials whose data vary over the
- spectrum. These materials are listed in a new
+- Add support of infrared rendering: when defined, the new `-l` option
+ setups the range of longwave into which the rendering is performed. In
+ infrared rendering, each pixel stores the radiance per pixel and its
+ associated brightness temperature. Spectral integration is done with
+ respect to the Planck function for a reference temperature of 290 K.
+- The ground geometry can now have several materials whose data vary
+ over the spectrum. These materials are listed in a new
[htrdr-materials](https://gitlab.com/meso-star/htrdr/-/blob/master/doc/htrdr-materials.5.txt)
- file where each materials is defined by a name and a file storing its spectral
- data with respect to the
+ file where each materials is defined by a name and a file storing its
+ spectral data with respect to the
[MruMtl](https://gitlab.com/meso-star/mrumtl/-/blob/master/doc/mrumtl.5.txt)
- fileformat. A material is mapped to a part of the OBJ geometry by using the
- `usemtl` directive of the
+ fileformat. A material is mapped to a part of the OBJ geometry by
+ using the `usemtl` directive of the
[OBJ fileformat](https://gitlab.com/meso-star/htrdr/-/blob/master/doc/htrdr-obj.5.txt).
- Improve the sampling of the spectral dimension: the per wavelength
- realisation is now precisely sampled rather than arbitrarly fixed to the
- center of the sampled spectral band. Consequently, high
- resolution data defined per wavelength (e.g. Mie's properties and the
+ realisation is now precisely sampled rather than arbitrarly fixed to
+ the center of the sampled spectral band. Consequently, high resolution
+ data defined per wavelength (e.g. Mie's properties and the
reflectivity of the materials) are now fully taken into account.
#### Fixes
@@ -280,49 +329,50 @@ regular image rendering), longwave or shortwave.
### Version 0.3
-- Add the `-O` option that defines the file where the sky data are cached. If
- the file does not exist, the sky data structures are built from scratch and
- serialized into this new file. If this file exists, these data structures are
- directly read from it, leading to a huge speed up of the `htrdr`
- pre-processing step. Note that if the provided file exists but is filled with
- data that do not match the submitted HTGOP, HTCP and HTMie files, an error is
- detected and the program stops.
-- Rely on the HTSky library to manage the sky data. This library handles the
- code previously defined into the `htrdr_sky.<c|h>` files. The HTCP, HTGOP,
- HTMie libraries are thus no more dependencies of `htrdr` since only the
- `htrdr_sky` files used them.
+- Add the `-O` option that defines the file where the sky data are
+ cached. If the file does not exist, the sky data structures are built
+ from scratch and serialized into this new file. If this file exists,
+ these data structures are directly read from it, leading to a huge
+ speed up of the `htrdr` pre-processing step. Note that if the provided
+ file exists but is filled with data that do not match the submitted
+ HTGOP, HTCP and HTMie files, an error is detected and the program
+ stops.
+- Rely on the HTSky library to manage the sky data. This library handles
+ the code previously defined into the `htrdr_sky.<c|h>` files. The
+ HTCP, HTGOP, HTMie libraries are thus no more dependencies of `htrdr`
+ since only the `htrdr_sky` files used them.
### Version 0.2
- Add the `-b` option that controls the BRDF of the ground geometry.
- Make optional the use of a ground geometry (option `-g`).
-- Make optional the definition of the optical properties of water droplets
- (option `-m`) when no cloud field is used.
+- Make optional the definition of the optical properties of water
+ droplets (option `-m`) when no cloud field is used.
### Version 0.1
-- Add the `-V` option that fixes the maximum definition of the octrees used to
- partitioned the radiative properties of the clouds.
+- Add the `-V` option that fixes the maximum definition of the octrees
+ used to partitioned the radiative properties of the clouds.
- Add a per pixel estimation of the per radiative path computation time.
### Version 0.0.4
-- Fix the computation of the surface scattering: there was a bug in how Russian
- roulette was implemented at surface scattering leading to an underestimation
- of the surface reflection.
-- Update the thread allocation policy: by default, the number of threads is now
- defined as the maximum between the number of processors detected by OpenMP
- and the number of threads defined by the `OMP_NUM_THREADS` environment
- variable. This variable can be used to counteract the number of processors
- detected by OpenMP that can be lower than the real number of processors of
- the system.
+- Fix the computation of the surface scattering: there was a bug in how
+ Russian roulette was implemented at surface scattering leading to an
+ underestimation of the surface reflection.
+- Update the thread allocation policy: by default, the number of threads
+ is now defined as the maximum between the number of processors
+ detected by OpenMP and the number of threads defined by the
+ `OMP_NUM_THREADS` environment variable. This variable can be used to
+ counteract the number of processors detected by OpenMP that can be
+ lower than the real number of processors of the system.
### Version 0.0.3
-- Fix compilation on systems with a GNU C Library whose version is less than
- 2.19.
-- Fix a possible invalid memory access to cloud data leading to segmentation
- faults.
+- Fix compilation on systems with a GNU C Library whose version is less
+ than 2.19.
+- Fix a possible invalid memory access to cloud data leading to
+ segmentation faults.
## Copyright notice
@@ -338,7 +388,7 @@ Copyright © 2018-2019, 2022-2023 Université Paul Sabatier
## License
-`htrdr` is free software released under the GPL v3+ license: GNU GPL version 3 or
-later. You are welcome to redistribute it under certain conditions; refer to
-the COPYING file for details.
+`htrdr` is free software released under the GPL v3+ license: GNU GPL
+version 3 or later. You are welcome to redistribute it under certain
+conditions; refer to the COPYING file for details.
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -1,76 +0,0 @@
-# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-# Copyright (C) 2022-2023 Observatoire de Paris
-# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-#
-# 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(htrdr C)
-enable_testing()
-
-set(HTRDR_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src)
-set(HTRDR_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
-
-set(VERSION_MAJOR 0)
-set(VERSION_MINOR 9)
-set(VERSION_PATCH 2)
-set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
-
-option(HTRDR_BUILD_ATMOSPHERE "Build the htrdr-atmosphere program" ON)
-option(HTRDR_BUILD_COMBUSTION "Build the htrdr-combustion program" ON)
-option(HTRDR_BUILD_PLANETO "Build the htrdr-planeto program" ON)
-
-set(HTRDR_BUILD_COMMANDS "")
-if(HTRDR_BUILD_ATMOSPHERE)
- set(HTRDR_BUILD_COMMANDS "${HTRDR_BUILD_COMMANDS};HTRDR_BUILD_ATMOSPHERE")
-endif()
-if(HTRDR_BUILD_COMBUSTION)
- set(HTRDR_BUILD_COMMANDS "${HTRDR_BUILD_COMMANDS};HTRDR_BUILD_COMBUSTION")
-endif()
-if(HTRDR_BUILD_PLANETO)
- set(HTRDR_BUILD_COMMANDS "${HTRDR_BUILD_COMMANDS};HTRDR_BUILD_PLANETO")
-endif()
-
-################################################################################
-# Add sub projects
-################################################################################
-add_subdirectory(core)
-
-if(HTRDR_BUILD_ATMOSPHERE)
- add_subdirectory(atmosphere)
-endif()
-if(HTRDR_BUILD_COMBUSTION)
- add_subdirectory(combustion)
-endif()
-if(HTRDR_BUILD_PLANETO)
- add_subdirectory(planeto)
-endif()
-
-add_subdirectory(commands)
-add_subdirectory(doc)
-
-################################################################################
-# Define output & install directories
-################################################################################
-set(HTRDR_FILES_DOC
- ${PROJECT_SOURCE_DIR}/../COPYING
- ${PROJECT_SOURCE_DIR}/../README.md)
-install(FILES ${HTRDR_FILES_DOC} DESTINATION share/doc/htrdr)
-
diff --git a/cmake/atmosphere/CMakeLists.txt b/cmake/atmosphere/CMakeLists.txt
@@ -1,114 +0,0 @@
-# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-# Copyright (C) 2022-2023 Observatoire de Paris
-# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-#
-# 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(htrdr-atmosphere)
-
-################################################################################
-# Check dependencies
-################################################################################
-find_package(HTSky 0.2 REQUIRED)
-find_package(RCMake 0.3 REQUIRED)
-find_package(RSys 0.11 REQUIRED)
-find_package(Star3D 0.8 REQUIRED)
-find_package(StarCamera 0.0 REQUIRED)
-find_package(StarSF 0.6 REQUIRED)
-find_package(StarSP 0.12 REQUIRED)
-find_package(StarVX 0.1 REQUIRED)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR})
-include(rcmake)
-include(rcmake_runtime)
-
-include_directories(
- ${HTSky_INCLUDE_DIR}
- ${RSys_INCLUDE_DIR}
- ${StarCamera_INCLUDE_DIR}
- ${Star3D_INCLUDE_DIR}
- ${StarSF_INCLUDE_DIR}
- ${StarSP_INCLUDE_DIR}
- ${StarVX_INCLUDE_DIR}
- ${HTRDR_BUILD_DIR}
- ${HTRDR_SOURCE_DIR})
-
-################################################################################
-# Generate files
-################################################################################
-set(HTRDR_ATMOSPHERE_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD "1" CACHE INTERNAL "")
-set(HTRDR_ATMOSPHERE_ARGS_DEFAULT_SKY_MTL_NAME "\"air\"" CACHE INTERNAL "")
-
-configure_file(${HTRDR_SOURCE_DIR}/atmosphere/htrdr_atmosphere_args.h.in
- ${HTRDR_BUILD_DIR}/atmosphere/htrdr_atmosphere_args.h @ONLY)
-
-################################################################################
-# Configure and define targets
-################################################################################
-set(HTRDR_ATMOSPHERE_FILES_SRC
- htrdr_atmosphere_args.c
- htrdr_atmosphere.c
- htrdr_atmosphere_compute_radiance_lw.c
- htrdr_atmosphere_compute_radiance_sw.c
- htrdr_atmosphere_draw_map.c
- htrdr_atmosphere_ground.c
- htrdr_atmosphere_main.c
- htrdr_atmosphere_sun.c)
-
-set(HTRDR_ATMOSPHERE_FILES_INC
- htrdr_atmosphere_c.h
- htrdr_atmosphere_ground.h
- htrdr_atmosphere.h
- htrdr_atmosphere_sun.h)
-
-set(HTRDR_ATMOSPHERE_FILES_INC2 # Generated files
- htrdr_atmosphere_args.h)
-
-# Prepend each file in the `HTRDR_FILES_<SRC|INC>' list by `HTRDR_SOURCE_DIR'
-rcmake_prepend_path(HTRDR_ATMOSPHERE_FILES_SRC ${HTRDR_SOURCE_DIR}/atmosphere)
-rcmake_prepend_path(HTRDR_ATMOSPHERE_FILES_INC ${HTRDR_SOURCE_DIR}/atmosphere)
-rcmake_prepend_path(HTRDR_ATMOSPHERE_FILES_INC2 ${HTRDR_BUILD_DIR}/atmosphere)
-
-# Atmosphere library
-add_library(htrdr-atmosphere STATIC
- ${HTRDR_ATMOSPHERE_FILES_SRC}
- ${HTRDR_ATMOSPHERE_FILES_INC}
- ${HTRDR_ATMOSPHERE_FILES_INC2})
-target_link_libraries(htrdr-atmosphere
- htrdr-core HTSky RSys Star3D StarCamera StarSF StarSP)
-
-if(CMAKE_COMPILER_IS_GNUCC)
- target_link_libraries(htrdr-atmosphere m)
-endif()
-
-set_target_properties(htrdr-atmosphere PROPERTIES
- DEFINE_SYMBOL HTRDR_STATIC
- VERSION ${VERSION}
- SOVERSION ${VERSION_MAJOR})
-
-################################################################################
-# Define output & install directories
-################################################################################
-install(TARGETS htrdr-atmosphere
- ARCHIVE DESTINATION bin
- LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin)
-
diff --git a/cmake/combustion/CMakeLists.txt b/cmake/combustion/CMakeLists.txt
@@ -1,127 +0,0 @@
-# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-# Copyright (C) 2022-2023 Observatoire de Paris
-# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-#
-# 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(htrdr-combustion)
-
-################################################################################
-# Check dependencies
-################################################################################
-find_package(AtrSTM REQUIRED)
-find_package(RCMake 0.3 REQUIRED)
-find_package(RSys 0.11 REQUIRED)
-find_package(Star3D 0.8 REQUIRED)
-find_package(StarCamera 0.0 REQUIRED)
-find_package(StarSF 0.6 REQUIRED)
-find_package(StarSP 0.12 REQUIRED)
-find_package(StarVX 0.1 REQUIRED)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR})
-include(rcmake)
-include(rcmake_runtime)
-
-include_directories(
- ${AtrSTM_INCLUDE_DIR}
- ${RSys_INCLUDE_DIR}
- ${Star3D_INCLUDE_DIR}
- ${StarCamera_INCLUDE_DIR}
- ${StarSF_INCLUDE_DIR}
- ${StarSP_INCLUDE_DIR}
- ${StarVX_INCLUDE_DIR}
- ${HTRDR_BUILD_DIR}
- ${HTRDR_SOURCE_DIR})
-
-################################################################################
-# Generate files
-################################################################################
-set(HTRDR_COMBUSTION_ARGS_DEFAULT_LASER_FLUX_DENSITY "1" CACHE INTERNAL "")
-set(HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_DIMENSION "1.80" CACHE INTERNAL "")
-set(HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_PREFACTOR "1.30" CACHE INTERNAL "")
-set(HTRDR_COMBUSTION_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD "1.0" CACHE INTERNAL "")
-set(HTRDR_COMBUSTION_ARGS_DEFAULT_GRID_DEFINITION_HINT "256" CACHE INTERNAL "")
-set(HTRDR_COMBUSTION_ARGS_DEFAULT_WAVELENGTH "532" CACHE INTERNAL "")
-
-configure_file(${HTRDR_SOURCE_DIR}/combustion/htrdr_combustion_args.h.in
- ${HTRDR_BUILD_DIR}/combustion/htrdr_combustion_args.h @ONLY)
-
-################################################################################
-# Configure and define targets
-################################################################################
-set(HTRDR_COMBUSTION_FILES_SRC
- htrdr_combustion.c
- htrdr_combustion_args.c
- htrdr_combustion_draw_map.c
- htrdr_combustion_compute_radiance_sw.c
- htrdr_combustion_geometry_ray_filter.c
- htrdr_combustion_laser.c
- htrdr_combustion_main.c
- htrdr_combustion_phase_func.c)
-
-set(HTRDR_COMBUSTION_FILES_INC
- htrdr_combustion.h
- htrdr_combustion_c.h
- htrdr_combustion_geometry_ray_filter.h
- htrdr_combustion_laser.h)
-
-# Prepend each file in the `HTRDR_FILES_<SRC|INC>' list by `HTRDR_SOURCE_DIR'
-rcmake_prepend_path(HTRDR_COMBUSTION_FILES_SRC ${HTRDR_SOURCE_DIR}/combustion)
-rcmake_prepend_path(HTRDR_COMBUSTION_FILES_INC ${HTRDR_SOURCE_DIR}/combustion)
-
-# Combustion library
-add_library(htrdr-combustion STATIC
- ${HTRDR_COMBUSTION_FILES_SRC}
- ${HTRDR_COMBUSTION_FILES_INC})
-target_link_libraries(htrdr-combustion
- htrdr-core AtrSTM RSys Star3D StarCamera StarSF StarSP)
-
-set_target_properties(htrdr-combustion PROPERTIES
- DEFINE_SYMBOL HTRDR_STATIC
- VERSION ${VERSION}
- SOVERSION ${VERSION_MAJOR})
-
-################################################################################
-# Add tests
-################################################################################
-if(NOT NO_TEST)
- function(build_test _name)
- add_executable(${_name}
- ${HTRDR_SOURCE_DIR}/combustion/${_name}.c)
- target_link_libraries(${_name} htrdr-combustion ${ARGN})
- endfunction()
-
- function(new_test _name)
- build_test(${_name} ${ARGN})
- add_test(${_name} ${_name})
- endfunction()
-
- new_test(test_htrdr_combustion_laser)
-endif()
-
-################################################################################
-# Define output & install directories
-################################################################################
-install(TARGETS htrdr-combustion
- ARCHIVE DESTINATION bin
- LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin)
-
diff --git a/cmake/commands/CMakeLists.txt b/cmake/commands/CMakeLists.txt
@@ -1,89 +0,0 @@
-# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-# Copyright (C) 2022-2023 Observatoire de Paris
-# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-#
-# 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(htrdr-commands C)
-
-include_directories(${HTRDR_BUILD_DIR} ${HTRDR_SOURCE_DIR})
-
-set(_link_libraries "")
-
-if(HTRDR_BUILD_ATMOSPHERE)
- list(APPEND _link_libraries htrdr-atmosphere)
-endif()
-if(HTRDR_BUILD_COMBUSTION)
- list(APPEND _link_libraries htrdr-combustion)
-endif()
-if(HTRDR_BUILD_PLANETO)
- list(APPEND _link_libraries htrdr-planeto)
-endif()
-
-################################################################################
-# Check dependencies
-################################################################################
-find_package(RSys 0.11 REQUIRED)
-include_directories(${RSys_INCLUDE_DIR})
-
-################################################################################
-# Configure and define targets
-################################################################################
-add_executable(htrdr_cmd ${HTRDR_SOURCE_DIR}/commands/htrdr_cmd.c)
-target_link_libraries(htrdr_cmd ${_link_libraries})
-set_target_properties(htrdr_cmd PROPERTIES
- COMPILE_DEFINITIONS "${HTRDR_BUILD_COMMANDS}"
- OUTPUT_NAME htrdr)
-
-add_executable(htrdr_atmosphere_cmd
- ${HTRDR_SOURCE_DIR}/commands/htrdr_atmosphere_cmd.c)
-set_target_properties(htrdr_atmosphere_cmd PROPERTIES
- COMPILE_DEFINITIONS "${HTRDR_BUILD_COMMANDS}"
- OUTPUT_NAME htrdr-atmosphere)
-if(HTRDR_BUILD_ATMOSPHERE)
- target_link_libraries(htrdr_atmosphere_cmd htrdr-atmosphere)
-endif()
-
-add_executable(htrdr_combustion_cmd
- ${HTRDR_SOURCE_DIR}/commands/htrdr_combustion_cmd.c)
-set_target_properties(htrdr_combustion_cmd PROPERTIES
- COMPILE_DEFINITIONS "${HTRDR_BUILD_COMMANDS}"
- OUTPUT_NAME htrdr-combustion)
-if(HTRDR_BUILD_COMBUSTION)
- target_link_libraries(htrdr_combustion_cmd htrdr-combustion)
-endif()
-
-add_executable(htrdr_planeto_cmd
- ${HTRDR_SOURCE_DIR}/commands/htrdr_planeto_cmd.c)
-set_target_properties(htrdr_planeto_cmd PROPERTIES
- COMPILE_DEFINITIONS "${HTRDR_BUILD_COMMANDS}"
- OUTPUT_NAME htrdr-planeto)
-if(HTRDR_BUILD_PLANETO)
- target_link_libraries(htrdr_planeto_cmd htrdr-planeto)
-endif()
-
-################################################################################
-# Define output & install directories
-################################################################################
-install(TARGETS htrdr_cmd htrdr_atmosphere_cmd htrdr_combustion_cmd htrdr_planeto_cmd
- ARCHIVE DESTINATION bin
- LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin)
diff --git a/cmake/core/CMakeLists.txt b/cmake/core/CMakeLists.txt
@@ -1,154 +0,0 @@
-# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-# Copyright (C) 2022-2023 Observatoire de Paris
-# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-#
-# 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(htrdr-core C)
-
-################################################################################
-# Check dependencies
-################################################################################
-find_package(AW 2.0 REQUIRED)
-find_package(MruMtl 0.1 REQUIRED)
-find_package(RCMake 0.3 REQUIRED)
-find_package(RSys 0.11 REQUIRED)
-find_package(Star3D 0.8 REQUIRED)
-find_package(StarCamera 0.0 REQUIRED)
-find_package(StarSF 0.6 REQUIRED)
-find_package(StarSP 0.12 REQUIRED)
-find_package(OpenMP 1.2 REQUIRED)
-find_package(MPI 2 REQUIRED)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR})
-include(rcmake)
-include(rcmake_runtime)
-
-set(CMAKE_C_COMPILER ${MPI_C_COMPILER})
-
-include_directories(
- ${AW_INCLUDE_DIR}
- ${MruMtl_INCLUDE_DIR}
- ${RSys_INCLUDE_DIR}
- ${Star3D_INCLUDE_DIR}
- ${StarCamera_INCLUDE_DIR}
- ${StarSF_INCLUDE_DIR}
- ${StarSP_INCLUDE_DIR}
- ${StarVX_INCLUDE_DIR}
- ${HTSky}
- ${HTRDR_BUILD_DIR}
- ${HTRDR_SOURCE_DIR}
- ${MPI_INCLUDE_PATH})
-
-################################################################################
-# Generate files
-################################################################################
-set(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN "0.0" CACHE INTERNAL "")
-set(HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX "180.0" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_CAMERA_POS "0,0,0" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_CAMERA_TGT "0,1,0" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_CAMERA_UP "0,0,1" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_CAMERA_ORTHOGRAPHIC_HEIGHT "1" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV "70" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS "0" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST "1" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_RECTANGLE_POS "0,0,0" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_RECTANGLE_TGT "0,0,1" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_RECTANGLE_UP "0,1,0" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_RECTANGLE_SZ "1,1" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_IMG_WIDTH "320" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_IMG_HEIGHT "240" CACHE INTERNAL "")
-set(HTRDR_ARGS_DEFAULT_IMG_SPP "1" CACHE INTERNAL "")
-
-configure_file(${HTRDR_SOURCE_DIR}/core/htrdr_args.h.in
- ${HTRDR_BUILD_DIR}/core/htrdr_args.h @ONLY)
-configure_file(${HTRDR_SOURCE_DIR}/core/htrdr_version.h.in
- ${HTRDR_BUILD_DIR}/core/htrdr_version.h @ONLY)
-
-################################################################################
-# Configure and define targets
-################################################################################
-set(HTRDR_CORE_FILES_SRC
- htrdr.c
- htrdr_args.c
- htrdr_buffer.c
- htrdr_draw_map.c
- htrdr_geometry.c
- htrdr_log.c
- htrdr_materials.c
- htrdr_ran_wlen_cie_xyz.c
- htrdr_ran_wlen_discrete.c
- htrdr_ran_wlen_planck.c
- htrdr_rectangle.c
- htrdr_slab.c
- htrdr_spectral.c)
-set(HTRDR_CORE_FILES_INC
- htrdr.h
- htrdr_accum.h
- htrdr_buffer.h
- htrdr_c.h
- htrdr_draw_map.h
- htrdr_geometry.c
- htrdr_interface.h
- htrdr_log.h
- htrdr_materials.h
- htrdr_ran_wlen_cie_xyz.h
- htrdr_ran_wlen_discrete.h
- htrdr_ran_wlen_planck.h
- htrdr_rectangle.h
- htrdr_sensor.h
- htrdr_slab.h
- htrdr_spectral.h)
-set(HTRDR_CORE_FILES_INC2 # Generated files
- htrdr_args.h
- htrdr_version.h)
-
-# Prepend each file in the `HTRDR_FILES_<SRC|INC>' list by `HTRDR_SOURCE_DIR'
-rcmake_prepend_path(HTRDR_CORE_FILES_SRC ${HTRDR_SOURCE_DIR}/core)
-rcmake_prepend_path(HTRDR_CORE_FILES_INC ${HTRDR_SOURCE_DIR}/core)
-rcmake_prepend_path(HTRDR_CORE_FILES_INC2 ${HTRDR_BUILD_DIR}/core)
-
-# Core library
-add_library(htrdr-core SHARED
- ${HTRDR_CORE_FILES_SRC}
- ${HTRDR_CORE_FILES_INC}
- ${HTRDR_CORE_FILES_INC2})
-target_link_libraries(htrdr-core AW MruMtl RSys Star3D StarCamera StarSF StarSP)
-
-if(CMAKE_COMPILER_IS_GNUCC)
- target_link_libraries(htrdr-core m)
- set_target_properties(htrdr-core PROPERTIES LINK_FLAGS "${OpenMP_C_FLAGS}")
-endif()
-
-set_target_properties(htrdr-core PROPERTIES
- COMPILE_FLAGS "${OpenMP_C_FLAGS}"
- DEFINE_SYMBOL HTRDR_CORE_SHARED_BUILD
- VERSION ${VERSION}
- SOVERSION ${VERSION_MAJOR})
-
-################################################################################
-# Define output & install directories
-################################################################################
-install(TARGETS htrdr-core
- ARCHIVE DESTINATION bin
- LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin)
-
diff --git a/cmake/doc/CMakeLists.txt b/cmake/doc/CMakeLists.txt
@@ -1,94 +0,0 @@
-# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-# Copyright (C) 2022-2023 Observatoire de Paris
-# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-#
-# 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/>.
-
-set(HTRDR_DOC_DIR ${PROJECT_SOURCE_DIR}/../doc)
-
-################################################################################
-# Look for the a2x program
-################################################################################
-find_program(SCDOC NAMES scdoc)
-if(NOT SCDOC)
- message(WARNING
- "The `scdoc' program is missing. "
- "The htrdr man pages cannot be generated.")
- return()
-endif()
-
-################################################################################
-# ROFF man pages
-################################################################################
-set(MAN_SOURCES
- ${HTRDR_DOC_DIR}/htrdr.1.scd
- ${HTRDR_DOC_DIR}/htrdr-image.5.scd
- ${HTRDR_DOC_DIR}/htrdr-materials.5.scd
- ${HTRDR_DOC_DIR}/htrdr-obj.5.scd
- ${HTRDR_DOC_DIR}/rnrl.5.scd)
-
-if(HTRDR_BUILD_ATMOSPHERE)
- configure_file(${HTRDR_DOC_DIR}/htrdr-atmosphere.1.scd.in
- ${CMAKE_CURRENT_BINARY_DIR}/htrdr-atmosphere.1.scd @ONLY)
- list(APPEND MAN_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/htrdr-atmosphere.1.scd)
-endif()
-
-if(HTRDR_BUILD_COMBUSTION)
- configure_file(${HTRDR_DOC_DIR}/htrdr-combustion.1.scd.in
- ${CMAKE_CURRENT_BINARY_DIR}/htrdr-combustion.1.scd @ONLY)
- list(APPEND MAN_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/htrdr-combustion.1.scd)
-endif()
-
-if(HTRDR_BUILD_PLANETO)
- configure_file(${HTRDR_DOC_DIR}/htrdr-planeto.1.scd.in
- ${CMAKE_CURRENT_BINARY_DIR}/htrdr-planeto.1.scd @ONLY)
- list(APPEND MAN_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/htrdr-planeto.1.scd)
-endif()
-
-set(MAN_FILES)
-set(MAN5_FILES)
-set(MAN1_FILES)
-
-foreach(_src IN LISTS MAN_SOURCES)
- get_filename_component(_man ${_src} NAME)
- string(REGEX MATCH "^.*\.[1-9]" _man "${_man}")
-
- add_custom_command(
- OUTPUT ${_man}
- COMMAND ${SCDOC} < ${_src} > ${_man}
- DEPENDS ${_src}
- COMMENT "Build ROFF man page ${_man}"
- VERBATIM)
- list(APPEND MAN_FILES ${_man})
-
- string(REGEX MATCH "^.*.5$" _man5 ${_man})
- string(REGEX MATCH "^.*.1$" _man1 ${_man})
- if(_man1)
- list(APPEND MAN1_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_man1})
- elseif(_man5)
- list(APPEND MAN5_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_man5})
- else()
- message(FATAL_ERROR "Unexpected man type")
- endif()
-endforeach()
-add_custom_target(man-roff ALL DEPENDS ${MAN_FILES})
-
-install(FILES ${MAN1_FILES} DESTINATION share/man/man1)
-install(FILES ${MAN5_FILES} DESTINATION share/man/man5)
diff --git a/cmake/planeto/CMakeLists.txt b/cmake/planeto/CMakeLists.txt
@@ -1,124 +0,0 @@
-# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-# Copyright (C) 2022-2023 Observatoire de Paris
-# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-#
-# 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(htrdr-planeto)
-
-################################################################################
-# Check dependencies
-################################################################################
-find_package(RCMake 0.4 REQUIRED)
-find_package(RNATM 0.0.1 REQUIRED)
-find_package(RNGRD 0.0 REQUIRED)
-find_package(RSys 0.11 REQUIRED)
-find_package(Star3D 0.8 REQUIRED)
-find_package(StarBuffer 0.0 REQUIRED)
-find_package(StarCamera 0.0 REQUIRED)
-find_package(StarSF 0.6 REQUIRED)
-find_package(StarSP 0.12 REQUIRED)
-find_package(StarVX 0.1 REQUIRED)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR})
-include(rcmake)
-include(rcmake_runtime)
-
-include_directories(
- ${RNATM_INCLUDE_DIR}
- ${RNGRD}
- ${RSys_INCLUDE_DIR}
- ${Star3D_INCLUDE_DIR}
- ${StarBuffer_INCLUDE_DIR}
- ${StarCamera_INCLUDE_DIR}
- ${StarSF_INCLUDE_DIR}
- ${StarSP_INCLUDE_DIR}
- ${StarVX_INCLUDE_DIR}
- ${HTRDR_BUILD_DIR}
- ${HTRDR_SOURCE_DIR})
-
-################################################################################
-# Generate files
-################################################################################
-set(HTRDR_PLANETO_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD "1" CACHE INTERNAL "")
-set(HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT "512" CACHE INTERNAL "")
-
-configure_file(${HTRDR_SOURCE_DIR}/planeto/htrdr_planeto_args.h.in
- ${HTRDR_BUILD_DIR}/planeto/htrdr_planeto_args.h @ONLY)
-
-################################################################################
-# Configure and define targets
-################################################################################
-set(HTRDR_PLANETO_FILES_SRC
- htrdr_planeto.c
- htrdr_planeto_args.c
- htrdr_planeto_compute_radiance.c
- htrdr_planeto_draw_map.c
- htrdr_planeto_main.c
- htrdr_planeto_source.c)
-
-set(HTRDR_PLANETO_FILES_INC
- htrdr_planeto.h
- htrdr_planeto_c.h
- htrdr_planeto_source.h)
-
-# Prepend each file in the `HTRDR_FILES_<SRC|INC>' list by `HTRDR_SOURCE_DIR'
-rcmake_prepend_path(HTRDR_PLANETO_FILES_SRC ${HTRDR_SOURCE_DIR}/planeto)
-rcmake_prepend_path(HTRDR_PLANETO_FILES_INC ${HTRDR_SOURCE_DIR}/planeto)
-
-# Planeto library
-add_library(htrdr-planeto STATIC
- ${HTRDR_PLANETO_FILES_SRC}
- ${HTRDR_PLANETO_FILES_INC})
-target_link_libraries(htrdr-planeto
- htrdr-core RNATM RNGRD RSys Star3D StarBuffer StarCamera StarSF StarSP)
-
-set_target_properties(htrdr-planeto PROPERTIES
- DEFINE_SYMBOL HTRDR_STATIC
- VERSION ${VERSION}
- SOVERSION ${VERSION_MAJOR})
-
-################################################################################
-# Add tests
-################################################################################
-if(NOT NO_TEST)
- function(build_test _name)
- add_executable(${_name}
- ${HTRDR_SOURCE_DIR}/planeto/${_name}.c)
- target_link_libraries(${_name} htrdr-core htrdr-planeto ${ARGN})
- endfunction()
-
- function(new_test _name)
- build_test(${_name} ${ARGN})
- add_test(${_name} ${_name})
- endfunction()
-
- new_test(test_htrdr_planeto_source StarBuffer)
-endif()
-
-################################################################################
-# Define output & install directories
-################################################################################
-install(TARGETS htrdr-planeto
- ARCHIVE DESTINATION bin
- LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin)
-
diff --git a/config.mk b/config.mk
@@ -0,0 +1,265 @@
+VERSION_MAJOR = 0
+VERSION_MINOR = 10
+VERSION_PATCH = 0
+
+VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
+PREFIX = /usr/local
+
+LIB_TYPE = SHARED
+#LIB_TYPE = STATIC
+
+BUILD_TYPE = RELEASE
+#BUILD_TYPE = DEBUG
+
+# MPI pkg-config file
+MPI_PC = ompi
+
+# Define the features supported, i.e. the htrdr commands to be built.
+# Any value other than ENABLE disables the corresponding functionality.
+# So, simply comment on a feature to deactivate it.
+ATMOSPHERE = ENABLE
+COMBUSTION = ENABLE
+PLANETO = ENABLE
+
+################################################################################
+# Default argument values
+################################################################################
+# Core
+HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN = 0.0
+HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX = 180.0
+HTRDR_ARGS_DEFAULT_CAMERA_POS = 0,0,0
+HTRDR_ARGS_DEFAULT_CAMERA_TGT = 0,1,0
+HTRDR_ARGS_DEFAULT_CAMERA_UP = 0,0,1
+HTRDR_ARGS_DEFAULT_CAMERA_ORTHOGRAPHIC_HEIGHT = 1
+HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV = 70
+HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS = 0
+HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST = 1
+HTRDR_ARGS_DEFAULT_RECTANGLE_POS = 0,0,0
+HTRDR_ARGS_DEFAULT_RECTANGLE_TGT = 0,0,1
+HTRDR_ARGS_DEFAULT_RECTANGLE_UP = 0,1,0
+HTRDR_ARGS_DEFAULT_RECTANGLE_SZ = 1,1
+HTRDR_ARGS_DEFAULT_IMG_WIDTH = 320
+HTRDR_ARGS_DEFAULT_IMG_HEIGHT = 240
+HTRDR_ARGS_DEFAULT_IMG_SPP = 1
+
+# Atmosphere
+HTRDR_ATMOSPHERE_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD = 1
+HTRDR_ATMOSPHERE_ARGS_DEFAULT_SKY_MTL_NAME = "air"
+
+# Combustion
+HTRDR_COMBUSTION_ARGS_DEFAULT_LASER_FLUX_DENSITY = 1
+HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_DIMENSION = 1.80
+HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_PREFACTOR = 1.30
+HTRDR_COMBUSTION_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD = 1.0
+HTRDR_COMBUSTION_ARGS_DEFAULT_GRID_DEFINITION_HINT = 256
+HTRDR_COMBUSTION_ARGS_DEFAULT_WAVELENGTH = 532
+
+# Planeto
+HTRDR_PLANETO_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD = 1
+HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT = 512
+
+################################################################################
+# 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))
+
+AW_VERSION = 2.1
+AW_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags aw)
+AW_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs aw)
+
+ATRSTM_VERSION = 0.1
+ATRSTM_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags atrstm)
+ATRSTM_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs atrstm)
+
+HTSKY_VERSION = 0.3
+HTSKY_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags htsky)
+HTSKY_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs htsky)
+
+MPI_VERSION = 2
+MPI_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags $(MPI_PC))
+MPI_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs $(MPI_PC))
+
+MRUMTL_VERSION = 0.2
+MRUMTL_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags mrumtl)
+MRUMTL_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs mrumtl)
+
+RNATM_VERSION = 0.1
+RNATM_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rnatm)
+RNATM_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rnatm)
+
+RNGRD_VERSION = 0.1
+RNGRD_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rngrd)
+RNGRD_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rngrd)
+
+RSYS_VERSION = 0.14
+RSYS_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys)
+RSYS_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys)
+
+S3D_VERSION = 0.10
+S3D_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags s3d)
+S3D_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs s3d)
+
+SBUF_VERSION = 0.1
+SBUF_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags sbuf)
+SBUF_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs sbuf)
+
+SCAM_VERSION = 0.2
+SCAM_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags scam)
+SCAM_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs scam)
+
+SSF_VERSION = 0.9
+SSF_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags ssf)
+SSF_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs ssf)
+
+SSP_VERSION = 0.14
+SSP_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags star-sp)
+SSP_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs star-sp)
+
+SVX_VERSION = 0.3
+SVX_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags svx)
+SVX_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs svx)
+
+# Atmosphere
+ATMOSPHERE_DPDC_CFLAGS =\
+ $(HTSKY_CFLAGS)\
+ $(RSYS_CFLAGS)\
+ $(S3D_CFLAGS)\
+ $(SCAM_CFLAGS)\
+ $(SSF_CFLAGS)\
+ $(SSP_CFLAGS)\
+ $(SVX_CFLAGS)
+ATMOSPHERE_DPDC_LIBS =\
+ $(HTSKY_LIBS)\
+ $(RSYS_LIBS)\
+ $(S3D_LIBS)\
+ $(SCAM_LIBS)\
+ $(SSF_LIBS)\
+ $(SSP_LIBS)\
+ $(SVX_LIBS)\
+ -lm
+
+# Combustion
+COMBUSTION_DPDC_CFLAGS =\
+ $(ATRSTM_CFLAGS)\
+ $(RSYS_CFLAGS)\
+ $(S3D_CFLAGS)\
+ $(SCAM_CFLAGS)\
+ $(SSF_CFLAGS)\
+ $(SSP_CFLAGS)\
+ $(SVX_CFLAGS)
+COMBUSTION_DPDC_LIBS =\
+ $(ATRSTM_LIBS)\
+ $(RSYS_LIBS)\
+ $(S3D_LIBS)\
+ $(SCAM_LIBS)\
+ $(SSF_LIBS)\
+ $(SSP_LIBS)\
+ $(SVX_LIBS)\
+ -lm
+
+# Core
+CORE_DPDC_CFLAGS =\
+ $(AW_CFLAGS)\
+ $(MPI_CFLAGS)\
+ $(MRUMTL_CFLAGS)\
+ $(RSYS_CFLAGS)\
+ $(S3D_CFLAGS)\
+ $(SCAM_CFLAGS)\
+ $(SSF_CFLAGS)\
+ $(SSP_CFLAGS)\
+ -fopenmp
+CORE_DPDC_LIBS =\
+ $(AW_LIBS)\
+ $(MPI_LIBS)\
+ $(MRUMTL_LIBS)\
+ $(RSYS_LIBS)\
+ $(S3D_LIBS)\
+ $(SCAM_LIBS)\
+ $(SSF_LIBS)\
+ $(SSP_LIBS)\
+ -fopenmp\
+ -lm
+
+# Planeto
+PLANETO_DPDC_CFLAGS=\
+ $(RNATM_CFLAGS)\
+ $(RNGRD_CFLAGS)\
+ $(RSYS_CFLAGS)\
+ $(S3D_CFLAGS)\
+ $(SBUF_CFLAGS)\
+ $(SCAM_CFLAGS)\
+ $(SSF_CFLAGS)\
+ $(SSP_CFLAGS)\
+ $(SVX_CFLAGS)
+PLANETO_DPDC_LIBS=\
+ $(RNATM_LIBS)\
+ $(RNGRD_LIBS)\
+ $(RSYS_LIBS)\
+ $(S3D_LIBS)\
+ $(SBUF_LIBS)\
+ $(SCAM_LIBS)\
+ $(SSF_LIBS)\
+ $(SSP_LIBS)\
+ $(SVX_LIBS)\
+-lm
+
+################################################################################
+# Compilation options
+################################################################################
+WFLAGS =\
+ -Wall\
+ -Wcast-align\
+ -Wconversion\
+ -Wextra\
+ -Wmissing-declarations\
+ -Wmissing-prototypes\
+ -Wshadow
+
+# Increase the security and robustness of generated binaries
+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_DEBUG = -g $(CFLAGS_COMMON)
+CFLAGS_RELEASE = -O2 -DNDEBUG $(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/doc/htrdr-atmosphere.1.in b/doc/htrdr-atmosphere.1.in
@@ -0,0 +1,683 @@
+.\" Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+.\" Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+.\" Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+.\" Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+.\" Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+.\" Copyright (C) 2022-2023 Observatoire de Paris
+.\" Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+.\" Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+.\" Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+.\"
+.\" 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/>.
+.Dd October 4, 2023
+.Dt HTRDR-ATMOSPHERE 1
+.Os
+.Sh NAME
+.Nm htrdr-atmosphere
+.Nd simulate radiative transfer in cloudy atmospheres
+.Sh SYNOPSIS
+.Nm
+.Op Fl dfhRrv
+.Op Fl c Pa clouds
+.Op Fl C Ar persp_camera_opt Ns Op : Ns Ar persp_camera_opt ...
+.Op Fl D Ar sun_azimuth , Ns Ar sun_elevation
+.Op Fl g Pa ground
+.Op Fl i Ar image_opt Ns Op : Ns Ar image_opt ...
+.Op Fl M Pa materials
+.Op Fl m Pa mie
+.Op Fl n Ar sky_mtl
+.Op Fl O Pa cache
+.Op Fl o Pa output
+.Op Fl P Ar ortho_camera_opt Ns Op : Ns Ar ortho_camera_opt ...
+.Op Fl p Ar flux_sensor_opt Ns Op : Ns Ar flux_sensor_opt ...
+.Op Fl s Ar spectral_opt Ns Op : Ns Ar spectral_opt ...
+.Op Fl T Ar optical_thickness
+.Op Fl t Ar threads_count
+.Op Fl V Ar x , Ns Ar y , Ns Ar z
+.Fl a Pa atmosphere
+.Sh DESCRIPTION
+.Nm
+simulates radiative transfer in scenes composed of an atmospheric gas
+mixture, liquid clouds, and a ground.
+It evaluates the intensity incoming on each pixel of the sensor array.
+The underlying algorithm is based on a Monte Carlo method: it consists
+in simulating a given number of optical paths originating from the
+sensor, directed into the atmosphere, taking into account light
+absorption and scattering phenomena.
+.Pp
+Radiative transfer can be evaluated in any part of the spectrum.
+It uses the k distributions to be provided for the vertical profile of
+atmospheric pressure and temperature
+.Pq option Fl a .
+For clouds, the user must define the liquid water content suspended in
+clouds
+.Pq option Fl c ,
+and the optical properties of water droplets
+.Pq option Fl m .
+All that remains is to define the position of the sun
+.Pq option Fl D ,
+the properties of the sensor
+.Pq options Fl C , Fl P No or Fl p
+and the definition of the image
+.Pq option Fl i .
+You can also enter the geometry of the ground
+.Pq option Fl g
+and its associated materials
+.Pq option Fl M .
+Note that clouds and ground can be infinitely repeated along the X and Y
+axis
+.Pq option Fl r No and Fl R .
+.Pp
+Four types of sensor are provided.
+The pinhole camera and the thin-lens camera
+.Pq option Fl C
+are used to calculate the image of the scene from a given viewpoint.
+Unlike these two cameras, the orthographic camera
+.Pq option Fl P
+uses parallel projection rather than perspective projection.
+Finally, the rectangular sensor
+.Pq option Fl p
+is used to calculate flux maps.
+.Pp
+The spectral dimension can be integrated in various ways
+.Pq option Fl s .
+When rendering an image
+.Pq options Fl C No and Fl P
+the calculation is by default performed for the visible part of the
+spectrum between
+.Bq 380, 780
+nanometers, for the three components of the CIE 1931 XYZ color space
+which are then recombined to obtain the final color for each pixel.
+The other method consists of explicitly defining the longwave or
+shortwave spectral range to be processed and continuously sampling a
+wavelength within this range.
+Longwave and shortwave are key words here meaning that the source of
+radiation is either internal or external to the medium.
+For short-wave images the radiance of the pixel is evaluated and stored
+at the output.
+For long-wave images this estimated radiance is then converted into
+brightness temperature and both are stored at the output.
+When calculating a flux map
+.Pq option Fl p
+the flux per pixel is stored in the output map regardless of whether the
+spectral range is longwave or shortwave.
+.Pp
+In
+.Nm
+the spatial unit 1.0 corresponds to one meter and temperatures are
+expressed in Kelvin.
+Estimated radiances are given in W/sr/m^2 except for monochromatic
+calculations where the calculated spectral radiance is defined in
+W/sr/m^2/nm.
+Flux densities are recorded in W/m^2.
+The results are written to the output file if the
+.Fl o
+option is set and otherwise to standard output.
+The output image is a list of raw ASCII data formatted using the
+.Xr htrdr-image 5
+file format.
+.Pp
+.Nm
+implements mixed parallelism.
+On a single computer (that is, a node), it uses shared memory
+parallelism while it relies on Message Passing Interface (MPI) to
+parallelize calculations between multiple nodes.
+.Nm
+can therefore be launched either directly or via a process launcher such
+as
+.Xr mpirun 1
+to distribute the calculation on several computers.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl a Ar atmosphere
+Optical properties of atmospheric gases saved in htgop format.
+.It Fl c Pa clouds
+Cloud properties saved in
+.Xr htcp 5
+format.
+.It Fl C Ar persp_camera_opt Ns Op : Ns Ar persp_camera_opt ...
+Set up a pinhole or thin-lens perspective camera.
+.Pp
+The options for a perspective camera are as follows:
+.Bl -tag -width Ds
+.It Cm focal-dst= Ns Ar distance
+Distance to focus on with a thin lens camera, that is, a camera whose
+.Cm lens-radius
+is not zero.
+The default focal distance is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@ meters.
+.It Cm focal-length= Ns Ar length
+Focal length of a camera lens.
+It is another way to control the field of view of a thin lens camera.
+By default, the field of view is set through the
+.Cm fov
+parameter.
+.It Cm fov= Ns Ar angle
+Vertical field of view of the camera in
+]@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@,
+@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@[ degrees.
+The default field of view is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@ degrees.
+.It Cm lens-radius= Ar radius
+Radius of the camera lens.
+A non-zero radius means that the camera is a thin lens camera while a
+zero radius defines a pinhole camera.
+The default lens radius is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@.
+.It Cm pos= Ns Ar x , Ns Ar y , Ns Ar z
+Camera position.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_POS@.
+.It Cm tgt= Ns Ar x , Ns Ar y , Ns Ar z
+Targeted position
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_TGT@.
+.It Cm up= Ns Ar x , Ns Ar y , Ns Ar z
+Upward vector that the top of the camera is pointing towards.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_UP@.
+.El
+.It Fl D Ar sun_azimuth , Ns Ar sun_elevation
+Direction toward the sun center.
+The direction is defined by two angles in degrees:
+the
+.Ar sun_azimuth
+angle in [0, 360[ and the
+.Ar sun_elevation
+angle in [0, 90].
+.Pp
+Following the right-handed convention, the azimuthal rotation is
+counter-clockwise, with 0 degree on the X axis.
+The elevation starts from 0 degree for a direction in the XY plane, up
+to 90 degrees at zenith.
+Thus
+.Li -D\ 0,0 ,
+.Li -D\ 90,0 ,
+.Li -D\ 180,0
+and
+.Li -D\ 270,0
+will produce solar vectors
+.Pq +1,0,0 ,
+.Pq 0,+1,0 ,
+.Pq -1,0,0
+and
+.Pq 0,-1,0
+respectively, while
+.Li -D\ Ns Ar sun_azminuth , Ns 90
+will produce
+.Pq 0,0,+1
+regardless of
+.Ar sun_azimuth
+value.
+.It Fl d
+Write to
+.Pa output
+the space partitioning data structures used to speed up cloud radiative
+transfer calculations.
+The data written are octrees saved in legacy VTK file format.
+Each octree node stores the minimum and maximum extinction coefficients
+of the cloud cells covered by the octree node.
+In the output file, each octree is separated from the previous one
+by a line containing three minus characters, i.e.\&
+.Li --- .
+.It Fl f
+Force overwriting of
+.Pa output
+file.
+.It Fl g Pa ground
+Ground geometry saved in
+.Xr htrdr-obj 5
+format.
+.It Fl h
+Display short help and exit.
+.It Fl i Ar image_opt Ns Op : Ns Ar image_opt ...
+Configure sensor image.
+.Pp
+The image options are as follows:
+.Bl -tag -width Ds
+.It Cm def= Ns Ar width Ns x Ns Ar height
+Image definition.
+Default is
+@HTRDR_ARGS_DEFAULT_IMG_WIDTH@x@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@.
+.It Cm spp= Ns Ar samples_per_pixel
+Number of samples to solve the Monte Carlo estimation of each pixel.
+In normal image rendering, a pixel will be estimated with
+.No 3\ *\ Ns Ar samples_per_pixel
+of Monte Carlo realisations, one set of
+.Ar samples_per_pixel
+for each X, Y and Z component of the CIE 1931 XYZ color space.
+In shortwave and longwave
+rendering or flux calculation, only one set of
+.Ar samples_per_pixel
+is used.
+By default,
+.Cm spp
+is set to @HTRDR_ARGS_DEFAULT_IMG_SPP@.
+.El
+.It Fl R
+Repeat the ground along the X and Y axes to infinity.
+.It Fl r
+Repeat the clouds along the X and Y axes to infinity.
+.It Fl M Pa materials
+Ground materials saved in
+.Xr htrdr-materials 5
+format.
+.It Fl m Pa mie
+Optical properties of water droplets saved in
+.Xr htmie 5
+format.
+.It Fl n Ar sky_mtl
+Name in the
+.Pa materials
+file representing the sky, i.e. the semi-transparent material.
+Default is @HTRDR_ATMOSPHERE_ARGS_DEFAULT_SKY_MTL_NAME@.
+.It Fl O Pa cache
+File where atmospheric acceleration structures are stored/loaded.
+If the
+.Pa cache
+file does not exist, it is created and filled with acceleration
+structures constructed from the clouds
+.Pq option Fl c ,
+atmosphere
+.Pq option Fl a
+and mie
+.Pq option Fl m
+input files.
+This cached data can then be reused in subsequent executions, provided
+that the input files supplied to the command are the same as those used
+to set up the cache, thus considerably speeding up the pre-processing
+stage.
+.Pp
+If
+.Pa cache
+contains data generated from input files that are not those submitted on
+the command line, an error is notified and execution is aborted, thus
+avoiding the use of bad cached data.
+.Pp
+Note that when the cache is used,
+.Nm
+ignores the options used to build acceleration structures
+.Pq options Fl T No and Fl V .
+.It Fl o Pa output
+Output file.
+If not defined, data is written to standard output.
+.It Fl P Ar ortho_camera_opt Ns Op : Ns Ar ortho_camera_opt ...
+Set up an orthographic camera.
+.Pp
+The options for an orthographic camera are as follows:
+.Bl -tag -width Ds
+.It Cm height= Ns Ar lenght
+Image plane height.
+Its width is calculated from this length and the image ratio
+to guarantee square pixels
+.Pq see Fl i No option .
+.It Cm pos= Ns Ar x , Ns Ar y , Ns Ar z
+Camera position.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_POS@.
+.It Cm tgt= Ns Ar x , Ns Ar y , Ns Ar z
+Targeted position.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_TGT@.
+.It Cm up= Ns Ar x , Ns Ar y , Ns Ar z
+Upward vector that the top of the camera is pointing towards.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_UP@.
+.El
+.It Fl p Ar flux_sensor_opt Ns Op : Ns Ar flux_sensor_opt ...
+Set up a flux sensor.
+The flux is computed for the part of the sensor that is outside any
+geometry.
+.Pp
+The flux sensor options are as follow:
+.Bl -tag -width Ds
+.It Cm pos= Ns Ar x , Ns Ar y , Ns Ar z
+Sensor center.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_POS@.
+.It Cm tgt= Ns Ar x , Ns Ar y , Ns Ar z
+Targeted position.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@.
+.It Cm up= Ns Ar x , Ns Ar y , Ns Ar z
+Upward vector that the top of the sensor is pointing towards.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_UP@.
+.It Cm sz= Ns Ar width , Ns Ar height
+Sensor size in meters.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@.
+.El
+.It Fl s Ar spectral_opt Ns Op : Ns Ar spectral_opt ...
+Configure spectral integration.
+.Pp
+The spectral integration options are as follows:
+.Bl -tag -width Ds
+.It Cm cie_xyz
+Calculate the radiance for the visible part of the spectrum between
+.Bq 380, 780
+nanometers using the XYZ CIE 1931 color matching functions.
+This is the default behavior.
+.It Cm lw= Ns Ar wlen_min , Ns Ar wlen_max
+Calculate the radiance using the internal source of radiation, i.e. the
+radiance emitted by the medium and its boundaries (ground and space).
+.Pp
+Calculations are performed between
+.Bq Ar wlen_min , Ar wlen_max
+nanometers according to Planck's function for a reference temperature.
+As the application mainly concerns the earth's atmosphere, internal
+radiation is emitted in the thermal, longwave part of the
+electromagnetic spectrum.
+Consequently, the default reference temperature is set at 290\ K.
+.Pp
+If
+.Ar wlen_min
+and
+.Ar wlen_max
+are equal, the calculation is monochromatic.
+.It Cm sw= Ns Ar wlen_min , Ns Ar wlen_max
+Calculate the radiance using the external source of radiance, i.e. the sun.
+.Pp
+Calculations are performed between
+.Bq Ar wlen_min , Ar wlen_max
+nanometers according to Planck's function for a reference temperature.
+As the application mainly concerns the earth's atmosphere, the default
+reference temperature is 5778\ K, i.e. the temperature of the sun's
+black body.
+.Pp
+If
+.Ar wlen_min
+and
+.Ar wlen_max
+are equal, the calculation is monochromatic.
+.It Cm Tref= Ns Ar temperature
+Reference temperature when integrating with respect to the Planck function.
+The default value is 290\ K or 5778\ K, depending on whether the
+radiation source is internal
+.Pq option Cm lw
+or external
+.Pq option Cm sw .
+.El
+.It Fl T Ar optical_thickness
+Optical thickness used as threshold criterion for building acceleration
+structures.
+Default is @HTRDR_ATMOSPHERE_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@.
+This option is ignored if a cache is used
+.Pq option Fl O .
+.It Fl t
+Advice on the number of threads to use.
+By default,
+.Nm
+uses many threads as processor cores.
+.It Fl V Ar x , Ns Ar y , Ns Ar z
+Maximum definition of acceleration structures.
+By default, the finest definition is that of clouds.
+This option is ignored if a cache is used
+.Pq option Fl O .
+.It Fl v
+Make
+.Nm
+verbose.
+.El
+.Sh OUTPUT IMAGE
+Images calculated by
+.Nm
+are saved in
+.Xr htrdr-image 5
+format.
+This section describes the nature and arrangement of image data
+depending on the type of calculation performed.
+.Ss XYZ image
+For an image rendering in the visible part of the spectrum
+.Pq default behavior or option Fl s Cm cie_xyz ,
+the pixel components store 4 estimates.
+The first, second, and third pairs of floating point values encode the
+estimated integrated radiance in W/sr/m^2 for the X, Y, and Z components
+of the CIE 1931 XYZ color space.
+The first value of each pair is the expected value of the
+average radiance of the pixel.
+The second value is its associated standard deviation.
+The fourth and final pair records the microsecond estimate of the
+computation time per radiative path and its standard error.
+.Ss Longwave image
+For infrared calculations
+.Pq option Fl s Cm lw= Ns Ar wlen_min , Ns Ar wlen_max
+the first and second pixel components store the expected value and the
+standard error of the estimated brightness temperature (in K),
+respectively.
+The third and fourth components record the expected value and the
+standard deviation of the pixel radiance which is either an integrated
+radiance in W/sr/m^2 or a spectral radiance in W/sr/m^2/nm depending on
+whether this radiance was calculated for a spectral range or at a single
+wavelength.
+The fifth and sixth pixel components are not used.
+Finally, the last 2 components of the pixel record the estimate in
+microseconds of the computation time per radiative path and its standard
+error.
+.Ss Shortwave image
+For shortwave calculations
+.Pq option Fl s Cm sw= Ns Ar wlen_min , Ns Ar wlen_max
+the output image is formatted as for a longwave image except that the
+first and second components of the pixels are not used, as no brightness
+temperature has been evaluated.
+.Ss Flux density map (shortwave and longwave)
+A flux density map
+.Pq option Fl p
+store on its first and second component
+the expected value and the standard error of the pixel radiative flux
+density
+.Pq in W/m^2 .
+All other components are unused excepted the seventh and eighth
+components that store the estimate of the radiative path computation
+time
+.Pq in microseconds
+and its standard error.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Render a clear sky scene, i.e. a scene without any cloud, whose sun is at
+zenith.
+The vertical atmospheric gaz mixture along the Z axis is described in
+the
+.Pa gas.txt
+file.
+The ground geometry is a quad repeated to the infinity
+whose materials are listed in the
+.Pa material.mtl
+file.
+The camera is positioned at
+.Ar 400
+meters height and looks toward the positive Y axis.
+The definition of the rendered image is
+.Ar 800 No by Ar 600
+pixels and the radiance of each pixel component is estimated with
+.Ar 64
+Monte-Carlo realisations.
+The resulting image
+is written to
+.Pa output
+excepted if the file already exists; in this case an
+error is notified, the program stops and the
+.Pa output
+file remains unchanged:
+.Bd -literal -offset Ds
+htrdr-atmosphere -D 0,90 \\
+ -a gas.txt \\
+ -Rg quad.obj \\
+ -M materials.mtl \\
+ -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \\
+ -i def=800x600:spp=64 \\
+ -o output
+.Ed
+.Pp
+Add clouds to the previous scene and use a more complex geometry to
+represent the ground; it has been carefully designed to be cyclical and
+can therefore be repeated ad infinitum without visual glitches.
+Use the
+.Fl f
+option to write the rendered
+image to
+.Pa output
+even though the file already exists.
+Use
+.Xr htpp 1
+to convert the output
+.Xr htrdr-image 5
+in a regular PPM image:
+.Bd -literal -offset Ds
+htrdr-atmosphere -D 0,90 \\
+ -a gas.txt \\
+ -Rg mountains.obj \\
+ -M materials.mtl \\
+ -c clouds.htcp \\
+ -m Mie.nc \\
+ -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \\
+ -i def=800x600:spp=64 \\
+ -fo output
+htpp -o image.ppm output
+.Ed
+.Pp
+Render the previous scene in infrared for the wavelengths in
+.Bq Ar 9200 , Ar 10000
+nanometers with a reference temperature of
+.Ar 300
+Kelvin:
+.Bd -literal -offset Ds
+htrdr-atmosphere -a gas.txt \\
+ -Rg mountains.obj -R \\
+ -M materials.mtl \\
+ -c clouds.htcp \\
+ -m Mie.nc \\
+ -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \\
+ -i def=800x600:spp=64 \\
+ -s lw=9200,10000:Tref=300 \\
+ -fo output
+.Ed
+.Pp
+Move the sun by setting its azimuthal and elevation angles to
+.Ar 120 No and Ar 40
+degrees respectively.
+Use the
+.Fl O
+option to enable the cache mechanism of acceleration structures.
+Increase the image definition to
+.Ar 1280 No by Ar 720
+pixels and set the number of samples per pixel component to
+.Ar 1024 :
+.Bd -literal -offset Ds
+htrdr-atmosphere -D 120,40 \\
+ -a gas.txt \\
+ -Rg mountains.obj \\
+ -M materials.mtl \\
+ -c clouds.htcp \\
+ -m Mie.nc \\
+ -O my_cache \\
+ -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \\
+ -i def=1280x720:spp=1024 \\
+ -fo output
+.Ed
+.Pp
+Compute the downward flux for the shortwave interval
+.Bq Ar 350 , Ar 4000
+nanometers on a square of
+.Ar 100
+meters side positioned at the origin at
+.Ar 1
+meter height.
+The resolution of the flux map is
+.Ar 500 No by Ar 500
+pixels and
+.Ar 1000
+realisations is used to estimate the flux per pixel.
+It is saved in the
+.Pa flux_map.txt
+file even though this file already exists:
+.Bd -literal -offset Ds
+htrdr-atmosphere -D 0,90 \\
+ -a gas.txt \\
+ -Rg plane.obj \\
+ -M materials.mtl \\
+ -c clouds.htcp \\
+ -m Mie.nc \\
+ -O my_cache \\
+ -p pos=0,0,1:tgt=0,0,2:up=0,1,0:sz=100,100 \\
+ -i def=500x500:spp=1000 \\
+ -s sw=350,4000 \\
+ -fo flux_map.txt
+.Ed
+.Pp
+Write cloud acceleration structures as output.
+Use
+.Xr csplit 1
+to save each of them in a specific VTK file named
+.Pa octree Ns Ar ID ,
+.Ar ID
+being between
+.Bq 0, N-1
+and N being the total number of acceleration structures (N > 1):
+.Bd -literal -offset Ds
+htrdr-atmosphere -a gas.txt -m Mie.nc -c clouds.htcp -d -fo output
+N="$(grep -ce "^# vtk" output)"
+sed /^---$/d output \\
+| csplit -f octree -k - %^#\\ vtk% /^#\\ vtk/ {$((${N}-2))}
+.Ed
+.Sh SEE ALSO
+.Xr mpirun 1 ,
+.Xr htcp 5 ,
+.Xr htmie 5 ,
+.Xr htrdr-image 5 ,
+.Xr htrdr-materials 5 ,
+.Xr htrdr-obj 5
+.Rs
+.%A |Méso|Star>
+.%T High-Tune: gas optical properties file format
+.%D November 2018
+.%U https://www.meso-star.com/projects/htrdr/downloads/gas_opt_prop_en.pdf
+.Re
+.Rs
+.%A Najda Villefranque
+.%A Richard Fournier
+.%A Fleur Couvreux
+.%A Stéphane Blanco
+.%A Céline Cornet
+.%A Vincent Eymet
+.%A Vincent Forest
+.%A Jean-Marc Trégan
+.%T A Path-Tracing Monte Carlo library for 3-D Radiative Transfer in \
+Highly Resolved Cloudy Atmospheres
+.%J Journal of Advances in Modeling Earth Systems
+.%V 11
+.%N 8
+.%P 2449-2473
+.%D 2019
+.%U https://dx.doi.org/10.1029/2018MS001602
+.Re
+.Sh STANDARDS
+.Rs
+.%A International Organization for Standardization / CIE
+.%R ISO/CIE 11664-1:2019
+.%D June 2019
+.%T Colorimetry - Part 1: CIE standard colorimetric observers
+.Re
+.Pp
+.Rs
+.%A OpenMP Architecture Review Board
+.%D March 2002
+.%T OpenMP C and C++ Application Interface
+.%O version 2.0
+.Re
+.Pp
+.Rs
+.%A Message Passing Interface Forum
+.%D July 1997
+.%T MPI-2: Extensions to The Message-Passing Interface
+.Re
+.Sh HISTORY
+.Nm
+has been initially developed as part of
+.Li ANR-16-CE01-0010
+High-Tune project.
+It was then extended in
+.Li MODEVAL-URBA 2019 .
diff --git a/doc/htrdr-atmosphere.1.scd.in b/doc/htrdr-atmosphere.1.scd.in
@@ -1,508 +0,0 @@
-htrdr-atmosphere(1)
-
-; Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-; Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-; Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-; Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-; Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-; Copyright (C) 2022-2023 Observatoire de Paris
-; Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-; Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-; Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-;
-; 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/>.
-
-# NAME
-
-htrdr-atmosphere - simulate radiative transfer in cloudy atmospheres
-
-# SYNOPSIS
-
-htrdr-atmosphere [_option_]... -a _atmosphere_
-
-# DESCRIPTION
-
-*htrdr-atmosphere* simulates radiative transfer in scenes composed of an
-atmospheric gas mixture, liquid clouds, and a ground. It evaluates the intensity
-incoming on each pixel of the sensor array. The underlying algorithm is based on
-a Monte-Carlo method: it consists in simulating a given number of optical paths
-originating from the sensor, directed into the atmosphere, taking into account
-light absorption and scattering phenomena. This algorithm and the way it is
-efficiently implemented in *htrdr-atmosphere* is presented in the following
-article: "A path-tracing Monte Carlo library for 3-D radiative transfer in
-highly resolved cloudy atmospheres", N. Villefranque et al, JAMES 2019 [1].
-
-Radiative transfer can be evaluated in any part of the spectrum. It uses
-k distributions that should be provided for the pressure and temperature
-atmospheric vertical profile [2] (*-a* _atmosphere_), the liquid water content
-in suspension within the clouds stored in a *htcp*(5) file (*-c* _clouds_), and
-the optical properties of water droplets that have been obtained from a Mie code
-and formatted according to the *htmie*(5) file format (*-m* _mie_). The user
-also has to set the position of the sun (*-D* _azimuth_,_elevation_), the sensor
-type (*-C* _camera_ or *-p* _rectangle_) and its definition (*-i* _image_). It
-is also possible to provide an *htrdr-obj*(5) file representing the ground
-geometry (*-g* _ground_) whose materials are listed in the *htrdr-material*(5)
-file provided through the *-M* option. Both, the clouds and ground, can be
-infinitely repeated along the X and Y axis by setting the *-r* and the *-R*
-options, respectively.
-
-Four types of sensor are supported by *htrdr-atmosphere*. The pinhole and thin
-lens camera (*-C* _camera_) are used to render an image of the scene from the
-given point of view. The orthographic camera (*-P* _camera_) render the scene
-with a parallel projection rather than a perspective projection. Finally, the
-rectangle sensor (*-p* _rectangle_) is used to compute a flux map.
-
-Spectral dimension can be integrated in many ways (*-s* option). When rendering
-an image (*-C* _camera_), the computation is by default performed for the
-visible part of the spectrum in [380, 780] nanometers, for the three components
-of the CIE 1931 XYZ colorimetric space that are subsequently recombined in
-order to obtain the final color for each pixel, and finally the whole image of
-the scene as seen from the set observation position. The two other ways consist
-in explicitly defining the longwave or shortwave spectral range to handle and
-continuously sampling a wavelength in this range. Actually longwave and
-shortwave are keywords that mean that the source of radiation is whether
-internal or external to the medium, respectively. In shortwave rendering, only
-the pixel radiance is evaluated and stored in the output image. For longwave
-rendering this estimated radiance is then converted to its brightness
-temperature and both are saved in the image. When computing a flux map (*-p*
-_rectangle_), the per pixel flux is saved into the output map whether spectral
-domain is longwave or shortwave.
-
-In *htrdr-atmosphere* the spatial unit 1.0 corresponds to one meter and the
-temperatures are expressed in Kelvin. The estimated radiances are given in
-W/sr/m² excepted for monochromatic computations where the computed spectral
-radiance is defined in W/sr/m²/nm. The flux densities are saved in W/m². The
-results are written to the output file if the *-o* option is defined and the
-standard output otherwise. The output image is a list of raw ASCII data
-formatted with respect to the *htrdr-image*(5) file format.
-
-*htrdr-atmosphere* supports shared memory parallelism and relies on the Message
-Passing Interface specification [4] to parallelise its computations in a
-distributed memory environment; it can thus be run either directly or through a
-MPI process launcher like *mpirun*(1).
-
-# OPTIONS
-
-*-a* _atmosphere_
- Path toward the file containing the gas optical properties of the atmosphere.
- Data must be formatted according to the fileformat described in [2].
-
-*-c* _clouds_
- Submit a *htcp*(5) file describing the properties of the clouds. If not
- defined, only the atmosphere properties submitted through the *-a* option
- are taken into account.
-
-*-C* <_camera-parameter_:...>
- Define a perspective camera. Available parameters are:
-
- *focal-dst*=_dst_
- Distance to focus on with a thin lens camera, that is, a camera whose
- *lens-radius* is not zero. The default focal distance is
- @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@ meter.
-
- *focal-length*=_length_
- Focal length of a camera lens. It is another way to control the field of
- view of a thin lens camera. By default, the field of view is directly set
- through the *fov* parameter.
-
- *fov*=_angle_
- Vertical field of view of the camera in
- \]@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@,
- @HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@\[ degrees. By
- default _angle_ is set to
- @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@ degrees.
-
- *lens-radius*=_radius_
- Radius of the camera lens. A non-zero radius means that the camera is a thin
- lens camera while a zero radius defines a pinhole camera. By default the
- lens radius is @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@.
-
- *pos*=_x_,_y_,_z_
- Camera lens position. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}.
-
- *tgt*=_x_,_y_,_z_
- Position targeted by the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}.
-
- *up*=_x_,_y_,_z_
- Up vector of the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}.
-
-*-D* <_azimuth_,_elevation_>
- Direction toward the sun center. The direction is defined by two angles in
- degrees: the _azimuth_ angle in [0, 360[ and the _elevation_ angle in [0,
- 90]. Following the right-handed convention, the azimuthal rotation is
- counter-clockwise, with 0 degree on the X axis. The elevation starts from 0
- degree for a direction in the XY plane, up to 90 degrees at zenith. Thus
- *-D* _0_,_0_ *-D* _90_,_0_ -*D* _180_,_0_ and *-D* _270_,_0_ will produce solar
- vectors {+1,0,0} {0,+1,0} {-1,0,0} and {0,-1,0} respectively, while
- *-D* _azimuth_,_90_ will produce {0,0,+1} regardless of _azimuth_ value.
-
-*-d*
- Write in _output_ the space partitioning data structures used to speed up
- the radiative transfer computations in the clouds. The written data are
- octrees saved in the VTK file format [3]. Each octree node stores the minimum
- and the maximum of the extinction coefficients of the cloud cells overlapped
- by the octree node. In the _output_ file, each octree is separated from the
- previous one by a line with three minus characters, i.e. '---'.
-
-*-f*
- Force overwrite of the _output_ file.
-
-*-g* _ground_
- Path toward a *htrdr-obj*(5) representing the ground geometry.
-
-*-h*
- List short help and exit.
-
-*-i* <_image-parameter_:...>
- Define the sensor array. Available image parameters are:
-
- *def*=<_width_>x<_height_>
- Definition of the image. By default the image definition is
- @HTRDR_ARGS_DEFAULT_IMG_WIDTH@x@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@.
-
- *spp*=_samples-count_
- Number of samples per pixel estimation. In regular image rendering, a pixel
- will use "3 \* _samples-count_" Monte-Carlo realisations, one set of
- _samples-count_ realisations for each X, Y and Z component of the CIE 1931
- XYZ color space. In shortwave/longwave rendering or flux computation, only
- one set of _samples-count_ is used. By default, *spp* is set to
- @HTRDR_ARGS_DEFAULT_IMG_SPP@.
-
-*-R*
- Infinitely repeat the _ground_ along the X and Y axis.
-
-*-r*
- Infinitely repeat the _clouds_ along the X and Y axis.
-
-*-M* _materials_
- Path toward a *htrdr-materials*(5) file listing the ground materials.
-
-*-m* _mie_
- Path toward a *htmie*(5) file defining the optical properties of water
- droplets.
-
-*-n* _sky-mtl_
- Name of the material representing the sky in the *htrdr-materials*(5) file.
- By default, _sky-mtl_ is @HTRDR_ATMOSPHERE_ARGS_DEFAULT_SKY_MTL_NAME@.
-
-*-O* _cache_
- File used to cache the sky data. If the _cache_ file does not exists, it is
- created and filled with the sky data built from the _clouds_, the _atmosphere_
- and the _mie_ input files. This cached data can then be reused in the next
- runs as long as the input files provided on the command are the same as the
- ones used to setup the cache; leading to a significant speed-up of the
- pre-processing step. If _cache_ contains data generated from input files that
- are not the ones submitted on the command line, an error is notified and the
- execution is stopped, avoiding the use of wrong cached data. Note that when
- the cache is used, *htrdr-atmosphere* ignores the arguments used to
- parametrise the structures partitioning the sky data, i.e. the *-T* and *-V*
- options.
-
-*-o* _output_
- File where *htrdr-atmosphere* writes its _output_ data. If not defined, write
- results to standard output.
-
-*-P* <_camera-parameter_:...>
- Define an orthographic camera. Available parameters are:
-
- *height*=_radius_
- Height of the image plane. By default it is set to
- @HTRDR_ARGS_DEFAULT_CAMERA_ORTHOGRAPHIC_HEIGHT@.
-
- *pos*=_x_,_y_,_z_
- Camera lens position. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}.
-
- *tgt*=_x_,_y_,_z_
- Position targeted by the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}.
-
- *up*=_x_,_y_,_z_
- Up vector of the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}.
-
-*-p* <_rectangle-parameter_:...>
- Switch in flux map computation. The flux is computed for the part of the
- sensor that is outside any geometry. The rectangular sensor onto which the
- flux is integrated is defined by the following parameters:
-
- *pos*=_x_,_y_,_z_
- Position of the center of the rectangle. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@}.
-
- *tgt*=_x_,_y_,_z_
- Position targeted by the rectangle, i.e. *tgt* - *pos* is the rectangle
- normal. By default it is set to {@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@}.
-
- *up*=_x_,_y_,_z_
- Up vector of the rectangle. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@}.
-
- *sz*=_width_,_height_
- Size of the rectangle. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@}.
-
-*-s* <_spectral-parameter_:...>
- Define the type and the range of the spectral integration. Available
- spectral parameters are:
-
- *cie_xyz*
- the radiance is computed for the visible part of the spectrum in [380, 780]
- nanometers with respect to the XYZ CIE 1931 tristimulus values. This is the
- default comportment of *htrdr-atmosphere*.
-
- *lw*=_wlen-min_,_wlen-max_
- perform the spectral sampling continuously in the [_wlen-min_, _wlen-max_]
- wavelength range (wavelength must be provided in nanometers) according to
- the Planck function for a reference temperature. If _wlen-min_ and
- _wlen-max_ are equals the computation is monochromatic. *lw* means for
- longwave but is here a code word that really means "computation of radiance
- using the internal source of radiation": in other words, radiation is
- emitted by the medium and its boundaries (ground and space). Because the
- application is for the terrestrial atmosphere, internal radiation is
- emitted in the thermal longwave part of the electromagnetic spectrum.
- Therefore the default value of the reference temperature used in the
- spectral sampling is fixed at 290 K.
-
- *sw*=_wlen-min_,_wlen-max_
- perform the spectral sampling continuously in the [_wlen-min_, _wlen-max_]
- wavelength range (wavelength must be provided in nanometers) according to
- the Planck function for a reference temperature. If _wlen-min_ and
- _wlen-max_ are equals the computation is monochromatic. In the present
- case, *sw* means that the source of radiation is external to the medium:
- because the application is for the terrestrial atmosphere, the value of the
- reference temperature is by default fixed at 5778 K, i.e. the blackbody
- temperature of the Sun.
-
- *Tref*=_temperature_
- reference temperature of the Planck function used to continuously sample the
- longwave/shortwave spectral range. In longwave, it is set to 290 K by
- default while in shortwave its default value is the blackbody temperature of
- the sun (i.e. 5778 K).
-
-*-T* _threshold_
- Optical thickness used as threshold criteria to partition the properties of
- the clouds. By default its value is
- @HTRDR_ATMOSPHERE_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@. This option is
- ignored if a cache file is used (option *-O*).
-
-*-t* _threads-count_
- Hint on the number of threads to use. By default use as many threads as CPU
- cores.
-
-*-V* _x_,_y_,_z_
- Define the maximum definition of the acceleration data structure that
- partitions the cloud properties. By default the finest definition is the
- definition of the submitted *htcp*(5) file. This option is ignored if a cache
- file is used (option *-O*).
-
-*-v*
- Make *htrdr-atmosphere* verbose.
-
-# OUTPUT IMAGE
-
-Images calculated by *htrdr-atmosphere* are saved in the *htrdr-image*(5) file
-format. This section describes the nature and arrangement of image data
-depending on the type of calculation performed by *htrdr-atmosphere*.
-
-## XYZ image
-
-For an image rendering in the visible part of the spectrum (default behavior or
-*-s cie_xyz* option), the pixel components store 4 estimates. The first,
-second, and third pairs of floating point values encode the estimated
-integrated radiance in W/sr/m² for the X, Y, and Z components of the CIE
-1931 XYZ color space. The first value of each pair is the expected value of the
-average radiance of the pixel. The second value is its associated standard
-deviation. The fourth and final pair records the microsecond estimate of the
-computation time per radiative path and its standard error.
-
-## Longwave image
-
-If the image is an infrared rendering (option *-s* *lw*=_wlen-min_,_wlen-max_)
-the first and second pixel components store the expected value and the standard
-error of the estimated brightness temperature (in K), respectively. The third
-and fourth components record the expected value and the standard deviation of
-the pixel radiance which is either an integrated radiance in W/sr/m² or a
-spectral radiance in W/sr/m²/nm depending on whether this radiance was
-calculated for a spectral range or at a single wavelength. The fifth and sixth
-pixel components are not used. Finally, the last 2 components of the pixel
-record the estimate in microseconds of the computation time per radiative path
-and its standard error.
-
-## Shortwave image
-
-For shortwave renderings (option *-s* *sw*=_wlen-min_,_wlen-max_), the data
-written to the output image are formatted as for a longwave image except
-that the first and second components of the pixels are not used because no
-brightness temperature has been evaluated.
-
-## Flux density map (shortwave and longwave)
-
-A flux density map (option *-p*) is saved in an *htrdr-image*(5) storing the
-expected value and the standard error of the pixel radiative flux density (in
-W/m²) on its first and second component. All other components are unused
-excepted the seventh and eighth components that store the estimate of the
-radiative path computation time in microseconds and its standard error.
-
-# EXAMPLES
-
-Render a clear sky scene, i.e. a scene without any cloud, whose sun is at
-zenith. The vertical atmospheric gaz mixture along the Z axis is described in
-the _gas.txt_ file. The ground geometry is a quad repeated to the infinity
-whose materials are listed in the _material.mtl_ file. The camera is positioned
-at _400_ meters height and looks toward the positive Y axis. The definition of
-the rendered image is _800_ by _600_ pixels and the radiance of each pixel
-component is estimated with _64_ Monte-Carlo realisations. The resulting image
-is written to _output_ excepted if the file already exists; in this case an
-error is notified, the program stops and the _output_ file remains unchanged:
-
-```
-htrdr-atmosphere -D0,90 -a gas.txt -m Mie.nc -g quad.obj -R \
- -M materials.mtl \
- -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \
- -i def=800x600:spp=64 \
- -o output
-```
-
-Add clouds to the previous scene and use a more complex geometry to represent
-the ground. The Mie data are provided through the _Mie.nc_ file. The ground
-geometry was carefully designed to be cyclic and can be thus infinitely
-repeated without visual glitches. Use the _-f_ option to write the rendered
-image to _output_ even though the file already exists. Finally, use the
-*htpp*(1) command to convert the *htrdr-image*(5) saved in output in a regular
-PPM image [5]:
-
-```
-htrdr-atmosphere -D0,90 -a gas.txt -m Mie.nc -g mountains.obj -R \
- -M materials.mtl \
- -c clouds.htcp \
- -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \
- -i def=800x600:spp=64 \
- -f -o output
-htpp -o image.ppm output
-```
-
-Render the previous scene in infrared for the wavelengths in [_9200_, _10000_]
-nanometers with a reference temperature of _300_ Kelvin:
-
-```
-htrdr-atmosphere -a gas.txt -m Mie.nc -g mountains.obj -R \
- -M materials.mtl \
- -c clouds.htcp \
- -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \
- -i def=800x600:spp=64 \
- -s lw=9200,10000:Tref=300 \
- -f -o output
-```
-
-Move the sun by setting its azimuthal and elevation angles to _120_ and _40_
-degrees respectively. Use the *-O* option to enable the cache mechanism on
-sky data. Increase the image definition to _1280_ by _720_ and set the
-number of samples per pixel component to _1024_. Write results on standard
-output and convert the resulting image in PPM before visualising it through the
-*feh*(1) image viewer:
-
-```
-htrdr-atmosphere -D120,40 -a gas.txt -m Mie.nc -g mountains.obj -R \
- -M materials.mtl \
- -c clouds.htcp \
- -O my_cache \
- -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \
- -i def=1280x720:spp=1024 | htpp | feh -
-```
-
-Compute the downward flux for the shortwave interval [_350_, _4000_] nanometers
-on a square of _100_ meters side positionned at the origin at *1* meter height.
-The resolution of the flux map is _500_ by _500_ pixels and _1000_ realisations
-is used to estimate the flux per pixel. It is saved in the _flux_map.txt_ file
-even though this file already exists:
-
-```
-htrdr-atmosphere -D0,90 -a gas.txt -m Mie.nc -g plane.obj -R \
- -M materials.mtl \
- -c clouds.htcp \
- -O my_cache \
- -p pos=0,0,1:tgt=0,0,2:up=0,1,0:sz=100,100 \
- -i def=500x500:spp=1000 \
- -s sw=350,4000 \
- -f -o flux_map.txt
-```
-
-Write into _output_ the data structures used to partition the clouds properties.
-Use the *csplit*(1) Unix command to extract from _output_ the list of the
-generated grids and save each of them in a specific VTK file whose name is
-_cloud_grid<NUM>.vtk_ with _NUM_ in [0, N-1] where N is the number of grids
-written into _output_:
-
-```
-htrdr-atmosphere -a gas.txt -m Mie.nc -c clouds.htcp -d -f -o output
-csplit -f cloud_grid_ -b %02d.vtk -z --suppress-matched output /^---$/ {*}
-```
-
-Use *mpirun*(1) to launch *htrdr-atmosphere* on several hosts defined in the
-_my_hosts_ file. Make the clouds infinite along the X and Y axis:
-
-```
-mpirun --hostfile my_hosts htrdr-atmosphere \
- -D120,40 -a gas.txt -m Mie.nc -g mountains.obj -R \
- -M materials.mtl \
- -c clouds.htcp -r \
- -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \
- -i def=1280x720:spp=1024 \
- -f -o output
-```
-
-# COPYRIGHT
-
-Copyright © 2018-2019, 2022-2023 Centre National de la Recherche Scientifique++
-Copyright © 2020-2022 Institut Mines Télécom Albi-Carmaux++
-Copyright © 2022-2023 Institut Pierre-Simon Laplace++
-Copyright © 2022-2023 Institut de Physique du Globe de Paris++
-Copyright © 2018-2023 |Méso|Star> <contact@meso-star.com>++
-Copyright © 2022-2023 Observatoire de Paris++
-Copyright © 2022-2023 Université de Reims Champagne-Ardenne++
-Copyright © 2022-2023 Université de Versaille Saint-Quentin++
-Copyright © 2018-2019, 2022-2023 Université Paul Sabatier
-
-# LICENSE
-
-*htrdr-atmosphere* is free software released under the GPLv3+ license: GNU GPL
-version 3 or later <https://gnu.org/licenses/gpl.html>. You are free to change
-and redistribute it. There is NO WARRANTY, to the extent permitted by law.
-
-# SEE ALSO
-
-. A path-tracing Monte Carlo library for 3-D radiative transfer in highly
- resolved cloudy atmospheres. N. Villefranque et al, JAMES 11, 2449-2473, 2019 -
- <https://doi.org/10.1029/2018MS001602>
-. High-Tune: Gas Optical Properties file format -
- <https://www.meso-star.com/projects/high-tune/downloads/gas_opt_prop_en.pdf>
-. VTK file format -
- <http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf>
-. MPI specifications - <https://www.mpi-forum.org/docs/>
-. Portable PixMap - <http://netpbm.sourceforge.net/doc/ppm.html>
-
-*csplit*(1),
-*feh*(1),
-*mpirun*(1),
-*htcp*(5),
-*htmie*(5),
-*htpp*(1),
-*htrdr*(1),
-*htrdr-image*(5),
-*htrdr-materials*(5)
-*htrdr-obj*(5)
diff --git a/doc/htrdr-combustion.1.in b/doc/htrdr-combustion.1.in
@@ -0,0 +1,601 @@
+.\" Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+.\" Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+.\" Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+.\" Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+.\" Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+.\" Copyright (C) 2022-2023 Observatoire de Paris
+.\" Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+.\" Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+.\" Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+.\"
+.\" 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/>.
+.Dd October 4, 2023
+.Dt HTRDR-COMBUSTION 1
+.Os
+.Sh NAME
+.Nm htrdr-combustion
+.Nd simulate radiative transfer in a combustion medium
+.Sh SYNOPSIS
+.Nm
+.Op Fl fhINsv
+.Op Fl C Ar persp_camera_opt Ns Op : Ns Ar persp_camera_opt ...
+.Op Fl D Ar laser_flux_density
+.Op Fl d Ar dump_type
+.Op Fl F Ar rdgfa_opt Ns Op : Ns Ar rdgfa_opt ...
+.Op Fl g Ar combustion_chamber_opt Ns Op : Ns Ar combustion_chamber_opt...
+.Op Fl i Ar image_opt Ns Op : Ns Ar image_opt ...
+.Op Fl l Ar laser_opt Ns Op : Ns Ar laser_opt ...
+.Op Fl O Pa cache
+.Op Fl o Pa output
+.Op Fl P Ar ortho_camera_opt Ns Op : Ns Ar ortho_camera_opt ...
+.Op Fl R Ar flux_sensor_opt Ns Op : Ns Ar flux_sensor_opt ...
+.Op Fl T Ar optical_thickness
+.Op Fl t Ar threads_count
+.Op Fl V Ar accel_struct_definition
+.Op Fl w Ar laser_wavelength
+.Fl m Pa medium_geometry
+.Fl p Pa thermo_properties
+.Fl r Pa refractive_ids
+.Sh DESCRIPTION
+The purpose of
+.Nm
+is to perform radiative transfer computations in a scene representing a
+semi-transparent combustion medium enlightened by a laser sheet.
+The medium may be surrounded by solid boundaries
+.Pq inner limits of the combustion chamber .
+The program will currently compute, in the visible at a given frequency, the
+monochromatic image or the radiative flux density of the combustion medium:
+collected light comes from the laser, and is scattered by soot aggregates
+within the flame before eventually reaching the sensor.
+.Pp
+Data relating to the gaseous medium are stored on the vertices of an
+unstructured tetrahedral mesh: pressure, temperature and concentrations
+of H2O, CO2 and CO are provided for each vertex.
+In the visible range, these data are useless, since the gas is assumed
+to be transparent, but they are part of the data expected to anticipate
+future developments in the longwave domain.
+.Pp
+Soot optical properties are computed using the Rayleigh-Debye Gans theory, for
+Fractal Aggregates (RDG-FA).
+This requires the knowledge of: soot volumic fraction, soot number
+density (number of primary particles per aggregate) and primary
+particles diameter, for each vertex of the tetrahedral mesh.
+For any position in the volume, these quantities are first interpolated
+from the values retrieved at the nodes of the current tetrahedron, and
+are then interpolated for the position of interest.
+Which then makes possible to compute the absorption and scattering
+cross-sections of soot aggregates, as well as their scattering function.
+.Pp
+The Monte Carlo algorithm that accounts for the visible intensity is inspired
+from the algorithm used for solar radiation in
+.Xr htrdr-atmosphere 1 .
+It was adapted to partially illuminated scenes in order to solve
+onvergence issues.
+.Pp
+In
+.Nm
+the spatial unit 1.0 corresponds to one meter while the
+estimated monochromatic radiances and flux densities are saved in
+W/sr/m^2 and
+W/m^2 respectively.
+The results are written to the output file if the
+.Fl o
+option is set and otherwise to standard output.
+The output image is a list of raw ASCII data formatted using the
+.Xr htrdr-image 5
+file format.
+.Pp
+.Nm
+implements mixed parallelism.
+On a single computer (that is, a node), it uses shared memory
+parallelism while it relies on Message Passing Interface (MPI) to
+parallelize calculations between multiple nodes.
+.Nm
+can therefore be launched either directly or via a process launcher such
+as
+.Xr mpirun 1
+to distribute the calculation on several computers.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl C Ar persp_camera_opt Ns Op : Ns Ar persp_camera_opt ...
+Set up a pinhole or thin-lens perspective camera.
+.Pp
+The options for a perspective camera are as follows:
+.Bl -tag -width Ds
+.It Cm focal-dst= Ns Ar distance
+Distance to focus on with a thin lens camera, that is, a camera whose
+.Cm lens-radius
+is not zero.
+The default focal distance is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@ meters.
+.It Cm focal-length= Ns Ar length
+Focal length of a camera lens.
+It is another way to control the field of view of a thin lens camera.
+By default, the field of view is set through the
+.Cm fov
+parameter.
+.It Cm fov= Ns Ar angle
+Vertical field of view of the camera in
+]@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@,
+@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@[ degrees.
+The default field of view is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@ degrees.
+.It Cm lens-radius= Ar radius
+Radius of the camera lens.
+A non-zero radius means that the camera is a thin lens camera while a
+zero radius defines a pinhole camera.
+The default lens radius is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@.
+.It Cm pos= Ns Ar x , Ns Ar y , Ns Ar z
+Camera position.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_POS@.
+.It Cm tgt= Ns Ar x , Ns Ar y , Ns Ar z
+Targeted position
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_TGT@.
+.It Cm up= Ns Ar x , Ns Ar y , Ns Ar z
+Upward vector that the top of the camera is pointing towards.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_UP@.
+.El
+.It Fl D Ar laser_flux_density
+Laser flux density in W/m^2. Default is
+@HTRDR_COMBUSTION_ARGS_DEFAULT_LASER_FLUX_DENSITY@.
+.It Fl d Ar dump type
+Write the data defined by
+.Ar dump_type
+to
+.Pa output
+instead of performing a normal calculation.
+.Pp
+The
+.Ar dump_type
+values supported are as follows:
+.Bl -tag -width Ds
+.It Cm laser
+Write the geometry of the laser sheet in legacy VTK format.
+.It Cm octree
+Write the leaves of the space partitioning structures used to speed up
+radiative transfer calculations.
+Each leaf stores the minimum and maximum extinction coefficients of the
+tetrahedra it covers.
+Data are written in legacy VTK format.
+.El
+.It Fl F Ar rdgfa_opt Ns Op : Ns Ar rdgfa_opt ...
+RDG-FA phase function parameters.
+.Pp
+The parameters of the RDG-FA phase function are as follows:
+.Bl -tag -width Ds
+.It Cm dimension= Ns Ar real
+Fractal dimension.
+Default is @HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_DIMENSION@.
+.It Cm prefactor= Ns Ar real
+Fractal prefactor.
+Default is @HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_PREFACTOR@.
+.El
+.It Fl f
+Force overwriting of
+.Pa output
+file.
+.It Fl g Ar combustion_chamber_opt Ns Op : Ns Ar combustion_chamber_opt...
+Define the combustion chamber.
+.Pp
+Note that the combustion chamber does not prevent the camera from seeing
+the medium, nor the laser from illuminating the medium, even if either is
+outside the chamber.
+The rendering algorithm ensures that they are not occluded by the
+combustion chamber, like with a two-way mirror.
+When the laser is out of chamber, its emissive surface is seen as if it
+were following its interior surface.
+Likewise, the radiance seen by the camera outside the chamber is the
+radiance that reaches it as if its image plane were following the
+surface of the geometry.
+.Pp
+The combustion chamber options are as follows:
+.Bl -tag -width Ds
+.It Cm mats= Ns Ar materials
+Combustion chamber materials saved in
+.Xr htrdr-materials 5
+format.
+.It Cm obj= Ns Ar mesh
+Combustion chamber geometry saved in
+.Xr htrdr-obj 5
+format.
+.Pp
+In accordance with the
+.Xr htrdr-obj 5
+file format, the mesh interface must be defined as a fine interface,
+i.e. it must be composed of 3 elements separated by the
+.Li \&:
+character.
+By convention,
+.Nm
+expects the external environment to be called "air" and the medium
+inside the combustion chamber to be called "chamber".
+No assumptions are made about the name of the surface material, except
+that it must refer to a valid material.
+.El
+.It Fl h
+Display short help and exit.
+.It Fl I
+Use an isotropic phase function rather than the RDG-FA phase function
+.Pq option Fl F .
+.It Fl i Ar image_opt Ns Op : Ns Ar image_opt ...
+Configure sensor image.
+.Pp
+The image options are as follows:
+.Bl -tag -width Ds
+.It Cm def= Ns Ar width Ns x Ns Ar height
+Image definition.
+Default is
+@HTRDR_ARGS_DEFAULT_IMG_WIDTH@x@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@.
+.It Cm spp= Ns Ar samples_per_pixel
+Number of samples to solve the Monte Carlo estimation of each pixel.
+Default is @HTRDR_ARGS_DEFAULT_IMG_SPP@.
+.El
+.It Fl l Ar laser_opt Ns Op : Ns Ar laser_opt ...
+Laser emission surface.
+.Pp
+The laser options are as follows:
+.Bl -tag -width Ds
+.It Cm pos= Ns Ar x , Ns Ar y , Ns Ar z
+Center of the laser emission surface.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_POS@.
+.It Cm tgt= Ns Ar x , Ns Ar y , Ns Ar z
+Targeted position, i.e.\&
+.Cm tgt No - Cm pos
+is the normal of the laser surface.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@.
+.It Cm up= Ns Ar x , Ns Ar y , Ns Ar z
+Upward vector that the top of thr laser is pointer towards.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_UP@.
+.It Cm sz= Ns Ar width , Ns Ar height
+Size of laser surface in meters.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@
+.El
+.It Fl m Ar medium_geometry
+Tetrahedra of the combustion medium saved in
+.Xr smsh 5
+format.
+.It Fl N
+This speeds up runtime performance by calculating normals once and for
+all rather than re-evaluating them every time a tetrahedron is queried
+at a given position.
+In return, the memory space used to store normals increases the memory
+footprint.
+.It Fl O Pa cache
+File where acceleration structure is stored/loaded.
+If the
+.Pa cache
+file does not exist, it is created and filled with the acceleration
+structure constructed from the medium geometry
+.Pq option Fl m ,
+termodynamic properties
+.Pq option Fl p
+and refractive indices
+.Pq option Fl r
+input files.
+This cached data can then be reused in subsequent executions, provided
+that the input files supplied to the command are the same as those used
+to set up the cache, thus considerably speeding up the pre-processing
+stage.
+.Pp
+If
+.Pa cache
+contains data generated from input files that are not those submitted on
+the command line, an error is notified and execution is aborted, thus
+avoiding the use of bad cached data.
+.It Fl o Pa output
+Output file.
+If not defined, data is written to standard output.
+.It Fl P Ar ortho_camera_opt Ns Op : Ns Ar ortho_camera_opt ...
+Set up an orthographic camera.
+.Pp
+The options for an orthographic camera are as follows:
+.Bl -tag -width Ds
+.It Cm height= Ns Ar lenght
+Image plane height.
+Its width is calculated from this length and the image ratio
+to guarantee square pixels
+.Pq see Fl i No option .
+.It Cm pos= Ns Ar x , Ns Ar y , Ns Ar z
+Camera position.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_POS@.
+.It Cm tgt= Ns Ar x , Ns Ar y , Ns Ar z
+Targeted position.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_TGT@.
+.It Cm up= Ns Ar x , Ns Ar y , Ns Ar z
+Upward vector that the top of the camera is pointing towards.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_UP@.
+.El
+.It Fl p Ar thermo_properties
+Thermodynamic properties of the combustion medium saved in
+.Xr atrtp 5
+format.
+.It Fl R Ar flux_sensor_opt Ns Op : Ns Ar flux_sensor_opt ...
+Set up a flux sensor.
+.Pp
+The flux sensor options are as follow:
+.Bl -tag -width Ds
+.It Cm pos= Ns Ar x , Ns Ar y , Ns Ar z
+Sensor center.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_POS@.
+.It Cm tgt= Ns Ar x , Ns Ar y , Ns Ar z
+Targeted position.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@.
+.It Cm up= Ns Ar x , Ns Ar y , Ns Ar z
+Upward vector that the top of the sensor is pointing towards.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_UP@.
+.It Cm sz= Ns Ar width , Ns Ar height
+Sensor size in meters.
+Default is @HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@.
+.El
+.It Fl r Ar refrative_ids
+Refrative indices of the combustion medium as a function of wavelength,
+saved in
+.Xr atrri 5
+format.
+.It Fl s
+Use Single Instruction Multiple Data (SIMD) instruction sets if available.
+This should speed up calculation time.
+.It Fl T Ar optical_thickness
+Optical thickness used as threshold criterion for building the acceleration
+structure.
+Default is @HTRDR_COMBUSTION_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@.
+.It Fl t
+Advice on the number of threads to use.
+By default,
+.Nm
+uses many threads as processor cores.
+.It Fl V Ar accel_struct_definition
+Definition of the discrete field storing the upper limit of the
+radiative coefficients from which the acceleration structure is built.
+The extent of the grid corresponds to the axis aligned bounding box of
+the combustion medium.
+.Pp
+The definition can be established as follows:
+.Bl -tag -width Ds
+.It Ar x , Ns Ar y , Ns Ar z
+Define grid definition on X, Y and Z axes.
+.It Ar expected_definition
+Provide an expected definition of the grid along its longest axis.
+The definition along the two remaining axes is then calculated
+internally to tend towards cubic cells.
+This is the default behavior with an expected definition set to
+@HTRDR_COMBUSTION_ARGS_DEFAULT_GRID_DEFINITION_HINT@.
+.El
+.It Fl v
+Make
+.Nm
+verbose.
+.It Fl w Ar laser_wavelength
+Laser wavelength in nanometers, which is also the wavelength at which
+calculations are performed.
+Default is @HTRDR_COMBUSTION_ARGS_DEFAULT_WAVELENGTH@.
+.El
+.Sh OUTPUT IMAGE
+Images calculated by
+.Nm
+are saved in
+.Xr htrdr-image 5
+format.
+This section describes the nature and arrangement of image data
+depending on the type of calculation performed.
+.Ss Shortwave monochromatic image
+For a monochromatic image rendering, the expected value and the standard
+deviation of the pixel radiance (in W/sr/m^2) are saved on the first and
+the second components.
+All other components are unused excepted the seventh and eighth
+components that store the estimate of the radiative path computation
+time in microseconds and its standard error.
+.Ss Shortwave flux density map
+A flux density map
+.Pq option Fl R
+store on its first and second component
+the expected value and the standard error of the pixel radiative flux
+density
+.Pq in W/m^2 .
+All other components are unused excepted the seventh and eighth
+components that store the estimate of the radiative path computation
+time
+.Pq in microseconds
+and its standard error.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Make
+.Nm
+verbose
+.Pq option Fl v
+and render an image of a combustion medium whose tetrahedral mesh is
+stored in
+.Pa tetra.smsh
+and whose associated thermodynamic properties are recorded in
+.Pa thermprops.atrtp .
+Refractive indices are listed in
+.Pa refract_ids.atrri .
+The laser's surface emission center is positioned at the origin and its
+direction aligned with the Y axis
+.Pq option Fl l .
+The calculated image resolution is
+.Ar 800 No by Ar 600
+pixels
+.Pq option Fl i
+and the monochromatic radiance
+of each pixel is estimated at
+.Ar 500
+nanometers
+.Pq option Fl w
+with
+.Ar 64
+Monte Carlo realisations
+.Pq option Fl i .
+The resulting image is written to
+.Pa output
+unless the file already exists, in which case an error is notified, the
+program stops and the output file remains unchanged:
+.Bd -literal -offset Ds
+htrdr-combustion -v \\
+ -m tetra.smsh \\
+ -p thermprops.atrtp \\
+ -r refract_ids.atrri \\
+ -l pos=0,0,0:tgt=0,1,0:up=0,0,1:sz=0.001,0.2 \\
+ -w 500 \\
+ -C pos=0.06,0,0.01:tgt=0.05,0,0.01:up=0,0,1:fov=30 \\
+ -i def=800x600:spp=64 \\
+ -o output
+.Ed
+.Pp
+Add a combustion chamber to the previous example
+.Pq option Fl g :
+its mesh is defined in
+.Pa chamber.obj
+while its materials are listed in
+.Pa materials.mtls .
+Save the acceleration structure in
+.Pa octree.cache
+or reuse it if it has already been filled in a previous run with
+compatible input data.
+Set the finest resolution of this acceleration structure to
+.Ar 1000
+voxels along the main extension of the medium
+.Pq option Fl V
+and use an optical
+thickness criterion of
+.Ar 5
+to build it
+.Pq option Fl T .
+Use the
+.Fl f
+option to force
+overwriting of the
+.Pa output
+file if it exists, and use the
+.Fl s
+option to accelerate rendering with available SIMD instruction sets:
+.Bd -literal -offset Ds
+htrdr-combustion -v \\
+ -m tetra.smsh \\
+ -p thermprops.atrtp \\
+ -r refract_ids.atrri \\
+ -g obj=chamber.obj:mats=materials.mtls \\
+ -l pos=0,0,0:tgt=0,1,0:up=0,0,1:sz=0.001,0.2 \\
+ -w 500 \\
+ -C pos=0.06,0,0.01:tgt=0.05,0,0.01:up=0,0,1:fov=30 \\
+ -i def=800x600:spp=64 \\
+ -O octree.cache \\
+ -V 1000 \\
+ -T 5 \\
+ -fo output \\
+ -s
+.Ed
+.Pp
+Calculate a flux density map
+.Pq option Fl R .
+The sensor on which the flux density is calculated is a square with
+sides measuring
+.Ar 0.05
+meters.
+Its center is placed at the origin and points towards the Z axis.
+The flux density map has a resolution of
+.Ar 500 No by Ar 500
+pixels
+.Pq option Fl i .
+The flux density per pixel is estimated with
+.Ar 64
+realisations; the flux density for the entire sensor is therefore
+calculated with 16 million realizations (500*500*64):
+.Bd -literal -offset Ds
+htrdr-combustion -v \\
+ -m tetra.smsh \\
+ -p thermprops.atrtp \\
+ -r refract_ids.atrri \\
+ -l pos=0,0,0:tgt=0,1,0:up=0,0,1:sz=0.001,0.2 \\
+ -w 500 \\
+ -R pos=0,0,0:tgt=0,0,1:up=0,1,0:sz=0.05,0.05 \\
+ -i def=500x500:spp=64 \\
+ -O octree.cache \\
+ -V 1000 \\
+ -T 5 \\
+ -fo map.txt
+ -s
+.Ed
+Write a representation of the acceleratrion structure in
+.Pa accel_struct.vtk
+.Pq option Fl d :
+.Bd -literal -offset Ds
+htrdr-combustion -v \\
+ -m tetra.smsh \\
+ -p thermprops.atrtp \\
+ -r refract_ids.atrri \\
+ -O octree.cache \\
+ -d octree \\
+ -o accel_struct.vtk
+.Ed
+.Sh SEE ALSO
+.Xr htrdr-atmosphere 1 ,
+.Xr atrri 5 ,
+.Xr atrtp 5 ,
+.Xr htrdr-image 5 ,
+.Xr htrdr-materials 5 ,
+.Xr htrdr-obj 5 ,
+.Xr smsh 5
+.Rs
+.%A Morgan Sans
+.%A Mouna El Hafi
+.%A Vincent Eymet
+.%A Vincent Forest
+.%A Richard Fournier
+.%A Najda Villefranque
+.%T Null-collision meshless Monte Carlo - A new reverse Monte Carlo \
+algorithm designed for laser-source emission in absorbing/scattering \
+inhomogeneous media
+.%J Journal of Quantitative Spectroscopy and Radiative Transfer
+.%V 271
+.%D 2021
+.%U https://doi.org/10.1016/j.jqsrt.2021.107725
+.Re
+.Rs
+.%A Jérôme Yon
+.%A Fengshan Liu
+.%A Alexandre Bescond
+.%A Chloé Caumont-Prim
+.%A Claude Rozé
+.%A François-Xavier Ouf
+.%A Alexis Coppalle
+.%T Effects of multiple scattering on radiative properties of soot \
+fractal aggregates
+.%J Journal of Quantitative Spectroscopy and Radiative Transfer
+.%V 133
+.%P 374-381
+.%D 2014
+.%U https://doi.org/10.1016/j.jqsrt.2013.08.022
+.Re
+.Sh STANDARDS
+.Rs
+.%A OpenMP Architecture Review Board
+.%D March 2002
+.%T OpenMP C and C++ Application Interface
+.%O version 2.0
+.Re
+.Pp
+.Rs
+.%A Message Passing Interface Forum
+.%D July 1997
+.%T MPI-2: Extensions to The Message-Passing Interface
+.Re
+.Sh HISTORY
+.Nm
+has been developed as part of
+.Li ANR-18-CE05-0015
+Astoria project.
diff --git a/doc/htrdr-combustion.1.scd.in b/doc/htrdr-combustion.1.scd.in
@@ -1,461 +0,0 @@
-htrdr-combustion(1)
-
-; Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-; Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-; Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-; Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-; Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-; Copyright (C) 2022-2023 Observatoire de Paris
-; Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-; Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-; Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-;
-; 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/>.
-
-
-# NAME
-
-htrdr-combustion - simulate radiative transfer in combustion medium
-
-# SYNOPSIS
-
-htrdr-combustion [_option_]... -m _tetrahedra_ -p _thermoprops_ -r _refract_ids_
-
-# DESCRIPTION
-
-The purpose of *htrdr-combustion* is to perform radiative transfer computations
-in a scene representing a semi-transparent medium enlightened by a laser sheet.
-The combustion medium may be surrounded by solid boundaries (inner limits of
-the combustion chamber). The program will currently compute, in the visible at
-a given frequency, the monochromatic image or the radiative flux density of the
-combustion medium: collected light comes from the laser, and is scattered by
-soot aggregates within the flame before eventually reaching the sensor.
-
-Data about the gaseous medium have to be provided on the vertices of a
-unstructured tetrahedral mesh: pressure, temperature and concentrations of H2O,
-CO2 and CO have to be provided for every spatial position used to define this
-mesh. These data have to be provided in anticipation of future developments for
-the longwave range: since the gas is assumed to be transparent in the visible,
-it is not currently used.
-
-Soot optical properties are computed using the Rayleigh-Debye Gans theory, for
-Fractal Aggregates (RDG-FA) [1]. This requires the knowledge of: soot volumic
-fraction, soot number density (number of primary particles per aggregate) and
-primary particles diameter, over each vertex of the tetrahedron mesh. For any
-position in the volume, these quantities are first interpolated from the values
-retrieved at the nodes of the current tetrahedron, and are then interpolated
-for the position of interest. Which then makes possible to compute the
-absorption and scattering cross-sections of soot aggregates, as well as their
-scattering function.
-
-The Monte-Carlo algorithm that accounts for the visible intensity is inspired
-from the algorithm used for solar radiation in the *htrdr-atmosphere*(1)
-command. It was adapted to partially illuminated scenes in order to solve
-convergence issues. The algorithm is presented in the following article:
-"Null-collision meshless Monte-Carlo - a new reverse Monte-Carlo algorithm
-designed for laser-source emission in absorbing/scattering inhomogeneous
-media". M. Sans et al, JQSRT, 2021 [2].
-
-In *htrdr-combustion* the spatial unit 1.0 corresponds to one meter while the
-estimated monochromatic radiances and flux densities are saved in W/sr/m² and
-W/m² respectively. Computed images are stored in the *htrdr-image*(5) file
-format.
-
-*htrdr-combustion* implements a mixed parallelism: on one computer (i.e. a
-node) it uses a shared memory parallelism, and it relies on the message passing
-interface [4] to parallelize the computations between several nodes. We can
-thus launch *htrdr-combustion* either directly, or via a process launcher
-like *mpirun*(1) to distribute the rendering over several nodes.
-
-# OPTIONS
-
-*-C* <_camera-parameter_:...>
- Define the camera. Available parameters are:
-
- *focal-dst*=_dst_
- Distance to focus on with a thin lens camera, that is, a camera whose
- *lens-radius* is not zero. The default focal distance is
- @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@ meter.
-
- *focal-length*=_length_
- Focal length of a camera lens. It is another way to control the field of
- view of a thin lens camera. By default, the field of view is directly set
- through the **fov** parameter.
-
- *fov*=_angle_
- Vertical field of view of the camera in
- \]@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@,
- @HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@[ degrees. By
- default _angle_ is set to
- @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@ degrees.
-
- *lens-radius*=_radius_
- Radius of the camera lens. A non-zero radius means that the camera is a thin
- lens camera while a zero radius defines a pinhole camera. By default the
- lens radius is @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@.
-
- *pos*=_x_,_y_,_z_
- Camera lens position. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}.
-
- *tgt*=_x_,_y_,_z_
- Position targeted by the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}.
-
- *up*=_x_,_y_,_z_
- Up vector of the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}.
-
-*-D* _flux_density_
- Flux density of the laser in W/m². By default it is set to
- @HTRDR_COMBUSTION_ARGS_DEFAULT_LASER_FLUX_DENSITY@.
-
-*-d* <_laser_|_octree_>
- When define with the _laser_ argument, write in _output_ the geometry of the
- laser sheet saved in the VTK file format [3]. With the _octree_ argument,
- write in _output_ a VTK file that stores the octree leaves of the space
- partitioning data structure used to speed up the radiative transfer
- computations in the combustion medium. Each leaf stores the minimum and the
- maximum of the extinction coefficients of the tetrahedra that the leaf
- overlaps.
-
-*-F* <_fractal-coefficients_:...>
- Fractal parameters of the RDG-FA model. This option disable the *-I* option
- if it was previously set. Available fractal coefficients are:
-
- *dimension*=_real_
- Fractal dimension. By default it is set to
- @HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_DIMENSION@.
-
- *prefactor*=_real_
- Fractal prefactor. By default it is set to
- @HTRDR_COMBUSTION_ARGS_DEFAULT_FRACTAL_PREFACTOR@.
-
-*-f*
- Force overwrite of the _output_ file.
-
-*-g* <_geometry-parameter_:...>
- Define the geometry of the combustion chamber. Note that this geometry does
- not prevent the camera from viewing the medium or the laser from illuminating
- it, even if they are outside the combustion chamber. The rendering algorithm
- ensures that they are not occluded by this geometry like with a two-way
- mirror. When the laser is out of geometry, its emissive surface is seen as if
- it were following the interior surface of the chamber. Likewise, the radiance
- seen by the camera outside the chamber is the radiance that reaches it as if
- its image plane were following the surface of the geometry. Available
- geometry parameters are:
-
- *mats*=_materials_
- Path to the *htrdr-materials*(5) that defines the media and materials used
- by the combustion chamber geometry.
-
- *obj*=_mesh_
- Path to the *htrdr-obj*(5) file that represents the mesh of the combustion
- chamber. Following the *htrdr-obj*(5) fileformat, the interface of the
- submitted mesh must be defined as a thin interface, i.e. it must be composed
- of 3 components separated by the ':' character. By convention,
- *htrdr-combustion* expects the outside environment to be called "air" and
- the medium inside the combustion chamber to be called "chamber". No
- assumption is made on the name of the surface material excepted that it has
- to reference a valid material.
-
-*-h*
- List short help and exit.
-
-*-I*
- Use an isotropic phase function rather than the RDG-FA model.
-
-*-i* <_image-parameter_:...>
- Define the sensor array. Available image parameters are:
-
- *def*=<_width_>x<_height_>
- Definition of the image. By default the image definition is
- @HTRDR_ARGS_DEFAULT_IMG_WIDTH@x@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@.
-
- *spp*=_samples-count_
- Number of samples per pixel estimation. By default, *spp* is set to
- @HTRDR_ARGS_DEFAULT_IMG_SPP@.
-
-*-l* <_laser-parameter_:...>
- Define the laser surface emission. Available laser parameters are:
-
- *pos*=_x_,_y_,_z_
- Position of the center of the surface emission. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@}.
-
- *tgt*=_x_,_y_,_z_
- Position targeted by the laser, i.e. *tgt* - *pos* is normal of the laser
- surface. By default it is set to {@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@}.
-
- *up*=_x_,_y_,_z_
- Up vector of the laser surface. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@}.
-
- *sz*=_width_,_height_
- Size of the laser surface. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@}.
-
-*-m* _tetrahedra_
- Path to the *smsh*(5) file that stores the volumetric mesh of the combustion
- medium.
-
-*-N*
- Precompute the normals of the tetrahedra. This option should speed up the
- computation since the normals are computed once per tetrahedron rather than
- reevaluated each time a tetrahedron is queried at a given position. On the
- other hand, the storage required by these normals increases the memory
- footprint.
-
-*-O* _cache_
- Path to the file used to cache the acceleration structure that partitions the
- combustion medium. If the _cache_ file does not exist, it is created and
- populated with the octree built from the _tetrahedra_, _thermoprops_ and
- _refract_ids_ input files. This cached acceleration structure can then be
- reused in future runs as long as the input data provided on the command line
- is the same as that used to configure the cache; leading to a significant
- acceleration of the pretreatment step. If _cache_ contains data generated
- from input data that is not that submitted on the command line, an error is
- notified and execution is stopped, thus avoiding the use of bad cached data.
-
-*-o* _output_
- Path to the file where *htrdr-combustion* writes the output data. If not set,
- data is written to standard output.
-
-*-P* <_camera-parameter_:...>
- Define an orthographic camera. Available parameters are:
-
- *height*=_radius_
- Height of the image plane. By default it is set to
- @HTRDR_ARGS_DEFAULT_CAMERA_ORTHOGRAPHIC_HEIGHT@.
-
- *pos*=_x_,_y_,_z_
- Camera lens position. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}.
-
- *tgt*=_x_,_y_,_z_
- Position targeted by the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}.
-
- *up*=_x_,_y_,_z_
- Up vector of the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}.
-
-*-p* _thermprops_
- Path to the *atrtp*(5) file that stores the thermodynamic properties of the
- combustion medium.
-
-*-R* <_rectangle-parameter_:...>
- Compute a radiatve flux density map rather than an image. The rectangular
- sensor onto which the flux is integrated is defined by the following
- parameters:
-
- *pos*=_x_,_y_,_z_
- Position of the center of the rectangle. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@}.
-
- *tgt*=_x_,_y_,_z_
- Position targeted by the rectangle, i.e. *tgt* - *pos* is the rectangle
- normal. By default it is set to {@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@}.
-
- *up*=_x_,_y_,_z_
- Up vector of the rectangle. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@}.
-
- *sz*=_width_,_height_
- Size of the rectangle. By default it is set to
- {@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@}.
-
-*-r* _refract_ids_
- Path the the *atrri*(5) file that lists the spectrally varying refractive
- indices of the combustion medium.
-
-*-s*
- Use of Single Instruction, Multiple Data (SIMD) instruction sets if
- available. This should speed up the computation time.
-
-*-T*
- Optical thickness used as threshold criteria to build the acceleration
- structure the combustion medium. By default its value is
- @HTRDR_COMBUSTION_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@.
-
-*-t* _threads-count_
- Hint on the number of threads to use. By default use as many threads as CPU
- cores.
-
-*-V* <_definition_>
- definition of the grid of the upper bound field of radiative coefficients
- from which the volumetric acceleration structure is built. The grid extent
- corresponds to the axis aligned bounding box of the volumetric mesh
- representing the combustion medium. Grid definition can be set in two ways:
-
- _x_,_z_,_z_
- Explicitly set the grid definition along the X, Y, and Z extents.
-
- _hint_
- Provide an hint on the expected definition of the grid along its major
- extent. The definition along the two remaining axes are then internally
- computed. This is the default comportment with an _hint_ set to
- @HTRDR_COMBUSTION_ARGS_DEFAULT_GRID_DEFINITION_HINT@.
-
-*-v*
- Make *htrdr-combustion* verbose.
-
-*-w*
- Define the wavelength of the laser in nanometre. By default it is set to
- @HTRDR_COMBUSTION_ARGS_DEFAULT_WAVELENGTH@.
-
-# OUTPUT IMAGE
-
-Images calculated by *htrdr-combustion* are saved in the *htrdr-image*(5) file
-format. This section describes the nature and arrangement of image data
-depending on the type of calculation performed by *htrdr-combustion*.
-
-## Shortwave monochromatic image
-
-For a monochromatic image rendering, the expected value and the standard
-deviation of the pixel radiance (in W/sr/m²) are saved on the first and the
-second components. All other components are unused excepted the seventh and
-eighth components that store the estimate of the radiative path computation
-time in microseconds and its standard error.
-
-## Shortwave flux density map
-
-A flux density map (option *-R*) is saved in an *htrdr-image*(5) storing the
-expected value and the standard error of the pixel radiative flux density (in
-W/m²) on its first and second component. All other components are unused
-excepted the seventh and eighth components that store the estimate of the
-radiative path computation time in microseconds and its standard error.
-
-# EXAMPLES
-
-Make htrdr-combustion verbose (option *-v*) and render an image of a combustion
-medium whose tetrahedral mesh is stored in _tetra.smsh_ and its associated
-thermodynamic properties are saved in _thermprops.atrtp_. The spectrally
-varying indices of the medium are listed in the _refract_ids.atrri_ file. The
-center of the laser surface emission is positioned at the origin and its
-direction is aligned to the Y axis. The definition of the rendered image is
-_800_ by _600_ pixels and the monochromatic radiance of each pixel is estimated
-at _500_ nanometre with _64_ Monte-Carlo realisations. The resulting image is
-written to _output_ excepted if it already exists; in this case an
-error is notified, the program stops and the _output_ file remains unchanged.
-
-```
-htrdr-combustion -v \
- -m tetra.smsh \
- -p thermprops.atrtp \
- -r refract_ids.atrri \
- -l pos=0,0,0:tgt=0,1,0:up=0,0,1:sz=0.001,0.2 \
- -w 500 \
- -C pos=0.06,0,0.01:tgt=0.05,0,0.01:up=0,0,1:fov=30 \
- -i def=800x600:spp=64 \
- -o output
-```
-
-Add a combustion chamber to the previous example: its mesh is defined in
-_chamber.obj_ while its materials are listed in _materials.mtls_. Save the
-volumetric acceleration structure in _octree.cache_ or reused it if it was
-already populated in a previous run with compatible input data. Set the finest
-resolution of this acceleration structure to _1000_ along the major extend of the
-medium and use a optical thickness criterion of _5_ to build it. Use the *-f*
-option to force the overwrite of the _output_ file if it exists and use *-s* to
-speed up the rendering with the available SIMD instruction sets.
-
-```
-htrdr-combustion -v \
- -m tetra.smsh \
- -p thermprops.atrtp \
- -r refract_ids.atrri \
- -g obj=chamber.obj:mats=materials.mtls \
- -l pos=0,0,0:tgt=0,1,0:up=0,0,1:sz=0.001,0.2 \
- -w 500 \
- -C pos=0.06,0,0.01:tgt=0.05,0,0.01:up=0,0,1:fov=30 \
- -i def=800x600:spp=64 \
- -O octree.cache \
- -V 1000 \
- -T 5 \
- -o output -f -s
-```
-
-Compute a flux density map whose definition is _500_ by _500_ pixels. The flux
-density per pixel is estimated with _64_ realisations; the flux density for the
-entire sensor is thus calculated with 16 million realisations (500 \* 500
-\* 64). The sensor on which the flux density is calculated is a square with
-sides measuring _0.05_ meter. Its center is positioned at the origin and points
-to the Z axis.
-
-```
-htrdr-combustion -v \
- -m tetra.smsh \
- -p thermprops.atrtp \
- -r refract_ids.atrri \
- -l pos=0,0,0:tgt=0,1,0:up=0,0,1:sz=0.001,0.2 \
- -w 500 \
- -R pos=0,0,0:tgt=0,0,1:up=0,1,0:sz=0.05,0.05 \
- -i def=500x500:spp=64 \
- -O octree.cache \
- -V 1000 \
- -T 5 \
- -o map.txt -f -s
-```
-
-Write into _octree.vtk_ a representation of the volumetric acceleration
-structure.
-
-```
-htrdr-combustion -v \
- -m tetra.smsh \
- -p thermprops.atrtp \
- -r refract_ids.atrri \
- -O octree.cache \
- -d octree -o octree.vtk
-```
-
-# COPYRIGHT
-
-Copyright © 2018-2019, 2022-2023 Centre National de la Recherche Scientifique++
-Copyright © 2020-2022 Institut Mines Télécom Albi-Carmaux++
-Copyright © 2022-2023 Institut Pierre-Simon Laplace++
-Copyright © 2022-2023 Institut de Physique du Globe de Paris++
-Copyright © 2018-2023 |Méso|Star> <contact@meso-star.com>++
-Copyright © 2022-2023 Observatoire de Paris++
-Copyright © 2022-2023 Université de Reims Champagne-Ardenne++
-Copyright © 2022-2023 Université de Versaille Saint-Quentin++
-Copyright © 2018-2019, 2022-2023 Université Paul Sabatier
-
-# LICENSE
-
-*htrdr-combustion* is free software released under the GPLv3+ license: GNU GPL
-version 3 or later <https://gnu.org/licenses/gpl.html>. You are free to change
-and redistribute it. There is NO WARRANTY, to the extent permitted by law.
-
-# SEE ALSO
-
-. Effects of multiple scattering on radiative properties of soot
- fractal aggregates. J. Yon et al, JQSRT 133, 374-381, 2014 -
- <https://doi.org/10.1016/j.jqsrt.2013.08.022>
-. Null-collision meshless Monte-Carlo - a new reverse Monte-Carlo algorithm
- designed for laser-source emission in absorbing/scattering inhomogeneous media. M.
- Sans et al, JQSRT, 2021 - <https://doi.org/10.1016/j.jqsrt.2021.107725>
-. VTK file format -
- <http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf>
-. MPI specifications - <https://www.mpi-forum.org/docs/>
-
-*atrtp*(5),
-*atrri*(5),
-*htrdr-atmosphere*(1),
-*htrdr-image*(5),
-*htrdr-obj*(5),
-*htrdr-materials*(5),
-*mpirun*(1),
-*smsh*(5)
diff --git a/doc/htrdr-image.5 b/doc/htrdr-image.5
@@ -0,0 +1,120 @@
+.\" Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+.\" Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+.\" Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+.\" Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+.\" Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+.\" Copyright (C) 2022-2023 Observatoire de Paris
+.\" Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+.\" Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+.\" Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+.\"
+.\" 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/>.
+.Dd October 4, 2023
+.Dt HTRDR-IMAGE 5
+.Os
+.Sh NAME
+.Nm htrdr-image
+.Nd two dimensional image format
+.Sh DESCRIPTION
+.Nm
+is an image format where data is stored as plain text.
+Text after the
+.Li \&#
+character is considered a comment and is therefore ignored, as are empty
+lines.
+The first valid line stores 2 unsigned integers representing the image
+definition, i.e. the number of pixels per row and column.
+Next, each line stores the 8 components of a pixel.
+.Pp
+Pixels are sorted line by line, with the origin defined in the top left
+corner of the image.
+With an image definition of N by M pixels, with N the number of pixels
+per line and M the total number of lines in the image, the first N
+pixels correspond to the pixels on the top line of the image, the next N
+pixels are the pixels on the second line and so on.
+.Pp
+.Xr htpp 1
+can be used to convert images in
+.Nm
+format into a regular PPM image.
+Note that the nature and unit of the data stored in a
+.Nm
+file are not determined by the file format itself.
+Please refer to the program that generates the image for a full
+description of the data it contains.
+.Pp
+The file format is as follows:
+.Bl -column (definition) (::=) ()
+.It Ao Va htrdr-image Ac Ta ::= Ta Ao Va definition Ac
+.It Ta Ta Ao Va pixel Ac
+.It Ta Ta Va ...
+.It \ Ta Ta
+.It Ao Va definition Ac Ta ::= Ta Ao Va width Ac Ao Va height Ac
+.It Ao Va width Ac Ta ::= Ta Va integer
+.It Ao Va height Ac Ta ::= Ta Va integer
+.It Ao Va pixel Ac Ta ::= Ta
+.Aq Va cpt
+.Aq Va cpt
+.Aq Va cpt
+.Aq Va cpt
+.Aq Va cpt
+.Aq Va cpt
+.Aq Va cpt
+.Aq Va cpt
+.It Ao Va cpt Ac Ta ::= Ta Va real
+# Pixel component
+.El
+.Sh EXAMPLES
+Image of 800 by 600 pixels.
+The comment after each pixel is the pixel's index in the image: the
+first and second integers are respectively the pixel's row and column
+index in the image:
+.Bd -literal
+800 600 # Image definition
+
+# Pixels of the 1st line
+2.55e-4 2.90e-5 3.75e-4 4.48e-5 3.20e-4 3.16e-5 306.484 259.7 # (1,1)
+2.95e-4 3.37e-5 3.39e-4 4.16e-5 3.38e-4 4.60e-5 18.3633 2.663 # (2,1)
+3.76e-4 5.43e-5 3.13e-4 3.48e-5 3.38e-4 3.32e-5 19.6252 2.670 # (3,1)
+ ...
+7.13e-4 1.14e-4 7.66e-4 1.35e-4 7.97e-4 1.26e-4 119.820 93.78 # (799,1)
+6.59e-4 1.14e-4 7.47e-4 1.41e-4 4.39e-4 7.33e-5 24.8655 2.463 # (800,1)
+
+# Pixels of the 2nd line
+3.33e-4 6.02e-5 4.21e-4 7.66e-5 3.44e-4 3.81e-5 19.4580 2.506 # (1,2)
+3.50e-4 4.93e-5 3.23e-4 2.52e-5 3.03e-4 2.42e-5 102.566 81.29 # (2,2)
+2.72e-4 4.69e-5 3.41e-4 4.12e-5 2.52e-4 2.06e-5 25.5801 5.377 # (3,2)
+ ...
+7.52e-4 1.31e-4 8.91e-4 1.84e-4 5.48e-4 1.30e-4 46.5418 12.47 # (799,2)
+6.82e-4 1.42e-4 6.61e-4 7.85e-5 4.44e-4 5.99e-5 59.8728 32.14 # (800,2)
+
+ ...
+
+# Pixels of the 600th line
+2.69e-4 7.44e-5 2.31e-4 2.56e-5 1.95e-4 2.30e-5 43.8242 15.00 # (1,600)
+4.32e-4 1.25e-4 2.22e-4 2.22e-5 2.04e-4 2.60e-5 25.5498 1.739 # (2,600)
+2.78e-4 5.81e-5 2.75e-4 4.99e-5 2.17e-4 3.30e-5 38.4448 7.161 # (3,600)
+ ...
+3.54e-4 4.32e-5 3.07e-4 3.80e-5 2.38e-4 2.49e-5 102.893 36.98 # (799,600)
+3.07e-4 2.61e-5 4.60e-4 1.13e-4 2.69e-4 4.29e-5 42.75070 11.9 # (800,600)
+.Ed
+.Sh SEE ALSO
+.Xr htpp 1 ,
+.Xr htrdr 1
+.Sh HISTORY
+The
+.Nm
+format was first developed for the
+.Xr htrdr 1
+program.
diff --git a/doc/htrdr-image.5.scd b/doc/htrdr-image.5.scd
@@ -1,124 +0,0 @@
-htrdr-image(5)
-
-; Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-; Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-; Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-; Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-; Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-; Copyright (C) 2022-2023 Observatoire de Paris
-; Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-; Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-; Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-;
-; 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/>.
-
-# NAME
-
-htrdr-image - two dimensional image format
-
-# DESCRIPTION
-
-The *htrdr-image* is a raw image file format where data are stored in plain
-text. Characters after the '#' character are considered as comments and are
-thus ignored as well as empty lines. The first valid line stores 2 unsigned
-integers that represent the image definition, i.e. the number of pixels per
-line and per column. Then each line stores 8 floating point components per
-pixel.
-
-Pixels are sorted line by line, with the origin defined at the top left corner
-of the image. With an image definition of N by M pixels, with N the number of
-pixels per line and M the overall number of lines in the image, the first N
-pixels correspond to the pixels of the top line of the image, the following N
-pixels are the pixels of the second line and so on.
-
-The *htpp*(1) program can be used to convert an *htrdr-image* into a regular
-PPM image [1]. Note that the nature and unit of the data stored in an
-*htrdr-image* is not determined by the file format itself. Refer to the
-program that generates the image for a full description of the data it
-contains.
-
-# GRAMMAR
-
-```
-<htrdr-image> ::= <definition>
- <pixel>
- [ <pixel> ... ]
-
-<definition> ::= <width> <height>
-<width> ::= INTEGER
-<height> ::= INTEGER
-
-<pixel> ::= <pixel-sw>
- | <pixel-lw>
-
-<pixel-sw> ::= <X> <Y> <Z> <time>
-<pixel-lw> ::= <temperature> <radiance> 0 0 <time>
-
-<X> ::= <estimate>
-<Y> ::= <estimate>
-<Z> ::= <estimate>
-<time> ::= <estimate>
-<temperature> ::= <estimate>
-<radiance> ::= <estimate>
-
-<estimate> ::= <expected-value> <standard-error>
-<expected-value> ::= REAL
-<standard-error> ::= REAL
-```
-
-# EXAMPLE
-
-The following output was produced by *htrdr*(1) invoked to render an image of
-_800_ by _600_ pixels. Note that actually the comments and blank lines were
-not necessarily written by *htrdr*(1); they are used here only to help the
-reader understand the data layout. The comment after each pixel gives the
-two-dimensional index of the pixel in the image: the first and second integer
-is the index of the line and the column of the pixel in the image,
-respectively.
-
-```
-800 600 # Image definition
-
-# Pixels of the 1st line
-2.55e-4 2.90e-5 3.75e-4 4.48e-5 3.20e-4 3.16e-5 306.484 259.723 # (1,1)
-2.95e-4 3.37e-5 3.39e-4 4.16e-5 3.38e-4 4.60e-5 18.3633 2.66317 # (2,1)
-3.76e-4 5.43e-5 3.13e-4 3.48e-5 3.38e-4 3.32e-5 19.6252 2.67015 # (3,1)
- ...
-7.13e-4 1.14e-4 7.66e-4 1.35e-4 7.97e-4 1.26e-4 119.820 93.7820 # (799,1)
-6.59e-4 1.14e-4 7.47e-4 1.41e-4 4.39e-4 7.33e-5 24.8655 2.46348 # (800,1)
-
-# Pixels of the 2nd line
-3.33e-4 6.02e-5 4.21e-4 7.66e-5 3.44e-4 3.81e-5 19.4580 2.50692 # (1,2)
-3.50e-4 4.93e-5 3.23e-4 2.52e-5 3.03e-4 2.42e-5 102.566 81.2936 # (2,2)
-2.72e-4 4.69e-5 3.41e-4 4.12e-5 2.52e-4 2.06e-5 25.5801 5.37736 # (3,2)
- ...
-7.52e-4 1.31e-4 8.91e-4 1.84e-4 5.48e-4 1.30e-4 46.5418 12.4728 # (799,2)
-6.82e-4 1.42e-4 6.61e-4 7.85e-5 4.44e-4 5.99e-5 59.8728 32.1468 # (800,2)
-
- ...
-
-# Pixels of the 600th line
-2.69e-4 7.44e-5 2.31e-4 2.56e-5 1.95e-4 2.30e-5 43.8242 15.0047 # (1,600)
-4.32e-4 1.25e-4 2.22e-4 2.22e-5 2.04e-4 2.60e-5 25.5498 1.73942 # (2,600)
-2.78e-4 5.81e-5 2.75e-4 4.99e-5 2.17e-4 3.30e-5 38.4448 7.16199 # (3,600)
- ...
-3.54e-4 4.32e-5 3.07e-4 3.80e-5 2.38e-4 2.49e-5 102.893 36.9865 # (799,600)
-3.07e-4 2.61e-5 4.60e-4 1.13e-4 2.69e-4 4.29e-5 42.75070 11.913 # (800,600)
-```
-
-# SEE ALSO
-
-. Portable PixMap - <http://netpbm.sourceforge.net/doc/ppm.html>
-
-*htpp*(1), *htrdr*(1)
diff --git a/doc/htrdr-materials.5 b/doc/htrdr-materials.5
@@ -0,0 +1,96 @@
+.\" Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+.\" Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+.\" Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+.\" Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+.\" Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+.\" Copyright (C) 2022-2023 Observatoire de Paris
+.\" Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+.\" Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+.\" Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+.\"
+.\" 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/>.
+.Dd October 5, 2023
+.Dt HTRDR-MATERIALS 5
+.Os
+.Sh NAME
+.Nm htrdr-materials
+.Nd materials list format
+.Sh DESCRIPTION
+A
+.Nm
+file lists materials in plain text.
+Each line of the file gives the name of the material.
+For opaque materials, the material name is followed by the path to a
+file storing the spectral properties of the associated Bidirectional
+Reflectance Distribution Function
+.Pq BRDF ,
+saved in
+.Xr mrumtl 5
+format.
+The material temperature is defined as the last parameter in the line,
+after the BRDF file mentioned above.
+.Pp
+The material name can be composed of any character except spaces and
+tabs.
+The path to the
+.Xr mrumtl 5
+file must be a valid absolute path in the file system.
+.Pp
+Text after the
+.Li \&#
+character is considered a comment and is therefore ignored, as are empty
+lines.
+.Pp
+The file format is as follows:
+.Bl -column (htrdr-materials) (::=) ()
+.It Ao Va htrdr-materials Ac Ta ::= Ta Ao Va material Ac
+.It Ta Ta Va ...
+.It Ao Va material Ac Ta ::= Ta Ao Va name Ac Ao Va properties Ac
+.It Ao Va properties Ac Ta ::= Ta Li none No \&|
+.Aq Va brdf
+.Aq Va temperature
+.It Ao Va brdf Ac Ta ::= Ta Pa path
+# mrumtl file
+.It Ao Va temperature Ac Ta ::= Ta Va real
+# In Kelvin
+.El
+.Sh EXAMPLES
+The following file lists 3 materials.
+The first,
+.Va grass ,
+has its spectral BRDF defined in file
+.Pa A001.mrumtl .
+The second, named
+.Va sand ,
+has its spectral properties recorded in file
+.Pa B002.mrumtl .
+Both materials have a temperature of
+.Va 300
+Kelvin.
+The final material is a semi-transparent material named
+.Va air
+with no additional properties defined in this file:
+.Bd -literal -offset -Ds
+grass /opt/materials/A001.mrumtl 300
+sand /opt/materials/B002.mrumtl 300
+air none
+.Ed
+.Sh SEE ALSO
+.Xr mrumtl 5
+.Sh HISTORY
+The
+.Nm
+format was first developed for the
+.Xr htrdr 1
+program.
diff --git a/doc/htrdr-materials.5.scd b/doc/htrdr-materials.5.scd
@@ -1,76 +0,0 @@
-htrdr-materials(5)
-
-; Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-; Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-; Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-; Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-; Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-; Copyright (C) 2022-2023 Observatoire de Paris
-; Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-; Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-; Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-;
-; 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/>.
-
-# NAME
-
-htrdr-materials - list of materials used by the geometries in htrdr(1)
-
-# DESCRIPTION
-
-A *htrdr-materials* file lists the materials that can be used by geometries
-provided through a *htrdr-obj*(5) file to the *htrdr*(1) program. Each line
-of the file gives the name of the material. For opaque materials the material
-name is followed by the path toward the *mrumtl*(5) file storing the spectral
-properties of its associated Bidirectional Reflectance Distribution Function.
-Furthermore, the temperature of the material must be defined too.
-
-The material name can be composed of any characters excepted for spaces and
-tabulations. The path toward the *mrumtl*(5) file must be a valid path
-relative to the file system.
-
-Characters behind the hash mark (#) are considered as comments and are thus
-ignored. Empty lines, i.e. lines without any characters or composed of spaces
-and tabulations, are simply skipped.
-
-# GRAMMAR
-
-```
-<htrdr-materials> ::= <material>
- [ <material> ... ]
-<material> ::= <name> <properties>
-<name> ::= STRING
-<properties> ::= none | <mrumtl-path> <temperature>
-<mrumtl-path> ::= PATH
-<temperature> ::= REAL # In Kelvin
-```
-
-# EXAMPLE
-
-The following file lists 3 materials. The first one named _grass_ has its
-spectral BRDF defines in the _A001.mrumtl_ file. The second one is named
-_sand_ and has its spectral properties saved in the _B002.mrumtl_ file. Both
-materials have a temperature of 300 Kelvin. The last material is a
-semi-transparent material named _air_ with no additionnal properties defined
-in this file.
-
-```
-grass /opt/materials/A001.mrumtl 300
-sand /opt/materials/B002.mrumtl 300
-air none
-```
-
-# SEE ALSO
-
-*htrdr*(1), *htrdr-obj*(5), *mrumtl*(5)
diff --git a/doc/htrdr-obj.5 b/doc/htrdr-obj.5
@@ -0,0 +1,113 @@
+.\" Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+.\" Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+.\" Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+.\" Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+.\" Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+.\" Copyright (C) 2022-2023 Observatoire de Paris
+.\" Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+.\" Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+.\" Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+.\"
+.\" 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/>.
+.Dd October 5, 2023
+.Dt HTRDR-OBJ 5
+.Os
+.Sh NAME
+.Nm htrdr-obj
+.Nd geometric file format
+.Sh DESCRIPTION
+A
+.Nm
+file is an ordinary obj file composed solely of triangular meshes.
+Its special feature is that each triangle must be included in a material
+group as defined by the
+.Li usemtl
+directive.
+And the form of the
+.Li usemtl
+directive must be as follows:
+.Bd -ragged -offset Ds
+.Li usemtl Va front_mtl Ns Oo : Ns Va interface_mtl Oc : Ns Va back_mtl
+.Ed
+.Pp
+with
+.Va front-mtl ,
+.Va interface-mtl
+and
+.Va back-mtl
+the material names of the front, interface and back of the triangles
+belonging to the group.
+The interface material name is optional: it is used for thin geometries,
+i.e. geometries with no thickness.
+Material names can be composed of any character, with the exception of
+spaces, tabs and the colon character used to separate the
+aforementioned names.
+Note that, by convention, a side of a triangle is said to be
+"front-facing" when its vertices are ordered clockwise.
+.Pp
+The grammar of a
+.Nm htrdr-obj
+file is therefore a subset of the obj file format, with only one
+specific convention concerning material names.
+Consequently, any software supporting the obj file format can be used to
+create or view a
+.Nm
+file.
+.Sh EXAMPLES
+Define a sheet of paper at the interface between air and concrete:
+.Bd -literal -offset Ds
+v -1.0 -1.0 0
+v -1.0 1.0 0
+v 1.0 -1.0 0
+v 1.0 1.0 0
+
+usemtl air:paper:concrete
+f 1 2 3
+f 3 2 4
+.Ed
+.Pp
+Define a wooden cube whose faces along the Z axis are against a brick.
+The other faces are in contact with the air:
+.Bd -literal -offset Ds
+v 0 0 0
+v 1 0 0
+v 0 1 0
+v 1 1 0
+v 0 0 1
+v 1 0 1
+v 0 1 1
+v 1 1 1
+
+usemtl wood:air
+f 1 3 2
+f 2 3 4
+f 1 5 3
+f 3 5 7
+f 5 6 7
+f 7 6 8
+f 4 8 2
+f 2 8 6
+
+usemtl wood:brick
+f 3 7 4
+f 4 7 8
+f 1 2 5
+f 5 2 6
+.Ed
+.Sh HISTORY
+The
+.Nm
+format was first developed for the
+.Xr htrdr 1
+program.
diff --git a/doc/htrdr-obj.5.scd b/doc/htrdr-obj.5.scd
@@ -1,103 +0,0 @@
-htrdr-obj(5)
-
-; Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-; Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-; Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-; Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-; Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-; Copyright (C) 2022-2023 Observatoire de Paris
-; Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-; Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-; Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-;
-; 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/>.
-
-# NAME
-
-htrdr-obj - file format of the ground geometry in htrdr(1)
-
-# DESCRIPTION
-
-A *htrdr-obj* file is a regular OBJ [1] composed only of triangular meshes.
-Each triangle must be included in a material group as defined by the 'usemtl'
-directive. The name of the material group must be of the form
-"<_front-mtl-name_>:[<_interface-mtl-name_>:]<_back-mtl-name_>", where
-<_front-mtl-name_>, <_interface-mtl-name_> and <_back-mtl-name_> are
-strings separated by a colon (:) defining the name of the front, interface,
-and back facing materials, respectively. The interface material name is
-optionnal: it is used for thin geometries, i.e. geometries with no thickness.
-Material names can be composed of any characters expected for spaces and
-tabulations. Note that regarding the *htrdr*(1) convention, a triangle side is
-said "front facing" when its vertices are clock-wise ordered.
-
-Note that to be a valid *htrdr-obj*(5) file for *htrdr*(1), the front and the
-back facing names must reference a material listed in *htrdr-materials*(5)
-file submitted to the *htrdr*(1) command line.
-
-The grammar of a *htrdr-obj* file is thus a subset of the OBJ file
-format [1] with only a specific convention regarding the material name.
-As a consequence, any software supporting the OBJ file format can be
-used to create or visualise an *htrdr-obj* file.
-
-# EXAMPLES
-
-Define a quad at the interface between the air medium and the concrete
-material.
-
-```
-v -5.0 -5.0 0
-v -5.0 5.0 0
-v 5.0 -5.0 0
-v 5.0 5.0 0
-
-usemtl air:concrete
-f 1 2 3
-f 3 2 4
-```
-
-Define a wooden cube whose Z-aligned faces are against a brick material.
-The remaining faces are in contact with the air.
-
-```
-v 0 0 0
-v 1 0 0
-v 0 1 0
-v 1 1 0
-v 0 0 1
-v 1 0 1
-v 0 1 1
-v 1 1 1
-
-usemtl wood:air
-f 1 3 2
-f 2 3 4
-f 1 5 3
-f 3 5 7
-f 5 6 7
-f 7 6 8
-f 4 8 2
-f 2 8 6
-
-usemtl wood:brick
-f 3 7 4
-f 4 7 8
-f 1 2 5
-f 5 2 6
-```
-
-# SEE ALSO
-
-. OBJ file format - <http://www.martinreddy.net/gfx/3d/OBJ.spec>
-
-*htrdr*(1)
diff --git a/doc/htrdr-planeto.1.in b/doc/htrdr-planeto.1.in
@@ -0,0 +1,610 @@
+.\" Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+.\" Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+.\" Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+.\" Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+.\" Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+.\" Copyright (C) 2022-2023 Observatoire de Paris
+.\" Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+.\" Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+.\" Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+.\"
+.\" 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/>.
+.Dd October 4, 2023
+.Dt HTRDR-PLANETO 1
+.Os
+.Sh NAME
+.Nm htrdr-planeto
+.Nd simulate radiative transfer in 3D planetary atmosphere
+.Sh SYNOPSIS
+.Nm
+.Op Fl dfhNv
+.Op Fl a Ar aerosol_opt Ns Op : Ns Ar aerosol_opt ...
+.Op Fl C Ar persp_camera_opt Ns Op : Ns Ar persp_camera_opt ...
+.Op Fl G Ar ground_opt Ns Op : Ns Ar ground_opt ...
+.Op Fl i Ar image_opt Ns Op : Ns Ar image_opt ...
+.Op Fl O Pa accel_struct_storage
+.Op Fl o Pa output
+.Op Fl S Ar source_opt Ns Op : Ns Ar source_opt ...
+.Op Fl s Ar spectral_opt Ns Op : Ns Ar spectral_opt ...
+.Op Fl T Ar optical_thickness
+.Op Fl t Ar threads_count
+.Op Fl V Ar accel_struct_definition
+.Fl g Ar gas_opt Ns Op : Ns Ar gas_opt ...
+.Sh DESCRIPTION
+.Nm
+simulates the radiative transfer of a terrestrial planet in the visible
+or the infrared part of the spectrum.
+The planet's ground
+.Pq option Fl G
+can be any set of triangles with BRDFs and temperatures defined per triangle.
+The atmosphere is composed of a gas mixture
+.Pq option Fl g
+and a potentially empty set of aerosols
+.Pq option Fl a .
+Both can have arbitrary tetrahedral meshes with per-node radiative
+properties.
+Rayleigh is used as a gas phase function.
+The temperature of the gas is defined on the mesh nodes.
+Aerosol phase functions
+.Pq Henyey and Greenstein or user defined
+are also defined per node.
+.Pp
+.Nm
+is mainly a renderer that calculates an image
+.Pq option Fl i
+for a given observation position
+.Pq option Fl C .
+Its internal rendering algorithm is based on Monte Carlo integration,
+which consists for each pixel of simulating a given number of optical
+paths from the sensor, taking into account the phenomena of light
+absorption and scattering.
+.Pp
+.Nm
+offers three ways to perform spectral integration
+.Pq option Fl s .
+By default, it calculates an image for the visible part of the spectrum between
+380 and 780 nanometers, for the three components of the CIE 1931 XYZ color space
+which are then recombined to obtain the final color for each pixel.
+The other two methods are to explicitly define the longwave or shortwave
+spectral range to be integrated and continuously sample a wavelength in
+this range.
+In fact, longwave and shortwave are keywords that mean that the source
+of radiation is either internal or external to the medium, respectively.
+In shortwave, only radiance is evaluated and stored in the output image.
+For longwave rendering, this estimated radiance is then converted to
+brightness temperature and both are recorded in the image.
+.Pp
+In
+.Nm ,
+the spatial unit 1.0 corresponds to one meter and temperatures are
+expressed in Kelvin.
+The estimated radiances are given in W/sr/m^2, except for monochromatic
+calculations where the calculated spectral radiance is defined in
+W/sr/m^2/nm.
+.Pp
+.Nm
+implements mixed parallelism.
+On a single computer
+.Pq that is, a node ,
+it uses shared memory parallelism while it relies on Message Passing
+Interface (MPI) to parallelize calculations between multiple nodes.
+.Nm
+can therefore be launched either directly or via a process
+launcher such as
+.Xr mpirun 1
+to distribute the rendering on several computers.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl a Ar aerosol_opt Ns Op : Ns Ar aerosol_opt ...
+Define an aerosol.
+Use this option once per aerosol, and duplicate it as many times as
+necessary.
+.Pp
+The aerosol options are as follows:
+.Bl -tag -width Ds
+.It Cm mesh= Ns Pa volumetric_mesh
+Aerosol tetrahedral mesh saved in
+.Xr smsh 5
+format.
+.It Cm name= Ns Ar string
+Name assined to the aerosol.
+.It Cm radprop= Ns Pa radiative_properties
+Radiatve properties of the aerosol saved in
+.Xr sars 5
+format.
+Radiative properties are defined per volumetric mesh node.
+This file and the tetrahedral mesh
+.Pq option Cm mesh
+must therefore be consistent with each other, i.e. the nodes must be
+listed in the same order.
+.It Cm phasefn= Ns Pa phase_functions_list
+List in
+.Xr rnsl 5
+format of phase functions to be loaded.
+Each phase function is saved in
+.Xr rnsf 5
+format.
+The correspondence between these phase functions and the nodes of the
+volumetric mesh is defined in another file
+.Pq option Cm phaseids .
+.It Cm phaseids= Ns Pa per_node_phase_function
+Path to the
+.Xr rnpfi 5
+file that stores the index of the phase function to be used per
+volumetric mesh node.
+The list of phase function is defined in another file
+.Pq option Cm phasefn .
+Note that this file and the tetrahedral mesh
+.Pq option Cm mesh
+must be consistent with each other, i.e. the nodes must be
+listed in the same order.
+.El
+.It Fl C Ar persp_camera_opt Ns Op : Ns Ar persp_camera_opt ...
+Set up a pinhole or thin-lens perspective camera.
+.Pp
+The options for a perspective camera are as follows:
+.Bl -tag -width Ds
+.It Cm focal-dst= Ns Ar distance
+Distance to focus on with a thin lens camera, that is, a camera whose
+.Cm lens-radius
+is not zero.
+The default focal distance is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@ meters.
+.It Cm focal-length= Ns Ar length
+Focal length of a camera lens.
+It is another way to control the field of view of a thin lens camera.
+By default, the field of view is set through the
+.Cm fov
+parameter.
+.It Cm fov= Ns Ar angle
+Vertical field of view of the camera in
+]@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@,
+@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@[ degrees.
+The default field of view is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@ degrees.
+.It Cm lens-radius= Ar radius
+Radius of the camera lens.
+A non-zero radius means that the camera is a thin lens camera while a
+zero radius defines a pinhole camera.
+The default lens radius is
+@HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@.
+.It Cm pos= Ns Ar x , Ns Ar y , Ns Ar z
+Camera position.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_POS@.
+.It Cm tgt= Ns Ar x , Ns Ar y , Ns Ar z
+Targeted position
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_TGT@.
+.It Cm up= Ns Ar x , Ns Ar y , Ns Ar z
+Upward vector that the top of the camera is pointing towards.
+Default is @HTRDR_ARGS_DEFAULT_CAMERA_UP@.
+.El
+.It Fl d
+Write atmospheric acceleration structures to
+.Pa output .
+Each structure is saved in legacy VTK format.
+To divide the resulting output into N files
+.Pq N > 1 ,
+each storing an acceleration structure, one can use the
+.Xr csplit 1
+command as below:
+.Bd -literal -offset Ds
+csplit -f octree -k output %^#\\ vtk% /^#\\ vtk/ \\
+ {$(($(grep -ce "^# vtk" output)-2))}
+.Ed
+.It Fl f
+Force overwriting of
+.Pa output
+file.
+.It Fl G Ar ground_opt Ns Op : Ns Ar ground_opt ...
+The planet's ground.
+.Pp
+The ground options are as follows:
+.Bl -tag -width Ds
+.It Cm brdf= Ns Pa brdfs_list
+List in
+.Xr rnsl 5
+format of the BRDFs to be loaded.
+Each BRDF is saved in
+.Xr mrumtl 5
+format.
+The correspondence between these BRDFs and the triangles of the surface
+mesh is defined in another file
+.Pq option Cm prop .
+.It Cm mesh= Ns Pa surface_mesh
+Ground triangular mesh saved in
+.Xr smsh 5
+format.
+.It Cm name= Ns Ar string
+Name assigned to the ground.
+.It Cm prop= Ns Ar surface_properties
+Ground surface properties, i.e. BRDF index and temperature, both defined
+by triangle.
+The list of BRDF is defined in another file
+.Pq option Cm brdf .
+Note that this file and the surface mesh must be consistent
+.Pq option Cm mesh ,
+i.e. the triangles must be listed in the same order.
+.El
+.It Fl g Ar gas_opt Ns Op : Ns Ar gas_opt ...
+Gas mixture.
+.Pp
+The gas options are as follows:
+.Bl -tag -width Ds
+.It Cm mesh= Ns Pa volumetric_mesh
+Gas tetrahedral mesh saved in
+.Xr smsh 5
+format.
+.It Cm ck= Ns Pa correlated_k
+Correlated K fof the gas saved in
+.Xr sck 5
+format.
+The correlated K are defined per volumetric mesh node.
+This file and the tetrahedral mesh
+.Pq option Cm mesh
+must therefore be consistent with each other, i.e. the nodes must be
+listed in the same order.
+.It Cm temp= Ns Pa temperature
+Gas temperatures saved in
+.Xr rngt 5
+format.
+The temperature is defined per volumetric mesh node.
+This file and the tetrahedral mesh
+.Pq option Cm mesh
+must therefore be consistent with each other, i.e. the nodes must be
+listed in the same order.
+.El
+.It Fl h
+Display short help and exit.
+.It Fl i Ar image_opt Ns Op : Ns Ar image_opt ...
+Configure sensor image.
+.Pp
+The image options are as follows:
+.Bl -tag -width Ds
+.It Cm def= Ns Ar width Ns x Ns Ar height
+Image definition.
+Default is
+@HTRDR_ARGS_DEFAULT_IMG_WIDTH@x@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@.
+.It Cm spp= Ns Ar samples_per_pixel
+Number of samples to solve the Monte Carlo estimation of each pixel.
+Default is @HTRDR_ARGS_DEFAULT_IMG_SPP@.
+.El
+.It Fl N
+Precalculate tetrahedron normals.
+This speeds up runtime performance by calculating normals once and for
+all rather than re-evaluating them every time a tetrahedron is queried
+at a given position.
+In return, the memory space used to store normals increases the memory
+footprint.
+.It Fl O Pa accel_struct_storage
+File where atmospheric acceleration structures are stored/loaded.
+.Pp
+If
+.Pa accel_struct_storage
+does not exist, it is created and is used to store the built
+acceleration structures.
+.Pp
+If
+.Pa accel_struct_storage
+exists, acceleration structures are loaded from it rather than built
+from scratch, resulting in significant acceleration of the preprocessing
+step.
+Note that if the data structures stored in
+.Pa accel_struct_storage
+are not as expected (that is, the input atmospheric data or construction
+parameters are different), an error is notified and execution is
+stopped, thus avoiding the use of incorrect acceleration structures.
+.It Fl o Pa output
+Output file.
+If not defined, data is written to standard output.
+.It Fl S Ar source_opt Ns Op : Ns Ar source_opt ...
+Define the external source.
+.Pp
+The source options are as follows:
+.Bl -tag -width Ds
+.It Cm lat= Ns Ar latitude
+The latitude of the source, i.e. its angle between
+.Bq -90, 90
+degrees about the Y axis.
+The default latitude of 0 is that of the X axis.
+.It Cm lon= Ns Ar longitude
+The longitude of the source, i.e. its angle between [-180, 180] degrees
+about the Z axis.
+The default longitude of 0 is that of the X axis.
+.It Cm dst= Ns Ar distance
+Distance in kilometers from source to origin.
+Default is 0.
+.It Cm rad= Ns Ar radiance_distribution
+Source radiance distribution saved in
+.Xr rnrl 5
+format.
+This option is not compatible with the temperature setting of the source
+.Pq option Cm temp
+which also defines its radiance distribution.
+.It Cm radius= Ns Ar real
+Source radius in kilometers.
+.It Cm temp= Ns Ar temperature
+Source temperature in Kelvin.
+When this option is set, the radiance distribution of the source is
+Planck, at the specified temperature.
+This option is not compatible with the
+.Cm rad
+option that explicitly defines the source radiance distribution.
+.El
+.It Fl s Ar spectral_opt Ns Op : Ns Ar spectral_opt ...
+Configure spectral integration.
+.Pp
+The spectral integration options are as follows:
+.Bl -tag -width Ds
+.It Cm cie_xyz
+Calculate the radiance for the visible part of the spectrum between
+.Bq 380, 780
+nanometers using the XYZ CIE 1931 color matching functions.
+This is the default behavior.
+.It Cm lw= Ns Ar wlen_min , Ns Ar wlen_max
+Calculate the radiance using the internal source of radiation, i.e. the
+radiance emitted by the medium and its boundaries (ground and space).
+.Pp
+Calculations are performed between
+.Bq Ar wlen_min , Ar wlen_max
+nanometers according to Planck's function for a reference temperature
+defined as the maximum ground temperature.
+.Pp
+If
+.Ar wlen_min
+and
+.Ar wlen_max
+are equal, the calculation is monochromatic.
+.It Cm sw= Ns Ar wlen_min , Ns Ar wlen_max
+Calculate the radiance using the external source of radiance
+.Pq option Fl S .
+.Pp
+Calculations are performed between
+.Bq Ar wlen_min , Ar wlen_max
+nanometers according to the radiance distribution of the external
+source
+.Pq see Fl S No option
+.Pp
+If
+.Ar wlen_min
+and
+.Ar wlen_max
+are equal, the calculation is monochromatic.
+.El
+.It Fl T Ar optical_thickness
+Optical thickness used as threshold criterion for building the acceleration
+structures.
+Default is @HTRDR_PLANETO_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@.
+.It Fl t
+Advice on the number of threads to use.
+By default,
+.Nm
+uses many threads as processor cores.
+.It Fl V Ar accel_struct_definition
+Advice on the definition of the atmospheric acceleration structures.
+Default is @HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT@.
+.It Fl v
+Make
+.Nm
+verbose.
+.El
+.Sh OUTPUT IMAGE
+Images calculated by
+.Nm
+are saved in
+.Xr htrdr-image 5
+format.
+This section describes the nature and arrangement of image data
+depending on the type of calculation performed.
+.Ss XYZ image
+For an image rendering in the visible part of the spectrum
+.Pq default behavior or option Fl s Cm cie_xyz ,
+the pixel components store 4 estimates.
+The first, second, and third pairs of floating point values encode the
+estimated integrated radiance in W/sr/m^2 for the X, Y, and Z components
+of the CIE 1931 XYZ color space.
+The first value of each pair is the expected value of the
+average radiance of the pixel.
+The second value is its associated standard deviation.
+The fourth and final pair records the microsecond estimate of the
+computation time per radiative path and its standard error.
+.Ss Longwave image
+For infrared calculations
+.Pq option Fl s Cm lw= Ns Ar wlen_min , Ns Ar wlen_max
+the first and second pixel components store the expected value and the
+standard error of the estimated brightness temperature (in K),
+respectively.
+The third and fourth components record the expected value and the
+standard deviation of the pixel radiance which is either an integrated
+radiance in W/sr/m^2 or a spectral radiance in W/sr/m^2/nm depending on
+whether this radiance was calculated for a spectral range or at a single
+wavelength.
+The fifth and sixth pixel components are not used.
+Finally, the last 2 components of the pixel record the estimate in
+microseconds of the computation time per radiative path and its standard
+error.
+.Ss Shortwave image
+For shortwave calculations
+.Pq option Fl s Cm sw= Ns Ar wlen_min , Ns Ar wlen_max
+the output image is formatted as for a longwave image except that the
+first and second components of the pixels are not used, as no brightness
+temperature has been evaluated.
+That is, the third and fourth values record the estimated radiance per
+pixel and the seventh and eighth values store the estimate of the
+calculation time by radiative path.
+The other values are set to 0.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The following command line runs
+.Nm
+in a verbose way
+.Pq option Fl v
+to calculate an
+.Ar 800 No by Ar 600
+pixel image by sampling
+.Ar 64
+radiative paths per pixel
+.Pq option Fl i
+for the 3 components of the CIE 1931 XYZ color
+space
+.Pq option Fl s .
+The external source is positioned at
+.Ar -45
+degrees longitude and
+.Ar 50
+degrees latitude relative to the absolute referential
+.Pq option Fl S .
+The camera
+.Pq option Fl C
+looks at the origin
+.Pq Cm tgt= Ns Ar 0 , Ns Ar 0 , Ns Ar 0
+and is positioned at
+.Ar 1.5e7
+meters along the Y axis with an image plane aligned along the Z axis
+.Pq Cm up= Ns Ar 0 , Ns Ar 0 , Ns Ar 1 .
+Its vertical field of view is
+.Ar 70
+degrees.
+The gas of the planetary atmosphere is described by the tetrahedral mesh
+recorded in the
+.Pa gas.smsh
+file, while its spectral data and temperature are given by the files
+.Pa gas.sck
+and
+.Pa gas.rngt ,
+respectively.
+Two aerosols complete the planetary atmosphere: one for
+.Ar clouds
+and one for
+.Ar haze .
+Their respective meshes are stored in the
+.Pa a.smsh No and Pa b.smsh
+files while their radiative properties are given by the
+.Pa a.sars No and Pa b.sars
+files.
+Finally, their phase functions are described by a set of 2 files: the
+.Pa a.rnsf No and Pa b.rnsf
+files which list the aerosol phase functions,
+and the
+.Pa a.rnpfi No and Pa b.rnpfi
+files which reference them by volumetric mesh node.
+To speed up rendering time, the normals of the tetrahedral meshes of
+the gas and aerosols are precalculated once and for all
+.Pq option Fl N .
+The ground geometry is stored in the
+.Pa ground.smsh
+file with its triangle properties
+.Pq temperature and BRDF
+defined in the
+.Pa ground.rnsp
+file.
+The referenced BRDFs are listed in the
+.Pa ground.rnsl
+file.
+The definition of acceleration structures
+cannot exceed
+.Ar 512^3
+and its voxels can be merged until their optical thickness
+is greater than
+.Ar 10 .
+These structures are either reloaded from
+.Pa storage_cie.bin
+or built from scratch and stored in
+.Pa storage_cie.bin
+depending on whether that file exists or not.
+Finally, the calculated images are
+stored in the
+.Pa image_CIE_XYZ.ht
+file even if the file already exists
+.Pq options Fl fo :
+.Bd -literal -offset Ds
+htrdr-planeto -v -N \\
+-i def=800x600:spp=64 \\
+-s cie_xyz \\
+-S lon=-45:lat=50:dst=1.5e8:radius=6.9e5:temp=5778 \\
+-C pos=0,1.5e7,0:tgt=0,0,0:up=0,0,1:fov=70 \\
+-g mesh=gas.smsh:ck=gas.sck:temp=gas.rngt \\
+-a mesh=a.smsh:radprop=a.sars:phasefn=a.rnsf:phaseids=a.rnpfi:name=clouds \\
+-a mesh=b.smsh:radprop=b.sars:phasefn=b.rnsf:phaseids=b.rnpfi:name=haze \\
+-G mesh=ground.smsh:prop=ground.rnsp:brdf=ground.rnsl:name=namek \\
+-V 512 -T 10 -O storage_cie.bin \\
+-fo image_CIE_XYZ.ht
+.Ed
+.Pp
+The next command line is the same as the previous one, except that it calculates
+an infrared image between
+.Ar 10,000
+nm and
+.Ar 20,000
+nm
+.Pq option Fl s .
+Note that the acceleration structure storage file is no longer the same
+.Pq Pa storage_lw.bin No rather than Pa storage_cie.bin .
+Indeed, the previous one records the acceleration structures for the
+spectral range of the CIE 1931 XYZ color space
+.Pq i.e. between Bo 380, 780 Bc nm ,
+while one wants to store/reload the acceleration structures for a
+spectral range between 10 and 20 microns.
+In any case, if the previous storage had been submitted, the command
+would have stopped with an error message, thus avoiding the use of the
+wrong acceleration structures
+.Pq see Fl O No option .
+.Bd -literal -offset Ds
+htrdr-planeto -v -N \\
+-i def=800x600:spp=64 \\
+-s lw=10000,20000 \\
+-C pos=0,1.5e7,0:tgt=0,0,0:up=0,0,1:fov=70 \\
+-g mesh=gas.smsh:ck=gas.sck:temp=gas.rngt \\
+-a mesh=a.smsh:radprop=a.sars:phasefn=a.rnsf:phaseids=a.rnpfi:name=clouds \\
+-a mesh=b.smsh:radprop=b.sars:phasefn=b.rnsf:phaseids=b.rnpfi:name=haze \\
+-G mesh=ground.smsh:prop=ground.rnsp:brdf=ground.rnsl:name=namek \\
+-V 512 -T 10 -O storage_lw.bin \\
+-fo image_infrared.ht
+.Ed
+.Sh SEE ALSO
+.Xr htrdr-image 5 ,
+.Xr mrumtl 5 ,
+.Xr rngt 5 ,
+.Xr rnpfi 5 ,
+.Xr rnrl 5 ,
+.Xr rnsf 5 ,
+.Xr sars 5 ,
+.Xr sck 5 ,
+.Xr smsh 5
+.Sh STANDARDS
+.Rs
+.%A International Organization for Standardization / CIE
+.%R ISO/CIE 11664-1:2019
+.%D June 2019
+.%T Colorimetry - Part 1: CIE standard colorimetric observers
+.Re
+.Pp
+.Rs
+.%A OpenMP Architecture Review Board
+.%D March 2002
+.%T OpenMP C and C++ Application Interface
+.%O version 2.0
+.Re
+.Pp
+.Rs
+.%A Message Passing Interface Forum
+.%D July 1997
+.%T MPI-2: Extensions to The Message-Passing Interface
+.Re
+.Sh HISTORY
+.Nm
+has been developed as part of
+.Li ANR-21-CE49-0020
+RaD-net project.
diff --git a/doc/htrdr-planeto.1.scd.in b/doc/htrdr-planeto.1.scd.in
@@ -1,446 +0,0 @@
-htrdr-planeto(1)
-
-; Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-; Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-; Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-; Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-; Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-; Copyright (C) 2022-2023 Observatoire de Paris
-; Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-; Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-; Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-;
-; 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/>.
-
-# NAME
-
-htrdr-planeto - simulate radiative transfer in 3D planetary atmosphere
-
-# SYNOPSIS
-
-htrdr-planeto [_option_] ... -G _ground_ -g _gas_
-
-# DESCRIPTION
-
-*htrdr-planeto* simulates the radiative transfer of a terrestrial planet in the
-visible or the infrared part of the spectrum. The planet's ground (option *-G*)
-can be any set of triangles with BRDFs and temperatures defined per triangle.
-The atmosphere is composed of a gas mixture (option *-g*) and a potentially
-empty set of aerosols (option *-a*). Both can have arbitrary tetrahedral meshes
-with per-node radiative properties. Rayleigh is used as a gas phase function and
-the temperature of the gas is defined on the mesh nodes. Aerosol phase functions
-(Henyey and Greenstein or user defined) are also defined per node.
-
-*htrdr-planeto* is mainly a renderer that calculates an image (option *-i*)
-for a given observation position (option *-C*). Its internal rendering algorithm
-is based on Monte-Carlo integration, which consists for each pixel of simulating
-a given number of optical paths from the sensor, taking into account the
-phenomena of light absorption and scattering.
-
-*htrdr-planeto* offers three ways to perform spectral integration (*-s* option).
-By default, it calculates an image for the visible part of the spectrum between
-380 and 780 nanometers, for the three components of the CIE 1931 XYZ color space
-which are then recombined to obtain the final color for each pixel, and finally
-the entire image of the scene as seen from the observation position. The other
-two methods are to explicitly define the longwave or shortwave spectral range to
-be integrated and continuously sample a wavelength in this range. In fact,
-longwave and shortwave are keywords that mean that the source of radiation is
-either internal or external to the medium, respectively. In shortwave, only
-radiance is evaluated and stored in the output image. For longwave rendering,
-this estimated radiance is then converted to brightness temperature and both are
-recorded in the image.
-
-In *htrdr-planeto*, the spatial unit 1.0 corresponds to one meter and
-temperatures are expressed in Kelvin. The estimated radiances are given in
-W/sr/m², except for monochromatic calculations where the calculated spectral
-radiance is defined in W/sr/m²/nm.
-
-*htrdr-planeto* implements mixed parallelism. On a single computer (that is, a
-node), it uses shared memory parallelism while it relies on Message Passing
-Interface (MPI) to parallelize calculations between multiple nodes.
-*htrdr-planeto* can therefore be launched either directly or via a process
-launcher such as *mpirun*(1) to distribute the rendering on several computers.
-
-# OPTIONS
-
-*-a* <_aerosol-parameter_:...>
- Define an aerosol. Use this option once per aerosol, and duplicate it as many
- times as necessary.
-
- *mesh*=_path_
- Path to the *smsh*(5) file that stores the aerosol tetrahedral mesh.
-
- *name*=_string_
- Name assigned to the aerosol.
-
- *radprop*=_path_
- Path to the *sars*(5) file that stores the radiative properties of the
- aerosol. Radiative properties are defined per volumetric mesh node and,
- therefore, this file and the volumetric mesh file (see *mesh* parameter)
- must be consistent with each other.
-
- *phasefn*=_path_
- Path to the *rnsl*(5) file that lists the *rnsf*(5) files to load; each of
- these files stores an aerosol phase function. The phase function to be used
- per volumetric mesh node is defined in another file (see *phaseids*
- parameter).
-
- *phaseids*=_path_
- Path to the *rnpfi*(5) file that stores the index of the phase function to
- be used per volumetric mesh node; the list of phase function is defined in
- another file (see *phasefn* parameter). Note that this file must be
- consistent with the volumetric mesh defined in the *mesh* parameter.
-
-*-C* <_camera-parameter_:...>
- Configure a perspective camera. Available parameters are:
-
- *focal-dst*=_dst_
- Distance to focus on with a thin lens camera, that is, a camera whose
- *lens-radius* is not zero. The default focal distance is
- @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@ meter.
-
- *focal-length*=_length_
- Focal length of a camera lens. It is another way to control the field of
- view of a thin lens camera. By default, the field of view is directly set
- through the **fov** parameter.
-
- *fov*=_angle_
- Vertical field of view of the camera in
- \]@HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@,
- @HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@[ degrees. By
- default _angle_ is set to
- @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@ degrees.
-
- *lens-radius*=_radius_
- Radius of the camera lens. A non-zero radius means that the camera is a thin
- lens camera while a zero radius defines a pinhole camera. By default the
- lens radius is @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@.
-
- *pos*=_x_,_y_,_z_
- Camera lens position. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}.
-
- *tgt*=_x_,_y_,_z_
- Position targeted by the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}.
-
- *up*=_x_,_y_,_z_
- Up vector of the camera. By default it is set to
- {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}.
-
-*-d*
- Write atmospheric acceleration structures to _output_. Each structure is saved
- in VTK ASCII file format [1]. To divide the resulting output into _n_ files
- (_n_ > 1), each storing an acceleration structure, one can use the *csplit*(1)
- command as below:
-
- ```
- csplit -f octree -k output %^#\\ vtk% /^#\\ vtk/ \\
- {$(($(grep -ce "^# vtk" output)-2))}
- ```
-
-*-f*
- Force overwrite the _output_ file.
-
-*-G* <_ground-parameter_:...>
- Define the ground of the planet. Available ground parameters are:
-
- *brdf*=_path_
- Path to the *rnsl*(5) file that lists the *mrumtl*(5) files to load; each of
- these files stores a ground BRDF. The BRDF to be used per ground node is
- defined in another file (see *prop* parameter).
-
- *mesh*=_path_
- Path to the *smsh*(5) file which stores the triangular mesh of the ground.
-
- *name*=_string_
- Name assigned to the ground.
-
- *prop*=_path_
- Path to the *rnsp*(5) file that stores ground surface properties. The
- properties (BRDF index and temperature) are defined per triangle and,
- therefore, this file and the mesh file (see *mesh* parameter) must be
- consistent with each other.
-
-*-g* <_gas-parameter_:...>
- Define the gas mixture. Available gas parameters are:
-
- *mesh*=_path_
- Path to the *smsh*(5) file that stores the gas tetrahedral mesh.
-
- *ck*=_path_
- Path to the *sck*(5) file that stores the correlated K of the gas. The CKs
- are defined per volumetric mesh node and, therefore, this file and the
- volumetric mesh file (see *mesh* parameter) must be consistent with each
- other.
-
- *temp*=_path_
- Path to the *rngt*(5) file that stores the temperature of the gas. The
- temperature is defined per volumetric mesh node and, therefore, this file
- and the volumetric mesh file (see *mesh* parameter) must be consistent with
- each other.
-
-*-h*
- Display short help and exit.
-
-*-i* <_image-parameter_:...>
- Define the image to compute. Available image parameters are:
-
- *def*=<_width_>x<_height_>
- Image definition. By default the image definition is
- @HTRDR_ARGS_DEFAULT_IMG_WIDTH@x@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@.
-
- *spp*=_samples-count_
- Number of samples to estimate one pixel, i.e. number of radiative paths
- sampled per pixel. By default, *spp* is set to
- @HTRDR_ARGS_DEFAULT_IMG_SPP@.
-
-*-N*
- Precalculate tetrahedron normals. This speeds up runtime performance by
- calculating normals once and for all rather than re-evaluating them every time
- a tetrahedron is queried at a given position. In return, the memory space used
- to store normals increases the memory footprint.
-
-*-O* _storage_
- File where atmospheric acceleration structures are stored/loaded. If _storage_
- does not exist, it is created and is used to store the built acceleration
- structures.
-
- If _storage_ exists, acceleration structures are loaded from it rather than
- built from scratch, resulting in significant acceleration of the preprocessing
- step. Note that if the data structures stored in _storage_ are not as expected
- (that is, the input atmospheric data or construction parameters are
- different), an error is notified and execution is stopped, thus avoiding the
- use of incorrect acceleration structures.
-
-*-o* _output_
- File to write the output data. The output data is either an image or atmospheric
- acceleration structures if the *-d* option is set. If it is not defined, the
- data is written to the standard output.
-
-*-S* <_source-parameter_:...>
- Define the external source. Available source parameters are:
-
- *lat*=_real_
- The latitude of the source, i.e. its angle between [-90, 90] degrees from
- the x-axis. The default latitude is set to 0.
-
- *lon*=_real_
- The longitude of the source, i.e. its angle between [-180, 180] degrees
- about the z-axis. The default longitude is set to 0.
-
- *dst*=_real_
- Distance in kilometers from source to origin. The default distance is 0.
-
- *rad*=_path_
- The path to the *rnrl*(5) file that stores the source radiance distribution.
- This option is not compatible with the temperature setting of the source
- (parameter *temp*) which also defines its radiance distribution.
-
- *rad*=_path_
- The path to the *rnrl*(5) file that stores the source radiance distribution.
- This option is not compatible with the temperature setting of the source
- (parameter *temp*) which also defines its radiance distribution.
-
- *radius*=_real_
- Source radius in kilometers.
-
- *temp*=_real_
- Source temperature in Kelvin; when this option is set, the radiance
- distribution of the source is Planck, at the specified temperature. This
- option is not compatible with the *rad* parameter that explicitly defines
- the source radiance distribution.
-
-*-s* <_spectral-parameter_:...>
- Configure spectral integration. Available spectral parameters are:
-
- *cie_xyz*
- The radiance is calculated for the visible part of the spectrum between
- 380 nm and 780 nm by sampling the wavelength relative to the XYZ CIE 1931
- color space. This is the default spectral integration.
-
- *lw*=_wlen-min_,_wlen-max_
- Perform continuous spectral sampling in the wavelength range [_wlen-min_, _wlen-max_]
- (wavelengths must be provided in nanometers) according to the Planck
- function for a reference temperature which is the maximum ground
- temperature, which is assumed to be the maximum scene temperature. If
- _wlen-min_ and _wlen-max_ are equal, the calculation is monochromatic. *lw*
- stands for "longwaves" but is only a keyword that actually refers to
- internal source (emitted within the medium, as opposed to external source
- like sun): in other words, radiation is emitted by the medium and its limits
- (ground and space).
-
- *sw*=_wlen-min_,_wlen-max_
- Perform continuous spectral sampling in the wavelength range [_wlen-min_, _wlen-max_]
- (wavelengths must be provided in nanometers) according to the Planck
- function for a reference temperatura which is the source temperature. If
- _wlen-min_ and _wlen-max_ are equal, the calculation is monochromatic. Here,
- *sw* means shortwaves, i.e. the radiation source is external to the medium
- (option *-S*).
-
-*-T* _optical-thickness_
- Optical thickness used as a criterion to construct atmospheric acceleration
- structures. Its default value is
- @HTRDR_PLANETO_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@.
-
-*-t* _threads-count_
- Hint on the number of threads to use. Default assumes as many threads as CPU
- cores.
-
-*-V* _definition_
- Advice on the definition of the atmospheric acceleration structures. Its
- default value is
- @HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT@.
-
-*-v*
- Make the command verbose.
-
-# OUTPUT IMAGE
-
-Images calculated by *htrdr-planeto* are saved in *htrdr-image*(5) file format.
-This section describes the nature and arrangement of the output data depending
-on the type of calculation.
-
-## XYZ image
-
-For image rendering in the visible part of the spectrum (default behavior or
-when the *-s cie_xyz* option is set), each pixel stores 4 estimates, or 8
-floating-point values. The first, second and third pairs of numbers store the
-estimated radiation in W/sr/m² for the X, Y, and Z components of the CIE 1931
-XYZ color space. For each pair, the first corresponds to the expected value and
-the second its standard error. Finally, the fourth and last pair records the
-estimate of the calculation time in µs of a radiative path (expected value and
-standard error).
-
-## Longwave image
-
-If the image is an infrared rendering (option *-s lw*=_wlen-min_,_wlen-max_),
-the first and second pixel values store the expected value and standard error of
-the estimated brightness temperature in Kelvin. The third and fourth values
-record the expected value and standard error of the estimated radiance, which is
-either integrated radiance in W/sr/m² or spectral radiance in W/sr/m²/nm
-depending on whether this radiance was calculated for a spectral range or at a
-single wavelength. The fifth and sixth values are not used and are therefore set
-to 0. Finally, the last 2 components of the pixel record the expected value and
-the standard error in µs of the calculation time per radiative path.
-
-## Shortwave image
-
-For shortwave renderings (option *-s sw*=_wlen-min_,_wlen-max_), the image
-layout is the same as for infrared rendering, except for the first and second
-pixel values that are not used. That is, the third and fourth values record the
-estimated radiance per pixel and the seventh and eighth values store the
-estimate of the calculation time by radiative path. The other values are set to
-0.
-
-# EXAMPLES
-
-The following command line runs *htrdr-planeto* in a verbose way (option *-v*)
-to calculate an _800_ by _600_ pixel image by sampling _64_ radiative paths per
-pixel for the 3 components of the CIE XYZ 1931 color space. The external source
-is positioned at _-45_ degrees longitude and _50_ degrees latitude relative to
-the absolute referential. The camera looks at the origin (*tgt=*_0_,_0_,_0_) and
-is positioned at _1.5e7_ meters along the Y axis with an image plane aligned
-along the Z axis (*up=*_0_,_0_,_1_). Its vertical field of view is _70_ degrees.
-The gas of the planetary atmosphere is described by the tetrahedral mesh
-recorded in the _gas.smsh_ file, while its spectral data and temperature are
-given by the files _gas.sck_ and _gas.rngt_, respectively. Two aerosols complete
-the planetary atmosphere: one for _clouds_ and one for _haze_. Their respective
-meshes are stored in the _a<1|2>.smsh_ files while their radiative properties
-are given by the _a<1|2>.sars_ files. Finally, their phase functions are
-described by a set of 2 files: the _a<1|2>.rnsf_ file which lists the aerosol
-phase functions and the _a<1|2>.rnpfi_ file which references them by volumetric
-mesh node. To speed up rendering time, the normals of the tetrahedral meshes of
-the gas and aerosols are precalculated once and for all (option *-N*). The
-ground geometry is stored in the _ground.smsh_ file with its triangle properties
-(temperature and BRDF) defined in the _ground.rnsp_ file. The referenced BRDFs
-are listed in the _ground.rnsl_ file. The definition of acceleration structures
-cannot exceed _512³_ and its voxels can be merged until their optical thickness
-is greater than _10_. These structures are either reloaded from
-_storage_cie.bin_ or built from scratch and stored in _storage_cie.bin_
-depending on whether that file exists or not. Finally, the calculated images are
-stored in the _image_CIE_XYZ.ht_ file even if the file already exists (option
-*-f*).
-
-```
-htrdr-planeto -v -N \
- -i def=800x600:spp=64 \
- -s cie_xyz \
- -S lon=-45:lat=50:dst=1.5e8:radius=6.9e5:temp=5778 \
- -C pos=0,1.5e7,0:tgt=0,0,0:up=0,0,1:fov=70 \
- -g mesh=gas.smsh:ck=gas.sck:temp=gas.rngt \
- -a mesh=a1.smsh:radprop=a1.sars:phasefn=a1.rnsf:phaseids=a1.rnpfi:name=clouds \
- -a mesh=a2.smsh:radprop=a2.sars:phasefn=a2.rnsf:phaseids=a2.rnpfi:name=haze \
- -G mesh=ground.smsh:prop=ground.rnsp:brdf=ground.rnsl:name=namek \
- -V 512 -T 10 -O storage_cie.bin \
- -f -o image_CIE_XYZ.ht
-```
-
-The next command line is the same as the previous one, except that it calculates
-an infrared image between _10,000_ nm and _20,000_ nm (option *-s*). Note that
-the acceleration structure storage file is no longer the same (_storage_lw.bin_
-rather than _storage_cie.bin_). Indeed, the previous one records the
-acceleration structures for the spectral range of the CIE XYZ color space, while
-one wants to store/reload the acceleration structures for a spectral range
-between 10 and 20 µm (see *-O* option). In any case, if the previous storage,
-incompatible with the current spectral range, had been submitted, the command
-would have stopped with an error message, thus avoiding the use of the wrong
-accelerartion structures.
-
-```
-htrdr-planeto -v -N \
- -i def=800x600:spp=64 \
- -s lw=10000,20000 \
- -C pos=0,1.5e7,0:tgt=0,0,0:up=0,0,1:fov=70 \
- -g mesh=gas.smsh:ck=gas.sck:temp=gas.rngt \
- -a mesh=a1.smsh:radprop=a1.sars:phasefn=a1.rnsf:phaseids=a1.rnpfi:name=clouds \
- -a mesh=a2.smsh:radprop=a2.sars:phasefn=a2.rnsf:phaseids=a2.rnpfi:name=haze \
- -G mesh=ground.smsh:prop=ground.rnsp:brdf=ground.rnsl:name=namek \
- -V 512 -T 10 -O storage_lw.bin \
- -f -o image_infrared.ht
-```
-
-# COPYRIGHT
-
-Copyright © 2018-2019, 2022-2023 Centre National de la Recherche Scientifique++
-Copyright © 2020-2022 Institut Mines Télécom Albi-Carmaux++
-Copyright © 2022-2023 Institut Pierre-Simon Laplace++
-Copyright © 2022-2023 Institut de Physique du Globe de Paris++
-Copyright © 2018-2023 |Méso|Star> <contact@meso-star.com>++
-Copyright © 2022-2023 Observatoire de Paris++
-Copyright © 2022-2023 Université de Reims Champagne-Ardenne++
-Copyright © 2022-2023 Université de Versaille Saint-Quentin++
-Copyright © 2018-2019, 2022-2023 Université Paul Sabatier
-
-# LICENSE
-
-*htrdr-planeto* is free software released under the GPLv3+ license: GNU GPL
-version 3 or later <https://gnu.org/licenses/gpl.html>. You are free to change
-and redistribute it. There is NO WARRANTY, to the extent permitted by law.
-
-# SEE ALSO
-
-. VTK file format -
- <http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf>
-
-*htpp*(1),
-*htrdr-image*(5),
-*mpirun*(1),
-*mrumtl*(5),
-*rnpfi*(5),
-*rnrl*(5),
-*rnsf*(5),
-*rnsl*(5),
-*sars*(5),
-*smsh*(5)
diff --git a/doc/htrdr.1 b/doc/htrdr.1
@@ -0,0 +1,85 @@
+.\" Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+.\" Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+.\" Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+.\" Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+.\" Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+.\" Copyright (C) 2022-2023 Observatoire de Paris
+.\" Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+.\" Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+.\" Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+.\"
+.\" 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/>.
+.Dd September 27, 2023
+.Dt HTRDR 1
+.Os
+.Sh NAME
+.Nm htrdr
+.Nd simulate radiative transfer
+.Sh SYNOPSIS
+.Nm
+.Op Fl vh
+.Op Ar mode Op Ar options ...
+.Sh DESCRIPTION
+.Nm
+simulates radiative transfer in scenes composed of heterogeneous
+semi-transparent materials and geometries with varying spectral
+reflectivities.
+.Pp
+The way the scenes are described and the Monte Carlo algorithms solved
+are controlled by the
+.Ar mode
+argument, which defines the computational context.
+A
+.Ar mode
+corresponds to a command line named
+.Li htrdr- Ns Ar mode
+with its set of options.
+See the corresponding manual page for a full description.
+.Pp
+The available modes are as follows:
+.Bl -tag -width Ds
+.It Cm atmosphere
+Calculate radiative transfer in a cloudy atmosphere
+.Pq see Xr htrdr-atmosphere 1 .
+.It Cm combustion
+Calculate radiative transfer in a combustion chamber
+.Pq see Xr htrdr-combustion 1 .
+.It Cm planeto
+Calculate radiative transfer in 3d planetary atmosphere
+.Pq see Xr htrdr-planeto 1 .
+.El
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl h
+Display short help and exit.
+.It Fl v
+Display the version number and exit.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr htrdr-atmosphere 1 ,
+.Xr htrdr-combustion 1 ,
+.Xr htrdr-planeto 1
+.\".Sh HISTORY
+.\".Nm
+.\"was initially developed for cloudy atmospheres in High-Tune
+.\".Li ANR-16-CE01-0010 .
+.\"It was then extended in
+.\".Li MODEVAL-URBA 2019 .
+.\"Support for combustion chambers was added in Astoria
+.\".Li ANR-18-CE05-0015 .
+.\"Planetology simulations were developed in RaD-net
+.\".Li ANR-21-CE49-0020 .
diff --git a/doc/htrdr.1.scd b/doc/htrdr.1.scd
@@ -1,88 +0,0 @@
-htrdr(1)
-
-; Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-; Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-; Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-; Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-; Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-; Copyright (C) 2022-2023 Observatoire de Paris
-; Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-; Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-; Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-;
-; 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/>.
-
-# NAME
-
-htrdr - the Monte-Carlo radiative transfert simulator
-
-# SYNOPSIS
-
-htrdr [-v] [-h] <_mode_> [<_args_>]
-
-# DESCRIPTION
-
-*htrdr* computes images of scenes composed of semi transparent materials and
-geometries with spectral varying reflectivities. The way the scenes are
-described and the solved Monte-Carlo algorithms are controlled by the _mode_
-argument that defines the computation context.
-
-# OPTIONS
-
-*-h*
- Print short help and exit.
-
-*-v*
- Display version information and exit.
-
-# MODES
-
-Each *htrdr* _mode_ is actually a mapping to a seperate command line named
-_htrdr-<mode>_ with its own set of arguments. Refer to their corresponding
-man page for their complete description.
-
-The available _htrdr-<mode>_ commands are:
-
-*htrdr-atmosphere*(1)
- Radiative transfer computations in a cloudy atmosphere.
-
-*htrdr-combustion*(1)
- Radiative transfer computations in a combustion medium.
-
-*htrdr-planeto*(1)
- Radiative transfer computations in 3D planetary atmosphere.
-
-# COPYRIGHT
-
-Copyright © 2018-2019, 2022-2023 Centre National de la Recherche Scientifique++
-Copyright © 2020-2022 Institut Mines Télécom Albi-Carmaux++
-Copyright © 2022-2023 Institut Pierre-Simon Laplace++
-Copyright © 2022-2023 Institut de Physique du Globe de Paris++
-Copyright © 2018-2023 |Méso|Star> <contact@meso-star.com>++
-Copyright © 2022-2023 Observatoire de Paris++
-Copyright © 2022-2023 Université de Reims Champagne-Ardenne++
-Copyright © 2022-2023 Université de Versaille Saint-Quentin++
-Copyright © 2018-2019, 2022-2023 Université Paul Sabatier
-
-# LICENSE
-
-*htrdr* is free software released under the GPLv3+ license: GNU GPL version 3
-or later <https://gnu.org/licenses/gpl.html>. You are free to change and
-redistribute it. There is NO WARRANTY, to the extent permitted by law.
-
-# SEE ALSO
-
-*htrdr-atmosphere*(1),
-*htrdr-combustion*(1),
-*htrdr-planeto*(1)
diff --git a/doc/rnrl.5 b/doc/rnrl.5
@@ -0,0 +1,89 @@
+.\" Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+.\" Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+.\" Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+.\" Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+.\" Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+.\" Copyright (C) 2022-2023 Observatoire de Paris
+.\" Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+.\" Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+.\" Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+.\"
+.\" 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/>.
+.Dd October 9, 2023
+.Dt RNRL 5
+.Os
+.Sh NAME
+.Nm rnrl
+.Nd radiance distribution format
+.Sh DESCRIPTION
+.Nm
+is a binary file format for storing a radiance distribution, i.e. a set
+of radiances
+.Pq in W/m^2/sr/m
+sorted by ascending wavelength
+.Pq in nm .
+.Pp
+A
+.Nm
+file is actualy a Star-Buffer file
+.Pq see Xr sbuf 5 .
+It starts with a header of 4 integers
+The first integer is a power of two
+.Pq usually 4096
+that defines the size of the memory page in bytes
+.Pq Va pagesize
+on which the list of radiances by wavelength is aligned.
+By aligning data to pagesize, and depending on system requirements,
+memory mapping can be used to automatically load/unload pages on demand
+.Pq see Xr mmap 2 .
+The second integer is the
+.Va size
+of the array, i.e. the number of wavelengths for which a radiance is
+defined.
+The 2 remaining integers store the memory size (16 bytes) and memory
+alignment (16 bytes) of each entry, i.e. the wavelength
+.Pq in nm
+and its associated radiance
+.Pq in W/m^2/sr/m .
+.Pp
+Padding bytes follow the file header to align the radiance distribution
+to
+.Va pagesize .
+.Pp
+The distribution is finally followed by padding bytes to align the
+overall file size with the size of a page.
+.Pp
+Data are encoded with respect to the little endian bytes ordering,
+i.e.\& least significant bytes are stored first.
+.Pp
+The file format is as follows:
+.Bl -column (distribution) (::=) ()
+.It Ao Va rnsl Ac Ta ::= Ta Ao Va pagesize Ac Ao Va size Ac Li 16 16
+.It Ta Ta Aq Va padding
+.It Ta Ta Aq Va distribution
+.It Ta Ta Aq Va padding
+.It Ao Va pagesize Ac Ta ::= Ta Vt uint64_t
+.It Ao Va distribution Ac Ta ::= Ta
+.Aq Va wavelength
+.Aq Va radiance
+.It Ta Ta Va ...
+.It Ao Va wavelength Ac Ta ::= Ta Vt double
+# In nm
+.It Ao Va radiance Ac Ta ::= Ta Vt double
+# In W/m^2/sr/m
+.It Ao Va padding Ac Ta ::= Ta Op Vt int8_t ...
+.El
+.Sh SEE ALSO
+.Xr mmap 2 ,
+.Xr sbuf 5
diff --git a/doc/rnrl.5.scd b/doc/rnrl.5.scd
@@ -1,82 +0,0 @@
-rnrl(5)
-
-; Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
-; Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
-; Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
-; Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
-; Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
-; Copyright (C) 2022-2023 Observatoire de Paris
-; Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
-; Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
-; Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
-;
-; 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/>.
-
-# NAME
-
-rnsr - Rad-Net Radiance List file format
-
-# DESCRIPTION
-
-*rnrl* is a binary file format for storing a list of spectrally varying
-radiances. The radiances (in W/m²/sr/m) are listed by wavelength (in nm)
-sorted in ascending order.
-
-A *rnrl* file is actually a Star-Buffer file (see *sbuf*(5)). It starts with a
-header of 4 64-bit integers describing the layout of the data. The first integer
-is a power of two (usually 4096) which defines the size of the memory page in
-bytes on which the list of radiances by wavelength aligns (_pagesize_). The
-second integer is the _size_ of the array, that is, the number of wavelengths
-for which a radiance is defined. Finally, the remaining 2 integers store the
-memory size (16 bytes) and memory alignment (16 bytes) of a radiance per
-wavelength.
-
-The fill bytes follow the file header to align the radiances by wavelength to
-_pagesize_.
-
-Each item in the list is composed of 2 double-precision floating-point values:
-the wavelength in nanometers and its corresponding radiance in W/m²/sr/m.
-
-The end of the file is eventually padded with dummy bytes to ensure that the
-overall file size is a multiple of _pagesize_.
-
-# BINARY FILE FORMAT
-
-Data are encoded with respect to the little endian bytes ordering, i.e. least
-significant bytes are stored first.
-
-```
-<rnsr> ::= <pagesize> <size> 16 16
- <padding>
- <radiances>
- <padding>
-
-<pagesize> ::= UINT64
-<size> ::= UINT64 # Number of items stored
-
----
-
-<radiances> ::= <property> ... ...
-<property> ::= <wavelength> <radiance>
-<wavelength> ::= DOUBLE # in nanometer
-<radiance> ::= DOUBLE # in W/m²/sr/m
-
----
-
-<padding> ::= [ BYTE ... ] # Ensure alignement
-```
-
-# SEE ALSO
-
-*sbuf*(5)
diff --git a/htrdr-atmosphere.pc.in b/htrdr-atmosphere.pc.in
@@ -0,0 +1,16 @@
+# Used for local building only
+Requires: rsys >= @RSYS_VERSION@
+Requires.private:\
+ htrdr-core >= @VERSION@,\
+ htsky >= @HTSKY_VERSION@,\
+ s3d >= @S3D_VERSION@,\
+ scam >= @SCAM_VERSION@,\
+ ssf >= @SSF_VERSION@,\
+ star-sp >= @SSP_VERSION@,\
+ svx >= @SVX_VERSION@
+Name: htrdr-atmosphere
+Description: htrdr Atmosphere
+Version: @VERSION@
+Libs: -L. -lhtrdr-atmosphere
+Libs.private: -lm
+CFlags: -DHTRDR_BUILD_ATMOSPHERE -Isrc
diff --git a/htrdr-combustion.pc.in b/htrdr-combustion.pc.in
@@ -0,0 +1,16 @@
+# Used for local building only
+Requires: rsys >= @RSYS_VERSION@
+Requires.private:\
+ atrstm > @ATRSTM_VERSION@,\
+ htrdr-core >= @VERSION@,\
+ s3d >= @S3D_VERSION@,\
+ scam >= @SCAM_VERSION@,\
+ ssf >= @SSF_VERSION@,\
+ star-sp >= @SSP_VERSION@,\
+ svx >= @SVX_VERSION@
+Name: htrdr-combustion
+Description: htrdr Combustion
+Version: @VERSION@
+Libs: -L. -lhtrdr-combustion
+Libs.private: -lm
+CFlags: -DHTRDR_BUILD_COMBUSTION -Isrc
diff --git a/htrdr-core.pc.in b/htrdr-core.pc.in
@@ -0,0 +1,16 @@
+# Used for local building only
+Requires: rsys >= @RSYS_VERSION@
+Requires.private:\
+ aw >= @AW_VERSION@,\
+ @MPI_PC@ >= @MPI_VERSION@,\
+ mrumtl >= @MRUMTL_VERSION@,\
+ s3d >= @S3D_VERSION@,\
+ scam >= @SCAM_VERSION@,\
+ ssf >= @SSF_VERSION@,\
+ star-sp >= @SSP_VERSION@
+Name: htrdr-core
+Description: htrdr Core
+Version: @VERSION@
+Libs: -L. -lhtrdr-core
+Libs.private: -lm -fopenmp
+CFlags: -Isrc
diff --git a/htrdr-planeto.pc.in b/htrdr-planeto.pc.in
@@ -0,0 +1,18 @@
+# Used for local building only
+Requires: rsys >= @RSYS_VERSION@
+Requires.private:\
+ htrdr-core >= @VERSION@,\
+ rnatm > @RNATM_VERSION@,\
+ rngrd > @RNGRD_VERSION@,\
+ s3d >= @S3D_VERSION@,\
+ sbuf >= @SBUF_VERSION@,\
+ scam >= @SCAM_VERSION@,\
+ ssf >= @SSF_VERSION@,\
+ star-sp >= @SSP_VERSION@,\
+ svx >= @SVX_VERSION@
+Name: htrdr-planeto
+Description: htrdr Planeto
+Version: @VERSION@
+Libs: -L. -lhtrdr-planeto
+Libs.private: -lm
+CFlags: -DHTRDR_BUILD_PLANETO -Isrc
diff --git a/make.sh b/make.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Copyright (C) 2018-2019, 2022-2023 Centre National de la Recherche Scientifique
+# Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
+# Copyright (C) 2022-2023 Institut Pierre-Simon Laplace
+# Copyright (C) 2022-2023 Institut de Physique du Globe de Paris
+# Copyright (C) 2018-2023 |Méso|Star> (contact@meso-star.com)
+# Copyright (C) 2022-2023 Observatoire de Paris
+# Copyright (C) 2022-2023 Université de Reims Champagne-Ardenne
+# Copyright (C) 2022-2023 Université de Versaille Saint-Quentin
+# Copyright (C) 2018-2019, 2022-2023 Université Paul Sabatier
+#
+# 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/>.
+
+set -e
+
+install()
+{
+ prefix=$1
+ shift 1
+
+ mkdir -p "${prefix}"
+
+ for i in "$@"; do
+ dst="${prefix}/${i##*/}"
+
+ if cmp -s "${i}" "${dst}"; then
+ printf "Up to date %s\n" "${dst}"
+ else
+ printf "Installing %s\n" "${dst}"
+ cp "${i}" "${prefix}"
+ fi
+ done
+}
+
+"$@"
diff --git a/src/atmosphere/htrdr_atmosphere.c b/src/atmosphere/htrdr_atmosphere.c
@@ -48,37 +48,6 @@
/*******************************************************************************
* Helper functions
******************************************************************************/
-static double
-compute_sky_min_band_len(struct htsky* sky, const double range[2])
-{
- double min_band_len = DBL_MAX;
- size_t nbands;
- ASSERT(sky && range && range[0] <= range[1]);
-
- nbands = htsky_get_spectral_bands_count(sky);
-
- if(eq_eps(range[0], range[1], 1.e-6)) {
- ASSERT(nbands == 1);
- min_band_len = 0;
- } else {
- size_t i = 0;
-
- /* Compute the length of the current band clamped to the submitted range */
- FOR_EACH(i, 0, nbands) {
- const size_t iband = htsky_get_spectral_band_id(sky, i);
- double wlens[2];
- HTSKY(get_spectral_band_bounds(sky, iband, wlens));
-
- /* Adjust band boundaries to the submitted range */
- wlens[0] = MMAX(wlens[0], range[0]);
- wlens[1] = MMIN(wlens[1], range[1]);
-
- min_band_len = MMIN(wlens[1] - wlens[0], min_band_len);
- }
- }
- return min_band_len;
-}
-
/* Compute the number of fixed size bands used to discretized the spectral
* range */
static size_t
@@ -87,8 +56,6 @@ compute_spectral_bands_count(const struct htrdr_atmosphere* cmd)
double wlen_range[2];
double wlen_range_size;
size_t nbands;
- double band_len;
- double band_len_max;
ASSERT(cmd);
/* Compute size of the spectral range in nanometers */
@@ -99,18 +66,6 @@ compute_spectral_bands_count(const struct htrdr_atmosphere* cmd)
/* Define as many intervals as wavelengths count in the spectral range */
nbands = (size_t)rint(wlen_range_size);
- /* Compute the size in nanometers of an interval */
- band_len = wlen_range_size / (double)nbands;
-
- /* Compute the minimum band length of the sky spectral data and define it
- * as the maximum length that the bands can have */
- band_len_max = compute_sky_min_band_len(cmd->sky, wlen_range);
-
- /* Adjust the bands count to ensure that each sky spectral interval is
- * overlapped by at least one band */
- if(band_len > band_len_max) {
- nbands = (size_t)ceil(wlen_range_size / band_len_max);
- }
return nbands;
}
@@ -440,8 +395,8 @@ htrdr_atmosphere_create
cmd->wlen_range_m[0] = spectral_range[0]*1e-9; /* Convert in meters */
cmd->wlen_range_m[1] = spectral_range[1]*1e-9; /* Convert in meters */
- /* Compute the number of fixed sized bands used to descrised to the spectral
- * data */
+ /* Compute the number of fixed sized bands used to accelerate the sampling of
+ * spectral data */
nintervals = compute_spectral_bands_count(cmd);
if(cmd->spectral_type == HTRDR_SPECTRAL_SW_CIE_XYZ) {
diff --git a/src/atmosphere/htrdr_atmosphere_args.c b/src/atmosphere/htrdr_atmosphere_args.c
@@ -31,79 +31,18 @@
* Helper functions
******************************************************************************/
static void
-print_help(const char* cmd)
+usage(void)
{
- ASSERT(cmd);
- printf("Usage: %s [option] ... -a gas\n", cmd);
- printf(
-"Simulate radiative transfer in a plane-parallel atmosphere.\n"
-"See htrdr-atmosphere(1) man page for details\n\n");
-
- printf(
-" -a gas filename of the gas optical properties\n");
- printf(
-" -C camera configure a perspective camera\n");
- printf(
-" -c clouds filename of the clouds properties\n");
- printf(
-" -D azimuth,elevation\n"
-" direction in degrees toward the sun center. By default\n"
-" azimuth is %g and elevation is %g\n",
- HTRDR_ATMOSPHERE_ARGS_DEFAULT.sun_azimuth,
- HTRDR_ATMOSPHERE_ARGS_DEFAULT.sun_elevation);
- printf(
-" -d dump volumetric acceleration structures to output\n"
-" and exit\n");
- printf(
-" -f overwrite the output file if it already exists\n");
- printf(
-" -g ground filename of the ground geometry\n");
- printf(
-" -h display this help and exit\n");
- printf(
-" -i image image to compute\n");
- printf(
-" -M materials filename of the ground materials\n");
- printf(
-" -m mie filename of the Mie's data\n");
- printf(
-" -n sky-name name used to identify the sky in the materials file.\n"
-" Its default value is `%s'\n",
- HTRDR_ATMOSPHERE_ARGS_DEFAULT.sky_mtl_name);
- printf(
-" -O cache filenaname of the cache file used to store/restore the\n"
-" volumetric data. By default do not use any cache\n");
- printf(
-" -o output file where data are written. If not defined, data are\n"
-" written to standard output\n");
- printf(
-" -p rectangle switch in flux computation by defining the rectangular\n"
-" sensor onto which the flux is computed\n");
- printf(
-" -P camera configure an orthoraphic camera\n");
- printf(
-" -R infinitely repeat the ground along the X and Y axis\n");
- printf(
-" -r infinitely repeat the clouds along the X and Y axis\n");
- printf(
-" -s spectral define the spectral doamin of integration\n");
- printf(
-" -T optical_thickness\n"
-" optical thickness criteria for octree building.\n"
-" Default is %g\n",
- HTRDR_ATMOSPHERE_ARGS_DEFAULT.optical_thickness);
- printf(
-" -t threads hint on the number of threads to use.\n"
-" Default assumes as many threads as CPU cores\n");
- printf(
-" -V octree_definition\n"
-" advice on the definition of the atmospheric\n"
-" acceleration structures. By default use\n"
-" the definition of the clouds data\n");
- printf(
-" -v make the command verbose\n");
- printf("\n");
- htrdr_fprint_license(cmd, stdout);
+ printf("usage: htrdr-atmosphere [-dfhRrv] [-c clouds]\n");
+ printf(" [-C persp_camera_opt[:persp_camera_opt ...]]\n");
+ printf(" [-D sun_azimuth,sun_elevation] [-g ground]\n");
+ printf(" [-i image_opt[:image_opt ...]] [-M materials] [-m mie]\n");
+ printf(" [-n sky_mtl] [-O cache] [-o output]\n");
+ printf(" [-P ortho_camera_opt[:ortho_camera_opt ...]]\n");
+ printf(" [-p flux_sensor_opt[:flux_sensor_opt ...]]\n");
+ printf(" [-s spectral_opt[:spectral_opt ...]]\n");
+ printf(" [-T optical_thickness] [-t threads_count] [-V x,y,z]\n");
+ printf(" -a atmosphere\n");
}
static res_T
@@ -209,7 +148,7 @@ htrdr_atmosphere_args_init
case 'f': args->force_overwriting = 1; break;
case 'g': args->filename_obj = optarg; break;
case 'h':
- print_help(argv[0]);
+ usage();
htrdr_atmosphere_args_release(args);
args->quit = 1;
goto exit;
@@ -257,19 +196,19 @@ htrdr_atmosphere_args_init
}
if(!args->filename_gas) {
fprintf(stderr,
- "Missing the path of the gas optical properties file -- option '-a'\n");
+ "missing the path of the gas optical properties file -- option '-a'\n");
res = RES_BAD_ARG;
goto error;
}
if(args->filename_obj && !args->filename_mtl) {
fprintf(stderr,
- "Missing the path of the file listing the ground materials -- option '-M'\n");
+ "missing the path of the file listing the ground materials -- option '-M'\n");
res = RES_BAD_ARG;
goto error;
}
if(args->filename_les && !args->filename_mie) {
fprintf(stderr,
- "Missing the path toward the file of the Mie's data -- option '-m'\n");
+ "missing the path toward the file of the Mie's data -- option '-m'\n");
res = RES_BAD_ARG;
goto error;
}
@@ -293,6 +232,7 @@ htrdr_atmosphere_args_init
exit:
return res;
error:
+ usage();
htrdr_atmosphere_args_release(args);
goto exit;
}
diff --git a/src/atmosphere/htrdr_atmosphere_compute_radiance_sw.c b/src/atmosphere/htrdr_atmosphere_compute_radiance_sw.c
@@ -343,7 +343,7 @@ atmosphere_compute_radiance_sw
for(;;) {
struct scattering_context scattering_ctx = SCATTERING_CONTEXT_NULL;
struct ssf_bsdf* bsdf = NULL;
- struct ssf_phase* phase;
+ struct ssf_phase* phase = NULL;
double N[3];
double bounce_reflectivity = 1;
double sun_dir_pdf;
diff --git a/src/combustion/htrdr_combustion_args.c b/src/combustion/htrdr_combustion_args.c
@@ -34,86 +34,20 @@
* Helper functions
******************************************************************************/
static void
-print_help(const char* cmd)
+usage(void)
{
- ASSERT(cmd);
- printf(
-"Usage: %s [option] ... -m mesh -p props -r refids\n",
- cmd);
- printf(
-"Simulate radiative transfer within a sooting flame.\n"
-"See htrdr-combustion(1) man page for details\n\n");
-
- printf(
-" -C camera configure a perspective camera\n");
- printf(
-" -D flux_density\n"
-" flux density of the laser in W/m²\n"
-" (default: %g W/m²)\n",
- HTRDR_COMBUSTION_ARGS_DEFAULT.laser_flux_density);
- printf(
-" -d <laser|octree>\n"
-" output geometry of the laser sheet or the volumetric\n"
-" acceleration structure and exit\n");
- printf(
-" -F fractal-coefs\n"
-" value of the fractal dimension and fractal prefactor\n"
-" to use in the RDG-FA model\n");
- printf(
-" -f force overwrite the output file\n");
- printf(
-" -g geometry define the combustion chamber geometry\n");
- printf(
-" -h display this help and exit\n");
- printf(
-" -I use an isotropic phase function rather than the RDG-FA\n");
- printf(
-" -i image image to compute\n");
- printf(
-" -l laser configure the geometry of the laser sheet\n");
- printf(
-" -R rectangle switch in flux computation bu defining the\n"
-" rectangular sensor onto which the flux is computed\n");
- printf(
-" -m mesh path toward the volumetric mesh\n");
- printf(
-" -N precompute tetrahedron normals\n");
- printf(
-" -O cache path of the cache file used to store/restore the\n"
-" volumetric data\n");
- printf(
-" -o output file where data are written.\n"
-" (default: write data to standard output)\n");
- printf(
-" -p props path toward the thermodynamic properties\n");
- printf(
-" -P camera configure an orthoraphic camera\n");
- printf(
-" -r refids path toward the per wavelength refractive\n"
-" indices\n");
- printf(
-" -s use of the SIMD instruction set if available\n");
- printf(
-" -T threshold optical thickness used as threshold during the octree\n"
-" building (default: %g)\n",
- HTRDR_COMBUSTION_ARGS_DEFAULT.optical_thickness);
- printf(
-" -t threads hint on the number of threads to use.\n"
-" Default assumes as many threads as CPU cores\n");
- printf(
-" -V octree_definition\n"
-" definition of the volumetric acceleration grids along\n"
-" the 3 axis. By default it is computed automatically\n"
-" with a hint on the expected definition set to %u\n",
- HTRDR_COMBUSTION_ARGS_DEFAULT.grid.definition.hint);
- printf(
-" -v make the command verbose.\n");
- printf(
-" -w WAVELENGTH wavelength definition of the laser in nanometre.\n"
-" (default: %g)\n",
- HTRDR_COMBUSTION_ARGS_DEFAULT.wavelength);
- printf("\n");
- htrdr_fprint_license(cmd, stdout);
+ printf("usage: htrdr-combustion [-fhINsv] [-C persp_camera_opt[:persp_camera_opt ...]]\n");
+ printf(" [-D laser_flux_density] [-d dump_type]\n");
+ printf(" [-F rdgfa_opt[:rdgfa_opt ...]]\n");
+ printf(" [-g combustion_chamber_opt[:combustion_chamber_opt...]]\n");
+ printf(" [-i image_opt[:image_opt ...]]\n");
+ printf(" [-l laser_opt[:laser_opt ...]] [-O cache] [-o output]\n");
+ printf(" [-P ortho_camera_opt[:ortho_camera_opt ...]]\n");
+ printf(" [-R flux_sensor_opt[:flux_sensor_opt ...]]\n");
+ printf(" [-T optical_thickness] [-t threads_count]\n");
+ printf(" [-V accel_struct_definition] [-w laser_wavelength]\n");
+ printf(" -m medium_geometry -p thermo_properties\n");
+ printf(" -r refractive_ids\n");
}
static res_T
@@ -263,7 +197,7 @@ htrdr_combustion_args_init
res = htrdr_args_geometry_parse(&args->geom, optarg);
break;
case 'h':
- print_help(argv[0]);
+ usage();
htrdr_combustion_args_release(args);
args->quit = 1;
goto exit;
@@ -319,17 +253,17 @@ htrdr_combustion_args_init
}
if(!args->path_tetra) {
- fprintf(stderr, "Missing the volumetric mesh -- option '-m'\n");
+ fprintf(stderr, "missing the volumetric mesh -- option '-m'\n");
res = RES_BAD_ARG;
goto error;
}
if(!args->path_therm_props) {
- fprintf(stderr, "Missing the thermodynamic properties -- option '-p'\n");
+ fprintf(stderr, "missing the thermodynamic properties -- option '-p'\n");
res = RES_BAD_ARG;
goto error;
}
if(!args->path_refract_ids) {
- fprintf(stderr, "Missing the refractive indices -- option '-r'\n");
+ fprintf(stderr, "missing the refractive indices -- option '-r'\n");
res = RES_BAD_ARG;
goto error;
}
@@ -337,6 +271,7 @@ htrdr_combustion_args_init
exit:
return res;
error:
+ usage();
htrdr_combustion_args_release(args);
goto exit;
}
diff --git a/src/commands/htrdr_cmd.c b/src/commands/htrdr_cmd.c
@@ -41,39 +41,9 @@
* Helper functions
******************************************************************************/
static void
-print_usage(const char* cmd)
+usage(void)
{
- ASSERT(cmd);
- printf("Usage: %s [-v] [-h] <mode> [option] ...\n", cmd);
-}
-
-static void
-print_help(const char* cmd)
-{
- ASSERT(cmd);
-
- print_usage(cmd);
- printf("Simulate radiative transfer.\n");
- printf("See htrdr(1) man page for details\n");
- printf("\n");
-
- printf(
-" -h display this help and exit\n");
- printf(
-" -v display version information and exit\n");
- printf("\n");
-
- printf("These are %s modes:\n", cmd);
- printf("\n");
- printf(
-" atmosphere Radiative transfer in a plane-parallel atmosphere\n");
- printf(
-" combustion Radiative transfer within a sooting flame\n");
- printf(
-" planeto Radiative transfer in a 3D planetory atmosphere\n");
- printf("\n");
-
- htrdr_fprint_license(cmd, stdout);
+ printf("usage: htrdr [-vh] [mode [options ...]]\n");
}
/*******************************************************************************
@@ -82,11 +52,10 @@ print_help(const char* cmd)
int
main(int argc, char** argv)
{
- char cmd_name[] = "htrdr";
int err = 0;
if(argc < 2) {
- print_usage(argv[0]);
+ usage();
err = -1;
goto error;
}
@@ -138,13 +107,13 @@ main(int argc, char** argv)
/* Help */
} else if(!strcmp(argv[1], "-h")) {
- print_help(cmd_name);
+ usage();
goto exit;
/* Fallback */
} else {
fprintf(stderr, "Unknown option: %s\n", argv[1]);
- print_usage(cmd_name);
+ usage();
err = -1;
goto error;
}
diff --git a/src/core/htrdr.h b/src/core/htrdr.h
@@ -27,15 +27,6 @@
#include <rsys/rsys.h>
#include <stdio.h>
-/* Library symbol management */
-#if defined(HTRDR_CORE_SHARED_BUILD) /* Build shared library */
- #define HTRDR_CORE_API extern EXPORT_SYM
-#elif defined(HTRDR_CORE_STATIC) /* Use/build static library */
- #define HTRDR_CORE_API extern LOCAL_SYM
-#else /* Use shared library */
- #define HTRDR_CORE_API extern IMPORT_SYM
-#endif
-
#if defined(HTRDR_SHARED_BUILD) /* Build shared library */
#define HTRDR_API extern EXPORT_SYM
#elif defined(HTRDR_STATIC) /* Use/build static library */
@@ -97,69 +88,69 @@ BEGIN_DECLS
/* Initialize the MPI execution environment. Must be called priorly to any MPI
* invocation, e.g. at the beginning of the main function */
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_mpi_init
(int argc,
char** argv);
/* Terminate the MPI execution environment */
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_mpi_finalize
(void);
/*******************************************************************************
* HTRDR api
******************************************************************************/
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_create
(struct mem_allocator* allocator,
const struct htrdr_args* args,
struct htrdr** htrdr);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_ref_get
(struct htrdr* htrdr);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_ref_put
(struct htrdr* htrdr);
/* Return the number of threads used by the process */
-HTRDR_CORE_API size_t
+HTRDR_API size_t
htrdr_get_threads_count
(const struct htrdr* htrdr);
/* Return the number of running processes for the current htrdr instance */
-HTRDR_CORE_API size_t
+HTRDR_API size_t
htrdr_get_procs_count
(const struct htrdr* htrdr);
-HTRDR_CORE_API int
+HTRDR_API int
htrdr_get_mpi_rank
(const struct htrdr* htrdr);
-HTRDR_CORE_API struct mem_allocator*
+HTRDR_API struct mem_allocator*
htrdr_get_allocator
(struct htrdr* htrdr);
-HTRDR_CORE_API struct mem_allocator*
+HTRDR_API struct mem_allocator*
htrdr_get_thread_allocator
(struct htrdr* htrdr,
const size_t ithread);
-HTRDR_CORE_API struct logger*
+HTRDR_API struct logger*
htrdr_get_logger
(struct htrdr* htrdr);
-HTRDR_CORE_API int
+HTRDR_API int
htrdr_get_verbosity_level
(const struct htrdr* htrdr);
-HTRDR_CORE_API struct s3d_device*
+HTRDR_API struct s3d_device*
htrdr_get_s3d
(struct htrdr* htrdr);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_open_output_stream
(struct htrdr* htrdr,
const char* filename,
diff --git a/src/core/htrdr_args.h.in b/src/core/htrdr_args.h.in
@@ -131,44 +131,44 @@ static const struct htrdr_args_spectral HTRDR_ARGS_SPECTRAL_DEFAULT =
******************************************************************************/
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_args_camera_perspective_parse
(struct htrdr_args_camera_perspective* cam,
const char* str);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_args_camera_perspective_check
(const struct htrdr_args_camera_perspective* cam);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_args_camera_orthographic_parse
(struct htrdr_args_camera_orthographic* cam,
const char* str);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_args_rectangle_parse
(struct htrdr_args_rectangle* rect,
const char* str);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_args_image_parse
(struct htrdr_args_image* img,
const char* str);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_args_image_check
(const struct htrdr_args_image* img);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_args_spectral_parse
(struct htrdr_args_spectral* spectral,
const char* str);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_args_geometry_free
(struct htrdr_args_geometry* geom);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_args_geometry_parse
(struct htrdr_args_geometry* geom,
const char* str);
diff --git a/src/core/htrdr_buffer.h b/src/core/htrdr_buffer.h
@@ -82,30 +82,30 @@ struct htrdr_buffer;
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_buffer_create
(struct htrdr* htrdr,
const struct htrdr_buffer_layout* layout,
struct htrdr_buffer** buf);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_buffer_ref_get
(struct htrdr_buffer* buf);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_buffer_ref_put
(struct htrdr_buffer* buf);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_buffer_get_layout
(const struct htrdr_buffer* buf,
struct htrdr_buffer_layout* layout);
-HTRDR_CORE_API void*
+HTRDR_API void*
htrdr_buffer_get_data
(struct htrdr_buffer* buf);
-HTRDR_CORE_API void*
+HTRDR_API void*
htrdr_buffer_at
(struct htrdr_buffer* buf,
const size_t x,
diff --git a/src/core/htrdr_draw_map.h b/src/core/htrdr_draw_map.h
@@ -86,7 +86,7 @@ htrdr_draw_pixel_args_check(const struct htrdr_draw_pixel_args* args)
******************************************************************************/
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_draw_map
(struct htrdr* htrdr,
const struct htrdr_draw_map_args* args,
diff --git a/src/core/htrdr_geometry.h b/src/core/htrdr_geometry.h
@@ -58,47 +58,47 @@ HTRDR_GEOMETRY_TRACE_RAY_ARGS_NULL = HTRDR_GEOMETRY_TRACE_RAY_ARGS_NULL__;
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_geometry_create
(struct htrdr* htrdr,
const char* obj_filename,
struct htrdr_materials* mats, /* Library of materials */
struct htrdr_geometry** geometry);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_geometry_ref_get
(struct htrdr_geometry* geom);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_geometry_ref_put
(struct htrdr_geometry* geom);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_geometry_get_interface
(struct htrdr_geometry* geom,
const struct s3d_hit* hit,
struct htrdr_interface* interface);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_geometry_get_hit_position
(const struct htrdr_geometry* geom,
const struct s3d_hit* hit,
double position[3]);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_geometry_trace_ray
(struct htrdr_geometry* geom,
const struct htrdr_geometry_trace_ray_args* args,
struct s3d_hit* hit);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_geometry_find_closest_point
(struct htrdr_geometry* geom,
const double position[3],
const double radius,
struct s3d_hit* hit);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_geometry_get_aabb
(const struct htrdr_geometry* geom,
double lower[3],
@@ -106,7 +106,7 @@ htrdr_geometry_get_aabb
/* Empirical value relative to the extent of the geometry that represents the
* threshold below which a numerical problem could occur. */
-HTRDR_CORE_API double
+HTRDR_API double
htrdr_geometry_get_epsilon
(const struct htrdr_geometry* geom);
diff --git a/src/core/htrdr_log.h b/src/core/htrdr_log.h
@@ -35,7 +35,7 @@ struct htrdr;
BEGIN_DECLS
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_log
(struct htrdr* htrdr,
const char* msg,
@@ -45,7 +45,7 @@ htrdr_log
#endif
;
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_log_err
(struct htrdr* htrdr,
const char* msg,
@@ -55,7 +55,7 @@ htrdr_log_err
#endif
;
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_log_warn
(struct htrdr* htrdr,
const char* msg,
diff --git a/src/core/htrdr_materials.c b/src/core/htrdr_materials.c
@@ -27,7 +27,7 @@
#include "core/htrdr_log.h"
#include "core/htrdr_materials.h"
-#include <modradurb/mrumtl.h>
+#include <mrumtl.h>
#include <star/ssf.h>
#include <star/ssp.h>
diff --git a/src/core/htrdr_materials.h b/src/core/htrdr_materials.h
@@ -44,28 +44,28 @@ static const struct htrdr_mtl HTRDR_MTL_NULL = HTRDR_MTL_NULL__;
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_materials_create
(struct htrdr* htrdr,
const char* filename,
struct htrdr_materials** mats);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_materials_ref_get
(struct htrdr_materials* mats);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_materials_ref_put
(struct htrdr_materials* mats);
/* Return 1 if the material exist and 0 otherwise */
-HTRDR_CORE_API int
+HTRDR_API int
htrdr_materials_find_mtl
(struct htrdr_materials* mats,
const char* mtl_name,
struct htrdr_mtl* mtl);
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_mtl_create_bsdf
(struct htrdr* htrdr,
const struct htrdr_mtl* mtl,
diff --git a/src/core/htrdr_ran_wlen_cie_xyz.h b/src/core/htrdr_ran_wlen_cie_xyz.h
@@ -38,37 +38,37 @@ struct htrdr_ran_wlen_cie_xyz;
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_ran_wlen_cie_xyz_create
(struct htrdr* htrdr,
const double range[2], /* Must be included in [380, 780] nanometers */
const size_t nbands, /* # bands used to discretize the CIE tristimulus */
struct htrdr_ran_wlen_cie_xyz** cie);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_ran_wlen_cie_xyz_ref_get
(struct htrdr_ran_wlen_cie_xyz* cie);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_ran_wlen_cie_xyz_ref_put
(struct htrdr_ran_wlen_cie_xyz* cie);
/* Return a wavelength in nanometer */
-HTRDR_CORE_API double
+HTRDR_API double
htrdr_ran_wlen_cie_xyz_sample_X
(struct htrdr_ran_wlen_cie_xyz* cie,
const double r0, const double r1, /* Canonical numbers in [0, 1[ */
double* pdf); /* In nm^-1. May be NULL */
/* Return a wavelength in nanometer */
-HTRDR_CORE_API double
+HTRDR_API double
htrdr_ran_wlen_cie_xyz_sample_Y
(struct htrdr_ran_wlen_cie_xyz* cie,
const double r0, const double r1, /* Canonical number in [0, 1[ */
double* pdf); /* In nm^-1. May be NULL */
/* Return a wavelength in nanometer */
-HTRDR_CORE_API double
+HTRDR_API double
htrdr_ran_wlen_cie_xyz_sample_Z
(struct htrdr_ran_wlen_cie_xyz* cie,
const double r0, const double r1, /* Canonical number in [0, 1[ */
diff --git a/src/core/htrdr_ran_wlen_discrete.h b/src/core/htrdr_ran_wlen_discrete.h
@@ -47,21 +47,21 @@ struct htrdr_ran_wlen_discrete;
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_ran_wlen_discrete_create
(struct htrdr* htrdr,
const struct htrdr_ran_wlen_discrete_create_args* args,
struct htrdr_ran_wlen_discrete** ran);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_ran_wlen_discrete_ref_get
(struct htrdr_ran_wlen_discrete* ran);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_ran_wlen_discrete_ref_put
(struct htrdr_ran_wlen_discrete* ran);
-HTRDR_CORE_API double /* wavelength in nanometer */
+HTRDR_API double /* wavelength in nanometer */
htrdr_ran_wlen_discrete_sample
(struct htrdr_ran_wlen_discrete* ran,
const double r0, const double r1, /* Canonical number in [0, 1[ */
diff --git a/src/core/htrdr_ran_wlen_planck.c b/src/core/htrdr_ran_wlen_planck.c
@@ -335,7 +335,10 @@ exit:
*out_wlen_planck_ran = planck;
return res;
error:
- if(planck) htrdr_ran_wlen_planck_ref_put(planck);
+ if(planck) {
+ htrdr_ran_wlen_planck_ref_put(planck);
+ planck = NULL;
+ }
goto exit;
}
diff --git a/src/core/htrdr_ran_wlen_planck.h b/src/core/htrdr_ran_wlen_planck.h
@@ -35,7 +35,7 @@ struct htrdr_ran_wlen_planck;
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_ran_wlen_planck_create
(struct htrdr* htrdr,
const double range[2],
@@ -45,16 +45,16 @@ htrdr_ran_wlen_planck_create
const double ref_temperature, /* Reference temperature */
struct htrdr_ran_wlen_planck** planck);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_ran_wlen_planck_ref_get
(struct htrdr_ran_wlen_planck* planck);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_ran_wlen_planck_ref_put
(struct htrdr_ran_wlen_planck* planck);
/* Return a wavelength in nanometer */
-HTRDR_CORE_API double
+HTRDR_API double
htrdr_ran_wlen_planck_sample
(const struct htrdr_ran_wlen_planck* planck,
const double r0, /* Canonical number in [0, 1[ */
diff --git a/src/core/htrdr_rectangle.h b/src/core/htrdr_rectangle.h
@@ -33,7 +33,7 @@ struct htrdr_rectangle; /* 2D rectangle transformed in 3D */
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_rectangle_create
(struct htrdr* htrdr,
const double sz[2], /* Size of the rectangle along its local X and Y axis */
@@ -42,41 +42,41 @@ htrdr_rectangle_create
const double up[3], /* vector orthogonal to the rectangle X axis */
struct htrdr_rectangle** rect);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_rectangle_ref_get
(struct htrdr_rectangle* rect);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_rectangle_ref_put
(struct htrdr_rectangle* rect);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_rectangle_sample_pos
(const struct htrdr_rectangle* rect,
const double sample[2], /* In [0, 1[ */
double pos[3]);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_rectangle_get_normal
(const struct htrdr_rectangle* rect,
double normal[3]);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_rectangle_get_center
(const struct htrdr_rectangle* rect,
double center[3]);
-HTRDR_CORE_API double*
+HTRDR_API double*
htrdr_rectangle_get_transform
(const struct htrdr_rectangle* rect,
double transform[12]);
-HTRDR_CORE_API double*
+HTRDR_API double*
htrdr_rectangle_get_transform_inverse
(const struct htrdr_rectangle* rect,
double transform_inverse[12]);
-HTRDR_CORE_API void
+HTRDR_API void
htrdr_rectangle_get_size
(const struct htrdr_rectangle* rect,
double size[2]);
diff --git a/src/core/htrdr_slab.h b/src/core/htrdr_slab.h
@@ -41,7 +41,7 @@ typedef res_T
BEGIN_DECLS
/* Trace a ray into a slab composed of a cell infinitely repeated in X and Y */
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_slab_trace_ray
(struct htrdr* htrdr,
const double org[3],
diff --git a/src/core/htrdr_spectral.h b/src/core/htrdr_spectral.h
@@ -149,7 +149,7 @@ htrdr_planck
BEGIN_DECLS
-HTRDR_CORE_API res_T
+HTRDR_API res_T
htrdr_brightness_temperature
(struct htrdr* htrdr,
const double lambda_min, /* In meters */
@@ -158,7 +158,7 @@ htrdr_brightness_temperature
const double radiance,
double* temperature);
-HTRDR_CORE_API double
+HTRDR_API double
htrdr_radiance_temperature
(struct htrdr* htrdr,
const double lambda_min, /* In meters */
diff --git a/src/planeto/htrdr_planeto.c b/src/planeto/htrdr_planeto.c
@@ -51,52 +51,12 @@
/*******************************************************************************
* Helper function
******************************************************************************/
-/* Calculate the minimum length of the atmospheric spectral bands for the
- * spectral domain considered */
-static double
-compute_min_band_len(const struct htrdr_planeto* cmd)
-{
- const double* range = NULL; /* In nm */
- double len = DBL_MAX;
- size_t ibands[2];
- size_t i;
- ASSERT(cmd);
-
- range = cmd->spectral_domain.wlen_range;
-
- /* The spectral range is degenerate to a wavelength */
- if(eq_eps(range[0], range[1], 1.e-6)) {
- return 0;
- }
-
- RNATM(find_bands(cmd->atmosphere, cmd->spectral_domain.wlen_range, ibands));
-
- /* At least one band must be overlaped by the spectral domain */
- ASSERT(ibands[0]<=ibands[1]);
- FOR_EACH(i, ibands[0], ibands[1]+1) {
- struct rnatm_band_desc band;
- double band_range[2];
- RNATM(band_get_desc(cmd->atmosphere, i, &band));
-
- /* Make the upper bound inclusive */
- band_range[0] = band.lower;
- band_range[1] = nextafter(band.upper, 0);
-
- /* Clamp the band range to the spectral domain */
- band_range[0] = MMAX(band_range[0], range[0]);
- band_range[1] = MMIN(band_range[1], range[1]);
- len = MMIN(band_range[1] - band_range[0], len);
- }
- return len;
-}
-
/* Calculate the number of fixed size spectral intervals to use for the
* cumulative */
static size_t
compute_nintervals_for_spectral_cdf(const struct htrdr_planeto* cmd)
{
double range_size;
- double interval_len;
size_t nintervals;
ASSERT(cmd);
@@ -107,14 +67,6 @@ compute_nintervals_for_spectral_cdf(const struct htrdr_planeto* cmd)
/* Initially assume ~one interval per nanometer */
nintervals = (size_t)rint(range_size);
- /* Calculate the minimum length of the atmospheric spectral bands fixed to
- * the spectral integration domain. We ensure that an interval of the
- * spectral cdf cannot be greater than this length */
- interval_len = compute_min_band_len(cmd);
- if(interval_len < (range_size / (double)nintervals)) {
- nintervals = (size_t)ceil(range_size / interval_len);
- }
-
return nintervals;
}
diff --git a/src/planeto/htrdr_planeto_args.c b/src/planeto/htrdr_planeto_args.c
@@ -103,64 +103,16 @@ check_spectral_args(const struct htrdr_planeto_spectral_args* args)
return RES_OK;
}
static void
-print_help(const char* cmd)
+usage(void)
{
- ASSERT(cmd);
- printf(
-"Usage: %s [-dfhv] [-s spectral_domain] [-t threads]\n"
-" [-T optical_thickness] [-V octree_definition]\n"
-" [-O octrees_storage] [-o output] [-C camera]\n"
-" [-S source] [-a aerosol]... -G ground -g gas\n", cmd);
- printf(
-"Simulate radiative transfer in heterogeneous 3D planetary atmosphere.\n"
-"See htrdr-planeto(1) man page for details\n\n");
- printf(
-" -a aerosol define an aerosol\n");
- printf(
-" -C camera configure a perspective camera\n");
- printf(
-" -d write the atmospheric acceleration structures\n");
- printf(
-" -f force overwrite the output file\n");
- printf(
-" -G ground define the ground of the planet\n");
- printf(
-" -g gas define the gas mixture\n");
- printf(
-" -h display this help and exit\n");
- printf(
-" -i image image to compute\n");
- printf(
-" -N precompute tetrahedron normals\n");
- printf(
-" -O octrees_storage\n"
-" file where atmospheric acceleration structures are\n"
-" stored/loaded\n");
- printf(
-" -o output file where the result is written. If not defined,\n"
-" the result is written to standard output\n");
- printf(
-" -S source define the source\n");
- printf(
-" -s spectral_domain\n"
-" define the spectral domain of integration\n");
- printf(
-" -T optical_thickness\n"
-" optical thickness criteria for octree building.\n"
-" Default is %g\n",
- HTRDR_PLANETO_ARGS_DEFAULT.optical_thickness);
- printf(
-" -t threads hint on the number of threads to use.\n"
-" Default assumes as many threads as CPU cores\n");
- printf(
-" -V octree_definition\n"
-" advice on the definition of the atmospheric\n"
-" acceleration structures. Default is %u\n",
- HTRDR_PLANETO_ARGS_DEFAULT.octree_definition_hint);
- printf(
-" -v make the command verbose\n");
- printf("\n");
- htrdr_fprint_license(cmd, stdout);
+ printf("usage: htrdr-planeto [-dfhNv] [-a aerosol_opt[:aerosol_opt ...]]\n");
+ printf(" [-C persp_camera_opt[:persp_camera_opt ...]]\n");
+ printf(" [-G ground_opt[:ground_opt ...]]\n");
+ printf(" [-i image_opt[:image_opt ...]] [-O accel_struct_storage]\n");
+ printf(" [-o output] [-S source_opt[:source_opt ...]]\n");
+ printf(" [-s spectral_opt[:spectral_opt ...]] [-T optical_thickness]\n");
+ printf(" [-t threads_count] [-V accel_struct_definition]\n");
+ printf(" -g gas_opt[:gas_opt ...] \n");
}
static INLINE char*
@@ -600,7 +552,7 @@ htrdr_planeto_args_init(struct htrdr_planeto_args* args, int argc, char** argv)
}
break;
case 'h':
- print_help(argv[0]);
+ usage();
htrdr_planeto_args_release(args);
args->quit = 1;
goto exit;
@@ -642,20 +594,14 @@ htrdr_planeto_args_init(struct htrdr_planeto_args* args, int argc, char** argv)
res = check_gas_args(&args->gas);
if(res != RES_OK) {
- fprintf(stderr, "Missing gas definition -- option '-g'\n");
- goto error;
- }
-
- res = check_ground_args(&args->ground);
- if(res != RES_OK) {
- fprintf(stderr, "Missing ground definition -- option '-G'\n");
+ fprintf(stderr, "missing gas definition -- option '-g'\n");
goto error;
}
if(args->output_type != HTRDR_PLANETO_ARGS_OUTPUT_OCTREES) {
res = check_ground_args(&args->ground);
if(res != RES_OK) {
- fprintf(stderr, "Missing ground definition -- option '-G'\n");
+ fprintf(stderr, "missing ground definition -- option '-G'\n");
goto error;
}
@@ -664,7 +610,7 @@ htrdr_planeto_args_init(struct htrdr_planeto_args* args, int argc, char** argv)
|| args->spectral_domain.type == HTRDR_SPECTRAL_SW_CIE_XYZ) {
res = htrdr_planeto_source_args_check(&args->source);
if(res != RES_OK) {
- fprintf(stderr, "Missing source definition -- option '-S'\n");
+ fprintf(stderr, "missing source definition -- option '-S'\n");
goto error;
}
}
@@ -673,6 +619,7 @@ htrdr_planeto_args_init(struct htrdr_planeto_args* args, int argc, char** argv)
exit:
return res;
error:
+ usage();
htrdr_planeto_args_release(args);
goto exit;
}