schiff

Estimate the radiative properties of soft particless
git clone git://git.meso-star.com/schiff.git
Log | Files | Refs | README | LICENSE

commit f3158b627ec22170aec3bce5b430aa84167f5a51
parent 2650825f11c077a63444d17a4abe30db35d3b167
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 24 Sep 2019 14:48:58 +0200

Update the short help and the man pages.

Diffstat:
Mcmake/CMakeLists.txt | 21++++++++++++++++-----
Ddoc/schiff.1 | 157-------------------------------------------------------------------------------
Adoc/schiff.1.in | 160+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/schiff.c | 2+-
Msrc/schiff_args.c | 55++++++++++++++++++++++++++++---------------------------
Dsrc/schiff_args.h | 73-------------------------------------------------------------------------
Asrc/schiff_args.h.in | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 280 insertions(+), 263 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -53,8 +53,17 @@ set(VERSION_MINOR 4) set(VERSION_PATCH 0) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) +set(SCHIFF_ARGS_DEFAULT_NINSAMPLES "100") +set(SCHIFF_ARGS_DEFAULT_NREALISATIONS "10000") +set(SCHIFF_ARGS_DEFAULT_NANGLES "1000") +set(SCHIFF_ARGS_DEFAULT_NANGLES_INV "2000") + configure_file(${SCHIFF_SOURCE_DIR}/schiff_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/schiff_version.h @ONLY) +configure_file(${SCHIFF_SOURCE_DIR}/schiff_args.h.in + ${CMAKE_CURRENT_BINARY_DIR}/schiff_args.h @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/../doc/schiff.1.in + ${CMAKE_CURRENT_BINARY_DIR}/schiff.1 @ONLY) set(SCHIFF_FILES_SRC schiff.c @@ -69,16 +78,18 @@ set(SCHIFF_FILES_INC schiff_optical_properties.h schiff_streamline.h) set(SCHIFF_FILES_DOC COPYING README.md) -set(SCHIFF_FILES_MAN1 schiff.1) -set(SCHIFF_FILES_MAN5 schiff-geometry.5 schiff-output.5) -# Prepend each file in the `SCHIFF_FILES_<SRC|INC>' list by the absolute +# Prepend each file in the `SCHIFF_FILES_<SRC|INC|DOC>' list by the absolute # path of the directory in which they lie rcmake_prepend_path(SCHIFF_FILES_SRC ${SCHIFF_SOURCE_DIR}) rcmake_prepend_path(SCHIFF_FILES_INC ${SCHIFF_SOURCE_DIR}) rcmake_prepend_path(SCHIFF_FILES_DOC ${PROJECT_SOURCE_DIR}/../) -rcmake_prepend_path(SCHIFF_FILES_MAN1 ${PROJECT_SOURCE_DIR}/../doc/) -rcmake_prepend_path(SCHIFF_FILES_MAN5 ${PROJECT_SOURCE_DIR}/../doc/) + +set(SCHIFF_FILES_MAN1 + ${CMAKE_CURRENT_BINARY_DIR}/schiff.1) +set(SCHIFF_FILES_MAN5 + ${PROJECT_SOURCE_DIR}/../doc/schiff-geometry.5 + ${PROJECT_SOURCE_DIR}/../doc/schiff-output.5) if(CMAKE_COMPILER_IS_GNUCC) set(MATH_LIB m) diff --git a/doc/schiff.1 b/doc/schiff.1 @@ -1,157 +0,0 @@ -.\" Copying and distribution of this file, with or without modification, -.\" are permitted in any medium without royalty provided the copyright -.\" notice and this notice are preserved. This file is offered as-is, -.\" without any warranty. -.TH SCHIFF 1 -.SH NAME -schiff \- estimate radiative properties of soft particles -.SH SYNOPSIS -.nf -\fBschiff \fR[\fIOPTIONS\fR]... [\fIFILE\fR] -.fi -.SH DESCRIPTION -\fBschiff\fR computes the radiative properties of soft particles with an -"Approximation Method for Short Wavelength or High Energy Scattering" [1]. The -implemented model is detailed in [2]. It relies on the Monte\-Carlo method to -solve Maxwell's equations within Schiff's approximation; it estimates total -cross sections (extinction, absorption and scattering cross-sections) in -addition of the inverse cumulative phase function. -.PP -The shapes of the soft particles are controlled by the -.BR schiff-geometry (5) -file submitted by the \fB\-i\fR option. The per wavelength optical properties -of the soft particles are stored in \fIFILE\fR where each line is formatted as -"W N K Ne" whith "W" is the wavelength in vacuum expressed in micron, "N" and -"K" are the real and imaginary parts, respectively, of the refractive index, -and "Ne" the refractive index of the medium. With no \fIFILE\fR, the optical -properties are read from standard input. -.PP -The estimated results follows the -.BR schiff-output (5) -format and are written to the \fIOUTPUT\fR file or to standard ouptut whether -the \fB\-o \fIOUTPUT\fR option is defined or not, respectively. -.SH OPTIONS -.TP -.B \-a \fINUM_ANGLES\fR -number of phase function scattering angles to estimate. These angles are -uniformaly distributed in [0, PI], i.e. the value of the i^th angle, i in -[0, \fINUM_ANGLES\fR-1], is i*PI/(\fINUM_ANGLES\fR-1). Default is 1000. -.TP -.B \-A \fINUM_ANGLES\fR -number of scattering angles computed from the inverse cumulative phase -function. The value of the i^th angle, i in [0, \fINUM_ANGLES\fR-1], is -CDF^-1(i/(\fINUM_ANGLES-1\fR). Default is 2000. -.TP -.B \-d \fINUM_DIRS\fR -number of sampled directions for each sampled geometry. Default is 100. -Calculation of optimal value is presented in [3]. -.TP -.B \-D -discard computations of the [[inverse] cumulative] phase functions for large -scattering angles. See the \fB\-l\fR option for the definition of large scattering -angles. -.TP -.B \-g \fINUM_PARTICLES\fR -number of sampled soft particle instances. This is actually the number of -realisations. Default is 10000. -.TP -.B \-G \fICOUNT\fR -sample \fICOUNT\fR soft particles with respect to the defined distribution, -dump their geometric data and exit. The data are written to \fIOUTPUT\fR or the -standard output whether the \fB-o\fR \fIOUTPUT\fR option is defined or not, -respectively. The outputted data followed the Alias Wavefront obj file format. -.TP -.B \-h -display short help and exit. -.TP -.B \-i \fIDISTRIBUTION\fR -define the -.BR schiff-geometry (5) -file that controls the geometry distribution of the soft particles. -.TP -.B \-l \fILENGTH\fR -characteristic length in micron of the soft particles. Used for the definition -of the angle that sets the limit between small and large scattering angles (see -equation. 7 in [2]). -.TP -.B \-n \fINUM_THREADS\fR -hint on the number of threads to use during the integration. By default use as -many threads as CPU cores. -.TP -.B \-o \fIOUTPUT\fR -write results to \fIOUTPUT\fR with respect to the -.BR schiff-output (5) -format. If not defined, write results to standard output. -.TP -.B \-q -do not print the helper message when no \fIFILE\fR is submitted. -.TP -.B \-w \fIW0\fR[\fB:\fIW1\fR]... -list of wavelengths in vacuum (expressed in micron) to integrate. -.TP -.B \-\-version -display version information and exit. -.SH EXAMPLES -Estimate the radiative properties of soft particles whose shape is described in -the \fBgeometry.yaml\fR file and its optical properties in the \fBproperties\fR -file. The characteristic length of the soft particle shapes is \fB2.3\fR -microns and the estimations is performed for the wavelengths \fB0.45\fR and -\fB0.6\fR microns. The results are written to the standard output: -.PP -.RS 4 -.nf -$ schiff -i geometry.yaml -l 2.3 -w 0.45:0.6 properties -.fi -.RE -.PP -The soft particles have a characteristic length of \fB1\fR and their shape is -controlled by the \fBmy_geom.yaml\fR file. Their optical properties are read -from the standard input. The estimated wavelelength is \fB0.66\fR microns and -the results are written to the \fBmy_result\fR file: -.PP -.RS 4 -.nf -$ schiff -w 0.66 -l 1.0 -i my_geom.yaml -o my_result -.fi -.RE -.PP -Sample \fB10\fR soft particles whose shape is defined by the \fBgeometry.yaml\fR -file and write their triangulated geometric data to the \fBtemp_output\fR file. -Use the -.BR csplit (1) -Unix command to split the \fBtemp_output\fR file in 10 files named -particle<\fINUM\fR>.obj, with NUM in [0, 9], each storing the geometric data of -a sampled soft particle: -.PP -.RS 4 -.nf -$ schiff -i geometry.yaml -G 10 -o temp_output -$ csplit temp_output -z /^g\\ / {*} -f particle -b %d.obj -.fi -.RE -.PP -.SH NOTES -.PP -[1] L. I. Schiff, 1956. Approximation Method for Short Wavelength or High\-Energy -Scattering. Phys. Rev. 104 \- 1481\-1485. -.PP -[2] J. Charon, S. Blanco, J. F. Cornet, J. Dauchet, M. El Hafi, R. Fournier, M. -Kaissar Abboud, S. Weitz, 2015. Monte Carlo Implementation of Schiff's -Approximation for Estimating Radiative Properties of Homogeneous, -Simple\-Shaped and Optically Soft Particles: Application to Photosynthetic -Micro-Organisms. Journal of Quantitative Spectroscopy and Radiative Transfer -172 \- 3\-23. -.PP -[3] S. Weitz, S. Blanco, J. Charon, J. Dauchet, M. El Hafi, V. Eymet, O. -Farges, R. Fournier, and J. Gautrais, 2016. Monte Carlo efficiency -improvement by multiple sampling of conditioned integration variables. Journal -of Computational Physics 326 \- 30\-34. -.SH COPYRIGHT -Copyright \(co 2015, 2016 CNRS. Copyright \(co 2019 |Meso|Star>. License -GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is -free software: you are free to change and redistribute it. There is NO -WARRANTY, to the extent permitted by law. -.SH SEE ALSO -.BR csplit (1), -.BR schiff-geometry (5), -.BR schiff-output (5) diff --git a/doc/schiff.1.in b/doc/schiff.1.in @@ -0,0 +1,160 @@ +.\" Copying and distribution of this file, with or without modification, +.\" are permitted in any medium without royalty provided the copyright +.\" notice and this notice are preserved. This file is offered as-is, +.\" without any warranty. +.TH SCHIFF 1 +.SH NAME +schiff \- estimate radiative properties of soft particles +.SH SYNOPSIS +.nf +\fBschiff \fR[\fIOPTIONS\fR]... [\fIFILE\fR] +.fi +.SH DESCRIPTION +\fBschiff\fR computes the radiative properties of soft particles with an +"Approximation Method for Short Wavelength or High Energy Scattering" [1]. The +implemented model is detailed in [2]. It relies on the Monte\-Carlo method to +solve Maxwell's equations within Schiff's approximation; it estimates total +cross sections (extinction, absorption and scattering cross-sections) in +addition of the inverse cumulative phase function. +.PP +The shapes of the soft particles are controlled by the +.BR schiff-geometry (5) +file submitted by the \fB\-i\fR option. The per wavelength optical properties +of the soft particles are stored in \fIFILE\fR where each line is formatted as +"W N K Ne" whith "W" is the wavelength in vacuum expressed in micron, "N" and +"K" are the real and imaginary parts, respectively, of the refractive index, +and "Ne" the refractive index of the medium. With no \fIFILE\fR, the optical +properties are read from standard input. +.PP +The estimated results follows the +.BR schiff-output (5) +format and are written to the \fIOUTPUT\fR file or to standard ouptut whether +the \fB\-o \fIOUTPUT\fR option is defined or not, respectively. +.SH OPTIONS +.TP +.B \-a \fINUM_ANGLES\fR +number of phase function scattering angles to estimate. These angles are +uniformaly distributed in [0, PI], i.e. the value of the i^th angle, i in [0, +\fINUM_ANGLES\fR-1], is i*PI/(\fINUM_ANGLES\fR-1). Default is +@SCHIFF_ARGS_DEFAULT_NANGLES@. +.TP +.B \-A \fINUM_ANGLES\fR +number of scattering angles computed from the inverse cumulative phase +function. The value of the i^th angle, i in [0, \fINUM_ANGLES\fR-1], is +CDF^-1(i/(\fINUM_ANGLES-1\fR). Default is @SCHIFF_ARGS_DEFAULT_NANGLES_INV@. +.TP +.B \-d \fINUM_INNER_SAMPLES\fR +number of conditioned integration variable sampling (incident direction, +volume, ray(s)) for each sampled particle-shape. Default is +@SCHIFF_ARGS_DEFAULT_NINSAMPLES@. Calculation of optimal value is presented in +[3]. +.TP +.B \-D +discard computations of the [[inverse] cumulative] phase functions for large +scattering angles. See the \fB\-l\fR option for the definition of large +scattering angles. +.TP +.B \-g \fINUM_PARTICLES\fR +number of sampled particle-shapes. This is actually the number of realizations +of the Monte Carlo algorithm. Default is @SCHIFF_ARGS_DEFAULT_NREALISATIONS@. +.TP +.B \-G \fICOUNT\fR +sample \fICOUNT\fR soft particles with respect to the defined distribution, +dump their geometric data and exit. The data are written to \fIOUTPUT\fR or the +standard output whether the \fB-o\fR \fIOUTPUT\fR option is defined or not, +respectively. The outputted data followed the Alias Wavefront obj file format. +.TP +.B \-h +display short help and exit. +.TP +.B \-i \fIDISTRIBUTION\fR +define the +.BR schiff-geometry (5) +file that controls the geometry distribution of the soft particles. +.TP +.B \-l \fILENGTH\fR +characteristic length in micron of the soft particles. Used for the definition +of the angle that sets the limit between small and large scattering angles (see +equation. 7 in [2]). +.TP +.B \-n \fINUM_THREADS\fR +hint on the number of threads to use during the integration. By default use as +many threads as CPU cores. +.TP +.B \-o \fIOUTPUT\fR +write results to \fIOUTPUT\fR with respect to the +.BR schiff-output (5) +format. If not defined, write results to standard output. +.TP +.B \-q +do not print the helper message when no \fIFILE\fR is submitted. +.TP +.B \-w \fIW0\fR[\fB:\fIW1\fR]... +list of wavelengths in vacuum (expressed in micron) to integrate. +.TP +.B \-\-version +display version information and exit. +.SH EXAMPLES +Estimate the radiative properties of soft particles whose shape is described in +the \fBgeometry.yaml\fR file and its optical properties in the \fBproperties\fR +file. The characteristic length of the soft particle shapes is \fB2.3\fR +microns and the estimations is performed for the wavelengths \fB0.45\fR and +\fB0.6\fR microns. The results are written to the standard output: +.PP +.RS 4 +.nf +$ schiff -i geometry.yaml -l 2.3 -w 0.45:0.6 properties +.fi +.RE +.PP +The soft particles have a characteristic length of \fB1\fR and their shape is +controlled by the \fBmy_geom.yaml\fR file. Their optical properties are read +from the standard input. The estimated wavelelength is \fB0.66\fR microns and +the results are written to the \fBmy_result\fR file: +.PP +.RS 4 +.nf +$ schiff -w 0.66 -l 1.0 -i my_geom.yaml -o my_result +.fi +.RE +.PP +Sample \fB10\fR soft particles whose shape is defined by the \fBgeometry.yaml\fR +file and write their triangulated geometric data to the \fBtemp_output\fR file. +Use the +.BR csplit (1) +Unix command to split the \fBtemp_output\fR file in 10 files named +particle<\fINUM\fR>.obj, with NUM in [0, 9], each storing the geometric data of +a sampled soft particle: +.PP +.RS 4 +.nf +$ schiff -i geometry.yaml -G 10 -o temp_output +$ csplit temp_output -z /^g\\ / {*} -f particle -b %d.obj +.fi +.RE +.PP +.SH NOTES +.PP +[1] L. I. Schiff, 1956. Approximation Method for Short Wavelength or High\-Energy +Scattering. Phys. Rev. 104 \- 1481\-1485. +.PP +[2] J. Charon, S. Blanco, J. F. Cornet, J. Dauchet, M. El Hafi, R. Fournier, M. +Kaissar Abboud, S. Weitz, 2015. Monte Carlo Implementation of Schiff's +Approximation for Estimating Radiative Properties of Homogeneous, +Simple\-Shaped and Optically Soft Particles: Application to Photosynthetic +Micro-Organisms. Journal of Quantitative Spectroscopy and Radiative Transfer +172 \- 3\-23. +.PP +[3] S. Weitz, S. Blanco, J. Charon, J. Dauchet, M. El Hafi, V. Eymet, O. +Farges, R. Fournier, and J. Gautrais, 2016. Monte Carlo efficiency +improvement by multiple sampling of conditioned integration variables. Journal +of Computational Physics 326 \- 30\-34. +.SH COPYRIGHT +Copyright \(co 2015, 2016 CNRS. Copyright \(co 2019 |Meso|Star>. License +GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is +free software: you are free to change and redistribute it. There is NO +WARRANTY, to the extent permitted by law. +.SH SEE ALSO +.BR csplit (1), +.BR schiff-geometry (5), +.BR schiff-output (5) diff --git a/src/schiff.c b/src/schiff.c @@ -338,7 +338,7 @@ run_integration nwlens = sa_size(args->wavelengths); res = sschiff_integrate(sschiff, rng, distrib, args->wavelengths, nwlens, sschiff_uniform_scattering_angles, args->nangles, args->nrealisations, - args->ndirs, args->discard_large_angles, &estimator); + args->ninsamps, args->discard_large_angles, &estimator); if(res != RES_OK) { fprintf(stderr, "Schiff integration error.\n"); goto error; diff --git a/src/schiff_args.c b/src/schiff_args.c @@ -19,6 +19,7 @@ #include "schiff_args.h" #include "schiff_version.h" #include "schiff_optical_properties.h" +#include "schiff_geometry.h" #include <rsys/dynamic_array_char.h> #include <rsys/cstr.h> @@ -54,46 +55,46 @@ print_help(const char* binary) "Photosynthetic Micro-Organisms\" (Charon et al. 2015).\n\n", binary); printf( -" -a ANGLES number of phase function scattering angles. Default is %u.\n", +" -a NUM_ANGLES number of phase function scattering angles. Default is %u.\n", SCHIFF_ARGS_NULL.nangles); printf( -" -A ANGLES number of computed inverse cumulative phase function values.\n" -" Default is %u.\n", +" -A NUM_ANGLES number of computed inverse cumulative phase function values.\n" +" Default is %u.\n", SCHIFF_ARGS_NULL.nangles_inv); printf( -" -d DIRS number of sampled directions for each geometry.\n" -" Default is %u.\n", - SCHIFF_ARGS_NULL.ndirs); +" -d NUM_INSAMPS number of (incident direction, volume, ray(s)) sampling for each\n" +" sampled particle-shape. Default is %u.\n", + SCHIFF_ARGS_NULL.ninsamps); printf( -" -D discard computations of the [[inverse] cumulative] phase\n" -" functions for large scattering angles.\n"); +" -D discard computations of the [[inverse] cumulative] phase\n" +" functions for large scattering angles.\n"); printf( -" -g GOEMS number of sampled geometries. This is actually the number of\n" -" realisations. Default is %u.\n", +" -g NUM_SHAPES number of sampled particle-shapes. This is actually the number\n" +" of realizations of the Monte Carlo algorithm. Default is %u.\n", SCHIFF_ARGS_NULL.nrealisations); printf( -" -G NUM sampled `NUM' geometries with respect to the defined\n" -" distribution, dump their data and exit.\n"); +" -G NUM sampled `NUM' particle shapes with respect to the defined\n" +" distribution, dump their geometry and exit.\n"); printf( -" -h display this help and exit.\n"); +" -h display this help and exit.\n"); printf( -" -i DISTRIB YAML file that defines the geometry distributions of the soft\n" -" particles.\n"); +" -i DISTRIB YAML file that defines the geometry distributions of the soft\n" +" particles.\n"); printf( -" -l LENGTH characteristic length of the soft particles.\n"); +" -l LENGTH characteristic length of the soft particles.\n"); printf( -" -n NTHREADS hint on the number of threads to use during the integration.\n" -" By default use as many threads as CPU cores.\n"); +" -n NTHREADS hint on the number of threads to use during the integration.\n" +" By default use as many threads as CPU cores.\n"); printf( -" -o OUTPUT write results to OUTPUT. If not defined, write results to\n" -" standard output.\n"); +" -o OUTPUT write results to OUTPUT. If not defined, write results to\n" +" standard output.\n"); printf( -" -q do not print the helper message when no FILE is submitted.\n"); +" -q do not print the helper message when no FILE is submitted.\n"); printf( -" -w A[:B]... list of wavelengths in vacuum (expressed in micron) to\n" -" integrate.\n"); +" -w A[:B]... list of wavelengths in vacuum (expressed in micron) to\n" +" integrate.\n"); printf( -" --version display version information and exit.\n"); +" --version display version information and exit.\n"); printf("\n"); printf( "Copyright (C) 2015, 2016 CNRS. Copyright (C) 2019 |Meso|Star>. This is free\n" @@ -1493,9 +1494,9 @@ schiff_args_init } break; case 'd': - res = cstr_to_uint(optarg, &args->ndirs); - if(res == RES_OK && !args->ndirs) { - fprintf(stderr, "%s: the number of directions cannot be null.\n", + res = cstr_to_uint(optarg, &args->ninsamps); + if(res == RES_OK && !args->ninsamps) { + fprintf(stderr, "%s: the number of inner samples cannot be null.\n", argv[0]); res = RES_BAD_ARG; } diff --git a/src/schiff_args.h b/src/schiff_args.h @@ -1,73 +0,0 @@ -/* Copyright (C) 2015, 2016 CNRS - * Copyright (C) 2019 |Meso|Star> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef SCHIFF_ARGS_H -#define SCHIFF_ARGS_H - -#include "schiff_geometry.h" -#include <rsys/rsys.h> -#include <star/sschiff.h> - -struct schiff_args { - const char* output_filename; /* File in which output data are stored */ - struct schiff_optical_properties* properties; /* List of properties */ - double* wavelengths; /* List of wavelengths to integrate */ - - double characteristic_length; /* Characteristic length of the soft particles */ - int discard_large_angles; /* Avoid analytic model for large angles */ - - /* List of parsed geometry distribution parameters and its associated random - * variate */ - struct schiff_geometry* geoms; - struct ssp_ranst_discrete* ran_geoms; - - unsigned ngeoms_dump; /* # sampled geometries to dump */ - unsigned nrealisations; /* # realisation */ - unsigned ndirs; /* Number of directions to sample per realisation */ - unsigned nangles; /* Number of scattering angles */ - unsigned nangles_inv; /* Number of angles in the the inverse phase function */ - - unsigned nthreads; /* Hint on the number of thread to use */ -}; - -static const struct schiff_args SCHIFF_ARGS_NULL = { - NULL, /* Output filename */ - NULL, /* List of optical properties */ - NULL, /* List of wavelength to integrate */ - -1.0, /* Caracteristic length */ - 0, /* Discard large angles */ - NULL, /* List of Schiff geometries */ - NULL, /* Schiff geometry random variates */ - 0, /* # Dumped geometries */ - 10000, /* # Sampled geometries */ - 100, /* # Sampled directions per geometry */ - 1000, /* # Scattering angles */ - 2000, /* # angles in the inv cumulative phase function */ - SSCHIFF_NTHREADS_DEFAULT -}; - -extern LOCAL_SYM res_T -schiff_args_init - (struct schiff_args* args, - const int argc, - char** argv); - -extern LOCAL_SYM void -schiff_args_release - (struct schiff_args* args); - -#endif /* SCHIFF_ARGS_H */ - diff --git a/src/schiff_args.h.in b/src/schiff_args.h.in @@ -0,0 +1,75 @@ +/* Copyright (C) 2015, 2016 CNRS + * Copyright (C) 2019 |Meso|Star> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef SCHIFF_ARGS_H +#define SCHIFF_ARGS_H + +#include <rsys/rsys.h> +#include <star/sschiff.h> + +struct schiff_geometry; +struct schiff_optical_properties; + +struct schiff_args { + const char* output_filename; /* File in which output data are stored */ + struct schiff_optical_properties* properties; /* List of properties */ + double* wavelengths; /* List of wavelengths to integrate */ + + double characteristic_length; /* Characteristic length of the soft particles */ + int discard_large_angles; /* Avoid analytic model for large angles */ + + /* List of parsed geometry distribution parameters and its associated random + * variate */ + struct schiff_geometry* geoms; + struct ssp_ranst_discrete* ran_geoms; + + unsigned ngeoms_dump; /* # sampled geometries to dump */ + unsigned nrealisations; /* # realisation */ + unsigned ninsamps; /* Number of inner samples per realisations */ + unsigned nangles; /* Number of scattering angles */ + unsigned nangles_inv; /* Number of angles in the the inverse phase function */ + + unsigned nthreads; /* Hint on the number of thread to use */ +}; + +static const struct schiff_args SCHIFF_ARGS_NULL = { + NULL, /* Output filename */ + NULL, /* List of optical properties */ + NULL, /* List of wavelength to integrate */ + -1.0, /* Caracteristic length */ + 0, /* Discard large angles */ + NULL, /* List of Schiff geometries */ + NULL, /* Schiff geometry random variates */ + 0, /* # Dumped geometries */ + @SCHIFF_ARGS_DEFAULT_NREALISATIONS@, /* #Sampled geometries */ + @SCHIFF_ARGS_DEFAULT_NINSAMPLES@, /* #inner samples */ + @SCHIFF_ARGS_DEFAULT_NANGLES@, /* # Scattering angles */ + @SCHIFF_ARGS_DEFAULT_NANGLES_INV@, /* # angles in the inv cumulative phase function */ + SSCHIFF_NTHREADS_DEFAULT +}; + +extern LOCAL_SYM res_T +schiff_args_init + (struct schiff_args* args, + const int argc, + char** argv); + +extern LOCAL_SYM void +schiff_args_release + (struct schiff_args* args); + +#endif /* SCHIFF_ARGS_H */ +