changes to make related and mixing items independent of case. surface_mix test case.

This commit is contained in:
David Parkhurst 2019-10-28 18:21:57 -06:00
parent 8089c10273
commit 6a49d41253
14 changed files with 32 additions and 27 deletions

View File

@ -360,7 +360,8 @@ cxxExchComp::add(const cxxExchComp & addee, LDBLE extensive)
this->la = f1 * this->la + f2 * addee.la;
this->charge_balance += addee.charge_balance * extensive;
if (this->phase_name != addee.phase_name)
//if (this->phase_name != addee.phase_name)
if (Phreeqc::strcmp_nocase(this->phase_name.c_str(), addee.phase_name.c_str()) != 0)
{
std::ostringstream oss;
oss <<
@ -374,7 +375,8 @@ cxxExchComp::add(const cxxExchComp & addee, LDBLE extensive)
this->phase_proportion =
this->phase_proportion * f1 + addee.phase_proportion * f2;
}
if (this->rate_name != addee.rate_name)
//if (this->rate_name != addee.rate_name)
if (Phreeqc::strcmp_nocase(this->rate_name.c_str(), addee.rate_name.c_str()) != 0)
{
std::ostringstream oss;
oss <<

View File

@ -467,7 +467,7 @@ cxxExchange::Deserialize(Dictionary & dictionary, std::vector < int >&ints, std:
this->exchange_comps.clear();
for (int n = 0; n < count; n++)
{
cxxExchComp ec;
cxxExchComp ec(this->io);
ec.Deserialize(dictionary, ints, doubles, ii, dd);
this->exchange_comps.push_back(ec);
}

View File

@ -373,7 +373,7 @@ cxxPPassemblage::Deserialize(Dictionary & dictionary, std::vector < int >&ints,
this->pp_assemblage_comps.clear();
for (int n = 0; n < count; n++)
{
cxxPPassemblageComp ppc;
cxxPPassemblageComp ppc(this->io);
ppc.Deserialize(dictionary, ints, doubles, ii, dd);
std::string str(ppc.Get_name());
this->pp_assemblage_comps[str] = ppc;

2
SS.cxx
View File

@ -580,7 +580,7 @@ cxxSS::Deserialize(Dictionary & dictionary, std::vector < int >&ints,
this->ss_comps.clear();
for (int i = 0; i < count; i++)
{
cxxSScomp ssc;
cxxSScomp ssc(this->io);
ssc.Deserialize(dictionary, ints, doubles, ii, dd);
this->ss_comps.push_back(ssc);
}

View File

@ -319,7 +319,7 @@ cxxSSassemblage::Deserialize(Dictionary & dictionary, std::vector < int >&ints,
this->SSs.clear();
for (int n = 0; n < count; n++)
{
cxxSS ssc;
cxxSS ssc(this->io);
ssc.Deserialize(dictionary, ints, doubles, ii, dd);
std::string str(ssc.Get_name());
this->SSs[str] = ssc;

View File

@ -133,7 +133,7 @@ Serializer::Deserialize(Phreeqc &phreeqc_ref, Dictionary &dictionary, std::vecto
break;
case PT_GASPHASE:
{
cxxGasPhase entity;
cxxGasPhase entity(phreeqc_ref.Get_phrq_io());
entity.Deserialize(dictionary, ints, doubles, ii, dd);
int n_user = entity.Get_n_user();
phreeqc_ref.Get_Rxn_gas_phase_map()[n_user] = entity;
@ -141,7 +141,7 @@ Serializer::Deserialize(Phreeqc &phreeqc_ref, Dictionary &dictionary, std::vecto
break;
case PT_KINETICS:
{
cxxKinetics entity;
cxxKinetics entity(phreeqc_ref.Get_phrq_io());
entity.Deserialize(dictionary, ints, doubles, ii, dd);
int n_user = entity.Get_n_user();
phreeqc_ref.Get_Rxn_kinetics_map()[n_user] = entity;
@ -158,7 +158,7 @@ Serializer::Deserialize(Phreeqc &phreeqc_ref, Dictionary &dictionary, std::vecto
break;
case PT_SSASSEMBLAGE:
{
cxxSSassemblage entity;
cxxSSassemblage entity(phreeqc_ref.Get_phrq_io());
entity.Deserialize(dictionary, ints, doubles, ii, dd);
int n_user = entity.Get_n_user();
phreeqc_ref.Get_Rxn_ss_assemblage_map()[n_user] = entity;

View File

@ -1061,7 +1061,7 @@ cxxStorageBin::read_raw(CParser & parser)
break;
case Keywords::KEY_SOLID_SOLUTIONS_RAW:
{
cxxSSassemblage entity;
cxxSSassemblage entity(this->Get_io());
entity.read_raw(parser);
SSassemblages[entity.Get_n_user()] = entity;
}
@ -1195,7 +1195,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
case Keywords::KEY_SOLID_SOLUTIONS_RAW:
{
cxxSSassemblage entity;
cxxSSassemblage entity(this->Get_io());
entity.read_raw(parser);
SSassemblages[entity.Get_n_user()] = entity;
entity_number = entity.Get_n_user();

View File

@ -812,7 +812,7 @@ cxxSurface::Deserialize(Dictionary & dictionary, std::vector < int >&ints,
this->surface_comps.clear();
for (int n = 0; n < count; n++)
{
cxxSurfaceComp sc;
cxxSurfaceComp sc(this->io);
sc.Deserialize(dictionary, ints, doubles, ii, dd);
this->surface_comps.push_back(sc);
}
@ -822,7 +822,7 @@ cxxSurface::Deserialize(Dictionary & dictionary, std::vector < int >&ints,
this->surface_charges.clear();
for (int n = 0; n < count; n++)
{
cxxSurfaceCharge sc;
cxxSurfaceCharge sc(this->io);
sc.Deserialize(dictionary, ints, doubles, ii, dd);
this->surface_charges.push_back(sc);
}

View File

@ -395,7 +395,8 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, LDBLE extensive)
this->totals.add_extensive(addee.totals, extensive);
this->la = f1 * this->la + f2 * addee.la;
this->charge_balance += addee.charge_balance * extensive;
if (this->phase_name != addee.phase_name)
//if (this->phase_name != addee.phase_name)
if (Phreeqc::strcmp_nocase(this->phase_name.c_str(),addee.phase_name.c_str()) != 0)
{
std::ostringstream oss;
oss <<
@ -410,7 +411,8 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, LDBLE extensive)
this->phase_proportion * f1 + addee.phase_proportion * f2;
}
if (this->rate_name != addee.rate_name)
//if (this->rate_name != addee.rate_name)
if (Phreeqc::strcmp_nocase(this->rate_name.c_str(), addee.rate_name.c_str()) != 0)
{
std::ostringstream oss;
oss <<

View File

@ -605,7 +605,7 @@ cxxKinetics::Deserialize(Dictionary & dictionary, std::vector < int >&ints,
this->kinetics_comps.clear();
for (int i = 0; i < n; i++)
{
cxxKineticsComp kc;
cxxKineticsComp kc(this->io);
kc.Deserialize(dictionary, ints, doubles, ii, dd);
this->kinetics_comps.push_back(kc);
}

View File

@ -1511,11 +1511,11 @@ restart:
}
if (j == 14)
{
cxxStorageBin error_bin;
cxxStorageBin error_bin(this->Get_phrq_io());
Use2cxxStorageBin(error_bin);
std::ostringstream error_input;
error_bin.dump_raw(error_input, 0);
cxxStorageBin reread;
cxxStorageBin reread(this->Get_phrq_io());
std::istringstream is(error_input.str());
CParser cp(is);
cp.set_echo_stream(CParser::EO_NONE);
@ -1574,7 +1574,7 @@ restart:
* write to error.inp what failed to converge.
*/
std::ofstream error_input("error.inp");
cxxStorageBin error_bin;
cxxStorageBin error_bin(this->Get_phrq_io());
Use2cxxStorageBin(error_bin);
error_bin.dump_raw(error_input, 0);
error_input.close();

View File

@ -1396,7 +1396,7 @@ xss_assemblage_save(int n_user)
* Save ss_assemblage composition into structure ss_assemblage with user
* number n_user.
*/
cxxSSassemblage temp_ss_assemblage;
cxxSSassemblage temp_ss_assemblage(this->phrq_io);
if (use.Get_ss_assemblage_ptr() == NULL)
return (OK);

View File

@ -1007,7 +1007,7 @@ read_exchange(void)
input_error++;
break;
}
cxxExchComp temp_comp;
cxxExchComp temp_comp(this->phrq_io);
temp_exchange.Get_exchange_comps().push_back(temp_comp);
comp_ptr = &(temp_exchange.Get_exchange_comps().back());
comp_ptr->Set_formula(token.c_str());
@ -1268,7 +1268,7 @@ read_gas_phase(void)
char *ptr;
char *description;
char token[MAX_LENGTH];
cxxGasPhase temp_gas_phase;
cxxGasPhase temp_gas_phase(this->phrq_io);
int return_value, opt;
char *next_char;
const char *opt_list[] = {
@ -2057,7 +2057,7 @@ read_kinetics(void)
*/
ptr = line;
read_number_description(ptr, &n_user, &n_user_end, &description);
cxxKinetics temp_kinetics;
cxxKinetics temp_kinetics(this->phrq_io);
temp_kinetics.Set_n_user(n_user);
temp_kinetics.Set_n_user_end(n_user_end);
temp_kinetics.Set_description(description);
@ -7538,7 +7538,8 @@ read_surface(void)
break;
}
cxxSurfaceComp temp_comp;
cxxSurfaceComp temp_comp(this->phrq_io);
temp_surface.Get_surface_comps().push_back(temp_comp);
comp_ptr = &(temp_surface.Get_surface_comps().back());
comp_ptr->Set_formula(token.c_str());
@ -7648,7 +7649,7 @@ read_surface(void)
formula = (char*)free_check_null(formula);
if (charge_ptr == NULL)
{
cxxSurfaceCharge temp_charge;
cxxSurfaceCharge temp_charge(this->phrq_io);
temp_charge.Set_name(name);
if (comp_ptr->Get_phase_name().size() == 0
&& comp_ptr->Get_rate_name().size() == 0)
@ -10125,7 +10126,7 @@ read_solid_solutions(void)
case 0: /* component */
case 1: /* comp */
{
cxxSScomp comp;
cxxSScomp comp(this->phrq_io);
/*
* Read phase name of component
*/

View File

@ -1840,7 +1840,7 @@ set_initial_moles(int i)
temp_exchange.Set_solution_equilibria(true);
temp_exchange.Set_n_solution(i);
cxxExchComp comp;
cxxExchComp comp(this->phrq_io);
count_elts = 0;
paren_count = 0;
strcpy(token, "X");