solparser_sun.h (2084B)
1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) 2 * Copyright (C) 2016-2018 CNRS 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 16 17 #ifndef SOLPARSER_SUN_H 18 #define SOLPARSER_SUN_H 19 20 #include "solparser_spectrum.h" 21 #include <rsys/dynamic_array.h> 22 23 enum solparser_sun_radang_distrib_type { /* Radial Angular distribution */ 24 SOLPARSER_SUN_RADANG_DISTRIB_BUIE, 25 SOLPARSER_SUN_RADANG_DISTRIB_DIRECTIONAL, 26 SOLPARSER_SUN_RADANG_DISTRIB_PILLBOX, 27 SOLPARSER_SUN_RADANG_DISTRIB_GAUSSIAN 28 }; 29 30 struct solparser_sun_buie { double csr; }; 31 struct solparser_sun_pillbox { double half_angle; }; 32 struct solparser_sun_gaussian { double std_dev; }; 33 34 struct solparser_sun { 35 double dni; /* In ]0, INF) */ 36 struct solparser_spectrum_id spectrum; 37 enum solparser_sun_radang_distrib_type radang_distrib_type; 38 union { 39 struct solparser_sun_buie buie; 40 struct solparser_sun_pillbox pillbox; 41 struct solparser_sun_gaussian gaussian; 42 } radang_distrib; 43 }; 44 45 static INLINE void 46 solparser_sun_init(struct mem_allocator* allocator, struct solparser_sun* sun) 47 { 48 ASSERT(sun); 49 (void)allocator; 50 sun->dni = 1.0; 51 sun->radang_distrib_type = SOLPARSER_SUN_RADANG_DISTRIB_DIRECTIONAL; 52 sun->spectrum.i = SIZE_MAX; 53 } 54 55 static INLINE void 56 solparser_sun_release(struct solparser_sun* sun) 57 { 58 ASSERT(sun); 59 (void)sun; 60 /* Do nothing */ 61 } 62 63 static INLINE void 64 solparser_sun_clear(struct solparser_sun* sun) 65 { 66 ASSERT(sun); 67 sun->spectrum.i = SIZE_MAX; 68 } 69 70 #endif /* SOLPARSER_SUN_H */ 71