htrdr_ran_wlen_discrete.h (2517B)
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 Pierre-Simon Laplace 4 * Copyright (C) 2022-2025 Institut de Physique du Globe de Paris 5 * Copyright (C) 2018-2025 |Méso|Star> (contact@meso-star.com) 6 * Copyright (C) 2022-2025 Observatoire de Paris 7 * Copyright (C) 2022-2025 Université de Reims Champagne-Ardenne 8 * Copyright (C) 2022-2025 Université de Versaille Saint-Quentin 9 * Copyright (C) 2018-2019, 2022-2025 Université Paul Sabatier 10 * 11 * This program is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation, either version 3 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 23 24 #ifndef HTRDR_RAN_WLEN_DISCRETE_H 25 #define HTRDR_RAN_WLEN_DISCRETE_H 26 27 #include "core/htrdr.h" 28 #include <rsys/rsys.h> 29 30 struct htrdr_ran_wlen_discrete_create_args { 31 void (*get) 32 (void* ctx, 33 const size_t i, 34 double* wlen, /* In nanometer */ 35 double* radiance); /* In W/m²/sr/m */ 36 size_t nwavelengths; 37 void* context; /* User defined data */ 38 }; 39 #define HTRDR_RAN_WLEN_DISCRETE_CREATE_ARGS_NULL__ {NULL, 0, NULL} 40 static const struct htrdr_ran_wlen_discrete_create_args 41 HTRDR_RAN_WLEN_DISCRETE_CREATE_ARGS_NULL = 42 HTRDR_RAN_WLEN_DISCRETE_CREATE_ARGS_NULL__; 43 44 /* Forward declarations */ 45 struct htrdr; 46 struct htrdr_ran_wlen_discrete; 47 48 BEGIN_DECLS 49 50 HTRDR_API res_T 51 htrdr_ran_wlen_discrete_create 52 (struct htrdr* htrdr, 53 const struct htrdr_ran_wlen_discrete_create_args* args, 54 struct htrdr_ran_wlen_discrete** ran); 55 56 HTRDR_API void 57 htrdr_ran_wlen_discrete_ref_get 58 (struct htrdr_ran_wlen_discrete* ran); 59 60 HTRDR_API void 61 htrdr_ran_wlen_discrete_ref_put 62 (struct htrdr_ran_wlen_discrete* ran); 63 64 HTRDR_API double /* wavelength in nanometer */ 65 htrdr_ran_wlen_discrete_sample 66 (struct htrdr_ran_wlen_discrete* ran, 67 const double r0, const double r1, /* Canonical number in [0, 1[ */ 68 double* pdf); /* In nm⁻¹ */ 69 70 END_DECLS 71 72 #endif /* HTRDR_RAN_WLEN_DISCRETE_H */