vector llnl parameters, removed hash references

This commit is contained in:
David Parkhurst 2021-03-23 19:24:09 -06:00
parent 7c538b62a7
commit d82d5d610f
13 changed files with 125 additions and 383 deletions

View File

@ -723,7 +723,7 @@ parse(char * l_inbuf, tokenrec ** l_buf)
* Note: Modification of string length may translate incorrectly [146] */
/*
* Search hash list
* Search list
*/
PhreeqcPtr->str_tolower(token);
std::map<const std::string, BASIC_TOKEN>::const_iterator item;
@ -2267,7 +2267,7 @@ factor(struct LOC_exec * LINK)
case tokdh_a:
{
if (PhreeqcPtr->llnl_count_temp > 0)
if (PhreeqcPtr->llnl_temp.size() > 0)
{
n.UU.val = PhreeqcPtr->a_llnl;
}
@ -2293,7 +2293,7 @@ factor(struct LOC_exec * LINK)
case tokdh_b:
{
if (PhreeqcPtr->llnl_count_temp > 0)
if (PhreeqcPtr->llnl_temp.size() > 0)
{
n.UU.val = PhreeqcPtr->b_llnl;
}

View File

@ -889,16 +889,6 @@ void Phreeqc::init(void)
count_total_steps = 0;
phast = FALSE;
output_newline = true;
llnl_temp = 0;
llnl_count_temp = 0;
llnl_adh = 0;
llnl_count_adh = 0;
llnl_bdh = 0;
llnl_count_bdh = 0;
llnl_bdot = 0;
llnl_count_bdot = 0;
llnl_co2_coefs = 0;
llnl_count_co2_coefs = 0;
//selected_output_file_name = NULL;
dump_file_name = NULL;
remove_unstable_phases = FALSE;
@ -1985,46 +1975,11 @@ Phreeqc::InternalCopy(const Phreeqc *pSrc)
llnl_co2_coefs = 0;
llnl_count_co2_coefs = 0;
*/
llnl_count_temp = pSrc->llnl_count_temp;
if (llnl_count_temp > 0)
{
llnl_temp = (LDBLE *) free_check_null(llnl_temp);
llnl_temp = (LDBLE *) PHRQ_malloc((size_t) llnl_count_temp * sizeof(LDBLE));
if (llnl_temp == NULL) malloc_error();
memcpy(llnl_temp, pSrc->llnl_temp, (size_t) llnl_count_temp * sizeof(LDBLE));
}
llnl_count_adh = pSrc->llnl_count_adh;
if (llnl_count_adh > 0)
{
llnl_adh = (LDBLE *) free_check_null(llnl_adh);
llnl_adh = (LDBLE *) PHRQ_malloc((size_t) llnl_count_adh * sizeof(LDBLE));
if (llnl_adh == NULL) malloc_error();
memcpy(llnl_adh, pSrc->llnl_adh, (size_t) llnl_count_adh * sizeof(LDBLE));
}
llnl_count_bdh = pSrc->llnl_count_bdh;
if (llnl_count_bdh > 0)
{
llnl_bdh = (LDBLE *) free_check_null(llnl_bdh);
llnl_bdh = (LDBLE *) PHRQ_malloc((size_t) llnl_count_bdh * sizeof(LDBLE));
if (llnl_bdh == NULL) malloc_error();
memcpy(llnl_bdh, pSrc->llnl_bdh, (size_t) llnl_count_bdh * sizeof(LDBLE));
}
llnl_count_bdot = pSrc->llnl_count_bdot;
if (llnl_count_bdot > 0)
{
llnl_bdot = (LDBLE *) free_check_null(llnl_bdot);
llnl_bdot = (LDBLE *) PHRQ_malloc((size_t) llnl_count_bdot * sizeof(LDBLE));
if (llnl_bdot == NULL) malloc_error();
memcpy(llnl_bdot, pSrc->llnl_bdot, (size_t) llnl_count_bdot * sizeof(LDBLE));
}
llnl_count_co2_coefs = pSrc->llnl_count_co2_coefs;
if (llnl_count_co2_coefs > 0)
{
llnl_co2_coefs = (LDBLE *) free_check_null(llnl_co2_coefs);
llnl_co2_coefs = (LDBLE *) PHRQ_malloc((size_t) llnl_count_co2_coefs * sizeof(LDBLE));
if (llnl_co2_coefs == NULL) malloc_error();
memcpy(llnl_co2_coefs, pSrc->llnl_co2_coefs, (size_t) llnl_count_co2_coefs * sizeof(LDBLE));
}
llnl_temp = pSrc->llnl_temp;
llnl_adh = pSrc->llnl_adh;
llnl_bdh = pSrc->llnl_bdh;
llnl_bdot = pSrc->llnl_bdot;
llnl_co2_coefs = pSrc->llnl_co2_coefs;
// Not implemented for now
SelectedOutput_map = pSrc->SelectedOutput_map;
@ -2057,17 +2012,6 @@ Phreeqc::InternalCopy(const Phreeqc *pSrc)
//remove_unstable_phases = FALSE;
// auto screen_string;
spread_length = 10;
/* ---------------------------------------------------------------------- */
/*
* Hash definitions
*/
/*
elements_hash_table = NULL;
species_hash_table = NULL;
phases_hash_table = NULL;
logk_hash_table = NULL;
master_isotope_hash_table = NULL;
*/
/* ----------------------------------------------------------------------
* ISOTOPES
* ---------------------------------------------------------------------- */

View File

@ -721,11 +721,6 @@ public:
int read_inv_isotopes(struct inverse *inverse_ptr, char *ptr);
int read_inv_phases(struct inverse *inverse_ptr, char *next_char);
int read_kinetics(void);
int read_line_doubles(char *next_char, LDBLE ** d, int *count_d,
int *count_alloc);
int read_lines_doubles(char *next_char, LDBLE ** d, int *count_d,
int *count_alloc, const char **opt_list,
int count_opt_list, int *opt);
LDBLE *read_list_doubles(char **ptr, int *count_doubles);
int *read_list_ints(char **ptr, int *count_ints, int positive);
int *read_list_t_f(char **ptr, int *count_ints);
@ -1629,9 +1624,8 @@ protected:
bool output_newline;
inline void Set_output_newline(bool tf) { this->output_newline = tf;}
inline bool Get_output_newline() { return this->output_newline;}
LDBLE *llnl_temp, *llnl_adh, *llnl_bdh, *llnl_bdot, *llnl_co2_coefs, a_llnl, b_llnl, bdot_llnl;
int llnl_count_temp, llnl_count_adh, llnl_count_bdh, llnl_count_bdot,
llnl_count_co2_coefs;
double a_llnl, b_llnl, bdot_llnl;
std::vector<double> llnl_temp, llnl_adh, llnl_bdh, llnl_bdot, llnl_co2_coefs;
//char *selected_output_file_name;
std::map<int, SelectedOutput> SelectedOutput_map;

View File

@ -722,7 +722,7 @@ dh_bdot(const char* name)
char token[MAX_LENGTH];
struct species* s_ptr;
double b = -999.99;
if (llnl_count_temp > 0)
if (llnl_temp.size() > 0)
{
b = bdot_llnl;
}

View File

@ -149,16 +149,7 @@
#endif
#define REF_PRES_PASCAL 1.01325E5 /* Reference pressure: 1 atm */
#define MAX_P_NONLLNL 1500.0
/*
* Hash definitions
*/
# define SegmentSize 256
# define SegmentSizeShift 8 /* log2(SegmentSize) */
# define DirectorySize 256
# define DirectorySizeShift 8 /* log2(DirectorySize) */
# define Prime1 37
# define Prime2 1048583
# define DefaultMaxLoadFactor 5
//
// Typedefs and structure definitions
//

View File

@ -1304,11 +1304,11 @@ master_isotope_store(const char *name, int replace_if_found)
/* ---------------------------------------------------------------------- */
{
/*
* Function locates the string "name" in the hash table for master_isotope.
* Function locates the string "name" in the map for master_isotope.
*
* Pointer to a master_isotope structure is always returned.
*
* If the string is not found, a new entry is made in the hash table. Pointer to
* If the string is not found, a new entry is made in the map. Pointer to
* the new structure is returned.
* If "name" is found and replace is true, pointers in old master_isotope structure
* are freed and replaced with additional input.
@ -1607,7 +1607,7 @@ isotope_ratio_store(const char *name_in, int replace_if_found)
*
* Pointer to a isotope_ratio structure is always returned.
*
* If the string is not found, a new entry is made in the hash table. Pointer to
* If the string is not found, a new entry is made in the map. Pointer to
* the new structure is returned.
* If "name" is found and replace is true, pointers in old isotope_ratio structure
* are freed and replaced with additional input.

View File

@ -71,26 +71,6 @@ initialize(void)
Initialize llnl aqueous model parameters
*/
a_llnl = b_llnl = 0.0;
llnl_temp = (LDBLE *) PHRQ_malloc(sizeof(LDBLE));
if (llnl_temp == NULL)
malloc_error();
llnl_count_temp = 0;
llnl_adh = (LDBLE *) PHRQ_malloc(sizeof(LDBLE));
if (llnl_adh == NULL)
malloc_error();
llnl_count_adh = 0;
llnl_bdh = (LDBLE *) PHRQ_malloc(sizeof(LDBLE));
if (llnl_bdh == NULL)
malloc_error();
llnl_count_bdh = 0;
llnl_bdot = (LDBLE *) PHRQ_malloc(sizeof(LDBLE));
if (llnl_bdot == NULL)
malloc_error();
llnl_count_bdot = 0;
llnl_co2_coefs = (LDBLE *) PHRQ_malloc(sizeof(LDBLE));
if (llnl_co2_coefs == NULL)
malloc_error();
llnl_count_co2_coefs = 0;
// new PBasic
basic_interpreter = new PBasic(this, phrq_io);
// allocate one change_surf

View File

@ -53,7 +53,7 @@ model(void)
input_error++;
error_msg("Cannot use PITZER and SIT data blocks in same run (database + input file).", STOP);
}
if ((pitzer_model == TRUE || sit_model == TRUE) && llnl_count_temp >0)
if ((pitzer_model == TRUE || sit_model == TRUE) && llnl_temp.size() > 0)
{
input_error++;
error_msg("Cannot use LLNL_AQUEOUS_MODEL_PARAMETERS with PITZER or SIT data blocks in same run (database + input file).", STOP);
@ -570,17 +570,17 @@ gammas(LDBLE mu)
/*
* LLNL temperature dependence
*/
if (llnl_count_temp > 0)
if (llnl_temp.size() > 0)
{
ifirst = 0;
ilast = llnl_count_temp;
if (tc_x < llnl_temp[0] || tc_x > llnl_temp[llnl_count_temp - 1])
ilast = (int)llnl_temp.size();
if (tc_x < llnl_temp[0] || tc_x > llnl_temp[llnl_temp.size() - 1])
{
error_msg
("Temperature out of range of LLNL_AQUEOUS_MODEL parameters",
STOP);
}
for (i = 0; i < llnl_count_temp; i++)
for (i = 0; i < (int)llnl_temp.size(); i++)
{
if (tc_x >= llnl_temp[i])
ifirst = i;
@ -629,7 +629,7 @@ gammas(LDBLE mu)
(2 * muhalf * (muhalf + 1.0) * (muhalf + 1.0)) -
0.3);
c2 = -a / (2 * muhalf);
if (llnl_count_temp > 0)
if (llnl_temp.size() > 0)
{
c2_llnl = -a_llnl / (2 * muhalf);
}
@ -725,7 +725,7 @@ gammas(LDBLE mu)
}
else if (s_x[i]->exch_gflag == 7 && s_x[i]->alk > 0)
{
if (llnl_count_temp > 0)
if (llnl_temp.size() > 0)
{
s_x[i]->lg =
coef * (-a_llnl * muhalf * z * z /
@ -805,7 +805,7 @@ gammas(LDBLE mu)
}
break;
case 7: /* LLNL */
if (llnl_count_temp > 0)
if (llnl_temp.size() > 0)
{
if (s_x[i]->z == 0)
{
@ -834,7 +834,7 @@ gammas(LDBLE mu)
}
break;
case 8: /* LLNL CO2 */
if (llnl_count_temp > 0)
if (llnl_temp.size() > 0)
{
s_x[i]->lg = log_g_co2;
s_x[i]->dg = dln_g_co2 * s_x[i]->moles;
@ -2690,7 +2690,7 @@ calc_gas_pressures(void)
* Fixed-volume gas phase reacting with a solution
* Change pressure used in logK to pressure of gas phase
*/
if (gas_phase_ptr->Get_total_p() > MAX_P_NONLLNL && llnl_count_temp <= 0)
if (gas_phase_ptr->Get_total_p() > MAX_P_NONLLNL && llnl_temp.size() == 0)
{
gas_phase_ptr->Set_total_moles(0);
for (size_t i = 0; i < gas_phase_ptr->Get_gas_comps().size(); i++)
@ -3686,7 +3686,7 @@ reset(void)
//{
// patm_x = ( 1 * patm_x + p_sat) / 2.0;
//}
if (llnl_count_temp <= 0)
if (llnl_temp.size() == 0)
{
if (patm_x > MAX_P_NONLLNL)
patm_x = MAX_P_NONLLNL;

View File

@ -5480,7 +5480,7 @@ calc_vm(LDBLE tc, LDBLE pa)
* b4 = logk[vmi4], or
* coef(tc) = millero[3] + millero[4] * tc + millero[5] * tc^2
*/
if (llnl_count_temp > 0) return OK;
if (llnl_temp.size() > 0) return OK;
LDBLE pb_s = 2600. + pa * 1.01325, TK_s = tc + 45.15, sqrt_mu = sqrt(mu_x);
for (int i = 0; i < (int)this->s_x.size(); i++)
{

View File

@ -597,7 +597,7 @@ print_gas_phase(void)
print_centered("Gas phase");
output_msg(sformatf("Total pressure: %5.2f atmospheres",
(double) gas_phase_ptr->Get_total_p()));
if (gas_phase_ptr->Get_total_p() >= MAX_P_NONLLNL && llnl_count_temp <= 0)
if (gas_phase_ptr->Get_total_p() >= MAX_P_NONLLNL && llnl_temp.size() == 0)
output_msg(" WARNING: Program limit.\n");
else if (PR)
output_msg(" (Peng-Robinson calculation)\n");

300
read.cpp
View File

@ -9243,25 +9243,22 @@ int Phreeqc::
read_llnl_aqueous_model_parameters(void)
/* ---------------------------------------------------------------------- */
{
/*
* Reads aqueous model parameters
*
* Arguments:
* none
*
* Returns:
* KEYWORD if keyword encountered, input_error may be incremented if
* a keyword is encountered in an unexpected position
* EOF if eof encountered while reading mass balance concentrations
* ERROR if error occurred reading data
*
*/
int i, count_alloc;
char token[MAX_LENGTH];
/*
* Reads aqueous model parameters
*
* Arguments:
* none
*
* Returns:
* KEYWORD if keyword encountered, input_error may be incremented if
* a keyword is encountered in an unexpected position
* EOF if eof encountered while reading mass balance concentrations
* ERROR if error occurred reading data
*
*/
int return_value, opt;
char *next_char;
const char *opt_list[] = {
char* next_char;
const char* opt_list[] = {
"temperatures", /* 0 */
"temperature", /* 1 */
"temp", /* 2 */
@ -9277,21 +9274,23 @@ read_llnl_aqueous_model_parameters(void)
"co2_coefs" /* 12 */
};
int count_opt_list = 13;
/*
* Initialize
*/
/*
* Read aqueous model parameters
*/
/*
* Initialize
*/
/*
* Read aqueous model parameters
*/
return_value = UNKNOWN;
opt = get_option(opt_list, count_opt_list, &next_char);
int opt_save = OPTION_DEFAULT;
opt_save = OPTION_DEFAULT;
for (;;)
{
next_char = line;
if (opt >= 0)
opt = get_option(opt_list, count_opt_list, &next_char);
if (opt == OPTION_DEFAULT)
{
copy_token(token, &next_char, &i);
opt = opt_save;
}
opt_save = OPTION_DEFAULT;
switch (opt)
{
case OPTION_EOF: /* end of file */
@ -9304,112 +9303,98 @@ read_llnl_aqueous_model_parameters(void)
case OPTION_ERROR:
input_error++;
error_msg
("Unknown input in LLNL_AQUEOUS_MODEL_PARAMETERS keyword.",
CONTINUE);
("Unknown input in LLNL_AQUEOUS_MODEL_PARAMETERS keyword.",
CONTINUE);
error_msg(line_save, CONTINUE);
break;
/*
* New component
*/
case 0: /* temperatures */
case 1: /* temperature */
case 2: /* temp */
count_alloc = 1;
llnl_count_temp = 0;
i = read_lines_doubles(next_char, &(llnl_temp),
&(llnl_count_temp), &(count_alloc),
opt_list, count_opt_list, &opt);
/*
ptr = next_char;
llnl_temp = read_list_doubles(&ptr, &count);
llnl_count_temp = count;
*/
break;
{
std::istringstream iss(next_char);
while (iss >> dummy)
{
llnl_temp.push_back(dummy);
}
opt_save = 2;
}
break;
case 3: /* adh */
case 4: /* debye_huckel_a */
case 5: /* dh_a */
count_alloc = 1;
llnl_count_adh = 0;
i = read_lines_doubles(next_char, &(llnl_adh), &(llnl_count_adh),
&(count_alloc), opt_list, count_opt_list,
&opt);
/*
ptr = next_char;
llnl_adh = read_list_doubles(&ptr, &count);
llnl_count_adh = count;
*/
break;
{
std::istringstream iss(next_char);
while (iss >> dummy)
{
llnl_adh.push_back(dummy);
}
opt_save = 5;
}
break;
case 6: /* bdh */
case 7: /* debye_huckel_b */
case 8: /* dh_b */
count_alloc = 1;
llnl_count_bdh = 0;
i = read_lines_doubles(next_char, &(llnl_bdh), &(llnl_count_bdh),
&(count_alloc), opt_list, count_opt_list,
&opt);
/*
ptr = next_char;
llnl_bdh = read_list_doubles(&ptr, &count);
llnl_count_bdh = count;
*/
break;
{
std::istringstream iss(next_char);
while (iss >> dummy)
{
llnl_bdh.push_back(dummy);
}
opt_save = 8;
}
break;
case 9: /* bdot */
case 10: /* b_dot */
count_alloc = 1;
llnl_count_bdot = 0;
i = read_lines_doubles(next_char, &(llnl_bdot),
&(llnl_count_bdot), &(count_alloc),
opt_list, count_opt_list, &opt);
/*
ptr = next_char;
llnl_bdot = read_list_doubles(&ptr, &count);
llnl_count_bdot = count;
*/
break;
{
std::istringstream iss(next_char);
while (iss >> dummy)
{
llnl_bdot.push_back(dummy);
}
opt_save = 10;
}
break;
case 11: /* c_co2 */
case 12: /* co2_coefs */
count_alloc = 1;
llnl_count_co2_coefs = 0;
i = read_lines_doubles(next_char, &(llnl_co2_coefs),
&(llnl_count_co2_coefs), &(count_alloc),
opt_list, count_opt_list, &opt);
/*
ptr = next_char;
llnl_co2_coefs = read_list_doubles(&ptr, &count);
llnl_count_co2_coefs = count;
*/
break;
{
std::istringstream iss(next_char);
while (iss >> dummy)
{
llnl_co2_coefs.push_back(dummy);
}
opt_save = 12;
}
break;
}
return_value = check_line_return;
if (return_value == EOF || return_value == KEYWORD)
break;
}
/* check consistency */
if ((llnl_count_temp <= 0) ||
(llnl_count_temp != llnl_count_adh) ||
(llnl_count_temp != llnl_count_bdh) ||
(llnl_count_temp != llnl_count_bdot))
if ((llnl_temp.size() == 0) ||
(llnl_temp.size() != llnl_adh.size()) ||
(llnl_temp.size() != llnl_bdh.size()) ||
(llnl_temp.size() != llnl_bdot.size()))
{
error_msg
("Must define equal number (>0) of temperatures, dh_a, dh_b, and bdot parameters\nin LLNL_AQUEOUS_MODEL",
CONTINUE);
("Must define equal number (>0) of temperatures, dh_a, dh_b, and bdot parameters\nin LLNL_AQUEOUS_MODEL",
CONTINUE);
input_error++;
}
if (llnl_count_co2_coefs != 5)
if (llnl_co2_coefs.size() != 5)
{
error_msg
("Must define 5 CO2 activity coefficient parameters in LLNL_AQUEOUS_MODEL",
CONTINUE);
("Must define 5 CO2 activity coefficient parameters in LLNL_AQUEOUS_MODEL",
CONTINUE);
input_error++;
}
for (i = 1; i < llnl_count_temp; i++)
for (size_t i = 1; i < llnl_temp.size(); i++)
{
if (llnl_temp[i - 1] > llnl_temp[i])
{
error_msg
("Temperatures must be in ascending order in LLNL_AQUEOUS_MODEL",
CONTINUE);
("Temperatures must be in ascending order in LLNL_AQUEOUS_MODEL",
CONTINUE);
input_error++;
}
}
@ -9417,119 +9402,6 @@ read_llnl_aqueous_model_parameters(void)
return (return_value);
}
/* ---------------------------------------------------------------------- */
int Phreeqc::
read_lines_doubles(char *next_char, LDBLE ** d, int *count_d,
int *count_alloc, const char **opt_list,
int count_opt_list, int *opt)
/* ---------------------------------------------------------------------- */
{
/*
* Reads LDBLEs on line starting at next_char
* and on succeeding lines. Appends to d.
* Stops at KEYWORD, OPTION, and EOF
*
* Input Arguments:
* next_char points to line to read from
* d points to array of LDBLEs, must be malloced
* count_d number of elements in array
* count_alloc number of elements malloced
*
* Output Arguments:
* d points to array of LDBLEs, may have been
* realloced
* count_d updated number of elements in array
* count_alloc updated of elements malloced
*
* Returns:
* KEYWORD
* OPTION
* EOF
* ERROR if any errors reading LDBLEs
*/
if (read_line_doubles(next_char, d, count_d, count_alloc) == ERROR)
{
return (ERROR);
}
for (;;)
{
*opt = get_option(opt_list, count_opt_list, &next_char);
if (*opt == OPTION_KEYWORD || *opt == OPTION_EOF
|| *opt == OPTION_ERROR)
{
break;
}
else if (*opt >= 0)
{
break;
}
next_char = line;
if (read_line_doubles(next_char, d, count_d, count_alloc) == ERROR)
{
return (ERROR);
}
}
return (OK);
}
/* ---------------------------------------------------------------------- */
int Phreeqc::
read_line_doubles(char *next_char, LDBLE ** d, int *count_d, int *count_alloc)
/* ---------------------------------------------------------------------- */
{
int i, j, l, n;
LDBLE value;
char token[MAX_LENGTH];
for (;;)
{
j = copy_token(token, &next_char, &l);
if (j == EMPTY)
{
break;
}
if (j != DIGIT)
{
return (ERROR);
}
if (replace("*", " ", token) == TRUE)
{
if (sscanf(token, "%d" SCANFORMAT, &n, &value) != 2)
{
return (ERROR);
}
}
else
{
(void)sscanf(token, SCANFORMAT, &value);
n = 1;
}
for (;;)
{
if ((*count_d) + n > (*count_alloc))
{
*count_alloc *= 2;
*d = (LDBLE *) PHRQ_realloc(*d,
(size_t) (*count_alloc) *
sizeof(LDBLE));
if (*d == NULL)
malloc_error();
}
else
{
break;
}
}
for (i = 0; i < n; i++)
{
(*d)[(*count_d) + i] = value;
}
*count_d += n;
}
return (OK);
}
/* ---------------------------------------------------------------------- */
int Phreeqc::
next_keyword_or_option(const char **opt_list, int count_opt_list)

View File

@ -137,7 +137,7 @@ clean_up(void)
rate_free(&rates[j]);
}
rates.clear();
/* logk hash table */
/* logk table */
for (j = 0; j < (int)logk.size(); j++)
{
logk[j]->add_logk.clear();
@ -168,13 +168,13 @@ clean_up(void)
rate_free(user_print);
user_print = (struct rate*)free_check_null(user_print);
/*
Free llnl aqueous model parameters
Clear llnl aqueous model parameters
*/
llnl_temp = (LDBLE*)free_check_null(llnl_temp);
llnl_adh = (LDBLE*)free_check_null(llnl_adh);
llnl_bdh = (LDBLE*)free_check_null(llnl_bdh);
llnl_bdot = (LDBLE*)free_check_null(llnl_bdot);
llnl_co2_coefs = (LDBLE*)free_check_null(llnl_co2_coefs);
llnl_temp.clear();
llnl_adh.clear();
llnl_bdh.clear();
llnl_bdot.clear();
llnl_co2_coefs.clear();
/*
* Copier space
*/
@ -226,7 +226,7 @@ clean_up(void)
pitzer_clean_up();
/* sit */
sit_clean_up();
/* hash tables */
/* elements, species, phases*/
elements_map.clear();
species_map.clear();
phases_map.clear();
@ -253,12 +253,6 @@ clean_up(void)
last_title_x.clear();
count_inverse = 0;
llnl_count_temp = 0;
llnl_count_adh = 0;
llnl_count_bdh = 0;
llnl_count_bdot = 0;
llnl_count_co2_coefs = 0;
default_data_base = (char *) free_check_null(default_data_base);
sformatf_buffer = (char *) free_check_null(sformatf_buffer);
return (OK);
@ -3145,7 +3139,7 @@ logk_search(const char *name_in)
/* ---------------------------------------------------------------------- */
{
/*
* Function locates the string "name" in the hash table for logk.
* Function locates the string "name" in the map for logk.
*
* Arguments:
* name input, character string to be found in "logk".

View File

@ -163,7 +163,7 @@ calc_rho_0(LDBLE tc, LDBLE pa)
Wagner and Pruss, 2002, JPCRD 31, 387, eqn. 2.6, along the saturation pressure line +
interpolation 0 - 300 oC, 0.006 - 1000 atm...
*/
if (llnl_count_temp > 0) return OK;
if (llnl_temp.size() > 0) return OK;
if (tc > 350.)
{
if (need_temp_msg < 1)
@ -223,7 +223,7 @@ calc_dielectrics(LDBLE tc, LDBLE pa)
and Fernandez et al., 1997, JPCRD 26, 1125, show its correctness)
+ d(eps)/d(P), Debye-Hueckel A and B, and Av (for Av, see Pitzer et al., 1984, JPCRD 13, p. 4)
*/
if (llnl_count_temp > 0) return OK;
if (llnl_temp.size() > 0) return OK;
if (tc > 350.)
{
tc = 350.;
@ -1449,41 +1449,8 @@ status(int count, const char *str, bool rk_string)
return (OK);
}
#endif /*PHREEQCI_GUI */
/*
** Dynamic hashing, after CACM April 1988 pp 446-457, by Per-Ake Larson.
** Coded into C, with minor code improvements, and with hsearch(3) interface,
** by ejp@ausmelb.oz, Jul 26, 1988: 13:16;
** also, hcreate/hdestroy routines added to simulate hsearch(3).
**
** These routines simulate hsearch(3) and family, with the important
** difference that the hash table is dynamic - can grow indefinitely
** beyond its original size (as supplied to hcreate()).
**
** Performance appears to be comparable to that of hsearch(3).
** The 'source-code' options referred to in hsearch(3)'s 'man' page
** are not implemented; otherwise functionality is identical.
**
** Compilation controls:
** DEBUG controls some informative traces, mainly for debugging.
** HASH_STATISTICS causes HashAccesses and HashCollisions to be maintained;
** when combined with DEBUG, these are displayed by hdestroy().
**
** Problems & fixes to ejp@ausmelb.oz. WARNING: relies on pre-processor
** concatenation property, in probably unnecessary code 'optimisation'.
** Esmond Pitt, Austec (Asia/Pacific) Ltd
** ...!uunet.UU.NET!munnari!ausmelb!ejp,ejp@ausmelb.oz
*/
# include <assert.h>
/*
** Fast arithmetic, relying on powers of 2,
** and on pre-processor concatenation property
*/
/* rewrote to remove MUL and DIV */
//# define MOD(x,y) ((x) & ((y)-1))
/* ---------------------------------------------------------------------- */
int Phreeqc::
string_trim(char *str)