cg_construction_mode_1.h (4257B)
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_1_H 21 #define Construction_MODE_1_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_1 { 38 size_t inter_floor_count; /* can be 0 */ 39 double wall_thickness; /* must be > 0 */ 40 double floor_thickness; /* must be > 0 */ 41 double inter_floor_thickness; /* must be > 0 */ 42 double roof_thickness; /* must be > 0 */ 43 double internal_insulation_thickness; /* can be 0 */ 44 double external_insulation_thickness; /* can be 0 */ 45 double floor_insulation_thickness; /* can be 0 */ 46 double roof_insulation_thickness; /* can be 0 */ 47 double foundation_depth; /* can be 0 */ 48 double crawl_height; /* can be 0 */ 49 double attic_height; /* can be 0 */ 50 double glass_ratio; /* in [0, 1] */ 51 }; 52 53 #define HTABLE_NAME dataset_cmode_1 54 #define HTABLE_DATA struct dataset_cmode_1 55 #define HTABLE_KEY struct str 56 #define HTABLE_KEY_FUNCTOR_INIT str_init 57 #define HTABLE_KEY_FUNCTOR_RELEASE str_release 58 #define HTABLE_KEY_FUNCTOR_COPY str_copy 59 #define HTABLE_KEY_FUNCTOR_COPY_AND_RELEASE str_copy_and_release 60 #define HTABLE_KEY_FUNCTOR_COPY_AND_CLEAR str_copy_and_clear 61 #define HTABLE_KEY_FUNCTOR_EQ str_eq 62 #define HTABLE_KEY_FUNCTOR_HASH str_hash 63 #include <rsys/hash_table.h> 64 65 struct data_cad_cmode_1 { 66 struct darray_common_trg common_trg; 67 struct darray_geometries adj_walls; 68 struct darray_geometries boundary; 69 struct darray_geometries connection; 70 struct building* building; 71 struct scad_geometry* wall; 72 struct scad_geometry* roof; 73 struct scad_geometry* floor; 74 struct scad_geometry* foundation; /* can be NULL */ 75 struct scad_geometry* intermediate_floor; /* can be NULL */ 76 struct scad_geometry* habitable_cavity; 77 struct scad_geometry* crawlspace_cavity; /* can be NULL */ 78 struct scad_geometry* attic_cavity; /* can be NULL */ 79 struct scad_geometry* internal_insulation; /* can be NULL */ 80 struct scad_geometry* external_insulation; /* can be NULL */ 81 struct scad_geometry* floor_insulation; /* can be NULL */ 82 struct scad_geometry* roof_insulation; /* can be NULL */ 83 struct scad_geometry* glazing; 84 struct scad_geometry* fake_ground;/*not exported, used for ground connection*/ 85 struct scad_geometry* ground_connection; 86 size_t n_connection; 87 }; 88 89 res_T 90 init_cmode_1 91 (struct building* building, 92 struct city* city, 93 struct parsed_city_building* parsed_data, 94 struct catalog* catalog, 95 const double lower[2], 96 const double upper[2]); 97 98 res_T 99 release_cmode_1 100 (struct building* building); 101 102 res_T 103 build_cad_cmode_1 104 (struct building* building, 105 int dump_footprints_on_error, 106 int keep_running_on_errors, 107 struct darray_adjoining_data* adjoining_data, 108 struct darray_geometries* current_cad, 109 void** cad); 110 111 res_T 112 build_footprint_cmode_1 113 (struct building* building, 114 struct scad_geometry** footprint); 115 116 res_T save_ground_connection_triangles_1 117 (void* cad, 118 struct darray_double* triangles); 119 120 res_T get_external_layer_name_1 121 (struct building* building, 122 const char* name); 123 124 res_T 125 export_stl_cmode_1 126 (void* cad, 127 const int binary); 128 129 res_T 130 release_cad_cmode_1 131 (void* cad); 132 133 #endif /* Construction_MODE_1_H */