solstice

Compute collected power and efficiencies of a solar plant
git clone git://git.meso-star.com/solstice.git
Log | Files | Refs | README | LICENSE

main.c (1524B)


      1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com)
      2  * Copyright (C) 2016-2018 CNRS
      3  *
      4  * This program is free software: you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License as published by
      6  * the Free Software Foundation, either version 3 of the License, or
      7  * (at your option) any later version.
      8  *
      9  * This program is distributed in the hope that it will be useful,
     10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     12  * GNU General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU General Public License
     15  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     16 
     17 #include "solstice.h"
     18 #include "solstice_args.h"
     19 
     20 #include <rsys/rsys.h>
     21 
     22 int
     23 main(int argc, char** argv)
     24 {
     25   struct solstice_args args;
     26   struct solstice solstice;
     27   size_t memsz = 0;
     28   res_T res;
     29   int solstice_is_init = 0;
     30   int err = 0;
     31 
     32   res = solstice_args_init(&args, argc, argv);
     33   if(res != RES_OK) goto error;
     34   if(args.quit) goto exit;
     35 
     36   res = solstice_init(NULL, &args, &solstice);
     37   if(res != RES_OK) goto error;
     38   solstice_is_init = 1;
     39 
     40   res = solstice_run(&solstice);
     41   if(res != RES_OK) goto error;
     42 
     43 exit:
     44   if(solstice_is_init) solstice_release(&solstice);
     45   solstice_args_release(&args);
     46   if((memsz = mem_allocated_size()) != 0) {
     47     fprintf(stderr, "Memory leaks: %lu Bytes\n", (unsigned long)memsz);
     48   }
     49   return err;
     50 error:
     51   err = -1;
     52   goto exit;
     53 }
     54