commit bc78b41863a243f5f3739ee920a6ae12f7392cf1
parent 15ff28f1db4e6cbf3bbe3c8d3bb6680a34c0bd03
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 31 Mar 2020 20:27:48 +0200
First try at the documentation
Diffstat:
13 files changed, 536 insertions(+), 525 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -34,14 +34,21 @@ set_property(CACHE STARDIS_DOC PROPERTY STRINGS
###############################################################################
# Generate files
-###############################################################################set(SOLSTICE_ARGS_DEFAULT_NREALISATIONS "10000")
-set(SOLSTICE_ARGS_DEFAULT_CAMERA_POS "0,0,0")
-set(SOLSTICE_ARGS_DEFAULT_CAMERA_TGT "0,0,-1")
-set(SOLSTICE_ARGS_DEFAULT_CAMERA_UP "0,1,0")
-set(SOLSTICE_ARGS_DEFAULT_CAMERA_FOV "70") # In degrees
-set(SOLSTICE_ARGS_DEFAULT_IMG_WIDTH "800")
-set(SOLSTICE_ARGS_DEFAULT_IMG_HEIGHT "600")
-set(SOLSTICE_ARGS_DEFAULT_IMG_SPP "1")
+###############################################################################
+set(STARDIS_ARGS_DEFAULT_AMBIANT_TEMP "300")
+set(STARDIS_ARGS_DEFAULT_COMPUTE_TIME "INF")
+set(STARDIS_ARGS_DEFAULT_RENDERING_FOV "70") # degrees
+set(STARDIS_ARGS_DEFAULT_RENDERING_IMG_HEIGHT "480")
+set(STARDIS_ARGS_DEFAULT_RENDERING_IMG_WIDTH "640")
+set(STARDIS_ARGS_DEFAULT_RENDERING_POS "1,1,1")
+set(STARDIS_ARGS_DEFAULT_RENDERING_SPP "4")
+set(STARDIS_ARGS_DEFAULT_RENDERING_TGT "0,0,0")
+set(STARDIS_ARGS_DEFAULT_RENDERING_TIME "INF")
+set(STARDIS_ARGS_DEFAULT_RENDERING_UP "0,0,1")
+set(STARDIS_ARGS_DEFAULT_REFERENCE_TEMP "300")
+set(STARDIS_ARGS_DEFAULT_SAMPLES_COUNT "10000")
+set(STARDIS_ARGS_DEFAULT_SCALE_FACTOR "1")
+set(STARDIS_ARGS_DEFAULT_VERBOSE_LEVEL "1")
configure_file(${SDIS_SOURCE_DIR}/../doc/stardis.1.txt.in
${CMAKE_CURRENT_BINARY_DIR}/doc/stardis.1.txt @ONLY)
@@ -51,6 +58,9 @@ set(VERSION_MINOR 4)
set(VERSION_PATCH 0)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
+configure_file(${SDIS_SOURCE_DIR}/stardis-default.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/stardis-default.h @ONLY)
+
configure_file(${SDIS_SOURCE_DIR}/stardis-version.h.in
${CMAKE_CURRENT_BINARY_DIR}/stardis-version.h @ONLY)
@@ -112,6 +122,7 @@ set(SDIS_FILES_SRC
set(SDIS_FILES_INC
stardis-app.h
stardis-compute.h
+ stardis-default.h.in
stardis-fluid.h
stardis-intface.h
stardis-output.h
diff --git a/doc/stardis-input.5.txt b/doc/stardis-input.5.txt
@@ -1,17 +1,18 @@
-// Copyright (C) 2016-2018 CNRS, 2018-2019 |Meso|Star>
+// Copyright (C) 2018-2020 |Meso|Star>
//
-// This is free documentation: you can redistribute it and/or modify
+// 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 manual is distributed in the hope that it will be useful,
+// 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/>.
+
:toc:
stardis-input(5)
diff --git a/doc/stardis-output.5.txt b/doc/stardis-output.5.txt
@@ -1,17 +1,18 @@
-// Copyright (C) 2016-2018 CNRS, 2018-2019 |Meso|Star>
+// Copyright (C) 2018-2020 |Meso|Star>
//
-// This is free documentation: you can redistribute it and/or modify
+// 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 manual is distributed in the hope that it will be useful,
+// 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/>.
+
:toc:
stardis-output(5)
diff --git a/doc/stardis.1.txt.in b/doc/stardis.1.txt.in
@@ -1,17 +1,18 @@
-// Copyright (C) 2016-2018 CNRS, 2018-2019 |Meso|Star>
+// Copyright (C) 2018-2020 |Meso|Star>
//
-// This is free documentation: you can redistribute it and/or modify
+// 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 manual is distributed in the hope that it will be useful,
+// 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/>.
+
:toc:
stardis(1)
@@ -19,245 +20,238 @@ stardis(1)
NAME
----
-stardis - compute the power collected by a concentrated solar plant
+stardis - statistical solving of coupled thermal systems
SYNOPSIS
--------
[verse]
-*stardis*
-*stardis* [_option_]... [_file_]
-*stardis* *-g* <__sub-option__[:...]> [_option_]... [_file_]
-*stardis* *-p* <__sub-option__[:...]> [_option_]... [_file_]
-*stardis* *-r* <__sub-option__[:...]> [_option_]... [_file_]
+*stardis* [_option_]
+*stardis* *-M* <__file__> [_option_]
DESCRIPTION
-----------
-*stardis* computes the total power collected by a concentrated solar plant, as
-described in the *stardis-input*(5) _file_. If the _file_ argument is not
-provided, the solar plant is read from standard input. To evaluate various
-efficiencies for each primary reflector, it computes losses due to cosine
-effect, shadowing and masking, orientation and surface irregularities,
-materials properties and atmospheric extinction. The efficiency for each
-one of these effects is subsequently computed for each reflector.
-
-The entities on which computations must be performed are listed in the
-*stardis-receiver*(5) file submitted through the *-R* option. The estimated
-results follow the *stardis-output*(5) format and are written to the _output_
-file or to the standard output whether the *-o* _output_ option is defined or
-not, respectively. Note that the *stardis* algorithm is based on the
-Monte-Carlo method, which means that every result is provided with its
-numerical accuracy.
-
-*stardis* is designed to efficiently handle complex solar facilities: several
-reflectors can be specified (planes, conics, cylindro-parabolic, etc.) and
-positioned in 3D space, with a possibility for 1-axis and 2-axis
-auto-orientation. Multiple materials can be used, as long as the relevant
-physical properties are provided. Spectral effects are also taken into account:
-it is possible to define the spectral distribution of any physical property,
-including the input solar spectrum and the transmissivity of the atmosphere, at
-any spectral resolution. Refer to *stardis-input*(5) for more informations.
+*stardis* solves coupled thermal systems under the linear assumption. Here
+coupled refers to conductive, convective and radiative transfers, and linear
+means that each phenomena is represented using a model that is linear
+with temperature. *stardis* can deal with complex geometries as well as
+high-frequency external solicitations over a very long period of time,
+relative to the characteristic time of the system.
+
+*stardis* can compute a thermal observable, like temperature or flux, at a
+probe point and date or the mean value of an observable over a given surface
+or volume, and time period. In addition, *stardis* gives access to the
+evaluation of the propagator (aka the *Green function*).
+
+The propagator is of great value for thermicist engineers as it gives some
+crucial information to analyse heat transfers in the system. It helps engineers
+answer questions like "Where from does the heat come at this location?".
+Propagators seamlessly agregate all the provided geometrical and physical
+information on the system in an unbiased and very-fast statistical model.
In addition of the aforementioned computations, *stardis* provides three
-other functionalities. The *-g* option can be used to convert the
-*stardis-input*(5) geometries in CAO files. The *-p* option saves the sampled
-radiative paths used by the estimates, allowing to visualise them externally
-which may be a great help to identify a design issue. Finally, the *-r* option
-is used to render an image of the submitted solar facility. Note that these
-three options are mutually exclusives, and once defined, they replace the
-default *stardis* behaviour.
-
-Please note that any coordinate-related question in Stardis must be
-considered with the right-handed convention in mind.
-
-OPTIONS
--------
-*-D* <__alpha__,__beta__[:...]>::
- List of sun directions. A direction is defined by two angles in degrees. The
- first one, here refered to as _alpha_, is an azimuthal angle in [0, 360[ and
- the second one, here refered to as _beta_, is an elevation in [0, 90].
- Each provided sun direction triggers a new computation whose results are
- concatenated to the _output_ file.
+other functionalities. The *-d* option can be used to convert the
+*stardis-input*(5) geometry into a VTK file. The *-D* option saves the sampled
+thermal paths used by the estimates, allowing to visualise them externally
+which may be of a great help to identify issues. Finally, the *-R* option
+can be used to render an infrared image of the submitted system.
+
+The provided system should be described in the *stardis-input*(5) format
+and can be split over any number of files, each being submited through the
+*-M* option.
+
+Stardis' algorithms are based on state-of-the-art Monte-Carlo method applied
+to radiative transfer physics (Delatorre [1]) combined with conduction's
+statistical formulation (Kac [2] and Muller [3]). Thanks to recent advances in
+computer graphics technology which has already been a game changer in the
+cinema industry (FX and animated movies), this theoretical framework can now
+be practically used on the most geometrically complex systems. While this
+capability is part of the StarEngine Star3D library, it is internally powered
+by Intel® Rendering Framework: Embree.
+
+Everytime the linear assumption is relevant, this theoretical framework allows
+to encompass all the heat transfer mecanisms (conductive-convective-radiative)
+in an unified statistical model. Such systems can be solved by a Monte-Carlo
+approach just by sampling thermal paths. This can be seen as an extension of
+Monte-Carlo algorithms that solve radiative transfer by sampling optical paths.
+A main property of this approach is that the resulting algorithms does not rely
+on a volume mesh of the system.
+
+[1] Delatorre et al., Monte Carlo advances and concentrated solar applications,
+Solar Energy, 2014
+
+[2] Kac, On Distributions of Certain Wiener Functionals. The Annals of
+Mathematical Statistics, 1949.
+
+[3] Muller, Some continuous Monte-Carlo Methods for the Dirichlet Problem,
+Transactions of the American Mathematical Society, 1956.
+
+MANDATORY OPTIONS
+-----------------
+*-M* _file_::
+ Read a text file containing a (partial) description of the system.
+ Can include both media enclosures and boundary conditions, in any order.
+ Can be used more than once if the description is splited across different
+ files.
+
-Following the right-handed convention, Stardis azimuthal rotation is
-counter-clockwise, with 0° on the X axis. Stardis elevation starts from 0° for
-directions in the XY plane, up to 90° at zenith. Thus -D0,0 -D90,0 -D180,0 and
--D270,0 will produce solar vectors {-1,0,0} {0,-1,0} {+1,0,0} and {0,+1,0}
-respectively, while -D__alpha__,90 will produce {0,0,-1} regardless of _alpha_
-value.
-
-*-f*::
- Force overwrite of the output files, i.e. the _output_ file and the file
- where the state of the random number generator is saved (see the *-G*
- option).
-
-*-G* <__sub-option__:...>::
- Save and restore the state of the random number generator. This option can be
- used to ensure the statistical independence between successive simulations
- on the same system. For instance, one can run a new simulation and
- initialising its random number generator with the final state of the
- generator as defined by the previous run. Available sub options are:
-
- **istate=**_input_rng_state_;;
- Define the file from which the initial state of the random number generator
- is read. If not defined, the random number generator is initialised with
- its default seed.
-
- **ostate=**_output_rng_state_;;
- Define the file where the final state of the random number generator is
- written. If not defined, this state is simply discarded.
-
-*-g* <__sub-option__:...>::
- Generate the shape of the geometry defined in the submitted _file_ and store
- it in _output_. Available sub-options are:
-
- *format=obj*;;
- Define the file format in which the meshes are stored. Currently, only the
- Alias Wavefront OBJ file format is supported.
-
- *split=*<**geometry**|*object*|*none*>;;
- Define how the output mesh is split in sub meshes. A sub mesh can be
- generated for each *geometry* or for each *object* as defined in the
- *stardis-input*(5) file format. The *none* option means that only one
- mesh is generated for the whole solar facility. By default, the *split*
- option is set to *none*.
-
-*-h*::
- List short help and exit.
-
-*-n* _experiments-count_::
- Number of Monte-Carlo experiments used to estimate the solar flux. By
- default _experiments-count_ is set to @SOLSTICE_ARGS_DEFAULT_NREALISATIONS@.
-
-*-o* _output_::
- Write results to _output_ with respect to the *stardis-output*(5) format. If
- not defined, write results to standard output.
-
-*-p* <__sub-option__:...>::
- Register the sampled radiative paths for each sun direction and write them to
- _output_. Available sub-options are:
-
- *default*;;
- Use default sub-options.
-
- **irlen=**_length_;;
- Length of the radiative path segments going to the infinity. By default, it
- is computed relatively to the scene size.
-
- **srlen=**_length_;;
- Length of the radiative path segments coming from the sun. By default, it
- is computed relatively to the scene size.
-
-*-q*::
- Do not print the helper message when no _file_ is submitted.
-
-*-R* _receivers_::
- *stardis-receiver*(5) file defining the scene receivers, i.e. the solar
- plant entities for which *stardis* computes Monte-Carlo estimates.
-
-*-r* <__sub-option__:...>::
- Render an image of the scene through a pinhole camera, for each submitted
- sun direction. Write the resulting images to _output_. Available sub-options
- are:
+blabla right-handed normals blabla inside/outside blabla.
+
+EXCLUSIVE OPTIONS
+-----------------
+*-p* _x,y,z[,time]_::
+ Compute the temperature at the given probe at a given time. By default
+ compute time is @STARDIS_ARGS_DEFAULT_COMPUTE_TIME@. The probe must be in a
+ medium.
+
+*-P* _x,y,z[,time]_::
+ Compute the temperature at the given probe on an interface at a given time.
+ By default compute time is @STARDIS_ARGS_DEFAULT_COMPUTE_TIME@. The probe is
+ suposed to be on an interface and is moved to the closest point of the
+ closest interface.
+
+*-m* _medium_name[,time]_::
+ Compute the mean temperature in a given medium at a given time. By default
+ compute time is @STARDIS_ARGS_DEFAULT_COMPUTE_TIME@. The medium doesn't need
+ to be connex.
+
+*-s* _file[,time]_::
+ Compute the mean temperature on a given 2D region at a given time, the
+ region being defined as the front sides of the triangles in the provided
+ *STL* file. By default compute time is @STARDIS_ARGS_DEFAULT_COMPUTE_TIME@.
+ These triangles are not added to the geometry, but must be part of it. The
+ region doesn't need to be connex.
+
+*-S* _file[,time]_::
+ Compute the by-triangle mean temperature on a given 2D region at a given
+ time, the region being defined as the front sides of the triangles in the
+ provided *VTK* file. By default compute time is
+ @STARDIS_ARGS_DEFAULT_COMPUTE_TIME@. These triangles are not added to the
+ geometry, but must be part of it. The region doesn't need to be connex.
+
+*-F* _file[,time]_::
+ Compute the mean flux on a given 2D region at a given time, the region
+ being defined as the front sides of the triangles in the provided *VTK* file.
+ By default compute time is @STARDIS_ARGS_DEFAULT_COMPUTE_TIME@.
+ Flux is accounted positive when going from the front side to the back side,
+ at a single-triangle level. These triangles are not added to the geometry,
+ but must be part of it. The region doesn't need to be connex.
+
+*-R* [__sub-option__:...]::
+ Render an infrared image of the system through a pinhole camera and write it
+ to _standard output_ in VTK format. Available sub-options are:
**fov=**_angle_;;
Horizontal field of view of the camera in [30, 120] degrees. By default
- _angle_ is @SOLSTICE_ARGS_DEFAULT_CAMERA_FOV@ degrees.
+ _angle_ is @STARDIS_ARGS_DEFAULT_RENDERING_FOV@ degrees.
**img=**_width_**x**_height_;;
Definition of the rendered image in pixels. By default the image definition
- is @SOLSTICE_ARGS_DEFAULT_IMG_WIDTH@x@SOLSTICE_ARGS_DEFAULT_IMG_HEIGHT@.
+ is @STARDIS_ARGS_DEFAULT_RENDERING_IMG_WIDTH@x@STARDIS_ARGS_DEFAULT_RENDERING_IMG_HEIGHT@.
**pos=**_x_**,**_y_**,**_z_;;
Position of the camera. By default it is set to
- {@SOLSTICE_ARGS_DEFAULT_CAMERA_POS@} or it is automatically computed to
- ensure that the whole scene is visible, whether *tgt* is set or not,
- respectively.
-
- **rmode=**<**draft**|**pt**>;;
- Rendering mode. In *draft* mode, images are computed by ray-casting; all
- materials are lambertian, the sun is ignored and the only light source is
- positioned at the camera position. In *pt* mode, the scene is rendered with
- the un-biased path-tracing Monte-Carlo algorithm; the materials described
- in the committed _file_ as well as the submitted sun directions are
- correctly handled and an uniform skydome is added to simulate the diffuse
- infinite lighting. By default *rmode* is set to *draft*.
+ {@STARDIS_ARGS_DEFAULT_RENDERING_POS@}.
**spp=**_samples-count_;;
- Number of samples per pixel. If *rmode* is *draft*, the samples position
- into a pixel are the same for all pixels. With *rmode=pt* the pixel
- samples are generated independently for each pixel. By default, use 1
- sample per pixel.
+ Number of samples per pixel.
+ By default, use @STARDIS_ARGS_DEFAULT_RENDERING_SPP@ samples per pixel.
+ **t=**_time_;;
+ Rendering time. By default _time_ is @STARDIS_ARGS_DEFAULT_RENDERING_TIME@
+ seconds.
+
**tgt=**_x_**,**_y_**,**_z_;;
Position targeted by the camera. By default, it is set to
- {@SOLSTICE_ARGS_DEFAULT_CAMERA_TGT@} or it is automatically computed to
+ {@STARDIS_ARGS_DEFAULT_RENDERING_TGT@} or it is automatically computed to
ensure that the whole scene is visible, whether *pos* is set or not,
respectively.
**up=**_x_**,**_y_**,**_z_;;
Up vector of the camera. If *rmode* is *pt*, this vector also defines the
direction toward the top of the skydome. By default, *up* is set to
- {@SOLSTICE_ARGS_DEFAULT_CAMERA_UP@}.
+ {@STARDIS_ARGS_DEFAULT_RENDERING_UP@}.
+
+OTHER OPTIONS
+-------------
+
+*-a* _ambiant_::
+ Set *ambiant* as the ambient radiative temperature for the whole system.
+ By default *ambiant* is @STARDIS_ARGS_DEFAULT_AMBIANT_TEMP@.
+
+*-d*::
+ Write the geometry to _standard output_ in VTK format along with various
+ properties, including possible errors. If this option is used, no
+ computation occurs.
++
+Using this option in conjunction with an option that
+specifies a compute region (-s, -S, -F) has the effect to include the
+region in the output. This option cannot be used in conjunction with other
+options that write to _standard output_ (-R, -g, -D, -h, -v).
+
+*-D* _type_::
+ Write thermal paths of the given *type* to _standard output_ in VTK format.
+ Possible values are *error* (write paths ending in error), *success*
+ (write successful paths),*all* (write all paths).
++
+This option can only be used in conjuction with an option that runs a
+computation (-p, -P, -m, -s, -R, -S, -F) and cannot be used in conjunction
+with other options that write to _standard output_ (-R, -d, -g, -h, -v).
+
+*-g*::
+ Write the green function at a steady state to _standard output_ after the
+ specified computation.
++
+This option can only be used in conjonction with one these options: -p, -P,
+-m, -s. Any provided compute time is silently ignored.
+
+**-f** _factor_::
+ Rescale the geometry by the given *factor* before sending it to the solver.
+ Default rescale *factor* is @STARDIS_ARGS_DEFAULT_SCALE_FACTOR@.
+
+*-n* _samples-count_::
+ Number of Monte-Carlo samples. By default _samples-count_ is set to
+ @STARDIS_ARGS_DEFAULT_SAMPLES_COUNT@.
+
+*-r* _reference_::
+ Set *reference* as the temperature used for the linearization of the
+ radiative transfer. By default *reference* is
+ @STARDIS_ARGS_DEFAULT_REFERENCE_TEMP@.
*-t* _threads-count_::
Hint on the number of threads to use. By default use as many threads as CPU
cores.
-*-v*::
- Make stardis more verbose.
+*-V* _level_::
+ Set the verbosity level according to the following list. Default verbosity
+ *level* is @STARDIS_ARGS_DEFAULT_VERBOSE_LEVEL@.
+ **0** (write no message to _standard error_),;;
+ **1** (write error messages only to _standard error_),;;
+ **2** (write error and warning messages to _standard error_),;;
+ **3** (write error, warning and informative messages to _standard error_).;;
-*--version*::
+*-v*::
Output version information and exit.
EXAMPLES
--------
-Launch two simulations for sun directions whose azimuthal and elevation angles
-are {*45*,*70*} and {*50*,*75*}. The solar facility is described in
-*input.yaml* and the receivers on which the integrations must be performed are
-declared in the *rcvs.yaml* file. *10000* experiments are used by the
-Monte-Carlo estimates and the results are written to *output* even though this
-file already exists:
-
- $ stardis -D45,70:50,75 -R rcvs.yaml -n 10000 -f -o output input.yaml
-
-Generate a mesh for each geometry described in *input.yaml*, and save them in
-the *output* file with respect to the Alias Wavefront OBJ format. The meshes
-are positioned according to their orientation constraints, with respect to the
-sun direction whose azimuthal and elevation angles are {*30*,*60*}. Use the
-*csplit*(1) Unix command to generate an Alias Wavefront OBJ file per geometry
-stored in *output*. The name of the generated Alias Wavefront OBJ files are
-*geom*<__NUM__>**.obj** with __NUM__ in [0, N-1] where N is the number of
-geometries described in *input.yaml*. Refer to *stardis-output*(5) for
-informations on the regular expression *^---$* used to split the output file:
-
- $ stardis -D30,60 -g format=obj:split=geometry -f -o output input.yaml
- $ csplit -f geom -b %02d.obj -z --suppress-matched output /^---$/ {*}
-
-Trace 100 radiative paths into the solar plant described in *input.yaml*, with
-respect to the sun direction whose azimuthal and elevations angles are *0* and
-*90* degrees, respectively. Write the *stardis-output*(5) result to the
-standard output and postprocess it with the *sed*(1) Unix command to remove the
-first line that stores the sun direction from which the radiative paths come
-from. The remaining data that list the radiative paths geometry are redirected
-into the *paths.vtk* file:
-
- $ stardis -n 100 -D0,90 -R rcvs.yaml -p default input.yaml | sed '1d'>paths.vtk
-
-Use the path-tracing rendering algorithm to draw the solar plant
-*solplant.yaml* with respect to the sun direction whose azimuthal and elevation
-angles are *180* and *45* degrees, respectively. Use *64* samples per pixel to
-estimate the per-pixel radiance and fix the up camera vector to {*0*,*0*,*1*}.
-Write the *stardis-output*(5) result to standard output and use the *sed*(1)
-Unix command to remove the first line which stores the sun direction used to
-draw the image. Finally, visualise the rendered picture by redirecting the
-remaining data to the *feh*(1) image viewer.
-
- $ stardis -D180,45 -r up=0,0,1:rmode=pt:spp=64 solplant.yaml | sed '1d' | feh -
+Pre-process the system as described in *scene.txt* when intending to compute
+the mean flux on the triangles from the file *edge.stl*, and write its geometry
+in the file *scene.vtk*. Verbosity level is set to *3* and the possible
+messages are printed to standard error:
+
+ $ stardis -M scene.txt -F edge.stl -d -V 3 > scene.vtk
+
+
+Compute the temperature at the probe point *0, 0.5, 0* at the steady state. The
+system is read from the 2 files *media.txt* and *bound.txt* and the number of
+samples is set to *1000000*:
+
+ $ stardis -M media.txt -M bounds.txt -p 0,0.5,0 -n 1000000
+
COPYRIGHT
---------
-Copyright © 2016-2018 CNRS, 2018-2019 |Meso|Star>. License GPLv3+: GNU GPL
+Copyright © 2018-2020 |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.
@@ -268,5 +262,4 @@ SEE ALSO
*feh*(1),
*sed*(1),
*stardis-input*(5),
-*stardis-output*(5),
-*stardis-receiver*(5)
+*stardis-output*(5)
diff --git a/src/main.c b/src/main.c
@@ -53,7 +53,7 @@ main
ERR(parse_args(argc, argv, args));
if(args->mode & DUMP_HELP) {
- print_help(stdout, argv[0]);
+ short_help(stdout, argv[0]);
goto exit;
}
else if(args->mode & DUMP_VERSION) {
diff --git a/src/stardis-app.c b/src/stardis-app.c
@@ -504,8 +504,8 @@ stardis_init
stardis->samples = args->samples;
stardis->nthreads = args->nthreads;
stardis->scale_factor = args->scale_factor;
- stardis->radiative_temp[0] = args->radiative_temp[0];
- stardis->radiative_temp[1] = args->radiative_temp[1];
+ stardis->ambiant_temp = args->ambiant_temp;
+ stardis->ref_temp = args->ref_temp;
stardis->dump_paths = SDIS_HEAT_PATH_NONE;
if(args->dump_paths & DUMP_ERROR)
stardis->dump_paths |= SDIS_HEAT_PATH_FAILURE;
diff --git a/src/stardis-app.h b/src/stardis-app.h
@@ -17,6 +17,7 @@
#define STARDIS_APP_H
#include "stardis-parsing.h"
+#include "stardis-default.h"
#include <star/sstl.h>
#include <star/sg3d.h>
@@ -640,19 +641,20 @@ struct camera {
double up[3];
double fov;
unsigned spp;
- unsigned img[2];
+ unsigned img_width, img_height;
double time;
};
static INLINE void
init_camera(struct camera* cam) {
- d3_splat(cam->pos, 0);
- d3_splat(cam->tgt, 0);
- d3_splat(cam->up, 0);
- cam->fov = 0;
- cam->spp = 0;
- cam->img[0] = cam->img[1] = 0;
- cam->time = INF;
+ d3(cam->pos, STARDIS_DEFAULT_RENDERING_POS);
+ d3(cam->tgt, STARDIS_DEFAULT_RENDERING_TGT);
+ d3(cam->up, STARDIS_DEFAULT_RENDERING_UP);
+ cam->fov = STARDIS_DEFAULT_RENDERING_FOV;
+ cam->spp = STARDIS_DEFAULT_RENDERING_SPP;
+ cam->img_width = STARDIS_DEFAULT_RENDERING_IMG_WIDTH;
+ cam->img_height = STARDIS_DEFAULT_RENDERING_IMG_HEIGHT;
+ cam->time = STARDIS_DEFAULT_RENDERING_TIME;
}
static INLINE void
@@ -736,7 +738,7 @@ struct stardis {
size_t samples;
unsigned nthreads;
double scale_factor;
- double radiative_temp[2];
+ double ambiant_temp, ref_temp;
struct mem_allocator* allocator;
struct logger* logger;
struct sdis_device* dev;
diff --git a/src/stardis-compute.c b/src/stardis-compute.c
@@ -175,8 +175,8 @@ compute_probe(struct stardis* stardis)
stardis->samples,
pos,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
&green));
ERR(dump_green(green, stardis, stdout));
} else {
@@ -187,8 +187,8 @@ compute_probe(struct stardis* stardis)
pos,
time,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
stardis->dump_paths,
&estimator));
ERR(print_single_MC_result(estimator, stardis, stdout));
@@ -222,8 +222,8 @@ compute_probe_on_interface(struct stardis* stardis)
uv,
SDIS_FRONT,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
&green));
ERR(dump_green(green, stardis, stdout));
} else {
@@ -236,8 +236,8 @@ compute_probe_on_interface(struct stardis* stardis)
time,
SDIS_FRONT,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
stardis->dump_paths,
&estimator));
ERR(print_single_MC_result(estimator, stardis, stdout));
@@ -262,8 +262,8 @@ compute_camera(const struct stardis* stardis)
ASSERT(stardis
&& !(stardis->mode & GREEN_MODE) && (stardis->mode & IR_COMPUTE));
- width = (size_t)stardis->camera.img[0];
- height = (size_t)stardis->camera.img[1];
+ width = (size_t)stardis->camera.img_width;
+ height = (size_t)stardis->camera.img_height;
/* Setup the camera */
ERR(sdis_camera_create(stardis->dev, &cam));
ERR(sdis_camera_set_proj_ratio(cam, (double)width / (double)height));
@@ -279,8 +279,8 @@ compute_camera(const struct stardis* stardis)
cam,
time,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
width,
height,
(size_t)stardis->camera.spp,
@@ -324,8 +324,8 @@ compute_medium(struct stardis* stardis)
stardis->samples,
medium,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
&green));
ERR(dump_green(green, stardis, stdout));
} else {
@@ -336,8 +336,8 @@ compute_medium(struct stardis* stardis)
medium,
time,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
stardis->dump_paths,
&estimator));
ERR(print_single_MC_result(estimator, stardis, stdout));
@@ -417,8 +417,8 @@ compute_boundary(struct stardis* stardis)
darray_sides_cdata_get(&stardis->compute_surface.sides),
darray_size_t_size_get(&stardis->compute_surface.primitives),
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
&green));
ERR(dump_green(green, stardis, stdout));
} else {
@@ -430,8 +430,8 @@ compute_boundary(struct stardis* stardis)
darray_size_t_size_get(&stardis->compute_surface.primitives),
time,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
stardis->dump_paths,
&estimator));
ERR(print_single_MC_result(estimator, stardis, stdout));
@@ -462,8 +462,8 @@ compute_flux_boundary(struct stardis* stardis)
darray_size_t_size_get(&stardis->compute_surface.primitives),
time,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
&estimator));
ERR(print_single_MC_result(estimator, stardis, stdout));
end:
@@ -504,8 +504,8 @@ compute_map(struct stardis* stardis)
1,
time,
stardis->scale_factor,
- stardis->radiative_temp[0],
- stardis->radiative_temp[1],
+ stardis->ambiant_temp,
+ stardis->ref_temp,
stardis->dump_paths,
darray_estimators_data_get(&estimators) + p));
}
diff --git a/src/stardis-default.h.in b/src/stardis-default.h.in
@@ -0,0 +1,35 @@
+/* Copyright (C) 2018-2020 |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 STARDIS_DEFAULT_H
+#define STARDIS_DEFAULT_H
+
+#define STARDIS_DEFAULT_AMBIANT_TEMP @STARDIS_ARGS_DEFAULT_AMBIANT_TEMP@
+#define STARDIS_DEFAULT_COMPUTE_TIME @STARDIS_ARGS_DEFAULT_COMPUTE_TIME@
+#define STARDIS_DEFAULT_RENDERING_FOV @STARDIS_ARGS_DEFAULT_RENDERING_FOV@
+#define STARDIS_DEFAULT_RENDERING_IMG_HEIGHT @STARDIS_ARGS_DEFAULT_RENDERING_IMG_HEIGHT@
+#define STARDIS_DEFAULT_RENDERING_IMG_WIDTH @STARDIS_ARGS_DEFAULT_RENDERING_IMG_WIDTH@
+#define STARDIS_DEFAULT_RENDERING_POS @STARDIS_ARGS_DEFAULT_RENDERING_POS@
+#define STARDIS_DEFAULT_RENDERING_SPP @STARDIS_ARGS_DEFAULT_RENDERING_SPP@
+#define STARDIS_DEFAULT_RENDERING_TGT @STARDIS_ARGS_DEFAULT_RENDERING_TGT@
+#define STARDIS_DEFAULT_RENDERING_TIME @STARDIS_ARGS_DEFAULT_RENDERING_TIME@
+#define STARDIS_DEFAULT_RENDERING_UP @STARDIS_ARGS_DEFAULT_RENDERING_UP@
+#define STARDIS_DEFAULT_REFERENCE_TEMP @STARDIS_ARGS_DEFAULT_REFERENCE_TEMP@
+#define STARDIS_DEFAULT_SAMPLES_COUNT @STARDIS_ARGS_DEFAULT_SAMPLES_COUNT@
+#define STARDIS_DEFAULT_SCALE_FACTOR @STARDIS_ARGS_DEFAULT_SCALE_FACTOR@
+#define STARDIS_DEFAULT_VERBOSE_LEVEL @STARDIS_ARGS_DEFAULT_VERBOSE_LEVEL@
+
+#endif /* STARDIS_DEFAULT_H */
+
diff --git a/src/stardis-output.c b/src/stardis-output.c
@@ -505,7 +505,7 @@ dump_green
fprintf(stream, "# Radiative Temperatures\n");
fprintf(stream, "# ID Rad_Temp Lin_Temp\n");
fprintf(stream, "%u\t%g\t%g\n",
- szd, stardis->radiative_temp[0], stardis->radiative_temp[1]);
+ szd, stardis->ambiant_temp, stardis->ref_temp);
fprintf(stream, "# Samples\n");
fprintf(stream,
diff --git a/src/stardis-parsing.c b/src/stardis-parsing.c
@@ -16,6 +16,7 @@
#define _GNU_SOURCE 1
#include "stardis-parsing.h"
#include "stardis-app.h"
+#include "stardis-default.h"
#include "stardis-version.h"
#include <rsys/cstr.h>
@@ -56,7 +57,7 @@ split_line
char** result = 0;
size_t count = 0;
char* tmp = a_str;
- char* last_comma = 0;
+ char* last_delim = a_str;
char delim[2];
delim[0] = a_delim;
delim[1] = 0;
@@ -64,32 +65,27 @@ split_line
ASSERT(a_str);
/* Count how many elements will be extracted. */
- while(*tmp)
- {
- if(a_delim == *tmp)
- {
+ while(*tmp) {
+ if(a_delim == *tmp) {
count++;
- last_comma = tmp;
+ last_delim = tmp;
}
tmp++;
}
/* Add space for trailing token. */
- count += last_comma < (a_str + strlen(a_str) - 1);
+ count += last_delim < (a_str + strlen(a_str) - 1);
/* Add space for terminating null string so caller
knows where the list of returned strings ends. */
count++;
result = malloc(sizeof(char*) * count);
-
- if(result)
- {
+ if(result) {
size_t idx = 0;
char* token = strtok(a_str, delim);
- while(token)
- {
+ while(token) {
ASSERT(idx < count);
#ifdef COMPILER_CL
*(result + idx++) = _strdup(token);
@@ -101,7 +97,6 @@ split_line
ASSERT(idx == count - 1);
*(result + idx) = 0;
}
-
return result;
}
@@ -291,13 +286,14 @@ init_args
args->logger = logger;
args->allocator = allocator;
darray_str_init(allocator, &args->model_files);
- /* Some fields have non-zero default values */
- args->samples = 10000;
+ /* Set default values */
+ args->samples = STARDIS_DEFAULT_SAMPLES_COUNT;
args->nthreads = DEFAULT_NTHREADS;
- args->probe[3] = INF; /* Probe time */
- args->scale_factor = 1;
- args->radiative_temp[0] = args->radiative_temp[1] = 300;
- args->verbose = 1;
+ args->probe[3] = STARDIS_DEFAULT_COMPUTE_TIME;
+ args->scale_factor = STARDIS_DEFAULT_SCALE_FACTOR;
+ args->ambiant_temp = STARDIS_DEFAULT_AMBIANT_TEMP;
+ args->ref_temp = STARDIS_DEFAULT_REFERENCE_TEMP;
+ args->verbose = STARDIS_DEFAULT_VERBOSE_LEVEL;
end:
*out_args = args;
@@ -363,7 +359,7 @@ print_multiple_modes
}
void
-print_help
+short_help
(FILE* stream,
const char* prog)
{
@@ -377,132 +373,78 @@ print_help
name = 1 + strrchr(prog, '\\');
#endif
+ fprintf(stream,
+ "Usage: %s [OPTIONS]\n"
+ "\nSolve coupled thermal systems under the linear assumption.\n"
+ "Refer to stardis(1) man page for more information.\n\n",
+ name);
print_version(stream);
- fprintf(stream, "\nUsage: \n");
- fprintf(stream, "------\n");
-
- fprintf(stream, "\n%s {-M MODEL_FILE_NAME}+\n", name);
- fprintf(stream, " [ -p X,Y,Z,TIME | -P X,Y,Z,TIME | -m MEDIUM_NAME,TIME\n");
- fprintf(stream, " | -s STL_FILE_NAME,TIME | -S STL_FILE_NAME,TIME | -F STL_FILE_NAME,TIME\n");
- fprintf(stream, " | -R t=TIME:spp=SPP:fov=FOV:up=XUP,YUP,ZUP:pos=X,Y,Z:tgt=XT,YT,ZT:img=WxH ]\n");
- fprintf(stream, " [-d] [-D {all|error|success}] [-g] [-f SCALE_FACTOR] [-n REALIZATIONS_COUNT]\n");
- fprintf(stream, " [-t NUM_OF_THREADS] [-r AMBIENT_RAD_TEMP:REFERENCE_TEMP]\n");
-
- fprintf(stream, "\n%s -h: print this help.\n", name);
-
- fprintf(stream, "\n%s -v: print stardis-app version.\n", name);
-
- fprintf(stream, "\nMandatory arguments:\n");
- fprintf(stream, "--------------------\n");
-
- fprintf(stream, "\n -M <MODEL_FILE_NAME>:\n");
- fprintf(stream, " Add a text file that contains (partial) description of the model.\n");
- fprintf(stream, " Can include both media and boundary conditions, in any order.\n");
- fprintf(stream, " Can be used more than once if description is split across different files.\n");
-
- fprintf(stream, "\nExclusive arguments:\n");
- fprintf(stream, "--------------------\n");
-
- fprintf(stream, "\n -p X,Y,Z,TIME:\n");
- fprintf(stream, " Compute the temperature at the given probe.\n");
- fprintf(stream, " The probe must be in a medium.\n");
-
- fprintf(stream, "\n -P X,Y,Z,TIME:\n");
- fprintf(stream, " Compute the temperature at the given probe on an interface.\n");
- fprintf(stream, " The probe is suposed to be on an interface and is adjusted to the\n");
- fprintf(stream, " closest point of the closest interface.\n");
-
- fprintf(stream, "\n -m MEDIUM_NAME,TIME:\n");
- fprintf(stream, " Compute the mean temperature in a given medium at a given time. The medium\n");
- fprintf(stream, " doesn't need to be connex.\n");
-
- fprintf(stream, "\n -s STL_FILE_NAME,TIME:\n");
- fprintf(stream, " Compute the mean temperature on a given 2D region at a given time, the\n");
- fprintf(stream, " region being defined as the front sides of the triangles in the provided\n");
- fprintf(stream, " file. These triangles are not added to the geometry, but must be already\n");
- fprintf(stream, " part of it. The region doesn't need to be connex.\n");
-
- fprintf(stream, "\n -S STL_FILE_NAME,TIME:\n");
- fprintf(stream, " Compute the by-triangle mean temperature on a given 2D region at a given\n");
- fprintf(stream, " time, the region being defined as the front sides of the triangles in the\n");
- fprintf(stream, " provided file. These triangles are not added to the geometry, but must be\n");
- fprintf(stream, " already part of it. The region doesn't need to be connex.\n");
-
- fprintf(stream, "\n -F STL_FILE_NAME,TIME:\n");
- fprintf(stream, " Compute the mean flux on a given 2D region at a given time, the region\n");
- fprintf(stream, " being defined as the front sides of the triangles in the provided file.\n");
- fprintf(stream, " Flux is accounted positive when going from the front side to the back side,\n");
- fprintf(stream, " at a single-triangle scale. These triangles are not added to the geometry,\n");
- fprintf(stream, " but must be already part of it. The region doesn't need to be connex.\n");
-
- fprintf(stream, "\n -R t=TIME:spp=SPP:fov=FOV:up=XUP,YUP,ZUP:pos=X,Y,Z:tgt=XT,YT,ZT:img=WxH:\n");
- fprintf(stream, " Compute an infra-red image of the model and dump it to stdout in VTK format.\n");
- fprintf(stream, " t is the rendering time (default: INF).\n");
- fprintf(stream, " spp is the number of samples per pixel (default: 4).\n");
- fprintf(stream, " fov is the field of view (default: 70 degrees).\n");
- fprintf(stream, " up is the up direction (default: 0,0,1).\n");
- fprintf(stream, " pos is the position of the camera (default: 1,1,1).\n");
- fprintf(stream, " tgt is the target of the camera (default: 0,0,0).\n");
- fprintf(stream, " img is the image resolution (default: 640x480).\n");
-
- fprintf(stream, "\nOptionnal arguments:\n");
- fprintf(stream, "--------------------\n");
-
- fprintf(stream, "\n -d:\n");
- fprintf(stream, " Dump the geometry to stdout in VTK format along with various properties,\n");
- fprintf(stream, " including possible errors. If this option is used, no computation occurs.\n");
- fprintf(stream, " Using this option in conjunction with an options that specifies a compute\n");
- print_multiple_modes(buf, sizeof(buf), SURFACE_COMPUTE_MODES, 0);
- fprintf(stream, " region (%s) has the effect to include the region in the dump.\n", buf);
- fprintf(stream, " This option cannot be used in conjunction with other dump options.\n");
- print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_VTK);
- fprintf(stream, " (%s).\n", buf);
-
- fprintf(stream, "\n -D TYPE:\n");
- fprintf(stream, " Dump thermal paths of type TYPE to stdout in VTK format.\n");
- fprintf(stream, " Type can be:\n");
- fprintf(stream, " - error (paths ending in error),\n");
- fprintf(stream, " - success (successful paths)\n");
- fprintf(stream, " - all (all paths).\n");
-
- fprintf(stream, " This option can only be used in conjuction with an option that runs a\n");
- print_multiple_modes(buf, sizeof(buf), COMPUTE_MODES, 0);
- fprintf(stream, " computation (%s) and cannot be used in conjunction\n", buf);
- print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_PATHS);
- fprintf(stream, " with other dump options (%s).\n", buf);
-
- fprintf(stream, "\n -g:\n");
- fprintf(stream, " Change the required computation to produce the green function at t=INF\n");
- fprintf(stream, " and dump it to stdout.\n");
- print_multiple_modes(buf, sizeof(buf), GREEN_COMPATIBLE_MODES, 0);
- fprintf(stream, " Can only be used in conjonction with one these options: %s\n", buf);
- fprintf(stream, " The provided TIME is silently ignored.\n");
-
- fprintf(stream, "\n -f SCALE_FACTOR.\n");
- fprintf(stream, " Rescale the geometry before sending it to the solver.\n");
-
- fprintf(stream, "\n -n NUM_OF_REALIZATIONS:\n");
- fprintf(stream, " Set the number of Monte-Carlo realizations.\n");
- fprintf(stream, " Default value: 10000.\n");
-
- fprintf(stream, "\n -t NUM_OF_THREADS:\n");
- fprintf(stream, " Set the number of threads.\n");
- fprintf(stream, " Default is to use all threads available.\n");
-
- fprintf(stream, "\n -r AMBIENT_RAD_TEMP,REFERENCE_TEMP:\n");
- fprintf(stream, " Set the parameters for the radiative transfer.\n");
- fprintf(stream, " AMBIENT_RAD_TEMP is the ambient radiative temperature .\n");
- fprintf(stream, " REFERENCE_TEMP is the temperature used for the linearization of the\n");
- fprintf(stream, " radiative transfer.\n");
- fprintf(stream, " Default values: 300 and 300.\n");
-
- fprintf(stream, "\n -V LEVEL:\n");
- fprintf(stream, " Set the verbosity level.\n");
- fprintf(stream, " Level can be:\n");
- fprintf(stream, " - 0 (non-verbose),\n");
- fprintf(stream, " - 1 (errors only, default),\n");
- fprintf(stream, " - 2 (errors and warnings),\n");
- fprintf(stream, " - 3 (errors, warnings and messages).\n");
+
+ fprintf(stream, "\nMandatory arguments\n");
+ fprintf(stream, "-------------------\n");
+
+ fprintf(stream, "\n -M <FILE>\n");
+ fprintf(stream, " Read a text file that contains (partial) description of the model.\n");
+
+ fprintf(stream, "\nExclusive arguments\n");
+ fprintf(stream, "-------------------\n");
+
+ fprintf(stream, "\n -F STL_FILE,TIME\n");
+ fprintf(stream, " Compute the mean flux on a given 2D region at a given time.\n");
+
+ fprintf(stream, "\n -m MEDIUM_NAME,TIME\n");
+ fprintf(stream, " Compute the mean temperature in a given medium at a given time.\n");
+
+ fprintf(stream, "\n -p X,Y,Z,TIME\n");
+ fprintf(stream, " Compute the temperature at the given probe.\n");
+
+ fprintf(stream, "\n -P X,Y,Z,TIME\n");
+ fprintf(stream, " Compute the temperature at the given probe on an interface.\n");
+
+ fprintf(stream, "\n -R [RENDERING_OPTIONS]\n");
+ fprintf(stream, " Compute an infra-red image of the model.\n");
+
+ fprintf(stream, "\n -s STL_FILE,TIME\n");
+ fprintf(stream, " Compute the mean temperature on a given 2D region.\n");
+
+ fprintf(stream, "\n -S STL_FILE,TIME\n");
+ fprintf(stream, " Compute the by-triangle mean temperature on a given 2D region.\n");
+
+ fprintf(stream, "\nOptionnal arguments\n");
+ fprintf(stream, "-------------------\n");
+
+ fprintf(stream, "\n -a AMBIENT_TEMP\n");
+ fprintf(stream, " Set the ambient radiative temperature .\n");
+
+ fprintf(stream, "\n -d\n");
+ fprintf(stream, " Dump the geometry to stdout in VTK format along with various properties.\n");
+
+ fprintf(stream, "\n -D TYPE\n");
+ fprintf(stream, " Dump thermal paths of the given TYPE to stdout in VTK format.\n");
+
+ fprintf(stream, "\n -f SCALE_FACTOR\n");
+ fprintf(stream, " Rescale the geometry before sending it to the solver.\n");
+
+ fprintf(stream, "\n -g\n");
+ fprintf(stream, " Change the required computation to produce the green function.\n");
+
+ fprintf(stream, "\n -h\n");
+ fprintf(stream, " Print this help and exit.\n", name);
+
+ fprintf(stream, "\n -n SAMPLE_COUNT\n");
+ fprintf(stream, " Set the number of Monte-Carlo samples.\n");
+
+ fprintf(stream, "\n -r REFERENCE_TEMP\n");
+ fprintf(stream, " Set the temperature used for the linearization of the radiative transfer.\n");
+
+ fprintf(stream, "\n -t NUM_OF_THREADS\n");
+ fprintf(stream, " Hint on the number of threads.\n");
+
+ fprintf(stream, "\n -v\n");
+ fprintf(stream, " Print version information and exit.\n", name);
+
+ fprintf(stream, "\n -V LEVEL\n");
+ fprintf(stream, " Set the verbosity level.\n");
}
res_T
@@ -513,20 +455,29 @@ parse_args
{
int opt = 0, n_used = 0;
size_t len = 0;
- const char option_list[] = "hvgn:t:B:M:m:p:P:dD:s:S:F:f:r:R:V:";
+ const char option_list[] = "a:d:D:f:F:ghm:M:n:p:P:r:R:s:S:tvV:";
char buf[128];
+ static char empty_arg[1] = "";
res_T res = RES_OK;
ASSERT(argv && args);
opterr = 0; /* No default error messages */
while((opt = getopt(argc, argv, option_list)) != -1) {
+re_switch:
switch (opt) {
+
case '?': /* Unreconised option */
{
char* ptr = strchr(option_list, optopt);
- res = RES_BAD_ARG;
if(ptr && ptr[1] == ':') {
+ /* As a special case -R option can accept an empty argument */
+ if(optopt == 'R') {
+ opt = optopt;
+ optarg = empty_arg;
+ goto re_switch; /* retry switch */
+ }
+ res = RES_BAD_ARG;
logger_print(args->logger, LOG_ERROR,
"Missing argument for option -%c\n",
optopt);
@@ -536,48 +487,119 @@ parse_args
goto error;
}
- case 'h':
+ case 'a':
+ res = cstr_to_double(optarg, &args->ambiant_temp);
+ if(res != RES_OK
+ || args->ambiant_temp < 0)
+ {
+ if(res == RES_OK) res = RES_BAD_ARG;
+ logger_print(args->logger, LOG_ERROR,
+ "Invalid argument for option -%c: %s\n",
+ opt, optarg);
+ goto error;
+ }
+ break;
+
+ case 'd':
if(args->mode & USE_STDOUT_MODES) {
res = RES_BAD_ARG;
- print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_HELP);
+ print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_VTK);
logger_print(args->logger, LOG_ERROR,
"Option -%c cannot be used in conjunction with other dump options (%s).\n",
(char)opt, buf);
goto error;
}
- args->mode |= DUMP_HELP;
+ args->mode |= DUMP_VTK;
break;
- case 'v':
+ case 'D':
+ if(0 == strcmp(optarg, "all")) {
+ args->dump_paths = DUMP_ALL;
+ }
+ else if(0 == strcmp(optarg, "error")) {
+ args->dump_paths = DUMP_ERROR;
+ }
+ else if(0 == strcmp(optarg, "success")) {
+ args->dump_paths = DUMP_SUCCESS;
+ } else {
+ res = RES_BAD_ARG;
+ logger_print(args->logger, LOG_ERROR,
+ "Invalid argument for option -%c: %s\n",
+ opt, optarg);
+ goto error;
+ }
if(args->mode & USE_STDOUT_MODES) {
res = RES_BAD_ARG;
- print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_VERSION);
+ print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_PATHS);
logger_print(args->logger, LOG_ERROR,
"Option -%c cannot be used in conjunction with other dump options (%s).\n",
(char)opt, buf);
goto error;
}
- args->mode |= DUMP_VERSION;
+ if(!(args->mode & COMPUTE_MODES)) {
+ res = RES_BAD_ARG;
+ print_multiple_modes(buf, sizeof(buf), COMPUTE_MODES, 0);
+ logger_print(args->logger, LOG_ERROR,
+ "Option -%c can only be used in conjunction with a compute option (%s).\n",
+ (char)opt, buf);
+ goto error;
+ }
+ args->mode |= DUMP_PATHS;
break;
+ case 'f':
+ res = cstr_to_double(optarg, &args->scale_factor);
+ if(res != RES_OK
+ || args->scale_factor <= 0)
+ {
+ if(res == RES_OK) res = RES_BAD_ARG;
+ logger_print(args->logger, LOG_ERROR,
+ "Invalid argument for option -%c: %s\n",
+ opt, optarg);
+ goto error;
+ }
+ break;
+
+ /*case 'F': see 's' */
+
case 'g':
args->mode |= GREEN_MODE;
break;
- case 'n': {
- unsigned long n;
- res = cstr_to_ulong(optarg, &n);
- if(res != RES_OK
- || n == 0)
- {
- if(res == RES_OK) res = RES_BAD_ARG;
+ case 'h':
+ if(args->mode & USE_STDOUT_MODES) {
+ res = RES_BAD_ARG;
+ print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_HELP);
+ logger_print(args->logger, LOG_ERROR,
+ "Option -%c cannot be used in conjunction with other dump options (%s).\n",
+ (char)opt, buf);
+ goto error;
+ }
+ args->mode |= DUMP_HELP;
+ break;
+
+ case 'm': {
+ char* ptr;
+ if(args->mode & EXCLUSIVE_MODES) {
+ res = RES_BAD_ARG;
+ logger_print(args->logger, LOG_ERROR,
+ "Modes -%c and -%c are exclusive.\n",
+ (char)opt, mode_option(args->mode));
+ goto error;
+ }
+ args->mode |= MEDIUM_COMPUTE;
+ ptr = strpbrk(optarg, ",");
+ if(!ptr || ptr == optarg)
+ res = RES_BAD_ARG;
+ else res = cstr_to_double(ptr + 1, args->probe + 3);
+ if(res != RES_OK) {
logger_print(args->logger, LOG_ERROR,
"Invalid argument for option -%c: %s\n",
opt, optarg);
goto error;
}
- args->samples = n;
- n_used = 1;
+ *ptr = '\0';
+ args->medium_name = optarg;
break;
}
@@ -589,11 +611,11 @@ parse_args
str_release(&name);
break;
}
-
- case 't':
- res = cstr_to_uint(optarg, &args->nthreads);
+ case 'n': {
+ unsigned long n;
+ res = cstr_to_ulong(optarg, &n);
if(res != RES_OK
- || args->nthreads <= 0)
+ || n == 0)
{
if(res == RES_OK) res = RES_BAD_ARG;
logger_print(args->logger, LOG_ERROR,
@@ -601,7 +623,10 @@ parse_args
opt, optarg);
goto error;
}
+ args->samples = n;
+ n_used = 1;
break;
+ }
case 'p':
if(args->mode & EXCLUSIVE_MODES) {
@@ -613,9 +638,10 @@ parse_args
}
args->mode |= PROBE_COMPUTE;
res = cstr_to_list_double(optarg, ',', args->probe, &len, 4);
- if(len != 4
- || res != RES_OK
- || args->probe[3] < 0)
+ if(res != RES_OK
+ || len < 3
+ || (len == 4 && args->probe[3] < 0)
+ || len > 4)
{
if(res == RES_OK) res = RES_BAD_ARG;
logger_print(args->logger, LOG_ERROR,
@@ -635,9 +661,23 @@ parse_args
}
args->mode |= PROBE_COMPUTE_ON_INTERFACE;
res = cstr_to_list_double(optarg, ',', args->probe, &len, 4);
- if(len != 4
- || res != RES_OK
- || args->probe[3] < 0)
+ if(res != RES_OK
+ || len < 3
+ || (len == 4 && args->probe[3] < 0)
+ || len > 4)
+ {
+ if(res == RES_OK) res = RES_BAD_ARG;
+ logger_print(args->logger, LOG_ERROR,
+ "Invalid argument for option -%c: %s\n",
+ opt, optarg);
+ goto error;
+ }
+ break;
+
+ case 'r':
+ res = cstr_to_double(optarg, &args->ref_temp);
+ if(res != RES_OK
+ || args->ref_temp < 0)
{
if(res == RES_OK) res = RES_BAD_ARG;
logger_print(args->logger, LOG_ERROR,
@@ -647,6 +687,18 @@ parse_args
}
break;
+ case 'R':
+ if(args->mode & EXCLUSIVE_MODES) {
+ res = RES_BAD_ARG;
+ logger_print(args->logger, LOG_ERROR,
+ "Modes -%c and -%c are exclusive.\n",
+ (char)opt, mode_option(args->mode));
+ goto error;
+ }
+ args->mode |= IR_COMPUTE;
+ args->camera = optarg;
+ break;
+
case 's':
case 'S':
case 'F': {
@@ -691,97 +743,10 @@ parse_args
break;
}
- case 'm': {
- char* ptr;
- if(args->mode & EXCLUSIVE_MODES) {
- res = RES_BAD_ARG;
- logger_print(args->logger, LOG_ERROR,
- "Modes -%c and -%c are exclusive.\n",
- (char)opt, mode_option(args->mode));
- goto error;
- }
- args->mode |= MEDIUM_COMPUTE;
- ptr = strpbrk(optarg, ",");
- if(!ptr || ptr == optarg)
- res = RES_BAD_ARG;
- else res = cstr_to_double(ptr + 1, args->probe + 3);
- if(res != RES_OK) {
- logger_print(args->logger, LOG_ERROR,
- "Invalid argument for option -%c: %s\n",
- opt, optarg);
- goto error;
- }
- *ptr = '\0';
- args->medium_name = optarg;
- break;
- }
-
- case 'd':
- if(args->mode & USE_STDOUT_MODES) {
- res = RES_BAD_ARG;
- print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_VTK);
- logger_print(args->logger, LOG_ERROR,
- "Option -%c cannot be used in conjunction with other dump options (%s).\n",
- (char)opt, buf);
- goto error;
- }
- args->mode |= DUMP_VTK;
- break;
-
- case 'D':
- if(0 == strcmp(optarg, "all")) {
- args->dump_paths = DUMP_ALL;
- }
- else if(0 == strcmp(optarg, "error")) {
- args->dump_paths = DUMP_ERROR;
- }
- else if(0 == strcmp(optarg, "success")) {
- args->dump_paths = DUMP_SUCCESS;
- } else {
- res = RES_BAD_ARG;
- logger_print(args->logger, LOG_ERROR,
- "Invalid argument for option -%c: %s\n",
- opt, optarg);
- goto error;
- }
- if(args->mode & USE_STDOUT_MODES) {
- res = RES_BAD_ARG;
- print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_PATHS);
- logger_print(args->logger, LOG_ERROR,
- "Option -%c cannot be used in conjunction with other dump options (%s).\n",
- (char)opt, buf);
- goto error;
- }
- if(!(args->mode & COMPUTE_MODES)) {
- res = RES_BAD_ARG;
- print_multiple_modes(buf, sizeof(buf), COMPUTE_MODES, 0);
- logger_print(args->logger, LOG_ERROR,
- "Option -%c can only be used in conjunction with a compute option (%s).\n",
- (char)opt, buf);
- goto error;
- }
- args->mode |= DUMP_PATHS;
- break;
-
- case 'f':
- res = cstr_to_double(optarg, &args->scale_factor);
- if(res != RES_OK
- || args->scale_factor <= 0)
- {
- if(res == RES_OK) res = RES_BAD_ARG;
- logger_print(args->logger, LOG_ERROR,
- "Invalid argument for option -%c: %s\n",
- opt, optarg);
- goto error;
- }
- break;
-
- case 'r':
- res = cstr_to_list_double(optarg, ',', args->radiative_temp, &len, 2);
+ case 't':
+ res = cstr_to_uint(optarg, &args->nthreads);
if(res != RES_OK
- || len != 2
- || args->radiative_temp[0] < 0
- || args->radiative_temp[1] < 0)
+ || args->nthreads <= 0)
{
if(res == RES_OK) res = RES_BAD_ARG;
logger_print(args->logger, LOG_ERROR,
@@ -791,16 +756,16 @@ parse_args
}
break;
- case 'R':
- if(args->mode & EXCLUSIVE_MODES) {
+ case 'v':
+ if(args->mode & USE_STDOUT_MODES) {
res = RES_BAD_ARG;
+ print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_VERSION);
logger_print(args->logger, LOG_ERROR,
- "Modes -%c and -%c are exclusive.\n",
- (char)opt, mode_option(args->mode));
+ "Option -%c cannot be used in conjunction with other dump options (%s).\n",
+ (char)opt, buf);
goto error;
}
- args->mode |= IR_COMPUTE;
- args->camera = optarg;
+ args->mode |= DUMP_VERSION;
break;
case 'V':
@@ -908,7 +873,10 @@ parse_camera
ERR(cstr_to_list_double(opt[1], ',', cam->pos, &len, 3));
}
else if(strcmp(opt[0], "IMG") == 0) {
- ERR(cstr_to_list_uint(opt[1], 'x', cam->img, &len, 2));
+ unsigned img_sz[2];
+ ERR(cstr_to_list_uint(opt[1], 'x', img_sz, &len, 2));
+ cam->img_width = img_sz[0];
+ cam->img_height = img_sz[1];
}
else if(strcmp(opt[0], "SPP") == 0) {
ERR(cstr_to_uint(opt[1], &cam->spp));
diff --git a/src/stardis-parsing.h b/src/stardis-parsing.h
@@ -94,7 +94,7 @@ struct args {
double probe[4];
enum stardis_mode mode;
double scale_factor;
- double radiative_temp[2];
+ double ambiant_temp, ref_temp;
char* camera;
enum dump_path_type dump_paths;
int verbose;
@@ -159,7 +159,7 @@ print_version
(FILE* stream);
extern void
-print_help
+short_help
(FILE* stream,
const char* prog);
diff --git a/src/stardis-version.h.in b/src/stardis-version.h.in
@@ -13,12 +13,12 @@
* 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 STARDIS_VERSION_H
-#define STARDIS_VERSION_H
+#ifndef STARDIS_APP_VERSION_H
+#define STARDIS_APP_VERSION_H
#define STARDIS_APP_VERSION_MAJOR @VERSION_MAJOR@
#define STARDIS_APP_VERSION_MINOR @VERSION_MINOR@
#define STARDIS_APP_VERSION_PATCH @VERSION_PATCH@
-#endif /* STARDIS_VERSION_H */
+#endif /* STARDIS_APP_VERSION_H */