- ChemApp has to be initalized.
- A data file has to be read.
- An iteration_input struct and an iteration_output has to be initialized (Explanation for the fields are given in iter.h).
- run_iteration can be called.
char* error_code_to_str( int error_code )
- turns an errror code given by run_iteration into a hopefully helpfull error message
void print_settings( struct iteration_input, int nelements, int nphases )
- prints a table with the options set in iteration_input
- nelements = number of elements
- nphases = number of phases
int show_total_chemapp_errors( int show_them )
- returns the total of ChemApp errors that occurred
- if show_them is 0 it will print nothing and increase the error count
- if show_them is not 0, it will print them
void table()
- prints a table with all phase name, amount and activity
void check_elimination( int eliminated[], double margin )
- checks which phases could be eliminated in the current equilibrium
- margin is the offset from zero which is still thought to be low enough for elimination
DB calc_error( DB amounts, DB amounts_with_eliminations )
- returns the error which was causes by eliminating a phase
int biggest_error_calc( DB amounts[], DB amounts_with_eliminations[], DB biggest_error_so_far[] )
- returns 1 if there is an error otherwhise 0
- amounts = amounts of all phases without elimination
- amounts_with_eliminations = amounts of all phases with elimination
- biggest_error_so_far = before first call all set to 0, in subsequent the biggest error for
a phases will be saved there
void get_amounts( DB amounts[] )
- retrieves the equilibrium amounts of all phases
void count_amounts( DB total_amount[] )
- adds up the current amounts in the equilibrium to total_amounts
void show_amounts( DB total_amount[] )
- prints the total amount for all phases in a table
void enter_all_phases()
void reset_vars( DB a, DB b, DB c, DB d, DB e, DB f )
void set_all_ia( int arr[], int step, int* ignored_elements )
- sets the initial amount for all phases
- will not set for ignored elements
- step: initial amount is set in iteration_input as an integer
step says by what it must be diveded to be the correct double value for initial amount
preset is 10
void eliminate_phases( int eliminate[] )
- takes an array as arguments, each phase with (index == 0) will be eliminated
int check_for_ignored_element( int element, int* ignored_elements )
- returns 1 if the element should be ignored
int sum_array( int arr[], int n )
- sums up an array and returns the sum
int check_for_range( int arr[], int min_set_ranges[], int max_set_ranges[], int nelements )
- returns 0 if any element is out of range