mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
vector calculate_value**
This commit is contained in:
parent
9d9fbfb85e
commit
97e574d259
28
Phreeqc.cpp
28
Phreeqc.cpp
@ -982,9 +982,6 @@ void Phreeqc::init(void)
|
|||||||
master_isotope = NULL;
|
master_isotope = NULL;
|
||||||
max_master_isotope = MAX_ELTS;
|
max_master_isotope = MAX_ELTS;
|
||||||
initial_solution_isotopes = FALSE;
|
initial_solution_isotopes = FALSE;
|
||||||
count_calculate_value = 0;
|
|
||||||
calculate_value = NULL;
|
|
||||||
max_calculate_value = MAX_ELTS;
|
|
||||||
calculate_value_hash_table = NULL;
|
calculate_value_hash_table = NULL;
|
||||||
count_isotope_ratio = 0;
|
count_isotope_ratio = 0;
|
||||||
isotope_ratio = 0;
|
isotope_ratio = 0;
|
||||||
@ -2309,34 +2306,17 @@ Phreeqc::InternalCopy(const Phreeqc *pSrc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
initial_solution_isotopes = pSrc->initial_solution_isotopes;
|
initial_solution_isotopes = pSrc->initial_solution_isotopes;
|
||||||
/*
|
|
||||||
count_calculate_value = 0;
|
for (int i = 0; i < pSrc->calculate_value.size(); i++)
|
||||||
calculate_value = NULL;
|
|
||||||
max_calculate_value = MAX_ELTS;
|
|
||||||
calculate_value_hash_table = NULL;
|
|
||||||
*/
|
|
||||||
for (int i = 0; i < pSrc->count_calculate_value; i++)
|
|
||||||
{
|
{
|
||||||
struct calculate_value *calculate_value_ptr = calculate_value_store(pSrc->calculate_value[i]->name, FALSE);
|
struct calculate_value* calculate_value_ptr = calculate_value_store(pSrc->calculate_value[i]->name, FALSE);
|
||||||
//memcpy(calculate_value_ptr, pSrc->calculate_value[i], sizeof(struct calculate_value));
|
|
||||||
calculate_value_ptr->value = pSrc->calculate_value[i]->value;
|
calculate_value_ptr->value = pSrc->calculate_value[i]->value;
|
||||||
//calculate_value_ptr->commands = NULL;
|
|
||||||
if (pSrc->calculate_value[i]->commands)
|
if (pSrc->calculate_value[i]->commands)
|
||||||
{
|
{
|
||||||
calculate_value_ptr->commands = string_duplicate(pSrc->calculate_value[i]->commands);
|
calculate_value_ptr->commands = string_duplicate(pSrc->calculate_value[i]->commands);
|
||||||
}
|
}
|
||||||
//calculate_value_ptr->new_def = TRUE;
|
|
||||||
//calculate_value_ptr->calculated = FALSE;
|
|
||||||
//calculate_value_ptr->linebase = NULL;
|
|
||||||
//calculate_value_ptr->varbase = NULL;
|
|
||||||
//calculate_value_ptr->loopbase = NULL;
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
count_isotope_ratio = 0;
|
|
||||||
isotope_ratio = 0;
|
|
||||||
max_isotope_ratio = MAX_ELTS;
|
|
||||||
isotope_ratio_hash_table = 0;
|
|
||||||
*/
|
|
||||||
for (int i = 0; i < pSrc->count_isotope_ratio; i++)
|
for (int i = 0; i < pSrc->count_isotope_ratio; i++)
|
||||||
{
|
{
|
||||||
struct isotope_ratio *isotope_ratio_ptr = isotope_ratio_store(pSrc->isotope_ratio[i]->name, FALSE);
|
struct isotope_ratio *isotope_ratio_ptr = isotope_ratio_store(pSrc->isotope_ratio[i]->name, FALSE);
|
||||||
|
|||||||
@ -1731,9 +1731,7 @@ protected:
|
|||||||
struct master_isotope **master_isotope;
|
struct master_isotope **master_isotope;
|
||||||
int max_master_isotope;
|
int max_master_isotope;
|
||||||
int initial_solution_isotopes;
|
int initial_solution_isotopes;
|
||||||
int count_calculate_value;
|
std::vector<struct calculate_value*> calculate_value;
|
||||||
struct calculate_value **calculate_value;
|
|
||||||
int max_calculate_value;
|
|
||||||
HashTable *calculate_value_hash_table;
|
HashTable *calculate_value_hash_table;
|
||||||
int count_isotope_ratio;
|
int count_isotope_ratio;
|
||||||
struct isotope_ratio **isotope_ratio;
|
struct isotope_ratio **isotope_ratio;
|
||||||
|
|||||||
18
isotopes.cpp
18
isotopes.cpp
@ -892,11 +892,7 @@ punch_calculate_values(void)
|
|||||||
|
|
||||||
if (current_selected_output->Get_calculate_values().size() == 0)
|
if (current_selected_output->Get_calculate_values().size() == 0)
|
||||||
return OK;
|
return OK;
|
||||||
//if (punch.in == FALSE || punch.calculate_values == FALSE)
|
|
||||||
// return (OK);
|
|
||||||
//if (punch.count_calculate_values == 0)
|
|
||||||
// return (OK);
|
|
||||||
//for (i = 0; i < punch.count_calculate_values; i++)
|
|
||||||
for (size_t i = 0; i < current_selected_output->Get_calculate_values().size(); i++)
|
for (size_t i = 0; i < current_selected_output->Get_calculate_values().size(); i++)
|
||||||
{
|
{
|
||||||
result = MISSING;
|
result = MISSING;
|
||||||
@ -1132,7 +1128,7 @@ calculate_values(void)
|
|||||||
/*
|
/*
|
||||||
* initialize ratios as missing
|
* initialize ratios as missing
|
||||||
*/
|
*/
|
||||||
for (j = 0; j < count_calculate_value; j++)
|
for (j = 0; j < calculate_value.size(); j++)
|
||||||
{
|
{
|
||||||
calculate_value[j]->calculated = FALSE;
|
calculate_value[j]->calculated = FALSE;
|
||||||
calculate_value[j]->value = MISSING;
|
calculate_value[j]->value = MISSING;
|
||||||
@ -1522,14 +1518,8 @@ calculate_value_store(const char *name, int replace_if_found)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = count_calculate_value++;
|
n = (int)calculate_value.size();
|
||||||
/* make sure there is space in s */
|
calculate_value.resize((size_t)n+1);
|
||||||
if (count_calculate_value >= max_calculate_value)
|
|
||||||
{
|
|
||||||
space((void **) ((void *) &calculate_value),
|
|
||||||
count_calculate_value, &max_calculate_value,
|
|
||||||
sizeof(struct calculate_value *));
|
|
||||||
}
|
|
||||||
/* Make new calculate_value structure */
|
/* Make new calculate_value structure */
|
||||||
calculate_value[n] = calculate_value_alloc();
|
calculate_value[n] = calculate_value_alloc();
|
||||||
calculate_value_ptr = calculate_value[n];
|
calculate_value_ptr = calculate_value[n];
|
||||||
|
|||||||
@ -177,11 +177,7 @@ initialize(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* calculate_value */
|
/* calculate_value */
|
||||||
max_calculate_value = MAX_ELTS;
|
hcreate_multi((unsigned) MAX_ELTS,
|
||||||
count_calculate_value = 0;
|
|
||||||
space((void **) ((void *) &calculate_value), INIT, &max_calculate_value,
|
|
||||||
sizeof(struct calculate_value *));
|
|
||||||
hcreate_multi((unsigned) max_calculate_value,
|
|
||||||
&calculate_value_hash_table);
|
&calculate_value_hash_table);
|
||||||
|
|
||||||
/* isotope_ratio */
|
/* isotope_ratio */
|
||||||
|
|||||||
@ -236,14 +236,11 @@ clean_up(void)
|
|||||||
master_isotope_hash_table = NULL;
|
master_isotope_hash_table = NULL;
|
||||||
|
|
||||||
/* calculate_value */
|
/* calculate_value */
|
||||||
for (i = 0; i < count_calculate_value; i++)
|
for (i = 0; i < (int) calculate_value.size(); i++)
|
||||||
{
|
{
|
||||||
calculate_value_free(calculate_value[i]);
|
calculate_value_free(calculate_value[i]);
|
||||||
calculate_value[i] =
|
calculate_value[i] = (struct calculate_value*)free_check_null(calculate_value[i]);
|
||||||
(struct calculate_value *) free_check_null(calculate_value[i]);
|
|
||||||
}
|
}
|
||||||
calculate_value =
|
|
||||||
(struct calculate_value **) free_check_null(calculate_value);
|
|
||||||
hdestroy_multi(calculate_value_hash_table);
|
hdestroy_multi(calculate_value_hash_table);
|
||||||
calculate_value_hash_table = NULL;
|
calculate_value_hash_table = NULL;
|
||||||
|
|
||||||
@ -334,7 +331,6 @@ clean_up(void)
|
|||||||
llnl_count_bdot = 0;
|
llnl_count_bdot = 0;
|
||||||
llnl_count_co2_coefs = 0;
|
llnl_count_co2_coefs = 0;
|
||||||
|
|
||||||
count_calculate_value = 0;
|
|
||||||
count_isotope_ratio = 0;
|
count_isotope_ratio = 0;
|
||||||
count_isotope_alpha = 0;
|
count_isotope_alpha = 0;
|
||||||
|
|
||||||
|
|||||||
1
tidy.cpp
1
tidy.cpp
@ -2227,7 +2227,6 @@ tidy_punch(void)
|
|||||||
|
|
||||||
/* calculate_values */
|
/* calculate_values */
|
||||||
|
|
||||||
//for (i = 0; i < punch.count_calculate_values; i++)
|
|
||||||
for (size_t i = 0; i < current_selected_output->Get_calculate_values().size(); i++)
|
for (size_t i = 0; i < current_selected_output->Get_calculate_values().size(); i++)
|
||||||
{
|
{
|
||||||
std::pair< std::string, void *> &pair_ref = current_selected_output->Get_calculate_values()[i];
|
std::pair< std::string, void *> &pair_ref = current_selected_output->Get_calculate_values()[i];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user