commit b81f70f4ac82c68fcb604b78d18ff5e239168efb
parent 217bd74802d801bd4551002968181e617008ad81
Author: Benjamin Piaud <benjamin.piaud@meso-star.com>
Date: Thu, 26 Jan 2023 11:34:50 +0100
Merge remote-tracking branch 'refs/remotes/origin/develop' into develop
Diffstat:
6 files changed, 152 insertions(+), 49 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -145,7 +145,7 @@ add_executable(city_generator2
${CG2_FILES_INC})
target_link_libraries(city_generator2
- RSys StarCAD StarCPR ${LIBCYAML_LIBRARY} ${MATH_LIB})
+ RSys StarCAD StarCPR libcyaml ${MATH_LIB})
set_target_properties(city_generator2 PROPERTIES
VERSION ${CG2_VERSION})
diff --git a/doc/city_generator2-output.5.txt b/doc/city_generator2-output.5.txt
@@ -23,18 +23,125 @@
== NAME
-city_generator2-output - naming-scheme of city_generator2(1) generated files.
+city_generator2-output - naming-scheme for city_generator2(1) generated files.
== DESCRIPTION
-Blah.
+The output of *city_generator2* is a set of *STL* files, either in ascii or in
+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.
-== NOTES
+== NAMING SCHEME
-1. YAML syntax -
- <https://yaml.org/>
+Some conventions apply in file names, regardless of which part of the output is
+concerned:
+
+- The name starts with either "ground", or a building name; the later obviously
+ indicates this file is part of the output for this building.
+
+- The next part of the name is a capital letter that indicates which 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* is 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 described.
+
+- The parts are separated with *_*.
+
+The simplest part of the output is the ground. The mesh describing the ground is
+provided both in a single file named *ground_B.stl* and in 6 files, one file per
+side, named *ground_B_0.stl* to *ground_B_5.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 attic 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 optional layer presence, the connection can be between a fluid
+ and an 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, either defining an enclosure or a connection or a
+boundary, comply with a consistency requirement regarding normal orientation
+(all the normals on the same side).
== SEE ALSO
*city_generator2*(1),
-rcity_generator2-input*(5),
+*city_generator2-input*(5),
diff --git a/doc/city_generator2.1.txt.in b/doc/city_generator2.1.txt.in
@@ -45,8 +45,8 @@ 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 are named after the name of the building they are part
-of, as well as the name of the part they mesh.
+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.
diff --git a/src/cg_construction_mode_0.c b/src/cg_construction_mode_0.c
@@ -206,7 +206,7 @@ build_wall
is_init = 1;
if (prefix) {
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_S_wall"));
+ ERR(str_append(&name, "_S_walls"));
wallname = str_get(&name);
}
@@ -250,7 +250,7 @@ build_cavity
is_init = 1;
if (prefix) {
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_F_cavity"));
+ ERR(str_append(&name, "_F_internal"));
cavityname = str_get(&name);
}
@@ -293,7 +293,7 @@ build_connection
is_init = 1;
if (prefix) {
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_C_cavity_floor"));
+ ERR(str_append(&name, "_C_floor"));
cname = str_get(&name);
}
@@ -303,7 +303,7 @@ build_connection
/* cavity/wall connection */
if (prefix) {
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_C_cavity_wall"));
+ ERR(str_append(&name, "_C_walls"));
cname = str_get(&name);
}
@@ -313,7 +313,7 @@ build_connection
/* cavity/roof connection */
if (prefix) {
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_C_cavity_roof"));
+ ERR(str_append(&name, "_C_roof"));
cname = str_get(&name);
}
@@ -360,17 +360,17 @@ build_boundary
data_cad->boundary = MEM_ALLOC(allocator, 2 * sizeof(struct scad_geometry*));
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_boundary_wall"));
+ ERR(str_append(&name, "_B_walls"));
boundaryname = str_get(&name);
ERR(scad_geometries_common_boundaries(boundaryname, list, count,
&data_cad->wall, 1, &data_cad->boundary[0]));
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_boundary_roof"));
+ ERR(str_append(&name, "_B_roof"));
boundaryname = str_get(&name);
ERR(scad_geometries_common_boundaries(boundaryname, list, count,
&data_cad->roof, 1, &data_cad->boundary[1]));
-
+
exit:
MEM_RM(allocator, list);
if (is_init) str_release(&name);
@@ -399,7 +399,7 @@ building_ground_connection
str_init(NULL, &name);
is_init = 1;
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_C_building_ground"));
+ ERR(str_append(&name, "_C_ground"));
cname = str_get(&name);
}
diff --git a/src/cg_construction_mode_1.c b/src/cg_construction_mode_1.c
@@ -189,7 +189,7 @@ build_int_insulation
str_init(allocator, &name);
is_init = 1;
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_S_int_insulation"));
+ ERR(str_append(&name, "_S_internal_insulation"));
insulationname = str_get(&name);
}
@@ -437,7 +437,7 @@ build_inter_floor
str_init(allocator, &name);
is_init = 1;
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_S_inter_floor"));
+ ERR(str_append(&name, "_S_intermediate_floors"));
floorname = str_get(&name);
}
@@ -510,7 +510,7 @@ build_ext_insulation
str_init(allocator, &name);
is_init = 1;
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_S_ext_insulation"));
+ ERR(str_append(&name, "_S_external_insulation"));
insulationname = str_get(&name);
}
@@ -635,7 +635,7 @@ build_habitable
str_init(allocator, &name);
is_init = 1;
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_F_cavity"));
+ ERR(str_append(&name, "_F_levels"));
cavityname = str_get(&name);
}
@@ -838,7 +838,7 @@ build_windows
str_init(allocator, &gname);
is_init = 1;
ERR(str_set(&gname, prefix));
- ERR(str_append(&gname, "_S_glass"));
+ ERR(str_append(&gname, "_S_glazing"));
}
ERR(scad_fuse_geometries(str_cget(&gname), glass_list, 1,
@@ -936,14 +936,14 @@ build_boundary
ERR(darray_geometries_reserve(boundary, 5+darray_geometries_size_get(boundary)));
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_boundary_wall"));
+ ERR(str_append(&name, "_B_walls"));
boundaryname = str_get(&name);
ERR(scad_geometries_common_boundaries(boundaryname, list, count,
&data_cad->wall, 1, &bound));
ERR(darray_geometries_push_back(boundary, &bound));
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_boundary_roof"));
+ ERR(str_append(&name, "_B_roof"));
boundaryname = str_get(&name);
ERR(scad_geometries_common_boundaries(boundaryname, list, count,
&data_cad->roof, 1, &bound));
@@ -951,7 +951,7 @@ build_boundary
if (data_cad->glass) {
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_boundary_glass"));
+ ERR(str_append(&name, "_B_glazing"));
boundaryname = str_get(&name);
ERR(scad_geometries_common_boundaries(boundaryname, list, count,
&data_cad->glass, 1, &bound));
@@ -960,7 +960,7 @@ build_boundary
if (data_cad->external_insulation) {
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_boundary_ext_insulation"));
+ ERR(str_append(&name, "_B_external_insulation"));
boundaryname = str_get(&name);
ERR(scad_geometries_common_boundaries(boundaryname, list, count,
&data_cad->external_insulation, 1, &bound));
@@ -970,7 +970,7 @@ build_boundary
if (data_cad->internal_insulation) {
size_t bcount = 0;
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_boundary_int_insulation"));
+ ERR(str_append(&name, "_B_internal_insulation"));
boundaryname = str_get(&name);
ERR(scad_geometries_common_boundaries(boundaryname, list, count,
&data_cad->internal_insulation, 1, &bound));
@@ -1026,32 +1026,32 @@ build_connection
/* -------------------------------------------------------------------------*/
/* with floor */
- CREATE_CONNECT(habitable_cavity,floor,"_C_cavity_floor");
+ CREATE_CONNECT(habitable_cavity,floor,"_C_floor");
/* with wall */
- CREATE_CONNECT(habitable_cavity,wall,"_C_cavity_wall");
+ CREATE_CONNECT(habitable_cavity,wall,"_C_walls");
/* with glass */
if (data_cad->glass) {
- CREATE_CONNECT(habitable_cavity,glass,"_C_cavity_glass");
+ CREATE_CONNECT(habitable_cavity,glass,"_C_glazing");
}
/* with internal insulation */
if (data_cad->internal_insulation) {
- CREATE_CONNECT(habitable_cavity,internal_insulation,"_C_cavity_internal_insulation");
+ CREATE_CONNECT(habitable_cavity,internal_insulation,"_C_internal_insulation");
}
/* with roof insulation */
if (data_cad->roof_insulation) {
- CREATE_CONNECT(habitable_cavity,roof_insulation,"_C_cavity_roof_insulation");
+ CREATE_CONNECT(habitable_cavity,roof_insulation,"_C_roof_insulation");
} else {
/* with roof */
- CREATE_CONNECT(habitable_cavity,roof,"_C_cavity_roof");
+ CREATE_CONNECT(habitable_cavity,roof,"_C_roof");
}
/* with intermediate floor */
if (data_cad->intermediate_floor) {
- CREATE_CONNECT(habitable_cavity,intermediate_floor,"_C_cavity_intermediate_floor");
+ CREATE_CONNECT(habitable_cavity,intermediate_floor,"_C_intermediate_floors");
}
/* -------------------------------------------------------------------------*/
@@ -1086,7 +1086,7 @@ build_connection
CREATE_CONNECT(attic_cavity, roof_insulation,"_C_attic_insulation");
/* with wall */
- CREATE_CONNECT(attic_cavity, wall,"_C_attic_wall");
+ CREATE_CONNECT(attic_cavity, wall,"_C_attic_walls");
}
#undef CREATE_CONNECT
@@ -1200,7 +1200,7 @@ building_ground_connection
str_init(allocator, &name);
is_init = 1;
ERR(str_set(&name, prefix));
- ERR(str_append(&name, "_C_building_ground"));
+ ERR(str_append(&name, "_C_ground"));
cname = str_get(&name);
/* Ensure enough room for all geometries without error nor mem move */
@@ -1339,7 +1339,7 @@ build_cad_cmode_1
name = str_cget(&building->name);
ERR(build_floor(name, allocator, pg, data, &data_cad->floor));
- ERR(build_wall(name, "S_wall", allocator, pg, height, data, &data_cad->wall));
+ ERR(build_wall(name, "S_walls", allocator, pg, height, data, &data_cad->wall));
ERR(build_roof(name, allocator, pg, height, data, &data_cad->roof));
diff --git a/src/cg_ground.c b/src/cg_ground.c
@@ -39,10 +39,7 @@ ground_build_cad
size_t i, count = 0;
- if (!city || !ground) {
- res = RES_BAD_ARG;
- goto error;
- }
+ ASSERT(city && ground);
origin[0] = city->ground_extent[0];
origin[1] = city->ground_extent[2];
@@ -76,28 +73,28 @@ ground_build_cad
ERR(scad_geometry_normal(list[i], center, N, NULL, &surface));
if (N[0] == 0 && N[1] == 0 && N[2] == -1) {
- ERR(scad_geometry_copy(surface, "B_ground_bottom", &ground->boundary[0]));
+ ERR(scad_geometry_copy(surface, "ground_B_bottom", &ground->boundary[0]));
}
if (N[0] == 0 && N[1] == 0 && N[2] == 1) {
- ERR(scad_cut_geometries("B_ground_top", &surface, 1,
+ ERR(scad_cut_geometries("ground_B_top", &surface, 1,
ground->footprints, ground->footprints_count, &ground->boundary[1]));
}
if (N[0] == -1 && N[1] == 0 && N[2] == 0) {
- ERR(scad_geometry_copy(surface, "B_ground_lateral_0", &ground->boundary[2]));
+ ERR(scad_geometry_copy(surface, "ground_B_lateral_0", &ground->boundary[2]));
}
if (N[0] == 1 && N[1] == 0 && N[2] == 0) {
- ERR(scad_geometry_copy(surface, "B_ground_lateral_1", &ground->boundary[3]));
+ ERR(scad_geometry_copy(surface, "ground_B_lateral_1", &ground->boundary[3]));
}
if (N[0] == 0 && N[1] == -1 && N[2] == 0) {
- ERR(scad_geometry_copy(surface, "B_ground_lateral_2", &ground->boundary[4]));
+ ERR(scad_geometry_copy(surface, "ground_B_lateral_2", &ground->boundary[4]));
}
if (N[0] == 0 && N[1] == 1 && N[2] == 0) {
- ERR(scad_geometry_copy(surface, "B_ground_lateral_3", &ground->boundary[5]));
+ ERR(scad_geometry_copy(surface, "ground_B_lateral_3", &ground->boundary[5]));
}
}
@@ -123,7 +120,6 @@ ground_export_stl(const struct ground* ground, const int binary)
for(i = 0; i < 6; i++) {
ERR(scad_stl_export(ground->boundary[i], NULL, 0, binary));
}
- /*ERR(scad_stl_export_split(ground->boundary, "B_ground", binary));*/
exit:
return res;