sgs_c.h (2284B)
1 /* Copyright (C) 2021-2023 Centre National de la Recherche Scientifique 2 * Copyright (C) 2021-2023 INSA Lyon 3 * Copyright (C) 2021-2023 Institut Mines Télécom Albi-Carmaux 4 * Copyright (C) 2021-2023 |Méso|Star> (contact@meso-star.com) 5 * Copyright (C) 2021-2023 Institut Pascal 6 * Copyright (C) 2021-2023 PhotonLyX (info@photonlyx.com) 7 * Copyright (C) 2021-2023 Université de Lorraine 8 * Copyright (C) 2021-2023 Université Paul Sabatier 9 * Copyright (C) 2021-2023 Université Toulouse - Jean Jaurès 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 SGS_C_H 25 #define SGS_C_H 26 27 #include <rsys/double3.h> 28 #include <rsys/logger.h> 29 #include <rsys/rsys.h> 30 31 struct sgs_scene { 32 struct sgs_geometry* geom; 33 34 double D[3]; /* Dimension of the box */ 35 double recv_min[2]; /* 2D lower bound of the receiver (in XY frame) */ 36 double recv_max[2]; /* 2D upper bound of the receiver (in XY frame) */ 37 }; 38 39 struct sgs { 40 struct s3d_device* s3d; 41 struct sgs_scene scene; 42 size_t nrealisations; /* #realisations */ 43 44 unsigned int nthreads; /* #threads */ 45 46 int dump_geometry; 47 48 struct logger logger; 49 struct mem_allocator* allocator; 50 }; 51 52 /* Reflect the vector V wrt the normal N. By convention V points outward the 53 * surface. */ 54 static INLINE double* 55 reflect(double res[3], const double V[3], const double N[3]) 56 { 57 double tmp[3]; 58 double cos_V_N; 59 ASSERT(res && V && N); 60 ASSERT(d3_is_normalized(V) && d3_is_normalized(N)); 61 cos_V_N = d3_dot(V, N); 62 d3_muld(tmp, N, 2*cos_V_N); 63 d3_sub(res, tmp, V); 64 return res; 65 } 66 67 extern LOCAL_SYM void 68 setup_logger 69 (struct sgs* sgs); 70 71 extern LOCAL_SYM res_T 72 compute_sensitivity_translation 73 (struct sgs* sgs); 74 75 #endif /* SGS_C_H */