mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
vector master_isotope
This commit is contained in:
parent
97e574d259
commit
4bb1c8006c
@ -978,9 +978,9 @@ void Phreeqc::init(void)
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
* ISOTOPES
|
* ISOTOPES
|
||||||
* ---------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------- */
|
||||||
count_master_isotope = 0;
|
//count_master_isotope = 0;
|
||||||
master_isotope = NULL;
|
//master_isotope = NULL;
|
||||||
max_master_isotope = MAX_ELTS;
|
//max_master_isotope = MAX_ELTS;
|
||||||
initial_solution_isotopes = FALSE;
|
initial_solution_isotopes = FALSE;
|
||||||
calculate_value_hash_table = NULL;
|
calculate_value_hash_table = NULL;
|
||||||
count_isotope_ratio = 0;
|
count_isotope_ratio = 0;
|
||||||
@ -2277,7 +2277,7 @@ Phreeqc::InternalCopy(const Phreeqc *pSrc)
|
|||||||
max_master_isotope = MAX_ELTS;
|
max_master_isotope = MAX_ELTS;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (int i = 0; i < pSrc->count_master_isotope; i++)
|
for (int i = 0; i < (int)pSrc->master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
struct master_isotope *master_isotope_ptr = master_isotope_store(pSrc->master_isotope[i]->name, FALSE);
|
struct master_isotope *master_isotope_ptr = master_isotope_store(pSrc->master_isotope[i]->name, FALSE);
|
||||||
memcpy(master_isotope_ptr, pSrc->master_isotope[i], sizeof(struct master_isotope));
|
memcpy(master_isotope_ptr, pSrc->master_isotope[i], sizeof(struct master_isotope));
|
||||||
|
|||||||
@ -1727,9 +1727,10 @@ protected:
|
|||||||
* ---------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------- */
|
||||||
//struct name_coef match_tokens[50];
|
//struct name_coef match_tokens[50];
|
||||||
//int count_match_tokens;
|
//int count_match_tokens;
|
||||||
int count_master_isotope;
|
//int count_master_isotope;
|
||||||
struct master_isotope **master_isotope;
|
//struct master_isotope **master_isotope;
|
||||||
int max_master_isotope;
|
//int max_master_isotope;
|
||||||
|
std::vector<master_isotope*> master_isotope;
|
||||||
int initial_solution_isotopes;
|
int initial_solution_isotopes;
|
||||||
std::vector<struct calculate_value*> calculate_value;
|
std::vector<struct calculate_value*> calculate_value;
|
||||||
HashTable *calculate_value_hash_table;
|
HashTable *calculate_value_hash_table;
|
||||||
|
|||||||
33
isotopes.cpp
33
isotopes.cpp
@ -478,7 +478,8 @@ add_isotopes(cxxSolution &solution_ref)
|
|||||||
/*
|
/*
|
||||||
* zero out isotopes
|
* zero out isotopes
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < count_master_isotope; i++)
|
//for (i = 0; i < count_master_isotope; i++)
|
||||||
|
for (i = 0; i < (int)master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
master_isotope[i]->moles = 0;
|
master_isotope[i]->moles = 0;
|
||||||
}
|
}
|
||||||
@ -513,7 +514,7 @@ add_isotopes(cxxSolution &solution_ref)
|
|||||||
* Set isotopes flag
|
* Set isotopes flag
|
||||||
*/
|
*/
|
||||||
initial_solution_isotopes = FALSE;
|
initial_solution_isotopes = FALSE;
|
||||||
for (i = 0; i < count_master_isotope; i++)
|
for (i = 0; i < (int)master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
if (master_isotope[i]->minor_isotope == TRUE
|
if (master_isotope[i]->minor_isotope == TRUE
|
||||||
&& master_isotope[i]->moles > 0)
|
&& master_isotope[i]->moles > 0)
|
||||||
@ -662,7 +663,7 @@ calculate_isotope_moles(struct element *elt_ptr,
|
|||||||
/*
|
/*
|
||||||
* Update master_isotope
|
* Update master_isotope
|
||||||
*/
|
*/
|
||||||
for (j = 0; j < count_master_isotope; j++)
|
for (j = 0; j < (int)master_isotope.size(); j++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < count_isotopes; i++)
|
for (i = 0; i < count_isotopes; i++)
|
||||||
{
|
{
|
||||||
@ -770,12 +771,12 @@ print_initial_solution_isotopes(void)
|
|||||||
print_centered("Isotopes");
|
print_centered("Isotopes");
|
||||||
output_msg(sformatf( "%10s\t%12s\t%12s\t%12s\t%12s\n\n", "Isotope",
|
output_msg(sformatf( "%10s\t%12s\t%12s\t%12s\t%12s\n\n", "Isotope",
|
||||||
"Molality", "Moles", "Ratio", "Units"));
|
"Molality", "Moles", "Ratio", "Units"));
|
||||||
for (i = 0; i < count_master_isotope; i++)
|
for (i = 0; i < (int)master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
if (master_isotope[i]->minor_isotope == FALSE)
|
if (master_isotope[i]->minor_isotope == FALSE)
|
||||||
{
|
{
|
||||||
print_isotope = FALSE;
|
print_isotope = FALSE;
|
||||||
for (j = 0; j < count_master_isotope; j++)
|
for (j = 0; j < (int)master_isotope.size(); j++)
|
||||||
{
|
{
|
||||||
if ((master_isotope[j]->elt == master_isotope[i]->elt) &&
|
if ((master_isotope[j]->elt == master_isotope[i]->elt) &&
|
||||||
(master_isotope[j]->minor_isotope == TRUE) &&
|
(master_isotope[j]->minor_isotope == TRUE) &&
|
||||||
@ -794,7 +795,7 @@ print_initial_solution_isotopes(void)
|
|||||||
master_isotope[i]->name,
|
master_isotope[i]->name,
|
||||||
(double) (master_isotope[i]->moles / mass_water_aq_x),
|
(double) (master_isotope[i]->moles / mass_water_aq_x),
|
||||||
(double) master_isotope[i]->moles));
|
(double) master_isotope[i]->moles));
|
||||||
for (j = 0; j < count_master_isotope; j++)
|
for (j = 0; j < (int)master_isotope.size(); j++)
|
||||||
{
|
{
|
||||||
if (i == j)
|
if (i == j)
|
||||||
continue;
|
continue;
|
||||||
@ -991,7 +992,7 @@ print_isotope_ratios(void)
|
|||||||
* Print heading
|
* Print heading
|
||||||
*/
|
*/
|
||||||
print_isotope = FALSE;
|
print_isotope = FALSE;
|
||||||
for (i = 0; i < count_master_isotope; i++)
|
for (i = 0; i < (int)master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
if (master_isotope[i]->minor_isotope == FALSE)
|
if (master_isotope[i]->minor_isotope == FALSE)
|
||||||
continue;
|
continue;
|
||||||
@ -1053,7 +1054,7 @@ print_isotope_alphas(void)
|
|||||||
* Print heading
|
* Print heading
|
||||||
*/
|
*/
|
||||||
print_isotope = FALSE;
|
print_isotope = FALSE;
|
||||||
for (i = 0; i < count_master_isotope; i++)
|
for (i = 0; i < (int)master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
if (master_isotope[i]->minor_isotope == FALSE)
|
if (master_isotope[i]->minor_isotope == FALSE)
|
||||||
continue;
|
continue;
|
||||||
@ -1350,13 +1351,15 @@ master_isotope_store(const char *name, int replace_if_found)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = count_master_isotope++;
|
//n = count_master_isotope++;
|
||||||
/* make sure there is space in s */
|
///* make sure there is space in s */
|
||||||
if (count_master_isotope >= max_master_isotope)
|
//if (count_master_isotope >= max_master_isotope)
|
||||||
{
|
//{
|
||||||
space((void **) ((void *) &master_isotope), count_master_isotope,
|
// space((void **) ((void *) &master_isotope), count_master_isotope,
|
||||||
&max_master_isotope, sizeof(struct master_isotope *));
|
// &max_master_isotope, sizeof(struct master_isotope *));
|
||||||
}
|
//}
|
||||||
|
n = (int)master_isotope.size();
|
||||||
|
master_isotope.resize((size_t)n + 1);
|
||||||
/* Make new master_isotope structure */
|
/* Make new master_isotope structure */
|
||||||
master_isotope[n] = master_isotope_alloc();
|
master_isotope[n] = master_isotope_alloc();
|
||||||
master_isotope_ptr = master_isotope[n];
|
master_isotope_ptr = master_isotope[n];
|
||||||
|
|||||||
@ -98,14 +98,14 @@ initialize(void)
|
|||||||
|
|
||||||
space((void **) ((void *) &logk), INIT, &max_logk, sizeof(struct logk *));
|
space((void **) ((void *) &logk), INIT, &max_logk, sizeof(struct logk *));
|
||||||
|
|
||||||
space((void **) ((void *) &master_isotope), INIT, &max_master_isotope,
|
//space((void **) ((void *) &master_isotope), INIT, &max_master_isotope,
|
||||||
sizeof(struct master_isotope *));
|
// sizeof(struct master_isotope *));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create hash tables
|
* Create hash tables
|
||||||
*/
|
*/
|
||||||
hcreate_multi((unsigned) max_logk, &logk_hash_table);
|
hcreate_multi((unsigned) max_logk, &logk_hash_table);
|
||||||
hcreate_multi((unsigned) max_master_isotope, &master_isotope_hash_table);
|
hcreate_multi((unsigned) MAX_ELTS, &master_isotope_hash_table);
|
||||||
hcreate_multi((unsigned) max_elements, &elements_hash_table);
|
hcreate_multi((unsigned) max_elements, &elements_hash_table);
|
||||||
hcreate_multi((unsigned) max_s, &species_hash_table);
|
hcreate_multi((unsigned) max_s, &species_hash_table);
|
||||||
hcreate_multi((unsigned) max_phases, &phases_hash_table);
|
hcreate_multi((unsigned) max_phases, &phases_hash_table);
|
||||||
@ -1379,7 +1379,7 @@ xsolution_save(int n_user)
|
|||||||
*/
|
*/
|
||||||
if (initial_solution_isotopes == TRUE)
|
if (initial_solution_isotopes == TRUE)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < count_master_isotope; i++)
|
for (int i = 0; i < (int)master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
if (master_isotope[i]->moles > 0)
|
if (master_isotope[i]->moles > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -225,13 +225,11 @@ clean_up(void)
|
|||||||
user_graph_headings = (char **) free_check_null(user_graph_headings);
|
user_graph_headings = (char **) free_check_null(user_graph_headings);
|
||||||
#endif
|
#endif
|
||||||
/* master_isotope */
|
/* master_isotope */
|
||||||
for (i = 0; i < count_master_isotope; i++)
|
for (i = 0; i < (int)master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
master_isotope[i] =
|
master_isotope[i] = (struct master_isotope *) free_check_null(master_isotope[i]);
|
||||||
(struct master_isotope *) free_check_null(master_isotope[i]);
|
|
||||||
}
|
}
|
||||||
master_isotope =
|
//master_isotope = (struct master_isotope **) free_check_null(master_isotope);
|
||||||
(struct master_isotope **) free_check_null(master_isotope);
|
|
||||||
hdestroy_multi(master_isotope_hash_table);
|
hdestroy_multi(master_isotope_hash_table);
|
||||||
master_isotope_hash_table = NULL;
|
master_isotope_hash_table = NULL;
|
||||||
|
|
||||||
@ -320,7 +318,7 @@ clean_up(void)
|
|||||||
count_phases = 0;
|
count_phases = 0;
|
||||||
count_s = 0;
|
count_s = 0;
|
||||||
count_logk = 0;
|
count_logk = 0;
|
||||||
count_master_isotope = 0;
|
//count_master_isotope = 0;
|
||||||
count_rates = 0;
|
count_rates = 0;
|
||||||
count_inverse = 0;
|
count_inverse = 0;
|
||||||
count_save_values = 0;
|
count_save_values = 0;
|
||||||
|
|||||||
2
tidy.cpp
2
tidy.cpp
@ -5505,7 +5505,7 @@ tidy_master_isotope(void)
|
|||||||
int i;
|
int i;
|
||||||
struct master *master_ptr;
|
struct master *master_ptr;
|
||||||
|
|
||||||
for (i = 0; i < count_master_isotope; i++)
|
for (i = 0; i < (int)master_isotope.size(); i++)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Mark master species list as minor isotope
|
* Mark master species list as minor isotope
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user