mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
Squashed 'src/' changes from c0e62935..25f24721
25f24721 fixed compiler warnings except NAN 3f24bf17 moved enum to RMVARS.h 54045123 changed all double precision to real(kind=8) in all files. Compiles and runs test cases. git-subtree-dir: src git-subtree-split: 25f2472130c22c1a63e15f0fa58f1021c83a7b4a
This commit is contained in:
parent
4fde5d2a99
commit
05d97e8baf
2
CVar.hxx
2
CVar.hxx
@ -12,7 +12,7 @@ public:
|
|||||||
{
|
{
|
||||||
::VarInit(this);
|
::VarInit(this);
|
||||||
}
|
}
|
||||||
~CVar(void) throw()
|
~CVar(void) //throw()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1672,9 +1672,9 @@ Headings
|
|||||||
* FUNCTION SetBasicFortranCallback(ID,FCN)
|
* FUNCTION SetBasicFortranCallback(ID,FCN)
|
||||||
* INTEGER(KIND=4), INTENT(IN) :: ID
|
* INTEGER(KIND=4), INTENT(IN) :: ID
|
||||||
* INTERFACE
|
* INTERFACE
|
||||||
* DOUBLE PRECISION FUNCTION FCN(x1, x2, str)
|
* real(kind=8) FUNCTION FCN(x1, x2, str)
|
||||||
* DOUBLE PRECISION, INTENT(in) :: x1
|
* real(kind=8), INTENT(in) :: x1
|
||||||
* DOUBLE PRECISION, INTENT(in) :: x2
|
* real(kind=8), INTENT(in) :: x2
|
||||||
* CHARACTER(*), INTENT(in) :: str
|
* CHARACTER(*), INTENT(in) :: str
|
||||||
* END FUNCTION
|
* END FUNCTION
|
||||||
* END INTERFACE
|
* END INTERFACE
|
||||||
|
|||||||
@ -713,7 +713,7 @@ public:
|
|||||||
* Sets a Fortran callback function for Basic programs. The syntax for the Basic command is
|
* Sets a Fortran callback function for Basic programs. The syntax for the Basic command is
|
||||||
* 10 result = CALLBACK(x1, x2, string$)
|
* 10 result = CALLBACK(x1, x2, string$)
|
||||||
* The syntax for the Fortran function is
|
* The syntax for the Fortran function is
|
||||||
* double precision my_callback(x1, x2, string), where x1 and x2 are double precision and string is a character variable.
|
* real(kind=8) my_callback(x1, x2, string), where x1 and x2 are real(kind=8) and string is a character variable.
|
||||||
* @param fcn The name of a user-defined function.
|
* @param fcn The name of a user-defined function.
|
||||||
* @see SetBasicCallback
|
* @see SetBasicCallback
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -688,7 +688,7 @@ INTEGER FUNCTION GetSelectedOutputValue(id, row, col, vtype, dvalue, svalue, sle
|
|||||||
END INTERFACE
|
END INTERFACE
|
||||||
INTEGER, INTENT(in) :: id, row, col
|
INTEGER, INTENT(in) :: id, row, col
|
||||||
INTEGER, INTENT(out) :: vtype
|
INTEGER, INTENT(out) :: vtype
|
||||||
DOUBLE PRECISION, INTENT(out) :: dvalue
|
real(kind=8), INTENT(out) :: dvalue
|
||||||
CHARACTER(len=*), INTENT(out) :: svalue
|
CHARACTER(len=*), INTENT(out) :: svalue
|
||||||
INTEGER, INTENT(out), OPTIONAL :: slength
|
INTEGER, INTENT(out), OPTIONAL :: slength
|
||||||
INTEGER :: sz, sz_fortran
|
INTEGER :: sz, sz_fortran
|
||||||
@ -898,9 +898,9 @@ INTEGER FUNCTION SetBasicFortranCallback(id, fcn)
|
|||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
INTEGER, INTENT(in) :: id
|
INTEGER, INTENT(in) :: id
|
||||||
INTERFACE
|
INTERFACE
|
||||||
DOUBLE PRECISION FUNCTION fcn(x1, x2, str, l)
|
real(kind=8) FUNCTION fcn(x1, x2, str, l)
|
||||||
INTEGER, INTENT(in) :: l
|
INTEGER, INTENT(in) :: l
|
||||||
DOUBLE PRECISION, INTENT(in) :: x1, x2
|
real(kind=8), INTENT(in) :: x1, x2
|
||||||
CHARACTER, INTENT(in) :: str(*)
|
CHARACTER, INTENT(in) :: str(*)
|
||||||
END FUNCTION fcn
|
END FUNCTION fcn
|
||||||
END INTERFACE
|
END INTERFACE
|
||||||
@ -908,9 +908,9 @@ INTEGER FUNCTION SetBasicFortranCallback(id, fcn)
|
|||||||
END INTERFACE
|
END INTERFACE
|
||||||
INTEGER, INTENT(in) :: id
|
INTEGER, INTENT(in) :: id
|
||||||
INTERFACE
|
INTERFACE
|
||||||
DOUBLE PRECISION FUNCTION fcn(x1, x2, str, l)
|
real(kind=8) FUNCTION fcn(x1, x2, str, l)
|
||||||
INTEGER, INTENT(in) :: l
|
INTEGER, INTENT(in) :: l
|
||||||
DOUBLE PRECISION, INTENT(in) :: x1, x2
|
real(kind=8), INTENT(in) :: x1, x2
|
||||||
CHARACTER, INTENT(in) :: str(*)
|
CHARACTER, INTENT(in) :: str(*)
|
||||||
END FUNCTION fcn
|
END FUNCTION fcn
|
||||||
END INTERFACE
|
END INTERFACE
|
||||||
|
|||||||
@ -142,7 +142,7 @@ cl1(int k, int l, int m, int n,
|
|||||||
/* AT LEAST NKLMD COLUMNS USED FOR WORKSPACE. */
|
/* AT LEAST NKLMD COLUMNS USED FOR WORKSPACE. */
|
||||||
/* S INTEGER ARRAY OF SIZE AT LEAST KLMD, USED FOR */
|
/* S INTEGER ARRAY OF SIZE AT LEAST KLMD, USED FOR */
|
||||||
/* WORKSPACE. */
|
/* WORKSPACE. */
|
||||||
/* DOUBLE PRECISION DBLE */
|
/* real(kind=8) DBLE */
|
||||||
/* REAL */
|
/* REAL */
|
||||||
|
|
||||||
/* INITIALIZATION. */
|
/* INITIALIZATION. */
|
||||||
|
|||||||
@ -624,7 +624,6 @@ int Phreeqc::
|
|||||||
calc_fixed_volume_gas_pressures(void)
|
calc_fixed_volume_gas_pressures(void)
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
int n_g = 0;
|
|
||||||
LDBLE lp;
|
LDBLE lp;
|
||||||
class rxn_token *rxn_ptr;
|
class rxn_token *rxn_ptr;
|
||||||
class phase *phase_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)
|
if (!PR && phase_ptr->t_c > 0 && phase_ptr->p_c > 0)
|
||||||
PR = true;
|
PR = true;
|
||||||
n_g++;
|
|
||||||
}
|
}
|
||||||
gas_phase_ptr->Set_total_moles(gas_phase_ptr->Get_total_moles() + gas_unknowns[i]->moles);
|
gas_phase_ptr->Set_total_moles(gas_phase_ptr->Get_total_moles() + gas_unknowns[i]->moles);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2543,7 +2543,6 @@ int Phreeqc::
|
|||||||
calc_gas_pressures(void)
|
calc_gas_pressures(void)
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
int n_g = 0;
|
|
||||||
LDBLE lp, V_m = 0;
|
LDBLE lp, V_m = 0;
|
||||||
class rxn_token *rxn_ptr;
|
class rxn_token *rxn_ptr;
|
||||||
std::vector<class phase *> phase_ptrs;
|
std::vector<class phase *> phase_ptrs;
|
||||||
@ -2576,7 +2575,6 @@ calc_gas_pressures(void)
|
|||||||
phase_ptrs.push_back(phase_ptr);
|
phase_ptrs.push_back(phase_ptr);
|
||||||
if (!PR && phase_ptr->t_c > 0 && phase_ptr->p_c > 0)
|
if (!PR && phase_ptr->t_c > 0 && phase_ptr->p_c > 0)
|
||||||
PR = true;
|
PR = true;
|
||||||
n_g++;
|
|
||||||
}
|
}
|
||||||
if (iterations > 2 && gas_phase_ptr->Get_type() == cxxGasPhase::GP_VOLUME)
|
if (iterations > 2 && gas_phase_ptr->Get_type() == cxxGasPhase::GP_VOLUME)
|
||||||
{
|
{
|
||||||
@ -3778,7 +3776,6 @@ residuals(void)
|
|||||||
int converge;
|
int converge;
|
||||||
|
|
||||||
LDBLE l_toler;
|
LDBLE l_toler;
|
||||||
LDBLE sum_residual;
|
|
||||||
LDBLE sinh_constant;
|
LDBLE sinh_constant;
|
||||||
LDBLE sum, sum1;
|
LDBLE sum, sum1;
|
||||||
class master *master_ptr, *master_ptr1, *master_ptr2;
|
class master *master_ptr, *master_ptr1, *master_ptr2;
|
||||||
@ -3786,7 +3783,6 @@ residuals(void)
|
|||||||
int print_fail;
|
int print_fail;
|
||||||
std::vector<LDBLE> cd_psi;
|
std::vector<LDBLE> cd_psi;
|
||||||
print_fail = FALSE;
|
print_fail = FALSE;
|
||||||
sum_residual = 0.0;
|
|
||||||
sigmaddl = 0;
|
sigmaddl = 0;
|
||||||
sum = 0;
|
sum = 0;
|
||||||
/*
|
/*
|
||||||
@ -4530,7 +4526,6 @@ residuals(void)
|
|||||||
* Store residuals in array
|
* Store residuals in array
|
||||||
*/
|
*/
|
||||||
my_array[((size_t)i + 1) * (count_unknowns + 1) - 1] = residual[i];
|
my_array[((size_t)i + 1) * (count_unknowns + 1) - 1] = residual[i];
|
||||||
sum_residual += fabs(residual[i]);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Return
|
* Return
|
||||||
|
|||||||
@ -52,7 +52,7 @@ pitzer_tidy(void)
|
|||||||
const char *string1, *string2;
|
const char *string1, *string2;
|
||||||
int i, j, order;
|
int i, j, order;
|
||||||
int i0, i1, i2;
|
int i0, i1, i2;
|
||||||
int count_pos, count_neg, count_neut, count[3], jj;
|
int count_neut, count[3], jj;
|
||||||
LDBLE z0, z1;
|
LDBLE z0, z1;
|
||||||
class pitz_param *pzp_ptr;
|
class pitz_param *pzp_ptr;
|
||||||
class theta_param *theta_param_ptr;
|
class theta_param *theta_param_ptr;
|
||||||
@ -339,21 +339,21 @@ pitzer_tidy(void)
|
|||||||
i0 = pitz_params[i]->ispec[0];
|
i0 = pitz_params[i]->ispec[0];
|
||||||
i1 = pitz_params[i]->ispec[1];
|
i1 = pitz_params[i]->ispec[1];
|
||||||
i2 = pitz_params[i]->ispec[2];
|
i2 = pitz_params[i]->ispec[2];
|
||||||
count_pos = count_neg = count_neut = 0;
|
count_neut = 0;
|
||||||
for (j = 0; j <= 2; j++)
|
for (j = 0; j <= 2; j++)
|
||||||
{
|
{
|
||||||
if (spec[pitz_params[i]->ispec[j]]->z > 0)
|
//if (spec[pitz_params[i]->ispec[j]]->z > 0)
|
||||||
{
|
//{
|
||||||
count_pos++;
|
// count_pos++;
|
||||||
}
|
//}
|
||||||
if (spec[pitz_params[i]->ispec[j]]->z == 0)
|
if (spec[pitz_params[i]->ispec[j]]->z == 0)
|
||||||
{
|
{
|
||||||
count_neut++;
|
count_neut++;
|
||||||
}
|
}
|
||||||
if (spec[pitz_params[i]->ispec[j]]->z < 0)
|
//if (spec[pitz_params[i]->ispec[j]]->z < 0)
|
||||||
{
|
//{
|
||||||
count_neg++;
|
// count_neg++;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
/* All neutral */
|
/* All neutral */
|
||||||
if (count_neut == 3)
|
if (count_neut == 3)
|
||||||
|
|||||||
@ -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
|
* Output: space is allocated and a list of master species pointers is
|
||||||
* returned.
|
* returned.
|
||||||
*/
|
*/
|
||||||
int j, l, count_list;
|
int j, l;
|
||||||
char token[MAX_LENGTH];
|
char token[MAX_LENGTH];
|
||||||
std::vector<class master*> master_ptr_list;
|
std::vector<class master*> master_ptr_list;
|
||||||
class master *master_ptr0;
|
class master *master_ptr0;
|
||||||
/*
|
/*
|
||||||
* Make list of master species pointers
|
* Make list of master species pointers
|
||||||
*/
|
*/
|
||||||
count_list = 0;
|
|
||||||
//master_ptr_list = unknown_alloc_master();
|
//master_ptr_list = unknown_alloc_master();
|
||||||
master_ptr0 = master_ptr;
|
master_ptr0 = master_ptr;
|
||||||
if (master_ptr0 == master_ptr->s->primary)
|
if (master_ptr0 == master_ptr->s->primary)
|
||||||
@ -2147,7 +2146,7 @@ mb_for_species_aq(int n)
|
|||||||
* by coef, usually moles.
|
* by coef, usually moles.
|
||||||
* mb_unknowns.coef - coefficient of s[n] in equation or relation
|
* mb_unknowns.coef - coefficient of s[n] in equation or relation
|
||||||
*/
|
*/
|
||||||
int i, j;
|
int i;
|
||||||
class master *master_ptr;
|
class master *master_ptr;
|
||||||
class unknown *unknown_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)
|
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++)
|
for (i = 0; i < count_unknowns; i++)
|
||||||
{
|
{
|
||||||
if (x[i]->type == SURFACE_CB)
|
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(),
|
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());
|
s[n]->z, s_diff_layer[n][charge_ptr->Get_name()].Get_dg_g_moles_address());
|
||||||
j++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1141,7 +1141,7 @@ copy_token_tab(std::string& token, const char **cptr)
|
|||||||
* EOL,
|
* EOL,
|
||||||
* UNKNOWN.
|
* UNKNOWN.
|
||||||
*/
|
*/
|
||||||
int i, return_value;
|
int return_value;
|
||||||
char c;
|
char c;
|
||||||
/*
|
/*
|
||||||
* Strip leading spaces
|
* Strip leading spaces
|
||||||
@ -1180,7 +1180,6 @@ copy_token_tab(std::string& token, const char **cptr)
|
|||||||
/*
|
/*
|
||||||
* Begin copying to token
|
* Begin copying to token
|
||||||
*/
|
*/
|
||||||
i = 0;
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
c = **cptr;
|
c = **cptr;
|
||||||
@ -1197,7 +1196,6 @@ copy_token_tab(std::string& token, const char **cptr)
|
|||||||
{
|
{
|
||||||
token.push_back(c);
|
token.push_back(c);
|
||||||
(*cptr)++;
|
(*cptr)++;
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (return_value);
|
return (return_value);
|
||||||
|
|||||||
@ -13,10 +13,10 @@
|
|||||||
* listed here work with the type realtype as defined in *
|
* listed here work with the type realtype as defined in *
|
||||||
* sundialstypes.h. *
|
* sundialstypes.h. *
|
||||||
* To do single precision floating point arithmetic, set the type *
|
* 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 *
|
* the type realtype to be double. The default implementations *
|
||||||
* for RPowerR and RSqrt call standard math library functions *
|
* 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 *
|
* when realtype is float, then the user should re-implement *
|
||||||
* these two routines by calling single precision routines *
|
* these two routines by calling single precision routines *
|
||||||
* available on his/her machine. *
|
* available on his/her machine. *
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
* The types for realtype and integertype below have been set to *
|
* The types for realtype and integertype below have been set to *
|
||||||
* double and long int, respectively. A user should modify these *
|
* double and long int, respectively. A user should modify these *
|
||||||
* type declarations as he/she sees fit. For example, if a user *
|
* 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 *
|
* floating point arithmetic is too expensive on the user's *
|
||||||
* machine, then the definition below should be changed to: *
|
* machine, then the definition below should be changed to: *
|
||||||
* *
|
* *
|
||||||
|
|||||||
@ -798,7 +798,6 @@ build_tally_table(void)
|
|||||||
*/
|
*/
|
||||||
int j, k, l, p, save_print_use;
|
int j, k, l, p, save_print_use;
|
||||||
size_t n;
|
size_t n;
|
||||||
int count_tt_pure_phase, count_tt_ss_phase, count_tt_kinetics;
|
|
||||||
class phase *phase_ptr;
|
class phase *phase_ptr;
|
||||||
char token[MAX_LENGTH];
|
char token[MAX_LENGTH];
|
||||||
const char* cptr;
|
const char* cptr;
|
||||||
@ -871,7 +870,6 @@ build_tally_table(void)
|
|||||||
/*
|
/*
|
||||||
* Count pure phases
|
* Count pure phases
|
||||||
*/
|
*/
|
||||||
count_tt_pure_phase = 0;
|
|
||||||
if (Rxn_pp_assemblage_map.size() > 0)
|
if (Rxn_pp_assemblage_map.size() > 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -904,7 +902,6 @@ build_tally_table(void)
|
|||||||
/*
|
/*
|
||||||
* Add to table
|
* Add to table
|
||||||
*/
|
*/
|
||||||
count_tt_pure_phase++;
|
|
||||||
n = count_tally_table_columns;
|
n = count_tally_table_columns;
|
||||||
extend_tally_table();
|
extend_tally_table();
|
||||||
tally_table[n].name = phase_ptr->name;
|
tally_table[n].name = phase_ptr->name;
|
||||||
@ -931,7 +928,6 @@ build_tally_table(void)
|
|||||||
/*
|
/*
|
||||||
* Add solid-solution pure phases
|
* Add solid-solution pure phases
|
||||||
*/
|
*/
|
||||||
count_tt_ss_phase = 0;
|
|
||||||
if (Rxn_ss_assemblage_map.size() > 0)
|
if (Rxn_ss_assemblage_map.size() > 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -964,7 +960,6 @@ build_tally_table(void)
|
|||||||
/*
|
/*
|
||||||
* Add to table
|
* Add to table
|
||||||
*/
|
*/
|
||||||
count_tt_ss_phase++;
|
|
||||||
n = count_tally_table_columns;
|
n = count_tally_table_columns;
|
||||||
extend_tally_table();
|
extend_tally_table();
|
||||||
tally_table[n].name = phase_ptr->name;
|
tally_table[n].name = phase_ptr->name;
|
||||||
@ -982,7 +977,6 @@ build_tally_table(void)
|
|||||||
/*
|
/*
|
||||||
* Add kinetic reactants
|
* Add kinetic reactants
|
||||||
*/
|
*/
|
||||||
count_tt_kinetics = 0;
|
|
||||||
if (Rxn_kinetics_map.size() > 0)
|
if (Rxn_kinetics_map.size() > 0)
|
||||||
{
|
{
|
||||||
std::map<int, cxxKinetics>::iterator it;
|
std::map<int, cxxKinetics>::iterator it;
|
||||||
@ -1006,7 +1000,6 @@ build_tally_table(void)
|
|||||||
/*
|
/*
|
||||||
* Add to table
|
* Add to table
|
||||||
*/
|
*/
|
||||||
count_tt_kinetics++;
|
|
||||||
n = count_tally_table_columns;
|
n = count_tally_table_columns;
|
||||||
extend_tally_table();
|
extend_tally_table();
|
||||||
tally_table[n].name = string_hsave(kinetics_comp_ptr->Get_rate_name().c_str());
|
tally_table[n].name = string_hsave(kinetics_comp_ptr->Get_rate_name().c_str());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user