cg_construction_mode_2.h (4398B)
1 /* Copyright (C) 2022 Université de Pau et des Pays de l'Adour UPPA 2 * Copyright (C) 2022 CNRS 3 * Copyright (C) 2022 Sorbonne Université 4 * Copyright (C) 2022 Université Paul Sabatier 5 * Copyright (C) 2022 |Meso|Star> (contact@meso-star.com) 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20 #ifndef Construction_MODE_2_H 21 #define Construction_MODE_2_H 22 23 #include "cg_construction_mode.h" 24 25 #include <rsys/rsys.h> 26 #include <rsys/str.h> 27 #include <rsys/hash_table.h> 28 #include <rsys/dynamic_array.h> 29 30 struct scad_geometry; 31 struct building; 32 struct city; 33 struct parsed_city_building; 34 struct catalog; 35 36 /* specific data for construction mode 1 */ 37 struct dataset_cmode_2 { 38 double wall_thickness; /* must be > 0 */ 39 double floor_thickness; /* must be > 0 */ 40 double inter_floor_thickness; /* must be > 0 */ 41 double roof_thickness; /* must be > 0 */ 42 double internal_insulation_thickness; /* can be 0 */ 43 double external_insulation_thickness; /* can be 0 */ 44 double floor_insulation_thickness; /* can be 0 */ 45 double roof_insulation_thickness; /* can be 0 */ 46 double foundation_depth; /* can be 0 */ 47 double crawl_height; /* can be 0 */ 48 double glass_ratio; /* in [0, 1] */ 49 double windows_min_width; /* must be > 0 */ 50 double windows_max_width; /* must be >= windows_min_width */ 51 double windows_min_spacing; /* must be > 0 */ 52 double windows_height_ratio; /* in [0, 1] */ 53 int has_attic; 54 }; 55 56 #define HTABLE_NAME dataset_cmode_2 57 #define HTABLE_DATA struct dataset_cmode_2 58 #define HTABLE_KEY struct str 59 #define HTABLE_KEY_FUNCTOR_INIT str_init 60 #define HTABLE_KEY_FUNCTOR_RELEASE str_release 61 #define HTABLE_KEY_FUNCTOR_COPY str_copy 62 #define HTABLE_KEY_FUNCTOR_COPY_AND_RELEASE str_copy_and_release 63 #define HTABLE_KEY_FUNCTOR_COPY_AND_CLEAR str_copy_and_clear 64 #define HTABLE_KEY_FUNCTOR_EQ str_eq 65 #define HTABLE_KEY_FUNCTOR_HASH str_hash 66 #include <rsys/hash_table.h> 67 68 struct data_cad_cmode_2 { 69 struct darray_common_trg common_trg; 70 struct darray_geometries adj_walls; 71 struct darray_geometries boundary; 72 struct darray_geometries connection; 73 struct building* building; 74 struct scad_geometry* wall; 75 struct scad_geometry* roof; 76 struct scad_geometry* floor; 77 struct scad_geometry* foundation; /* can be NULL */ 78 struct scad_geometry* intermediate_floor; /* can be NULL */ 79 struct scad_geometry* habitable_cavity; 80 struct scad_geometry* crawlspace_cavity; /* can be NULL */ 81 struct scad_geometry* attic_cavity; /* can be NULL */ 82 struct scad_geometry* internal_insulation; /* can be NULL */ 83 struct scad_geometry* external_insulation; /* can be NULL */ 84 struct scad_geometry* floor_insulation; /* can be NULL */ 85 struct scad_geometry* roof_insulation; /* can be NULL */ 86 struct scad_geometry* glazing; 87 struct scad_geometry* fake_ground;/*not exported, used for ground connection*/ 88 struct scad_geometry* ground_connection; 89 size_t n_connection; 90 }; 91 92 res_T 93 init_cmode_2 94 (struct building* building, 95 struct city* city, 96 struct parsed_city_building* parsed_data, 97 struct catalog* catalog, 98 const double lower[2], 99 const double upper[2]); 100 101 res_T 102 release_cmode_2 103 (struct building* building); 104 105 res_T 106 build_cad_cmode_2 107 (struct building* building, 108 int dump_footprints_on_error, 109 int keep_running_on_errors, 110 struct darray_adjoining_data* adjoining_data, 111 struct darray_geometries* current_cad, 112 void** cad); 113 114 res_T 115 build_footprint_cmode_2 116 (struct building* building, 117 struct scad_geometry** footprint); 118 119 res_T save_ground_connection_triangles_2 120 (void* cad, 121 struct darray_double* triangles); 122 123 res_T get_external_layer_name_2 124 (struct building* building, 125 const char* name); 126 127 res_T 128 export_stl_cmode_2 129 (void* cad, 130 const int binary); 131 132 res_T 133 release_cad_cmode_2 134 (void* cad); 135 136 #endif /* Construction_MODE_2_H */