stardis

Perform coupled heat transfer calculations
git clone git://git.meso-star.fr/stardis.git
Log | Files | Refs | README | LICENSE

stardis-args.h.in (5581B)


      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 STARDIS_ARGS_H
     17 #define STARDIS_ARGS_H
     18 
     19 #define STARDIS_MAX_NAME_LENGTH @STARDIS_MAX_NAME_LENGTH@
     20 
     21 #include <sdis.h>
     22 
     23 #include <rsys/rsys.h>
     24 #include <rsys/dynamic_array_str.h>
     25 
     26 struct camera;
     27 struct logger;
     28 struct mem_allocator;
     29 struct stardis;
     30 
     31 struct stardis_probe_boundary {
     32   double position[3];
     33   double time[2]; /* Observation time */
     34   char side[STARDIS_MAX_NAME_LENGTH];
     35 };
     36 #define STARDIS_PROBE_BOUNDARY_NULL__ {{0,0,0},{0,0},{0}}
     37 static const struct stardis_probe_boundary STARDIS_PROBE_BOUNDARY_NULL =
     38   STARDIS_PROBE_BOUNDARY_NULL__;
     39 
     40 /* Define the dynamic array of probes on the boundary */
     41 #define DARRAY_NAME probe_boundary
     42 #define DARRAY_DATA struct stardis_probe_boundary
     43 #include <rsys/dynamic_array.h>
     44 
     45 enum stardis_mode {
     46   /* Ordered so that print_multiple_modes() prints in alphabetical order */
     47   UNDEF_MODE = 0,
     48   MODE_DUMP_C_CHUNKS = BIT(0), /* -c */
     49   MODE_DUMP_PATHS = BIT(1), /* -D */
     50   MODE_DUMP_MODEL = BIT(2), /* -d */
     51   MODE_EXTENDED_RESULTS = BIT(3), /* -e */
     52   MODE_COMPUTE_FLUX_THROUGH_SURF= BIT(4), /* -F */
     53   MODE_COMPUTE_PROBE_FLUX_DNSTY_ON_SURF = BIT(5), /* -f */
     54   MODE_GREEN_BIN = BIT(6), /* -G */
     55   MODE_GREEN_ASCII = BIT(7), /* -g */
     56   MODE_DUMP_HELP = BIT(8), /* -h */
     57   MODE_COMPUTE_LIST_PROBE_TEMP_ON_SURF = BIT(9), /* -L */
     58   MODE_COMPUTE_LIST_PROBE_FLUX_DNSTY_ON_SURF = BIT(10), /* -l */
     59   MODE_COMPUTE_TEMP_MEAN_IN_MEDIUM = BIT(11), /* -m */
     60   MODE_COMPUTE_PROBE_TEMP_ON_SURF = BIT(12), /* -P */
     61   MODE_COMPUTE_PROBE_TEMP_ON_VOL = BIT(13), /* -p */
     62   MODE_COMPUTE_IMAGE_IR = BIT(14), /* -R */
     63   MODE_COMPUTE_TEMP_MAP_ON_SURF = BIT(15), /* -S */
     64   MODE_COMPUTE_TEMP_MEAN_ON_SURF = BIT(16), /* -s */
     65   MODE_VERBOSITY = BIT(17), /* -V */
     66   MODE_DUMP_VERSION = BIT(18), /* -v */
     67 
     68   GREEN_COMPATIBLE_MODES =
     69     MODE_COMPUTE_PROBE_TEMP_ON_VOL
     70   | MODE_COMPUTE_PROBE_TEMP_ON_SURF
     71   | MODE_COMPUTE_TEMP_MEAN_IN_MEDIUM
     72   | MODE_COMPUTE_TEMP_MEAN_ON_SURF,
     73 
     74   SURFACE_COMPUTE_MODES =
     75     MODE_COMPUTE_TEMP_MEAN_ON_SURF
     76   | MODE_COMPUTE_FLUX_THROUGH_SURF
     77   | MODE_COMPUTE_TEMP_MAP_ON_SURF,
     78 
     79   EXT_COMPATIBLE_MODES =
     80     GREEN_COMPATIBLE_MODES
     81   | MODE_COMPUTE_TEMP_MEAN_IN_MEDIUM
     82   | MODE_COMPUTE_FLUX_THROUGH_SURF
     83   | MODE_COMPUTE_PROBE_FLUX_DNSTY_ON_SURF,
     84 
     85   REGION_COMPUTE_MODES =
     86     SURFACE_COMPUTE_MODES
     87   | MODE_COMPUTE_TEMP_MEAN_IN_MEDIUM,
     88 
     89   COMPUTE_MODES =
     90     GREEN_COMPATIBLE_MODES
     91   | MODE_COMPUTE_IMAGE_IR
     92   | SURFACE_COMPUTE_MODES
     93   | MODE_COMPUTE_LIST_PROBE_TEMP_ON_SURF
     94   | MODE_COMPUTE_PROBE_FLUX_DNSTY_ON_SURF
     95   | MODE_COMPUTE_LIST_PROBE_FLUX_DNSTY_ON_SURF,
     96 
     97   EXCLUSIVE_MODES = COMPUTE_MODES,
     98 
     99   SHORT_EXIT_MODES =
    100     MODE_DUMP_HELP
    101   | MODE_DUMP_VERSION,
    102 
    103   USE_STDOUT_MODES =
    104     MODE_DUMP_C_CHUNKS
    105   | MODE_DUMP_HELP
    106   | MODE_DUMP_VERSION
    107   | MODE_COMPUTE_IMAGE_IR
    108   | MODE_GREEN_ASCII,
    109 
    110   RANDOM_RW_MODES =
    111     MODE_COMPUTE_PROBE_TEMP_ON_VOL
    112   | MODE_COMPUTE_PROBE_TEMP_ON_SURF
    113   | MODE_COMPUTE_LIST_PROBE_TEMP_ON_SURF
    114   | MODE_COMPUTE_LIST_PROBE_FLUX_DNSTY_ON_SURF
    115   | MODE_COMPUTE_TEMP_MEAN_IN_MEDIUM
    116   | MODE_COMPUTE_TEMP_MEAN_ON_SURF
    117   | MODE_COMPUTE_FLUX_THROUGH_SURF
    118   | MODE_COMPUTE_PROBE_FLUX_DNSTY_ON_SURF,
    119 
    120   CAN_DUMP_PATHS =
    121     MODE_COMPUTE_PROBE_TEMP_ON_VOL |
    122     MODE_COMPUTE_IMAGE_IR |
    123     MODE_COMPUTE_TEMP_MEAN_IN_MEDIUM |
    124     MODE_COMPUTE_TEMP_MEAN_ON_SURF |
    125     MODE_COMPUTE_TEMP_MAP_ON_SURF |
    126     MODE_COMPUTE_PROBE_TEMP_ON_SURF
    127 };
    128 
    129 STATIC_ASSERT(GREEN_COMPATIBLE_MODES == (COMPUTE_MODES & GREEN_COMPATIBLE_MODES),
    130   Cannot_have_a_GREEN_COMPATIBLE_MODE_that_is_not_a_COMPUTE_MODE);
    131 
    132 enum dump_path_type {
    133   DUMP_NONE = 0,
    134   DUMP_SUCCESS = BIT(0),
    135   DUMP_ERROR = BIT(1),
    136   DUMP_ALL = DUMP_SUCCESS | DUMP_ERROR
    137 };
    138 
    139 struct args {
    140   struct logger* logger;
    141   struct mem_allocator* allocator;
    142   struct darray_str model_files;
    143   char* medium_name;
    144   char* solve_filename;
    145   char* bin_green_filename;
    146   char* end_paths_filename;
    147   char* dump_model_filename;
    148   char* paths_filename;
    149   char* rndgen_state_in_filename;
    150   char* rndgen_state_out_filename;
    151   char* chunks_prefix;
    152   char* camera;
    153   size_t samples;
    154   double pos_and_time[5];
    155   double initial_time; /* [s] */
    156   unsigned nthreads;
    157   unsigned picard_order;
    158   int mode;
    159   enum dump_path_type dump_paths;
    160   enum sdis_diffusion_algorithm diff_algo;
    161   int verbose;
    162   int disable_intrad; /* Disable internal radiative exchanges */
    163 
    164   struct darray_probe_boundary probe_boundary_list;
    165 };
    166 
    167 extern LOCAL_SYM res_T
    168 init_args
    169   (struct logger* logger,
    170    struct mem_allocator* mem,
    171    struct args** args);
    172 
    173 extern LOCAL_SYM void
    174 release_args
    175   (struct args* args);
    176 
    177 extern LOCAL_SYM void
    178 print_version
    179   (FILE* stream);
    180 
    181 extern LOCAL_SYM void
    182 usage
    183   (FILE* stream);
    184 
    185 extern LOCAL_SYM res_T
    186 parse_args
    187   (const int argc,
    188    char** argv,
    189    struct args* args,
    190    struct mem_allocator* allocator);
    191 
    192 extern LOCAL_SYM res_T
    193 parse_camera
    194   (struct logger* logger,
    195    char* cam_param,
    196    struct stardis* stardis);
    197 
    198 #endif /* STRADIS_ARGS_H */