htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

htrdr_solve_buffer.h (3056B)


      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_SOLVE_BUFFER_H
     25 #define HTRDR_SOLVE_BUFFER_H
     26 
     27 struct htrdr_solve_item_args {
     28   struct ssp_rng* rng; /* Random Number Generator */
     29   size_t item_id; /* Index of the item */
     30   size_t nrealisations; /* #realisations to estimate the item */
     31   size_t ithread; /* Id of the thread solving the item */
     32   void* context; /* User defined data */
     33 };
     34 #define HTRDR_SOLVE_ITEM_ARGS_NULL__ {NULL, 0, 0, 0, NULL}
     35 static const struct htrdr_solve_item_args HTRDR_SOLVE_ITEM_ARGS_NULL =
     36   HTRDR_SOLVE_ITEM_ARGS_NULL__;
     37 
     38 typedef void
     39 (*htrdr_solve_item_T)
     40   (struct htrdr* htrdr,
     41    const struct htrdr_solve_item_args* args,
     42    void* item); /* Output data */
     43 
     44 struct htrdr_solve_buffer_args {
     45   htrdr_solve_item_T solve_item; /* User defined functor */
     46   struct htrdr_buffer_layout buffer_layout;
     47   size_t nrealisations; /* #realisations per item */
     48   void* context; /* User defined data */
     49 };
     50 #define HTRDR_SOLVE_BUFFER_ARGS_NULL__ {                                       \
     51   NULL, /* Solver item functor */                                              \
     52   HTRDR_BUFFER_LAYOUT_NULL__, /* Layout of the destination buffer */           \
     53   0, /* #realisations per item */                                              \
     54   NULL /* User defined data */                                                 \
     55 }
     56 static const struct htrdr_solve_buffer_args HTRDR_SOLVE_BUFFER_ARGS_NULL =
     57   HTRDR_SOLVE_BUFFER_ARGS_NULL__;
     58 
     59 /*******************************************************************************
     60  * Exported symbols
     61  ******************************************************************************/
     62 BEGIN_DECLS
     63 
     64 HTRDR_API res_T
     65 htrdr_solve_buffer
     66   (struct htrdr* htrdr,
     67    const struct htrdr_solve_buffer_args* args,
     68    struct htrdr_buffer* buf); /* May be NULL for non master processes */
     69 
     70 END_DECLS
     71 
     72 #endif /* HTRDR_SOLVE_BUFFER_H */