star-phor

Radiative transfer solver for photoreactors.
git clone https://www.edstar.cnrs.fr/git/star-phor.git
Log | Files | Refs | README | LICENSE

sphor_c.h (2847B)


      1 /* Copyright (C) 2024-2026 Centre National de la Recherche Scientifique
      2  * Copyright (C) 2024-2026 Clermont Auvergne INP
      3  * Copyright (C) 2024-2026 INSA Lyon
      4  * Copyright (C) 2024-2026 Institut Mines Télécom Albi-Carmaux
      5  * Copyright (C) 2024-2026 Institut National Polytechnique de Toulouse
      6  * Copyright (C) 2024-2026 |Méso|Star> (contact@meso-star.com)
      7  * Copyright (C) 2024-2026 PhotonLyX (info@photonlyx.com)
      8  * Copyright (C) 2024-2026 Université de Lorraine
      9  * Copyright (C) 2024-2026 Université Paul Sabatier
     10  * Copyright (C) 2024-2026 Université Toulouse - Jean Jaurès
     11  *
     12  * This program is free software: you can redistribute it and/or modify
     13  * it under the terms of the GNU General Public License as published by
     14  * the Free Software Foundation, either version 3 of the License, or
     15  * (at your option) any later version.
     16  *
     17  * This program is distributed in the hope that it will be useful,
     18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     20  * GNU General Public License for more details.
     21  *
     22  * You should have received a copy of the GNU General Public License
     23  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     24 
     25 #ifndef SPHOR_C_H
     26 #define SPHOR_C_H
     27 
     28 #include "sphor_interface.h"
     29 #include "sphor_sources.h"
     30 
     31 #include <rsys/logger.h>
     32 #include <rsys/ref_count.h>
     33 #include <rsys/rsys.h>
     34 
     35 #include <stdio.h>
     36 
     37 /* Helper macros for logging */
     38 #define LOG__(Dev, Lvl, Type, ...) { \
     39   if ((Dev)->verbose >= (Lvl)) \
     40     logger_print((Dev)->logger, Type, __VA_ARGS__); \
     41 } (void)0
     42 #define ERROR(Dev, ...) LOG__(Dev, 1, LOG_ERROR,   __VA_ARGS__)
     43 #define WARN(Dev, ...) LOG__(Dev, 2, LOG_WARNING, __VA_ARGS__)
     44 #define INFO(Dev, ...) LOG__(Dev, 3, LOG_OUTPUT,  __VA_ARGS__)
     45 
     46 /* Forward declarations */
     47 struct s3d_scene_view;
     48 struct sphin_geometry_descriptor;
     49 struct sphor_create_args;
     50 struct suniq;
     51 struct suniq_triangle;
     52 
     53 struct sphor {
     54   /* Physical configuration */
     55   struct sphin_config* config;
     56   struct darray_interface interfaces;
     57   struct ssp_ranst_discrete* source_distrib_power;
     58 
     59   /* Geometrical data */
     60   struct s3d_scene_view* scene_view;
     61   struct darray_source_view source_views;
     62 
     63   /* Monte Carlo variables */
     64   unsigned nthreads; /* hint: number of threads; defaults to all available
     65                         threads in the computer */
     66   size_t samples; /* number of realisations used during the Monte Carlo
     67                      integrating algorithm */
     68 
     69   /* Output stream (can be NULL: stdout) */
     70   FILE* stream;
     71 
     72   /* Log */
     73   struct logger* logger;
     74   int verbose;
     75 
     76   /* Memory management */
     77   struct mem_allocator* allocator;
     78   ref_T ref;
     79 };
     80 
     81 extern LOCAL_SYM FILE* /* Returns NULL if an error occurs */
     82 open_output_stream
     83   (const struct sphor_create_args* args,
     84    const struct sphor* sphor);
     85 
     86 #endif /* SPHOR_C_H */