mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Saved list of newly read entities (including _raw and _modify).
Limit checking to new versions. Limit loop to new for initial calculations (solution, exchange, surface, gas phase). git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@7218 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
c0a8627fbe
commit
c2f8b3bb42
@ -205,7 +205,8 @@ cxxExchange::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read exchange number and description
|
||||
this->read_number_description(parser);
|
||||
this->Set_new_def(true);
|
||||
this->Set_new_def(false);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
bool pitzer_exchange_gammas_defined(false);
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ cxxPPassemblage::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read PPassemblage number and description
|
||||
this->read_number_description(parser);
|
||||
this->Set_new_def(true);
|
||||
this->Set_new_def(false);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
|
||||
|
||||
23
Phreeqc.h
23
Phreeqc.h
@ -1211,6 +1211,20 @@ protected:
|
||||
std::map<int, cxxMix> Rxn_pp_assemblage_mix_map;
|
||||
std::map<int, cxxMix> Rxn_ss_assemblage_mix_map;
|
||||
std::map<int, cxxMix> Rxn_surface_mix_map;
|
||||
/*
|
||||
* List new definitions
|
||||
*/
|
||||
std::vector<int> Rxn_new_exchange;
|
||||
std::vector<int> Rxn_new_gas_phase;
|
||||
std::vector<int> Rxn_new_kinetics; // not used
|
||||
std::vector<int> Rxn_new_mix; // not used
|
||||
std::vector<int> Rxn_new_pp_assemblage;
|
||||
std::vector<int> Rxn_new_pressure; // not used
|
||||
std::vector<int> Rxn_new_reaction; // not used
|
||||
std::vector<int> Rxn_new_solution;
|
||||
std::vector<int> Rxn_new_ss_assemblage;
|
||||
std::vector<int> Rxn_new_surface;
|
||||
std::vector<int> Rxn_new_temperature; // not used
|
||||
/*----------------------------------------------------------------------
|
||||
* Irreversible reaction
|
||||
*---------------------------------------------------------------------- */
|
||||
@ -1980,7 +1994,7 @@ namespace Utilities
|
||||
}
|
||||
}
|
||||
template < typename T >
|
||||
int Rxn_read_raw(std::map < int, T > &m, Phreeqc * phreeqc_cookie)
|
||||
int Rxn_read_raw(std::map < int, T > &m, std::vector < int > &v, Phreeqc * phreeqc_cookie)
|
||||
{
|
||||
typename std::map < int, T >::iterator it;
|
||||
assert(!phreeqc_cookie->reading_database());
|
||||
@ -1998,11 +2012,15 @@ namespace Utilities
|
||||
|
||||
// Make copies if necessary
|
||||
Utilities::Rxn_copies(m, entity.Get_n_user(), entity.Get_n_user_end());
|
||||
for (int i = entity.Get_n_user(); i <= entity.Get_n_user_end(); i++)
|
||||
{
|
||||
v.push_back(i);
|
||||
}
|
||||
return phreeqc_cookie->cleanup_after_parser(parser);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
int Rxn_read_modify(std::map < int, T > &m, Phreeqc * phreeqc_cookie)
|
||||
int Rxn_read_modify(std::map < int, T > &m, std::vector < int > &v, Phreeqc * phreeqc_cookie)
|
||||
{
|
||||
typename std::map < int, T >::iterator it;
|
||||
|
||||
@ -2024,6 +2042,7 @@ namespace Utilities
|
||||
}
|
||||
|
||||
entity_ptr->read_raw(parser, false);
|
||||
v.push_back(entity_ptr->Get_n_user());
|
||||
|
||||
return phreeqc_cookie->cleanup_after_parser(parser);
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ cxxSSassemblage::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read SSassemblage number and description
|
||||
this->read_number_description(parser);
|
||||
this->Set_new_def(true);
|
||||
this->Set_new_def(false);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
|
||||
|
||||
@ -304,7 +304,7 @@ cxxSolution::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read solution number and description
|
||||
this->read_number_description(parser.line());
|
||||
this->Set_new_def(true);
|
||||
this->Set_new_def(false);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
bool tc_defined(false);
|
||||
|
||||
@ -1278,9 +1278,12 @@ initial_solutions(int print)
|
||||
set_use();
|
||||
print1 = TRUE;
|
||||
dl_type_x = cxxSurface::NO_DL;
|
||||
std::map<int, cxxSolution>::iterator it = Rxn_solution_map.begin();
|
||||
for ( ; it != Rxn_solution_map.end(); it++)
|
||||
//std::map<int, cxxSolution>::iterator it = Rxn_solution_map.begin();
|
||||
//for ( ; it != Rxn_solution_map.end(); it++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_solution.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxSolution>::iterator it = Rxn_solution_map.find(Rxn_new_solution[nn]);
|
||||
cxxSolution &solution_ref = it->second;
|
||||
initial_solution_isotopes = FALSE;
|
||||
if (solution_ref.Get_new_def())
|
||||
@ -1378,9 +1381,12 @@ initial_exchangers(int print)
|
||||
set_use();
|
||||
print1 = TRUE;
|
||||
dl_type_x = cxxSurface::NO_DL;
|
||||
std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
for ( ; it != Rxn_exchange_map.end(); it++)
|
||||
//std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
//for ( ; it != Rxn_exchange_map.end(); it++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_exchange.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.find(Rxn_new_exchange[nn]);
|
||||
if (!it->second.Get_new_def())
|
||||
continue;
|
||||
cxxExchange *exchange_ptr = &(it->second);
|
||||
@ -1458,9 +1464,12 @@ initial_gas_phases(int print)
|
||||
set_use();
|
||||
print1 = TRUE;
|
||||
dl_type_x = cxxSurface::NO_DL;
|
||||
std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.begin();
|
||||
for ( ; it != Rxn_gas_phase_map.end(); it++)
|
||||
//std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.begin();
|
||||
//for ( ; it != Rxn_gas_phase_map.end(); it++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_gas_phase.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.find(Rxn_new_gas_phase[nn]);
|
||||
cxxGasPhase *gas_phase_ptr = &it->second;
|
||||
if (!gas_phase_ptr->Get_new_def())
|
||||
continue;
|
||||
@ -1568,9 +1577,12 @@ initial_surfaces(int print)
|
||||
set_use();
|
||||
print1 = TRUE;
|
||||
|
||||
std::map<int, cxxSurface>::iterator it = Rxn_surface_map.begin();
|
||||
for ( ; it != Rxn_surface_map.end(); it++)
|
||||
//std::map<int, cxxSurface>::iterator it = Rxn_surface_map.begin();
|
||||
//for ( ; it != Rxn_surface_map.end(); it++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_surface.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxSurface>::iterator it = Rxn_surface_map.find(Rxn_new_surface[nn]);
|
||||
cxxSurface * surface_ptr = &it->second;
|
||||
if (!surface_ptr->Get_new_def())
|
||||
continue;
|
||||
|
||||
@ -3311,6 +3311,17 @@ setup_exchange(void)
|
||||
for (size_t j = 0; j < use.Get_exchange_ptr()->Get_exchange_comps().size(); j++)
|
||||
{
|
||||
cxxExchComp & comp_ref = use.Get_exchange_ptr()->Get_exchange_comps()[j];
|
||||
{
|
||||
element * elt_ptr = element_store(comp_ref.Get_formula().c_str());
|
||||
if (elt_ptr == NULL || elt_ptr->master == NULL)
|
||||
{
|
||||
error_string = sformatf( "Component not in database, %s", comp_ref.Get_formula().c_str());
|
||||
input_error++;
|
||||
error_msg(error_string, CONTINUE);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
cxxNameDouble nd(comp_ref.Get_totals());
|
||||
cxxNameDouble::iterator it = nd.begin();
|
||||
for ( ; it != nd.end(); it++)
|
||||
@ -3321,8 +3332,8 @@ setup_exchange(void)
|
||||
element * elt_ptr = element_store(it->first.c_str());
|
||||
if (elt_ptr == NULL || elt_ptr->master == NULL)
|
||||
{
|
||||
error_string = sformatf( "Master species not in data "
|
||||
"base for %s, skipping element.",
|
||||
error_string = sformatf( "Master species not in database "
|
||||
"for %s, skipping element.",
|
||||
it->first.c_str());
|
||||
input_error++;
|
||||
error_msg(error_string, CONTINUE);
|
||||
@ -3535,7 +3546,7 @@ setup_surface(void)
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Master species not in data base for %s, skipping element.",
|
||||
"Master species not in database for %s, skipping element.",
|
||||
elt_ptr->name);
|
||||
warning_msg(error_string);
|
||||
continue;
|
||||
@ -3600,6 +3611,12 @@ setup_surface(void)
|
||||
*/
|
||||
cxxSurfaceCharge *charge_ptr = use.Get_surface_ptr()->
|
||||
Find_charge(comp_ptr->Get_charge_name());
|
||||
if (charge_ptr == NULL)
|
||||
{
|
||||
input_error++;
|
||||
error_msg(sformatf("Charge structure not defined for surface, %s", use.Get_surface_ptr()->Get_description().c_str()), CONTINUE);
|
||||
continue;
|
||||
}
|
||||
x[count_unknowns]->type = SURFACE_CB;
|
||||
x[count_unknowns]->surface_charge = string_hsave(charge_ptr->Get_name().c_str());
|
||||
x[count_unknowns]->related_moles = charge_ptr->Get_grams();
|
||||
@ -4371,7 +4388,7 @@ setup_solution(void)
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Master species not in data base for %s, skipping element.",
|
||||
"Master species not in database for %s, skipping element.",
|
||||
it->first.c_str());
|
||||
warning_msg(error_string);
|
||||
free_check_null(temp_desc);
|
||||
|
||||
@ -31,6 +31,18 @@ read_input(void)
|
||||
input_error = 0;
|
||||
next_keyword = Keywords::KEY_NONE;
|
||||
count_warnings = 0;
|
||||
|
||||
Rxn_new_exchange.clear();
|
||||
Rxn_new_gas_phase.clear();
|
||||
Rxn_new_kinetics.clear(); // not used
|
||||
Rxn_new_mix.clear(); // not used
|
||||
Rxn_new_pp_assemblage.clear();
|
||||
Rxn_new_pressure.clear(); // not used
|
||||
Rxn_new_reaction.clear(); // not used
|
||||
Rxn_new_solution.clear();
|
||||
Rxn_new_ss_assemblage.clear();
|
||||
Rxn_new_surface.clear();
|
||||
Rxn_new_temperature.clear(); // not used
|
||||
/*
|
||||
* Initialize keyword counters
|
||||
*/
|
||||
@ -279,58 +291,58 @@ read_input(void)
|
||||
read_sit();
|
||||
break;
|
||||
case Keywords::KEY_SOLUTION_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_solution_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_solution_map, Rxn_new_solution, this);
|
||||
break;
|
||||
case Keywords::KEY_EXCHANGE_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_exchange_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_exchange_map, Rxn_new_exchange, this);
|
||||
break;
|
||||
case Keywords::KEY_SURFACE_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_surface_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_surface_map, Rxn_new_surface, this);
|
||||
break;
|
||||
case Keywords::KEY_EQUILIBRIUM_PHASES_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_pp_assemblage_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_pp_assemblage_map, Rxn_new_pp_assemblage, this);
|
||||
break;
|
||||
case Keywords::KEY_KINETICS_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_kinetics_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_kinetics_map, Rxn_new_kinetics, this);
|
||||
break;
|
||||
case Keywords::KEY_SOLID_SOLUTIONS_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_ss_assemblage_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_ss_assemblage_map, Rxn_new_ss_assemblage, this);
|
||||
break;
|
||||
case Keywords::KEY_GAS_PHASE_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_gas_phase_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_gas_phase_map, Rxn_new_gas_phase, this);
|
||||
break;
|
||||
case Keywords::KEY_REACTION_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_reaction_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_reaction_map, Rxn_new_reaction, this);
|
||||
break;
|
||||
case Keywords::KEY_MIX_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_mix_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_mix_map, Rxn_new_mix, this);
|
||||
break;
|
||||
case Keywords::KEY_REACTION_TEMPERATURE_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_temperature_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_temperature_map, Rxn_new_temperature, this);
|
||||
break;
|
||||
case Keywords::KEY_DUMP:
|
||||
read_dump();
|
||||
break;
|
||||
case Keywords::KEY_SOLUTION_MODIFY:
|
||||
Utilities::Rxn_read_modify(Rxn_solution_map, this);
|
||||
Utilities::Rxn_read_modify(Rxn_solution_map, Rxn_new_solution, this);
|
||||
break;
|
||||
case Keywords::KEY_EQUILIBRIUM_PHASES_MODIFY:
|
||||
Utilities::Rxn_read_modify(Rxn_pp_assemblage_map, this);
|
||||
Utilities::Rxn_read_modify(Rxn_pp_assemblage_map, Rxn_new_pp_assemblage, this);
|
||||
break;
|
||||
case Keywords::KEY_EXCHANGE_MODIFY:
|
||||
Utilities::Rxn_read_modify(Rxn_exchange_map, this);
|
||||
Utilities::Rxn_read_modify(Rxn_exchange_map, Rxn_new_exchange, this);
|
||||
break;
|
||||
case Keywords::KEY_SURFACE_MODIFY:
|
||||
Utilities::Rxn_read_modify(Rxn_surface_map, this);
|
||||
Utilities::Rxn_read_modify(Rxn_surface_map, Rxn_new_surface, this);
|
||||
break;
|
||||
case Keywords::KEY_SOLID_SOLUTIONS_MODIFY:
|
||||
Utilities::Rxn_read_modify(Rxn_ss_assemblage_map, this);
|
||||
Utilities::Rxn_read_modify(Rxn_ss_assemblage_map, Rxn_new_ss_assemblage, this);
|
||||
break;
|
||||
case Keywords::KEY_GAS_PHASE_MODIFY:
|
||||
Utilities::Rxn_read_modify(Rxn_gas_phase_map, this);
|
||||
Utilities::Rxn_read_modify(Rxn_gas_phase_map, Rxn_new_gas_phase, this);
|
||||
break;
|
||||
case Keywords::KEY_KINETICS_MODIFY:
|
||||
Utilities::Rxn_read_modify(Rxn_kinetics_map, this);
|
||||
Utilities::Rxn_read_modify(Rxn_kinetics_map, Rxn_new_kinetics, this);
|
||||
break;
|
||||
case Keywords::KEY_DELETE:
|
||||
read_delete();
|
||||
@ -339,7 +351,7 @@ read_input(void)
|
||||
read_run_cells();
|
||||
break;
|
||||
case Keywords::KEY_REACTION_MODIFY:
|
||||
Utilities::Rxn_read_modify(Rxn_reaction_map, this);
|
||||
Utilities::Rxn_read_modify(Rxn_reaction_map, Rxn_new_reaction, this);
|
||||
break;
|
||||
//case LAST_C_KEYWORD + 22: //reaction_temperature_modify
|
||||
// keyword[LAST_C_KEYWORD + 22].keycount++;
|
||||
@ -349,7 +361,7 @@ read_input(void)
|
||||
read_reaction_pressure();
|
||||
break;
|
||||
case Keywords::KEY_REACTION_PRESSURE_RAW:
|
||||
Utilities::Rxn_read_raw(Rxn_pressure_map, this);
|
||||
Utilities::Rxn_read_raw(Rxn_pressure_map, Rxn_new_pressure, this);
|
||||
break;
|
||||
default:
|
||||
error_msg("Error in keyword switch", STOP);
|
||||
@ -1098,6 +1110,7 @@ read_exchange(void)
|
||||
break;
|
||||
}
|
||||
Rxn_exchange_map[n_user] = temp_exchange;
|
||||
Rxn_new_exchange.push_back(n_user);
|
||||
return (return_value);
|
||||
}
|
||||
|
||||
@ -1390,7 +1403,7 @@ read_gas_phase(void)
|
||||
|
||||
|
||||
Rxn_gas_phase_map[n_user] = temp_gas_phase;
|
||||
|
||||
Rxn_new_gas_phase.push_back(n_user);
|
||||
return (return_value);
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -4191,7 +4204,7 @@ read_pp_assemblage(void)
|
||||
}
|
||||
temp_pp_assemblage.Set_pp_assemblage_comps(comps);
|
||||
Rxn_pp_assemblage_map[n_user] = temp_pp_assemblage;
|
||||
|
||||
Rxn_new_pp_assemblage.push_back(n_user);
|
||||
return (return_value);
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -5356,7 +5369,7 @@ read_solution(void)
|
||||
}
|
||||
}
|
||||
Rxn_solution_map[n_user] = temp_solution;
|
||||
|
||||
Rxn_new_solution.push_back(n_user);
|
||||
return (return_value);
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -7132,6 +7145,7 @@ read_surface(void)
|
||||
}
|
||||
temp_surface.Sort_comps();
|
||||
Rxn_surface_map[n_user] = temp_surface;
|
||||
Rxn_new_surface.push_back(n_user);
|
||||
return (return_value);
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -9660,8 +9674,14 @@ read_solid_solutions(void)
|
||||
comps.insert(comps.begin(), *comp1_ptr);
|
||||
if (comp0_ptr)
|
||||
comps.insert(comps.begin(), *comp0_ptr);
|
||||
ss_ptr->Set_ss_comps(comps);
|
||||
temp_ss_assemblage.Get_SSs()[ss_ptr->Get_name()] = *ss_ptr;
|
||||
if (ss_ptr != NULL && comps.size() > 0)
|
||||
{
|
||||
ss_ptr->Set_ss_comps(comps);
|
||||
}
|
||||
if (ss_ptr != NULL && ss_ptr->Get_name().size() > 0)
|
||||
{
|
||||
temp_ss_assemblage.Get_SSs()[ss_ptr->Get_name()] = *ss_ptr;
|
||||
}
|
||||
delete ss_ptr;
|
||||
ss_ptr = NULL;
|
||||
comps.clear();
|
||||
@ -9689,7 +9709,7 @@ read_solid_solutions(void)
|
||||
|
||||
// Add to map
|
||||
Rxn_ss_assemblage_map[n_user] = temp_ss_assemblage;
|
||||
|
||||
Rxn_new_ss_assemblage.push_back(n_user);
|
||||
return (return_value);
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -373,7 +373,15 @@ add_solution(cxxSolution *solution_ptr, LDBLE extensive, LDBLE intensive)
|
||||
for ( ; jit != solution_ptr->Get_totals().end(); jit++)
|
||||
{
|
||||
master_ptr = master_bsearch_primary(jit->first.c_str());
|
||||
master_ptr->total += jit->second * extensive;
|
||||
if (master_ptr != NULL)
|
||||
{
|
||||
master_ptr->total += jit->second * extensive;
|
||||
}
|
||||
else
|
||||
{
|
||||
input_error++;
|
||||
error_msg(sformatf("Undefined element in solution, %s\n", jit->first.c_str()), CONTINUE);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Accumulate initial guesses for activities
|
||||
@ -495,6 +503,10 @@ add_surface(cxxSurface *surface_ptr)
|
||||
{
|
||||
cxxSurfaceComp *comp_ptr = &(surface_ptr->Get_surface_comps()[i]);
|
||||
struct element *elt_ptr = element_store(comp_ptr->Get_master_element().c_str());
|
||||
if (elt_ptr->master == NULL)
|
||||
{
|
||||
error_msg(sformatf("Data not defined for master in SURFACE, %s\n", comp_ptr->Get_formula().c_str()), STOP);
|
||||
}
|
||||
struct master *master_i_ptr = elt_ptr->master;
|
||||
|
||||
if (surface_ptr->Get_type() == cxxSurface::NO_EDL)
|
||||
@ -1001,9 +1013,16 @@ add_gas_phase(cxxGasPhase *gas_phase_ptr)
|
||||
cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]);
|
||||
int k;
|
||||
struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE);
|
||||
assert(phase_ptr);
|
||||
|
||||
add_elt_list(phase_ptr->next_elt, gc_ptr->Get_moles());
|
||||
if (phase_ptr == NULL)
|
||||
{
|
||||
input_error++;
|
||||
error_msg(sformatf("PHASE not found in database, %s\n", gc_ptr->Get_phase_name().c_str()), CONTINUE);
|
||||
}
|
||||
//assert(phase_ptr);
|
||||
else
|
||||
{
|
||||
add_elt_list(phase_ptr->next_elt, gc_ptr->Get_moles());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Sort elements in reaction and combine
|
||||
|
||||
152
phreeqc/tidy.cpp
152
phreeqc/tidy.cpp
@ -888,12 +888,14 @@ tidy_gas_phase(void)
|
||||
/*
|
||||
* Find all gases for each gas_phase in phase list
|
||||
*/
|
||||
std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.begin();
|
||||
for ( ; it != Rxn_gas_phase_map.end(); it++)
|
||||
//std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.begin();
|
||||
//for ( ; it != Rxn_gas_phase_map.end(); it++)
|
||||
for (size_t nn = 0; nn < Rxn_new_gas_phase.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.find(Rxn_new_gas_phase[nn]);
|
||||
cxxGasPhase *gas_phase_ptr = &(it->second);
|
||||
if (gas_phase_ptr->Get_new_def() != TRUE)
|
||||
continue;
|
||||
//if (gas_phase_ptr->Get_new_def() != TRUE)
|
||||
// continue;
|
||||
gas_phase_ptr->Set_new_def(false);
|
||||
PR = false;
|
||||
P = 0.0;
|
||||
@ -906,7 +908,7 @@ tidy_gas_phase(void)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf(
|
||||
"Gas not found in PHASES data base, %s.",
|
||||
"Gas not found in PHASES database, %s.",
|
||||
gc[j].Get_phase_name().c_str());
|
||||
error_msg(error_string, CONTINUE);
|
||||
continue;
|
||||
@ -1500,12 +1502,15 @@ tidy_pp_assemblage(void)
|
||||
/*
|
||||
* Find pointers for pure phases
|
||||
*/
|
||||
std::map<int, cxxPPassemblage>::iterator it;
|
||||
it = Rxn_pp_assemblage_map.begin();
|
||||
for ( ; it != Rxn_pp_assemblage_map.end(); it++)
|
||||
//std::map<int, cxxPPassemblage>::iterator it;
|
||||
//it = Rxn_pp_assemblage_map.begin();
|
||||
//for ( ; it != Rxn_pp_assemblage_map.end(); it++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_pp_assemblage.size(); nn++)
|
||||
{
|
||||
if (!it->second.Get_new_def()) continue;
|
||||
cxxPPassemblage *pp_assemblage_ptr = &(it->second);
|
||||
std::map<int, cxxPPassemblage>::iterator kit = Rxn_pp_assemblage_map.find(Rxn_new_pp_assemblage[nn]);
|
||||
//if (!kit->second.Get_new_def()) continue;
|
||||
cxxPPassemblage *pp_assemblage_ptr = &(kit->second);
|
||||
count_elts = 0;
|
||||
paren_count = 0;
|
||||
coef = 1.0;
|
||||
@ -1520,7 +1525,7 @@ tidy_pp_assemblage(void)
|
||||
if (phase_ptr == NULL)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf( "Phase not found in data base, %s.",
|
||||
error_string = sformatf( "Phase not found in database, %s.",
|
||||
it->first.c_str());
|
||||
error_msg(error_string, CONTINUE);
|
||||
continue;
|
||||
@ -1588,10 +1593,13 @@ tidy_ss_assemblage(void)
|
||||
/*
|
||||
* Find pointers for pure phases
|
||||
*/
|
||||
std::map<int, cxxSSassemblage>::iterator it;
|
||||
for (it = Rxn_ss_assemblage_map.begin(); it != Rxn_ss_assemblage_map.end(); it++)
|
||||
//std::map<int, cxxSSassemblage>::iterator it;
|
||||
//for (it = Rxn_ss_assemblage_map.begin(); it != Rxn_ss_assemblage_map.end(); it++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_ss_assemblage.size(); nn++)
|
||||
{
|
||||
if (!it->second.Get_new_def()) continue;
|
||||
std::map<int, cxxSSassemblage>::iterator it = Rxn_ss_assemblage_map.find(Rxn_new_ss_assemblage[nn]);
|
||||
//if (!it->second.Get_new_def()) continue;
|
||||
count_elts = 0;
|
||||
paren_count = 0;
|
||||
cxxSSassemblage *ss_assemblage_ptr = &(it->second);
|
||||
@ -1608,7 +1616,7 @@ tidy_ss_assemblage(void)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf(
|
||||
"Phase not found in data base, %s, assemblage %d.",
|
||||
"Phase not found in database, %s, assemblage %d.",
|
||||
comp_ptr->Get_name().c_str(),
|
||||
ss_assemblage_ptr->Get_n_user());
|
||||
error_msg(error_string, CONTINUE);
|
||||
@ -2375,10 +2383,13 @@ tidy_surface(void)
|
||||
*/
|
||||
char *ptr1;
|
||||
cxxSurface *surface_ptr;
|
||||
std::map<int, cxxSurface>::iterator kit;
|
||||
for (kit = Rxn_surface_map.begin(); kit != Rxn_surface_map.end(); kit++)
|
||||
//std::map<int, cxxSurface>::iterator kit;
|
||||
//for (kit = Rxn_surface_map.begin(); kit != Rxn_surface_map.end(); kit++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_surface.size(); nn++)
|
||||
{
|
||||
if (!kit->second.Get_new_def()) continue;
|
||||
std::map<int, cxxSurface>::iterator kit = Rxn_surface_map.find(Rxn_new_surface[nn]);
|
||||
//if (!kit->second.Get_new_def()) continue;
|
||||
surface_ptr = &(kit->second);
|
||||
for (size_t i = 0; i < surface_ptr->Get_surface_comps().size(); i++)
|
||||
{
|
||||
@ -2395,7 +2406,7 @@ tidy_surface(void)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf(
|
||||
"Master species not in data base for %s, "
|
||||
"Master species not in database for %s, "
|
||||
"skipping element.",
|
||||
elt_ptr->name);
|
||||
error_msg(error_string, CONTINUE);
|
||||
@ -2533,17 +2544,20 @@ tidy_solutions(void)
|
||||
{
|
||||
unnumbered_solutions[i].Set_n_user_both(++last);
|
||||
Rxn_solution_map[last] = unnumbered_solutions[i];
|
||||
Rxn_new_solution.push_back(last);
|
||||
}
|
||||
unnumbered_solutions.clear();
|
||||
}
|
||||
/*
|
||||
* Check that elements are in database
|
||||
*/
|
||||
std::map<int, cxxSolution>::iterator it;
|
||||
for (it = Rxn_solution_map.begin(); it != Rxn_solution_map.end(); it++)
|
||||
//std::map<int, cxxSolution>::iterator it;
|
||||
//for (it = Rxn_solution_map.begin(); it != Rxn_solution_map.end(); it++)
|
||||
for(size_t n = 0; n < Rxn_new_solution.size(); n++)
|
||||
{
|
||||
std::map<int, cxxSolution>::iterator it = Rxn_solution_map.find(Rxn_new_solution[n]);
|
||||
cxxSolution &solution_ref = it->second;
|
||||
if (solution_ref.Get_new_def())
|
||||
//if (solution_ref.Get_new_def())
|
||||
{
|
||||
cxxISolution *initial_data_ptr = solution_ref.Get_initial_data();
|
||||
if (initial_data_ptr != NULL)
|
||||
@ -2834,14 +2848,16 @@ tidy_kin_exchange(void)
|
||||
char *ptr;
|
||||
LDBLE conc;
|
||||
|
||||
std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
for ( ; it != Rxn_exchange_map.end(); it++)
|
||||
//std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
//for ( ; it != Rxn_exchange_map.end(); it++)
|
||||
for (size_t nn = 0; nn < Rxn_new_exchange.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.find(Rxn_new_exchange[nn]);
|
||||
cxxExchange * exchange_ptr = &(it->second);
|
||||
if (!exchange_ptr->Get_new_def())
|
||||
continue;
|
||||
if (exchange_ptr->Get_n_user() < 0)
|
||||
continue;
|
||||
//if (!exchange_ptr->Get_new_def())
|
||||
// continue;
|
||||
//if (exchange_ptr->Get_n_user() < 0)
|
||||
// continue;
|
||||
// check elements
|
||||
for (size_t j = 0; j < exchange_ptr->Get_exchange_comps().size(); j++)
|
||||
{
|
||||
@ -2859,8 +2875,8 @@ tidy_kin_exchange(void)
|
||||
if (elt_ptr == NULL || elt_ptr->master == NULL)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf( "Master species not in data "
|
||||
"base for %s, skipping element.",
|
||||
error_string = sformatf( "Master species not in database "
|
||||
"for %s, skipping element.",
|
||||
elt_ptr->name);
|
||||
error_msg(error_string, CONTINUE);
|
||||
continue;
|
||||
@ -2943,14 +2959,17 @@ tidy_min_exchange(void)
|
||||
char *ptr;
|
||||
LDBLE conc;
|
||||
|
||||
std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
for ( ; it != Rxn_exchange_map.end(); it++)
|
||||
//std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
//for ( ; it != Rxn_exchange_map.end(); it++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_exchange.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.find(Rxn_new_exchange[nn]);
|
||||
cxxExchange * exchange_ptr = &(it->second);
|
||||
if (!exchange_ptr->Get_new_def())
|
||||
continue;
|
||||
if (exchange_ptr->Get_n_user() < 0)
|
||||
continue;
|
||||
//if (!exchange_ptr->Get_new_def())
|
||||
// continue;
|
||||
//if (exchange_ptr->Get_n_user() < 0)
|
||||
// continue;
|
||||
n = exchange_ptr->Get_n_user();
|
||||
// check elements
|
||||
for (size_t j = 0; j < exchange_ptr->Get_exchange_comps().size(); j++)
|
||||
@ -2969,8 +2988,8 @@ tidy_min_exchange(void)
|
||||
if (elt_ptr == NULL || elt_ptr->master == NULL)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf( "Master species not in data "
|
||||
"base for %s, skipping element.",
|
||||
error_string = sformatf( "Master species not in database "
|
||||
"for %s, skipping element.",
|
||||
kit->first.c_str());
|
||||
error_msg(error_string, CONTINUE);
|
||||
continue;
|
||||
@ -3082,14 +3101,17 @@ tidy_min_surface(void)
|
||||
* set in proportion
|
||||
*/
|
||||
{
|
||||
std::map<int, cxxSurface>::iterator kit;
|
||||
for (kit = Rxn_surface_map.begin(); kit != Rxn_surface_map.end(); kit++)
|
||||
//std::map<int, cxxSurface>::iterator kit;
|
||||
//for (kit = Rxn_surface_map.begin(); kit != Rxn_surface_map.end(); kit++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_surface.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxSurface>::iterator kit = Rxn_surface_map.find(Rxn_new_surface[nn]);
|
||||
cxxSurface *surface_ptr = &(kit->second);
|
||||
if (!surface_ptr->Get_new_def())
|
||||
continue;
|
||||
if (surface_ptr->Get_n_user() < 0)
|
||||
continue;
|
||||
//if (!surface_ptr->Get_new_def())
|
||||
// continue;
|
||||
//if (surface_ptr->Get_n_user() < 0)
|
||||
// continue;
|
||||
for (size_t j = 0; j < surface_ptr->Get_surface_comps().size(); j++)
|
||||
{
|
||||
cxxSurfaceComp *surface_comp_ptr = &(surface_ptr->Get_surface_comps()[j]);
|
||||
@ -3109,8 +3131,8 @@ tidy_min_surface(void)
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf( "Master species not in data "
|
||||
"base for %s, skipping element.",
|
||||
error_string = sformatf( "Master species not in database "
|
||||
"for %s, skipping element.",
|
||||
elt_ptr->name);
|
||||
error_msg(error_string, CONTINUE);
|
||||
continue;
|
||||
@ -3325,14 +3347,17 @@ tidy_kin_surface(void)
|
||||
struct elt_list *elt_list_kinetics;
|
||||
int count_elts_kinetics;
|
||||
|
||||
std::map<int, cxxSurface>::iterator it;
|
||||
for (it = Rxn_surface_map.begin(); it != Rxn_surface_map.end(); it++)
|
||||
//std::map<int, cxxSurface>::iterator it;
|
||||
//for (it = Rxn_surface_map.begin(); it != Rxn_surface_map.end(); it++)
|
||||
//{
|
||||
for (size_t nn = 0; nn < Rxn_new_surface.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxSurface>::iterator it = Rxn_surface_map.find(Rxn_new_surface[nn]);
|
||||
cxxSurface *surface_ptr = &(it->second);
|
||||
if (!surface_ptr->Get_new_def())
|
||||
continue;
|
||||
if (surface_ptr->Get_n_user() < 0)
|
||||
continue;
|
||||
//if (!surface_ptr->Get_new_def())
|
||||
// continue;
|
||||
//if (surface_ptr->Get_n_user() < 0)
|
||||
// continue;
|
||||
int n = surface_ptr->Get_n_user();
|
||||
for (size_t j = 0; j < surface_ptr->Get_surface_comps().size(); j++)
|
||||
{
|
||||
@ -3352,8 +3377,8 @@ tidy_kin_surface(void)
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf( "Master species not in data "
|
||||
"base for %s, skipping element.",
|
||||
error_string = sformatf( "Master species not in database "
|
||||
"for %s, skipping element.",
|
||||
elt_ptr->name);
|
||||
error_msg(error_string, CONTINUE);
|
||||
continue;
|
||||
@ -4679,14 +4704,17 @@ tidy_exchange(void)
|
||||
* set in proportion
|
||||
*/
|
||||
{
|
||||
std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
for ( ; it != Rxn_exchange_map.end(); it++)
|
||||
//std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
//for ( ; it != Rxn_exchange_map.end(); it++)
|
||||
for (size_t nn = 0; nn < Rxn_new_exchange.size(); nn++)
|
||||
{
|
||||
std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.find(Rxn_new_exchange[nn]);
|
||||
//std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
|
||||
cxxExchange * exchange_ptr = &(it->second);
|
||||
if (!exchange_ptr->Get_new_def())
|
||||
continue;
|
||||
if (exchange_ptr->Get_n_user() < 0)
|
||||
continue;
|
||||
//if (!exchange_ptr->Get_new_def())
|
||||
// continue;
|
||||
//if (exchange_ptr->Get_n_user() < 0)
|
||||
// continue;
|
||||
// check elements
|
||||
for (size_t j = 0; j < exchange_ptr->Get_exchange_comps().size(); j++)
|
||||
{
|
||||
@ -4706,8 +4734,8 @@ tidy_exchange(void)
|
||||
if (elt_ptr == NULL || elt_ptr->master == NULL)
|
||||
{
|
||||
input_error++;
|
||||
error_string = sformatf( "Master species not in data "
|
||||
"base for %s, skipping element.",
|
||||
error_string = sformatf( "Master species not in database "
|
||||
"for %s, skipping element.",
|
||||
kit->first.c_str());
|
||||
error_msg(error_string, CONTINUE);
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user