ITM AMNS: User Interface  \$Id: Doxyfile 502 2015-10-15 12:23:45Z dpc $
test_c.c
Go to the documentation of this file.
1 
8 #include "amns_interface.h"
9 
10 int main(int argc, char *argv[])
11 {
12  void* amns_handle = NULL;
14  void* reactants_handle = NULL;
15  amns_c_reactant_type species1 = {.ZN=6, .ZA=1, .MI=12, .LR=0};
16  amns_c_reactant_type species2 = {.ZN=1, .ZA=0, .MI=2 , .LR=0};
17  amns_c_reactant_type species3 = {.ZN=6, .ZA=0, .MI=12, .LR=1};
18  amns_c_reactant_type species4 = {.ZN=1, .ZA=1, .MI=2 , .LR=1};
19  amns_c_reaction_type xx_rx = {.string = "CX"};
20  void* amns_cx_handle;
21  double rate;
22 
23  ITM_AMNS_CC_SETUP(&amns_handle, &error_stat);
24  printf("error = %s: %s\n", error_stat.flag ? "true" : "false", error_stat.string);
25  ITM_AMNS_CC_SETUP_REACTANTS(&reactants_handle, "", 0, 4);
26  ITM_AMNS_CC_SET_REACTANT(reactants_handle, 1, &species1);
27  ITM_AMNS_CC_SET_REACTANT(reactants_handle, 2, &species2);
28  ITM_AMNS_CC_SET_REACTANT(reactants_handle, 3, &species3);
29  ITM_AMNS_CC_SET_REACTANT(reactants_handle, 4, &species4);
30  ITM_AMNS_CC_SETUP_TABLE(amns_handle, &xx_rx, reactants_handle, &amns_cx_handle, &error_stat);
31  printf("error = %s: %s\n", error_stat.flag ? "true" : "false", error_stat.string);
32  ITM_AMNS_CC_RX_0_B(amns_cx_handle, &rate, 100.0, 1e20, &error_stat);
33  printf("error = %s: %s\n", error_stat.flag ? "true" : "false", error_stat.string);
34  printf("Rate = %25.15e\n", rate);
35  ITM_AMNS_CC_FINISH_TABLE(&amns_cx_handle, &error_stat);
36  printf("error = %s: %s\n", error_stat.flag ? "true" : "false", error_stat.string);
37  ITM_AMNS_CC_FINISH_REACTANTS(&reactants_handle);
38  ITM_AMNS_CC_FINISH(&amns_handle, &error_stat);
39  printf("error = %s: %s\n", error_stat.flag ? "true" : "false", error_stat.string);
40  return 0;
41 }
Type for error returns from the AMNS interface ("C" version)
const amns_c_error_type DEFAULT_AMNS_C_ERROR_TYPE
void ITM_AMNS_CC_FINISH_TABLE(void **handle_rx_inout, amns_c_error_type *error_status)
Type used for specifying reactions when using the AMNS interface ("C" version)
char * string
name of the reaction (e.g. RC)
void ITM_AMNS_CC_FINISH_REACTANTS(void **reactants_handle_inout)
void ITM_AMNS_CC_FINISH(void **handle_inout, amns_c_error_type *error_status)
int main(int argc, char *argv[])
Definition: test_c.c:10
void ITM_AMNS_CC_SETUP_REACTANTS(void **reactants_handle_out, char *string_in, int index_in, int n_reactants)
void ITM_AMNS_CC_RX_0_B(void *handle_rx_in, double *out, double arg1, double arg2, amns_c_error_type *error_status)
void ITM_AMNS_CC_SET_REACTANT(void *reactants_handle_in, int reactant_index, amns_c_reactant_type *reactant_in)
bool flag
True if an error occurred.
double ZN
Nuclear charge.
Type for indicating a single reactant or product when using the AMNS interface.
void ITM_AMNS_CC_SETUP_TABLE(void *handle_in, amns_c_reaction_type *reaction_type, void *reactant_handle_in, void **handle_rx_out, amns_c_error_type *error_status)
char * string
text describing the error if flag was True
void ITM_AMNS_CC_SETUP(void **handle_out, amns_c_error_type *error_status)