From 0a7874068e77f654f99f8a66b57f3963fea8ec0f Mon Sep 17 00:00:00 2001 From: Darth Vader Date: Mon, 10 Apr 2023 03:21:02 +0000 Subject: [PATCH] Squashed 'phreeqcpp/' changes from e1de8e8..97a0327 97a0327 fixed compiler warnings except NAN ee1acc4 changed all double precision to real(kind=8) in all files. Compiles and runs test cases. git-subtree-dir: phreeqcpp git-subtree-split: 97a0327aa6a4017dcd2e0298f44d5e672b05288a --- cl1.cpp | 2 +- gases.cpp | 2 -- model.cpp | 5 ----- pitzer.cpp | 20 ++++++++++---------- prep.cpp | 7 ++----- spread.cpp | 4 +--- sundialsmath.h | 4 ++-- sundialstypes.h | 2 +- tally.cpp | 7 ------- 9 files changed, 17 insertions(+), 36 deletions(-) diff --git a/cl1.cpp b/cl1.cpp index 107a8ad9..b0dd1be4 100644 --- a/cl1.cpp +++ b/cl1.cpp @@ -142,7 +142,7 @@ cl1(int k, int l, int m, int n, /* AT LEAST NKLMD COLUMNS USED FOR WORKSPACE. */ /* S INTEGER ARRAY OF SIZE AT LEAST KLMD, USED FOR */ /* WORKSPACE. */ -/* DOUBLE PRECISION DBLE */ +/* real(kind=8) DBLE */ /* REAL */ /* INITIALIZATION. */ diff --git a/gases.cpp b/gases.cpp index d64d2c97..b373068a 100644 --- a/gases.cpp +++ b/gases.cpp @@ -624,7 +624,6 @@ int Phreeqc:: calc_fixed_volume_gas_pressures(void) /* ---------------------------------------------------------------------- */ { - int n_g = 0; LDBLE lp; class rxn_token *rxn_ptr; class phase *phase_ptr; @@ -645,7 +644,6 @@ calc_fixed_volume_gas_pressures(void) { if (!PR && phase_ptr->t_c > 0 && phase_ptr->p_c > 0) PR = true; - n_g++; } gas_phase_ptr->Set_total_moles(gas_phase_ptr->Get_total_moles() + gas_unknowns[i]->moles); } diff --git a/model.cpp b/model.cpp index 9bebfc87..bf8d8fd7 100644 --- a/model.cpp +++ b/model.cpp @@ -2543,7 +2543,6 @@ int Phreeqc:: calc_gas_pressures(void) /* ---------------------------------------------------------------------- */ { - int n_g = 0; LDBLE lp, V_m = 0; class rxn_token *rxn_ptr; std::vector phase_ptrs; @@ -2576,7 +2575,6 @@ calc_gas_pressures(void) phase_ptrs.push_back(phase_ptr); if (!PR && phase_ptr->t_c > 0 && phase_ptr->p_c > 0) PR = true; - n_g++; } if (iterations > 2 && gas_phase_ptr->Get_type() == cxxGasPhase::GP_VOLUME) { @@ -3778,7 +3776,6 @@ residuals(void) int converge; LDBLE l_toler; - LDBLE sum_residual; LDBLE sinh_constant; LDBLE sum, sum1; class master *master_ptr, *master_ptr1, *master_ptr2; @@ -3786,7 +3783,6 @@ residuals(void) int print_fail; std::vector cd_psi; print_fail = FALSE; - sum_residual = 0.0; sigmaddl = 0; sum = 0; /* @@ -4530,7 +4526,6 @@ residuals(void) * Store residuals in array */ my_array[((size_t)i + 1) * (count_unknowns + 1) - 1] = residual[i]; - sum_residual += fabs(residual[i]); } /* * Return diff --git a/pitzer.cpp b/pitzer.cpp index 77de08e5..b71f24d3 100644 --- a/pitzer.cpp +++ b/pitzer.cpp @@ -52,7 +52,7 @@ pitzer_tidy(void) const char *string1, *string2; int i, j, order; int i0, i1, i2; - int count_pos, count_neg, count_neut, count[3], jj; + int count_neut, count[3], jj; LDBLE z0, z1; class pitz_param *pzp_ptr; class theta_param *theta_param_ptr; @@ -339,21 +339,21 @@ pitzer_tidy(void) i0 = pitz_params[i]->ispec[0]; i1 = pitz_params[i]->ispec[1]; i2 = pitz_params[i]->ispec[2]; - count_pos = count_neg = count_neut = 0; + count_neut = 0; for (j = 0; j <= 2; j++) { - if (spec[pitz_params[i]->ispec[j]]->z > 0) - { - count_pos++; - } + //if (spec[pitz_params[i]->ispec[j]]->z > 0) + //{ + // count_pos++; + //} if (spec[pitz_params[i]->ispec[j]]->z == 0) { count_neut++; } - if (spec[pitz_params[i]->ispec[j]]->z < 0) - { - count_neg++; - } + //if (spec[pitz_params[i]->ispec[j]]->z < 0) + //{ + // count_neg++; + //} } /* All neutral */ if (count_neut == 3) diff --git a/prep.cpp b/prep.cpp index 82b3125c..0d26ba98 100644 --- a/prep.cpp +++ b/prep.cpp @@ -1980,14 +1980,13 @@ get_list_master_ptrs(const char* cptr, class master *master_ptr) * Output: space is allocated and a list of master species pointers is * returned. */ - int j, l, count_list; + int j, l; char token[MAX_LENGTH]; std::vector master_ptr_list; class master *master_ptr0; /* * Make list of master species pointers */ - count_list = 0; //master_ptr_list = unknown_alloc_master(); master_ptr0 = master_ptr; if (master_ptr0 == master_ptr->s->primary) @@ -2147,7 +2146,7 @@ mb_for_species_aq(int n) * by coef, usually moles. * mb_unknowns.coef - coefficient of s[n] in equation or relation */ - int i, j; + int i; class master *master_ptr; class unknown *unknown_ptr; @@ -2223,7 +2222,6 @@ mb_for_species_aq(int n) */ if (use.Get_surface_ptr() != NULL && s[n]->type < H2O && dl_type_x != cxxSurface::NO_DL) { - j = 0; for (i = 0; i < count_unknowns; i++) { if (x[i]->type == SURFACE_CB) @@ -2235,7 +2233,6 @@ mb_for_species_aq(int n) store_mb_unknowns(unknown_ptr, s_diff_layer[n][charge_ptr->Get_name()].Get_g_moles_address(), s[n]->z, s_diff_layer[n][charge_ptr->Get_name()].Get_dg_g_moles_address()); - j++; } } } diff --git a/spread.cpp b/spread.cpp index 77ada3e7..5d7137b5 100644 --- a/spread.cpp +++ b/spread.cpp @@ -1141,7 +1141,7 @@ copy_token_tab(std::string& token, const char **cptr) * EOL, * UNKNOWN. */ - int i, return_value; + int return_value; char c; /* * Strip leading spaces @@ -1180,7 +1180,6 @@ copy_token_tab(std::string& token, const char **cptr) /* * Begin copying to token */ - i = 0; for (;;) { c = **cptr; @@ -1197,7 +1196,6 @@ copy_token_tab(std::string& token, const char **cptr) { token.push_back(c); (*cptr)++; - i++; } } return (return_value); diff --git a/sundialsmath.h b/sundialsmath.h index 59e49d3a..4f240e81 100644 --- a/sundialsmath.h +++ b/sundialsmath.h @@ -13,10 +13,10 @@ * listed here work with the type realtype as defined in * * sundialstypes.h. * * To do single precision floating point arithmetic, set the type * - * realtype to be float. To do double precision arithmetic, set * + * realtype to be float. To do real(kind=8) arithmetic, set * * the type realtype to be double. The default implementations * * for RPowerR and RSqrt call standard math library functions * - * which do double precision arithmetic. If this is unacceptable * + * which do real(kind=8) arithmetic. If this is unacceptable * * when realtype is float, then the user should re-implement * * these two routines by calling single precision routines * * available on his/her machine. * diff --git a/sundialstypes.h b/sundialstypes.h index 1003410f..ddf6c84a 100644 --- a/sundialstypes.h +++ b/sundialstypes.h @@ -25,7 +25,7 @@ * The types for realtype and integertype below have been set to * * double and long int, respectively. A user should modify these * * type declarations as he/she sees fit. For example, if a user * - * wants the work with type float because double precision * + * wants the work with type float because real(kind=8) * * floating point arithmetic is too expensive on the user's * * machine, then the definition below should be changed to: * * * diff --git a/tally.cpp b/tally.cpp index 969b165d..131411e1 100644 --- a/tally.cpp +++ b/tally.cpp @@ -798,7 +798,6 @@ build_tally_table(void) */ int j, k, l, p, save_print_use; size_t n; - int count_tt_pure_phase, count_tt_ss_phase, count_tt_kinetics; class phase *phase_ptr; char token[MAX_LENGTH]; const char* cptr; @@ -871,7 +870,6 @@ build_tally_table(void) /* * Count pure phases */ - count_tt_pure_phase = 0; if (Rxn_pp_assemblage_map.size() > 0) { /* @@ -904,7 +902,6 @@ build_tally_table(void) /* * Add to table */ - count_tt_pure_phase++; n = count_tally_table_columns; extend_tally_table(); tally_table[n].name = phase_ptr->name; @@ -931,7 +928,6 @@ build_tally_table(void) /* * Add solid-solution pure phases */ - count_tt_ss_phase = 0; if (Rxn_ss_assemblage_map.size() > 0) { /* @@ -964,7 +960,6 @@ build_tally_table(void) /* * Add to table */ - count_tt_ss_phase++; n = count_tally_table_columns; extend_tally_table(); tally_table[n].name = phase_ptr->name; @@ -982,7 +977,6 @@ build_tally_table(void) /* * Add kinetic reactants */ - count_tt_kinetics = 0; if (Rxn_kinetics_map.size() > 0) { std::map::iterator it; @@ -1006,7 +1000,6 @@ build_tally_table(void) /* * Add to table */ - count_tt_kinetics++; n = count_tally_table_columns; extend_tally_table(); tally_table[n].name = string_hsave(kinetics_comp_ptr->Get_rate_name().c_str());