city_generator2

Generated conformal 3D meshes representing a city
git clone git://git.meso-star.fr/city_generator2.git
Log | Files | Refs | README | LICENSE

commit e8292d9213b30ae1d6a446f8c28af24da1d92805
parent eae8859ae65e7c492121618eed94c7d7d4d34ea3
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Wed, 12 Jun 2024 11:20:04 +0200

Merge branch 'feature_posix_make' into develop

Diffstat:
AMakefile | 137+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aconfig.mk | 126+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adoc/city_generator2-input.5 | 160+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/city_generator2-input.5.txt | 187-------------------------------------------------------------------------------
Ddoc/city_generator2-man.css | 96-------------------------------------------------------------------------------
Adoc/city_generator2-output.5 | 174+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/city_generator2-output.5.txt | 145-------------------------------------------------------------------------------
Adoc/city_generator2.1.in | 180+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/city_generator2.1.txt.in | 126-------------------------------------------------------------------------------
Amake.sh | 39+++++++++++++++++++++++++++++++++++++++
Msrc/cg.h | 3++-
Msrc/cg_catalog_parsing.c | 3+--
Msrc/cg_city_parsing.c | 3+--
Msrc/cg_city_parsing_schemas.h | 3+--
Msrc/cg_construction_mode_0_parsing_schemas.h | 2+-
Msrc/cg_construction_mode_1_parsing_schemas.h | 2+-
Msrc/cg_construction_modes_parsing_schemas.h | 2+-
Asrc/cg_cyaml.h | 31+++++++++++++++++++++++++++++++
Msrc/cg_main.c | 3+--
19 files changed, 856 insertions(+), 566 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,137 @@ +# Copyright (C) 2018-2023 |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 target +all: build_executable man + +################################################################################ +# Program building +################################################################################ +SRC =\ + src/cg_args.c\ + src/cg_building.c\ + src/cg_catalog.c\ + src/cg_catalog_parsing.c\ + src/cg_city.c\ + src/cg_city_parsing.c\ + src/cg_construction_mode_0.c\ + src/cg_construction_mode_1.c\ + src/cg_construction_mode.c\ + src/cg_ground.c\ + src/cg_main.c\ + src/cg_types.c\ + src/cg_vertex_denoiser.c + +# Headers to configure +HDR=\ + src/cg_default.h\ + src/cg_version.h + +OBJ = $(SRC:.c=.o) +DEP = $(SRC:.c=.d) + +build_executable: .config $(HDR) $(DEP) + @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) city_generator2 + +$(DEP) $(OBJ): config.mk + +city_generator2: $(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 $(SCAD_VERSION) scad; then \ + echo "scad $(SCAD_VERSION) not found" >&2; exit 1; fi + @if ! $(PKG_CONFIG) --atleast-version $(SCPR_VERSION) scpr; then \ + echo "scpr $(SCPR_VERSION) not found" >&2; exit 1; fi + @if ! $(PKG_CONFIG) --atleast-version $(LIBCYAML_VERSION) libcyaml; then \ + echo "libcyaml $(LIBCYAML_VERSION) not found" >&2; exit 1; fi + @echo "config done" > $@ + +src/cg_default.h: config.mk src/cg_default.h.in + sed -e 's/@CG2_ARGS_DEFAULT_VERBOSITY_LEVEL@/$(CG2_ARGS_DEFAULT_VERBOSITY_LEVEL)/' \ + -e 's/@CG2_ARGS_BINARY_STL_DEFAULT@/$(CG2_ARGS_BINARY_STL_DEFAULT)/' \ + -e 's/@CG2_ARGS_STL_DEFAULT_STR@/$(CG2_ARGS_STL_DEFAULT_STR)/' \ + -e 's/@CG2_ARGS_STL_NON_DEFAULT_STR@/$(CG2_ARGS_STL_NON_DEFAULT_STR)/' \ + -e 's/@CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION@/$(CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION)/' \ + -e 's/@CG2_CLOSE_NEIGHBOR_DISTANCE@/$(CG2_CLOSE_NEIGHBOR_DISTANCE)/' \ + -e 's/@CG2_MIN_DISTANCE_TO_MAP_LIMITS@/$(CG2_MIN_DISTANCE_TO_MAP_LIMITS)/' \ + -e 's/@CG2_MIN_WINDOWS_WIDTH@/$(CG2_MIN_WINDOWS_WIDTH)/' \ + $@.in > $@ + +src/cg_version.h: config.mk src/cg_version.h.in + sed -e 's/@CG2_VERSION_MAJOR@/$(VERSION_MAJOR)/' \ + -e 's/@CG2_VERSION_MINOR@/$(VERSION_MINOR)/' \ + -e 's/@CG2_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 $@ + +################################################################################ +# Man pages +################################################################################ +man: doc/city_generator2.1 doc/city_generator2-input.5 doc/city_generator2-output.5 + +doc/city_generator2.1: doc/city_generator2.1.in + sed -e 's/@CG2_ARGS_DEFAULT_VERBOSITY_LEVEL@/$(CG2_ARGS_DEFAULT_VERBOSITY_LEVEL)/' \ + -e 's/@CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION@/$(CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION)/' \ + -e 's/@CG2_ARGS_STL_NON_DEFAULT_STR@/$(CG2_ARGS_STL_NON_DEFAULT_STR)/' \ + -e 's/@CG2_ARGS_STL_DEFAULT_STR@/$(CG2_ARGS_STL_DEFAULT_STR)/' \ + $@.in > $@ + +################################################################################ +# Installation +################################################################################ +install: all + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/bin" city_generator2 + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/doc/city_generator2" COPYING README.md + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man1" doc/city_generator2.1 + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man5" doc/city_generator2-input.5 + @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man5" doc/city_generator2-output.5 + +uninstall: + rm -f "$(DESTDIR)$(PREFIX)/bin/city_generator2" + rm -f "$(DESTDIR)$(PREFIX)/share/doc/city_generator2/COPYING" + rm -f "$(DESTDIR)$(PREFIX)/share/doc/city_generator2/README.md" + rm -f "$(DESTDIR)$(PREFIX)/share/man/man1/city_generator2.1" + rm -f "$(DESTDIR)$(PREFIX)/share/man/man5/city_generator2-input.5" + rm -f "$(DESTDIR)$(PREFIX)/share/man/man5/city_generator2-output.5" + +################################################################################ +# Miscellaneous targets +################################################################################ +clean: + rm -f $(HDR) $(OBJ) .config city_generator2 doc/city_generator2.1 + +distclean: clean + rm -f $(DEP) + +lint: man + shellcheck -o all make.sh + mandoc -Tlint -Wall doc/city_generator2.1 || [ $$? -le 1 ] + mandoc -Tlint -Wall doc/city_generator2-input.5 || [ $$? -le 1 ] + mandoc -Tlint -Wall doc/city_generator2-output.5 || [ $$? -le 1 ] diff --git a/config.mk b/config.mk @@ -0,0 +1,126 @@ +VERSION_MAJOR = 0 +VERSION_MINOR = 2 +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 + +################################################################################ +# Configuration values +################################################################################ +# Default verbosity when running city_generator2 (can be changed from the command line) +CG2_ARGS_DEFAULT_VERBOSITY_LEVEL = 1 +# Default format of the output STL files (can be changed from the command line) +CG2_STL_OUTPUT_DEFAULT_IS_BINARY = 0 +# Distance up to which neighbor buildings prevent windows' creation (in m) +CG2_CLOSE_NEIGHBOR_DISTANCE = 2 +# Minimum allowed distance beetween a building and map's limits (in m) +CG2_MIN_DISTANCE_TO_MAP_LIMITS = 2 +# Minimum width for windows or they are not created (in m) +CG2_MIN_WINDOWS_WIDTH = 0.1 + +################################################################################ +# Tools +################################################################################ +AR = ar +CC = cc +LD = ld +OBJCOPY = objcopy +PKG_CONFIG = pkg-config +RANLIB = ranlib + +################################################################################ +# Dependencies +################################################################################ +PCFLAGS_SHARED = +PCFLAGS_STATIC = --static +PCFLAGS = $(PCFLAGS_$(LIB_TYPE)) + +RSYS_VERSION = 0.14 +RSYS_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys) +RSYS_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys) + +SCAD_VERSION = 0.5 +SCAD_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags scad) +SCAD_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs scad) + +SCPR_VERSION = 0.4.1 +SCPR_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags scpr) +SCPR_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs scpr) + +LIBCYAML_VERSION = 1.4.1 +LIBCYAML_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags libcyaml) +LIBCYAML_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs libcyaml) + +DPDC_CFLAGS =\ + $(RSYS_CFLAGS)\ + $(SCAD_CFLAGS)\ + $(SCPR_CFLAGS)\ + $(LIBCYAML_CFLAGS) +DPDC_LIBS =\ + $(RSYS_LIBS)\ + $(SCAD_LIBS)\ + $(SCPR_LIBS)\ + $(LIBCYAML_LIBS)\ + -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=c99\ + -pedantic\ + -fvisibility=hidden\ + -fstrict-aliasing\ + $(CFLAGS_HARDENED)\ + $(WFLAGS) + +CFLAGS_RELEASE = -O3 -DNDEBUG $(CFLAGS_COMMON) +CFLAGS_DEBUG = -g $(CFLAGS_COMMON) +CFLAGS = $(CFLAGS_$(BUILD_TYPE)) -fPIE + +################################################################################ +# Linker options +################################################################################ +LDFLAGS_HARDENED = -Wl,-z,relro,-z,now +LDFLAGS_DEBUG = $(LDFLAGS_HARDENED) +LDFLAGS_RELEASE = -s $(LDFLAGS_HARDENED) +LDFLAGS = $(LDFLAGS_$(BUILD_TYPE)) -pie + +OCPFLAGS_DEBUG = --localize-hidden +OCPFLAGS_RELEASE = --localize-hidden --strip-unneeded +OCPFLAGS = $(OCPFLAGS_$(BUILD_TYPE)) + +################################################################################ +# Other Values deduced from configuration values +################################################################################ +CG2_ARGS_STL_DEFAULT_STR_0 = ascii +CG2_ARGS_STL_DEFAULT_STR_1 = binary +CG2_ARGS_STL_NON_DEFAULT_STR_0 = binary +CG2_ARGS_STL_NON_DEFAULT_STR_1 = ascii +CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION_0 = b +CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION_1 = a +CG2_ARGS_BINARY_STL_DEFAULT = $(CG2_STL_OUTPUT_DEFAULT_IS_BINARY) +CG2_ARGS_STL_DEFAULT_STR = $(CG2_ARGS_STL_DEFAULT_STR_$(CG2_STL_OUTPUT_DEFAULT_IS_BINARY)) +CG2_ARGS_STL_NON_DEFAULT_STR = $(CG2_ARGS_STL_NON_DEFAULT_STR_$(CG2_STL_OUTPUT_DEFAULT_IS_BINARY)) +CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION = $(CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION_$(CG2_STL_OUTPUT_DEFAULT_IS_BINARY)) diff --git a/doc/city_generator2-input.5 b/doc/city_generator2-input.5 @@ -0,0 +1,160 @@ +.\" Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA +.\" Copyright (C) 2022-2023 CNRS +.\" Copyright (C) 2022-2023 Sorbonne Université +.\" Copyright (C) 2022-2023 Université Paul Sabatier +.\" Copyright (C) 2022-2023 |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/>. +.Dd June 10, 2024 +.Dt CITY_GENERATOR2-INTPUT 5 +.Os +.Sh NAME +.Nm city_generator2-input +.Nd description of input file formats for +.Xr city_generator2 1 +.Sh DESCRIPTION +.Nm +are the formats used by the +.Xr city_generator2 1 +program to describe a city. +They all rely on the yaml 1.1 syntax. +.Xr city_generator2 1 +reads two different types of files: a single map file, and at least one catalog +file. +The next two sections describe their formats. +.Pp +Because these files are yaml files, they must comply with yaml syntax rules, +including the hard part that is spacing. The following grammar rules that +begin with a verbatim text must all start at column 1. +From here, the amount of whitespace characters in verbatim text must be strictly +observed. +Also, text appearing between quote marks has to be used verbatim in the input, +without the quote characters. +Finally, text introduced by the # character in descriptions, +when not verbatim, is a comment and is not part of the description. +.Pp +Note however that yaml syntax admits multiple equivalent expressions. +Thus, the rules given thereafter could have been written differently. +Experienced yaml users can use any equivalent syntax instead of the one +introduced here. +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.\" Grammar in Backus-Naur form +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh GRAMMAR +.Ss CITY MAP FILE FORMAT +The city map file aims to describe the ground, that is currently limited to a +single layer, with a depth, and the list of buildings on the ground. +Each building is described in the same way, regardless of its construction mode, +that is part of the description. +.Pp +The city map file format is as follows: +.Bl -column (descr-line) (::) () +.It Ao Va city-map-file Ac Ta ::= Ta Ao Va ground-desc Ac +.It Ta Ta Ao Va building-list Ac +.It Ao Va ground-desc Ac Ta ::= Ta Qo ground: Qc +.It Ta Ta Qo \ \ extend: \& Qc Ao Va extend Ac +.It Ta Ta Qo \ \ depth: \& Qc Ao Va depth Ac +.It Ao Va building-list Ac Ta ::= Ta Qo buildings: Qc +.It Ta Ta Ao Va buildings Ac +.It Ao Va extent Ac Ta ::= Ta Qo \&[ Qc Ao Va Xmin Ac Qo , Qc\ + Ao Va Ymin Ac Qo , Qc Ao Va Xsize Ac Qo , Qc Ao Va Ysize Ac Qo ] Qc +.It Ao Va depth Ac Ta ::= Ta Vt REAL No # > 0, in m +.It Ao Va buildings Ac Ta ::= Ta Ao Va building Ac +.It Ta Ta [ \& Ao Va buildings Ac \& ] +.It Ao Va Xmin Ac Ta ::= Ta Vt REAL No # in m +.It Ao Va Ymin Ac Ta ::= Ta Vt REAL No # in m +.It Ao Va Xsize Ac Ta ::= Ta Vt REAL No # > 0, in m +.It Ao Va Ysize Ac Ta ::= Ta Vt REAL No # > 0, in m +.It Ao Va building Ac Ta ::= Ta Qo \ \ -name: \& Qc Ao Va name Ac +.It Ta Ta Qo \ \ \ construction_mode: \& Qc Ao Va cmode-name Ac +.It Ta Ta Qo \ \ \ dataset: \& Qc Ao Va dataset-name Ac +.It Ta Ta Qo \ \ \ height: \& Qc Ao Va height Ac +.It Ta Ta Qo \ \ \ footprint: [ Qc Ao Va vertices Ac Qo ] Qc +.It Ao Va name Ac Ta ::= Ta Vt STRING +.It Ao Va cmode-name Ac Ta ::= Ta Qo Construction_Mode_0 Qc | Qo Construction_Mode_1 Qc +.It Ao Va dataset-name Ac Ta ::= Ta Vt STRING +.It Ta Ta # The name must be found in a catalog file +.It Ta Ta # with the same construction mode +.It Ao Va height Ac Ta ::= Ta Vt REAL No # > 0, in m +.It Ao Va vertices Ac Ta ::= Ta Ao Va vertex Ac Bo \& Qo , Qc Ao Va vertices Ac \& Bc +.It Ta Ta # \&At least 3 vertices +.It Ao Va vertex Ac Ta ::= Ta Qo \&[ Qc Ao Va X Ac Qo , Qc Ao Va Y Ac Qo ] Qc +.It Ao Va X Ac Ta ::= Ta Vt REAL No # in m +.It Ao Va Y Ac Ta ::= Ta Vt REAL No # in m +.El +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Ss CATALOG FILE FORMAT +There are currently two different catalog file formats, identified by name, +and the way +.Xr city_generator2 1 +is designed allows for additional catalog formats to be implemented. +.Pp +All catalog files contain the name of the construction mode to which they add +datasets, and a list of datasets. +What differs between catalog file formats is the format of the datasets. +It is obviously expected that datasets use the format associated with the named +construction mode. +.Pp +The catalog file format is as follows: +.Bl -column (descri-line) (::) () +.It Ao Va catalog-file Ac Ta ::= Ta Ao Va catalog-file-0 Ac | Ao Va catalog-file-1 Ac +.It Ao Va catalog-file-0 Ac Ta ::= Ta Qo construction_mode: Construction_Mode_0 Qc +.It Ta Ta Qo datasets: \& Qc +.It Ta Ta Ao Va datasets-0 Ac +.It Ao Va catalog-file-1 Ac Ta ::= Ta Qo construction_mode: Construction_Mode_1 Qc +.It Ta Ta Qo datasets: \& Qc +.It Ta Ta Ao Va datasets-1 Ac +.It Ao Va datasets-0 Ac Ta ::= Ta Ao Va dataset-0 Ac +.It Ta Ta [ \& Ao Va datasets-0 Ac \& ] +.It Ao Va datasets-1 Ac Ta ::= Ta Ao Va dataset-1 Ac +.It Ta Ta [ \& Ao Va datasets-1 Ac \& ] +.It Ao Va dataset-0 Ac Ta ::= Ta Qo \ \ -name: \& Qc Ao Va name Ac +.It Ta Ta Qo \ \ \ wall_thickness: \& Qc Vt REAL No # > 0, in m +.It Ta Ta Qo \ \ \ floor_thickness: \& Qc Vt REAL No # > 0, in m +.It Ao Va dataset-1 Ac Ta ::= Ta Qo \ \ -name: \& Qc Ao Va name Ac +.It Ta Ta Qo \ \ \ wall_thickness: \& Qc Vt REAL No # > 0, in m +.It Ta Ta Qo \ \ \ floor_thickness: \& Qc Vt REAL No # > 0, in m +.It Ta Ta Qo \ \ \ inter_floor_count: \& Qc Vt INTEGER No # >= 0 +.It Ta Ta Qo \ \ \ inter_floor_thickness: \& Qc Vt REAL No # > 0, in m +.It Ta Ta Qo \ \ \ roof_thickness: \& Qc Vt REAL No # > 0, in m +.It Ta Ta Qo \ \ \ crawl_height: \& Qc Vt REAL No # >= 0, in m +.It Ta Ta Qo \ \ \ attic_height: \& Qc Vt REAL No # >= 0, in m +.It Ta Ta Qo \ \ \ glass_ratio: \& Qc Vt REAL No # >= 0 and <= 1 +.It Ta Ta Qo \ \ \ floor_insulation_thickness: \& Qc Vt REAL +.It Ta Ta No # >= 0, in m +.It Ta Ta Qo \ \ \ roof_insulation_thickness: \& Qc Vt REAL +.It Ta Ta No # >= 0, in m +.It Ta Ta Qo \ \ \ internal_insulation_thickness: \& Qc Vt REAL +.It Ta Ta No # >= 0, in m +.It Ta Ta Qo \ \ \ external_insulation_thickness: \& Qc Vt REAL +.It Ta Ta No # >= 0, in m +.It Ta Ta Qo \ \ \ foundation_depth: \& Qc Vt REAL No # >= 0, in m +.It Ao Va name Ac Ta ::= Ta Vt STRING +.El +.Sh SEE ALSO +.Xr city_generator2 1 +.Sh STANDARDS +.Rs +.%T YAML Ain't Markup Language version 1.1 +.%A Oren Ben-Kiki +.%A Clark Evans +.%A Ingy döt Net +.%D 2005 +.%U https://yaml.org/spec/1.1 +.Re +.Sh HISTORY +.Nm +has been initially developed as part of the +.Sy Readynov No funding program of the Occitanie / +Pyrénées-Méditerranée region. diff --git a/doc/city_generator2-input.5.txt b/doc/city_generator2-input.5.txt @@ -1,187 +0,0 @@ -// Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA -// Copyright (C) 2022-2023 CNRS -// Copyright (C) 2022-2023 Sorbonne Université -// Copyright (C) 2022-2023 Université Paul Sabatier -// Copyright (C) 2022-2023 |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/>. - -:sharp: {sharp} - -:toc: - -= city_generator2-input(5) - -== NAME - -city_generator2-input - description of input file formats for -city_generator2(1) - -== DESCRIPTION - -*city_generator2-input*(5) are the formats used by the *city_generator2*(1) -program to describe a city. They all rely on the yaml 1.1 syntax[1]. -*city_generator2*(1) reads two different types of files: a single map file, and -at least one catalog file. The next two sections describe their formats. - -Because these files are yaml files, they must comply with yaml syntax rules, -including the hard part that is spacing. The following grammar rules that begin -with a verbatim text must all start at column 1. From here, the amount of -whitespace characters in verbatim text must be strictly observed. Also, text -appearing between quote marks has to be used verbatim in the input, without the -quote characters. Finally, text introduced by the *#* character in descriptions, -when not verbatim, is a comment and is not part of the description. - -Note however that yaml syntax admits multiple equivalent expressions. Thus, the -rules given thereafter could have been written differently. Experienced yaml -users can use any equivalent syntax instead of the one introduced here. - -[1] https://yaml.org/ - -=== CITY MAP FILE FORMAT - -The city map file aims to describe the ground, that is currently limited to a -single layer, with a depth, and the list of buildings on the ground. Each -building is described in the same way, regardless of its construction mode, that -is part of the description. - -==== GRAMMAR - -[verse] -_______ -<city-map-file> ::= <ground-description> - <building-list> - -<ground-description> ::= "ground:" - " extent: " <extent> - " depth: " <depth> - -<building-list> ::= "building: " - <buildings> - -------------------------------------- - -<extent> ::= "[ <Xmin> "," <Ymin> "," <Xsize> "," <Ysize> ] - -<depth> ::= <REAL> # in ]0, INF) - -<Xmin> ::= <REAL> - -<Ymin> ::= <REAL> - -<buildings> ::= <building> - [ <buildings> ] - -<Xsize> ::= <REAL> # in ]0, INF) - -<Ysize> ::= <REAL> # in ]0, INF) - -------------------------------------- - -<buildings> ::= " -name: " <name> - " construction_mode: " <cmode-name> - " dataset: " <dataset-name> - " height: " <height> - " footprint: [" <vertices> "]" - -<name> ::= STRING - -<cmode-name> ::= "Construction_Mode_0" | "Construction_Mode_1" - -<dataset-name> ::= STRING # The name must be found in a catalog file - # with the same construction mode - -<height> ::= <REAL> # in ]0, INF) - -<vertices> ::= <vertex> [ "," <vertices> ] # At least 3 vertices - -------------------------------------- - -<vertex> ::= "[" <X> "," <Y> "]" - -<X> ::= <REAL> - -<Y> ::= <REAL> - -______________ - -=== CATALOG FILE FORMATS - -There are currently two different catalog file formats, identified by name, and -the way city-generator2 is designed allows for additional catalog formats to be -implemented. - -All catalog files contain the name of the construction mode to which they add -datasets, and a list of datasets. What differs between catalog file formats is -the format of the datasets. It is obviously expected that datasets use the -format associated with the named construction mode. - -==== GRAMMAR - -[verse] -_______ -<catalog-file> ::= <catalog-file_0 > | <catalog-file_1> - -<catalog-file-0> ::= <construction-mode-0> - "datasets:" - <datasets-0> - -<catalog-file-1> ::= <construction-mode-1> - "datasets:" - <datasets-1> - -------------------------------------- - -<construction-mode-0> ::= "construction_mode: Construction_Mode_0" - -<construction-mode-1> ::= "construction_mode: Construction_Mode_1" - -------------------------------------- - -<datasets_0> ::= <dataset_0> - [ <datasets_0> ] - -<datasets_1> ::= <dataset_1> - [ <datasets_1> ] - -------------------------------------- - -<dataset_0> ::= " - name: " <name> - " wall_thickness: " <REAL> {sharp} in ]0, INF) - " floor_thickness: " <REAL> {sharp} in ]0, INF) - -<dataset_1> ::= " - name: " <name> - " inter_floor_count: " <REAL> {sharp} in ]0, INF) - " wall_thickness: " <REAL> {sharp} in ]0, INF) - " floor_thickness: " <REAL> {sharp} in ]0, INF) - " inter_floor_thickness: " <REAL> {sharp} in ]0, INF) - " roof_thickness: " <REAL> {sharp} in ]0, INF) - " internal_insulation_thickness: " <REAL> {sharp} in ]0, INF) - " external_insulation_thickness: " <REAL> {sharp} in ]0, INF) - " floor_insulation_thickness: " <REAL> {sharp} in ]0, INF) - " roof_insulation_thickness: " <REAL> {sharp} in ]0, INF) - " foundation_depth: " <REAL> {sharp} in ]0, INF) - " crawl_height: " <REAL> {sharp} in ]0, INF) - " attic_height: " <REAL> {sharp} in ]0, INF) - " glass_ratio: " <REAL> {sharp} in ]0, INF) - -------------------------------------- - -<name> ::= STRING -______________ - - -== SEE ALSO - -*city_generator2*(1) diff --git a/doc/city_generator2-man.css b/doc/city_generator2-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/city_generator2-output.5 b/doc/city_generator2-output.5 @@ -0,0 +1,174 @@ +.\" Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA +.\" Copyright (C) 2022-2023 CNRS +.\" Copyright (C) 2022-2023 Sorbonne Université +.\" Copyright (C) 2022-2023 Université Paul Sabatier +.\" Copyright (C) 2022-2023 |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/>. +.Dd June 11, 2024 +.Dt CITY_GENERATOR2-OUTPUT 5 +.Os +.Sh NAME +.Nm city_generator2-output +.Nd naming-scheme for files created by +.Xr city_generator2 1 +.Sh DESCRIPTION +The output of +.Xr city-generator2 1 +is a set of STL files, in either ascii or binary format, that describe the +ground and the building parts, along with all their boundaries. +As expected for use by most solvers, including +.Xr stardis 1 , the output meshes are conformal. +The various output files for buildings are named after the name of the building +they are part of, as well as the name of the part they mesh. +.Sh NAMING SCHEME +Some conventions apply in file names, regardless of which part of the output is +concerned: +.Bl -dash -offset indent +.It +The name begins either with +.Sy ground No or the Sy name No of a building; the later obviously indicates +that this file is part of the output for this building. +.It +The next part of the name is a capital letter that indicates what type of +mesh the file describes: +.Bl -tag -nested -width Ds +.It B +if the file describes a boundary (a frontier with the external fluid), +.It C +if the file describes a connection (a frontier between two solids or +between a solid and the internal fluid), +.It F +if the file describes a fluid closed volume, +.It S +if the file describes a solid closed volume. +.El +.It +The final part of the name indicates which part is being described. +.It +Parts are separated by underscore characters. +.El +.Pp +The simplest part of the output is the ground. +The mesh describing the ground is provided in 6 files, one file per face, named +.Sm off +.Sy ground_B_top.stl No \&, +.Sm on +.Sm off +.Sy ground_B_bottom.stl No \&, +.Sm on +and +.Sy ground_B_lateral_0.stl No through +.Sm off +.Sy ground_B_lateral_3.stl No \&. +.Sm on +The shape of the mesh is the box described in the city map file used in input +(see +.Xr city_generator2-intput 5 ) +punched with 1 hole per building, according to building footprints. +.Pp +The connection between the ground and each building is part of the building +description. +If a closed volume for the ground is needed, it can be obtained as +the union of the meshes in +.Sy ground_B_*.stl No and +.Sm off +.Sy *_C_ground.stl No \&. +.Sm on +.Pp +Each building on the map is described by various files, depending on its +construction mode. +.Pp +Buildings of construction mode +.Sy Construction_Mode_0 No produce the following output files\&: +.Bl -dash -offset indent +.It +The solid for the walls, +.It +The solid for the floor, +.It +The solid for the roof, +.It +The internal fluid, +.It +The 3 solid-fluid connections between the internal fluid and the 3 solids, +.It +The solid-solid connection between the building and the ground, +.It +The boundary of the walls, +.It +The boundary of the roof. +.El +.Pp +Note that the many solid-solid connections between the different building layers +are not part of the output. +.Pp +Buildings of construction mode +.Sy Construction_Mode_1 No produce the following output files, some being +optional: +.Bl -dash -offset indent +.It +The solid for the walls, +.It +The solid for the floor, +.It +The solid for the roof, +.It +The solid for the glazing, +.It +The solid for the foundation (optional). +.It +The solid for the intermediate floors (optional, all levels merged). +.It +The solid for the internal insulation (optional). +.It +The solid for the external insulation (optional). +.It +The solid for the floor insulation (optional). +.It +The solid for the roof insulation (optional). +.It +The internal fluid in the attic (optional). +.It +The internal fluid in the crawlspace (optional). +.It +The internal fluid for the other levels (all levels merged). +.It +Various solid-fluid connections between an internal fluid and a solid. +Depending on the presence of an optional layer, the connection can be between +a fluid and the optional layer, or between a fluid and the next layer. +.It +The solid-solid connection between the building and the ground. +.It +The boundary of the various solids, including optional ones, that are part of +the external layer of the building. +.El +.Pp +Note that the many solid-solid connections between the different building layers +are not part of the output. +.Sh MESH ORIENTATION +All the meshes enclosing either a fluid or a solid are defined with all +triangles having their direct normal (right-hand rule) pointing to the outside. +.Pp +Additionally, all the meshes, whether they define an enclosure or a connection +or a boundary, comply with a consistency requirement regarding normal +orientation (all normals on the same side). +.Sh SEE ALSO +.Xr city_generator2 1 , +.Xr city_generator2-input 5 +.Sh HISTORY +.Nm +has been initially developed as part of the +.Sy Readynov No funding program of the Occitanie / +Pyrénées-Méditerranée region. diff --git a/doc/city_generator2-output.5.txt b/doc/city_generator2-output.5.txt @@ -1,145 +0,0 @@ -// Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA -// Copyright (C) 2022-2023 CNRS -// Copyright (C) 2022-2023 Sorbonne Université -// Copyright (C) 2022-2023 Université Paul Sabatier -// Copyright (C) 2018-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: - -= city_generator2-output(5) - -== NAME - -city_generator2-output - naming-scheme for files created by city_generator2(1). - -== DESCRIPTION - -The output of *city_generator2* is a set of *STL* files, in either ascii or -binary format, that describe the ground and the building parts, along with all -their boundaries. As expected for use by most solvers, including *stardis*(1), -the output meshes are conformal. The various output files for buildings are -named after the name of the building they are part of, as well as the name of -the part they mesh. - -== NAMING SCHEME - -Some conventions apply in file names, regardless of which part of the output is -concerned: - -- The name begins either with "ground" or the name of a building; the later - obviously indicates that this file is part of the output for this building. - -- The next part of the name is a capital letter that indicates what type of - mesh the file describes: *B* if the file describes a boundary (a frontier with - the external fluid), *C* if the file describes a connection (a frontier - between two solids or between a solid and the internal fluid), *F* if the file - describes a fluid closed volume, and *S* if the file describes a solid closed - volume. - -- The final part of the name indicates which part is being described. - -- Parts are separated by *_*. - -The simplest part of the output is the ground. The mesh describing the ground is -provided in 6 files, one file per face, named *ground_B_top.stl*, -*ground_B_bottom.stl*, and *ground_B_lateral_0.stl* through -*ground_B_lateral_3.stl*. The shape of the mesh is the box described in the city -map file used in input (see *city_generator2-intput*(5)) punched with 1 hole per -building, according to building footprints. - -The connection between the ground and each building is part of the building -description. If a closed volume for the ground is needed, it can be obtained as -the union of the meshes in **ground_B_*.stl** and ***_C_ground.stl**. - -Each building on the map is described by various files, depending on its -construction mode. - -Buildings of construction mode *Construction_Mode_0* produce the following -output files: - -- The solid for the walls. - -- The solid for the floor. - -- The solid for the roof. - -- The internal fluid. - -- The 3 solid-fluid connections between the internal fluid and the 3 solids. - -- The solid-solid connection between the building and the ground. - -- The boundary of the walls. - -- The boundary of the roof. - -Note that the many solid-solid connections between the different building layers -are not part of the output. - -Buildings of construction mode *Construction_Mode_1* produce the following -output files, some being optional: - -- The solid for the walls. - -- The solid for the floor. - -- The solid for the roof. - -- The solid for the glazing. - -- The solid for the foundation (optional). - -- The solid for the intermediate floors (optional, all levels merged). - -- The solid for the internal insulation (optional). - -- The solid for the external insulation (optional). - -- The solid for the floor insulation (optional). - -- The solid for the roof insulation (optional). - -- The internal fluid in the attic (optional). - -- The internal fluid in the crawlspace (optional). - -- The internal fluid for the other levels (all levels merged). - -- Various solid-fluid connections between an internal fluid and a solid. - Depending on the presence of an optional layer, the connection can be between - a fluid and the optional layer, or between a fluid and the next layer. - -- The solid-solid connection between the building and the ground. - -- The boundary of the various solids, including optional ones, that are part of - the external layer of the building. - -Note that the many solid-solid connections between the different building layers -are not part of the output. - -== MESH ORIENTATION - -All the meshes enclosing either a fluid or a solid are defined with all -triangles having their direct normal (right-hand rule) pointing to the outside. - -Additionally, all the meshes, whether they define an enclosure or a connection -or a boundary, comply with a consistency requirement regarding normal -orientation (all normals on the same side). - -== SEE ALSO - -*city_generator2*(1), -*city_generator2-input*(5), diff --git a/doc/city_generator2.1.in b/doc/city_generator2.1.in @@ -0,0 +1,180 @@ +.\" Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA +.\" Copyright (C) 2022-2023 CNRS +.\" Copyright (C) 2022-2023 Sorbonne Université +.\" Copyright (C) 2022-2023 Université Paul Sabatier +.\" Copyright (C) 2022-2023 |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/>. +.Dd June 11, 2024 +.Dt CITY_GENERATOR2 1 +.Os +.Sh NAME +.Nm city_generator2 +.Nd generation of conformal 3D meshes of a city from a simple ascii description +.Sh SYNOPSIS +.Nm +.Op Fl @CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION@Ehksv +.Op Fl c Ar file_name +.Op Fl f Ar building_name +.Op Fl F Ar level +.Op Fl m Ar file_name +.Op Fl V Ar level +.Sh DESCRIPTION +.Nm +generates a city as 3D conformal meshes from an ascii description. +The description includes the city map and at least one catalog file. +The provided description must comply with the +.Xr city_generator2-input 5 +input format. +.Pp +The output of +.Nm +is a set of STL files, either in ascii or in binary format, that contain the +various meshes of the ground layers and building parts, along with all their +boundaries. +As expected for use by most solvers, including +.Xr stardis 1 , the output meshes are conformal. +The various output files for buildings are named after the name of the building +they are part of, as well as the name of the part they mesh. +Please refer to +.Xr city_generator2-output 5 +for the complete description of this naming scheme. +.Pp +.Nm Ns ' +internals rely on the star-cad library which itself relies on the gmsh library. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl @CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION@ +Change the output format of the generated STL files to +@CG2_ARGS_STL_NON_DEFAULT_STR@ (default @CG2_ARGS_STL_DEFAULT_STR@). +.It Fl c Ar file_name +Read a catalog file which is a text file in yaml 1.1 format containing datasets +for a given construction mode. +All the datasets in a given file share the same construction mode. +If the city map uses more than one construction mode, the different datasets +must be provided in (at least) as many catalog files as there are construction +modes involved. +Please refer to +.Xr city_generator2-input 5 +for more information on formats. +.It Fl f Ar building_name +Dump the footprint of the building with the given name, if any. +Can be used more than once. +.It Fl F Ar level +Dump the footprint of some buildings in OBJ format, depending on +.Ar level . +Possible values are\&: +.Bl -tag -nested -width Ds +.It Cm 1 +Dump the footprint of any building not generated due to an error, +.It Cm 2 +Dump the footprint of any building. +.El +.It Fl E +Don't use escape characters in output text. +Use as first option to avoid escape characters in initial messages. +.It Fl h +Output short help and exit. +.It Fl k +Keep running on errors. +.It Fl m Ar file_name +Read a city map file which is a text file in yaml 1.1 format containing the +description of the ground and a list of buildings. +The description of an individual building includes its footprint and +construction mode among other things. +Please refer to +.Xr city_generator2-input 5 +for more information on formats. +.It Fl s +Force single threaded execution. +By default use as many threads as available. +Note however that only some parts of the processing is parallelized. +Therefore, poor speedup when run multithreaded is not a bug and can even be +expected. +.It Fl v +Output version information and exit. +.It Fl V Ar level +Set the verbosity +.Ar level . +Possible values are\&: +.Bl -tag -nested -width Ds +.It Cm 0 +No message, +.It Cm 1 +Error messages only, +.It Cm 2 +Error and warning messages, +.It Cm 3 +Error, warning and informative messages. +.El +.Pp +All the messages are written to standard error. +Default verbosity +.Ar level +is @CG2_ARGS_DEFAULT_VERBOSITY_LEVEL@. +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +Generates the city described in the +.Pa city.yaml +file, looking for the needed datasets in the +.Pa catalog0.yaml +and +.Pa catalog1.yaml +datafile: +.Pp +.Dl city_generator2 -m city.yaml -c catalog0.yaml -c catalog1.yaml +.Sh SEE ALSO +.Xr city_generator2-input 5 , +.Xr city_generator2-output 5 +.Rs +.%A C. Geuzaine and J.-F. Remacle. +.%T Gmsh: a three-dimensional finite element mesh generator with \ +built-in pre- and post-processing facilities. +.%J International Journal for Numerical Methods in Engineering +.%V 79 +.%N 11 +.%P 1309-1331 +.%D 2009 +.Re +.Sh STANDARDS +.Rs +.%T Appendix B1 of Advanced Visualizer software 3.0 manual +.%A Wavefront Technologies +.%D 1992 +.%U http://fegemo.github.io/cefet-cg/attachments/obj-spec.pdf +.Re +.Rs +.Pp +.%T The StL Format: Standard Data Format for Fabbers +.%A Marshall Burns +.%D 1993 +.%U https://www.fabbers.com/tech/STL_Format +.Re +.Pp +.Rs +.%T YAML Ain't Markup Language version 1.1 +.%A Oren Ben-Kiki +.%A Clark Evans +.%A Ingy döt Net +.%D 2005 +.%U https://yaml.org/spec/1.1 +.Re +.Sh HISTORY +.Nm +has been initially developed as part of the +.Sy Readynov No funding program of the Occitanie / +Pyrénées-Méditerranée region. diff --git a/doc/city_generator2.1.txt.in b/doc/city_generator2.1.txt.in @@ -1,126 +0,0 @@ -// Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA -// Copyright (C) 2022-2023 CNRS -// Copyright (C) 2022-2023 Sorbonne Université -// Copyright (C) 2022-2023 Université Paul Sabatier -// Copyright (C) 2022-2023 |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: - -city_generator2(1) -================== - -NAME ----- -city_generator2 - generation of conformal 3D meshes of a city from a simple -ascii description. - -SYNOPSIS --------- -[verse] -*city_generator2* *-h* [_option_] -*city_generator2* *-m* <__file__> {*-c* <__file__>}+ [_option_] - -DESCRIPTION ------------ -*city_generator2* generates a city as 3D conformal meshes from an ascii -description. The description includes the city map (a description of the ground -and buildings in a yaml file), and at least one catalog file (a description of -a set of datasets grouped by construction modes). The provided description must -comply with the *city_generator2-input*(5) format. - -The output of *city_generator2* is a set of *STL* files, either in ascii or in -binary format, that contain the various meshes of the ground layers and -building parts, along with all their boundaries. As expected for use by most -solvers, including *stardis*(1), the output meshes are conformal. -The various output files for buildings are named after the name of the building -they are part of, as well as the name of the part they mesh. -Please refer to *city_generator2-output*(5) for the complete description of -this naming scheme. - -The internals of *city_generator2* rely on the star-cad library[1] which itself -relies on the gmsh library[2]. - -[1] https://gitlab.com/meso-star/star-cad/ - -[2] C. Geuzaine and J.-F. Remacle. Gmsh: a three-dimensional finite element -mesh generator with built-in pre- and post-processing facilities. -International Journal for Numerical Methods in Engineering 79(11), -pp. 1309-1331, 2009. - -MANDATORY OPTIONS ------------------ -*-m* _file_:: - Read a city map file which is a text file in yaml 1.1 format containing the - description of the ground and a list of buildings. The description of an - individual building includes its footprint and construction mode among other - things. - Please refer to *city_generator2-input*(5) for more information on formats. - -*-c* _file_:: - Read a catalog file which is a text file in yaml 1.1 format containing datasets - for a given construction mode. All the datasets in a given file share the - same construction mode. If the city map uses more than one construction mode, - the different datasets must be provided in (at least) as many catalog files - as there are construction modes involved. - Please refer to *city_generator2-input*(5) for more information on formats. - -OTHER OPTIONS -------------- -*-@CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION@*:: - Change the output format of the generated *STL* files to - @CG2_ARGS_STL_NON_DEFAULT_STR@ (default @CG2_ARGS_STL_DEFAULT_STR@). - -*-h*:: - Output short help and exit. - -*-s*:: - Force single threaded execution. By default use as many threads as available. -+ -Note however that only some parts of the processing is parallelized. -Therefore, poor speedup is not a bug and can even be expected. - -*-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 @CG2_ARGS_DEFAULT_VERBOSITY_LEVEL@. - -EXAMPLES --------- -Generates the city described in the *city.yaml* file, looking for the needed -datasets in the *catalog0.yaml* and *catalog1.yaml* datafile: - - $ city_generator2 -m city.yaml -c catalog0.yaml -c catalog1.yaml - -COPYRIGHT ---------- -Copyright &copy; 2022-2023 Université de Pau et des Pays de l'Adour UPPA, - CNRS, - Sorbonne Université, - Université Paul Sabatier, - |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 --------- -*city_generator2-input*(5), -*city_generator2-output*(5) diff --git a/make.sh b/make.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# Copyright (C) 2018-2023 |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/cg.h b/src/cg.h @@ -20,8 +20,9 @@ #ifndef CG_H #define CG_H +#include "cg_cyaml.h" + #include <rsys/rsys.h> -#include <cyaml/cyaml.h> #define ERR(Expr) if((res = (Expr)) != RES_OK) goto error; else (void)0 diff --git a/src/cg_catalog_parsing.c b/src/cg_catalog_parsing.c @@ -23,13 +23,12 @@ #include "cg_construction_mode_0_parsing_schemas.h" #include "cg_construction_mode_1_parsing_schemas.h" #include "cg_city_parsing_schemas.h" +#include "cg_cyaml.h" #include <rsys/logger.h> #include <rsys/str.h> #include <rsys/clock_time.h> -#include <cyaml/cyaml.h> - static const struct cyaml_schema_value* get_schema_from_parsed_cmode (const enum parsed_cmode_type parsed_cmode) diff --git a/src/cg_city_parsing.c b/src/cg_city_parsing.c @@ -22,6 +22,7 @@ #include "cg_city_parsing_schemas.h" #include "cg_ground.h" #include "cg_city.h" +#include "cg_cyaml.h" #include <star/scpr.h> @@ -30,8 +31,6 @@ #include <rsys/mem_allocator.h> #include <rsys/clock_time.h> -#include <cyaml/cyaml.h> - #include <stdio.h> res_T diff --git a/src/cg_city_parsing_schemas.h b/src/cg_city_parsing_schemas.h @@ -21,11 +21,10 @@ #define FG_CITY_PARSING_SCHEMAS__ #include "cg_construction_modes_parsing_schemas.h" +#include "cg_cyaml.h" #include <rsys/str.h> -#include <cyaml/cyaml.h> - struct mem_allocator; struct logger; diff --git a/src/cg_construction_mode_0_parsing_schemas.h b/src/cg_construction_mode_0_parsing_schemas.h @@ -20,7 +20,7 @@ #ifndef FG_MODE0_PARSING_SCHEMAS__ #define FG_MODE0_PARSING_SCHEMAS__ -#include <cyaml/cyaml.h> +#include "cg_cyaml.h" struct parsed_dataset_cmode_0 { char* name; diff --git a/src/cg_construction_mode_1_parsing_schemas.h b/src/cg_construction_mode_1_parsing_schemas.h @@ -20,7 +20,7 @@ #ifndef FG_MODE1_PARSING_SCHEMAS__ #define FG_MODE1_PARSING_SCHEMAS__ -#include <cyaml/cyaml.h> +#include "cg_cyaml.h" #include <rsys/str.h> diff --git a/src/cg_construction_modes_parsing_schemas.h b/src/cg_construction_modes_parsing_schemas.h @@ -20,7 +20,7 @@ #ifndef FG_CMODES_PARSING_SCHEMAS__ #define FG_CMODES_PARSING_SCHEMAS__ -#include <cyaml/cyaml.h> +#include "cg_cyaml.h" /********************************************************/ /* Types used for parsing and to define parsing schemas */ diff --git a/src/cg_cyaml.h b/src/cg_cyaml.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2022 Université de Pau et des Pays de l'Adour UPPA + * Copyright (C) 2022 CNRS + * Copyright (C) 2022 Sorbonne Université + * Copyright (C) 2022 Université Paul Sabatier + * Copyright (C) 2022 |Meso|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/>. */ + +#ifndef CG_CYAML_H +#define CG_CYAML_H + +#include <rsys/rsys.h> + +#ifdef COMPILER_GCC + #pragma GCC system_header +#endif + +#include <cyaml/cyaml.h> + +#endif /* CG_CYAML_H */ diff --git a/src/cg_main.c b/src/cg_main.c @@ -25,8 +25,7 @@ #include "cg_catalog.h" #include "cg_catalog_parsing.h" #include "cg_vertex_denoiser.h" - -#include <cyaml/cyaml.h> +#include "cg_cyaml.h" #include <rsys/rsys.h> #include <rsys/clock_time.h>