stardis-green

Post-processing of green functions
git clone git://git.meso-star.fr/stardis-green.git
Log | Files | Refs | README | LICENSE

commit 154e2fcb1b7aed3686346eb3b197019b2cc8ed37
parent 32cf5ffe8bff25200be12dcb9013623795558aba
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Sat, 27 Apr 2024 14:02:27 +0200

Merge branch 'release_0.5'

Diffstat:
M.gitignore | 13+++++++------
AMakefile | 115+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MREADME.md | 64+++++++++++++++++++++++++++++++++++-----------------------------
Dcmake/CMakeLists.txt | 142-------------------------------------------------------------------------------
Dcmake/doc/CMakeLists.txt | 149-------------------------------------------------------------------------------
Aconfig.mk | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adoc/sgreen-input.5 | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/sgreen-input.5.txt | 102-------------------------------------------------------------------------------
Ddoc/sgreen-man.css | 96-------------------------------------------------------------------------------
Adoc/sgreen-output.5 | 123+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/sgreen-output.5.txt | 126-------------------------------------------------------------------------------
Adoc/sgreen.1.in | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/sgreen.1.txt.in | 117-------------------------------------------------------------------------------
Amake.sh | 39+++++++++++++++++++++++++++++++++++++++
Msrc/green-args.c | 2+-
Msrc/green-args.h | 2+-
Msrc/green-compute.c | 2+-
Msrc/green-compute.h | 2+-
Msrc/green-default.h.in | 2+-
Msrc/green-input.c | 2+-
Msrc/green-main.c | 4++--
Msrc/green-output.c | 55+++++--------------------------------------------------
Msrc/green-output.h | 7+++----
Msrc/green-types.h | 4++--
Msrc/green-version.h.in | 2+-
25 files changed, 657 insertions(+), 832 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,12 +1,13 @@ .gitignore -CMakeCache.txt -CMakeFiles -Makefile -tmp [Bb]uild* *.sw[po] -*.[ao] -*.orig +*.[aod] +*.so *~ +.config +doc/sgreen.1 +src/green-default.h +src/green-version.h +sgreen tags diff --git a/Makefile b/Makefile @@ -0,0 +1,115 @@ +# Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) +# +# 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 + +default: build_executable + +################################################################################ +# Program building +################################################################################ +SRC =\ + src/green-args.c\ + src/green-compute.c\ + src/green-input.c\ + src/green-main.c\ + src/green-output.c +OBJ = $(SRC:.c=.o) +DEP = $(SRC:.c=.d) + +# Headers to configure +HDR =\ + src/green-default.h\ + src/green-version.h + +build_executable: .config $(HDR) $(DEP) + @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) sgreen + +$(DEP) $(HDR) $(OBJ): config.mk + +sgreen: $(OBJ) + $(CC) $(CFLAGS) $(DPDC_CFLAGS) -o $@ $(OBJ) $(LDFLAGS) $(DPDC_LIBS) + +.config: config.mk + @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \ + echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi + @if ! $(PKG_CONFIG) --atleast-version $(STARDIS_VERSION) stardis; then \ + echo "stardis $(STARDIS_VERSION) not found" >&2; exit 1; fi + @echo "config done" > $@ + +src/green-default.h: src/green-default.h.in + sed -e 's#@GREEN_ARGS_DEFAULT_VERBOSE_LEVEL@#$(GREEN_ARGS_DEFAULT_VERBOSE_LEVEL)#g'\ + $@.in > $@ + +src/green-version.h: src/green-version.h.in + sed -e 's/@GREEN_VERSION_MAJOR@/$(VERSION_MAJOR)/' \ + -e 's/@GREEN_VERSION_MINOR@/$(VERSION_MINOR)/' \ + -e 's/@GREEN_VERSION_PATCH@/$(VERSION_PATCH)/' \ + $@.in > $@ + +.SUFFIXES: .c .d .o +.c.d: + @$(CC) $(CFLAGS) $(DPDC_CFLAGS) -MM -MT "$(@:.d=.o) $@" $< -MF $@ + +.c.o: + $(CC) $(CFLAGS) $(DPDC_CFLAGS) -c $< -o $@ + +################################################################################ +# Manual pages +################################################################################ +man: doc/sgreen.1 + +doc/sgreen.1: doc/sgreen.1.in + sed -e 's#@GREEN_ARGS_DEFAULT_VERBOSE_LEVEL@#$(GREEN_ARGS_DEFAULT_VERBOSE_LEVEL)#g'\ + $@.in > $@ + +################################################################################ +# Installation +################################################################################ +install: build_executable man + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/bin" sgreen + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man1" doc/sgreen.1 + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man5" doc/sgreen-input.5 + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man5" doc/sgreen-output.5 + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/doc/stardis" COPYING + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/doc/stardis" README.md + +uninstall: + rm -f "$(DESTDIR)$(PREFIX)/bin/sgreen" + rm -f "$(DESTDIR)$(PREFIX)/share/man/man1/sgreen.1" + rm -f "$(DESTDIR)$(PREFIX)/share/man/man5/sgreen-input.5" + rm -f "$(DESTDIR)$(PREFIX)/share/man/man5/sgreen-output.5" + rm -f "$(DESTDIR)$(PREFIX)/share/doc/stardis/COPYING" + rm -f "$(DESTDIR)$(PREFIX)/share/doc/stardis/README.md" + +################################################################################ +# Miscellaneous targets +################################################################################ +all: build_library build_tests + +clean: + rm -f $(OBJ) $(HDR) .config sgreen doc/sgreen.1 + +distclean: clean + rm -f $(DEP) + +lint: man + shellcheck -o all make.sh + mandoc -Tlint -Wall doc/sgreen.1 || [ $$? -le 1 ] + mandoc -Tlint -Wall doc/sgreen-input.5 || [ $$? -le 1 ] + mandoc -Tlint -Wall doc/sgreen-output.5 || [ $$? -le 1 ] diff --git a/README.md b/README.md @@ -1,37 +1,42 @@ -# sgreen +# Stardis Green -## Overview +Stardis Green is a postprocess of Green function binary files, as +produced by the [Stardis](https://gitlab.com/meso-star/stardis) program. +Its main purpose is to compute Monte Carlo results by applying Green +functions to new settings, enabling ultra-fast Monte Carlo computations. -sgreen is a postprocess of Green function binary files, as produced by the -*stardis* program (https://gitlab.com/meso-star/stardis). The main purpose -of sgreen is to compute Monte-Carlo results by applying Green functions to -new settings, enabling ultra-fast Monte-Carlo computations. +## Requirements -## How to build +- C compiler with OpenMP support +- POSIX make +- pkg-config +- [RSys](https://gitlab.com/vaplv/rsys) +- [Stardis](https://gitlab.com/meso-star/stardis) -Sgreen relies on the [CMake](http://www.cmake.org) and the -[RCMake](https://gitlab.com/vaplv/rcmake/) package to build. -It also depends on the -[RSys](https://gitlab.com/vaplv/rsys/) library as well as on the -[OpenMP](http://www.openmp.org) 2.0 specification to parallelize its -computations. Finally, sgreen depends on the header file in -[Stardis-green-types](https://gitlab.com/meso-star/stardis.git) to define -the format of its input files. +## Installation -First ensure that CMake and a C compiler that implements the OpenMP 2.0 -specification are installed on your system. Then install the RCMake package as -well as all the aforementioned prerequisites. Finally generate the project from -the `cmake/CMakeLists.txt` file by appending to the `CMAKE_PREFIX_PATH` -variable the install directories of its dependencies. +Edit config.mk as needed, then run: + + make clean install ## Release notes -## Version 0.4 +### Version 0.5 + +- Write the man pages directly in mdoc's roff macros, instead of using + the intermediate asciidoc source. +- Replace CMake by Makefile as build system. +- Update compiler and linker flags to increase the security and + robustness of generated binaries. +- Provide a pkg-config file to link the library as an external + dependency. + +### Version 0.4 - Change input file format to cope with stardis changes. -- Now depends on the stardis-green-types.h header file, that is installed - when building stardis and describes the types used to read and write Green - function binary files. Currently depends on version 4. +- Now depends on the stardis-green-types.h header file, that is + installed when building stardis and describes the types used to read + and write Green function binary files. Currently depends on version 4. ### Version 0.3 @@ -57,12 +62,13 @@ Fix a bug that could cause a crash. - Compatible with stardis v0.5.0 binary Green function files. - Can produce a summary of a Green function in HTML format. -- Can apply a Green function to new settings and output the corresponding Monte-Carlo results. +- Can apply a Green function to new settings and output the + corresponding Monte Carlo results. ## License -Copyright (C) 2020-2022 |Meso|Star> (<contact@meso-star.com>). Stardis-Green 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. +Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com). +Stardis-Green 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,142 +0,0 @@ -# Copyright (C) 2020-2022 |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/>. - -cmake_minimum_required(VERSION 3.0) -project(sgreen C) - -set(GREEN_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) - -if(CMAKE_HOST_UNIX) - set(GREEN_DOC "TROFF" CACHE STRING - "Type of documentation to generate and install.") -else() - set(GREEN_DOC "HTML" CACHE STRING - "Type of documentation to generate and install.") -endif() - -set_property(CACHE GREEN_DOC PROPERTY STRINGS - "HTML" - "TROFF" - "TROFF & HTML" - "NONE") - -############################################################################### -# Generate files -############################################################################### -set(GREEN_ARGS_DEFAULT_VERBOSE_LEVEL "1") - -configure_file(${GREEN_SOURCE_DIR}/../doc/sgreen.1.txt.in - ${CMAKE_CURRENT_BINARY_DIR}/doc/sgreen.1.txt @ONLY) - -set(GREEN_VERSION_MAJOR 0) -set(GREEN_VERSION_MINOR 4) -set(GREEN_VERSION_PATCH 0) -set(GREEN_VERSION ${GREEN_VERSION_MAJOR}.${GREEN_VERSION_MINOR}.${GREEN_VERSION_PATCH}) - -configure_file(${GREEN_SOURCE_DIR}/green-default.h.in - ${CMAKE_CURRENT_BINARY_DIR}/green-default.h @ONLY) - -configure_file(${GREEN_SOURCE_DIR}/green-version.h.in - ${CMAKE_CURRENT_BINARY_DIR}/green-version.h @ONLY) - -############################################################################### -# Check dependencies -############################################################################### -find_package(RCMake 0.4 REQUIRED) -find_package(RSys 0.12 REQUIRED) -find_package(stardis-green-types 4 REQUIRED) -find_package(OpenMP 2.0 REQUIRED) -if(MSVC) - find_package(MuslGetopt REQUIRED) -endif() - -include_directories( - ${RSys_INCLUDE_DIR} - ${CMAKE_CURRENT_BINARY_DIR}) -if(MSVC) - include_directories(${MuslGetopt_INCLUDE_DIR}) -endif() - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR}) -include(rcmake) -include(rcmake_runtime) - -if(CMAKE_COMPILER_IS_GNUCC) - rcmake_append_runtime_dirs(_runtime_dirs RSys) -endif() -if(MSVC) - rcmake_append_runtime_dirs(_runtime_dirs RSys MuslGetopt) -endif() - -############################################################################### -# Build subprojects -############################################################################### -if(NOT GREEN_DOC STREQUAL "NONE") - add_subdirectory(doc) -endif() - -############################################################################### -# Configure and define targets -############################################################################### -set(GREEN_FILES_SRC - green-args.c - green-compute.c - green-input.c - green-main.c - green-output.c) - -set(GREEN_FILES_INC - green-args.h - green-compute.h - green-output.h - green-types.h - green-version.h.in) - -set(GREEN_FILES_DOC COPYING README.md) - -# Prepend each file by `GREEN_SOURCE_DIR' -rcmake_prepend_path(GREEN_FILES_SRC ${GREEN_SOURCE_DIR}) -rcmake_prepend_path(GREEN_FILES_INC ${GREEN_SOURCE_DIR}) -rcmake_prepend_path(GREEN_FILES_DOC ${PROJECT_SOURCE_DIR}/../) - -add_executable(sgreen - ${GREEN_FILES_SRC} - ${GREEN_FILES_INC}) - -set_target_properties(sgreen PROPERTIES - COMPILE_FLAGS "${OpenMP_C_FLAGS}" - VERSION ${GREEN_VERSION}) - -if(CMAKE_COMPILER_IS_GNUCC) - set(MATH_LIB m) - set_target_properties(sgreen PROPERTIES LINK_FLAGS "${OpenMP_C_FLAGS}") -elseif(MSVC) - set(GETOPT_LIB MuslGetopt) -endif() - -target_link_libraries(sgreen - RSys ${GETOPT_LIB} ${MATH_LIB}) - -############################################################################### -# Define output & install directories -############################################################################### -install(TARGETS sgreen - ARCHIVE DESTINATION bin - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) - -install(FILES ${GREEN_FILES_DOC} DESTINATION share/doc/sgreen) - -rcmake_copy_runtime_libraries(sgreen) diff --git a/cmake/doc/CMakeLists.txt b/cmake/doc/CMakeLists.txt @@ -1,149 +0,0 @@ -# Copyright (C) 2020-2022 |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/>. - -cmake_minimum_required(VERSION 3.0) - -string(REGEX MATCH ".*HTML.*" _html ${GREEN_DOC}) -string(REGEX MATCH ".*ROFF.*" _roff ${GREEN_DOC}) - -set(GREEN_DOC_DIR ${PROJECT_SOURCE_DIR}/../doc) - -################################################################################ -# Look for asciidoc and a2x programs -################################################################################ -if(_html) - find_program(ASCIIDOC NAMES asciidoc asciidoc.py) - if(NOT ASCIIDOC) - unset(_html) - message(WARNING - "The `asciidoc' program is missing. " - "The sgreen HTML documentation cannot be generated.") - endif() -endif() - -if(_roff) - find_program(A2X NAMES a2x a2x.py) - if(NOT A2X) - unset(_roff) - message(WARNING - "The `a2x' program is missing. " - "The sgreen man pages cannot be generated.") - endif() -endif() - -################################################################################ -# Copy doc files -################################################################################ -set(MAN_NAMES - sgreen-input.5 - sgreen-output.5) - -if(_roff OR _html) - set(MAN_FILES) - foreach(_name IN LISTS MAN_NAMES) - set(_src ${GREEN_DOC_DIR}/${_name}.txt) - set(_dst ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt) - add_custom_command( - OUTPUT ${_dst} - COMMAND ${CMAKE_COMMAND} -E copy ${_src} ${_dst} - DEPENDS ${_src} - COMMENT "Copy the asciidoc ${_src}" - VERBATIM) - list(APPEND MAN_FILES ${_dst}) - endforeach() - add_custom_target(man-copy ALL DEPENDS ${MAN_FILES}) -endif() - -list(APPEND MAN_NAMES sgreen.1) - -################################################################################ -# ROFF man pages -################################################################################ -if(_roff) - set(A2X_OPTS -dmanpage -fmanpage) - set(MAN_FILES) - set(MAN5_FILES) - set(MAN1_FILES) - foreach(_name IN LISTS MAN_NAMES) - set(_man ${CMAKE_CURRENT_BINARY_DIR}/${_name}) - set(_txt ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt) - - add_custom_command( - OUTPUT ${_man} - COMMAND ${A2X} ${A2X_OPTS} ${_txt} - DEPENDS man-copy ${_txt} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - 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 ${_man1}) - elseif(_man5) - list(APPEND MAN5_FILES ${_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) -endif() - -################################################################################ -# HTML documentation -################################################################################ -if(_html) - set(ASCIIDOC_OPTS - -bxhtml11 - -dmanpage - --attribute themedir=${GREEN_DOC_DIR} - --theme=sgreen-man) - - set(MAN_FILES) - set(MAN5_FILES) - set(MAN1_FILES) - foreach(_name IN LISTS MAN_NAMES) - set(_man ${CMAKE_CURRENT_BINARY_DIR}/${_name}.html) - set(_txt ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt) - - add_custom_command( - OUTPUT ${_man} - COMMAND ${ASCIIDOC} ${ASCIIDOC_OPTS} ${_txt} - DEPENDS man-copy ${_txt} ${GREEN_DOC_DIR}/sgreen-man.css - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Build HTML man page ${_man}" - VERBATIM) - list(APPEND MAN_FILES ${_man}) - - string(REGEX MATCH "^.*.5.html$" _man5 ${_man}) - string(REGEX MATCH "^.*.1.html$" _man1 ${_man}) - if(_man1) - list(APPEND MAN1_FILES ${_man1}) - elseif(_man5) - list(APPEND MAN5_FILES ${_man5}) - else() - message(FATAL_ERROR "Unexpected man type") - endif() - endforeach() - add_custom_target(man-html ALL DEPENDS ${MAN_FILES}) - - install(FILES ${MAN1_FILES} DESTINATION share/doc/sgreen/html) - install(FILES ${MAN5_FILES} DESTINATION share/doc/sgreen/html) -endif() - diff --git a/config.mk b/config.mk @@ -0,0 +1,74 @@ +VERSION_MAJOR = 0 +VERSION_MINOR = 5 +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 + +GREEN_ARGS_DEFAULT_VERBOSE_LEVEL = 1 + +################################################################################ +# Tools +################################################################################ +CC = cc +PKG_CONFIG = pkg-config + +################################################################################ +# Dependencies +################################################################################ +PCFLAGS_STATIC = --static +PCFLAGS = $(PCFLAGS_$(LIB_TYPE)) + +RSYS_VERSION = 0.14 +RSYS_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys) +RSYS_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys) + +STARDIS_VERSION = 0.10 +STARDIS_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags stardis) + +DPDC_CFLAGS = $(RSYS_CFLAGS) $(STARDIS_CFLAGS) -fopenmp +DPDC_LIBS = $(RSYS_LIBS) -fopenmp -lm + +################################################################################ +# Compilation options +################################################################################ +WFLAGS =\ + -Wall\ + -Wcast-align\ + -Wconversion\ + -Wextra\ + -Wmissing-declarations\ + -Wmissing-prototypes\ + -Wshadow + +CFLAGS_HARDENED =\ + -D_FORTIFY_SOURCES=2\ + -fcf-protection=full\ + -fstack-clash-protection\ + -fstack-protector-strong + +CFLAGS_COMMON =\ + -std=c89\ + -pedantic\ + -fPIE\ + -fvisibility=hidden\ + -fstrict-aliasing\ + $(CFLAGS_HARDENED)\ + $(WFLAGS) + +CFLAGS_DEBUG = -g $(CFLAGS_COMMON) +CFLAGS_RELEASE = -O3 -DNDEBUG $(CFLAGS_COMMON) +CFLAGS = $(CFLAGS_$(BUILD_TYPE)) + +################################################################################ +# Linker options +################################################################################ +LDFLAGS_HARDENED = -Wl,-z,relro,-z,now +LDFLAGS_DEBUG = $(LDFLAGS_HARDENED) +LDFLAGS_RELEASE = -s $(LDFLAGS_HARDENED) +LDFLAGS = $(LDFLAGS_$(BUILD_TYPE)) -pie diff --git a/doc/sgreen-input.5 b/doc/sgreen-input.5 @@ -0,0 +1,101 @@ +.\" Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) +.\" +.\" 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 April 26, 2024 +.Dt SGREEN-INPUT 5 +.Os +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh NAME +.Nm sgreen-input +.Nd settings description for +.Xr sgreen 1 +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh DESCRIPTION +.Nm +is the format used by the +.Xr sgreen 1 +program to describe settings when applying a Green function. +It relies on a line-based ad-hoc syntax. +.Pp +A settings file is composed of lines of text, each one describing the +settings to apply for a Green function call. +Each line contains +.Li variable = value +pairs +in any number +.Pq at least one pair for a line to be meaningful . +A list of all legit variable names can be found in the Green function +summary, as produced by +.Xr sgreen 1 +option +.Fl s . +Except the name +.Li AMBIENT , +that refers to the ambient radiative temperature and is always a legit +name in settings, the list of names that can be used to form settings is +the list of medium and boundary case-sensitive names defined in the +.Xr stardis-input 5 +files used when creating the Green function applied to the settings. +.Pp +In what follows, text introduced by the sharp character +.Pq Li # +is a comment and is not part of the description. +Any physical quantity involved in settings files is expected in the +International System of Units +.Pq metre, kelvin, Watt . +.Pp +The file format is as follows: +.Bl -column (****************) (::) () +.It Ao Va settings Ac Ta ::= Ta +.Op Ao Va affectation Ac ... +.Op Ao Va comment Ac +.It Ta Ta ... +.It Ao Va affectation Ac Ta ::= Ta Ao Va val Ac Li = Ao Va value Ac +.It Ao Va var Ac Ta ::= Ta Ao Va description-name Ac Ns Li \&. Ns Ao Va field Ac +.It Ta \& \& | Ta Li AMBIENT No # Ambient radiative temperature +.It Ao Va description-name Ac Ta ::= Ta Vt string No # \&No space allowed +.It Ao Va field Ac Ta ::= Ta Li T No # temperature +.It Ta \& \& | Ta Li F No # flux +.It Ta \& \& | Ta Li VP No # volumic power +.It Ao Va value Ac Ta ::= Ta Vt real +.It Ao Va comment Ac Ta ::= Ta Li # Vt string +.El +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh EXAMPLES +Apply a Green function with +.Li AMBIENT +radiative temperature set to 0\& K: +.Bd -literal -offset Ds +AMBIENT = 0 +.Ed +.Pp +First apply a Green function with volumic power in medium +.Qq AL +set to 100\& W/m^3 and temperature of the +.Qq Left +boundary set to 300\& K. +Then apply it with the same variables set to 120 and 350 respectively. +Finally, apply it with the same variables set to 140 and 360 +respectively and temperature of the +.Qq Right +boundary set to 380\& K: +.Bd -literal -offset Ds +AL.VP=100 Left.T=300 +AL.VP=120 Left.T=350 +AL.VP=140 Left.T=360 Right.T=380 +.Ed +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh SEE ALSO +.Xr sgreen 1 , +.Xr stardis-input 5 diff --git a/doc/sgreen-input.5.txt b/doc/sgreen-input.5.txt @@ -1,102 +0,0 @@ -// Copyright (C) 2020-2022 |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/>. - -:toc: - -sgreen-input(5) -=============== - -NAME ----- -sgreen-input - settings description for sgreen(1) - -DESCRIPTION ------------ -*sgreen-input* is the format used by the *sgreen*(1) program to describe -settings when applying a Green function. It relies on a line-based ad-hoc -syntax. - -A settings file is composed of lines of text, each one describing the settings -to apply for a Green function call. Each line contains *variable = value* pairs -in any number (at least one pair for a line to be meaningful). A list of all -legit variable names can be found in the Green function summary, as produced -by *sgreen*(1) option *-s*. - -GRAMMAR -------- -In what follows, text appearing between quote marks has to be used verbatim in -the input, except the quote characters. Also, text introduced by the *#* -character in descriptions, when not verbatim, is a comment and is not part of -the description. - -[verse] -_______ -<settings-file> ::= <settings-line> - [ <settings-file> ] - -<settings-line> ::= [ <var> "=" <value> ] [ <settings-line> ] [ comment ] - -------------------------------------- - -<var> ::= <description-name>"."<field> - | "AMBIENT" # set ambient radiative temperature value - -<value> ::= REAL - -<comment> ::= "#" Any text introduced by the # character - -<description-name> ::= STRING # no space allowed - -<field> ::= "T" # set the temperature value - | "F" # set the flux value - | "VP" # set the volumic power value - -______________ - -NAMES ------ -Except the name AMBIENT, that refers to the ambient radiative temperature and -is always a legit name in settings, the list of names that can be used to form -settings is the list of medium and boundary case-sensitive names defined in the -*stardis-input*(5) files used when creating the Green function applied to the -settings. - -UNITS ------ -Any physical quantity involved in settings files is expected in the -International System of Units (metre, kelvin, Watt). - -EXAMPLES --------- -Apply a Green function with *AMBIENT* radiative temperature set to 0 K. -....... -AMBIENT = 0 -....... - -First apply a Green function with volumic power in medium *AL* set to 100 W/m^3^ -and temperature of the *Left* boundary set to 300 K. Then apply it with the -same variables set to 120 and 350 respectively. Finally, apply it with the -same variables set to 140 and 360 respectively and temperature of the *Right* -boundary set to 380 K. -....... -AL.VP=100 Left.T=300 -AL.VP=120 Left.T=350 -AL.VP=140 Left.T=360 Right.T=380 -....... - -SEE ALSO --------- -*sgreen*(1), -*sgreen-input*(5) diff --git a/doc/sgreen-man.css b/doc/sgreen-man.css @@ -1,96 +0,0 @@ -/* Copyright (C) 2016-2018 CNRS - * - * This is free style sheet: 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 CSS 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/. */ - -body.manpage { - font-family:"Liberation Sans",sans-serif; - font-size:10pt; - text-align: justify; - max-width: 55em; - margin: 1em; - background: #ffffff -} - -body.manpage .monospaced, .literalblock { - margin: 2em; - color: #636261 -} - -body.manpage em { - color: #660000 -} - -body.manpage div.verseblock > pre.content { - font-family: "Liberation Mono",monospace; -} - -body.manpage h1 { - padding-bottom: 0.5em; -} -body.manpage h2 { - border-style: none; -} -body.manpage div.sectionbody { - margin-left: 3em; -} - -body.manpage code { - font-family: "Liberation Mono",monospace; -} - -body.manpage #footer { display: none; } - -body.manpage div#toctitle { display: none; } - -body.manpage div#toc { - display: block; - position:fixed; - top:0; - left:60em; - height:100%; - width: 100%; - padding:3em 0 0 0; - border-left:1px solid #dbdbdb; - background: #eeeeee -} - -body.manpage a { - font-weight: bold; - color: #225588; -} - -body.manpage div#toc a, div#toc a:link, div#toc a:visited { - margin:0; - padding-left: 2em; - color:#999999; - text-decoration:none; - font-weight: normal; -} - -body.manpage div.toclevel1 { - line-height: 1.5em; -} - -body.manpage div.toclevel2 { - margin-left: 2em; -} - -body.manpage div#toc a:hover { - color:#666666; -} - -@media print { - body.manpage div#toc { display: none; } -} - diff --git a/doc/sgreen-output.5 b/doc/sgreen-output.5 @@ -0,0 +1,123 @@ +.\" Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) +.\" +.\" 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 April 26, 2024 +.Dt SGREEN-OUTPUT 5 +.Os +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh NAME +.Nm sgreen-output +.Nd output format of +.Xr sgreen 1 +results +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh DESCRIPTION +The type of the data that are generated depends on the options used when +.Xr sgreen 1 +is invoked. +When invoked with option +.Fl a , +.Xr sgreen 1 +outputs Monte Carlo results, either in extended or compact format, +whether option +.Fl e +is used or not. +.Pp +When invoked with the +.Fl s +option, +.Xr sgreen 1 +silently creates an HTML file containing a summary of the Green function +used. +As it conforms to the HTML format found in the HTML specification +documents, these will not be described in further detail below. +This summary HTML file contains the following sections: +.Bl -bullet -compact -offset indent +.It +List of variables +.It +Formula of the Monte Carlo estimate +.It +Counts +.It +Solids +.It +Fluids +.It +T boundaries for solids +.It +T boundaries for fluids +.It +H boundaries for solids +.It +H boundaries for fluids +.It +F boundaries for solids +.It +Solid-Fluid connections +.It +Solid-Solid connections +.It +Radiative temperatures +.El +.Pp +In what follows, some lines end with a backslash +.Pq Li \e . +This is used as a convenience to continue a description next line. +However, this trick cannot be used in actual description files and +actual description lines must be kept single-line. +Text introduced by the sharp character +.Pq Li # +in descriptions is a comment and is not part of the description. +.Pp +The file format for Monte Carlo results is as follows: +.Bl -column (****************) (::) () +.It Ao Va results Ac Ta ::= Ta Ao Va results-raw Ac | Ao Va results-ext Ac +.It Ao Va results-raw Ac Ta ::= Ta Ao Va estimate-raw Ac +.It Ta Ta ... +.It Ao Va results-ext Ac Ta ::= Ta Li message: Initialisation time = Aq Va time +.It Ta Ta Li message: Computation time = Aq Va time +.It Ta Ta Ao Va estimate-ext Ac +.It Ta Ta ... +.It Ao Va estimate-raw Ac Ta ::= Ta Ao Va expected-value Ac Ao Va standard-error Ac +.It Ao Va estimate-ext Ac Ta ::= Ta Ao Va expected-value Ac Li K +/- Ao Va standard-error Ac \e +.It Ta Ta Ao Va applied-settings Ac +.It \ Ta Ta +.It Ao Va expected-value Ac Ta ::= Ta Vt real +.It Ao Va standard-error Ac Ta ::= Ta Vt real +.It Ao Va time Ac Ta :: Ta +.Op Ao Va h Ac Li hour +.Op Ao Va m Ac Li min +.Op Ao Va s Ac Li sec +\e +.It Ta Ta +.Op Ao Va ms Ac Li msec +.Op Ao Va us Ac Li usec +.It Ao Va h Ac Ta ::= Ta Vt integer No # \&In Bq 1, INF +.It Ao Va m Ac Ta ::= Ta Vt integer No # \&In Bq 1, 59 +.It Ao Va s Ac Ta ::= Ta Vt integer No # \&In Bq 1, 59 +.It Ao Va ms Ac Ta ::= Ta Vt integer No # \&In Bq 1, 999 +.It Ao Va us Ac Ta ::= Ta Vt integer No # \&In Bq 1, 999 +.It Ao Va applied-settings Ac Ta ::= Ta Vt string No # Verbatim from the settings file +.El +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh SEE ALSO +.Xr sgreen 1 +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh STANDARDS +.Rs +.%A Web Hypertext Application Technology Working Group +.%T HTML Living Standard +.%U https://html.spec.whatwg.org/ +.Re diff --git a/doc/sgreen-output.5.txt b/doc/sgreen-output.5.txt @@ -1,126 +0,0 @@ -// Copyright (C) 2020-2022 |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/>. - -:toc: - -sgreen-output(5) -================ - -NAME ----- -sgreen-output - output format of sgreen(1) results - -DESCRIPTION ------------ -The type of the data that are generated depends on the options used when -*sgreen*(1) is invoked. When invoked with option *-a*, *sgreen*(1) outputs -Monte-Carlo results, either in extended or compact format, whether option *-e* -is used or not. Also, when invoked whith option *-s* *sgreen*(1) silently -creates an HTML file contening a summary of the Green function used. - -GRAMMAR -------- -As Green summaries comply with HTML format, that can be found in HTML -specification documents [1], they will not be further described thereafter. -Only Monte-Carlo results grammar is described in this section. - -In what follows, text appearing between quote marks is a verbatim part of the -output, except the quote characters, and text introduced by the *#* character -in a description is a comment and is not part of the output. - -[verse] -_______ - -<output> ::= <compact-results> - | <extended-results> - -<compact-results> ::= <compact-MC-result> # as many results as provided - <compact-results> # setting lines - -<extended-results> ::= "message: Initialisation time = " <time value> - "message: Computation time = " <time value> - <extended-MC-results> - -------------------------------------- - -<compact-MC-result> ::= <estimate> <standard-deviation> - -<extended-MC-results> ::= <extended-MC-result> # as many results as provided - | <extended-MC-results> # setting lines - -<time value> ::= [<h> "hour"] [<m> "min"] [<s> "sec"] \ - [<ms> "msec"] [<us> "usec"] - -<extended-MC-result> ::= <estimate> "K +/-" <standard-deviation> \ - ";" <applied-settings> - -<estimate> ::= REAL - -<standard-deviation> ::= REAL # in [0, INF) - -------------------------------------- - -<applied-settings> ::= ASCII TEXT # verbatim from the settings file - -<h> ::= INTEGER # in [1 INF) - -<m> ::= INTEGER # in [1 59] - -<s> ::= INTEGER # in [1 59] - -<ms> ::= INTEGER # in [1 999] - -<us> ::= INTEGER # in [1 999] -_______ - -HTML SUMMARY ------------- -When using option *-s*, *sgreen*(1) creates a summary of the Green function in -HTML format. This document contains the following sections: - -* List of variables - -* Formula of the Monte-Carlo estimate - -* Counts - -* Solids - -* Fluids - -* T boundaries for solids - -* T boundaries for fluids - -* H boundaries for solids - -* H boundaries for fluids - -* F boundaries for solids - -* Solid-Fluid connections - -* Solid-Solid connections - -* Radiative temperatures - -NOTES ------ -1. HTML Standard - <https://html.spec.whatwg.org/> - -SEE ALSO --------- -*sgreen*(1), -*sgreen-input*(5) diff --git a/doc/sgreen.1.in b/doc/sgreen.1.in @@ -0,0 +1,144 @@ +.\" Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) +.\" +.\" 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 April 26, 2024 +.Dt SGREEN 1 +.Os +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh NAME +.Nm sgreen +.Nd statistical solving of coupled thermal systems +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh SYNOPSIS +.Nm +.Op Fl ehv +.Op Fl a Pa arguments +.Op Fl g Pa green +.Op Fl s Pa summary +.Op Fl t Ar threads_count +.Op Fl V Ar verbosity_level +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh DESCRIPTION +.Nm +is a post processing tool that can be used on +.Xr stardis 1 +Green functions +.Pq a.k.a propagators , +as contained in binary files. +The main functionality is to apply different boundary conditions to a +system once solved by +.Xr stardis 1 +in Green mode +.Pq Fl G No option of Xr stardis 1 . +The provided file should comply with the +.Xr sgreen-input 5 +format. +.Pp +Using this Green function approach, when possible, produces the very +same results as a full Monte Carlo computation, but only requires a +fraction of the computation time. +.Pp +The propagator is of great value to thermal engineers as it gives some +crucial information to analyse heat transfers in the system. +It helps engineers answer questions like +.Dq 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. +.Pp +.Nm +also offers an additional feature: summarizing information on a Green +function in HTML format to help understand what's important in the +simulated system. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl a Pa arguments +Apply a Green function using the arguments listed in the +.Pa arguments +file. +Can only be applied in conjunction with option +.Fl g . +.It Fl e +Use extended format to output Monte Carlo results. +Can only be used in conjunction with option +.Fl a . +.It Fl g Pa green +Read a Green function from a file for further processing. +.It Fl h +Output short help and exit. +.It Fl s Pa summary +Create a summary of a Green function and write it to a file in HTML +format. +Can only be applied in conjunction with option +.Fl g . +.It Fl t Ar threads_count +Advice on the number of threads to use. +By default, +.Nm +uses as many threads as processor cores. +.It Fl V Ar verbosity_level +Set the verbosity level. +Possible values are +.Li 0 Pq no message , +.Li 1 Pq error messages only , +.Li 2 error and warning messages , +All the messages are written to standard error. +Default is @GREEN_ARGS_DEFAULT_VERBOSE_LEVEL@. +.It Fl v +Output version information and exit. +.El +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh EXIT STATUS +.Ex -std +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh EXAMPLES +Create a summary of the +.Pa heatsink.green +Green function and write it in the +.Pa heatsink_green.html +file: +.Bd -literal -offset Ds +sgreen -g heatsink.green -s heatsink_green.html +.Ed +.Pp +Apply the settings from the file +.Pa cube_settings.txt +to the +.Pa cube.green +Green function and output the corresponding Monte Carlo results to +stdout in extended format. +Set verbosity level to 2: +.Bd -literal -offset Ds +sgreen -g cube.green -a cube_settings.txt -e -V 2 +.Ed +.Pp +Create a summary of the +.Pa heatsink.green +Green function and write it in the +.Pa heatsink_green.html +file; also apply the settings from the file +.Pa heatsink_settings.txt +and output the corresponding Monte Carlo results to standard output in +compact format: +.Bd -literal -offset Ds +sgreen -g heatsink.green \\ + -s heatsink_green.html \\ + -a heatsink_settings.txt +.Ed +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh SEE ALSO +.Xr stardis 1 , +.Xr sgreen-input 5 , +.Xr sgreen-output 5 diff --git a/doc/sgreen.1.txt.in b/doc/sgreen.1.txt.in @@ -1,117 +0,0 @@ -// Copyright (C) 2020-2022 |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/>. - -:toc: - -sgreen(1) -========= - -NAME ----- -sgreen - postprocessing of Green functions - -SYNOPSIS --------- -[verse] -*sgreen* [_option_] - -DESCRIPTION ------------ -*sgreen* is a post processing tool that can be used on *stardis*(1) Green -functions (a.k.a propagators), as contained in binary files. The main -functionality is to apply different boundary conditions to a system once solved -by *stardis*(1) in Green mode (*-G* option of *stardis*(1)). The provided file -should comply with the *sgreen-input*(5) format, that is also the -*stardis-output*(1) format in binary Green mode. - -Using this Green function approach, when possible, produces the very same -results as a full Monte-Carlo computation, but only requires a fraction of the -computation time. - -The propagator is of great value to thermal 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. - -*sgreen*(1) also provides an additional functionality: summarize information on -a Green function in HTML format to help understand what matters on the -simulated system. - -OPTIONS -------- -*-a* _FILE_NAME_:: - Apply a Green function using the variable settings read from a file. Can only - be applied in conjunction with option *-g*. - -*-e*:: - Use extended format to output Monte-Carlo results. Can only be used in - conjunction with option *-a*. - -*-g* _GREEN_BINARY_FILE_:: - Read a Green function from a file for further processing. - -*-h*:: - Output short help and exit. - -*-s* _FILE_NAME_:: - Create a summary of a Green function and write it to a file in HTML format. - Can only be applied in conjunction with option *-g*. - -*-t* _threads-count_:: - Hint on the number of threads to use. By default use as many threads as CPU - cores. - -*-v*:: - Output version information and exit. - -*-V* _level_:: - Set the verbosity level. Possible values are *0* (no message), *1* (error - messages only), *2* (error and warning messages), and *3* (error, warning - and informative messages). All the messages are written to _standard error_. - Default verbosity *level* is @GREEN_ARGS_DEFAULT_VERBOSE_LEVEL@. - -EXAMPLES --------- -Create a summary of the *heatsink.green* Green function and write it in the -*heatsink_green.html* file: - - $ sgreen -g heatsink.green -s heatsink_green.html - -Apply the settings from the file *cube_settings.txt* to the *cube.green* Green -function and output the corresponding Monte-Carlo results to stdout in extended -format. Set verbosity level to 2. - - $ sgreen -g cube.green -a cube_settings.txt -e -V 2 - -Create a summary of the *heatsink.green* Green function and write it in the -*heatsink_green.html* file; also apply the settings from the file -*heatsink_settings.txt* and output the corresponding Monte-Carlo results to -stdout in compact format. - - $ sgreen -g heatsink.green -s heatsink_green.html -a heatsink_settings.txt - -COPYRIGHT ---------- -Copyright &copy; 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. - -SEE ALSO --------- -*sgreen-input*(5), -*sgreen-output*(5), -*stardis*(1) diff --git a/make.sh b/make.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) +# +# 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/green-args.c b/src/green-args.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 diff --git a/src/green-args.h b/src/green-args.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 diff --git a/src/green-compute.c b/src/green-compute.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 diff --git a/src/green-compute.h b/src/green-compute.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 diff --git a/src/green-default.h.in b/src/green-default.h.in @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> +/* Copyright (C) 2020-2022, 2024 |Méso|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 diff --git a/src/green-input.c b/src/green-input.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 diff --git a/src/green-main.c b/src/green-main.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 @@ -59,7 +59,7 @@ main ERR(parse_args(argc, argv, &args)); if(args.mode & MODE_HELP) { - short_help(argv[0], stdout); + usage(stdout); goto exit; } diff --git a/src/green-output.c b/src/green-output.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 @@ -52,57 +52,12 @@ print_version } void -short_help - (const char* prog, - FILE * stream) +usage(FILE * stream) { - const char* name; - ASSERT(stream && prog); - -#ifdef COMPILER_GCC - name = strrchr(prog, '/'); -#else - name = strrchr(prog, '\\'); -#endif - - name = name ? name + 1 : prog; - fprintf(stream, - "Usage: %s [OPTIONS]\n" - "\nUse a Green function created by stardis-app(1).\n" - "Refer to green(1) man page for more information.\n\n", - name); - - fprintf(stream, "\n -a <FILE>\n"); - fprintf(stream, " Apply a Green function using the variable settings " - "read from a file.\n"); - - fprintf(stream, "\n -e\n"); - fprintf(stream, " Use extended format to output Monte-Carlo results.\n"); - - fprintf(stream, "\n -g <FILE>\n"); - fprintf(stream, " Read a Green function from a file.\n"); - - fprintf(stream, "\n -h\n"); - fprintf(stream, " Print this help and exit.\n"); - - fprintf(stream, "\n -s <FILE>\n"); - fprintf(stream, " Create a summary of a Green function and write it to " - "a file.\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"); - - fprintf(stream, "\n -V LEVEL\n"); - fprintf(stream, " Set the verbosity level.\n"); fprintf(stream, -"\nCopyright (C) 2020-2022 |Meso|Star> <contact@meso-star.com>.\n" -"stardis-green is free software released under the GNU GPL license, version 3 or later.\n" -"You are free to change or redistribute it under certain conditions\n" -"<http://gnu.org/licenses/gpl.html>.\n"); + "sgreen [-ehv] [-a arguments] [-g green] [-s summary] [-t threads_count]\n" + " [-V verbosity_level]\n"); } void @@ -533,7 +488,7 @@ dump_green_info local_count++; } if(local_count) fprintf(stream, "</table>\n"); - + /* S-S connection table */ local_count = 0; FOR_EACH(i, 0, green->header.description_count) { diff --git a/src/green-output.h b/src/green-output.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 @@ -27,9 +27,8 @@ print_version (FILE* stream); void -short_help - (const char* prog, - FILE* stream); +usage + (FILE* stream); void green_print_result diff --git a/src/green-types.h b/src/green-types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2020-2022, 2024 |Méso|Star> (contact@meso-star.com) * * 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 @@ -279,7 +279,7 @@ green_release } if(green->table) { /* On error, table could be not yet allocated */ FOR_EACH(i, 0, 1 + green->header.description_count) - if(&green->table[i]) release_table_elt(&green->table[i]); + release_table_elt(&green->table[i]); MEM_RM(green->allocator, green->table); } green->allocator = NULL; diff --git a/src/green-version.h.in b/src/green-version.h.in @@ -1,4 +1,4 @@ -/* Copyright (C) 2020-2022 |Meso|Star> +/* Copyright (C) 2020-2022, 2024 |Méso|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