stardis-solid-prog.h (2498B)
1 /* Copyright (C) 2018-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 #ifndef SDIS_SOLID_PROG_H 17 #define SDIS_SOLID_PROG_H 18 19 #include <rsys/rsys.h> 20 #include <rsys/str.h> 21 22 #include "stardis-prog-properties.h" 23 24 struct stardis; 25 struct mem_allocator; 26 struct program; 27 28 /******************************************************************************* 29 * Solid prog data 30 ******************************************************************************/ 31 struct solid_prog { 32 void* prog_data; /* result of the create() call */ 33 struct str name; 34 struct str prog_name; 35 size_t argc; 36 char** argv; 37 int is_outside; /* the solid is used for a boundary */ 38 unsigned desc_id; /* id of the boundary; meaningful if is_outside */ 39 unsigned solid_id; 40 /* lib handle and function ptrs */ 41 struct program* program; 42 void* (*create) 43 (const struct stardis_description_create_context*, void*, size_t, char**); 44 void (*release)(void*); 45 double (*lambda)(const struct stardis_vertex*, void*); 46 double (*rho)(const struct stardis_vertex*, void*); 47 double (*cp)(const struct stardis_vertex*, void*); 48 double (*delta)(const struct stardis_vertex*, void*); 49 double (*temp)(const struct stardis_vertex*, void*); 50 double (*vpower)(const struct stardis_vertex*, void*); 51 double (*t_range)(void* data, double t_range[2]); 52 53 /* User-defined function for sampling a conductive path */ 54 int 55 (*sample_path) 56 (struct sdis_scene*, 57 struct ssp_rng*, 58 struct stardis_path*, 59 void*); 60 }; 61 62 res_T 63 create_solver_solid_prog 64 (struct stardis* stardis, 65 const struct solid_prog* solid_props); 66 67 res_T 68 init_solid_prog 69 (struct mem_allocator* allocator, 70 struct solid_prog** dst); 71 72 void 73 release_solid_prog 74 (struct solid_prog* solid, 75 struct mem_allocator* allocator); 76 77 res_T 78 str_print_solid_prog 79 (struct str* str, 80 const struct solid_prog* s); 81 82 #endif