From 2b76f04a8bd97cc731c8e69ff6976fa8dc0e404a Mon Sep 17 00:00:00 2001 From: David L Parkhurst Date: Mon, 7 Dec 2009 19:49:38 +0000 Subject: [PATCH] Cleaned up header files to remove unnecessary includes of .h files. Moved includes to source code where possible. Moved some methods for .h to source files to avoid need for includes. Debug and Release compile. Still need to get class version working. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@3868 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- ExchComp.cxx | 15 +++-- ExchComp.h | 5 +- Exchange.cxx | 39 +++++++++--- Exchange.h | 37 ++++------- GasPhase.cxx | 13 +++- GasPhase.h | 8 +-- ISolution.cxx | 14 +++-- ISolution.h | 10 +-- ISolutionComp.cxx | 11 ++-- ISolutionComp.h | 7 --- KineticsComp.cxx | 21 ++++--- KineticsComp.h | 5 +- NameDouble.cxx | 23 ++++--- NameDouble.h | 1 + NumKeyword.cxx | 1 + NumKeyword.h | 7 +-- PPassemblage.cxx | 20 +++--- PPassemblage.h | 6 +- PPassemblageComp.cxx | 22 ++++--- PPassemblageComp.h | 5 +- Reaction.cxx | 18 +++--- Reaction.h | 7 +-- ReadClass.cxx | 18 ++++-- SSassemblage.cxx | 11 ++-- SSassemblage.h | 4 +- SSassemblageSS.cxx | 22 ++++--- SSassemblageSS.h | 3 +- Solution.cxx | 13 +++- Solution.h | 12 ++-- SolutionIsotope.cxx | 18 +++--- SolutionIsotope.h | 2 +- SolutionIsotopeList.cxx | 16 +++-- SolutionIsotopeList.h | 10 +-- StorageBin.cxx | 19 +++--- StorageBin.h | 6 +- StorageBinList.cpp | 4 +- StorageBinList.h | 4 +- Surface.cxx | 20 +++--- Surface.h | 6 +- SurfaceCharge.cxx | 68 ++++++++++---------- SurfaceCharge.h | 9 ++- SurfaceComp.cxx | 136 +++++++++++++++++++++++++++++++--------- SurfaceComp.h | 134 +++++++++------------------------------ System.cxx | 23 ++++++- System.h | 32 +++++++--- Temperature.cxx | 20 +++--- Temperature.h | 5 +- cxxKinetics.cxx | 23 ++++--- cxxKinetics.h | 7 +-- cxxMix.cxx | 20 +++--- cxxMix.h | 5 +- dumper.cpp | 4 +- dumper.h | 3 +- runner.cpp | 2 +- runner.h | 4 +- 55 files changed, 549 insertions(+), 429 deletions(-) diff --git a/ExchComp.cxx b/ExchComp.cxx index 15c1b178..536c190f 100644 --- a/ExchComp.cxx +++ b/ExchComp.cxx @@ -5,16 +5,23 @@ #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif #include // std::cout std::cerr +#include // assert +#include // std::sort +#include + #include "Utils.h" // define first -#include "ExchComp.h" -#include "Dictionary.h" +#if !defined(PHREEQC_CLASS) #define EXTERNAL extern #include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "ExchComp.h" +#include "Dictionary.h" #include "phqalloc.h" #include "phrqproto.h" #include "output.h" -#include // assert -#include // std::sort + ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff --git a/ExchComp.h b/ExchComp.h index 6f0797d8..68d21791 100644 --- a/ExchComp.h +++ b/ExchComp.h @@ -1,15 +1,14 @@ #if !defined(EXCHCOMP_H_INCLUDED) #define EXCHCOMP_H_INCLUDED -#include "NameDouble.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NameDouble.h" + class cxxExchComp { diff --git a/Exchange.cxx b/Exchange.cxx index 07c909e1..fd48ed16 100644 --- a/Exchange.cxx +++ b/Exchange.cxx @@ -4,18 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - #include // std::cout std::cerr -#include "Utils.h" // define first -#include "Exchange.h" -#include "ExchComp.h" +#include // assert +#include // std::sort + +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) #define EXTERNAL extern #include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "cxxMix.h" +#include "Exchange.h" #include "phqalloc.h" #include "phrqproto.h" #include "output.h" -#include // assert -#include // std::sort ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -551,10 +555,31 @@ cxxExchange::totalize() this->totals.clear(); // component structures for (std::map < std::string, cxxExchComp >::const_iterator it = exchComps.begin(); - it != exchComps.end(); ++it) + it != exchComps.end(); ++it) { this->totals.add_extensive((*it).second.get_totals(), 1.0); this->totals.add("Charge", (*it).second.get_charge_balance()); } return; } +bool +cxxExchange::get_pitzer_exchange_gammas() +{ + return this->pitzer_exchange_gammas; +} +void +cxxExchange::set_pitzer_exchange_gammas(bool b) +{ + this->pitzer_exchange_gammas = b; +} + +std::map < std::string, cxxExchComp > & +cxxExchange::get_exchComps(void) +{ + return (this->exchComps); +} +const cxxNameDouble & +cxxExchange::get_totals() const +{ + return totals; +}; \ No newline at end of file diff --git a/Exchange.h b/Exchange.h index e474762e..c3b0660d 100644 --- a/Exchange.h +++ b/Exchange.h @@ -1,26 +1,25 @@ #if !defined(EXCHANGE_H_INCLUDED) #define EXCHANGE_H_INCLUDED -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list - +#include "NumKeyword.h" #include "ExchComp.h" -#include "cxxMix.h" +#include "NameDouble.h" +class cxxMix; class cxxExchange:public cxxNumKeyword { - public: +public: cxxExchange(); cxxExchange(int n_user); - cxxExchange(struct exchange *); - cxxExchange(const std::map < int, cxxExchange > &exchange_map, - cxxMix & mx, int n_user); - ~cxxExchange(); + cxxExchange(struct exchange *); + cxxExchange(const std::map < int, cxxExchange > &exchange_map, + cxxMix & mx, int n_user); + ~cxxExchange(); struct exchange *cxxExchange2exchange(); @@ -34,25 +33,13 @@ class cxxExchange:public cxxNumKeyword bool get_related_rate(void); - bool get_pitzer_exchange_gammas() - { - return this->pitzer_exchange_gammas; - } - void set_pitzer_exchange_gammas(bool b) - { - this->pitzer_exchange_gammas = b; - } + bool get_pitzer_exchange_gammas(); + void set_pitzer_exchange_gammas(bool b); - std::map < std::string, cxxExchComp > &get_exchComps(void) - { - return (this->exchComps); - } + std::map < std::string, cxxExchComp > &get_exchComps(void); void totalize(); - const cxxNameDouble & get_totals() const - { - return totals; - }; + const cxxNameDouble & get_totals() const; #ifdef USE_MPI void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles); diff --git a/GasPhase.cxx b/GasPhase.cxx index c8df508c..5315b838 100644 --- a/GasPhase.cxx +++ b/GasPhase.cxx @@ -4,16 +4,23 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif +#include // assert +#include // std::sort +#include #include "Utils.h" // define first -#include "GasPhase.h" +#if !defined(PHREEQC_CLASS) #define EXTERNAL extern #include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "GasPhase.h" +#include "cxxMix.h" #include "phqalloc.h" #include "phrqproto.h" #include "output.h" -#include // assert -#include // std::sort + ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff --git a/GasPhase.h b/GasPhase.h index 5d3363cf..8cfe5759 100644 --- a/GasPhase.h +++ b/GasPhase.h @@ -1,17 +1,15 @@ #if !defined(GASPHASE_H_INCLUDED) #define GASPHASE_H_INCLUDED -#include "NumKeyword.h" -#include "NameDouble.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector -#include "cxxMix.h" +#include "NumKeyword.h" +#include "NameDouble.h" +class cxxMix; class cxxGasPhase:public cxxNumKeyword { diff --git a/ISolution.cxx b/ISolution.cxx index 78355274..2b5e4745 100644 --- a/ISolution.cxx +++ b/ISolution.cxx @@ -4,18 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif +#include // assert +#include // std::sort +#include -#include "ISolution.h" -#include "ISolutionComp.h" +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) #define EXTERNAL extern #include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "ISolution.h" #include "phqalloc.h" #include "phrqproto.h" #include "output.h" -#include // assert -#include // std::sort -#include #ifdef ORCHESTRA extern void ORCH_write_chemistry_species(std::ostream & chemistry_dat); #endif diff --git a/ISolution.h b/ISolution.h index cdb505b0..2c9db096 100644 --- a/ISolution.h +++ b/ISolution.h @@ -1,11 +1,6 @@ #if !defined(ISOLUTION_H_INCLUDED) #define ISOLUTION_H_INCLUDED -//#include "Parser.h" -#include "ISolutionComp.h" -#include "NumKeyword.h" -#include "Solution.h" -//#include "Isotope.h" #include // assert #include // std::map #include // std::string @@ -15,6 +10,11 @@ #include #include #include + +#include "ISolutionComp.h" +#include "NumKeyword.h" +#include "Solution.h" + class cxxISolution:public cxxSolution { diff --git a/ISolutionComp.cxx b/ISolutionComp.cxx index fd0c6020..52fbf1c0 100644 --- a/ISolutionComp.cxx +++ b/ISolutionComp.cxx @@ -1,13 +1,16 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "ISolutionComp.h" -#include "ISolution.h" -#include "Utils.h" #include + +#include "Utils.h" +#if !defined(PHREEQC_CLASS) #define EXTERNAL extern #include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "ISolutionComp.h" #include "phrqproto.h" #include "phqalloc.h" #include "output.h" diff --git a/ISolutionComp.h b/ISolutionComp.h index 28d24c21..2e045b7d 100644 --- a/ISolutionComp.h +++ b/ISolutionComp.h @@ -1,13 +1,6 @@ #if !defined(ISOLUTIONCOMP_H_INCLUDED) #define ISOLUTIONCOMP_H_INCLUDED -//#include "Parser.h" -#include "Utils.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" - #include #include // std::map #include diff --git a/KineticsComp.cxx b/KineticsComp.cxx index 5c6dcef5..959ab182 100644 --- a/KineticsComp.cxx +++ b/KineticsComp.cxx @@ -4,17 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "KineticsComp.h" -#include "Dictionary.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "KineticsComp.h" +#include "Dictionary.h" +#include "phqalloc.h" +#include "phrqproto.h" + + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/KineticsComp.h b/KineticsComp.h index 17d96930..d66bccdb 100644 --- a/KineticsComp.h +++ b/KineticsComp.h @@ -1,15 +1,14 @@ #if !defined(KINETICSCOMP_H_INCLUDED) #define KINETICSCOMP_H_INCLUDED -#include "NameDouble.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NameDouble.h" + class cxxKineticsComp { diff --git a/NameDouble.cxx b/NameDouble.cxx index cd729ea6..428db5d5 100644 --- a/NameDouble.cxx +++ b/NameDouble.cxx @@ -4,19 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include // std::cout std::cerr -#include "Utils.h" // define first -#include "NameDouble.h" -#include "Dictionary.h" -#define EXTERNAL extern -#include "global.h" -#include "output.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort #include // std::sort +#include // std::cout std::cerr + +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "NameDouble.h" +#include "Dictionary.h" +#include "phqalloc.h" +#include "phrqproto.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff --git a/NameDouble.h b/NameDouble.h index 883f6756..68ef7b69 100644 --- a/NameDouble.h +++ b/NameDouble.h @@ -9,6 +9,7 @@ #include // std::vector #include "Parser.h" + class cxxNameDouble:public std::map < std::string, double > { diff --git a/NumKeyword.cxx b/NumKeyword.cxx index 34926f66..dedee506 100644 --- a/NumKeyword.cxx +++ b/NumKeyword.cxx @@ -6,6 +6,7 @@ ////////////////////////////////////////////////////////////////////// #include "NumKeyword.h" +#include "Parser.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff --git a/NumKeyword.h b/NumKeyword.h index 9c31fb69..4fa31211 100644 --- a/NumKeyword.h +++ b/NumKeyword.h @@ -1,12 +1,11 @@ #if !defined(NUMKEYWORD_H_INCLUDED) #define NUMKEYWORD_H_INCLUDED -#include "Parser.h" +//#include "Parser.h" #include // std::ostream #include // std::string -//#define EXTERNAL extern -//#include "global.h" -//#include "phrqproto.h" +class CParser; + extern char *string_duplicate(const char *); class cxxNumKeyword diff --git a/PPassemblage.cxx b/PPassemblage.cxx index aa35f313..a4c9f8d7 100644 --- a/PPassemblage.cxx +++ b/PPassemblage.cxx @@ -4,17 +4,21 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "PPassemblage.h" -#include "PPassemblageComp.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "PPassemblage.h" +#include "cxxMix.h" +#include "phqalloc.h" +#include "phrqproto.h" + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/PPassemblage.h b/PPassemblage.h index af9cdc75..50a93c0b 100644 --- a/PPassemblage.h +++ b/PPassemblage.h @@ -1,17 +1,15 @@ #if !defined(PPASSEMBLAGE_H_INCLUDED) #define PPASSEMBLAGE_H_INCLUDED -#include "NumKeyword.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NumKeyword.h" #include "PPassemblageComp.h" -#include "cxxMix.h" +class cxxMix; class cxxPPassemblage:public cxxNumKeyword { diff --git a/PPassemblageComp.cxx b/PPassemblageComp.cxx index 4801c633..9af0b3e9 100644 --- a/PPassemblageComp.cxx +++ b/PPassemblageComp.cxx @@ -4,17 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif +#include // assert +#include // std::sort #include "Utils.h" // define first -#include "PPassemblageComp.h" -#include "Dictionary.h" +#if !defined(PHREEQC_CLASS) #define EXTERNAL extern #include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "PPassemblageComp.h" +#include "Dictionary.h" #include "phqalloc.h" #include "phrqproto.h" #include "output.h" -#include // assert -#include // std::sort + ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -365,15 +370,13 @@ cxxPPassemblageComp::read_raw(CParser & parser, bool check) if (initial_moles_defined == false) { parser.incr_input_error(); - parser. - error_msg("Initial_moles not defined for PPassemblageComp input.", + parser.error_msg("Initial_moles not defined for PPassemblageComp input.", CParser::OT_CONTINUE); } if (dissolve_only_defined == false) { parser.incr_input_error(); - parser. - error_msg("Dissolve_only not defined for PPassemblageComp input.", + parser.error_msg("Dissolve_only not defined for PPassemblageComp input.", CParser::OT_CONTINUE); } /* don't check to maintain backward compatibility @@ -388,8 +391,7 @@ cxxPPassemblageComp::read_raw(CParser & parser, bool check) if (force_equality_defined == false) { parser.incr_input_error(); - parser. - error_msg + parser.error_msg ("Force_equality not defined for PPassemblageComp input.", CParser::OT_CONTINUE); } diff --git a/PPassemblageComp.h b/PPassemblageComp.h index e88a35c7..a220d31e 100644 --- a/PPassemblageComp.h +++ b/PPassemblageComp.h @@ -1,15 +1,14 @@ #if !defined(PPASSEMBLAGECOMP_H_INCLUDED) #define PPASSEMBLAGECOMP_H_INCLUDED -#include "NameDouble.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NameDouble.h" + class cxxPPassemblageComp { diff --git a/Reaction.cxx b/Reaction.cxx index b40b194f..9dd9fb0b 100644 --- a/Reaction.cxx +++ b/Reaction.cxx @@ -4,16 +4,20 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "Reaction.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "Reaction.h" +#include "phqalloc.h" +#include "phrqproto.h" + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/Reaction.h b/Reaction.h index ae6d8dd2..e3c24594 100644 --- a/Reaction.h +++ b/Reaction.h @@ -1,16 +1,15 @@ #if !defined(REACTION_H_INCLUDED) #define REACTION_H_INCLUDED -#include "NumKeyword.h" -#include "NameDouble.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NumKeyword.h" +#include "NameDouble.h" + class cxxReaction:public cxxNumKeyword { diff --git a/ReadClass.cxx b/ReadClass.cxx index 48805ea0..398436bd 100644 --- a/ReadClass.cxx +++ b/ReadClass.cxx @@ -1,6 +1,16 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif +#include +#include +#include + +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif #include "Parser.h" #include "Solution.h" #include "Exchange.h" @@ -14,14 +24,10 @@ #include "Temperature.h" #include "dumper.h" #include "runner.h" -#define EXTERNAL extern -#include "global.h" +#include "cxxMix.h" #include "phqalloc.h" -#include "output.h" #include "phrqproto.h" -#include -#include -#include +#include "output.h" static int streamify_to_next_keyword(std::istringstream & lines); extern int reading_database(void); diff --git a/SSassemblage.cxx b/SSassemblage.cxx index de9b9b87..95909e95 100644 --- a/SSassemblage.cxx +++ b/SSassemblage.cxx @@ -9,17 +9,18 @@ #include // std::sort #include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif #include "SSassemblage.h" #include "SSassemblageSS.h" #include "cxxMix.h" -#if defined(PHREEQC_CLASS) -#define CLASS_STATIC static -#endif -#include "global_structures.h" #include "phqalloc.h" #include "phrqproto.h" - ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/SSassemblage.h b/SSassemblage.h index 40cbb185..b81b8475 100644 --- a/SSassemblage.h +++ b/SSassemblage.h @@ -1,14 +1,14 @@ #if !defined(SSASSEMBLAGE_H_INCLUDED) #define SSASSEMBLAGE_H_INCLUDED -#include "NumKeyword.h" + #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector -//#include "SSassemblageSS.h" +#include "NumKeyword.h" #include "NameDouble.h" class cxxSSassemblageSS; diff --git a/SSassemblageSS.cxx b/SSassemblageSS.cxx index 47e3ce37..b1e96f29 100644 --- a/SSassemblageSS.cxx +++ b/SSassemblageSS.cxx @@ -4,18 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "SSassemblageSS.h" -#include "NameDouble.h" -#include "Dictionary.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "SSassemblageSS.h" +#include "Dictionary.h" +#include "phqalloc.h" +#include "phrqproto.h" + + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/SSassemblageSS.h b/SSassemblageSS.h index 8c601e52..af148c50 100644 --- a/SSassemblageSS.h +++ b/SSassemblageSS.h @@ -1,13 +1,14 @@ #if !defined(SSASSEMBLAGESS_H_INCLUDED) #define SSASSEMBLAGESS_H_INCLUDED -#include "NameDouble.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NameDouble.h" + class cxxSSassemblageSS { diff --git a/Solution.cxx b/Solution.cxx index 193591df..3b0f5a98 100644 --- a/Solution.cxx +++ b/Solution.cxx @@ -4,19 +4,26 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif +#include // assert +#include // std::sort + #ifdef USE_MPI //MPICH seems to require mpi.h to be first #include #endif #include "Utils.h" // define first -#include "Solution.h" +#if !defined(PHREEQC_CLASS) #define EXTERNAL extern #include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "Solution.h" +#include "cxxMix.h" #include "phqalloc.h" #include "phrqproto.h" #include "output.h" -#include // assert -#include // std::sort + ////////////////////////////////////////////////////////////////////// diff --git a/Solution.h b/Solution.h index 96a03533..90b9bcae 100644 --- a/Solution.h +++ b/Solution.h @@ -1,19 +1,17 @@ #if !defined(SOLUTION_H_INCLUDED) #define SOLUTION_H_INCLUDED -#include "NumKeyword.h" -#include "SolutionIsotopeList.h" -#include "NameDouble.h" -#include "cxxMix.h" - -//#define EXTERNAL extern -//#include "global.h" #include // assert #include // std::map #include // std::string #include // std::vector #include +#include "NumKeyword.h" +#include "SolutionIsotopeList.h" +#include "NameDouble.h" +class cxxMix; + class cxxSolution:public cxxNumKeyword { diff --git a/SolutionIsotope.cxx b/SolutionIsotope.cxx index baff944c..510e1563 100644 --- a/SolutionIsotope.cxx +++ b/SolutionIsotope.cxx @@ -1,16 +1,20 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif -#include "SolutionIsotope.h" -#include "Utils.h" -#include "Parser.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include #include // std::ostrstream +#include "Utils.h" +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "SolutionIsotope.h" +#include "phqalloc.h" +#include "phrqproto.h" + cxxSolutionIsotope::cxxSolutionIsotope(void): isotope_number(0.0) { diff --git a/SolutionIsotope.h b/SolutionIsotope.h index 32fc066f..e3589470 100644 --- a/SolutionIsotope.h +++ b/SolutionIsotope.h @@ -1,10 +1,10 @@ #if !defined(SOLUTIONISOTOPE_H_INCLUDED) #define SOLUTIONISOTOPE_H_INCLUDED -#include "Parser.h" #include // std::ostream #include // std::string #include // std::list +#include "Parser.h" class cxxSolutionIsotope { diff --git a/SolutionIsotopeList.cxx b/SolutionIsotopeList.cxx index 2989d788..b1910b63 100644 --- a/SolutionIsotopeList.cxx +++ b/SolutionIsotopeList.cxx @@ -1,12 +1,18 @@ #include "Utils.h" // define first -#include "SolutionIsotopeList.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "SolutionIsotopeList.h" +#include "phqalloc.h" +#include "phrqproto.h" + + cxxSolutionIsotopeList::cxxSolutionIsotopeList(void) // // default constructor for cxxSolution diff --git a/SolutionIsotopeList.h b/SolutionIsotopeList.h index efc9f192..e2862ec2 100644 --- a/SolutionIsotopeList.h +++ b/SolutionIsotopeList.h @@ -1,18 +1,14 @@ #if !defined(SOLUTIONISOTOPELIST_H_INCLUDED) #define SOLUTIONISOTOPELIST_H_INCLUDED -//#define EXTERNAL extern -#include "SolutionIsotope.h" -//#include "global.h" #include // assert #include // std::string #include // std::list -#include "Parser.h" +#include "SolutionIsotope.h" class cxxSolutionIsotopeList:public - std::list < - cxxSolutionIsotope > + std::list < cxxSolutionIsotope > { public: @@ -29,7 +25,7 @@ public: protected: - public: +public: }; diff --git a/StorageBin.cxx b/StorageBin.cxx index cb965b6d..6a210f30 100644 --- a/StorageBin.cxx +++ b/StorageBin.cxx @@ -4,14 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif +#include +#include // std::cout std::cerr +#include // assert +#include // std::sort + #ifdef USE_MPI //MPICH seems to require mpi.h to be first #include #endif - -#include -#include // std::cout std::cerr #include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif #include "NameDouble.h" #include "StorageBin.h" #include "SSassemblage.h" @@ -26,14 +34,9 @@ #include "cxxMix.h" #include "Reaction.h" #include "Temperature.h" - -#define EXTERNAL extern -#include "global.h" #include "phqalloc.h" #include "phrqproto.h" #include "output.h" -#include // assert -#include // std::sort ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff --git a/StorageBin.h b/StorageBin.h index 44ff84fd..ba0750c5 100644 --- a/StorageBin.h +++ b/StorageBin.h @@ -6,9 +6,7 @@ #include // std::list #include // std::vector -//#include "Utils.h" -//#include "Parser.h" - +#include "System.h" class cxxSolution; class cxxExchange; class cxxGasPhase; @@ -16,11 +14,9 @@ class cxxKinetics; class cxxPPassemblage; class cxxSSassemblage; class cxxSurface; -#include "System.h" class cxxReaction; class cxxTemperature; - class cxxStorageBin { diff --git a/StorageBinList.cpp b/StorageBinList.cpp index 201528d0..cbbdf385 100644 --- a/StorageBinList.cpp +++ b/StorageBinList.cpp @@ -1,5 +1,7 @@ -#include "StorageBinList.h" #include // std::replace +#include "StorageBinList.h" +#include "Parser.h" + StorageBinListItem::StorageBinListItem(void) { this->defined = false; diff --git a/StorageBinList.h b/StorageBinList.h index 10094d0a..4656f817 100644 --- a/StorageBinList.h +++ b/StorageBinList.h @@ -4,7 +4,9 @@ #include // std::string #include // std::list #include // std::vector -#include "Parser.h" + +class CParser; + class StorageBinListItem { public: diff --git a/Surface.cxx b/Surface.cxx index a48bd0c7..129e4570 100644 --- a/Surface.cxx +++ b/Surface.cxx @@ -4,17 +4,21 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "Surface.h" -#include "SurfaceComp.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "Surface.h" +#include "cxxMix.h" +#include "phqalloc.h" +#include "phrqproto.h" + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/Surface.h b/Surface.h index 461f7520..86828a74 100644 --- a/Surface.h +++ b/Surface.h @@ -1,18 +1,16 @@ #if !defined(SURFACE_H_INCLUDED) #define SURFACE_H_INCLUDED -#include "NumKeyword.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NumKeyword.h" #include "SurfaceComp.h" #include "SurfaceCharge.h" -#include "cxxMix.h" +class cxxMix; class cxxSurface:public cxxNumKeyword { diff --git a/SurfaceCharge.cxx b/SurfaceCharge.cxx index 8e22a6b4..f6ffa348 100644 --- a/SurfaceCharge.cxx +++ b/SurfaceCharge.cxx @@ -4,26 +4,30 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "SurfaceCharge.h" -#include "Dictionary.h" -#define EXTERNAL extern -#include "global.h" -#include "output.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "SurfaceCharge.h" +#include "Dictionary.h" +#include "phqalloc.h" +#include "phrqproto.h" +#include "output.h" + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// cxxSurfaceCharge::cxxSurfaceCharge() - // - // default constructor for cxxSurfaceCharge - // +// +// default constructor for cxxSurfaceCharge +// { specific_area = 0.0; grams = 0.0; @@ -38,10 +42,10 @@ cxxSurfaceCharge::cxxSurfaceCharge() } cxxSurfaceCharge::cxxSurfaceCharge(struct surface_charge *surf_charge_ptr) - // - // constructor for cxxSurfaceCharge from struct surface_charge - // - : +// +// constructor for cxxSurfaceCharge from struct surface_charge +// +: diffuse_layer_totals(surf_charge_ptr->diffuse_layer_totals) { this->set_name(surf_charge_ptr->name); @@ -61,7 +65,7 @@ cxxSurfaceCharge::~cxxSurfaceCharge() } struct master * -cxxSurfaceCharge::get_psi_master() + cxxSurfaceCharge::get_psi_master() { struct master *master_ptr = NULL; std::string str = this->name; @@ -81,9 +85,9 @@ cxxSurfaceCharge::get_psi_master() struct surface_charge * cxxSurfaceCharge::cxxSurfaceCharge2surface_charge(std::map < std::string, cxxSurfaceCharge > &el) - // - // Builds surface_charge structure from of cxxSurfaceCharge - // + // + // Builds surface_charge structure from of cxxSurfaceCharge + // { struct surface_charge *surf_charge_ptr = (struct surface_charge *) @@ -93,7 +97,7 @@ struct surface_charge * int i = 0; for (std::map < std::string, cxxSurfaceCharge >::iterator it = el.begin(); - it != el.end(); ++it) + it != el.end(); ++it) { surf_charge_ptr[i].name = string_hsave((*it).second.name.c_str()); assert((*it).second.name.size() > 0); @@ -265,7 +269,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->name.clear(); parser.incr_input_error(); parser.error_msg("Expected string value for name.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } else { @@ -280,7 +284,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->specific_area = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for specific_area.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } specific_area_defined = true; break; @@ -291,7 +295,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->grams = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for grams.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } grams_defined = true; break; @@ -303,7 +307,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->charge_balance = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for charge_balance.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } charge_balance_defined = true; break; @@ -314,7 +318,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->mass_water = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for mass_water.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } mass_water_defined = true; break; @@ -326,7 +330,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->la_psi = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for la_psi.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } la_psi_defined = true; break; @@ -340,7 +344,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) parser. error_msg ("Expected element name and molality for SurfaceCharge diffuse_layer_totals.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } opt_save = 6; break; @@ -351,7 +355,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->la_psi1 = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for la_psi1.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } la_psi1_defined = true; break; @@ -362,7 +366,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->la_psi2 = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for la_psi.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } la_psi2_defined = true; break; @@ -373,7 +377,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->capacitance[0] = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for capacitance0.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } capacitance0_defined = true; break; @@ -384,7 +388,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) this->capacitance[1] = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for capacitance1.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } capacitance1_defined = true; break; diff --git a/SurfaceCharge.h b/SurfaceCharge.h index a5841a3f..bb24db33 100644 --- a/SurfaceCharge.h +++ b/SurfaceCharge.h @@ -1,23 +1,22 @@ #if !defined(SURFACECHARGE_H_INCLUDED) #define SURFACECHARGE_H_INCLUDED -#include "NameDouble.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NameDouble.h" + class cxxSurfaceCharge { - public: +public: cxxSurfaceCharge(); cxxSurfaceCharge(struct surface_charge *); - ~cxxSurfaceCharge(); + ~cxxSurfaceCharge(); struct master *get_psi_master(); diff --git a/SurfaceComp.cxx b/SurfaceComp.cxx index bab9bb65..5e7fc69d 100644 --- a/SurfaceComp.cxx +++ b/SurfaceComp.cxx @@ -4,26 +4,30 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif +#include // assert +#include // std::sort #include "Utils.h" // define first -#include "SurfaceComp.h" -#include "Dictionary.h" +#if !defined(PHREEQC_CLASS) #define EXTERNAL extern #include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "SurfaceComp.h" +#include "Dictionary.h" #include "phqalloc.h" #include "phrqproto.h" #include "output.h" -#include // assert -#include // std::sort ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// cxxSurfaceComp::cxxSurfaceComp() - // - // default constructor for cxxSurfaceComp - // +// +// default constructor for cxxSurfaceComp +// { formula_totals.type = cxxNameDouble::ND_ELT_MOLES; formula_z = 0.0; @@ -37,10 +41,10 @@ cxxSurfaceComp::cxxSurfaceComp() } cxxSurfaceComp::cxxSurfaceComp(struct surface_comp *surf_comp_ptr) - // - // constructor for cxxSurfaceComp from struct surface_comp - // - : +// +// constructor for cxxSurfaceComp from struct surface_comp +// +: formula_totals(surf_comp_ptr->formula_totals), totals(surf_comp_ptr->totals) { @@ -61,12 +65,12 @@ cxxSurfaceComp::~cxxSurfaceComp() } struct master * -cxxSurfaceComp::get_master() + cxxSurfaceComp::get_master() { struct master *master_ptr = NULL; //for (std::map ::iterator it = totals.begin(); it != totals.end(); it++) { for (cxxNameDouble::iterator it = this->totals.begin(); - it != this->totals.end(); it++) + it != this->totals.end(); it++) { /* Find master species */ char *eltName = string_hsave(it->first.c_str()); @@ -100,9 +104,9 @@ cxxSurfaceComp::get_master() struct surface_comp * cxxSurfaceComp::cxxSurfaceComp2surface_comp(std::map < std::string, cxxSurfaceComp > &el) - // - // Builds surface_comp structure from of cxxSurfaceComp - // + // + // Builds surface_comp structure from of cxxSurfaceComp + // { struct surface_comp *surf_comp_ptr = (struct surface_comp *) @@ -112,7 +116,7 @@ struct surface_comp * int i = 0; for (std::map < std::string, cxxSurfaceComp >::iterator it = el.begin(); - it != el.end(); ++it) + it != el.end(); ++it) { surf_comp_ptr[i].formula = string_hsave((*it).second.formula.c_str()); assert((*it).second.formula.size() > 0); @@ -306,7 +310,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->formula.clear(); parser.incr_input_error(); parser.error_msg("Expected string value for formula.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } else { @@ -321,7 +325,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->moles = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for moles.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } moles_defined = true; break; @@ -332,7 +336,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->la = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for la.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } la_defined = true; break; @@ -343,7 +347,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->charge_number = 0; parser.incr_input_error(); parser.error_msg("Expected integer value for charge_number.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } charge_number_defined = true; break; @@ -354,7 +358,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->charge_balance = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for charge_balance.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } charge_balance_defined = true; break; @@ -365,7 +369,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->phase_name.clear(); parser.incr_input_error(); parser.error_msg("Expected string value for phase_name.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } else { @@ -379,7 +383,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->rate_name.clear(); parser.incr_input_error(); parser.error_msg("Expected string value for rate_name.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } else { @@ -394,7 +398,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) parser.incr_input_error(); parser. error_msg("Expected numeric value for phase_proportion.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } break; @@ -406,7 +410,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) parser. error_msg ("Expected element name and molality for SurfaceComp totals.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } opt_save = 8; break; @@ -417,7 +421,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->formula_z = 0; parser.incr_input_error(); parser.error_msg("Expected numeric value for formula_z.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } formula_z_defined = true; break; @@ -430,7 +434,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) parser. error_msg ("Expected element name and molality for SurfaceComp formula totals.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } opt_save = 10; break; @@ -441,7 +445,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) this->Dw = 0.0; parser.incr_input_error(); parser.error_msg("Expected numeric value for Dw.", - CParser::OT_CONTINUE); + CParser::OT_CONTINUE); } Dw_defined = true; break; @@ -658,3 +662,77 @@ cxxSurfaceComp::multiply(double extensive) //char *rate_name; //double Dw; } +const std::string & +cxxSurfaceComp::get_phase_name() const +{ + return this->phase_name; +} +void +cxxSurfaceComp::set_phase_name(char * f) +{ + if (f != NULL) + this->phase_name = std::string(f); + else + this->phase_name.clear(); +} +const std::string & +cxxSurfaceComp::get_rate_name() const +{ + return this->rate_name; +} +void +cxxSurfaceComp::set_rate_name(char * f) +{ + if (f != NULL) + this->rate_name = std::string(f); + else + this->rate_name.clear(); +} +const std::string & +cxxSurfaceComp::get_formula() const +{ + return this->formula; +} +void +cxxSurfaceComp::set_formula(char * f) +{ + if (f != NULL) + this->formula = std::string(f); + else + this->formula.clear(); +} +double +cxxSurfaceComp::get_charge_balance() const +{ + return this->charge_balance; +} +void +cxxSurfaceComp::set_charge_balance(double d) +{ + this->charge_balance = d; +} +const cxxNameDouble & +cxxSurfaceComp::get_totals() const +{ + return (this->totals); +}; +std::string +cxxSurfaceComp::charge_name() +{ + char * str = string_hsave(this->formula.c_str()); + return (get_charge_name(str)); +}; +std::string +cxxSurfaceComp::get_charge_name(char *token) +{ + char name[100]; + int l; + char *ptr1 = token; + get_elt(&ptr1, name, &l); + ptr1 = strchr(name, '_'); + if (ptr1 != NULL) + { + ptr1[0] = '\0'; + } + return (std::string(name)); +}; \ No newline at end of file diff --git a/SurfaceComp.h b/SurfaceComp.h index c1c43eb8..f0e28241 100644 --- a/SurfaceComp.h +++ b/SurfaceComp.h @@ -1,136 +1,60 @@ #if !defined(SURFACECOMP_H_INCLUDED) #define SURFACECOMP_H_INCLUDED -#include "NameDouble.h" -#define EXTERNAL extern -#include "global.h" -#include "phrqproto.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NameDouble.h" + class cxxSurfaceComp { - public: +public: cxxSurfaceComp(); cxxSurfaceComp(struct surface_comp *); - ~cxxSurfaceComp(); - + ~cxxSurfaceComp(); struct master *get_master(); - const std::string &get_phase_name() const - { - return this->phase_name; - } - void set_phase_name(char * f) - { - if (f != NULL) - this->phase_name = std::string(f); - else - this->phase_name.clear(); - } - const std::string &get_rate_name() const - { - return this->rate_name; - } - void set_rate_name(char * f) - { - if (f != NULL) - this->rate_name = std::string(f); - else - this->rate_name.clear(); - } - const std::string &get_formula() const - { - return this->formula; - } - void set_formula(char * f) - { - if (f != NULL) - this->formula = std::string(f); - else - this->formula.clear(); - } - double get_charge_balance() const - { - return this->charge_balance; - } - void set_charge_balance(double d) - { - this->charge_balance = d; - } - + const std::string &get_phase_name() const; + void set_phase_name(char * f); + const std::string &get_rate_name() const; + void set_rate_name(char * f); + const std::string &get_formula() const; + void set_formula(char * f); + double get_charge_balance() const; + void set_charge_balance(double d); static struct surface_comp *cxxSurfaceComp2surface_comp(std::map < std::string, cxxSurfaceComp > &el); - void dump_xml(std::ostream & os, unsigned int indent = 0) const; - void dump_raw(std::ostream & s_oss, unsigned int indent) const; - void read_raw(CParser & parser, bool check = true); - const cxxNameDouble & get_totals() const - { - return (this->totals); - }; - - + const cxxNameDouble & get_totals() const; void add(const cxxSurfaceComp & comp, double extensive); void multiply(double extensive); - - std::string charge_name() - { - char * str = string_hsave(this->formula.c_str()); - return (get_charge_name(str)); - }; - - //static std::string &get_charge_name(char *token) - //{ - // char name[100]; - // int l; - // char *ptr1 = token; - // get_elt(&ptr1, name, &l); - // ptr1 = strchr(name, '_'); - // if (ptr1 != NULL) - // { - // ptr1[0] = '\0'; - // } - // return (string_hsave(name)); - //}; - static std::string get_charge_name(char *token) - { - char name[100]; - int l; - char *ptr1 = token; - get_elt(&ptr1, name, &l); - ptr1 = strchr(name, '_'); - if (ptr1 != NULL) - { - ptr1[0] = '\0'; - } - return (std::string(name)); - }; + std::string charge_name(); + static std::string get_charge_name(char *token); #ifdef USE_MPI void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles); void mpi_unpack(int *ints, int *ii, double *doubles, int *dd); #endif - protected: - std::string formula; - cxxNameDouble formula_totals; - double formula_z; - double moles; - cxxNameDouble totals; - double la; - //int charge_number; - double charge_balance; - std::string phase_name; - double phase_proportion; - std::string rate_name; - double Dw; - public: +protected: + std::string formula; + cxxNameDouble formula_totals; + double formula_z; + double moles; + cxxNameDouble totals; + double la; + //int charge_number; + double charge_balance; + std::string phase_name; + double phase_proportion; + std::string rate_name; + double Dw; +public: }; diff --git a/System.cxx b/System.cxx index b22ef153..f9f46ce0 100644 --- a/System.cxx +++ b/System.cxx @@ -1,5 +1,26 @@ -#include "System.h" #include // std::replace + +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "System.h" +#include "SSassemblage.h" +#include "Solution.h" +#include "Exchange.h" +#include "GasPhase.h" +#include "cxxKinetics.h" +#include "PPassemblage.h" +#include "SSassemblageSS.h" +#include "SSassemblage.h" +#include "Surface.h" +#include "cxxMix.h" +#include "Reaction.h" +#include "Temperature.h" + + extern void ORCH_write_chemistry_species(std::ostream & chemistry_dat); cxxSystem::cxxSystem(void) { diff --git a/System.h b/System.h index c27c4eb5..a5c0cca3 100644 --- a/System.h +++ b/System.h @@ -1,15 +1,27 @@ #if !defined(SYSTEM_H_INCLUDED) #define SYSTEM_H_INCLUDED -#include "Solution.h" -#include "Exchange.h" -#include "GasPhase.h" -#include "cxxKinetics.h" -#include "PPassemblage.h" -#include "SSassemblage.h" -#include "Surface.h" -#include "cxxMix.h" -#include "Reaction.h" -#include "Temperature.h" +//#include "Solution.h" +//#include "Exchange.h" +//#include "GasPhase.h" +//#include "cxxKinetics.h" +//#include "PPassemblage.h" +//#include "SSassemblage.h" +//#include "Surface.h" +//#include "cxxMix.h" +//#include "Reaction.h" +//#include "Temperature.h" +#include "NameDouble.h" +class cxxSolution; +class cxxExchange; +class cxxGasPhase; +class cxxKinetics; +class cxxPPassemblage; +class cxxSSassemblage; +class cxxSurface; +class cxxReaction; +class cxxTemperature; +class cxxMix; + class cxxSystem { public:cxxSystem(void); diff --git a/Temperature.cxx b/Temperature.cxx index 2ceeb196..86dce37b 100644 --- a/Temperature.cxx +++ b/Temperature.cxx @@ -4,16 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "Temperature.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#include "Parser.h" +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "Temperature.h" +#include "phqalloc.h" +#include "phrqproto.h" + + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/Temperature.h b/Temperature.h index ef7cf2a5..a34818f6 100644 --- a/Temperature.h +++ b/Temperature.h @@ -1,15 +1,14 @@ #if !defined(TEMPERATURE_H_INCLUDED) #define TEMPERATURE_H_INCLUDED -#include "NumKeyword.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector +#include "NumKeyword.h" + class cxxTemperature:public cxxNumKeyword { diff --git a/cxxKinetics.cxx b/cxxKinetics.cxx index f2709a33..f140fd77 100644 --- a/cxxKinetics.cxx +++ b/cxxKinetics.cxx @@ -4,17 +4,24 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "cxxKinetics.h" -#include "KineticsComp.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif + +#include "cxxKinetics.h" +#include "cxxMix.h" + +#include "phqalloc.h" +#include "phrqproto.h" + + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/cxxKinetics.h b/cxxKinetics.h index a38a4311..bef2abab 100644 --- a/cxxKinetics.h +++ b/cxxKinetics.h @@ -1,18 +1,15 @@ #if !defined(CXXKINETICS_H_INCLUDED) #define CXXKINETICS_H_INCLUDED -#include "NumKeyword.h" -#define EXTERNAL extern -#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector -#include "char_star.h" +#include "NumKeyword.h" #include "KineticsComp.h" -#include "cxxMix.h" +class cxxMix; class cxxKinetics:public cxxNumKeyword { diff --git a/cxxMix.cxx b/cxxMix.cxx index 8f7145be..79c9895c 100644 --- a/cxxMix.cxx +++ b/cxxMix.cxx @@ -4,16 +4,22 @@ #ifdef _DEBUG #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif - -#include "Utils.h" // define first -#include "cxxMix.h" -#define EXTERNAL extern -#include "global.h" -#include "phqalloc.h" -#include "phrqproto.h" #include // assert #include // std::sort +#include "Utils.h" // define first +#include "Parser.h" +#if !defined(PHREEQC_CLASS) +#define EXTERNAL extern +#include "global.h" +#else +#include "Phreeqc.h" +#endif +#include "cxxMix.h" +#include "phqalloc.h" +#include "phrqproto.h" + + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/cxxMix.h b/cxxMix.h index 05fb92e6..3117af5b 100644 --- a/cxxMix.h +++ b/cxxMix.h @@ -1,16 +1,13 @@ #if !defined(CXXMIX_H_INCLUDED) #define CXXMIX_H_INCLUDED -#include "NumKeyword.h" -//#define EXTERNAL extern -//#include "global.h" #include // assert #include // std::map #include // std::string #include // std::list #include // std::vector -#include "char_star.h" +#include "NumKeyword.h" class cxxMix:public cxxNumKeyword { diff --git a/dumper.cpp b/dumper.cpp index 2341296f..bea4ebb4 100644 --- a/dumper.cpp +++ b/dumper.cpp @@ -1,6 +1,8 @@ -#include "dumper.h" #include // std::replace +#include "dumper.h" +#include "Parser.h" + dumper::dumper(void) { this->file_name = "dump.out"; diff --git a/dumper.h b/dumper.h index f951aa96..d5ee1c0f 100644 --- a/dumper.h +++ b/dumper.h @@ -4,8 +4,9 @@ #include // std::string #include // std::list #include // std::vector -#include "Parser.h" #include "StorageBinList.h" +class CParser; + class dumper { public: diff --git a/runner.cpp b/runner.cpp index 092cb8f3..1a8952bf 100644 --- a/runner.cpp +++ b/runner.cpp @@ -1,5 +1,5 @@ #include "runner.h" - +#include "Parser.h" runner::runner(void) { this->time_step = 0; diff --git a/runner.h b/runner.h index fb407ebd..11073164 100644 --- a/runner.h +++ b/runner.h @@ -2,8 +2,10 @@ #define RUNNER_H_INCLUDED #include // std::set #include // std::string -#include "Parser.h" + #include "StorageBinList.h" +class CParser; + class runner { public: