From c42d9855589da8d825887c3792e8d438710bf255 Mon Sep 17 00:00:00 2001 From: David L Parkhurst Date: Thu, 16 Feb 2006 20:09:24 +0000 Subject: [PATCH] Moved Isotope to SolutionIsotope git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@793 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- Makefile | 68 +++++++++++++++--------------- Solution.cxx | 10 ++--- Solution.h | 4 +- Isotope.cxx => SolutionIsotope.cxx | 30 ++++++------- Isotope.h => SolutionIsotope.h | 20 ++++----- 5 files changed, 67 insertions(+), 65 deletions(-) rename Isotope.cxx => SolutionIsotope.cxx (88%) rename Isotope.h => SolutionIsotope.h (74%) diff --git a/Makefile b/Makefile index 5af31c48..89e054c3 100644 --- a/Makefile +++ b/Makefile @@ -143,7 +143,7 @@ COMMON_CXXOBJS = \ ExchComp.o \ GasPhase.o \ ISolution.o \ - Isotope.o \ + SolutionIsotope.o \ KineticsComp.o \ KineticsCxx.o \ Mix.o \ @@ -193,18 +193,16 @@ GasPhase.o: ../GasPhase.cxx ../Utils.h ../GasPhase.h ../NumKeyword.h \ ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ISolutionComp.o: ../ISolutionComp.cxx ../ISolutionComp.h ../Utils.h \ ../char_star.h ../ISolution.h ../ISolutionComp.h ../NumKeyword.h \ - ../Parser.h ../char_star.h ../Solution.h ../NumKeyword.h ../Isotope.h \ - ../Parser.h ../NameDouble.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ - ../char_star.h ../Parser.h ../char_star.h ../Utils.h \ - ../phreeqc/phrqproto.h ../phreeqc/phqalloc.h + ../Parser.h ../char_star.h ../Solution.h ../NumKeyword.h \ + ../SolutionIsotope.h ../Parser.h ../NameDouble.h ../phreeqc/global.h \ + ../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \ + ../Utils.h ../phreeqc/phrqproto.h ../phreeqc/phqalloc.h ISolution.o: ../ISolution.cxx ../ISolution.h ../ISolutionComp.h \ ../Utils.h ../char_star.h ../NumKeyword.h ../Parser.h ../char_star.h \ - ../Solution.h ../NumKeyword.h ../Isotope.h ../Parser.h ../NameDouble.h \ - ../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h ../Parser.h \ - ../char_star.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h -Isotope.o: ../Isotope.cxx ../Isotope.h ../Parser.h ../char_star.h \ - ../Utils.h ../Parser.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ - ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h + ../Solution.h ../NumKeyword.h ../SolutionIsotope.h ../Parser.h \ + ../NameDouble.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ + ../char_star.h ../Parser.h ../char_star.h ../phreeqc/phqalloc.h \ + ../phreeqc/phrqproto.h KineticsComp.o: ../KineticsComp.cxx ../Utils.h ../KineticsComp.h \ ../NameDouble.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ ../char_star.h ../Parser.h ../char_star.h ../char_star.h \ @@ -238,27 +236,9 @@ Reaction.o: ../Reaction.cxx ../Utils.h ../Reaction.h ../NumKeyword.h \ ../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \ ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ReadClass.o: ../ReadClass.cxx ../Parser.h ../char_star.h ../Solution.h \ - ../NumKeyword.h ../Parser.h ../Isotope.h ../Parser.h ../NameDouble.h \ - ../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h ../Parser.h \ - ../char_star.h ../Exchange.h ../NumKeyword.h ../char_star.h \ - ../ExchComp.h ../NameDouble.h ../char_star.h ../Surface.h \ - ../NumKeyword.h ../char_star.h ../SurfComp.h ../NameDouble.h \ - ../char_star.h ../SurfCharge.h ../NameDouble.h ../char_star.h \ - ../PPassemblage.h ../NumKeyword.h ../char_star.h ../PPassemblageComp.h \ - ../NameDouble.h ../char_star.h ../KineticsCxx.h ../NumKeyword.h \ - ../char_star.h ../KineticsComp.h ../NameDouble.h ../char_star.h \ - ../SSassemblage.h ../NumKeyword.h ../char_star.h ../SSassemblageSS.h \ - ../NameDouble.h ../char_star.h ../GasPhase.h ../NumKeyword.h \ - ../NameDouble.h ../char_star.h ../Reaction.h ../NumKeyword.h \ - ../NameDouble.h ../char_star.h ../Mix.h ../NumKeyword.h ../char_star.h \ - ../Temperature.h ../NumKeyword.h ../char_star.h ../phreeqc/phqalloc.h \ - ../phreeqc/output.h ../phreeqc/phrqproto.h -Solution.o: ../Solution.cxx ../Utils.h ../Solution.h ../NumKeyword.h \ - ../Parser.h ../char_star.h ../Isotope.h ../Parser.h ../NameDouble.h \ - ../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h ../Parser.h \ - ../char_star.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h \ - ../ISolution.h ../ISolutionComp.h ../Utils.h ../char_star.h \ - ../NumKeyword.h ../Solution.h ../Exchange.h ../NumKeyword.h \ + ../NumKeyword.h ../Parser.h ../SolutionIsotope.h ../Parser.h \ + ../NameDouble.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ + ../char_star.h ../Parser.h ../char_star.h ../Exchange.h ../NumKeyword.h \ ../char_star.h ../ExchComp.h ../NameDouble.h ../char_star.h \ ../Surface.h ../NumKeyword.h ../char_star.h ../SurfComp.h \ ../NameDouble.h ../char_star.h ../SurfCharge.h ../NameDouble.h \ @@ -269,7 +249,29 @@ Solution.o: ../Solution.cxx ../Utils.h ../Solution.h ../NumKeyword.h \ ../SSassemblageSS.h ../NameDouble.h ../char_star.h ../GasPhase.h \ ../NumKeyword.h ../NameDouble.h ../char_star.h ../Reaction.h \ ../NumKeyword.h ../NameDouble.h ../char_star.h ../Mix.h ../NumKeyword.h \ - ../char_star.h ../Temperature.h ../NumKeyword.h ../char_star.h + ../char_star.h ../Temperature.h ../NumKeyword.h ../char_star.h \ + ../phreeqc/phqalloc.h ../phreeqc/output.h ../phreeqc/phrqproto.h +Solution.o: ../Solution.cxx ../Utils.h ../Solution.h ../NumKeyword.h \ + ../Parser.h ../char_star.h ../SolutionIsotope.h ../Parser.h \ + ../NameDouble.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ + ../char_star.h ../Parser.h ../char_star.h ../phreeqc/phqalloc.h \ + ../phreeqc/phrqproto.h ../ISolution.h ../ISolutionComp.h ../Utils.h \ + ../char_star.h ../NumKeyword.h ../Solution.h ../Exchange.h \ + ../NumKeyword.h ../char_star.h ../ExchComp.h ../NameDouble.h \ + ../char_star.h ../Surface.h ../NumKeyword.h ../char_star.h \ + ../SurfComp.h ../NameDouble.h ../char_star.h ../SurfCharge.h \ + ../NameDouble.h ../char_star.h ../PPassemblage.h ../NumKeyword.h \ + ../char_star.h ../PPassemblageComp.h ../NameDouble.h ../char_star.h \ + ../KineticsCxx.h ../NumKeyword.h ../char_star.h ../KineticsComp.h \ + ../NameDouble.h ../char_star.h ../SSassemblage.h ../NumKeyword.h \ + ../char_star.h ../SSassemblageSS.h ../NameDouble.h ../char_star.h \ + ../GasPhase.h ../NumKeyword.h ../NameDouble.h ../char_star.h \ + ../Reaction.h ../NumKeyword.h ../NameDouble.h ../char_star.h ../Mix.h \ + ../NumKeyword.h ../char_star.h ../Temperature.h ../NumKeyword.h \ + ../char_star.h +SolutionIsotope.o: ../SolutionIsotope.cxx ../SolutionIsotope.h \ + ../Parser.h ../char_star.h ../Utils.h ../Parser.h ../phreeqc/global.h \ + ../phreeqc/phrqtype.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h SSassemblage.o: ../SSassemblage.cxx ../Utils.h ../SSassemblage.h \ ../NumKeyword.h ../Parser.h ../char_star.h ../phreeqc/global.h \ ../phreeqc/phrqtype.h ../char_star.h ../SSassemblageSS.h \ diff --git a/Solution.cxx b/Solution.cxx index 9331295c..f13f3515 100644 --- a/Solution.cxx +++ b/Solution.cxx @@ -69,7 +69,7 @@ species_gamma(solution_ptr->species_gamma, solution_ptr->count_species_gamma, cx // Isotopes for (i = 0; i < solution_ptr->count_isotopes; i++) { - cxxIsotope iso(&solution_ptr->isotopes[i]); + cxxSolutionIsotope iso(&solution_ptr->isotopes[i]); isotopes.push_back(iso); } @@ -123,7 +123,7 @@ struct solution *cxxSolution::cxxSolution2solution() // isotopes solution_ptr->isotopes = (struct isotope *) free_check_null(solution_ptr->isotopes); - solution_ptr->isotopes = cxxIsotope::list2isotope(this->isotopes); + solution_ptr->isotopes = cxxSolutionIsotope::list2isotope(this->isotopes); solution_ptr->count_isotopes = this->isotopes.size(); return(solution_ptr); @@ -223,7 +223,7 @@ void cxxSolution::dump_xml(std::ostream& s_oss, unsigned int indent)const } */ - for (std::list::const_iterator it = this->isotopes.begin(); it != isotopes.end(); ++it) { + for (std::list::const_iterator it = this->isotopes.begin(); it != isotopes.end(); ++it) { it->dump_xml(s_oss, indent + 1); } @@ -326,7 +326,7 @@ void cxxSolution::dump_raw(std::ostream& s_oss, unsigned int indent)const s_oss << indent1; s_oss << "-Isotopes" << std::endl; { - for (std::list::const_iterator it = this->isotopes.begin(); it != isotopes.end(); ++it) { + for (std::list::const_iterator it = this->isotopes.begin(); it != isotopes.end(); ++it) { it->dump_raw(s_oss, indent + 2); } } @@ -429,7 +429,7 @@ void cxxSolution::read_raw(CParser& parser) case 3: // isotopes { - cxxIsotope iso; + cxxSolutionIsotope iso; if ( iso.read_raw(parser) != CParser::PARSER_OK) { parser.incr_input_error(); parser.error_msg("Expected data for isotopes.", CParser::OT_CONTINUE); diff --git a/Solution.h b/Solution.h index 733d9ecc..131063f6 100644 --- a/Solution.h +++ b/Solution.h @@ -2,7 +2,7 @@ #define SOLUTION_H_INCLUDED #include "NumKeyword.h" -#include "Isotope.h" +#include "SolutionIsotope.h" #include "NameDouble.h" #define EXTERNAL extern #include "global.h" @@ -76,7 +76,7 @@ protected: double mass_water; double total_alkalinity; cxxNameDouble totals; - std::list isotopes; + std::list isotopes; cxxNameDouble master_activity; cxxNameDouble species_gamma; public: diff --git a/Isotope.cxx b/SolutionIsotope.cxx similarity index 88% rename from Isotope.cxx rename to SolutionIsotope.cxx index 244d71fe..54afd61d 100644 --- a/Isotope.cxx +++ b/SolutionIsotope.cxx @@ -1,7 +1,7 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif -#include "Isotope.h" +#include "SolutionIsotope.h" #include "Utils.h" #include "Parser.h" #define EXTERNAL extern @@ -11,12 +11,12 @@ #include #include // std::ostrstream -cxxIsotope::cxxIsotope(void) +cxxSolutionIsotope::cxxSolutionIsotope(void) : isotope_number(0.0) { } -cxxIsotope::cxxIsotope(struct isotope *isotope_ptr) +cxxSolutionIsotope::cxxSolutionIsotope(struct isotope *isotope_ptr) { isotope_number = isotope_ptr->isotope_number; elt_name = isotope_ptr->elt_name; @@ -26,12 +26,12 @@ cxxIsotope::cxxIsotope(struct isotope *isotope_ptr) ratio_uncertainty = isotope_ptr->ratio_uncertainty; } -cxxIsotope::~cxxIsotope(void) +cxxSolutionIsotope::~cxxSolutionIsotope(void) { } -struct isotope *cxxIsotope::list2isotope(std::list &isolist) - // takes a std::list of cxxIsotope structures +struct isotope *cxxSolutionIsotope::list2isotope(std::list &isolist) + // takes a std::list of cxxSolutionIsotope structures // returns array of isotope structures { struct isotope *iso; @@ -41,7 +41,7 @@ struct isotope *cxxIsotope::list2isotope(std::list &isolist) iso = (struct isotope *) PHRQ_malloc((size_t) ((isolist.size()) * sizeof(struct isotope))); if (iso == NULL) malloc_error(); int i = 0; - for (std::list ::iterator it = isolist.begin(); it != isolist.end(); ++it) { + for (std::list ::iterator it = isolist.begin(); it != isolist.end(); ++it) { iso[i].isotope_number = it->isotope_number; iso[i].elt_name = it->elt_name; iso[i].total = it->total; @@ -56,7 +56,7 @@ struct isotope *cxxIsotope::list2isotope(std::list &isolist) } #ifdef SKIP -std::string cxxIsotope::get_name()const +std::string cxxSolutionIsotope::get_name()const { std::ostringstream oss; //std::ostrstream oss; @@ -65,7 +65,7 @@ std::string cxxIsotope::get_name()const } #endif -void cxxIsotope::dump_xml(std::ostream& s_oss, unsigned int indent)const +void cxxSolutionIsotope::dump_xml(std::ostream& s_oss, unsigned int indent)const { unsigned int i; @@ -99,7 +99,7 @@ void cxxIsotope::dump_xml(std::ostream& s_oss, unsigned int indent)const s_oss << "\">" << std::endl; } -void cxxIsotope::dump_raw(std::ostream& s_oss, unsigned int indent)const +void cxxSolutionIsotope::dump_raw(std::ostream& s_oss, unsigned int indent)const { unsigned int i; @@ -118,7 +118,7 @@ void cxxIsotope::dump_raw(std::ostream& s_oss, unsigned int indent)const s_oss << std::endl; } -CParser::STATUS_TYPE cxxIsotope::read_raw(CParser& parser) +CParser::STATUS_TYPE cxxSolutionIsotope::read_raw(CParser& parser) { std::string token; std::istream::pos_type next_char; @@ -168,25 +168,25 @@ CParser::STATUS_TYPE cxxIsotope::read_raw(CParser& parser) return CParser::PARSER_OK; } -bool cxxIsotope::operator<(const cxxIsotope& isotope)const +bool cxxSolutionIsotope::operator<(const cxxSolutionIsotope& isotope)const { int i = Utilities::strcmp_nocase(this->elt_name, isotope.elt_name); if (i != 0) return (i < 0); return ( this->isotope_number < isotope.isotope_number ); } -struct master *cxxIsotope::master(void) +struct master *cxxSolutionIsotope::master(void) { return (master_bsearch(this->elt_name)); } -struct master *cxxIsotope::primary(void) +struct master *cxxSolutionIsotope::primary(void) { return (master_bsearch_primary(this->elt_name)); } #ifdef SKIP -cxxIsotope::STATUS cxxIsotope::read(CParser& parser) +cxxSolutionIsotope::STATUS cxxSolutionIsotope::read(CParser& parser) { if ( !(parser.get_iss() >> this->isotope_number) ) { assert(parser.get_iss().fail()); diff --git a/Isotope.h b/SolutionIsotope.h similarity index 74% rename from Isotope.h rename to SolutionIsotope.h index 372e5523..4fbd821c 100644 --- a/Isotope.h +++ b/SolutionIsotope.h @@ -1,25 +1,25 @@ -#if !defined(ISOTOPE_H_INCLUDED) -#define ISOTOPE_H_INCLUDED +#if !defined(SOLUTIONISOTOPE_H_INCLUDED) +#define SOLUTIONISOTOPE_H_INCLUDED #include "Parser.h" #include // std::ostream #include // std::string #include // std::list -class cxxIsotope +class cxxSolutionIsotope { public: - cxxIsotope(void); - cxxIsotope(struct isotope *isotope_ptr); - ~cxxIsotope(void); + cxxSolutionIsotope(void); + cxxSolutionIsotope(struct isotope *isotope_ptr); + ~cxxSolutionIsotope(void); enum STATUS { ERROR = 0, OK = 1 }; - //cxxIsotope::STATUS read(CParser& parser); - static struct isotope * list2isotope(std::list &t); + //cxxSolutionIsotope::STATUS read(CParser& parser); + static struct isotope * list2isotope(std::list &t); void dump_xml(std::ostream& os, unsigned int indent)const; void dump_raw(std::ostream& os, unsigned int indent)const; @@ -37,7 +37,7 @@ public: bool get_ratio_uncertainty_defined()const { return this->ratio_uncertainty_defined; } - bool operator<(const cxxIsotope& conc)const; + bool operator<(const cxxSolutionIsotope& conc)const; struct master *master(void); struct master *primary(void); @@ -53,4 +53,4 @@ private: //struct master *primary; bool ratio_uncertainty_defined; }; -#endif // ISOTOPE_H_INCLUDED +#endif // SOLUTIONISOTOPE_H_INCLUDED