ISLEC  Version 4.2
islre.c
Go to the documentation of this file.
1 /* src/islre.c
2  *
3  * Copyright (C) 2011-2018 Dongdong Li
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundataion; either version 3 of the License, or (at
8  * your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABLITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <string.h>
33 #include <getopt.h>
34 #include <time.h>
35 #include <math.h>
36 #include <stdbool.h>
37 
38 #include "islre.h"
39 #include "copyright.c"
40 #include "usage.c"
41 #include "version.c"
42 #include "clear_comments.c"
43 #include "load_db.c"
44 #include "load_exp.c"
45 #include "test_load.c"
46 #include "test_models.c"
47 #include "psc_model.c"
48 #include "rkg_model.c"
49 #include "gem_ipopt.c"
50 #include "gsl_reg.c"
51 #include "print_results.c"
52 
53 char *l_opt_arg;
54 char* const short_options = "vh";
55 struct option long_options[] = {
56  { "version", 0, NULL, 'v'},
57  { "help", 0, NULL, 'h'},
58  { 0, 0, 0, 0},
59 };
60 
61 int main (int argc, char *argvs[])
62 {
63  int c;
64 
66 
67  if (argc == 1)
68  {
69  print_re_usage (0);
70  return 100;
71  }
72 
73  while((c = getopt_long (argc, argvs, short_options, long_options, NULL)) != -1)
74  {
75  switch (c)
76  {
77  case 'h':
78  print_re_usage (0);
79  return 100;
80  case 'v':
81  print_re_version ();
82  return 201;
83  }
84  }
85 
86  if (argc < 4)
87  {
88  printf ("invalid arguments\n");
89  exit(0);
90  }
91 
92  // the first step must be load databank
93  if (load_db (argvs[1], TEMP_FILE) == false)
94  {
95  return 300;
96  }
97 
98  fitted_param_num = atoi (argvs[3]);
99 
100  //test_load();
101 
102  if (load_exp (argvs[2]) == false)
103  {
104  return 301;
105  }
106 
107  gsl_reg ();
108 
109  return 0;
110 }
char * l_opt_arg
Definition: islre.c:53
Header file of the ISLRE program.
Perform Gibbs energy minimization of the whole thermodynamic system using the open source IPOPT optim...
Implementation of activity (a) and activity coefficient (r) equations of a revised Pitzer-Simonson-Cl...
bool load_exp(char *exp)
Definition: load_exp.c:32
Perform parameter regression combining single point Gibbs energy minimization and the GNU Scientific ...
Implementation of activity (a) equation of the Redlich-Kister-Guggenheim (RKG) sub-regular solution m...
Load experimental data from a file for parameter regression; the loaded data include water activity (...
Test the correctness of the loaded database content by printing them.
bool load_db(char *input, char *temp)
Definition: load_db.c:718
int fitted_param_num
Definition: islre.h:282
Test the correctness of the activity equations of PSC and RKG models.
Output ISLEC and ISLRE usage information.
Load (after cleared all commented and black lines) database file into memory object components and ph...
Output ISLEC and ISLRE version information.
void print_re_version()
Definition: version.c:35
struct option long_options[]
Definition: islre.c:55
char *const short_options
Definition: islre.c:54
void gsl_reg()
Definition: gsl_reg.c:700
#define TEMP_FILE
Definition: islec.h:39
int main(int argc, char *argvs[])
Definition: islre.c:61
Clear all commented lines (started with the character &#39;#&#39;) and black lines included in a user specifi...
void print_re_usage(int exit_code)
Definition: usage.c:38