htrdr_combustion_laser.h (4069B)
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_COMBUSTION_LASER_H 25 #define HTRDR_COMBUSTION_LASER_H 26 27 #include "core/htrdr_args.h" 28 29 #include <rsys/rsys.h> 30 31 /* Monochromatic laser */ 32 struct htrdr_combustion_laser_create_args { 33 struct htrdr_args_rectangle surface; /* Surface emission */ 34 double wavelength; /* In nanometers */ 35 double flux_density; /* In W/m^2 */ 36 }; 37 #define HTRDR_COMBUSTION_LASER_CREATE_ARGS_DEFAULT__ { \ 38 HTRDR_ARGS_RECTANGLE_DEFAULT__, \ 39 -1, /* Wavelength */ \ 40 -1, /* Flux density */ \ 41 } 42 static const struct htrdr_combustion_laser_create_args 43 HTRDR_COMBUSTION_LASER_CREATE_ARGS_DEFAULT = 44 HTRDR_COMBUSTION_LASER_CREATE_ARGS_DEFAULT__; 45 46 struct htrdr_combustion_laser_mesh { 47 double vertices[8/*#vertices*/*3/*#coords per vertex*/]; 48 /* Triangle are clock wise ordered from the inside of the laser sheet */ 49 unsigned triangles[10/*#triangles*/*3/*#vertices per triangle*/]; 50 unsigned nvertices; 51 unsigned ntriangles; 52 }; 53 54 /* Syntactic sugar to check if a laser sheet hit is valid */ 55 #define HTRDR_COMBUSTION_LASER_HIT_NONE(Hit) ((Hit)[0] >= FLT_MAX) 56 57 /* Forward declaration */ 58 struct htrdr; 59 struct htrdr_combustion_laser; 60 61 BEGIN_DECLS 62 63 extern LOCAL_SYM res_T 64 htrdr_combustion_laser_create 65 (struct htrdr* htrdr, 66 const struct htrdr_combustion_laser_create_args* args, 67 struct htrdr_combustion_laser** laser); 68 69 extern LOCAL_SYM void 70 htrdr_combustion_laser_ref_get 71 (struct htrdr_combustion_laser* laser); 72 73 extern LOCAL_SYM void 74 htrdr_combustion_laser_ref_put 75 (struct htrdr_combustion_laser* laser); 76 77 extern LOCAL_SYM void 78 htrdr_combustion_laser_trace_ray 79 (struct htrdr_combustion_laser* laser, 80 const double pos[3], 81 const double dir[3], 82 const double range[2], 83 double distance[2]); 84 85 extern LOCAL_SYM void 86 htrdr_combustion_laser_get_mesh 87 (const struct htrdr_combustion_laser* laser, 88 /* Max distance of the laser mesh along its infinite dimension */ 89 const double extent, 90 struct htrdr_combustion_laser_mesh* mesh); 91 92 extern LOCAL_SYM void 93 htrdr_combustion_laser_get_position 94 (const struct htrdr_combustion_laser* laser, 95 double pos[3]); 96 97 extern LOCAL_SYM void 98 htrdr_combustion_laser_get_direction 99 (const struct htrdr_combustion_laser* laser, 100 double dir[3]); /* Normalized */ 101 102 extern LOCAL_SYM double /* In W.m^2 */ 103 htrdr_combustion_laser_get_flux_density 104 (const struct htrdr_combustion_laser* laser); 105 106 extern LOCAL_SYM double /* In nm */ 107 htrdr_combustion_laser_get_wavelength 108 (const struct htrdr_combustion_laser* laser); 109 110 extern LOCAL_SYM double 111 htrdr_combustion_laser_compute_surface_plane_distance 112 (const struct htrdr_combustion_laser* laser, 113 const double pos[3]); 114 115 END_DECLS 116 117 #endif /* HTRDR_COMBUSTION_LASER_H */