mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
vector trxn.token
This commit is contained in:
parent
83cfb298d6
commit
7d303de1b4
@ -763,7 +763,6 @@ void Phreeqc::init(void)
|
|||||||
* Reaction work space
|
* Reaction work space
|
||||||
*---------------------------------------------------------------------- */
|
*---------------------------------------------------------------------- */
|
||||||
// struct trxn;
|
// struct trxn;
|
||||||
trxn.token = 0;
|
|
||||||
for (int i = 0; i < MAX_LOG_K_INDICES; i++)
|
for (int i = 0; i < MAX_LOG_K_INDICES; i++)
|
||||||
{
|
{
|
||||||
trxn.logk[i] = 0;
|
trxn.logk[i] = 0;
|
||||||
@ -773,7 +772,6 @@ void Phreeqc::init(void)
|
|||||||
trxn.dz[i] = 0;
|
trxn.dz[i] = 0;
|
||||||
}
|
}
|
||||||
count_trxn = 0;
|
count_trxn = 0;
|
||||||
max_trxn = MAX_TRXN;
|
|
||||||
|
|
||||||
mb_unknowns = NULL;
|
mb_unknowns = NULL;
|
||||||
count_mb_unknowns = 0;
|
count_mb_unknowns = 0;
|
||||||
@ -1896,7 +1894,6 @@ Phreeqc::InternalCopy(const Phreeqc *pSrc)
|
|||||||
trxn.dz[i] = 0;
|
trxn.dz[i] = 0;
|
||||||
}
|
}
|
||||||
count_trxn = 0;
|
count_trxn = 0;
|
||||||
max_trxn = MAX_TRXN;
|
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
mb_unknowns = NULL;
|
mb_unknowns = NULL;
|
||||||
|
|||||||
@ -1530,8 +1530,7 @@ protected:
|
|||||||
*---------------------------------------------------------------------- */
|
*---------------------------------------------------------------------- */
|
||||||
struct reaction_temp trxn; /* structure array of working space while reading equations
|
struct reaction_temp trxn; /* structure array of working space while reading equations
|
||||||
species names are in "temp_strings" */
|
species names are in "temp_strings" */
|
||||||
int count_trxn; /* number of reactants in trxn = position of next */
|
int count_trxn; /* number of reactants in trxn = position of next */
|
||||||
int max_trxn;
|
|
||||||
|
|
||||||
struct unknown_list *mb_unknowns;
|
struct unknown_list *mb_unknowns;
|
||||||
int count_mb_unknowns;
|
int count_mb_unknowns;
|
||||||
|
|||||||
@ -813,7 +813,7 @@ struct reaction_temp
|
|||||||
{
|
{
|
||||||
LDBLE logk[MAX_LOG_K_INDICES];
|
LDBLE logk[MAX_LOG_K_INDICES];
|
||||||
LDBLE dz[3];
|
LDBLE dz[3];
|
||||||
struct rxn_token_temp *token;
|
std::vector<struct rxn_token_temp> token;
|
||||||
};
|
};
|
||||||
struct rxn_token_temp
|
struct rxn_token_temp
|
||||||
{ /* data for equations, aq. species or minerals */
|
{ /* data for equations, aq. species or minerals */
|
||||||
|
|||||||
@ -78,10 +78,6 @@ initialize(void)
|
|||||||
stag_data->exch_f = 0;
|
stag_data->exch_f = 0;
|
||||||
stag_data->th_m = 0;
|
stag_data->th_m = 0;
|
||||||
stag_data->th_im = 0;
|
stag_data->th_im = 0;
|
||||||
|
|
||||||
space((void **) ((void *) &trxn.token), INIT, &max_trxn,
|
|
||||||
sizeof(struct rxn_token_temp));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create hash tables
|
* Create hash tables
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1025,11 +1025,8 @@ get_species(char **ptr)
|
|||||||
char string[MAX_LENGTH];
|
char string[MAX_LENGTH];
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
if (count_trxn + 1 >= max_trxn)
|
if ((size_t) count_trxn + 1 > trxn.token.size())
|
||||||
{
|
trxn.token.resize((size_t)count_trxn + 1);
|
||||||
space((void **) ((void *) &(trxn.token)), count_trxn + 1, &max_trxn,
|
|
||||||
sizeof(struct rxn_token_temp));
|
|
||||||
}
|
|
||||||
/* coefficient */
|
/* coefficient */
|
||||||
if (get_coef(&(trxn.token[count_trxn].coef), ptr) == ERROR)
|
if (get_coef(&(trxn.token[count_trxn].coef), ptr) == ERROR)
|
||||||
{
|
{
|
||||||
|
|||||||
14
prep.cpp
14
prep.cpp
@ -2861,11 +2861,8 @@ add_potential_factor(void)
|
|||||||
/*
|
/*
|
||||||
* Make sure there is space
|
* Make sure there is space
|
||||||
*/
|
*/
|
||||||
if (count_trxn + 1 >= max_trxn)
|
if ((size_t)count_trxn + 1 > trxn.token.size())
|
||||||
{
|
trxn.token.resize((size_t)count_trxn + 1);
|
||||||
space((void **) ((void *) &(trxn.token)), count_trxn + 1, &max_trxn,
|
|
||||||
sizeof(struct rxn_token_temp));
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Include psi in mass action equation
|
* Include psi in mass action equation
|
||||||
*/
|
*/
|
||||||
@ -2958,11 +2955,8 @@ add_cd_music_factors(int n)
|
|||||||
/*
|
/*
|
||||||
* Make sure there is space
|
* Make sure there is space
|
||||||
*/
|
*/
|
||||||
if (count_trxn + 3 >= max_trxn)
|
if ((size_t)count_trxn + 3 > trxn.token.size())
|
||||||
{
|
trxn.token.resize((size_t)count_trxn + 3);
|
||||||
space((void **) ((void *) &(trxn.token)), count_trxn + 3, &max_trxn,
|
|
||||||
sizeof(struct rxn_token_temp));
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Include psi in mass action equation
|
* Include psi in mass action equation
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -291,10 +291,8 @@ clean_up(void)
|
|||||||
change_surf = (struct Change_Surf *) free_check_null(change_surf);
|
change_surf = (struct Change_Surf *) free_check_null(change_surf);
|
||||||
|
|
||||||
/* miscellaneous work space */
|
/* miscellaneous work space */
|
||||||
|
|
||||||
//elt_list = (struct elt_list *) free_check_null(elt_list);
|
|
||||||
elt_list.clear();
|
elt_list.clear();
|
||||||
trxn.token = (struct rxn_token_temp *) free_check_null(trxn.token);
|
trxn.token.clear();
|
||||||
mb_unknowns = (struct unknown_list *) free_check_null(mb_unknowns);
|
mb_unknowns = (struct unknown_list *) free_check_null(mb_unknowns);
|
||||||
line = (char *) free_check_null(line);
|
line = (char *) free_check_null(line);
|
||||||
line_save = (char *) free_check_null(line_save);
|
line_save = (char *) free_check_null(line_save);
|
||||||
@ -2620,11 +2618,8 @@ trxn_add(cxxChemRxn &r_ptr, LDBLE coef, int combine)
|
|||||||
*/
|
*/
|
||||||
for (size_t j = 0; j < r_ptr.Get_tokens().size(); j++)
|
for (size_t j = 0; j < r_ptr.Get_tokens().size(); j++)
|
||||||
{
|
{
|
||||||
if (count_trxn + 1 >= max_trxn)
|
if ((size_t)count_trxn + 1 > trxn.token.size())
|
||||||
{
|
trxn.token.resize((size_t)count_trxn + 1);
|
||||||
space((void **) ((void *) &(trxn.token)), count_trxn + 1,
|
|
||||||
&max_trxn, sizeof(struct rxn_token_temp));
|
|
||||||
}
|
|
||||||
trxn.token[count_trxn].name = r_ptr.Get_tokens()[j].name;
|
trxn.token[count_trxn].name = r_ptr.Get_tokens()[j].name;
|
||||||
trxn.token[count_trxn].s = r_ptr.Get_tokens()[j].s;
|
trxn.token[count_trxn].s = r_ptr.Get_tokens()[j].s;
|
||||||
trxn.token[count_trxn].coef = coef * r_ptr.Get_tokens()[j].coef;
|
trxn.token[count_trxn].coef = coef * r_ptr.Get_tokens()[j].coef;
|
||||||
@ -2685,11 +2680,8 @@ trxn_add(struct reaction *r_ptr, LDBLE coef, int combine)
|
|||||||
next_token = r_ptr->token;
|
next_token = r_ptr->token;
|
||||||
while (next_token->s != NULL)
|
while (next_token->s != NULL)
|
||||||
{
|
{
|
||||||
if (count_trxn + 1 >= max_trxn)
|
if ((size_t)count_trxn + 1 > trxn.token.size())
|
||||||
{
|
trxn.token.resize((size_t)count_trxn + 1);
|
||||||
space((void **) ((void *) &(trxn.token)), count_trxn + 1,
|
|
||||||
&max_trxn, sizeof(struct rxn_token_temp));
|
|
||||||
}
|
|
||||||
trxn.token[count_trxn].name = next_token->s->name;
|
trxn.token[count_trxn].name = next_token->s->name;
|
||||||
trxn.token[count_trxn].s = next_token->s;
|
trxn.token[count_trxn].s = next_token->s;
|
||||||
trxn.token[count_trxn].coef = coef * next_token->coef;
|
trxn.token[count_trxn].coef = coef * next_token->coef;
|
||||||
@ -2743,11 +2735,8 @@ trxn_add_phase(struct reaction *r_ptr, LDBLE coef, int combine)
|
|||||||
next_token = r_ptr->token;
|
next_token = r_ptr->token;
|
||||||
while (next_token->s != NULL || next_token->name != NULL)
|
while (next_token->s != NULL || next_token->name != NULL)
|
||||||
{
|
{
|
||||||
if (count_trxn + 1 >= max_trxn)
|
if ((size_t)count_trxn + 1 > trxn.token.size())
|
||||||
{
|
trxn.token.resize((size_t)count_trxn + 1);
|
||||||
space((void **) ((void *) &(trxn.token)), count_trxn + 1,
|
|
||||||
&max_trxn, sizeof(struct rxn_token_temp));
|
|
||||||
}
|
|
||||||
if (next_token->s != NULL)
|
if (next_token->s != NULL)
|
||||||
{
|
{
|
||||||
trxn.token[count_trxn].name = next_token->s->name;
|
trxn.token[count_trxn].name = next_token->s->name;
|
||||||
|
|||||||
14
tidy.cpp
14
tidy.cpp
@ -2873,11 +2873,8 @@ species_rxn_to_trxn(struct species *s_ptr)
|
|||||||
trxn.token[i].unknown = NULL;
|
trxn.token[i].unknown = NULL;
|
||||||
trxn.token[i].coef = s_ptr->rxn->token[i].coef;
|
trxn.token[i].coef = s_ptr->rxn->token[i].coef;
|
||||||
count_trxn = i + 1;
|
count_trxn = i + 1;
|
||||||
if (count_trxn + 1 >= max_trxn)
|
if ((size_t)count_trxn + 1 > trxn.token.size())
|
||||||
{
|
trxn.token.resize((size_t)count_trxn + 1);
|
||||||
space((void **) ((void *) &(trxn.token)), count_trxn + 1,
|
|
||||||
&max_trxn, sizeof(struct rxn_token_temp));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
@ -2916,11 +2913,8 @@ phase_rxn_to_trxn(struct phase *phase_ptr, struct reaction *rxn_ptr)
|
|||||||
trxn.token[i].unknown = NULL;
|
trxn.token[i].unknown = NULL;
|
||||||
trxn.token[i].coef = rxn_ptr->token[i].coef;
|
trxn.token[i].coef = rxn_ptr->token[i].coef;
|
||||||
count_trxn = i + 1;
|
count_trxn = i + 1;
|
||||||
if (count_trxn + 1 >= max_trxn)
|
if ((size_t)count_trxn + 1 > trxn.token.size())
|
||||||
{
|
trxn.token.resize((size_t)count_trxn + 1);
|
||||||
space((void **) ((void *) &(trxn.token)), count_trxn + 1,
|
|
||||||
&max_trxn, sizeof(struct rxn_token_temp));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user