sdis_solve.c (6049B)
1 /* Copyright (C) 2016-2025 |Méso|Star> (contact@meso-star.com) 2 * 3 * This program is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 3 of the License, or 6 * (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 16 #include "sdis.h" 17 18 /* Generate the probe solvers */ 19 #define SDIS_XD_DIMENSION 2 20 #include "sdis_solve_probe_Xd.h" 21 #define SDIS_XD_DIMENSION 3 22 #include "sdis_solve_probe_Xd.h" 23 24 /* Generate the probe boundary solvers */ 25 #define SDIS_XD_DIMENSION 2 26 #include "sdis_solve_probe_boundary_Xd.h" 27 #define SDIS_XD_DIMENSION 3 28 #include "sdis_solve_probe_boundary_Xd.h" 29 30 /* Generate the boundary solvers */ 31 #define SDIS_XD_DIMENSION 2 32 #include "sdis_solve_boundary_Xd.h" 33 #define SDIS_XD_DIMENSION 3 34 #include "sdis_solve_boundary_Xd.h" 35 36 /* Generate the medium solvers */ 37 #define SDIS_XD_DIMENSION 2 38 #include "sdis_solve_medium_Xd.h" 39 #define SDIS_XD_DIMENSION 3 40 #include "sdis_solve_medium_Xd.h" 41 42 /******************************************************************************* 43 * Exported functions 44 ******************************************************************************/ 45 res_T 46 sdis_solve_probe 47 (struct sdis_scene* scn, 48 const struct sdis_solve_probe_args* args, 49 struct sdis_estimator** out_estimator) 50 { 51 if(!scn) return RES_BAD_ARG; 52 if(scene_is_2d(scn)) { 53 return solve_probe_2d(scn, args, NULL, out_estimator); 54 } else { 55 return solve_probe_3d(scn, args, NULL, out_estimator); 56 } 57 } 58 59 res_T 60 sdis_solve_probe_list 61 (struct sdis_scene* scn, 62 const struct sdis_solve_probe_list_args* args, 63 struct sdis_estimator_buffer** out_buf) 64 { 65 if(!scn) return RES_BAD_ARG; 66 if(scene_is_2d(scn)) { 67 return solve_probe_list_2d(scn, args, out_buf); 68 } else { 69 return solve_probe_list_3d(scn, args, out_buf); 70 } 71 } 72 73 res_T 74 sdis_solve_probe_green_function 75 (struct sdis_scene* scn, 76 const struct sdis_solve_probe_args* args, 77 struct sdis_green_function** out_green) 78 { 79 if(!scn) return RES_BAD_ARG; 80 if(scene_is_2d(scn)) { 81 return solve_probe_2d(scn, args, out_green, NULL); 82 } else { 83 return solve_probe_3d(scn, args, out_green, NULL); 84 } 85 } 86 87 res_T 88 sdis_solve_probe_boundary 89 (struct sdis_scene* scn, 90 const struct sdis_solve_probe_boundary_args* args, 91 struct sdis_estimator** out_estimator) 92 { 93 if(!scn) return RES_BAD_ARG; 94 if(scene_is_2d(scn)) { 95 return solve_probe_boundary_2d(scn, args, NULL, out_estimator); 96 } else { 97 return solve_probe_boundary_3d(scn, args, NULL, out_estimator); 98 } 99 } 100 101 res_T 102 sdis_solve_probe_boundary_list 103 (struct sdis_scene* scn, 104 const struct sdis_solve_probe_boundary_list_args* args, 105 struct sdis_estimator_buffer** out_buf) 106 { 107 if(!scn) return RES_BAD_ARG; 108 if(scene_is_2d(scn)) { 109 return solve_probe_boundary_list_2d(scn, args, out_buf); 110 } else { 111 return solve_probe_boundary_list_3d(scn, args, out_buf); 112 } 113 } 114 115 res_T 116 sdis_solve_probe_boundary_green_function 117 (struct sdis_scene* scn, 118 const struct sdis_solve_probe_boundary_args* args, 119 struct sdis_green_function** green) 120 { 121 if(!scn) return RES_BAD_ARG; 122 if(scene_is_2d(scn)) { 123 return solve_probe_boundary_2d(scn, args, green, NULL); 124 } else { 125 return solve_probe_boundary_3d(scn, args, green, NULL); 126 } 127 } 128 129 res_T 130 sdis_solve_boundary 131 (struct sdis_scene* scn, 132 const struct sdis_solve_boundary_args* args, 133 struct sdis_estimator** out_estimator) 134 { 135 if(!scn) return RES_BAD_ARG; 136 if(scene_is_2d(scn)) { 137 return solve_boundary_2d(scn, args, NULL, out_estimator); 138 } else { 139 return solve_boundary_3d(scn, args, NULL, out_estimator); 140 } 141 } 142 143 res_T 144 sdis_solve_boundary_green_function 145 (struct sdis_scene* scn, 146 const struct sdis_solve_boundary_args* args, 147 struct sdis_green_function** green) 148 { 149 if(!scn) return RES_BAD_ARG; 150 if(scene_is_2d(scn)) { 151 return solve_boundary_2d(scn, args, green, NULL); 152 } else { 153 return solve_boundary_3d(scn, args, green, NULL); 154 } 155 } 156 157 res_T 158 sdis_solve_probe_boundary_flux 159 (struct sdis_scene* scn, 160 const struct sdis_solve_probe_boundary_flux_args* args, 161 struct sdis_estimator** out_estimator) 162 { 163 if(!scn) return RES_BAD_ARG; 164 if(scene_is_2d(scn)) { 165 return solve_probe_boundary_flux_2d(scn, args, out_estimator); 166 } else { 167 return solve_probe_boundary_flux_3d(scn, args, out_estimator); 168 } 169 } 170 171 res_T 172 sdis_solve_boundary_flux 173 (struct sdis_scene* scn, 174 const struct sdis_solve_boundary_flux_args* args, 175 struct sdis_estimator** out_estimator) 176 { 177 if(!scn) return RES_BAD_ARG; 178 if(scene_is_2d(scn)) { 179 return solve_boundary_flux_2d(scn, args, out_estimator); 180 } else { 181 return solve_boundary_flux_3d(scn, args, out_estimator); 182 } 183 } 184 185 res_T 186 sdis_solve_medium 187 (struct sdis_scene* scn, 188 const struct sdis_solve_medium_args* args, 189 struct sdis_estimator** estimator) 190 { 191 if(!scn) return RES_BAD_ARG; 192 if(scene_is_2d(scn)) { 193 return solve_medium_2d(scn, args, NULL, estimator); 194 } else { 195 return solve_medium_3d(scn, args, NULL, estimator); 196 } 197 } 198 199 res_T 200 sdis_solve_medium_green_function 201 (struct sdis_scene* scn, 202 const struct sdis_solve_medium_args* args, 203 struct sdis_green_function** green) 204 { 205 if(!scn) return RES_BAD_ARG; 206 if(scene_is_2d(scn)) { 207 return solve_medium_2d(scn, args, green, NULL); 208 } else { 209 return solve_medium_3d(scn, args, green, NULL); 210 } 211 } 212 213 res_T 214 sdis_compute_power 215 (struct sdis_scene* scn, 216 const struct sdis_compute_power_args* args, 217 struct sdis_estimator** estimator) 218 { 219 if(!scn) return RES_BAD_ARG; 220 if(scene_is_2d(scn)) { 221 return compute_power_2d(scn, args, estimator); 222 } else { 223 return compute_power_3d(scn, args, estimator); 224 } 225 }