mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 00:28:23 +01:00
Merge commit '74b541d42e40ef1ed8df0bfba9826e55b046e9f0'
This commit is contained in:
commit
a19f9e7e15
@ -27,6 +27,11 @@ m_next_keyword(Keywords::KEY_NONE)
|
||||
if (!io)
|
||||
{
|
||||
error_msg("This parser constructor requires non-null phrq_io", PHRQ_io::OT_STOP);
|
||||
echo_file = EO_ALL;
|
||||
echo_stream = EO_NONE;
|
||||
accumulate = false;
|
||||
phrq_io_only = true;
|
||||
m_line_type = PHRQ_io::LT_EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -55,6 +60,7 @@ m_next_keyword(Keywords::KEY_NONE)
|
||||
echo_stream = EO_NONE;
|
||||
accumulate = false;
|
||||
phrq_io_only = false;
|
||||
m_line_type = PHRQ_io::LT_EMPTY;
|
||||
}
|
||||
|
||||
CParser::~CParser()
|
||||
@ -326,7 +332,7 @@ PHRQ_io::LINE_TYPE CParser::get_logical_line()
|
||||
// remove '\\'
|
||||
for (; pos < m_line_save.size(); pos++)
|
||||
{
|
||||
m_line_save[pos] = m_line_save[pos + 1];
|
||||
m_line_save[pos] = m_line_save[(size_t) pos + 1];
|
||||
}
|
||||
m_line_save.erase(m_line_save.size() - 1, 1);
|
||||
break;
|
||||
|
||||
@ -604,6 +604,7 @@ class cxxChemRxn
|
||||
public:
|
||||
cxxChemRxn(void)
|
||||
{
|
||||
logk[0] = dz[0] = 0.0;
|
||||
for (size_t i = 0; i < MAX_LOG_K_INDICES; i++)
|
||||
{
|
||||
logk[i] = 0.0;
|
||||
@ -615,6 +616,7 @@ public:
|
||||
}
|
||||
cxxChemRxn(struct reaction *rxn)
|
||||
{
|
||||
logk[0] = dz[0] = 0.0;
|
||||
for (size_t i = 0; i < MAX_LOG_K_INDICES; i++)
|
||||
{
|
||||
logk[i] = rxn->logk[i];
|
||||
|
||||
@ -188,7 +188,11 @@ RESTART: // if limiting rates, jump to here
|
||||
{
|
||||
char * temp_name = string_duplicate(name.c_str());
|
||||
char * ptr = temp_name;
|
||||
get_elts_in_species(&ptr, coef * coef1);
|
||||
if (get_elts_in_species(&ptr, coef * coef1) == ERROR)
|
||||
{
|
||||
error_string = sformatf("Error in -formula: %s", temp_name);
|
||||
error_msg(error_string, CONTINUE);
|
||||
}
|
||||
free_check_null(temp_name);
|
||||
}
|
||||
}
|
||||
@ -208,7 +212,11 @@ RESTART: // if limiting rates, jump to here
|
||||
/* found kinetics component */
|
||||
char * formula = string_duplicate(exchange_ptr->Get_exchange_comps()[j].Get_formula().c_str());
|
||||
char * ptr = formula;
|
||||
get_elts_in_species(&ptr, -coef*exchange_ptr->Get_exchange_comps()[j].Get_phase_proportion());
|
||||
if (get_elts_in_species(&ptr, -coef*exchange_ptr->Get_exchange_comps()[j].Get_phase_proportion()) == ERROR)
|
||||
{
|
||||
error_string = sformatf("Error in -formula: %s", formula);
|
||||
error_msg(error_string, CONTINUE);
|
||||
}
|
||||
free_check_null(formula);
|
||||
}
|
||||
}
|
||||
@ -243,7 +251,11 @@ RESTART: // if limiting rates, jump to here
|
||||
}
|
||||
else
|
||||
{
|
||||
get_elts_in_species(&ptr, -coef * surface_comp_ptr->Get_phase_proportion());
|
||||
if (get_elts_in_species(&ptr, -coef * surface_comp_ptr->Get_phase_proportion()) == ERROR)
|
||||
{
|
||||
error_string = sformatf("Error in -formula: %s", temp_formula);
|
||||
error_msg(error_string, CONTINUE);
|
||||
}
|
||||
}
|
||||
free_check_null(temp_formula);
|
||||
}
|
||||
|
||||
@ -1207,7 +1207,7 @@ ineq(int in_kode)
|
||||
/* Copy in saturation index equation (has mass or supersaturated) */
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(my_array[i * (count_unknowns + 1)]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
back_eq[l_count_rows] = i;
|
||||
//if (it->second.Get_add_formula().size() == 0
|
||||
if (comp_ptr->Get_add_formula().size() == 0
|
||||
@ -1241,7 +1241,7 @@ ineq(int in_kode)
|
||||
*/
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(my_array[i * (count_unknowns + 1)]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
back_eq[l_count_rows] = i;
|
||||
l_count_rows++;
|
||||
/*
|
||||
@ -1252,7 +1252,7 @@ ineq(int in_kode)
|
||||
{
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(my_array[i * (count_unknowns + 1)]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
back_eq[l_count_rows] = i;
|
||||
|
||||
res[l_count_rows] = 1.0;
|
||||
@ -1269,7 +1269,7 @@ ineq(int in_kode)
|
||||
{
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(my_array[i * (count_unknowns + 1)]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
back_eq[l_count_rows] = i;
|
||||
res[l_count_rows] = 1.0;
|
||||
if (in_kode != 1)
|
||||
@ -1351,7 +1351,7 @@ ineq(int in_kode)
|
||||
}
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(my_array[i * (count_unknowns + 1)]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
back_eq[l_count_rows] = i;
|
||||
if (mass_water_switch == TRUE && x[i] == mass_hydrogen_unknown)
|
||||
{
|
||||
@ -1368,7 +1368,7 @@ ineq(int in_kode)
|
||||
{
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(my_array[i * (count_unknowns + 1)]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
back_eq[l_count_rows] = i;
|
||||
l_count_rows++;
|
||||
}
|
||||
@ -1412,7 +1412,7 @@ ineq(int in_kode)
|
||||
memcpy((void *)
|
||||
&(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(zero[0]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
ineq_array[l_count_rows * max_column_count + i] = 1.0;
|
||||
ineq_array[l_count_rows * max_column_count +
|
||||
count_unknowns] = x[i]->moles;
|
||||
@ -1425,7 +1425,7 @@ ineq(int in_kode)
|
||||
memcpy((void *)
|
||||
&(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(zero[0]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
ineq_array[l_count_rows * max_column_count + i] = -1.0;
|
||||
ineq_array[l_count_rows * max_column_count +
|
||||
count_unknowns] =
|
||||
@ -1447,7 +1447,7 @@ ineq(int in_kode)
|
||||
{
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(my_array[i * (count_unknowns + 1)]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
back_eq[l_count_rows] = i;
|
||||
for (j = 0; j < count_unknowns; j++)
|
||||
{
|
||||
@ -1609,7 +1609,7 @@ ineq(int in_kode)
|
||||
{
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(zero[0]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
ineq_array[l_count_rows * max_column_count + i] = -1.0;
|
||||
ineq_array[l_count_rows * max_column_count + count_unknowns] =
|
||||
x[i]->moles;
|
||||
@ -1647,7 +1647,7 @@ ineq(int in_kode)
|
||||
{
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(zero[0]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
ineq_array[l_count_rows * max_column_count + i] = 1.0;
|
||||
ineq_array[l_count_rows * max_column_count + count_unknowns] =
|
||||
0.99 * x[i]->moles - MIN_TOTAL_SS;
|
||||
@ -1674,7 +1674,7 @@ ineq(int in_kode)
|
||||
{
|
||||
memcpy((void *) &(ineq_array[l_count_rows * max_column_count]),
|
||||
(void *) &(my_array[i * (count_unknowns + 1)]),
|
||||
(size_t) (count_unknowns + 1) * sizeof(LDBLE));
|
||||
((size_t) count_unknowns + 1) * sizeof(LDBLE));
|
||||
back_eq[l_count_rows] = i;
|
||||
for (j = 0; j < count_unknowns; j++)
|
||||
{
|
||||
|
||||
@ -580,7 +580,7 @@ get_elts_in_species(char **t_ptr, LDBLE coef)
|
||||
char c, c1;
|
||||
LDBLE d;
|
||||
char element[MAX_LENGTH];
|
||||
|
||||
char** t_ptr_save = t_ptr;
|
||||
while (((c = **t_ptr) != '+') && (c != '-') && (c != '\0'))
|
||||
{
|
||||
/* close parenthesis */
|
||||
@ -689,7 +689,7 @@ get_elts_in_species(char **t_ptr, LDBLE coef)
|
||||
}
|
||||
if (paren_count != 0)
|
||||
{
|
||||
error_string = sformatf( "Unbalanced parentheses.");
|
||||
error_string = sformatf( "Unbalanced parentheses: %s", *t_ptr_save);
|
||||
error_msg(error_string, CONTINUE);
|
||||
input_error++;
|
||||
return (ERROR);
|
||||
@ -837,7 +837,7 @@ get_secondary_in_species(char **t_ptr, LDBLE coef)
|
||||
char c, c1;
|
||||
LDBLE d;
|
||||
char element[MAX_LENGTH];
|
||||
|
||||
char** t_ptr_save = t_ptr;
|
||||
while (((c = **t_ptr) != '+') && (c != '-') && (c != '\0'))
|
||||
{
|
||||
/* close parenthesis */
|
||||
@ -941,7 +941,7 @@ get_secondary_in_species(char **t_ptr, LDBLE coef)
|
||||
}
|
||||
if (paren_count != 0)
|
||||
{
|
||||
error_string = sformatf( "Unbalanced parentheses.");
|
||||
error_string = sformatf("Unbalanced parentheses: %s", *t_ptr_save);
|
||||
error_msg(error_string, CONTINUE);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user