From 62a55134bec1aeb4daf3dacd80ac6837472d154d Mon Sep 17 00:00:00 2001 From: David L Parkhurst Date: Tue, 27 Sep 2011 21:18:38 +0000 Subject: [PATCH] Worked through solution removing PHREEQC_PTR_ARG. More cleaning up to do. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/branches/ErrorHandling@5653 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- Phreeqc.h | 11 ++++++++--- ReadClass.cxx | 6 ++++-- Solution.cxx | 7 +++++-- Solution.h | 9 +++++++-- SolutionIsotopeList.cxx | 2 ++ StorageBin.cxx | 6 ++++-- 6 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Phreeqc.h b/Phreeqc.h index 1a0ac2c9..f598c1e6 100644 --- a/Phreeqc.h +++ b/Phreeqc.h @@ -46,6 +46,8 @@ class cxxTemperature; class cxxPPassemblage; class cxxPPassemblageComp; class cxxReaction; +class cxxSolution; +class cxxSolutionIsotopeList; class Phreeqc { @@ -1244,9 +1246,7 @@ extern void MergeFinalize(void); struct mix * cxxMix2mix(cxxMix *mx); struct kinetics *cxxKinetics2kinetics(cxxKinetics * kin); -struct elt_list * cxxNameDouble2elt_list(const cxxNameDouble * nd); struct kinetics_comp * cxxKineticsComp2kinetics_comp(std::list < cxxKineticsComp > * el); -struct name_coef * cxxNameDouble2name_coef(const cxxNameDouble * nd); struct exchange * cxxExchange2exchange(cxxExchange * ex); struct exch_comp * cxxExchComp2exch_comp(const std::map < std::string, cxxExchComp > * el); struct master * Get_exch_master(const cxxExchComp * ec); @@ -1256,7 +1256,12 @@ struct temperature * cxxTemperature2temperature(const cxxTemperature *temp); struct pp_assemblage * cxxPPassemblage2pp_assemblage(const cxxPPassemblage * pp); struct pure_phase * cxxPPassemblageComp2pure_phase(const std::map < std::string, cxxPPassemblageComp > * ppc); struct irrev * cxxReaction2irrev(const cxxReaction * rxn); - +struct solution * cxxSolution2solution(const cxxSolution * sol); +struct isotope * cxxSolutionIsotopeList2isotope(const cxxSolutionIsotopeList * il); +struct conc * cxxNameDouble2conc(const cxxNameDouble *nd); +struct elt_list * cxxNameDouble2elt_list(const cxxNameDouble * nd); +struct name_coef * cxxNameDouble2name_coef(const cxxNameDouble * nd); +struct master_activity * cxxNameDouble2master_activity(const cxxNameDouble * nd); /* tally.c */ void add_all_components_tally(void); diff --git a/ReadClass.cxx b/ReadClass.cxx index 3f948746..47bb1569 100644 --- a/ReadClass.cxx +++ b/ReadClass.cxx @@ -112,7 +112,8 @@ read_solution_raw(void) cxxSolution sol(&phrq_io); sol.read_raw(parser); - struct solution *soln_ptr = sol.cxxSolution2solution(PHREEQC_THIS); + //struct solution *soln_ptr = sol.cxxSolution2solution(PHREEQC_THIS); + struct solution *soln_ptr = cxxSolution2solution(&sol); int n; /* @@ -1337,7 +1338,8 @@ read_solution_modify(void) sol.modify_activities(PHREEQC_THIS_COMMA orig); - struct solution *soln_ptr = sol.cxxSolution2solution(PHREEQC_THIS); + //struct solution *soln_ptr = sol.cxxSolution2solution(PHREEQC_THIS); + struct solution *soln_ptr = cxxSolution2solution(&sol); /* * This is not quite right, may not produce sort order, forced sort diff --git a/Solution.cxx b/Solution.cxx index f5fb4a5a..eb4c4361 100644 --- a/Solution.cxx +++ b/Solution.cxx @@ -137,7 +137,7 @@ isotopes(io) } } } - +#ifdef SKIP_OR_MOVE_TO_STRUCTURES cxxSolution::cxxSolution(PHREEQC_PTR_ARG_COMMA int l_n_user, PHRQ_io * io) // // constructor for cxxSolution from results of calculation @@ -278,10 +278,12 @@ isotopes(io) } } } - +#endif cxxSolution::~cxxSolution() { } + +#ifdef MOVE_TO_STRUCTURES struct solution * cxxSolution::cxxSolution2solution(PHREEQC_PTR_ARG) // @@ -336,6 +338,7 @@ cxxSolution::cxxSolution2solution(PHREEQC_PTR_ARG) return (solution_ptr); } +#endif void cxxSolution::dump_xml(std::ostream & s_oss, unsigned int indent) const diff --git a/Solution.h b/Solution.h index dfcdbefb..493c9c47 100644 --- a/Solution.h +++ b/Solution.h @@ -19,7 +19,7 @@ class cxxSolution:public cxxNumKeyword public: cxxSolution(PHRQ_io *io=NULL); cxxSolution(struct solution *, PHRQ_io *io=NULL); - cxxSolution(PHREEQC_PTR_ARG_COMMA int n_user, PHRQ_io *io=NULL); + //cxxSolution(PHREEQC_PTR_ARG_COMMA int n_user, PHRQ_io *io=NULL); cxxSolution( const std::map < int, cxxSolution > &solution_map, cxxMix & mx, int n_user, PHRQ_io *io=NULL); ~cxxSolution(); @@ -142,8 +142,13 @@ class cxxSolution:public cxxNumKeyword { return this->master_activity; } + const cxxNameDouble & get_species_gamma(void) const + { + return this->species_gamma; + } double get_master_activity(char *string) const; void set_master_activity(char *string, double value); + const cxxSolutionIsotopeList & Get_isotopes(void) const {return isotopes;}; /* double get_species_gamma(char *string)const; @@ -153,7 +158,7 @@ class cxxSolution:public cxxNumKeyword void set_isotope(char *string, double value); */ - struct solution *cxxSolution2solution(PHREEQC_PTR_ARG); + //struct solution *cxxSolution2solution(PHREEQC_PTR_ARG); void dump_raw(std::ostream & s_oss, unsigned int indent) const; diff --git a/SolutionIsotopeList.cxx b/SolutionIsotopeList.cxx index 33f832f9..31a8f72a 100644 --- a/SolutionIsotopeList.cxx +++ b/SolutionIsotopeList.cxx @@ -88,6 +88,7 @@ cxxSolutionIsotopeList::multiply(double extensive) it->total *= extensive; } } +#ifdef MOVE_TO_STRUCTURES struct isotope * cxxSolutionIsotopeList::cxxSolutionIsotopeList2isotope(PHREEQC_PTR_ARG) { @@ -119,3 +120,4 @@ cxxSolutionIsotopeList::cxxSolutionIsotopeList2isotope(PHREEQC_PTR_ARG) } return (iso); } +#endif diff --git a/StorageBin.cxx b/StorageBin.cxx index d25d43e2..0b0ac6bb 100644 --- a/StorageBin.cxx +++ b/StorageBin.cxx @@ -1001,7 +1001,8 @@ cxxStorageBin::cxxStorageBin2phreeqc(PHREEQC_PTR_ARG_COMMA int n) std::map < int, cxxSolution >::iterator it = this->Solutions.find(n); if (it != this->Solutions.end()) { - P_INSTANCE_POINTER solution[0] = (it->second).cxxSolution2solution(P_INSTANCE); + //P_INSTANCE_POINTER solution[0] = (it->second).cxxSolution2solution(P_INSTANCE); + P_INSTANCE_POINTER solution[0] = P_INSTANCE_POINTER cxxSolution2solution(&(it->second)); P_INSTANCE_POINTER solution[0]->n_user = n; P_INSTANCE_POINTER solution[0]->n_user_end = n; P_INSTANCE_POINTER count_solution++; @@ -1256,7 +1257,8 @@ cxxStorageBin::cxxStorageBin2system(PHREEQC_PTR_ARG_COMMA int n) if (this->getSolution(n) != NULL) { - system_ptr->solution = (this->getSolution(n))->cxxSolution2solution(P_INSTANCE); + //system_ptr->solution = (this->getSolution(n))->cxxSolution2solution(P_INSTANCE); + system_ptr->solution = P_INSTANCE_POINTER cxxSolution2solution(this->getSolution(n)); } else {