vector isotope_ratio

This commit is contained in:
David Parkhurst 2021-03-15 10:36:07 -06:00
parent 76da4f89bc
commit ba2601a32f
7 changed files with 14 additions and 29 deletions

View File

@ -980,9 +980,6 @@ void Phreeqc::init(void)
* ---------------------------------------------------------------------- */
initial_solution_isotopes = FALSE;
calculate_value_hash_table = NULL;
count_isotope_ratio = 0;
isotope_ratio = 0;
max_isotope_ratio = MAX_ELTS;
isotope_ratio_hash_table = 0;
count_isotope_alpha = 0;
isotope_alpha = 0;
@ -2308,7 +2305,7 @@ Phreeqc::InternalCopy(const Phreeqc *pSrc)
}
}
for (int i = 0; i < pSrc->count_isotope_ratio; i++)
for (int i = 0; i < (int)pSrc->isotope_ratio.size(); i++)
{
struct isotope_ratio *isotope_ratio_ptr = isotope_ratio_store(pSrc->isotope_ratio[i]->name, FALSE);
isotope_ratio_ptr->name = string_hsave(pSrc->isotope_ratio[i]->name);

View File

@ -1729,9 +1729,7 @@ protected:
int initial_solution_isotopes;
std::vector<struct calculate_value*> calculate_value;
HashTable *calculate_value_hash_table;
int count_isotope_ratio;
struct isotope_ratio **isotope_ratio;
int max_isotope_ratio;
std::vector<struct isotope_ratio*> isotope_ratio;
HashTable *isotope_ratio_hash_table;
int count_isotope_alpha;
struct isotope_alpha **isotope_alpha;

View File

@ -4011,7 +4011,7 @@ iso_value(const char *total_name)
strcpy(token, "");
strcpy(my_total_name, total_name);
while (replace(" ","_",my_total_name));
for (j = 0; j < count_isotope_ratio; j++)
for (j = 0; j < (int)isotope_ratio.size(); j++)
{
if (isotope_ratio[j]->ratio == MISSING)
continue;
@ -4025,7 +4025,7 @@ iso_value(const char *total_name)
strcat(token,"R(");
strcat(token,my_total_name);
strcat(token,")");
for (j = 0; j < count_isotope_ratio; j++)
for (j = 0; j < (int)isotope_ratio.size(); j++)
{
if (isotope_ratio[j]->ratio == MISSING)
continue;
@ -4047,7 +4047,7 @@ iso_unit(const char *total_name)
strcpy(my_total_name, total_name);
while (replace(" ","_",my_total_name));
strcpy(unit, "unknown");
for (j = 0; j < count_isotope_ratio; j++)
for (j = 0; j < (int)isotope_ratio.size(); j++)
{
if (isotope_ratio[j]->ratio == MISSING)
continue;
@ -4066,7 +4066,7 @@ iso_unit(const char *total_name)
strcat(token,"R(");
strcat(token,my_total_name);
strcat(token,")");
for (j = 0; j < count_isotope_ratio; j++)
for (j = 0; j < (int)isotope_ratio.size(); j++)
{
if (isotope_ratio[j]->ratio == MISSING)
continue;

View File

@ -1011,7 +1011,7 @@ print_isotope_ratios(void)
output_msg(sformatf( "%25s\t%12s\t%15s\n\n", "Isotope Ratio",
"Ratio", "Input Units"));
for (j = 0; j < count_isotope_ratio; j++)
for (j = 0; j < (int)isotope_ratio.size(); j++)
{
if (isotope_ratio[j]->ratio == MISSING)
continue;
@ -1135,7 +1135,7 @@ calculate_values(void)
}
if (pr.isotope_ratios == TRUE)
{
for (j = 0; j < count_isotope_ratio; j++)
for (j = 0; j < (int)isotope_ratio.size(); j++)
{
isotope_ratio_ptr = isotope_ratio[j];
master_isotope_ptr =
@ -1699,13 +1699,8 @@ isotope_ratio_store(const char *name, int replace_if_found)
}
else
{
n = count_isotope_ratio++;
/* make sure there is space in s */
if (count_isotope_ratio >= max_isotope_ratio)
{
space((void **) ((void *) &isotope_ratio), count_isotope_ratio,
&max_isotope_ratio, sizeof(struct isotope_ratio *));
}
n = (int)isotope_ratio.size();
isotope_ratio.resize((size_t)n + 1);
/* Make new isotope_ratio structure */
isotope_ratio[n] = isotope_ratio_alloc();
isotope_ratio_ptr = isotope_ratio[n];

View File

@ -178,11 +178,7 @@ initialize(void)
&calculate_value_hash_table);
/* isotope_ratio */
max_isotope_ratio = MAX_ELTS;
count_isotope_ratio = 0;
space((void **) ((void *) &isotope_ratio), INIT, &max_isotope_ratio,
sizeof(struct isotope_ratio *));
hcreate_multi((unsigned) max_isotope_ratio, &isotope_ratio_hash_table);
hcreate_multi((unsigned) MAX_ELTS, &isotope_ratio_hash_table);
/* isotope_value */
max_isotope_alpha = MAX_ELTS;

View File

@ -243,12 +243,12 @@ clean_up(void)
calculate_value_hash_table = NULL;
/* isotope_ratio */
for (i = 0; i < count_isotope_ratio; i++)
for (i = 0; i < (int)isotope_ratio.size(); i++)
{
isotope_ratio[i] =
(struct isotope_ratio *) free_check_null(isotope_ratio[i]);
}
isotope_ratio = (struct isotope_ratio **) free_check_null(isotope_ratio);
//isotope_ratio = (struct isotope_ratio **) free_check_null(isotope_ratio);
hdestroy_multi(isotope_ratio_hash_table);
isotope_ratio_hash_table = NULL;
@ -328,7 +328,6 @@ clean_up(void)
llnl_count_bdot = 0;
llnl_count_co2_coefs = 0;
count_isotope_ratio = 0;
count_isotope_alpha = 0;
default_data_base = (char *) free_check_null(default_data_base);

View File

@ -5543,7 +5543,7 @@ tidy_isotope_ratios(void)
struct master_isotope *master_isotope_ptr;
struct calculate_value *calculate_value_ptr;
for (i = 0; i < count_isotope_ratio; i++)
for (i = 0; i < (int)isotope_ratio.size(); i++)
{
/*
* Mark master species list as minor isotope