htrdr_planets_args.h.in (7887B)
1 /* Copyright (C) 2018-2019, 2022-2025 Centre National de la Recherche Scientifique 2 * Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux 3 * Copyright (C) 2022-2025 Institut de Physique du Globe de Paris 4 * Copyright (C) 2018-2025 |Méso|Star> (contact@meso-star.com) 5 * Copyright (C) 2022-2025 Université de Reims Champagne-Ardenne 6 * Copyright (C) 2022-2025 Université de Versaille Saint-Quentin 7 * Copyright (C) 2018-2019, 2022-2025 Université Paul Sabatier 8 * 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation, either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 21 22 #ifndef HTRDR_PLANETS_ARGS_H 23 #define HTRDR_PLANETS_ARGS_H 24 25 #include "core/htrdr_args.h" 26 27 #include <rad-net/rnatm.h> 28 #include <rsys/rsys.h> 29 30 #include <limits.h> /* UINT_MAX */ 31 32 enum htrdr_planets_args_output_type { 33 HTRDR_PLANETS_ARGS_OUTPUT_IMAGE, 34 HTRDR_PLANETS_ARGS_OUTPUT_OCTREES, 35 HTRDR_PLANETS_ARGS_OUTPUT_VOLUMIC_RADIATIVE_BUDGET, 36 HTRDR_PLANETS_ARGS_OUTPUT_TYPES_COUNT__ 37 }; 38 39 struct htrdr_planets_spectral_args { 40 double wlen_range[2]; /* Spectral range in nm */ 41 enum htrdr_spectral_type type; 42 }; 43 #define HTRDR_PLANETS_SPECTRAL_ARGS_DEFAULT__ { \ 44 HTRDR_RAN_WLEN_CIE_XYZ_RANGE_DEFAULT__, /* Spectral range */ \ 45 HTRDR_SPECTRAL_SW_CIE_XYZ, /* Spectral type */ \ 46 } 47 static const struct htrdr_planets_spectral_args 48 HTRDR_PLANETS_SPECTRAL_ARGS_DEFAULT = HTRDR_PLANETS_SPECTRAL_ARGS_DEFAULT__; 49 50 struct htrdr_planets_source_args { 51 /* Radiance of the source per wavelength. May be NULL */ 52 char* rnrl_filename; 53 54 double longitude; /* In [-180, 180] degrees */ 55 double latitude; /* In [-90, 90] degrees */ 56 double distance; /* In km */ 57 double radius; /* In km */ 58 double temperature; /* In Kelvin */ 59 }; 60 #define HTRDR_PLANETS_SOURCE_ARGS_NULL__ {NULL,0,0,0,-1,-1} 61 static const struct htrdr_planets_source_args HTRDR_PLANETS_SOURCE_ARGS_NULL = 62 HTRDR_PLANETS_SOURCE_ARGS_NULL__; 63 64 struct htrdr_planets_ground_args { 65 char* smsh_filename; /* The Star-Mesh geometry */ 66 char* props_filename; /* Per triangle physical properties */ 67 char* mtllst_filename; /* List of used materials */ 68 char* name; 69 }; 70 #define HTRDR_PLANETS_GROUND_ARGS_NULL__ {NULL,NULL,NULL,NULL} 71 static const struct htrdr_planets_ground_args HTRDR_PLANETS_GROUND_ARGS_NULL = 72 HTRDR_PLANETS_GROUND_ARGS_NULL__; 73 74 struct htrdr_planets_volrad_budget_args { 75 char* smsh_filename; /* The Star-Mesh geometry */ 76 unsigned spt; /* Number of MC realisations per tetrahedron */ 77 }; 78 #define HTRDR_PLANETS_VOLRAD_BUDGET_ARGS_NULL__ { \ 79 NULL, @HTRDR_PLANETS_ARGS_DEFAULT_VOLRAD_BUDGET_SPT@ \ 80 } 81 static const struct htrdr_planets_volrad_budget_args 82 HTRDR_PLANETS_VOLRAD_BUDGET_ARGS_NULL = 83 HTRDR_PLANETS_VOLRAD_BUDGET_ARGS_NULL__; 84 85 /* Configure the building of the acceleration structure */ 86 struct htrdr_planets_accel_struct_build_args { 87 unsigned definition_hint; /* Hint on octree definition */ 88 unsigned nthreads; /* Hint on the number of threads to use */ 89 double optical_thickness; /* Threshold used during octree building */ 90 91 /* Read/Write file where octrees are stored. May be NULL => octres are built 92 * at runtime and kept in memory */ 93 char* storage; 94 95 /* Indicator defining whether the structure is built solely on the 96 * master process */ 97 int master_only; 98 }; 99 #define HTRDR_PLANETS_ACCEL_STRUCT_BUILD_ARGS_NULL__ { 512, 8, 1, NULL, 1 } 100 static const struct htrdr_planets_accel_struct_build_args 101 HTRDR_PLANETS_ACCEL_STRUCT_BUILD_ARGS_NULL = 102 HTRDR_PLANETS_ACCEL_STRUCT_BUILD_ARGS_NULL__; 103 104 struct htrdr_planets_args { 105 /* System data */ 106 struct rnatm_gas_args gas; 107 struct rnatm_aerosol_args* aerosols; 108 size_t naerosols; 109 struct htrdr_planets_ground_args ground; 110 111 /* Configure the building of the acceleration structure */ 112 struct htrdr_planets_accel_struct_build_args accel_struct; 113 114 char* output; /* File where the result is written */ 115 struct htrdr_planets_spectral_args spectral_domain; /* Integration spectral domain */ 116 struct htrdr_planets_source_args source; 117 struct htrdr_args_image image; 118 119 struct htrdr_args_camera_perspective cam_persp; /* Perspective camera */ 120 struct htrdr_args_camera_orthographic cam_ortho; /* Orthographic camera */ 121 enum htrdr_args_camera_type cam_type; 122 123 /* Input parameters for volumic radiative budget calculation */ 124 struct htrdr_planets_volrad_budget_args volrad_budget; 125 126 /* Miscellaneous arguments */ 127 unsigned nthreads; /* Hint on the number of threads to use */ 128 enum htrdr_planets_args_output_type output_type; 129 int precompute_normals; /* Pre-compute tetrahedron normals */ 130 int force_output_overwrite; /* Replace output if it exists */ 131 int verbose; /* Verbose level */ 132 int quit; /* Stop the command */ 133 }; 134 #define HTRDR_PLANETS_ARGS_DEFAULT__ { \ 135 RNATM_GAS_ARGS_NULL__, /* Gas */ \ 136 NULL, /* List of aerosols */ \ 137 0, /* Number of aerosols */ \ 138 HTRDR_PLANETS_GROUND_ARGS_NULL__, /* Ground */ \ 139 \ 140 HTRDR_PLANETS_ACCEL_STRUCT_BUILD_ARGS_NULL__, \ 141 \ 142 NULL, /* Ouput file */ \ 143 HTRDR_PLANETS_SPECTRAL_ARGS_DEFAULT__, /* Spectral domain */ \ 144 HTRDR_PLANETS_SOURCE_ARGS_NULL__, /* Source */ \ 145 HTRDR_ARGS_IMAGE_DEFAULT__, /* Image */ \ 146 \ 147 HTRDR_ARGS_CAMERA_PERSPECTIVE_DEFAULT__, /* Perspective camera */ \ 148 HTRDR_ARGS_CAMERA_ORTHOGRAPHIC_DEFAULT__, /* Orthographic camera */ \ 149 HTRDR_ARGS_CAMERA_PERSPECTIVE, \ 150 \ 151 HTRDR_PLANETS_VOLRAD_BUDGET_ARGS_NULL__, /* Volumic radiative budget */ \ 152 \ 153 UINT_MAX, /* Number of threads */ \ 154 HTRDR_PLANETS_ARGS_OUTPUT_IMAGE, \ 155 0, /* Force output overwrite */ \ 156 0, /* Precompute normals */ \ 157 0, /* Verbosity level */ \ 158 0 /* Stop the command */ \ 159 } 160 static const struct htrdr_planets_args HTRDR_PLANETS_ARGS_DEFAULT = 161 HTRDR_PLANETS_ARGS_DEFAULT__; 162 163 extern LOCAL_SYM res_T 164 htrdr_planets_args_init 165 (struct htrdr_planets_args* args, 166 int argc, 167 char** argv); 168 169 extern LOCAL_SYM void 170 htrdr_planets_args_release 171 (struct htrdr_planets_args* args); 172 173 extern LOCAL_SYM res_T 174 htrdr_planets_args_check 175 (const struct htrdr_planets_args* args); 176 177 extern LOCAL_SYM res_T 178 htrdr_planets_source_args_check 179 (const struct htrdr_planets_source_args* args); 180 181 #endif /* HTRDR_PLANETS_ARGS_H */