indented header files.

removed ^M from System.h





git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@3169 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2008-10-31 15:32:53 +00:00
parent 3313c814a9
commit d37ed2c6ae
30 changed files with 1776 additions and 1227 deletions

View File

@ -19,7 +19,8 @@ public:
void add_phreeqc(); void add_phreeqc();
int size() { int size()
{
return (int) stringkey.size(); return (int) stringkey.size();
} }

View File

@ -22,7 +22,8 @@ public:
struct master *get_master(); struct master *get_master();
static struct exch_comp *cxxExchComp2exch_comp(std::list<cxxExchComp>& el); static struct exch_comp *cxxExchComp2exch_comp(std::list < cxxExchComp >
&el);
void dump_xml(std::ostream & os, unsigned int indent = 0) const; void dump_xml(std::ostream & os, unsigned int indent = 0) const;
@ -30,34 +31,94 @@ public:
void read_raw(CParser & parser); void read_raw(CParser & parser);
char * get_formula()const { return this->formula;} char *get_formula() const
void set_formula(char * cstring) { this->formula = cstring;} {
double get_moles()const { return this->moles;} return this->formula;
void set_moles(double d) { this->moles = d;} }
double get_la()const { return this->la;} void set_formula(char *cstring)
void set_la(double d) { this->la = d;} {
double get_charge_balance()const { return this->charge_balance;} this->formula = cstring;
void set_charge_balance(double d) { this->charge_balance = d;} }
char * get_phase_name()const { return this->phase_name;} double get_moles() const
void set_phase_name(char * cstring) { this->phase_name = cstring;} {
double get_phase_proportion()const { return this->phase_proportion;} return this->moles;
void set_phase_proportion(double d) { this->phase_proportion = d;} }
char * get_rate_name()const { return this->rate_name;} void set_moles(double d)
void set_rate_name(char * cstring) { this->rate_name = cstring;} {
double get_formula_z()const { return this->formula_z;} this->moles = d;
void set_formula_z(double d) { this->formula_z = d;} }
double get_la() const
{
return this->la;
}
void set_la(double d)
{
this->la = d;
}
double get_charge_balance() const
{
return this->charge_balance;
}
void set_charge_balance(double d)
{
this->charge_balance = d;
}
char *get_phase_name() const
{
return this->phase_name;
}
void set_phase_name(char *cstring)
{
this->phase_name = cstring;
}
double get_phase_proportion() const
{
return this->phase_proportion;
}
void set_phase_proportion(double d)
{
this->phase_proportion = d;
}
char *get_rate_name() const
{
return this->rate_name;
}
void set_rate_name(char *cstring)
{
this->rate_name = cstring;
}
double get_formula_z() const
{
return this->formula_z;
}
void set_formula_z(double d)
{
this->formula_z = d;
}
void set_totals(struct elt_list *e_l, int count) void set_totals(struct elt_list *e_l, int count)
{this->totals = cxxNameDouble(e_l, count);} {
this->totals = cxxNameDouble(e_l, count);
}
void set_totals(struct elt_list *e_l) void set_totals(struct elt_list *e_l)
{this->totals = cxxNameDouble(e_l);} {
this->totals = cxxNameDouble(e_l);
}
void set_totals(cxxNameDouble nd) void set_totals(cxxNameDouble nd)
{this->totals = nd;} {
this->totals = nd;
}
void set_formula_totals(struct elt_list *e_l, int count) void set_formula_totals(struct elt_list *e_l, int count)
{this->formula_totals = cxxNameDouble(e_l, count);} {
this->formula_totals = cxxNameDouble(e_l, count);
}
void set_formula_totals(struct elt_list *e_l) void set_formula_totals(struct elt_list *e_l)
{this->formula_totals = cxxNameDouble(e_l);} {
this->formula_totals = cxxNameDouble(e_l);
}
void set_formula_totals(cxxNameDouble nd) void set_formula_totals(cxxNameDouble nd)
{this->formula_totals = nd;} {
this->formula_totals = nd;
}
const cxxNameDouble & get_totals() const const cxxNameDouble & get_totals() const
{ {

View File

@ -18,7 +18,8 @@ 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, cxxMix &mx, int n_user); cxxExchange(const std::map < int, cxxExchange > &exchange_map,
cxxMix & mx, int n_user);
~cxxExchange(); ~cxxExchange();
struct exchange *cxxExchange2exchange(); struct exchange *cxxExchange2exchange();
@ -33,14 +34,17 @@ public:
bool get_related_rate(void); bool get_related_rate(void);
bool get_pitzer_exchange_gammas() { bool get_pitzer_exchange_gammas()
{
return this->pitzer_exchange_gammas; return this->pitzer_exchange_gammas;
} }
void set_pitzer_exchange_gammas(bool b) { void set_pitzer_exchange_gammas(bool b)
{
this->pitzer_exchange_gammas = b; this->pitzer_exchange_gammas = b;
} }
std::list<cxxExchComp> &get_exchComps(void) { std::list < cxxExchComp > &get_exchComps(void)
{
return (this->exchComps); return (this->exchComps);
} }
void totalize(); void totalize();

View File

@ -20,10 +20,12 @@ class cxxGasPhase : public cxxNumKeyword
public: public:
cxxGasPhase(); cxxGasPhase();
cxxGasPhase(struct gas_phase *); cxxGasPhase(struct gas_phase *);
cxxGasPhase(const std::map<int, cxxGasPhase> &entity_map, cxxMix &mx, int n_user); cxxGasPhase(const std::map < int, cxxGasPhase > &entity_map,
cxxMix & mx, int n_user);
~cxxGasPhase(); ~cxxGasPhase();
enum GP_TYPE { enum GP_TYPE
{
GP_PRESSURE = 0, GP_PRESSURE = 0,
GP_VOLUME = 1 GP_VOLUME = 1
}; };

View File

@ -30,11 +30,23 @@ public:
struct solution *cxxISolution2solution(); struct solution *cxxISolution2solution();
double get_density()const {return this->density;} double get_density() const
void set_density(double density) {this->density = density;} {
return this->density;
}
void set_density(double density)
{
this->density = density;
}
std::string get_units()const {return units;} std::string get_units() const
void set_units(std::string units) {units = units;} {
return units;
}
void set_units(std::string units)
{
units = units;
}
//char * get_redox()const {return this->pe[this->default_pe].get_name();} //char * get_redox()const {return this->pe[this->default_pe].get_name();}
@ -43,7 +55,8 @@ public:
void ConvertUnits(); void ConvertUnits();
#ifdef ORCHESTRA #ifdef ORCHESTRA
void ORCH_write(std::ostream &chemistry_dat, std::ostream &input_dat, std::ostream &output_dat); void ORCH_write(std::ostream & chemistry_dat, std::ostream & input_dat,
std::ostream & output_dat);
void ORCH_write_chemistry(std::ostream & chemistry_dat); void ORCH_write_chemistry(std::ostream & chemistry_dat);
void ORCH_write_input(std::ostream & input_dat); void ORCH_write_input(std::ostream & input_dat);
void ORCH_write_output_vars(std::ostream & input_dat); void ORCH_write_output_vars(std::ostream & input_dat);

View File

@ -30,38 +30,97 @@ public:
void dump_xml(std::ostream & os, unsigned int indent = 0) const; void dump_xml(std::ostream & os, unsigned int indent = 0) const;
char * get_description()const {return this->description;} char *get_description() const
void set_description(char * description) {this->description = description;} {
return this->description;
}
void set_description(char *description)
{
this->description = description;
}
double get_moles()const {return this->moles;} double get_moles() const
void set_moles(double moles) {this->moles = moles;} {
return this->moles;
}
void set_moles(double moles)
{
this->moles = moles;
}
double get_input_conc()const {return this->input_conc;} double get_input_conc() const
void set_input_conc(double input_conc) {this->input_conc = input_conc;} {
return this->input_conc;
}
void set_input_conc(double input_conc)
{
this->input_conc = input_conc;
}
std::string get_units()const {return this->units;} std::string get_units()const
void set_units(char * units) {this->units = units;} {
return this->units;
}
void set_units(char *units)
{
this->units = units;
}
char * get_equation_name()const {return this->equation_name;} char *get_equation_name() const
void set_equation_name(char * equation_name) {this->equation_name = equation_name;} {
return this->equation_name;
}
void set_equation_name(char *equation_name)
{
this->equation_name = equation_name;
}
double get_phase_si()const {return this->phase_si;} double get_phase_si() const
void set_phase_si(int phase_si) {this->phase_si = phase_si;} {
return this->phase_si;
}
void set_phase_si(int phase_si)
{
this->phase_si = phase_si;
}
int get_n_pe()const {return this->n_pe;} int get_n_pe() const
void set_n_pe(int n_pe) {this->n_pe = n_pe;} {
return this->n_pe;
}
void set_n_pe(int n_pe)
{
this->n_pe = n_pe;
}
char *get_as()const {return this->as;} char *get_as() const
void set_as(char *as) {this->as = as;} {
return this->as;
}
void set_as(char *as)
{
this->as = as;
}
//double get_gfw()const {return this->gfw;} //double get_gfw()const {return this->gfw;}
double get_gfw()const {return this->gfw;}; double get_gfw() const
void set_gfw(double gfw) {this->gfw = gfw;} {
return this->gfw;
};
void set_gfw(double gfw)
{
this->gfw = gfw;
}
void set_gfw(); void set_gfw();
bool operator<(const cxxISolutionComp& conc)const { return ::strcmp(this->description, conc.description) < 0; } bool operator<(const cxxISolutionComp & conc) const
{
return::strcmp(this->description, conc.description) < 0;
}
static struct conc * cxxISolutionComp2conc(const std::map <char *, cxxISolutionComp, CHARSTAR_LESS> &t ); static struct conc *cxxISolutionComp2conc(const std::map < char *,
cxxISolutionComp,
CHARSTAR_LESS > &t);
private: private:
char *description; char *description;

View File

@ -20,7 +20,9 @@ public:
cxxKineticsComp(struct kinetics_comp *); cxxKineticsComp(struct kinetics_comp *);
~cxxKineticsComp(); ~cxxKineticsComp();
static struct kinetics_comp *cxxKineticsComp2kinetics_comp(std::list<cxxKineticsComp>& el); static struct kinetics_comp *cxxKineticsComp2kinetics_comp(std::list <
cxxKineticsComp
> &el);
void dump_xml(std::ostream & os, unsigned int indent = 0) const; void dump_xml(std::ostream & os, unsigned int indent = 0) const;
@ -28,7 +30,10 @@ public:
void read_raw(CParser & parser); void read_raw(CParser & parser);
char *get_rate_name()const {return this->rate_name;} char *get_rate_name() const
{
return this->rate_name;
}
#ifdef USE_MPI #ifdef USE_MPI
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd); void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);

View File

@ -11,11 +11,14 @@
//#include "global.h" //#include "global.h"
#include "char_star.h" #include "char_star.h"
#include "Parser.h" #include "Parser.h"
class cxxNameDouble : public std::map <char *, double, CHARSTAR_LESS> class cxxNameDouble:public
std::map < char *, double,
CHARSTAR_LESS >
{ {
public: public:
enum ND_TYPE { enum ND_TYPE
{
ND_ELT_MOLES = 1, ND_ELT_MOLES = 1,
ND_SPECIES_LA = 2, ND_SPECIES_LA = 2,
ND_SPECIES_GAMMA = 3, ND_SPECIES_GAMMA = 3,
@ -29,38 +32,57 @@ public:
cxxNameDouble(struct master_activity *ma, int count, ND_TYPE); cxxNameDouble(struct master_activity *ma, int count, ND_TYPE);
cxxNameDouble(struct name_coef *nc, int count); cxxNameDouble(struct name_coef *nc, int count);
cxxNameDouble(const cxxNameDouble & old, double factor); cxxNameDouble(const cxxNameDouble & old, double factor);
~cxxNameDouble(); ~
cxxNameDouble();
struct elt_list *elt_list(); struct elt_list *
elt_list();
struct master_activity *master_activity()const; struct master_activity *
master_activity() const;
struct conc *conc()const; struct conc *
conc() const;
struct name_coef *name_coef()const; struct name_coef *
name_coef() const;
void dump_xml(std::ostream& s_oss, unsigned int indent)const; void
dump_xml(std::ostream & s_oss, unsigned int indent) const;
void dump_raw(std::ostream& s_oss, unsigned int indent)const; void
dump_raw(std::ostream & s_oss, unsigned int indent) const;
CParser::STATUS_TYPE read_raw(CParser& parser, std::istream::pos_type& pos); CParser::STATUS_TYPE
read_raw(CParser & parser, std::istream::pos_type & pos);
void add_extensive(const cxxNameDouble &old, double factor); void
void add_intensive(const cxxNameDouble &addee, double fthis, double f2); add_extensive(const cxxNameDouble & old, double factor);
void add_log_activities(const cxxNameDouble &addee, double fthis, double f2); void
void add(const char * key, double total); add_intensive(const cxxNameDouble & addee, double fthis, double f2);
void multiply(double factor); void
add_log_activities(const cxxNameDouble & addee, double fthis, double f2);
void
add(const char *key, double total);
void
multiply(double factor);
void insert(char *str, double d) { void
insert(char *str, double d)
{
(*this)[str] = d; (*this)[str] = d;
} }
void mpi_pack(std::vector<int>& ints, std::vector<double>& doubles); void
void mpi_pack(int *ints, int *ii, double *doubles, int *dd); mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
void
mpi_pack(int *ints, int *ii, double *doubles, int *dd);
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd); void
mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
enum ND_TYPE type; enum ND_TYPE
type;
protected: protected:

View File

@ -16,17 +16,42 @@ public:
virtual ~ cxxNumKeyword(); virtual ~ cxxNumKeyword();
char * get_description()const { return string_duplicate(this->description.c_str()); } char *get_description() const
void set_description(std::string str) { this->description = str; } {
void set_description(char * str) { if (str != NULL) this->description = str; } return string_duplicate(this->description.c_str());
}
void set_description(std::string str)
{
this->description = str;
}
void set_description(char *str)
{
if (str != NULL)
this->description = str;
}
int get_n_user()const { return this->n_user; } int get_n_user() const
void set_n_user(int user) { this->n_user = user; } {
return this->n_user;
}
void set_n_user(int user)
{
this->n_user = user;
}
int get_n_user_end()const { return this->n_user_end; } int get_n_user_end() const
void set_n_user_end(int user_end) { this->n_user_end = user_end; } {
return this->n_user_end;
}
void set_n_user_end(int user_end)
{
this->n_user_end = user_end;
}
bool operator<(const cxxNumKeyword& key)const { return (this->n_user < key.n_user); } bool operator<(const cxxNumKeyword & key) const
{
return (this->n_user < key.n_user);
}
virtual void dump_xml(std::ostream & os, unsigned int indent = 0) const; virtual void dump_xml(std::ostream & os, unsigned int indent = 0) const;

View File

@ -20,7 +20,8 @@ class cxxPPassemblage : public cxxNumKeyword
public: public:
cxxPPassemblage(); cxxPPassemblage();
cxxPPassemblage(struct pp_assemblage *); cxxPPassemblage(struct pp_assemblage *);
cxxPPassemblage(const std::map<int, cxxPPassemblage> &entity_map, cxxMix &mx, int n_user); cxxPPassemblage(const std::map < int, cxxPPassemblage > &entity_map,
cxxMix & mx, int n_user);
~cxxPPassemblage(); ~cxxPPassemblage();
struct pp_assemblage *cxxPPassemblage2pp_assemblage(); struct pp_assemblage *cxxPPassemblage2pp_assemblage();
@ -45,7 +46,10 @@ public:
#ifdef ORCHESTRA #ifdef ORCHESTRA
void ORCH_write_chemistry(std::ostream & chemistry_dat); void ORCH_write_chemistry(std::ostream & chemistry_dat);
void ORCH_write_output_vars(std::ostream & outstream); void ORCH_write_output_vars(std::ostream & outstream);
void ORCH_read(std::vector <std::pair <std::string, double> > output_vector, std::vector < std::pair < std::string, double > >::iterator &it); void ORCH_read(std::vector < std::pair < std::string,
double >>output_vector,
std::vector < std::pair < std::string,
double >>::iterator & it);
void ORCH_store_global(std::map < std::string, double >output_map); void ORCH_store_global(std::map < std::string, double >output_map);
#endif #endif

View File

@ -21,7 +21,9 @@ public:
~cxxPPassemblageComp(); ~cxxPPassemblageComp();
static struct pure_phase *cxxPPassemblageComp2pure_phase(std::list<cxxPPassemblageComp>& el); static struct pure_phase *cxxPPassemblageComp2pure_phase(std::list <
cxxPPassemblageComp
> &el);
void dump_xml(std::ostream & os, unsigned int indent = 0) const; void dump_xml(std::ostream & os, unsigned int indent = 0) const;
@ -29,7 +31,10 @@ public:
void read_raw(CParser & parser); void read_raw(CParser & parser);
char *get_name()const {return this->name;} char *get_name() const
{
return this->name;
}
struct phase *get_phase(); struct phase *get_phase();

120
Parser.h
View File

@ -15,11 +15,13 @@ class CParser
public: public:
CParser(std::istream & input); CParser(std::istream & input);
CParser(std::istream & input, std::ostream & output); CParser(std::istream & input, std::ostream & output);
CParser(std::istream& input, std::ostream& output, std::ostream& error); CParser(std::istream & input, std::ostream & output,
std::ostream & error);
virtual ~ CParser(); virtual ~ CParser();
enum LINE_TYPE { enum LINE_TYPE
{
LT_EOF = -1, LT_EOF = -1,
LT_OK = 1, LT_OK = 1,
LT_EMPTY = 2, LT_EMPTY = 2,
@ -27,7 +29,8 @@ public:
LT_OPTION = 8 LT_OPTION = 8
}; };
enum TOKEN_TYPE { enum TOKEN_TYPE
{
TT_EMPTY = 2, TT_EMPTY = 2,
TT_UPPER = 4, TT_UPPER = 4,
TT_LOWER = 5, TT_LOWER = 5,
@ -35,12 +38,14 @@ public:
TT_UNKNOWN = 7 TT_UNKNOWN = 7
}; };
enum FIND_TYPE { enum FIND_TYPE
{
FT_OK = 0, FT_OK = 0,
FT_ERROR = 1 FT_ERROR = 1
}; };
enum KEY_TYPE { enum KEY_TYPE
{
KT_NONE = -1, KT_NONE = -1,
KT_END = 0, KT_END = 0,
KT_EOF = 1, KT_EOF = 1,
@ -51,29 +56,32 @@ public:
KT_PPASSEMBLAGE_RAW = 9, KT_PPASSEMBLAGE_RAW = 9,
KT_SSASSEMBLAGE_RAW = 10, KT_SSASSEMBLAGE_RAW = 10,
KT_SURFACE_RAW = 11 KT_SURFACE_RAW = 11
}; };
enum OPT_TYPE { enum OPT_TYPE
{
OPT_DEFAULT = -4, OPT_DEFAULT = -4,
OPT_ERROR = -3, OPT_ERROR = -3,
OPT_KEYWORD = -2, OPT_KEYWORD = -2,
OPT_EOF = -1 OPT_EOF = -1
}; };
enum ONERROR_TYPE { enum ONERROR_TYPE
{
OT_CONTINUE = 0, OT_CONTINUE = 0,
OT_STOP = 1 OT_STOP = 1
}; };
enum ECHO_OPTION { enum ECHO_OPTION
{
EO_NONE = 0, EO_NONE = 0,
EO_ALL = 1, EO_ALL = 1,
EO_KEYWORDS = 2, EO_KEYWORDS = 2,
EO_NOKEYWORDS = 3 EO_NOKEYWORDS = 3
}; };
enum STATUS_TYPE { enum STATUS_TYPE
{
PARSER_ERROR = 0, PARSER_ERROR = 0,
PARSER_OK = 1 PARSER_OK = 1
}; };
@ -98,7 +106,8 @@ public:
Terminates if EOF and allow_eof == false. Terminates if EOF and allow_eof == false.
*/ */
LINE_TYPE check_line(const std::string& str, bool allow_empty, bool allow_eof, bool allow_keyword, bool print); LINE_TYPE check_line(const std::string & str, bool allow_empty,
bool allow_eof, bool allow_keyword, bool print);
/** /**
Read a line from input file put in "line". Read a line from input file put in "line".
@ -119,22 +128,46 @@ public:
// bool check_key(const std::string::iterator ptr); // bool check_key(const std::string::iterator ptr);
bool check_key(std::string::iterator begin, std::string::iterator end); bool check_key(std::string::iterator begin, std::string::iterator end);
STATUS_TYPE check_units(std::string& tot_units, bool alkalinity, bool check_compatibility, STATUS_TYPE check_units(std::string & tot_units, bool alkalinity,
bool check_compatibility,
const std::string & default_units, bool print); const std::string & default_units, bool print);
KEY_TYPE next_keyword()const { return m_next_keyword; } KEY_TYPE next_keyword() const
int get_option(const std::vector<std::string>& opt_list, std::string::iterator& next_char); {
int get_option(const std::vector<std::string>& opt_list, std::istream::pos_type& next_pos); return m_next_keyword;
int getOptionFromLastLine(const std::vector<std::string>& opt_list, std::string::iterator& next_char); }
int getOptionFromLastLine(const std::vector<std::string>& opt_list, std::istream::pos_type& next_pos); int get_option(const std::vector < std::string > &opt_list,
std::string::iterator & next_char);
int get_option(const std::vector < std::string > &opt_list,
std::istream::pos_type & next_pos);
int getOptionFromLastLine(const std::vector < std::string > &opt_list,
std::string::iterator & next_char);
int getOptionFromLastLine(const std::vector < std::string > &opt_list,
std::istream::pos_type & next_pos);
std::string& line() {return m_line;} std::string & line()
std::istringstream& get_iss() {return m_line_iss;} {
int incr_input_error() {++::input_error; return ++m_input_error;} return m_line;
std::ostream& get_output() {return m_output_stream;} }
int get_input_error() {return m_input_error;} std::istringstream & get_iss()
{
return m_line_iss;
}
int incr_input_error()
{
++::input_error;
return ++m_input_error;
}
std::ostream & get_output()
{
return m_output_stream;
}
int get_input_error()
{
return m_input_error;
}
/** /**
@ -152,7 +185,9 @@ public:
TT_DIGIT TT_DIGIT
TT_UNKNOWN TT_UNKNOWN
*/ */
static TOKEN_TYPE copy_token(std::string& token, std::string::iterator& begin, std::string::iterator& end); static TOKEN_TYPE copy_token(std::string & token,
std::string::iterator & begin,
std::string::iterator & end);
static TOKEN_TYPE token_type(const std::string & token); static TOKEN_TYPE token_type(const std::string & token);
static TOKEN_TYPE copy_token(std::string & token, std::istream & is); static TOKEN_TYPE copy_token(std::string & token, std::istream & is);
TOKEN_TYPE copy_token(std::string & token, std::istream::pos_type & pos); TOKEN_TYPE copy_token(std::string & token, std::istream::pos_type & pos);
@ -170,7 +205,9 @@ public:
end input, points to last position in the equation end input, points to last position in the equation
element input pointer to place to return element character string element input pointer to place to return element character string
*/ */
STATUS_TYPE get_elt(std::string::iterator& begin, const std::string::iterator end, std::string& element); STATUS_TYPE get_elt(std::string::iterator & begin,
const std::string::iterator end,
std::string & element);
/** /**
@ -189,23 +226,42 @@ public:
n -1 item not matched n -1 item not matched
i position of match in list i position of match in list
*/ */
static FIND_TYPE find_option(const std::string& item, int *n, const std::vector<std::string>& list, bool exact); static FIND_TYPE find_option(const std::string & item, int *n,
const std::vector < std::string > &list,
bool exact);
int error_msg(const std::ostringstream& err_str, ONERROR_TYPE stop) {return error_msg(err_str.str().c_str(), stop);} int error_msg(const std::ostringstream & err_str, ONERROR_TYPE stop)
{
return error_msg(err_str.str().c_str(), stop);
}
int error_msg(const char *err_str, ONERROR_TYPE stop); int error_msg(const char *err_str, ONERROR_TYPE stop);
int warning_msg(const char *err_str); int warning_msg(const char *err_str);
void set_echo_file(ECHO_OPTION opt) {echo_file = opt;} void set_echo_file(ECHO_OPTION opt)
ECHO_OPTION get_echo_file() {return this->echo_file;}; {
echo_file = opt;
}
ECHO_OPTION get_echo_file()
{
return this->echo_file;
};
void set_echo_stream(ECHO_OPTION opt) {echo_stream = opt;} void set_echo_stream(ECHO_OPTION opt)
ECHO_OPTION get_echo_stream() {return this->echo_stream;}; {
echo_stream = opt;
}
ECHO_OPTION get_echo_stream()
{
return this->echo_stream;
};
STATUS_TYPE parse_couple(std::string & token); STATUS_TYPE parse_couple(std::string & token);
STATUS_TYPE addPair(std::map<char *, double, CHARSTAR_LESS> &totals, std::istream::pos_type& pos); STATUS_TYPE addPair(std::map < char *, double, CHARSTAR_LESS > &totals,
STATUS_TYPE addPair(std::map<char *, double> &totals, std::istream::pos_type& pos); std::istream::pos_type & pos);
STATUS_TYPE addPair(std::map < char *, double >&totals,
std::istream::pos_type & pos);
protected: protected:
LINE_TYPE get_logical_line(); LINE_TYPE get_logical_line();

View File

@ -2,7 +2,8 @@
#define _INC_SAXPHREEQC_H #define _INC_SAXPHREEQC_H
#if defined(__cplusplus) | defined(_CPP) #if defined(__cplusplus) | defined(_CPP)
extern "C" { extern "C"
{
#endif #endif
void SAX_StartSystem(); void SAX_StartSystem();

View File

@ -20,7 +20,8 @@ class cxxSSassemblage : public cxxNumKeyword
public: public:
cxxSSassemblage(); cxxSSassemblage();
cxxSSassemblage(struct s_s_assemblage *); cxxSSassemblage(struct s_s_assemblage *);
cxxSSassemblage(const std::map<int, cxxSSassemblage> &entity_map, cxxMix &mx, int n_user); cxxSSassemblage(const std::map < int, cxxSSassemblage > &entity_map,
cxxMix & mx, int n_user);
~cxxSSassemblage(); ~cxxSSassemblage();
struct s_s_assemblage *cxxSSassemblage2s_s_assemblage(); struct s_s_assemblage *cxxSSassemblage2s_s_assemblage();

View File

@ -20,7 +20,8 @@ public:
cxxSSassemblageSS(struct s_s *); cxxSSassemblageSS(struct s_s *);
~cxxSSassemblageSS(); ~cxxSSassemblageSS();
enum SS_PARAMETER_TYPE { enum SS_PARAMETER_TYPE
{
SS_PARM_NONE = -1, SS_PARM_NONE = -1,
SS_PARM_A0_A1 = 0, SS_PARM_A0_A1 = 0,
SS_PARM_GAMMAS = 1, SS_PARM_GAMMAS = 1,
@ -34,7 +35,8 @@ public:
SS_PARM_MARGULES = 9 SS_PARM_MARGULES = 9
}; };
static struct s_s *cxxSSassemblageSS2s_s(std::list<cxxSSassemblageSS>& el); static struct s_s *cxxSSassemblageSS2s_s(std::list < cxxSSassemblageSS >
&el);
void dump_xml(std::ostream & os, unsigned int indent = 0) const; void dump_xml(std::ostream & os, unsigned int indent = 0) const;
@ -42,7 +44,10 @@ public:
void read_raw(CParser & parser); void read_raw(CParser & parser);
char *get_name()const {return this->name;} char *get_name() const
{
return this->name;
}
void totalize(); void totalize();
const cxxNameDouble & get_totals() const const cxxNameDouble & get_totals() const

View File

@ -25,10 +25,17 @@
#define LDBLE double #define LDBLE double
#endif #endif
struct XMLCH_LESS : std::binary_function<const XMLCh*, const XMLCh*, bool> { struct XMLCH_LESS:
bool operator()(const XMLCh* _X, const XMLCh* _Y) const std::binary_function < const XMLCh *, const XMLCh *,
bool >
{ {
return xns::XMLString::compareString( _X, _Y) < 0;} bool
operator() (const XMLCh * _X, const XMLCh * _Y) const
{
return
xns::XMLString::compareString(_X, _Y) <
0;
}
}; };
#include <math.h> #include <math.h>
@ -41,36 +48,60 @@ bool operator()(const XMLCh* _X, const XMLCh* _Y) const
//} //}
class Cconc : public conc class
Cconc:
public
conc
{ {
public: public:
Cconc() { conc_init(this); } Cconc()
~Cconc() { ; } {
conc_init(this);
}
~
Cconc()
{;
}
}; };
class SaxPhreeqcHandlers : public xns::DefaultHandler class
SaxPhreeqcHandlers:
public
xns::DefaultHandler
{ {
public: public:
SaxPhreeqcHandlers(); SaxPhreeqcHandlers();
virtual ~SaxPhreeqcHandlers(); virtual ~
SaxPhreeqcHandlers();
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// Implementations of the SAX DocumentHandler interface // Implementations of the SAX DocumentHandler interface
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void endDocument(); void
endDocument();
void endElement(const XMLCh* const uri, const XMLCh* const name, const XMLCh* const qname); void
endElement(const XMLCh * const uri, const XMLCh * const name,
const XMLCh * const qname);
void characters(const XMLCh* const chars, const unsigned int length); void
characters(const XMLCh * const chars, const unsigned int length);
void ignorableWhitespace(const XMLCh* const chars, const unsigned int length); void
ignorableWhitespace(const XMLCh * const chars, const unsigned int length);
void processingInstruction(const XMLCh* const target, const XMLCh* const data); void
processingInstruction(const XMLCh * const target,
const XMLCh * const data);
void startDocument(); void
startDocument();
void startElement(const XMLCh* const uri, const XMLCh* const name, const XMLCh* const qname, const xns::Attributes& attributes); void
startElement(const XMLCh * const uri, const XMLCh * const name,
const XMLCh * const qname,
const xns::Attributes & attributes);
// element types // element types
enum elementType enum elementType
@ -133,22 +164,43 @@ public:
attCONC_gfw, attCONC_gfw,
} attType; } attType;
int processSolutionAttributes(const xns::Attributes& attributes); int
int processSolutionTotalAttributes(const xns::Attributes& attributes, struct conc *c); processSolutionAttributes(const xns::Attributes & attributes);
int processMasterActivityAttributes(const xns::Attributes& attributes, struct master_activity *ma); int
processSolutionTotalAttributes(const xns::Attributes & attributes,
struct conc *c);
int
processMasterActivityAttributes(const xns::Attributes & attributes,
struct master_activity *ma);
//int processMasterActivityAttributes(const xns::Attributes& attributes, std::vector<struct master_activity> *v); //int processMasterActivityAttributes(const xns::Attributes& attributes, std::vector<struct master_activity> *v);
int processIsotopeAttributes(const xns::Attributes& attributes, struct isotope *iso); int
processIsotopeAttributes(const xns::Attributes & attributes,
struct isotope *iso);
protected: protected:
std::vector<conc> totals; std::vector <
std::vector<master_activity> acts, s_gammas; conc >
std::vector<isotope> isotopes; totals;
std::map< const XMLCh*, elementType, XMLCH_LESS > mapXMLCh2Type; std::vector <
std::map< const XMLCh*, attributeType, XMLCH_LESS > mapXMLCh2AttType; master_activity >
acts,
s_gammas;
std::vector <
isotope >
isotopes;
std::map < const XMLCh *,
elementType,
XMLCH_LESS >
mapXMLCh2Type;
std::map < const XMLCh *,
attributeType,
XMLCH_LESS >
mapXMLCh2AttType;
/** /**
std::hash_map<const XMLCh*, ElementType, hash<const XMLCh*>, XMLCH_EQUALS> m_hashmapXMLCh2Type; std::hash_map<const XMLCh*, ElementType, hash<const XMLCh*>, XMLCH_EQUALS> m_hashmapXMLCh2Type;
**/ **/
struct solution* solution_ptr; struct solution *
solution_ptr;
}; };
#endif // !defined(AFX_SAXPHREEQCHANDLERS_H__4A69D5F5_2E57_4001_911D_4ABF6F2C0A0B__INCLUDED_) #endif // !defined(AFX_SAXPHREEQCHANDLERS_H__4A69D5F5_2E57_4001_911D_4ABF6F2C0A0B__INCLUDED_)

View File

@ -23,50 +23,124 @@ public:
cxxSolution(); cxxSolution();
cxxSolution(struct solution *); cxxSolution(struct solution *);
cxxSolution(int n_user); cxxSolution(int n_user);
cxxSolution(const std::map<int, cxxSolution> &solution_map, cxxMix &mx, int n_user); cxxSolution(const std::map < int, cxxSolution > &solution_map,
cxxMix & mx, int n_user);
~cxxSolution(); ~cxxSolution();
//static cxxSolution& read(CParser& parser); //static cxxSolution& read(CParser& parser);
double get_tc()const {return this->tc;} double get_tc() const
void set_tc(double tc) {this->tc = tc;} {
return this->tc;
}
void set_tc(double tc)
{
this->tc = tc;
}
double get_ph()const {return this->ph;} double get_ph() const
void set_ph(double pH) {this->ph = pH;} {
return this->ph;
}
void set_ph(double pH)
{
this->ph = pH;
}
double get_pe()const {return this->pe;} double get_pe() const
void set_pe(double pe) {this->pe =pe;} {
return this->pe;
}
void set_pe(double pe)
{
this->pe = pe;
}
double get_mu()const {return this->mu;} double get_mu() const
void set_mu(double mu) {this->mu = mu;} {
return this->mu;
}
void set_mu(double mu)
{
this->mu = mu;
}
double get_ah2o()const {return this->ah2o;} double get_ah2o() const
void set_ah2o(double ah2o) {this->ah2o = ah2o;} {
return this->ah2o;
}
void set_ah2o(double ah2o)
{
this->ah2o = ah2o;
}
double get_total_h()const {return this->total_h;} double get_total_h() const
void set_total_h(double total_h) {this->total_h = total_h;} {
return this->total_h;
}
void set_total_h(double total_h)
{
this->total_h = total_h;
}
double get_total_o()const {return this->total_o;} double get_total_o() const
void set_total_o(double total_o) {this->total_o = total_o;} {
return this->total_o;
}
void set_total_o(double total_o)
{
this->total_o = total_o;
}
double get_cb()const {return this->cb;} double get_cb() const
void set_cb(double cb) {this->cb = cb;} {
return this->cb;
}
void set_cb(double cb)
{
this->cb = cb;
}
double get_mass_water()const {return this->mass_water;} double get_mass_water() const
void set_mass_water(long double mass_water) {this->mass_water = mass_water;} {
return this->mass_water;
}
void set_mass_water(long double mass_water)
{
this->mass_water = mass_water;
}
double get_total_alkalinity()const {return this->total_alkalinity;} double get_total_alkalinity() const
void set_total_alkalinity(double total_alkalinity) {this->total_alkalinity = total_alkalinity;} {
return this->total_alkalinity;
}
void set_total_alkalinity(double total_alkalinity)
{
this->total_alkalinity = total_alkalinity;
}
double get_total(char *string) const; double get_total(char *string) const;
double get_total_element(char *string) const; double get_total_element(char *string) const;
void set_total(char *string, double value); void set_total(char *string, double value);
const cxxNameDouble& get_totals(void)const {return this->totals;} const cxxNameDouble & get_totals(void) const
void set_totals(cxxNameDouble &nd) {this->totals = nd; this->totals.type = cxxNameDouble::ND_ELT_MOLES;} {
void clear_totals() {this->totals.clear();} return this->totals;
}
void set_totals(cxxNameDouble & nd)
{
this->totals = nd;
this->totals.type = cxxNameDouble::ND_ELT_MOLES;
}
void clear_totals()
{
this->totals.clear();
}
const cxxNameDouble& get_master_activity(void)const {return this->master_activity;} const cxxNameDouble & get_master_activity(void) const
{
return this->master_activity;
}
double get_master_activity(char *string) const; double get_master_activity(char *string) const;
void set_master_activity(char *string, double value); void set_master_activity(char *string, double value);
@ -86,7 +160,10 @@ public:
void multiply(double extensive); void multiply(double extensive);
#ifdef ORCHESTRA #ifdef ORCHESTRA
void ORCH_write(std::ostream & headings, std::ostream & input_data) const; void ORCH_write(std::ostream & headings, std::ostream & input_data) const;
void ORCH_read(std::vector <std::pair <std::string, double> > output_vector, std::vector < std::pair < std::string, double > >::iterator &it); void ORCH_read(std::vector < std::pair < std::string,
double >>output_vector,
std::vector < std::pair < std::string,
double >>::iterator & it);
void ORCH_store_global(std::map < std::string, double >output_map); void ORCH_store_global(std::map < std::string, double >output_map);
#endif #endif

View File

@ -27,27 +27,61 @@ public:
CParser::STATUS_TYPE read_raw(CParser & parser); CParser::STATUS_TYPE read_raw(CParser & parser);
double get_isotope_number()const { return this->isotope_number;} double get_isotope_number() const
void set_isotope_number(double d) { this->isotope_number = d;} {
char * get_elt_name()const { return this->elt_name;} return this->isotope_number;
void set_elt_name(char * cstring) { this->elt_name = cstring;} }
char * get_isotope_name()const { return this->isotope_name;} void set_isotope_number(double d)
void set_isotope_name(char * cstring) { this->isotope_name = cstring;} {
double get_total()const { return this->total;} this->isotope_number = d;
void set_total(double d) { this->total = d;} }
char *get_elt_name() const
{
return this->elt_name;
}
void set_elt_name(char *cstring)
{
this->elt_name = cstring;
}
char *get_isotope_name() const
{
return this->isotope_name;
}
void set_isotope_name(char *cstring)
{
this->isotope_name = cstring;
}
double get_total() const
{
return this->total;
}
void set_total(double d)
{
this->total = d;
}
double get_ratio()const { return this->ratio; } double get_ratio() const
{
return this->ratio;
}
double get_ratio_uncertainty()const { return this->ratio_uncertainty; } double get_ratio_uncertainty() const
{
return this->ratio_uncertainty;
}
bool get_ratio_uncertainty_defined()const { return this->ratio_uncertainty_defined; } bool get_ratio_uncertainty_defined() const
{
return this->ratio_uncertainty_defined;
}
bool operator<(const cxxSolutionIsotope & conc) const; bool operator<(const cxxSolutionIsotope & conc) const;
struct master *master(void); struct master *master(void);
struct master *primary(void); struct master *primary(void);
void add(const cxxSolutionIsotope &isotope_ptr, double intensive, double extensive); void add(const cxxSolutionIsotope & isotope_ptr, double intensive,
double extensive);
void multiply(double extensive); void multiply(double extensive);
protected: protected:

View File

@ -11,7 +11,9 @@
#include "char_star.h" #include "char_star.h"
#include "Parser.h" #include "Parser.h"
class cxxSolutionIsotopeList : public std::list <cxxSolutionIsotope> class cxxSolutionIsotopeList:public
std::list <
cxxSolutionIsotope >
{ {
public: public:
@ -19,12 +21,16 @@ public:
cxxSolutionIsotopeList(struct solution *solution_ptr); cxxSolutionIsotopeList(struct solution *solution_ptr);
~cxxSolutionIsotopeList(); ~
cxxSolutionIsotopeList();
struct isotope *cxxSolutionIsotopeList2isotope(); struct isotope *
cxxSolutionIsotopeList2isotope();
void add(cxxSolutionIsotopeList oldlist, double intensive, double extensive); void
void multiply(double extensive); add(cxxSolutionIsotopeList oldlist, double intensive, double extensive);
void
multiply(double extensive);
protected: protected:

View File

@ -37,87 +37,117 @@ public:
void remove(int n); void remove(int n);
cxxSolution *getSolution(int n_user) { cxxSolution *getSolution(int n_user)
if (this->Solutions.find(n_user) != this->Solutions.end()) { {
if (this->Solutions.find(n_user) != this->Solutions.end())
{
return (&(this->Solutions.find(n_user)->second)); return (&(this->Solutions.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setSolution(int n_user, cxxSolution *entity) { void setSolution(int n_user, cxxSolution * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
Solutions[n_user] = *entity; Solutions[n_user] = *entity;
} }
void removeSolution(int n_user) { void removeSolution(int n_user)
{
Solutions.erase(n_user); Solutions.erase(n_user);
} }
cxxExchange *getExchange(int n_user) { cxxExchange *getExchange(int n_user)
if (this->Exchangers.find(n_user) != this->Exchangers.end()) { {
if (this->Exchangers.find(n_user) != this->Exchangers.end())
{
return (&(this->Exchangers.find(n_user)->second)); return (&(this->Exchangers.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setExchange(int n_user, cxxExchange *entity) { void setExchange(int n_user, cxxExchange * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
Exchangers[n_user] = *entity; Exchangers[n_user] = *entity;
} }
void removeExchange(int n_user) { void removeExchange(int n_user)
{
Exchangers.erase(n_user); Exchangers.erase(n_user);
} }
cxxPPassemblage *getPPassemblage(int n_user) { cxxPPassemblage *getPPassemblage(int n_user)
if (this->PPassemblages.find(n_user) != this->PPassemblages.end()) { {
if (this->PPassemblages.find(n_user) != this->PPassemblages.end())
{
return (&(this->PPassemblages.find(n_user)->second)); return (&(this->PPassemblages.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setPPassemblage(int n_user, cxxPPassemblage *entity) { void setPPassemblage(int n_user, cxxPPassemblage * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
PPassemblages[n_user] = *entity; PPassemblages[n_user] = *entity;
} }
void removePPassemblage(int n_user) { void removePPassemblage(int n_user)
{
PPassemblages.erase(n_user); PPassemblages.erase(n_user);
} }
cxxGasPhase *getGasPhase(int n_user) { cxxGasPhase *getGasPhase(int n_user)
if (this->GasPhases.find(n_user) != this->GasPhases.end()) { {
if (this->GasPhases.find(n_user) != this->GasPhases.end())
{
return (&(this->GasPhases.find(n_user)->second)); return (&(this->GasPhases.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setGasPhase(int n_user, cxxGasPhase *entity) { void setGasPhase(int n_user, cxxGasPhase * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
GasPhases[n_user] = *entity; GasPhases[n_user] = *entity;
} }
void removeGasPhase(int n_user) { void removeGasPhase(int n_user)
{
GasPhases.erase(n_user); GasPhases.erase(n_user);
} }
cxxSSassemblage *getSSassemblage(int n_user) { cxxSSassemblage *getSSassemblage(int n_user)
if (this->SSassemblages.find(n_user) != this->SSassemblages.end()) { {
if (this->SSassemblages.find(n_user) != this->SSassemblages.end())
{
return (&(this->SSassemblages.find(n_user)->second)); return (&(this->SSassemblages.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setSSassemblage(int n_user, cxxSSassemblage *entity) { void setSSassemblage(int n_user, cxxSSassemblage * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
SSassemblages[n_user] = *entity; SSassemblages[n_user] = *entity;
} }
void removeSSassemblage(int n_user) { void removeSSassemblage(int n_user)
{
SSassemblages.erase(n_user); SSassemblages.erase(n_user);
} }
cxxKinetics *getKinetics(int n_user) { cxxKinetics *getKinetics(int n_user)
if (this->Kinetics.find(n_user) != this->Kinetics.end()) { {
if (this->Kinetics.find(n_user) != this->Kinetics.end())
{
return (&(this->Kinetics.find(n_user)->second)); return (&(this->Kinetics.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setKinetics(int n_user, cxxKinetics *entity) { void setKinetics(int n_user, cxxKinetics * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
Kinetics[n_user] = *entity; Kinetics[n_user] = *entity;
} }
void removeKinetics(int n_user) { void removeKinetics(int n_user)
{
Kinetics.erase(n_user); Kinetics.erase(n_user);
} }
@ -129,53 +159,71 @@ public:
} }
return (NULL); return (NULL);
} }
void setSurface(int n_user, cxxSurface *entity) { void setSurface(int n_user, cxxSurface * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
Surfaces[n_user] = *entity; Surfaces[n_user] = *entity;
} }
void removeSurface(int n_user) { void removeSurface(int n_user)
{
Surfaces.erase(n_user); Surfaces.erase(n_user);
} }
cxxMix *getMix(int n_user) { cxxMix *getMix(int n_user)
if (this->Mixes.find(n_user) != this->Mixes.end()) { {
if (this->Mixes.find(n_user) != this->Mixes.end())
{
return (&(this->Mixes.find(n_user)->second)); return (&(this->Mixes.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setMix(int n_user, cxxMix *entity) { void setMix(int n_user, cxxMix * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
Mixes[n_user] = *entity; Mixes[n_user] = *entity;
} }
void removeMix(int n_user) { void removeMix(int n_user)
{
Mixes.erase(n_user); Mixes.erase(n_user);
} }
cxxReaction *getReaction(int n_user) { cxxReaction *getReaction(int n_user)
if (this->Reactions.find(n_user) != this->Reactions.end()) { {
if (this->Reactions.find(n_user) != this->Reactions.end())
{
return (&(this->Reactions.find(n_user)->second)); return (&(this->Reactions.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setReaction(int n_user, cxxReaction *entity) { void setReaction(int n_user, cxxReaction * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
Reactions[n_user] = *entity; Reactions[n_user] = *entity;
} }
void removeReaction(int n_user) { void removeReaction(int n_user)
{
Reactions.erase(n_user); Reactions.erase(n_user);
} }
cxxTemperature *getTemperature(int n_user) { cxxTemperature *getTemperature(int n_user)
if (this->Temperatures.find(n_user) != this->Temperatures.end()) { {
if (this->Temperatures.find(n_user) != this->Temperatures.end())
{
return (&(this->Temperatures.find(n_user)->second)); return (&(this->Temperatures.find(n_user)->second));
} }
return (NULL); return (NULL);
} }
void setTemperature(int n_user, cxxTemperature *entity) { void setTemperature(int n_user, cxxTemperature * entity)
if (entity == NULL) return; {
if (entity == NULL)
return;
Temperatures[n_user] = *entity; Temperatures[n_user] = *entity;
} }
void removeTemperature(int n_user) { void removeTemperature(int n_user)
{
Temperatures.erase(n_user); Temperatures.erase(n_user);
} }
@ -195,20 +243,42 @@ public:
//cxxSolution *mix_cxxSolutions(cxxMix &mixmap); //cxxSolution *mix_cxxSolutions(cxxMix &mixmap);
cxxExchange *mix_cxxExchange(cxxMix & mixmap); cxxExchange *mix_cxxExchange(cxxMix & mixmap);
const std::map<int, cxxSolution>& getSolutions()const {return this->Solutions;}; const std::map < int, cxxSolution > &getSolutions() const
const std::map<int, cxxExchange>& getExchangers()const {return this->Exchangers;}; {
const std::map<int, cxxGasPhase>& getGasPhases()const {return this->GasPhases;}; return this->Solutions;
const std::map<int, cxxKinetics>& getKinetics()const {return this->Kinetics;}; };
const std::map<int, cxxPPassemblage>& getPPassemblages()const {return this->PPassemblages;}; const std::map < int, cxxExchange > &getExchangers() const
const std::map<int, cxxSSassemblage>& getSSassemblages()const {return this->SSassemblages;}; {
const std::map<int, cxxSurface>& getSurfaces()const {return this->Surfaces;}; return this->Exchangers;
};
const std::map < int, cxxGasPhase > &getGasPhases() const
{
return this->GasPhases;
};
const std::map < int, cxxKinetics > &getKinetics() const
{
return this->Kinetics;
};
const std::map < int, cxxPPassemblage > &getPPassemblages() const
{
return this->PPassemblages;
};
const std::map < int, cxxSSassemblage > &getSSassemblages() const
{
return this->SSassemblages;
};
const std::map < int, cxxSurface > &getSurfaces() const
{
return this->Surfaces;
};
#ifdef USE_MPI #ifdef USE_MPI
void mpi_send(int n, int task_number); void mpi_send(int n, int task_number);
void mpi_recv(int task_number); void mpi_recv(int task_number);
#endif #endif
#ifdef ORCHESTRA #ifdef ORCHESTRA
void ORCH_write(std::ostream &chemistry_dat, std::ostream &input_dat, std::ostream &output_dat); void ORCH_write(std::ostream & chemistry_dat, std::ostream & input_dat,
std::ostream & output_dat);
#endif #endif
protected: protected:
// Tidied classes // Tidied classes

View File

@ -21,7 +21,8 @@ class cxxSurface : public cxxNumKeyword
public: public:
cxxSurface(); cxxSurface();
cxxSurface(struct surface *); cxxSurface(struct surface *);
cxxSurface(const std::map<int, cxxSurface> &entity_map, cxxMix &mx, int n_user); cxxSurface(const std::map < int, cxxSurface > &entity_map, cxxMix & mx,
int n_user);
~cxxSurface(); ~cxxSurface();
//enum SURFACE_STYPE { UNKNOWN_DL, NO_EDL, DDL, CD_MUSIC }; //enum SURFACE_STYPE { UNKNOWN_DL, NO_EDL, DDL, CD_MUSIC };

View File

@ -24,7 +24,9 @@ public:
struct master *get_psi_master(); struct master *get_psi_master();
static struct surface_charge *cxxSurfaceCharge2surface_charge(std::list<cxxSurfaceCharge>& el); static struct surface_charge *cxxSurfaceCharge2surface_charge(std::list <
cxxSurfaceCharge
> &el);
void dump_xml(std::ostream & os, unsigned int indent = 0) const; void dump_xml(std::ostream & os, unsigned int indent = 0) const;
@ -32,7 +34,10 @@ public:
void read_raw(CParser & parser); void read_raw(CParser & parser);
char *get_name()const {return this->name;} char *get_name() const
{
return this->name;
}
void add(const cxxSurfaceCharge & comp, double extensive); void add(const cxxSurfaceCharge & comp, double extensive);
void multiply(double extensive); void multiply(double extensive);

View File

@ -24,13 +24,30 @@ public:
struct master *get_master(); struct master *get_master();
char *get_phase_name()const {return this->phase_name;} char *get_phase_name() const
char *get_rate_name()const {return this->rate_name;} {
char *get_formula()const {return this->formula;} return this->phase_name;
double get_charge_balance()const { return this->charge_balance;} }
void set_charge_balance(double d) { this->charge_balance = d;} char *get_rate_name() const
{
return this->rate_name;
}
char *get_formula() const
{
return this->formula;
}
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::list<cxxSurfaceComp>& el); static struct surface_comp *cxxSurfaceComp2surface_comp(std::list <
cxxSurfaceComp >
&el);
void dump_xml(std::ostream & os, unsigned int indent = 0) const; void dump_xml(std::ostream & os, unsigned int indent = 0) const;
@ -46,9 +63,13 @@ public:
void add(const cxxSurfaceComp & comp, double extensive); void add(const cxxSurfaceComp & comp, double extensive);
void multiply(double extensive); void multiply(double extensive);
char *charge_name() {return(get_charge_name(this->formula));}; char *charge_name()
{
return (get_charge_name(this->formula));
};
static char *get_charge_name(char * token) { static char *get_charge_name(char *token)
{
char name[100]; char name[100];
int l; int l;
char *ptr1 = token; char *ptr1 = token;

View File

@ -12,54 +12,53 @@
#include "Temperature.h" #include "Temperature.h"
class cxxSystem class cxxSystem
{ {
public: public:cxxSystem(void);
cxxSystem(void); public: ~cxxSystem(void);
public:
~cxxSystem(void);
void Initialize(void); void Initialize(void);
void setSolution(cxxSolution *entity) { void setSolution(cxxSolution * entity)
{
this->solution = entity; this->solution = entity;
} } void setExchange(cxxExchange * entity)
void setExchange(cxxExchange *entity) { {
this->exchange = entity; this->exchange = entity;
} } void setPPassemblage(cxxPPassemblage * entity)
void setPPassemblage(cxxPPassemblage *entity) { {
this->ppassemblage = entity; this->ppassemblage = entity;
} } void setGasPhase(cxxGasPhase * entity)
void setGasPhase(cxxGasPhase *entity) { {
this->gasphase = entity; this->gasphase = entity;
} } void setSSassemblage(cxxSSassemblage * entity)
void setSSassemblage(cxxSSassemblage *entity) { {
this->ssassemblage = entity; this->ssassemblage = entity;
} } void setKinetics(cxxKinetics * entity)
void setKinetics(cxxKinetics *entity) { {
this->kinetics = entity; this->kinetics = entity;
} } void setSurface(cxxSurface * entity)
void setSurface(cxxSurface *entity) { {
this->surface = entity; this->surface = entity;
} } void setMix(cxxMix * entity)
void setMix(cxxMix *entity) { {
this->mix = entity; this->mix = entity;
} } void setReaction(cxxReaction * entity)
void setReaction(cxxReaction *entity) { {
this->reaction = entity; this->reaction = entity;
} } void setTemperature(cxxTemperature * entity)
void setTemperature(cxxTemperature *entity) { {
this->temperature = entity; this->temperature = entity;
} } void totalize();
void totalize();
#ifdef ORCHESTRA #ifdef ORCHESTRA
void ORCH_components(); void ORCH_components();
void ORCH_write(std::ostream &chemistry_dat, std::ostream &input_dat, std::ostream &output_dat); void ORCH_write(std::ostream & chemistry_dat, std::ostream & input_dat,
std::ostream & output_dat);
void ORCH_write_chemistry_water(std::ostream & chemistry_dat); void ORCH_write_chemistry_water(std::ostream & chemistry_dat);
void ORCH_write_chemistry_primary(std::ostream & chemistry_dat); void ORCH_write_chemistry_primary(std::ostream & chemistry_dat);
void ORCH_write_chemistry_total_O_H(std::ostream & chemistry_dat); void ORCH_write_chemistry_total_O_H(std::ostream & chemistry_dat);
void ORCH_write_output_vars(std::ostream & outstream); void ORCH_write_output_vars(std::ostream & outstream);
void ORCH_write_input(std::ostream & input_dat); void ORCH_write_input(std::ostream & input_dat);
#endif
private: #endif /* */
cxxSolution *solution; private:cxxSolution * solution;
cxxExchange * exchange; cxxExchange * exchange;
cxxPPassemblage * ppassemblage; cxxPPassemblage * ppassemblage;
cxxGasPhase * gasphase; cxxGasPhase * gasphase;
@ -72,4 +71,6 @@ private:
cxxNameDouble totals; cxxNameDouble totals;
cxxNameDouble orch_totals; cxxNameDouble orch_totals;
}; };
#endif // !defined(SYSTEM_H_INCLUDED) #endif // !defined(SYSTEM_H_INCLUDED)

27
Utils.h
View File

@ -8,11 +8,13 @@
#include <map> // std::map #include <map> // std::map
#include "char_star.h" #include "char_star.h"
namespace Utilities { namespace Utilities
{
const char INDENT[] = " "; const char INDENT[] = " ";
enum STATUS_TYPE { enum STATUS_TYPE
{
OK = 0, OK = 0,
ERROR = 1 ERROR = 1
}; };
@ -37,20 +39,25 @@ namespace Utilities {
{ {
//std :: map < int, T > :: const_iterator it; //std :: map < int, T > :: const_iterator it;
typename T::const_iterator it; typename T::const_iterator it;
for (it = b.begin(); it != b.end(); ++it) { for (it = b.begin(); it != b.end(); ++it)
{
it->second.dump_raw(s_oss, indent); it->second.dump_raw(s_oss, indent);
} }
return; return;
} }
template<typename T> template < typename T > bool exists(const T & b, int i)
bool exists (const T &b, int i){ {
return (b.find(i) != b.end());} return (b.find(i) != b.end());
}
template<typename T> template < typename T > T * get_entity(std::map < int, T > b, int i)
T *get_entity(std::map<int, T> b, int i) { {
if (b.find(i) != b.end()) { if (b.find(i) != b.end())
{
return (&(b.find(i)->second)); return (&(b.find(i)->second));
} else { }
else
{
return (NULL); return (NULL);
} }
} }

View File

@ -1,11 +1,16 @@
#if !defined(CHARSTAR_H_INCLUDED) #if !defined(CHARSTAR_H_INCLUDED)
#define CHARSTAR_H_INCLUDED #define CHARSTAR_H_INCLUDED
struct CHARSTAR_LESS : std::binary_function<const char*, const char*, bool> { struct CHARSTAR_LESS:
bool operator()(const char* _X, const char* _Y) const std::binary_function < const char *, const char *,
bool >
{ {
return ::strcmp( _X, _Y) < 0;} bool
operator() (const char *_X, const char *_Y) const
{
return::strcmp(_X, _Y) <
0;
}
}; };
#endif #endif

View File

@ -20,7 +20,8 @@ class cxxKinetics : public cxxNumKeyword
public: public:
cxxKinetics(); cxxKinetics();
cxxKinetics(struct kinetics *); cxxKinetics(struct kinetics *);
cxxKinetics(const std::map<int, cxxKinetics> &entity_map, cxxMix &mx, int n_user); cxxKinetics(const std::map < int, cxxKinetics > &entity_map, cxxMix & mx,
int n_user);
~cxxKinetics(); ~cxxKinetics();
struct kinetics *cxxKinetics2kinetics(); struct kinetics *cxxKinetics2kinetics();

View File

@ -28,17 +28,22 @@ public:
void read_raw(CParser & parser); void read_raw(CParser & parser);
void add(int n, double f) { void add(int n, double f)
{
if (this->mixComps.find(n) != this->mixComps.end()) if (this->mixComps.find(n) != this->mixComps.end())
{ {
mixComps[n] += f; mixComps[n] += f;
} else }
else
{ {
mixComps[n] = f; mixComps[n] = f;
} }
}; };
std::map<int, double> *comps() {return &mixComps;} std::map < int, double >*comps()
{
return &mixComps;
}
protected: protected:
friend class cxxStorageBin; friend class cxxStorageBin;