mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Removed keyword hash.
Added enum for unique keywords, static map of phreeqc keywords, map of keyword names. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/branches/ErrorHandling@5832 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
02119ae8db
commit
041db99144
299
Phreeqc.cpp
299
Phreeqc.cpp
@ -68,104 +68,10 @@ Phreeqc::Phreeqc(void)
|
||||
iso_defaults[i].uncertainty = temp_iso_defaults[i].uncertainty;
|
||||
}
|
||||
|
||||
|
||||
struct const_key keyword_temp[] = {
|
||||
{"eof", 0},
|
||||
{"end", 0},
|
||||
{"solution_species", 0},
|
||||
{"solution_master_species", 0},
|
||||
{"solution", 0},
|
||||
{"phases", 0},
|
||||
{"pure_phases", 0},
|
||||
{"reaction", 0},
|
||||
{"mix", 0},
|
||||
{"use", 0},
|
||||
{"save", 0},
|
||||
{"exchange_species", 0},
|
||||
{"exchange_master_species", 0},
|
||||
{"exchange", 0},
|
||||
{"surface_species", 0},
|
||||
{"surface_master_species", 0},
|
||||
{"surface", 0},
|
||||
{"reaction_temperature", 0},
|
||||
{"inverse_modeling", 0},
|
||||
{"gas_phase", 0},
|
||||
{"transport", 0},
|
||||
{"debug", 0},
|
||||
{"selected_output", 0},
|
||||
{"select_output", 0},
|
||||
{"knobs", 0},
|
||||
{"print", 0},
|
||||
{"equilibrium_phases", 0},
|
||||
{"equilibria", 0},
|
||||
{"equilibrium", 0},
|
||||
{"pure", 0},
|
||||
{"title", 0},
|
||||
{"comment", 0},
|
||||
{"advection", 0},
|
||||
{"kinetics", 0},
|
||||
{"incremental_reactions", 0},
|
||||
{"incremental", 0},
|
||||
{"rates", 0},
|
||||
{"solution_s", 0},
|
||||
{"user_print", 0},
|
||||
{"user_punch", 0},
|
||||
{"solid_solutions", 0},
|
||||
{"solid_solution", 0},
|
||||
{"solution_spread", 0},
|
||||
{"spread_solution", 0},
|
||||
{"selected_out", 0},
|
||||
{"select_out", 0},
|
||||
{"user_graph", 0},
|
||||
{"llnl_aqueous_model_parameters", 0},
|
||||
{"llnl_aqueous_model", 0},
|
||||
{"database", 0},
|
||||
{"named_analytical_expression", 0},
|
||||
{"named_analytical_expressions", 0},
|
||||
{"named_expressions", 0},
|
||||
{"named_log_k", 0},
|
||||
{"isotopes", 0},
|
||||
{"calculate_values", 0},
|
||||
{"isotope_ratios", 0},
|
||||
{"isotope_alphas", 0},
|
||||
{"copy", 0},
|
||||
{"pitzer", 0},
|
||||
{"sit", 0},
|
||||
{"equilibrium_phase", 0}
|
||||
,
|
||||
{"solution_raw", 0},
|
||||
{"exchange_raw", 0},
|
||||
{"surface_raw", 0},
|
||||
{"equilibrium_phases_raw", 0},
|
||||
{"kinetics_raw", 0},
|
||||
{"solid_solutions_raw", 0},
|
||||
{"gas_phase_raw", 0},
|
||||
{"reaction_raw", 0},
|
||||
{"mix_raw", 0},
|
||||
{"reaction_temperature_raw", 0},
|
||||
{"dump", 0},
|
||||
{"solution_modify", 0},
|
||||
{"equilibrium_phases_modify", 0},
|
||||
{"exchange_modify", 0},
|
||||
{"surface_modify", 0},
|
||||
{"solid_solutions_modify", 0},
|
||||
{"gas_phase_modify", 0},
|
||||
{"kinetics_modify", 0},
|
||||
{"delete", 0},
|
||||
{"run_cells", 0},
|
||||
{"reaction_modify", 0},
|
||||
{"reaction_temperature_modify", 0},
|
||||
{"solid_solution_modify", 0}
|
||||
};
|
||||
NKEYS = (sizeof(keyword_temp) / sizeof(struct const_key)); /* Number of valid keywords */
|
||||
|
||||
|
||||
//keyword = (struct const_key *) PHRQ_malloc((size_t) (NKEYS * sizeof(const_key)));
|
||||
keyword = new const_key[NKEYS];
|
||||
for (i = 0; i < NKEYS; i++)
|
||||
// counters for enum KEYWORDS
|
||||
for (i = 0; i < KEY_COUNT_KEYWORDS; i++)
|
||||
{
|
||||
keyword[i].name = string_duplicate(keyword_temp[i].name);
|
||||
keyword[i].keycount = 0;
|
||||
keycount.push_back(0);
|
||||
}
|
||||
|
||||
// basic.c
|
||||
@ -238,11 +144,6 @@ Phreeqc::~Phreeqc(void)
|
||||
iso_defaults[i].name = (char *) free_check_null((void *) iso_defaults[i].name);
|
||||
}
|
||||
delete[] iso_defaults;
|
||||
for (i = 0; i < NKEYS; i++)
|
||||
{
|
||||
keyword[i].name = (char *) free_check_null((void *) keyword[i].name);
|
||||
}
|
||||
delete[] keyword;
|
||||
|
||||
free_check_null(default_data_base);
|
||||
free_check_null(sformatf_buffer);
|
||||
@ -548,7 +449,6 @@ void Phreeqc::init(void)
|
||||
elements_hash_table = 0;
|
||||
species_hash_table = 0;
|
||||
phases_hash_table = 0;
|
||||
keyword_hash_table = 0;
|
||||
/*
|
||||
* Initialize use pointers
|
||||
*/
|
||||
@ -624,10 +524,6 @@ void Phreeqc::init(void)
|
||||
last_model.si = NULL;
|
||||
last_model.surface_comp = NULL;
|
||||
last_model.surface_charge = NULL;
|
||||
/*
|
||||
* Update hash table
|
||||
*/
|
||||
keyword_hash = 0;
|
||||
/*
|
||||
* rates
|
||||
*/
|
||||
@ -976,4 +872,193 @@ void Phreeqc::init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
Phreeqc::KEYWORDS Phreeqc::Keyword_search(std::string key)
|
||||
{
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::const_iterator it;
|
||||
it = phreeqc_keywords.find(key);
|
||||
if (it != Phreeqc::phreeqc_keywords.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return Phreeqc::KEY_NONE;
|
||||
}
|
||||
|
||||
const std::string & Phreeqc::Keyword_name_search(Phreeqc::KEYWORDS key)
|
||||
{
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::const_iterator it;
|
||||
it = phreeqc_keyword_names.find(key);
|
||||
if (it != Phreeqc::phreeqc_keyword_names.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
it = phreeqc_keyword_names.find(KEY_NONE);
|
||||
return it->second;
|
||||
}
|
||||
|
||||
const std::map<const std::string, Phreeqc::KEYWORDS>::value_type temp_keywords[] = {
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("eof", Phreeqc::KEY_END),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("end", Phreeqc::KEY_END),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solution_species", Phreeqc::KEY_SOLUTION_SPECIES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solution_master_species", Phreeqc::KEY_SOLUTION_MASTER_SPECIES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solution", Phreeqc::KEY_SOLUTION),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("phases", Phreeqc::KEY_PHASES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("pure_phases", Phreeqc::KEY_EQUILIBRIUM_PHASES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction", Phreeqc::KEY_REACTION),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("mix", Phreeqc::KEY_MIX),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("use", Phreeqc::KEY_USE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("save", Phreeqc::KEY_SAVE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("exchange_species", Phreeqc::KEY_EXCHANGE_SPECIES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("exchange_master_species", Phreeqc::KEY_EXCHANGE_MASTER_SPECIES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("exchange", Phreeqc::KEY_EXCHANGE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("surface_species", Phreeqc::KEY_SURFACE_SPECIES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("surface_master_species", Phreeqc::KEY_SURFACE_MASTER_SPECIES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("surface", Phreeqc::KEY_SURFACE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_temperature", Phreeqc::KEY_REACTION_TEMPERATURE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("inverse_modeling", Phreeqc::KEY_INVERSE_MODELING),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("gas_phase", Phreeqc::KEY_GAS_PHASE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("transport", Phreeqc::KEY_TRANSPORT),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("debug", Phreeqc::KEY_KNOBS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("selected_output", Phreeqc::KEY_SELECTED_OUTPUT),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("select_output", Phreeqc::KEY_SELECTED_OUTPUT),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("knobs", Phreeqc::KEY_KNOBS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("print", Phreeqc::KEY_PRINT),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("equilibrium_phases", Phreeqc::KEY_EQUILIBRIUM_PHASES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("equilibria", Phreeqc::KEY_EQUILIBRIUM_PHASES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("equilibrium", Phreeqc::KEY_EQUILIBRIUM_PHASES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("pure", Phreeqc::KEY_EQUILIBRIUM_PHASES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("title", Phreeqc::KEY_TITLE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("comment", Phreeqc::KEY_TITLE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("advection", Phreeqc::KEY_ADVECTION),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("kinetics", Phreeqc::KEY_KINETICS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("incremental_reactions", Phreeqc::KEY_INCREMENTAL_REACTIONS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("incremental", Phreeqc::KEY_INCREMENTAL_REACTIONS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("rates", Phreeqc::KEY_RATES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solution_s", Phreeqc::KEY_SOLUTION_SPREAD),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("user_print", Phreeqc::KEY_USER_PRINT),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("user_punch", Phreeqc::KEY_USER_PUNCH),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solid_solutions", Phreeqc::KEY_SOLID_SOLUTIONS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solid_solution", Phreeqc::KEY_SOLID_SOLUTIONS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solution_spread", Phreeqc::KEY_SOLUTION_SPREAD),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("spread_solution", Phreeqc::KEY_SOLUTION_SPREAD),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("selected_out", Phreeqc::KEY_SELECTED_OUTPUT),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("select_out", Phreeqc::KEY_SELECTED_OUTPUT),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("user_graph", Phreeqc::KEY_USER_GRAPH),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("llnl_aqueous_model_parameters", Phreeqc::KEY_LLNL_AQUEOUS_MODEL_PARAMETERS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("llnl_aqueous_model", Phreeqc::KEY_LLNL_AQUEOUS_MODEL_PARAMETERS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("database", Phreeqc::KEY_DATABASE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("named_analytical_expression", Phreeqc::KEY_NAMED_EXPRESSIONS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("named_analytical_expressions", Phreeqc::KEY_NAMED_EXPRESSIONS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("named_expressions", Phreeqc::KEY_NAMED_EXPRESSIONS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("named_log_k", Phreeqc::KEY_NAMED_EXPRESSIONS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("isotopes", Phreeqc::KEY_ISOTOPES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("calculate_values", Phreeqc::KEY_CALCULATE_VALUES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("isotope_ratios", Phreeqc::KEY_ISOTOPE_RATIOS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("isotope_alphas", Phreeqc::KEY_ISOTOPE_ALPHAS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("copy", Phreeqc::KEY_COPY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("pitzer", Phreeqc::KEY_PITZER),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("sit", Phreeqc::KEY_SIT),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("equilibrium_phase", Phreeqc::KEY_EQUILIBRIUM_PHASES),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solution_raw", Phreeqc::KEY_SOLUTION_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("exchange_raw", Phreeqc::KEY_EXCHANGE_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("surface_raw", Phreeqc::KEY_SURFACE_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("equilibrium_phases_raw", Phreeqc::KEY_EQUILIBRIUM_PHASES_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("kinetics_raw", Phreeqc::KEY_KINETICS_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solid_solutions_raw", Phreeqc::KEY_SOLID_SOLUTIONS_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("gas_phase_raw", Phreeqc::KEY_GAS_PHASE_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_raw", Phreeqc::KEY_REACTION_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("mix_raw", Phreeqc::KEY_MIX_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_temperature_raw", Phreeqc::KEY_REACTION_TEMPERATURE_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("dump", Phreeqc::KEY_DUMP),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solution_modify", Phreeqc::KEY_SOLUTION_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("equilibrium_phases_modify", Phreeqc::KEY_EQUILIBRIUM_PHASES_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("exchange_modify", Phreeqc::KEY_EXCHANGE_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("surface_modify", Phreeqc::KEY_SURFACE_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solid_solutions_modify", Phreeqc::KEY_SOLID_SOLUTIONS_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("gas_phase_modify", Phreeqc::KEY_GAS_PHASE_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("kinetics_modify", Phreeqc::KEY_KINETICS_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("delete", Phreeqc::KEY_DELETE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("run_cells", Phreeqc::KEY_RUN_CELLS),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_modify", Phreeqc::KEY_REACTION_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_temperature_modify", Phreeqc::KEY_REACTION_TEMPERATURE_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("solid_solution_modify", Phreeqc::KEY_SOLID_SOLUTION_MODIFY),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_pressure", Phreeqc::KEY_REACTION_PRESSURE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_pressures", Phreeqc::KEY_REACTION_PRESSURE),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_pressure_raw", Phreeqc::KEY_REACTION_PRESSURE_RAW),
|
||||
std::map<const std::string, Phreeqc::KEYWORDS>::value_type("reaction_pressure_modify", Phreeqc::KEY_REACTION_PRESSURE_MODIFY)
|
||||
|
||||
};
|
||||
std::map<const std::string, Phreeqc::KEYWORDS> Phreeqc::phreeqc_keywords(temp_keywords, temp_keywords + sizeof temp_keywords / sizeof temp_keywords[0]);
|
||||
|
||||
const std::map<Phreeqc::KEYWORDS, std::string>::value_type temp_keyword_names[] = {
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_NONE, "UNKNOWN"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_END, "END"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLUTION_SPECIES, "SOLUTION_SPECIES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLUTION_MASTER_SPECIES, "SOLUTION_MASTER_SPECIES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLUTION, "SOLUTION"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_PHASES, "PHASES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION, "REACTION"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_MIX, "MIX"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_USE, "USE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SAVE, "SAVE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_EXCHANGE_SPECIES, "EXCHANGE_SPECIES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_EXCHANGE_MASTER_SPECIES, "EXCHANGE_MASTER_SPECIES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_EXCHANGE, "EXCHANGE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SURFACE_SPECIES, "SURFACE_SPECIES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SURFACE_MASTER_SPECIES, "SURFACE_MASTER_SPECIES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SURFACE, "SURFACE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION_TEMPERATURE, "REACTION_TEMPERATURE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_INVERSE_MODELING, "INVERSE_MODELING"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_GAS_PHASE, "GAS_PHASE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_TRANSPORT, "TRANSPORT"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SELECTED_OUTPUT, "SELECTED_OUTPUT"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_KNOBS, "KNOBS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_PRINT, "PRINT"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_EQUILIBRIUM_PHASES, "EQUILIBRIUM_PHASES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_TITLE, "TITLE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_ADVECTION, "ADVECTION"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_KINETICS, "KINETICS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_INCREMENTAL_REACTIONS, "INCREMENTAL_REACTIONS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_RATES, "RATES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_USER_PRINT, "USER_PRINT"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_USER_PUNCH, "USER_PUNCH"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLID_SOLUTIONS, "SOLID_SOLUTIONS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLUTION_SPREAD, "SOLUTION_SPREAD"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_USER_GRAPH, "USER_GRAPH"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_LLNL_AQUEOUS_MODEL_PARAMETERS, "LLNL_AQUEOUS_MODEL_PARAMETERS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_DATABASE, "DATABASE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_NAMED_EXPRESSIONS, "NAMED_EXPRESSIONS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_ISOTOPES, "ISOTOPES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_CALCULATE_VALUES, "CALCULATE_VALUES"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_ISOTOPE_RATIOS, "ISOTOPE_RATIOS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_ISOTOPE_ALPHAS, "ISOTOPE_ALPHAS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_COPY, "COPY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_PITZER, "PITZER"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SIT, "SIT"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLUTION_RAW, "SOLUTION_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_EXCHANGE_RAW, "EXCHANGE_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SURFACE_RAW, "SURFACE_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_EQUILIBRIUM_PHASES_RAW, "EQUILIBRIUM_PHASES_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_KINETICS_RAW, "KINETICS_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLID_SOLUTIONS_RAW, "SOLID_SOLUTIONS_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_GAS_PHASE_RAW, "GAS_PHASE_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION_RAW, "REACTION_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_MIX_RAW, "MIX_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION_TEMPERATURE_RAW, "REACTION_TEMPERATURE_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_DUMP, "DUMP"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLUTION_MODIFY, "SOLUTION_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_EQUILIBRIUM_PHASES_MODIFY, "EQUILIBRIUM_PHASES_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_EXCHANGE_MODIFY, "EXCHANGE_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SURFACE_MODIFY, "SURFACE_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLID_SOLUTIONS_MODIFY, "SOLID_SOLUTIONS_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_GAS_PHASE_MODIFY, "GAS_PHASE_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_KINETICS_MODIFY, "KINETICS_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_DELETE, "DELETE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_RUN_CELLS, "RUN_CELLS"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION_MODIFY, "REACTION_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION_TEMPERATURE_MODIFY, "REACTION_TEMPERATURE_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_SOLID_SOLUTION_MODIFY, "SOLID_SOLUTION_MODIFY"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION_PRESSURE, "REACTION_PRESSURE"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION_PRESSURE_RAW, "REACTION_PRESSURE_RAW"),
|
||||
std::map<Phreeqc::KEYWORDS, const std::string>::value_type(Phreeqc::KEY_REACTION_PRESSURE_MODIFY, "REACTION_PRESSURE_MODIFY")
|
||||
};
|
||||
std::map<Phreeqc::KEYWORDS, const std::string> Phreeqc::phreeqc_keyword_names(temp_keyword_names, temp_keyword_names + sizeof temp_keyword_names / sizeof temp_keyword_names[0]);
|
||||
90
Phreeqc.h
90
Phreeqc.h
@ -58,10 +58,86 @@ public:
|
||||
Phreeqc(void);
|
||||
~Phreeqc(void);
|
||||
|
||||
enum KEYWORDS
|
||||
{
|
||||
KEY_NONE,
|
||||
KEY_END,
|
||||
KEY_SOLUTION_SPECIES,
|
||||
KEY_SOLUTION_MASTER_SPECIES,
|
||||
KEY_SOLUTION,
|
||||
KEY_PHASES,
|
||||
KEY_REACTION,
|
||||
KEY_MIX,
|
||||
KEY_USE,
|
||||
KEY_SAVE,
|
||||
KEY_EXCHANGE_SPECIES,
|
||||
KEY_EXCHANGE_MASTER_SPECIES,
|
||||
KEY_EXCHANGE,
|
||||
KEY_SURFACE_SPECIES,
|
||||
KEY_SURFACE_MASTER_SPECIES,
|
||||
KEY_SURFACE,
|
||||
KEY_REACTION_TEMPERATURE,
|
||||
KEY_INVERSE_MODELING,
|
||||
KEY_GAS_PHASE,
|
||||
KEY_TRANSPORT,
|
||||
KEY_SELECTED_OUTPUT,
|
||||
KEY_KNOBS,
|
||||
KEY_PRINT,
|
||||
KEY_EQUILIBRIUM_PHASES,
|
||||
KEY_TITLE,
|
||||
KEY_ADVECTION,
|
||||
KEY_KINETICS,
|
||||
KEY_INCREMENTAL_REACTIONS,
|
||||
KEY_RATES,
|
||||
KEY_USER_PRINT,
|
||||
KEY_USER_PUNCH,
|
||||
KEY_SOLID_SOLUTIONS,
|
||||
KEY_SOLUTION_SPREAD,
|
||||
KEY_USER_GRAPH,
|
||||
KEY_LLNL_AQUEOUS_MODEL_PARAMETERS,
|
||||
KEY_DATABASE,
|
||||
KEY_NAMED_EXPRESSIONS,
|
||||
KEY_ISOTOPES,
|
||||
KEY_CALCULATE_VALUES,
|
||||
KEY_ISOTOPE_RATIOS,
|
||||
KEY_ISOTOPE_ALPHAS,
|
||||
KEY_COPY,
|
||||
KEY_PITZER,
|
||||
KEY_SIT,
|
||||
KEY_SOLUTION_RAW,
|
||||
KEY_EXCHANGE_RAW,
|
||||
KEY_SURFACE_RAW,
|
||||
KEY_EQUILIBRIUM_PHASES_RAW,
|
||||
KEY_KINETICS_RAW,
|
||||
KEY_SOLID_SOLUTIONS_RAW,
|
||||
KEY_GAS_PHASE_RAW,
|
||||
KEY_REACTION_RAW,
|
||||
KEY_MIX_RAW,
|
||||
KEY_REACTION_TEMPERATURE_RAW,
|
||||
KEY_DUMP,
|
||||
KEY_SOLUTION_MODIFY,
|
||||
KEY_EQUILIBRIUM_PHASES_MODIFY,
|
||||
KEY_EXCHANGE_MODIFY,
|
||||
KEY_SURFACE_MODIFY,
|
||||
KEY_SOLID_SOLUTIONS_MODIFY,
|
||||
KEY_GAS_PHASE_MODIFY,
|
||||
KEY_KINETICS_MODIFY,
|
||||
KEY_DELETE,
|
||||
KEY_RUN_CELLS,
|
||||
KEY_REACTION_MODIFY,
|
||||
KEY_REACTION_TEMPERATURE_MODIFY,
|
||||
KEY_SOLID_SOLUTION_MODIFY,
|
||||
KEY_REACTION_PRESSURE,
|
||||
KEY_REACTION_PRESSURE_RAW,
|
||||
KEY_REACTION_PRESSURE_MODIFY,
|
||||
KEY_COUNT_KEYWORDS // must be last in list
|
||||
};
|
||||
public:
|
||||
//
|
||||
// Phreeqc class methods
|
||||
//
|
||||
static Phreeqc::KEYWORDS Keyword_search(std::string key);
|
||||
static const std::string & Phreeqc::Keyword_name_search(Phreeqc::KEYWORDS key);
|
||||
|
||||
// advection.cpp -------------------------------
|
||||
int advection(void);
|
||||
@ -1581,16 +1657,13 @@ protected:
|
||||
int advection_warnings;
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* Keywords
|
||||
* Tidy data
|
||||
*---------------------------------------------------------------------- */
|
||||
struct const_key *keyword;
|
||||
int NKEYS;
|
||||
|
||||
struct key *keyword_hash;
|
||||
int new_model, new_exchange, new_pp_assemblage, new_surface,
|
||||
new_reaction, new_temperature, new_mix, new_solution, new_gas_phase,
|
||||
new_inverse, new_punch, new_s_s_assemblage, new_kinetics, new_copy,
|
||||
new_pitzer;
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* Elements
|
||||
*---------------------------------------------------------------------- */
|
||||
@ -1747,7 +1820,7 @@ protected:
|
||||
|
||||
int input_error;
|
||||
|
||||
int next_keyword;
|
||||
KEYWORDS next_keyword;
|
||||
int parse_error;
|
||||
int paren_count;
|
||||
int iterations;
|
||||
@ -1808,7 +1881,6 @@ protected:
|
||||
HashTable *elements_hash_table;
|
||||
HashTable *species_hash_table;
|
||||
HashTable *phases_hash_table;
|
||||
HashTable *keyword_hash_table;
|
||||
HashTable *logk_hash_table;
|
||||
HashTable *master_isotope_hash_table;
|
||||
|
||||
@ -2068,6 +2140,10 @@ public:
|
||||
friend class PBasic;
|
||||
friend class ChartObject;
|
||||
|
||||
std::vector<int> keycount; // used to mark keywords that have been read
|
||||
static std::map<const std::string, KEYWORDS> phreeqc_keywords;
|
||||
static std::map<Phreeqc::KEYWORDS, const std::string> phreeqc_keyword_names;
|
||||
|
||||
#endif /* _INC_PHREEQC_H */
|
||||
|
||||
/*********************************
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user