From 6a49d41253c7705c0273262d0290389b18643d32 Mon Sep 17 00:00:00 2001 From: David Parkhurst Date: Mon, 28 Oct 2019 18:21:57 -0600 Subject: [PATCH] changes to make related and mixing items independent of case. surface_mix test case. --- ExchComp.cxx | 6 ++++-- Exchange.cxx | 2 +- PPassemblage.cxx | 2 +- SS.cxx | 2 +- SSassemblage.cxx | 2 +- Serializer.cxx | 6 +++--- StorageBin.cxx | 4 ++-- Surface.cxx | 4 ++-- SurfaceComp.cxx | 6 ++++-- cxxKinetics.cxx | 2 +- kinetics.cpp | 6 +++--- mainsubs.cpp | 2 +- read.cpp | 13 +++++++------ transport.cpp | 2 +- 14 files changed, 32 insertions(+), 27 deletions(-) diff --git a/ExchComp.cxx b/ExchComp.cxx index 5af520b7..dba46b3d 100644 --- a/ExchComp.cxx +++ b/ExchComp.cxx @@ -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 << diff --git a/Exchange.cxx b/Exchange.cxx index 117123dd..c1192df9 100644 --- a/Exchange.cxx +++ b/Exchange.cxx @@ -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); } diff --git a/PPassemblage.cxx b/PPassemblage.cxx index 9af480db..3536dc51 100644 --- a/PPassemblage.cxx +++ b/PPassemblage.cxx @@ -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; diff --git a/SS.cxx b/SS.cxx index 2ed2edc6..a40e577f 100644 --- a/SS.cxx +++ b/SS.cxx @@ -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); } diff --git a/SSassemblage.cxx b/SSassemblage.cxx index 471127bb..ef945efa 100644 --- a/SSassemblage.cxx +++ b/SSassemblage.cxx @@ -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; diff --git a/Serializer.cxx b/Serializer.cxx index 4b67baeb..7b05d817 100644 --- a/Serializer.cxx +++ b/Serializer.cxx @@ -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; diff --git a/StorageBin.cxx b/StorageBin.cxx index 24e698d0..cf4d5c56 100644 --- a/StorageBin.cxx +++ b/StorageBin.cxx @@ -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(); diff --git a/Surface.cxx b/Surface.cxx index 99a986de..fdbc122a 100644 --- a/Surface.cxx +++ b/Surface.cxx @@ -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); } diff --git a/SurfaceComp.cxx b/SurfaceComp.cxx index b2963e71..8ef1669c 100644 --- a/SurfaceComp.cxx +++ b/SurfaceComp.cxx @@ -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 << diff --git a/cxxKinetics.cxx b/cxxKinetics.cxx index 17ad6626..be640cae 100644 --- a/cxxKinetics.cxx +++ b/cxxKinetics.cxx @@ -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); } diff --git a/kinetics.cpp b/kinetics.cpp index f7727cc4..6396a192 100644 --- a/kinetics.cpp +++ b/kinetics.cpp @@ -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(); diff --git a/mainsubs.cpp b/mainsubs.cpp index 5774a6ee..8b72bcb9 100644 --- a/mainsubs.cpp +++ b/mainsubs.cpp @@ -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); diff --git a/read.cpp b/read.cpp index 9d6f7043..6b7843b3 100644 --- a/read.cpp +++ b/read.cpp @@ -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 */ diff --git a/transport.cpp b/transport.cpp index 05708c58..3eda7432 100644 --- a/transport.cpp +++ b/transport.cpp @@ -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");