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
This commit is contained in:
David L Parkhurst 2009-12-07 19:49:38 +00:00
parent e65ab2ea73
commit 2b76f04a8b
55 changed files with 549 additions and 429 deletions

View File

@ -5,16 +5,23 @@
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <iostream> // std::cout std::cerr #include <iostream> // std::cout std::cerr
#include <cassert> // assert
#include <algorithm> // std::sort
#include <float.h>
#include "Utils.h" // define first #include "Utils.h" // define first
#include "ExchComp.h" #if !defined(PHREEQC_CLASS)
#include "Dictionary.h"
#define EXTERNAL extern #define EXTERNAL extern
#include "global.h" #include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "ExchComp.h"
#include "Dictionary.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "output.h" #include "output.h"
#include <cassert> // assert
#include <algorithm> // std::sort
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction

View File

@ -1,15 +1,14 @@
#if !defined(EXCHCOMP_H_INCLUDED) #if !defined(EXCHCOMP_H_INCLUDED)
#define EXCHCOMP_H_INCLUDED #define EXCHCOMP_H_INCLUDED
#include "NameDouble.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NameDouble.h"
class cxxExchComp class cxxExchComp
{ {

View File

@ -4,18 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <iostream> // std::cout std::cerr #include <iostream> // std::cout std::cerr
#include "Utils.h" // define first #include <cassert> // assert
#include "Exchange.h" #include <algorithm> // std::sort
#include "ExchComp.h"
#include "Utils.h" // define first
#if !defined(PHREEQC_CLASS)
#define EXTERNAL extern #define EXTERNAL extern
#include "global.h" #include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "cxxMix.h"
#include "Exchange.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "output.h" #include "output.h"
#include <cassert> // assert
#include <algorithm> // std::sort
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
@ -551,10 +555,31 @@ cxxExchange::totalize()
this->totals.clear(); this->totals.clear();
// component structures // component structures
for (std::map < std::string, cxxExchComp >::const_iterator it = exchComps.begin(); 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_extensive((*it).second.get_totals(), 1.0);
this->totals.add("Charge", (*it).second.get_charge_balance()); this->totals.add("Charge", (*it).second.get_charge_balance());
} }
return; 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;
};

View File

@ -1,26 +1,25 @@
#if !defined(EXCHANGE_H_INCLUDED) #if !defined(EXCHANGE_H_INCLUDED)
#define EXCHANGE_H_INCLUDED #define EXCHANGE_H_INCLUDED
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include "NumKeyword.h"
#include "ExchComp.h" #include "ExchComp.h"
#include "cxxMix.h" #include "NameDouble.h"
class cxxMix;
class cxxExchange:public cxxNumKeyword class cxxExchange:public cxxNumKeyword
{ {
public: public:
cxxExchange(); cxxExchange();
cxxExchange(int n_user); cxxExchange(int n_user);
cxxExchange(struct exchange *); cxxExchange(struct exchange *);
cxxExchange(const std::map < int, cxxExchange > &exchange_map, cxxExchange(const std::map < int, cxxExchange > &exchange_map,
cxxMix & mx, int n_user); cxxMix & mx, int n_user);
~cxxExchange(); ~cxxExchange();
struct exchange *cxxExchange2exchange(); struct exchange *cxxExchange2exchange();
@ -34,25 +33,13 @@ class cxxExchange:public cxxNumKeyword
bool get_related_rate(void); bool get_related_rate(void);
bool get_pitzer_exchange_gammas() bool get_pitzer_exchange_gammas();
{ void set_pitzer_exchange_gammas(bool b);
return this->pitzer_exchange_gammas;
}
void set_pitzer_exchange_gammas(bool b)
{
this->pitzer_exchange_gammas = b;
}
std::map < std::string, cxxExchComp > &get_exchComps(void) std::map < std::string, cxxExchComp > &get_exchComps(void);
{
return (this->exchComps);
}
void totalize(); void totalize();
const cxxNameDouble & get_totals() const const cxxNameDouble & get_totals() const;
{
return totals;
};
#ifdef USE_MPI #ifdef USE_MPI
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles); void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);

View File

@ -4,16 +4,23 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <cassert> // assert
#include <algorithm> // std::sort
#include <float.h>
#include "Utils.h" // define first #include "Utils.h" // define first
#include "GasPhase.h" #if !defined(PHREEQC_CLASS)
#define EXTERNAL extern #define EXTERNAL extern
#include "global.h" #include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "GasPhase.h"
#include "cxxMix.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "output.h" #include "output.h"
#include <cassert> // assert
#include <algorithm> // std::sort
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction

View File

@ -1,17 +1,15 @@
#if !defined(GASPHASE_H_INCLUDED) #if !defined(GASPHASE_H_INCLUDED)
#define GASPHASE_H_INCLUDED #define GASPHASE_H_INCLUDED
#include "NumKeyword.h"
#include "NameDouble.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "cxxMix.h" #include "NumKeyword.h"
#include "NameDouble.h"
class cxxMix;
class cxxGasPhase:public cxxNumKeyword class cxxGasPhase:public cxxNumKeyword
{ {

View File

@ -4,18 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <cassert> // assert
#include <algorithm> // std::sort
#include <sstream>
#include "ISolution.h" #include "Utils.h" // define first
#include "ISolutionComp.h" #if !defined(PHREEQC_CLASS)
#define EXTERNAL extern #define EXTERNAL extern
#include "global.h" #include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "ISolution.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "output.h" #include "output.h"
#include <cassert> // assert
#include <algorithm> // std::sort
#include <sstream>
#ifdef ORCHESTRA #ifdef ORCHESTRA
extern void ORCH_write_chemistry_species(std::ostream & chemistry_dat); extern void ORCH_write_chemistry_species(std::ostream & chemistry_dat);
#endif #endif

View File

@ -1,11 +1,6 @@
#if !defined(ISOLUTION_H_INCLUDED) #if !defined(ISOLUTION_H_INCLUDED)
#define ISOLUTION_H_INCLUDED #define ISOLUTION_H_INCLUDED
//#include "Parser.h"
#include "ISolutionComp.h"
#include "NumKeyword.h"
#include "Solution.h"
//#include "Isotope.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
@ -15,6 +10,11 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include "ISolutionComp.h"
#include "NumKeyword.h"
#include "Solution.h"
class cxxISolution:public cxxSolution class cxxISolution:public cxxSolution
{ {

View File

@ -1,13 +1,16 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include "ISolutionComp.h"
#include "ISolution.h"
#include "Utils.h"
#include <cassert> #include <cassert>
#include "Utils.h"
#if !defined(PHREEQC_CLASS)
#define EXTERNAL extern #define EXTERNAL extern
#include "global.h" #include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "ISolutionComp.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "output.h" #include "output.h"

View File

@ -1,13 +1,6 @@
#if !defined(ISOLUTIONCOMP_H_INCLUDED) #if !defined(ISOLUTIONCOMP_H_INCLUDED)
#define 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 <string> #include <string>
#include <map> // std::map #include <map> // std::map
#include <vector> #include <vector>

View File

@ -4,17 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #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 <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,15 +1,14 @@
#if !defined(KINETICSCOMP_H_INCLUDED) #if !defined(KINETICSCOMP_H_INCLUDED)
#define KINETICSCOMP_H_INCLUDED #define KINETICSCOMP_H_INCLUDED
#include "NameDouble.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NameDouble.h"
class cxxKineticsComp class cxxKineticsComp
{ {

View File

@ -4,19 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <iostream> // 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 <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // std::sort
#include <map> // std::sort #include <map> // std::sort
#include <iostream> // 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 // Construction/Destruction

View File

@ -9,6 +9,7 @@
#include <vector> // std::vector #include <vector> // std::vector
#include "Parser.h" #include "Parser.h"
class cxxNameDouble:public class cxxNameDouble:public
std::map < std::string, double > std::map < std::string, double >
{ {

View File

@ -6,6 +6,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
#include "NumKeyword.h" #include "NumKeyword.h"
#include "Parser.h"
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction

View File

@ -1,12 +1,11 @@
#if !defined(NUMKEYWORD_H_INCLUDED) #if !defined(NUMKEYWORD_H_INCLUDED)
#define NUMKEYWORD_H_INCLUDED #define NUMKEYWORD_H_INCLUDED
#include "Parser.h" //#include "Parser.h"
#include <ostream> // std::ostream #include <ostream> // std::ostream
#include <string> // std::string #include <string> // std::string
//#define EXTERNAL extern class CParser;
//#include "global.h"
//#include "phrqproto.h"
extern char *string_duplicate(const char *); extern char *string_duplicate(const char *);
class cxxNumKeyword class cxxNumKeyword

View File

@ -4,17 +4,21 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #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 <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,17 +1,15 @@
#if !defined(PPASSEMBLAGE_H_INCLUDED) #if !defined(PPASSEMBLAGE_H_INCLUDED)
#define PPASSEMBLAGE_H_INCLUDED #define PPASSEMBLAGE_H_INCLUDED
#include "NumKeyword.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NumKeyword.h"
#include "PPassemblageComp.h" #include "PPassemblageComp.h"
#include "cxxMix.h" class cxxMix;
class cxxPPassemblage:public cxxNumKeyword class cxxPPassemblage:public cxxNumKeyword
{ {

View File

@ -4,17 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <cassert> // assert
#include <algorithm> // std::sort
#include "Utils.h" // define first #include "Utils.h" // define first
#include "PPassemblageComp.h" #if !defined(PHREEQC_CLASS)
#include "Dictionary.h"
#define EXTERNAL extern #define EXTERNAL extern
#include "global.h" #include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "PPassemblageComp.h"
#include "Dictionary.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "output.h" #include "output.h"
#include <cassert> // assert
#include <algorithm> // std::sort
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
@ -365,15 +370,13 @@ cxxPPassemblageComp::read_raw(CParser & parser, bool check)
if (initial_moles_defined == false) if (initial_moles_defined == false)
{ {
parser.incr_input_error(); parser.incr_input_error();
parser. parser.error_msg("Initial_moles not defined for PPassemblageComp input.",
error_msg("Initial_moles not defined for PPassemblageComp input.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
if (dissolve_only_defined == false) if (dissolve_only_defined == false)
{ {
parser.incr_input_error(); parser.incr_input_error();
parser. parser.error_msg("Dissolve_only not defined for PPassemblageComp input.",
error_msg("Dissolve_only not defined for PPassemblageComp input.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
/* don't check to maintain backward compatibility /* don't check to maintain backward compatibility
@ -388,8 +391,7 @@ cxxPPassemblageComp::read_raw(CParser & parser, bool check)
if (force_equality_defined == false) if (force_equality_defined == false)
{ {
parser.incr_input_error(); parser.incr_input_error();
parser. parser.error_msg
error_msg
("Force_equality not defined for PPassemblageComp input.", ("Force_equality not defined for PPassemblageComp input.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }

View File

@ -1,15 +1,14 @@
#if !defined(PPASSEMBLAGECOMP_H_INCLUDED) #if !defined(PPASSEMBLAGECOMP_H_INCLUDED)
#define PPASSEMBLAGECOMP_H_INCLUDED #define PPASSEMBLAGECOMP_H_INCLUDED
#include "NameDouble.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NameDouble.h"
class cxxPPassemblageComp class cxxPPassemblageComp
{ {

View File

@ -4,16 +4,20 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include "Utils.h" // define first
#include "Reaction.h"
#define EXTERNAL extern
#include "global.h"
#include "phqalloc.h"
#include "phrqproto.h"
#include <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,16 +1,15 @@
#if !defined(REACTION_H_INCLUDED) #if !defined(REACTION_H_INCLUDED)
#define REACTION_H_INCLUDED #define REACTION_H_INCLUDED
#include "NumKeyword.h"
#include "NameDouble.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NumKeyword.h"
#include "NameDouble.h"
class cxxReaction:public cxxNumKeyword class cxxReaction:public cxxNumKeyword
{ {

View File

@ -1,6 +1,16 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <iostream>
#include <fstream>
#include <sstream>
#if !defined(PHREEQC_CLASS)
#define EXTERNAL extern
#include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "Parser.h" #include "Parser.h"
#include "Solution.h" #include "Solution.h"
#include "Exchange.h" #include "Exchange.h"
@ -14,14 +24,10 @@
#include "Temperature.h" #include "Temperature.h"
#include "dumper.h" #include "dumper.h"
#include "runner.h" #include "runner.h"
#define EXTERNAL extern #include "cxxMix.h"
#include "global.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "output.h"
#include "phrqproto.h" #include "phrqproto.h"
#include <iostream> #include "output.h"
#include <fstream>
#include <sstream>
static int streamify_to_next_keyword(std::istringstream & lines); static int streamify_to_next_keyword(std::istringstream & lines);
extern int reading_database(void); extern int reading_database(void);

View File

@ -9,17 +9,18 @@
#include <algorithm> // std::sort #include <algorithm> // std::sort
#include "Utils.h" // define first #include "Utils.h" // define first
#if !defined(PHREEQC_CLASS)
#define EXTERNAL extern
#include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "SSassemblage.h" #include "SSassemblage.h"
#include "SSassemblageSS.h" #include "SSassemblageSS.h"
#include "cxxMix.h" #include "cxxMix.h"
#if defined(PHREEQC_CLASS)
#define CLASS_STATIC static
#endif
#include "global_structures.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,14 +1,14 @@
#if !defined(SSASSEMBLAGE_H_INCLUDED) #if !defined(SSASSEMBLAGE_H_INCLUDED)
#define SSASSEMBLAGE_H_INCLUDED #define SSASSEMBLAGE_H_INCLUDED
#include "NumKeyword.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
//#include "SSassemblageSS.h" #include "NumKeyword.h"
#include "NameDouble.h" #include "NameDouble.h"
class cxxSSassemblageSS; class cxxSSassemblageSS;

View File

@ -4,18 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #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 <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,13 +1,14 @@
#if !defined(SSASSEMBLAGESS_H_INCLUDED) #if !defined(SSASSEMBLAGESS_H_INCLUDED)
#define SSASSEMBLAGESS_H_INCLUDED #define SSASSEMBLAGESS_H_INCLUDED
#include "NameDouble.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NameDouble.h"
class cxxSSassemblageSS class cxxSSassemblageSS
{ {

View File

@ -4,19 +4,26 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <cassert> // assert
#include <algorithm> // std::sort
#ifdef USE_MPI #ifdef USE_MPI
//MPICH seems to require mpi.h to be first //MPICH seems to require mpi.h to be first
#include <mpi.h> #include <mpi.h>
#endif #endif
#include "Utils.h" // define first #include "Utils.h" // define first
#include "Solution.h" #if !defined(PHREEQC_CLASS)
#define EXTERNAL extern #define EXTERNAL extern
#include "global.h" #include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "Solution.h"
#include "cxxMix.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "output.h" #include "output.h"
#include <cassert> // assert
#include <algorithm> // std::sort
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,19 +1,17 @@
#if !defined(SOLUTION_H_INCLUDED) #if !defined(SOLUTION_H_INCLUDED)
#define 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 <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <vector> // std::vector #include <vector> // std::vector
#include <iostream> #include <iostream>
#include "NumKeyword.h"
#include "SolutionIsotopeList.h"
#include "NameDouble.h"
class cxxMix;
class cxxSolution:public cxxNumKeyword class cxxSolution:public cxxNumKeyword
{ {

View File

@ -1,16 +1,20 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include "SolutionIsotope.h"
#include "Utils.h"
#include "Parser.h"
#define EXTERNAL extern
#include "global.h"
#include "phqalloc.h"
#include "phrqproto.h"
#include <cassert> #include <cassert>
#include <sstream> // std::ostrstream #include <sstream> // 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): cxxSolutionIsotope::cxxSolutionIsotope(void):
isotope_number(0.0) isotope_number(0.0)
{ {

View File

@ -1,10 +1,10 @@
#if !defined(SOLUTIONISOTOPE_H_INCLUDED) #if !defined(SOLUTIONISOTOPE_H_INCLUDED)
#define SOLUTIONISOTOPE_H_INCLUDED #define SOLUTIONISOTOPE_H_INCLUDED
#include "Parser.h"
#include <ostream> // std::ostream #include <ostream> // std::ostream
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include "Parser.h"
class cxxSolutionIsotope class cxxSolutionIsotope
{ {

View File

@ -1,12 +1,18 @@
#include "Utils.h" // define first #include "Utils.h" // define first
#include "SolutionIsotopeList.h"
#define EXTERNAL extern
#include "global.h"
#include "phqalloc.h"
#include "phrqproto.h"
#include <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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) cxxSolutionIsotopeList::cxxSolutionIsotopeList(void)
// //
// default constructor for cxxSolution // default constructor for cxxSolution

View File

@ -1,18 +1,14 @@
#if !defined(SOLUTIONISOTOPELIST_H_INCLUDED) #if !defined(SOLUTIONISOTOPELIST_H_INCLUDED)
#define SOLUTIONISOTOPELIST_H_INCLUDED #define SOLUTIONISOTOPELIST_H_INCLUDED
//#define EXTERNAL extern
#include "SolutionIsotope.h"
//#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include "Parser.h" #include "SolutionIsotope.h"
class cxxSolutionIsotopeList:public class cxxSolutionIsotopeList:public
std::list < std::list < cxxSolutionIsotope >
cxxSolutionIsotope >
{ {
public: public:
@ -29,7 +25,7 @@ public:
protected: protected:
public: public:
}; };

View File

@ -4,14 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <fstream>
#include <iostream> // std::cout std::cerr
#include <cassert> // assert
#include <algorithm> // std::sort
#ifdef USE_MPI #ifdef USE_MPI
//MPICH seems to require mpi.h to be first //MPICH seems to require mpi.h to be first
#include <mpi.h> #include <mpi.h>
#endif #endif
#include <fstream>
#include <iostream> // std::cout std::cerr
#include "Utils.h" // define first #include "Utils.h" // define first
#if !defined(PHREEQC_CLASS)
#define EXTERNAL extern
#include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "NameDouble.h" #include "NameDouble.h"
#include "StorageBin.h" #include "StorageBin.h"
#include "SSassemblage.h" #include "SSassemblage.h"
@ -26,14 +34,9 @@
#include "cxxMix.h" #include "cxxMix.h"
#include "Reaction.h" #include "Reaction.h"
#include "Temperature.h" #include "Temperature.h"
#define EXTERNAL extern
#include "global.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "output.h" #include "output.h"
#include <cassert> // assert
#include <algorithm> // std::sort
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction

View File

@ -6,9 +6,7 @@
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
//#include "Utils.h" #include "System.h"
//#include "Parser.h"
class cxxSolution; class cxxSolution;
class cxxExchange; class cxxExchange;
class cxxGasPhase; class cxxGasPhase;
@ -16,11 +14,9 @@ class cxxKinetics;
class cxxPPassemblage; class cxxPPassemblage;
class cxxSSassemblage; class cxxSSassemblage;
class cxxSurface; class cxxSurface;
#include "System.h"
class cxxReaction; class cxxReaction;
class cxxTemperature; class cxxTemperature;
class cxxStorageBin class cxxStorageBin
{ {

View File

@ -1,5 +1,7 @@
#include "StorageBinList.h"
#include <algorithm> // std::replace #include <algorithm> // std::replace
#include "StorageBinList.h"
#include "Parser.h"
StorageBinListItem::StorageBinListItem(void) StorageBinListItem::StorageBinListItem(void)
{ {
this->defined = false; this->defined = false;

View File

@ -4,7 +4,9 @@
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "Parser.h"
class CParser;
class StorageBinListItem class StorageBinListItem
{ {
public: public:

View File

@ -4,17 +4,21 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #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 <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,18 +1,16 @@
#if !defined(SURFACE_H_INCLUDED) #if !defined(SURFACE_H_INCLUDED)
#define SURFACE_H_INCLUDED #define SURFACE_H_INCLUDED
#include "NumKeyword.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NumKeyword.h"
#include "SurfaceComp.h" #include "SurfaceComp.h"
#include "SurfaceCharge.h" #include "SurfaceCharge.h"
#include "cxxMix.h" class cxxMix;
class cxxSurface:public cxxNumKeyword class cxxSurface:public cxxNumKeyword
{ {

View File

@ -4,26 +4,30 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #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 <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
cxxSurfaceCharge::cxxSurfaceCharge() cxxSurfaceCharge::cxxSurfaceCharge()
// //
// default constructor for cxxSurfaceCharge // default constructor for cxxSurfaceCharge
// //
{ {
specific_area = 0.0; specific_area = 0.0;
grams = 0.0; grams = 0.0;
@ -38,10 +42,10 @@ cxxSurfaceCharge::cxxSurfaceCharge()
} }
cxxSurfaceCharge::cxxSurfaceCharge(struct surface_charge *surf_charge_ptr) 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) diffuse_layer_totals(surf_charge_ptr->diffuse_layer_totals)
{ {
this->set_name(surf_charge_ptr->name); this->set_name(surf_charge_ptr->name);
@ -61,7 +65,7 @@ cxxSurfaceCharge::~cxxSurfaceCharge()
} }
struct master * struct master *
cxxSurfaceCharge::get_psi_master() cxxSurfaceCharge::get_psi_master()
{ {
struct master *master_ptr = NULL; struct master *master_ptr = NULL;
std::string str = this->name; std::string str = this->name;
@ -81,9 +85,9 @@ cxxSurfaceCharge::get_psi_master()
struct surface_charge * struct surface_charge *
cxxSurfaceCharge::cxxSurfaceCharge2surface_charge(std::map < std::string, cxxSurfaceCharge > &el) 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 *surf_charge_ptr =
(struct surface_charge *) (struct surface_charge *)
@ -93,7 +97,7 @@ struct surface_charge *
int i = 0; int i = 0;
for (std::map < std::string, cxxSurfaceCharge >::iterator it = el.begin(); 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()); surf_charge_ptr[i].name = string_hsave((*it).second.name.c_str());
assert((*it).second.name.size() > 0); assert((*it).second.name.size() > 0);
@ -265,7 +269,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->name.clear(); this->name.clear();
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected string value for name.", parser.error_msg("Expected string value for name.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
else else
{ {
@ -280,7 +284,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->specific_area = 0; this->specific_area = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for specific_area.", parser.error_msg("Expected numeric value for specific_area.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
specific_area_defined = true; specific_area_defined = true;
break; break;
@ -291,7 +295,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->grams = 0; this->grams = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for grams.", parser.error_msg("Expected numeric value for grams.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
grams_defined = true; grams_defined = true;
break; break;
@ -303,7 +307,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->charge_balance = 0; this->charge_balance = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for charge_balance.", parser.error_msg("Expected numeric value for charge_balance.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
charge_balance_defined = true; charge_balance_defined = true;
break; break;
@ -314,7 +318,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->mass_water = 0; this->mass_water = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for mass_water.", parser.error_msg("Expected numeric value for mass_water.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
mass_water_defined = true; mass_water_defined = true;
break; break;
@ -326,7 +330,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->la_psi = 0; this->la_psi = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for la_psi.", parser.error_msg("Expected numeric value for la_psi.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
la_psi_defined = true; la_psi_defined = true;
break; break;
@ -340,7 +344,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
parser. parser.
error_msg error_msg
("Expected element name and molality for SurfaceCharge diffuse_layer_totals.", ("Expected element name and molality for SurfaceCharge diffuse_layer_totals.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
opt_save = 6; opt_save = 6;
break; break;
@ -351,7 +355,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->la_psi1 = 0; this->la_psi1 = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for la_psi1.", parser.error_msg("Expected numeric value for la_psi1.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
la_psi1_defined = true; la_psi1_defined = true;
break; break;
@ -362,7 +366,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->la_psi2 = 0; this->la_psi2 = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for la_psi.", parser.error_msg("Expected numeric value for la_psi.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
la_psi2_defined = true; la_psi2_defined = true;
break; break;
@ -373,7 +377,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->capacitance[0] = 0; this->capacitance[0] = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for capacitance0.", parser.error_msg("Expected numeric value for capacitance0.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
capacitance0_defined = true; capacitance0_defined = true;
break; break;
@ -384,7 +388,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
this->capacitance[1] = 0; this->capacitance[1] = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for capacitance1.", parser.error_msg("Expected numeric value for capacitance1.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
capacitance1_defined = true; capacitance1_defined = true;
break; break;

View File

@ -1,23 +1,22 @@
#if !defined(SURFACECHARGE_H_INCLUDED) #if !defined(SURFACECHARGE_H_INCLUDED)
#define SURFACECHARGE_H_INCLUDED #define SURFACECHARGE_H_INCLUDED
#include "NameDouble.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NameDouble.h"
class cxxSurfaceCharge class cxxSurfaceCharge
{ {
public: public:
cxxSurfaceCharge(); cxxSurfaceCharge();
cxxSurfaceCharge(struct surface_charge *); cxxSurfaceCharge(struct surface_charge *);
~cxxSurfaceCharge(); ~cxxSurfaceCharge();
struct master *get_psi_master(); struct master *get_psi_master();

View File

@ -4,26 +4,30 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include <cassert> // assert
#include <algorithm> // std::sort
#include "Utils.h" // define first #include "Utils.h" // define first
#include "SurfaceComp.h" #if !defined(PHREEQC_CLASS)
#include "Dictionary.h"
#define EXTERNAL extern #define EXTERNAL extern
#include "global.h" #include "global.h"
#else
#include "Phreeqc.h"
#endif
#include "SurfaceComp.h"
#include "Dictionary.h"
#include "phqalloc.h" #include "phqalloc.h"
#include "phrqproto.h" #include "phrqproto.h"
#include "output.h" #include "output.h"
#include <cassert> // assert
#include <algorithm> // std::sort
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
cxxSurfaceComp::cxxSurfaceComp() cxxSurfaceComp::cxxSurfaceComp()
// //
// default constructor for cxxSurfaceComp // default constructor for cxxSurfaceComp
// //
{ {
formula_totals.type = cxxNameDouble::ND_ELT_MOLES; formula_totals.type = cxxNameDouble::ND_ELT_MOLES;
formula_z = 0.0; formula_z = 0.0;
@ -37,10 +41,10 @@ cxxSurfaceComp::cxxSurfaceComp()
} }
cxxSurfaceComp::cxxSurfaceComp(struct surface_comp *surf_comp_ptr) 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), formula_totals(surf_comp_ptr->formula_totals),
totals(surf_comp_ptr->totals) totals(surf_comp_ptr->totals)
{ {
@ -61,12 +65,12 @@ cxxSurfaceComp::~cxxSurfaceComp()
} }
struct master * struct master *
cxxSurfaceComp::get_master() cxxSurfaceComp::get_master()
{ {
struct master *master_ptr = NULL; struct master *master_ptr = NULL;
//for (std::map <char *, double, CHARSTAR_LESS>::iterator it = totals.begin(); it != totals.end(); it++) { //for (std::map <char *, double, CHARSTAR_LESS>::iterator it = totals.begin(); it != totals.end(); it++) {
for (cxxNameDouble::iterator it = this->totals.begin(); for (cxxNameDouble::iterator it = this->totals.begin();
it != this->totals.end(); it++) it != this->totals.end(); it++)
{ {
/* Find master species */ /* Find master species */
char *eltName = string_hsave(it->first.c_str()); char *eltName = string_hsave(it->first.c_str());
@ -100,9 +104,9 @@ cxxSurfaceComp::get_master()
struct surface_comp * struct surface_comp *
cxxSurfaceComp::cxxSurfaceComp2surface_comp(std::map < std::string, cxxSurfaceComp > &el) 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 *surf_comp_ptr =
(struct surface_comp *) (struct surface_comp *)
@ -112,7 +116,7 @@ struct surface_comp *
int i = 0; int i = 0;
for (std::map < std::string, cxxSurfaceComp >::iterator it = el.begin(); 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()); surf_comp_ptr[i].formula = string_hsave((*it).second.formula.c_str());
assert((*it).second.formula.size() > 0); assert((*it).second.formula.size() > 0);
@ -306,7 +310,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->formula.clear(); this->formula.clear();
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected string value for formula.", parser.error_msg("Expected string value for formula.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
else else
{ {
@ -321,7 +325,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->moles = 0; this->moles = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for moles.", parser.error_msg("Expected numeric value for moles.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
moles_defined = true; moles_defined = true;
break; break;
@ -332,7 +336,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->la = 0; this->la = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for la.", parser.error_msg("Expected numeric value for la.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
la_defined = true; la_defined = true;
break; break;
@ -343,7 +347,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->charge_number = 0; this->charge_number = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected integer value for charge_number.", parser.error_msg("Expected integer value for charge_number.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
charge_number_defined = true; charge_number_defined = true;
break; break;
@ -354,7 +358,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->charge_balance = 0; this->charge_balance = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for charge_balance.", parser.error_msg("Expected numeric value for charge_balance.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
charge_balance_defined = true; charge_balance_defined = true;
break; break;
@ -365,7 +369,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->phase_name.clear(); this->phase_name.clear();
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected string value for phase_name.", parser.error_msg("Expected string value for phase_name.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
else else
{ {
@ -379,7 +383,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->rate_name.clear(); this->rate_name.clear();
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected string value for rate_name.", parser.error_msg("Expected string value for rate_name.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
else else
{ {
@ -394,7 +398,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
parser.incr_input_error(); parser.incr_input_error();
parser. parser.
error_msg("Expected numeric value for phase_proportion.", error_msg("Expected numeric value for phase_proportion.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
break; break;
@ -406,7 +410,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
parser. parser.
error_msg error_msg
("Expected element name and molality for SurfaceComp totals.", ("Expected element name and molality for SurfaceComp totals.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
opt_save = 8; opt_save = 8;
break; break;
@ -417,7 +421,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->formula_z = 0; this->formula_z = 0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for formula_z.", parser.error_msg("Expected numeric value for formula_z.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
formula_z_defined = true; formula_z_defined = true;
break; break;
@ -430,7 +434,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
parser. parser.
error_msg error_msg
("Expected element name and molality for SurfaceComp formula totals.", ("Expected element name and molality for SurfaceComp formula totals.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
opt_save = 10; opt_save = 10;
break; break;
@ -441,7 +445,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
this->Dw = 0.0; this->Dw = 0.0;
parser.incr_input_error(); parser.incr_input_error();
parser.error_msg("Expected numeric value for Dw.", parser.error_msg("Expected numeric value for Dw.",
CParser::OT_CONTINUE); CParser::OT_CONTINUE);
} }
Dw_defined = true; Dw_defined = true;
break; break;
@ -658,3 +662,77 @@ cxxSurfaceComp::multiply(double extensive)
//char *rate_name; //char *rate_name;
//double Dw; //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));
};

View File

@ -1,136 +1,60 @@
#if !defined(SURFACECOMP_H_INCLUDED) #if !defined(SURFACECOMP_H_INCLUDED)
#define SURFACECOMP_H_INCLUDED #define SURFACECOMP_H_INCLUDED
#include "NameDouble.h"
#define EXTERNAL extern
#include "global.h"
#include "phrqproto.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NameDouble.h"
class cxxSurfaceComp class cxxSurfaceComp
{ {
public: public:
cxxSurfaceComp(); cxxSurfaceComp();
cxxSurfaceComp(struct surface_comp *); cxxSurfaceComp(struct surface_comp *);
~cxxSurfaceComp(); ~cxxSurfaceComp();
struct master *get_master(); struct master *get_master();
const std::string &get_phase_name() const const std::string &get_phase_name() const;
{ void set_phase_name(char * f);
return this->phase_name; const std::string &get_rate_name() const;
} void set_rate_name(char * f);
void set_phase_name(char * f) const std::string &get_formula() const;
{ void set_formula(char * f);
if (f != NULL) double get_charge_balance() const;
this->phase_name = std::string(f); void set_charge_balance(double d);
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;
}
static struct surface_comp *cxxSurfaceComp2surface_comp(std::map < std::string, cxxSurfaceComp > &el); 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_xml(std::ostream & os, unsigned int indent = 0) const;
void dump_raw(std::ostream & s_oss, unsigned int indent) const; void dump_raw(std::ostream & s_oss, unsigned int indent) const;
void read_raw(CParser & parser, bool check = true); void read_raw(CParser & parser, bool check = true);
const cxxNameDouble & get_totals() const const cxxNameDouble & get_totals() const;
{
return (this->totals);
};
void add(const cxxSurfaceComp & comp, double extensive); void add(const cxxSurfaceComp & comp, double extensive);
void multiply(double extensive); void multiply(double extensive);
std::string charge_name();
std::string charge_name() static std::string get_charge_name(char *token);
{
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));
};
#ifdef USE_MPI #ifdef USE_MPI
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles); void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd); void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
#endif #endif
protected: protected:
std::string formula; std::string formula;
cxxNameDouble formula_totals; cxxNameDouble formula_totals;
double formula_z; double formula_z;
double moles; double moles;
cxxNameDouble totals; cxxNameDouble totals;
double la; double la;
//int charge_number; //int charge_number;
double charge_balance; double charge_balance;
std::string phase_name; std::string phase_name;
double phase_proportion; double phase_proportion;
std::string rate_name; std::string rate_name;
double Dw; double Dw;
public: public:
}; };

View File

@ -1,5 +1,26 @@
#include "System.h"
#include <algorithm> // std::replace #include <algorithm> // 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); extern void ORCH_write_chemistry_species(std::ostream & chemistry_dat);
cxxSystem::cxxSystem(void) cxxSystem::cxxSystem(void)
{ {

View File

@ -1,15 +1,27 @@
#if !defined(SYSTEM_H_INCLUDED) #if !defined(SYSTEM_H_INCLUDED)
#define SYSTEM_H_INCLUDED #define SYSTEM_H_INCLUDED
#include "Solution.h" //#include "Solution.h"
#include "Exchange.h" //#include "Exchange.h"
#include "GasPhase.h" //#include "GasPhase.h"
#include "cxxKinetics.h" //#include "cxxKinetics.h"
#include "PPassemblage.h" //#include "PPassemblage.h"
#include "SSassemblage.h" //#include "SSassemblage.h"
#include "Surface.h" //#include "Surface.h"
#include "cxxMix.h" //#include "cxxMix.h"
#include "Reaction.h" //#include "Reaction.h"
#include "Temperature.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 class cxxSystem
{ {
public:cxxSystem(void); public:cxxSystem(void);

View File

@ -4,16 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include "Utils.h" // define first
#include "Temperature.h"
#define EXTERNAL extern
#include "global.h"
#include "phqalloc.h"
#include "phrqproto.h"
#include <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,15 +1,14 @@
#if !defined(TEMPERATURE_H_INCLUDED) #if !defined(TEMPERATURE_H_INCLUDED)
#define TEMPERATURE_H_INCLUDED #define TEMPERATURE_H_INCLUDED
#include "NumKeyword.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "NumKeyword.h"
class cxxTemperature:public cxxNumKeyword class cxxTemperature:public cxxNumKeyword
{ {

View File

@ -4,17 +4,24 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #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 <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,18 +1,15 @@
#if !defined(CXXKINETICS_H_INCLUDED) #if !defined(CXXKINETICS_H_INCLUDED)
#define CXXKINETICS_H_INCLUDED #define CXXKINETICS_H_INCLUDED
#include "NumKeyword.h"
#define EXTERNAL extern
#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "char_star.h" #include "NumKeyword.h"
#include "KineticsComp.h" #include "KineticsComp.h"
#include "cxxMix.h" class cxxMix;
class cxxKinetics:public cxxNumKeyword class cxxKinetics:public cxxNumKeyword
{ {

View File

@ -4,16 +4,22 @@
#ifdef _DEBUG #ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif #endif
#include "Utils.h" // define first
#include "cxxMix.h"
#define EXTERNAL extern
#include "global.h"
#include "phqalloc.h"
#include "phrqproto.h"
#include <cassert> // assert #include <cassert> // assert
#include <algorithm> // std::sort #include <algorithm> // 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 // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,16 +1,13 @@
#if !defined(CXXMIX_H_INCLUDED) #if !defined(CXXMIX_H_INCLUDED)
#define CXXMIX_H_INCLUDED #define CXXMIX_H_INCLUDED
#include "NumKeyword.h"
//#define EXTERNAL extern
//#include "global.h"
#include <cassert> // assert #include <cassert> // assert
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "char_star.h" #include "NumKeyword.h"
class cxxMix:public cxxNumKeyword class cxxMix:public cxxNumKeyword
{ {

View File

@ -1,6 +1,8 @@
#include "dumper.h"
#include <algorithm> // std::replace #include <algorithm> // std::replace
#include "dumper.h"
#include "Parser.h"
dumper::dumper(void) dumper::dumper(void)
{ {
this->file_name = "dump.out"; this->file_name = "dump.out";

View File

@ -4,8 +4,9 @@
#include <string> // std::string #include <string> // std::string
#include <list> // std::list #include <list> // std::list
#include <vector> // std::vector #include <vector> // std::vector
#include "Parser.h"
#include "StorageBinList.h" #include "StorageBinList.h"
class CParser;
class dumper class dumper
{ {
public: public:

View File

@ -1,5 +1,5 @@
#include "runner.h" #include "runner.h"
#include "Parser.h"
runner::runner(void) runner::runner(void)
{ {
this->time_step = 0; this->time_step = 0;

View File

@ -2,8 +2,10 @@
#define RUNNER_H_INCLUDED #define RUNNER_H_INCLUDED
#include <set> // std::set #include <set> // std::set
#include <string> // std::string #include <string> // std::string
#include "Parser.h"
#include "StorageBinList.h" #include "StorageBinList.h"
class CParser;
class runner class runner
{ {
public: public: