mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
Moved Conc to SolutionComp
git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@791 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
0d1acff7da
commit
75b28d81ca
193
ExchComp.cxx
193
ExchComp.cxx
@ -359,196 +359,3 @@ void cxxExchComp::read_raw(CParser& parser)
|
||||
parser.error_msg("Formula_z not defined for ExchComp input.", CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SKIP
|
||||
cxxExchComp& cxxExchComp::read(CParser& parser)
|
||||
{
|
||||
static std::vector<std::string> vopts;
|
||||
if (vopts.empty()) {
|
||||
vopts.reserve(11);
|
||||
vopts.push_back("temp"); // 0
|
||||
vopts.push_back("temperature"); // 1
|
||||
vopts.push_back("dens"); // 2
|
||||
vopts.push_back("density"); // 3
|
||||
vopts.push_back("units"); // 4
|
||||
vopts.push_back("redox"); // 5
|
||||
vopts.push_back("ph"); // 6
|
||||
vopts.push_back("pe"); // 7
|
||||
vopts.push_back("unit"); // 8
|
||||
vopts.push_back("isotope"); // 9
|
||||
vopts.push_back("water"); // 10
|
||||
}
|
||||
// const int count_opt_list = vopts.size();
|
||||
|
||||
cxxExchComp numkey;
|
||||
|
||||
// Read exch_comp number and description
|
||||
numkey.read_number_description(parser);
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
CParser::TOKEN_TYPE j;
|
||||
|
||||
//cxxExchComp& sol = s_map[numkey.n_user()];
|
||||
int default_pe = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPTION_DEFAULT)
|
||||
{
|
||||
ptr = next_char;
|
||||
if (parser.copy_token(token, ptr) == CParser::TT_DIGIT) {
|
||||
opt = 9;
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPTION_EOF:
|
||||
break;
|
||||
case CParser::OPTION_KEYWORD:
|
||||
break;
|
||||
case CParser::OPTION_ERROR:
|
||||
opt = CParser::OPTION_EOF;
|
||||
parser.error_msg("Unknown input in EXCH_COMP keyword.", CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
break;
|
||||
|
||||
case 0: // temp
|
||||
case 1: // temperature
|
||||
if (!(parser.get_iss() >> sol.tc))
|
||||
{
|
||||
sol.tc = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // dens
|
||||
case 3: // density
|
||||
parser.get_iss() >> sol.density;
|
||||
break;
|
||||
|
||||
case 4: // units
|
||||
case 8: // unit
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.check_units(token, false, false, sol.units, true) == CParser::OK) {
|
||||
sol.units = token;
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // redox
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
default_pe = cxxPe_Data::store(sol.pe, token);
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.ph = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("H(1)");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.exch_comp_pe = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("E");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // isotope
|
||||
{
|
||||
cxxIsotope isotope;
|
||||
if (isotope.read(parser) == cxxIsotope::OK) {
|
||||
sol.add(isotope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // water
|
||||
j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY) {
|
||||
sol.mass_water = 1.0;
|
||||
} else if (j != CParser::TT_DIGIT) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("Expected numeric value for mass of water in exch_comp.", CParser::OT_CONTINUE);
|
||||
} else {
|
||||
std::istringstream(token) >> sol.mass_water;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (opt == CParser::OPTION_EOF || opt == CParser::OPTION_KEYWORD) break;
|
||||
}
|
||||
#ifdef SKIP
|
||||
//
|
||||
// Sort totals by description
|
||||
//
|
||||
std::sort(sol.totals.begin(), sol.totals.end());
|
||||
#endif
|
||||
|
||||
//
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
Utilities::str_tolower(token);
|
||||
if ((*iter).get_units().empty()) {
|
||||
(*iter).set_units(sol.units);
|
||||
} else {
|
||||
bool alk = false;
|
||||
if (token.find("alk") == 0) alk = true;
|
||||
token1 = (*iter).get_units();
|
||||
if (parser.check_units(token1, alk, true, sol.get_units(), true) == CParser::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
(*iter).set_units(token1);
|
||||
}
|
||||
}
|
||||
if ((*iter).get_n_pe() < 0) {
|
||||
(*iter).set_n_pe(default_pe);
|
||||
}
|
||||
}
|
||||
sol.default_pe = default_pe;
|
||||
return sol;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
191
Exchange.cxx
191
Exchange.cxx
@ -220,194 +220,3 @@ void cxxExchange::read_raw(CParser& parser)
|
||||
parser.error_msg("Pitzer_exchange_gammsa not defined for EXCHANGE_RAW input.", CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
#ifdef SKIP
|
||||
cxxExchange& cxxExchange::read(CParser& parser)
|
||||
{
|
||||
static std::vector<std::string> vopts;
|
||||
if (vopts.empty()) {
|
||||
vopts.reserve(11);
|
||||
vopts.push_back("temp"); // 0
|
||||
vopts.push_back("temperature"); // 1
|
||||
vopts.push_back("dens"); // 2
|
||||
vopts.push_back("density"); // 3
|
||||
vopts.push_back("units"); // 4
|
||||
vopts.push_back("redox"); // 5
|
||||
vopts.push_back("ph"); // 6
|
||||
vopts.push_back("pe"); // 7
|
||||
vopts.push_back("unit"); // 8
|
||||
vopts.push_back("isotope"); // 9
|
||||
vopts.push_back("water"); // 10
|
||||
}
|
||||
// const int count_opt_list = vopts.size();
|
||||
|
||||
cxxExchange numkey;
|
||||
|
||||
// Read exchange number and description
|
||||
numkey.read_number_description(parser);
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
CParser::TOKEN_TYPE j;
|
||||
|
||||
//cxxExchange& sol = s_map[numkey.n_user()];
|
||||
int default_pe = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPTION_DEFAULT)
|
||||
{
|
||||
ptr = next_char;
|
||||
if (parser.copy_token(token, ptr) == CParser::TT_DIGIT) {
|
||||
opt = 9;
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPTION_EOF:
|
||||
break;
|
||||
case CParser::OPTION_KEYWORD:
|
||||
break;
|
||||
case CParser::OPTION_ERROR:
|
||||
opt = CParser::OPTION_EOF;
|
||||
parser.error_msg("Unknown input in EXCHANGE keyword.", CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
break;
|
||||
|
||||
case 0: // temp
|
||||
case 1: // temperature
|
||||
if (!(parser.get_iss() >> sol.tc))
|
||||
{
|
||||
sol.tc = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // dens
|
||||
case 3: // density
|
||||
parser.get_iss() >> sol.density;
|
||||
break;
|
||||
|
||||
case 4: // units
|
||||
case 8: // unit
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.check_units(token, false, false, sol.units, true) == CParser::OK) {
|
||||
sol.units = token;
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // redox
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
default_pe = cxxPe_Data::store(sol.pe, token);
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.ph = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("H(1)");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.exchange_pe = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("E");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // isotope
|
||||
{
|
||||
cxxIsotope isotope;
|
||||
if (isotope.read(parser) == cxxIsotope::OK) {
|
||||
sol.add(isotope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // water
|
||||
j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY) {
|
||||
sol.mass_water = 1.0;
|
||||
} else if (j != CParser::TT_DIGIT) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("Expected numeric value for mass of water in exchange.", CParser::OT_CONTINUE);
|
||||
} else {
|
||||
std::istringstream(token) >> sol.mass_water;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (opt == CParser::OPTION_EOF || opt == CParser::OPTION_KEYWORD) break;
|
||||
}
|
||||
#ifdef SKIP
|
||||
//
|
||||
// Sort totals by description
|
||||
//
|
||||
std::sort(sol.totals.begin(), sol.totals.end());
|
||||
#endif
|
||||
|
||||
//
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
Utilities::str_tolower(token);
|
||||
if ((*iter).get_units().empty()) {
|
||||
(*iter).set_units(sol.units);
|
||||
} else {
|
||||
bool alk = false;
|
||||
if (token.find("alk") == 0) alk = true;
|
||||
token1 = (*iter).get_units();
|
||||
if (parser.check_units(token1, alk, true, sol.get_units(), true) == CParser::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
(*iter).set_units(token1);
|
||||
}
|
||||
}
|
||||
if ((*iter).get_n_pe() < 0) {
|
||||
(*iter).set_n_pe(default_pe);
|
||||
}
|
||||
}
|
||||
sol.default_pe = default_pe;
|
||||
return sol;
|
||||
}
|
||||
#endif
|
||||
|
||||
191
GasPhase.cxx
191
GasPhase.cxx
@ -281,194 +281,3 @@ void cxxGasPhase::read_raw(CParser& parser)
|
||||
parser.error_msg("Volume not defined for GAS_PHASE_RAW input.", CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
#ifdef SKIP
|
||||
cxxGasPhase& cxxGasPhase::read(CParser& parser)
|
||||
{
|
||||
static std::vector<std::string> vopts;
|
||||
if (vopts.empty()) {
|
||||
vopts.reserve(11);
|
||||
vopts.push_back("temp"); // 0
|
||||
vopts.push_back("temperature"); // 1
|
||||
vopts.push_back("dens"); // 2
|
||||
vopts.push_back("density"); // 3
|
||||
vopts.push_back("units"); // 4
|
||||
vopts.push_back("redox"); // 5
|
||||
vopts.push_back("ph"); // 6
|
||||
vopts.push_back("pe"); // 7
|
||||
vopts.push_back("unit"); // 8
|
||||
vopts.push_back("isotope"); // 9
|
||||
vopts.push_back("water"); // 10
|
||||
}
|
||||
// const int count_opt_list = vopts.size();
|
||||
|
||||
cxxGasPhase numkey;
|
||||
|
||||
// Read gas_phase number and description
|
||||
numkey.read_number_description(parser);
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
CParser::TOKEN_TYPE j;
|
||||
|
||||
//cxxGasPhase& sol = s_map[numkey.n_user()];
|
||||
int default_pe = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPTION_DEFAULT)
|
||||
{
|
||||
ptr = next_char;
|
||||
if (parser.copy_token(token, ptr) == CParser::TT_DIGIT) {
|
||||
opt = 9;
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPTION_EOF:
|
||||
break;
|
||||
case CParser::OPTION_KEYWORD:
|
||||
break;
|
||||
case CParser::OPTION_ERROR:
|
||||
opt = CParser::OPTION_EOF;
|
||||
parser.error_msg("Unknown input in GAS_PHASE keyword.", CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
break;
|
||||
|
||||
case 0: // temp
|
||||
case 1: // temperature
|
||||
if (!(parser.get_iss() >> sol.tc))
|
||||
{
|
||||
sol.tc = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // dens
|
||||
case 3: // density
|
||||
parser.get_iss() >> sol.density;
|
||||
break;
|
||||
|
||||
case 4: // units
|
||||
case 8: // unit
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.check_units(token, false, false, sol.units, true) == CParser::OK) {
|
||||
sol.units = token;
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // redox
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
default_pe = cxxPe_Data::store(sol.pe, token);
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.ph = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("H(1)");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.gas_phase_pe = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("E");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // isotope
|
||||
{
|
||||
cxxIsotope isotope;
|
||||
if (isotope.read(parser) == cxxIsotope::OK) {
|
||||
sol.add(isotope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // water
|
||||
j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY) {
|
||||
sol.mass_water = 1.0;
|
||||
} else if (j != CParser::TT_DIGIT) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("Expected numeric value for mass of water in gas_phase.", CParser::OT_CONTINUE);
|
||||
} else {
|
||||
std::istringstream(token) >> sol.mass_water;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (opt == CParser::OPTION_EOF || opt == CParser::OPTION_KEYWORD) break;
|
||||
}
|
||||
#ifdef SKIP
|
||||
//
|
||||
// Sort totals by description
|
||||
//
|
||||
std::sort(sol.totals.begin(), sol.totals.end());
|
||||
#endif
|
||||
|
||||
//
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
Utilities::str_tolower(token);
|
||||
if ((*iter).get_units().empty()) {
|
||||
(*iter).set_units(sol.units);
|
||||
} else {
|
||||
bool alk = false;
|
||||
if (token.find("alk") == 0) alk = true;
|
||||
token1 = (*iter).get_units();
|
||||
if (parser.check_units(token1, alk, true, sol.get_units(), true) == CParser::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
(*iter).set_units(token1);
|
||||
}
|
||||
}
|
||||
if ((*iter).get_n_pe() < 0) {
|
||||
(*iter).set_n_pe(default_pe);
|
||||
}
|
||||
}
|
||||
sol.default_pe = default_pe;
|
||||
return sol;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -37,8 +37,8 @@ cxxISolution::cxxISolution(struct solution *solution_ptr)
|
||||
units = solution_ptr->units;
|
||||
// totals
|
||||
for (int i = 0; solution_ptr->totals[i].description != NULL; i++) {
|
||||
cxxConc c(&(solution_ptr->totals[i]));
|
||||
concs.insert(c);
|
||||
cxxSolutionComp c(&(solution_ptr->totals[i]));
|
||||
comps.insert(c);
|
||||
}
|
||||
default_pe = solution_ptr->default_pe;
|
||||
// pe_data
|
||||
@ -65,7 +65,7 @@ struct solution *cxxISolution::cxxISolution2solution()
|
||||
soln_ptr->pe = pe_data_dup(this->pes);
|
||||
// totals
|
||||
soln_ptr->totals = (struct conc *) free_check_null(soln_ptr->totals);
|
||||
soln_ptr->totals = cxxConc::cxxConc2conc(this->concs);
|
||||
soln_ptr->totals = cxxSolutionComp::cxxSolutionComp2conc(this->comps);
|
||||
return(soln_ptr);
|
||||
}
|
||||
#ifdef SKIP
|
||||
@ -162,8 +162,8 @@ cxxISolution& cxxISolution::read(CParser& parser)
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
cxxSolutionComp conc;
|
||||
if (conc.read(parser, sol) == cxxSolutionComp::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
@ -178,8 +178,8 @@ cxxISolution& cxxISolution::read(CParser& parser)
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
cxxSolutionComp conc;
|
||||
if (conc.read(parser, sol) == cxxSolutionComp::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
@ -216,8 +216,8 @@ cxxISolution& cxxISolution::read(CParser& parser)
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
cxxSolutionComp conc;
|
||||
if (conc.read(parser, sol) == cxxSolutionComp::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
@ -238,7 +238,7 @@ cxxISolution& cxxISolution::read(CParser& parser)
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
std::vector<cxxSolutionComp>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
@ -299,7 +299,7 @@ void cxxISolution::dump_xml(std::ostream& os, unsigned int indent)const
|
||||
for(i = 0; i < indent + 1; ++i) os << Utilities::INDENT;
|
||||
os << "<totals>\n";
|
||||
|
||||
std::vector<cxxConc>::const_iterator iter = this->totals.begin();
|
||||
std::vector<cxxSolutionComp>::const_iterator iter = this->totals.begin();
|
||||
for(; iter != this->totals.end(); ++iter)
|
||||
{
|
||||
(*iter).dump_xml(*this, os, indent + 2);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
//#include "Parser.h"
|
||||
#include "NumKeyword.h"
|
||||
#include "Solution.h"
|
||||
#include "Conc.h"
|
||||
#include "SolutionComp.h"
|
||||
//#include "Isotope.h"
|
||||
#include <cassert> // assert
|
||||
#include <map> // std::map
|
||||
@ -25,7 +25,7 @@ public:
|
||||
|
||||
//static cxxISolution& read(CParser& parser);
|
||||
|
||||
//void add(cxxConc conc) { this->concs.push_back(conc); }
|
||||
//void add(cxxSolutionComp conc) { this->concs.push_back(conc); }
|
||||
|
||||
struct solution *cxxISolution2solution();
|
||||
|
||||
@ -40,11 +40,10 @@ public:
|
||||
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
||||
|
||||
protected:
|
||||
friend class cxxConc; // for this->pe access
|
||||
friend class cxxSolutionComp; // for this->pe access
|
||||
double density;
|
||||
std::string units;
|
||||
std::set<cxxConc> concs;
|
||||
//std::map <char *, struct reaction *> pe;
|
||||
std::set<cxxSolutionComp> comps;
|
||||
struct pe_data *pes;
|
||||
int default_pe;
|
||||
|
||||
|
||||
193
KineticsComp.cxx
193
KineticsComp.cxx
@ -309,196 +309,3 @@ void cxxKineticsComp::read_raw(CParser& parser)
|
||||
parser.error_msg("Moles not defined for KineticsComp input.", CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SKIP
|
||||
cxxKineticsComp& cxxKineticsComp::read(CParser& parser)
|
||||
{
|
||||
static std::vector<std::string> vopts;
|
||||
if (vopts.empty()) {
|
||||
vopts.reserve(11);
|
||||
vopts.push_back("temp"); // 0
|
||||
vopts.push_back("temperature"); // 1
|
||||
vopts.push_back("dens"); // 2
|
||||
vopts.push_back("density"); // 3
|
||||
vopts.push_back("units"); // 4
|
||||
vopts.push_back("redox"); // 5
|
||||
vopts.push_back("ph"); // 6
|
||||
vopts.push_back("pe"); // 7
|
||||
vopts.push_back("unit"); // 8
|
||||
vopts.push_back("isotope"); // 9
|
||||
vopts.push_back("water"); // 10
|
||||
}
|
||||
// const int count_opt_list = vopts.size();
|
||||
|
||||
cxxKineticsComp numkey;
|
||||
|
||||
// Read kinetics_comp number and description
|
||||
numkey.read_number_description(parser);
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
CParser::TOKEN_TYPE j;
|
||||
|
||||
//cxxKineticsComp& sol = s_map[numkey.n_user()];
|
||||
int default_pe = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPTION_DEFAULT)
|
||||
{
|
||||
ptr = next_char;
|
||||
if (parser.copy_token(token, ptr) == CParser::TT_DIGIT) {
|
||||
opt = 9;
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPTION_EOF:
|
||||
break;
|
||||
case CParser::OPTION_KEYWORD:
|
||||
break;
|
||||
case CParser::OPTION_ERROR:
|
||||
opt = CParser::OPTION_EOF;
|
||||
parser.error_msg("Unknown input in KINETICS_COMP keyword.", CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
break;
|
||||
|
||||
case 0: // temp
|
||||
case 1: // temperature
|
||||
if (!(parser.get_iss() >> sol.tc))
|
||||
{
|
||||
sol.tc = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // dens
|
||||
case 3: // density
|
||||
parser.get_iss() >> sol.density;
|
||||
break;
|
||||
|
||||
case 4: // units
|
||||
case 8: // unit
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.check_units(token, false, false, sol.units, true) == CParser::OK) {
|
||||
sol.units = token;
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // redox
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
default_pe = cxxPe_Data::store(sol.pe, token);
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.ph = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("H(1)");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.kinetics_comp_pe = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("E");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // isotope
|
||||
{
|
||||
cxxIsotope isotope;
|
||||
if (isotope.read(parser) == cxxIsotope::OK) {
|
||||
sol.add(isotope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // water
|
||||
j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY) {
|
||||
sol.mass_water = 1.0;
|
||||
} else if (j != CParser::TT_DIGIT) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("Expected numeric value for mass of water in kinetics_comp.", CParser::OT_CONTINUE);
|
||||
} else {
|
||||
std::istringstream(token) >> sol.mass_water;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (opt == CParser::OPTION_EOF || opt == CParser::OPTION_KEYWORD) break;
|
||||
}
|
||||
#ifdef SKIP
|
||||
//
|
||||
// Sort totals by description
|
||||
//
|
||||
std::sort(sol.totals.begin(), sol.totals.end());
|
||||
#endif
|
||||
|
||||
//
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
Utilities::str_tolower(token);
|
||||
if ((*iter).get_units().empty()) {
|
||||
(*iter).set_units(sol.units);
|
||||
} else {
|
||||
bool alk = false;
|
||||
if (token.find("alk") == 0) alk = true;
|
||||
token1 = (*iter).get_units();
|
||||
if (parser.check_units(token1, alk, true, sol.get_units(), true) == CParser::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
(*iter).set_units(token1);
|
||||
}
|
||||
}
|
||||
if ((*iter).get_n_pe() < 0) {
|
||||
(*iter).set_n_pe(default_pe);
|
||||
}
|
||||
}
|
||||
sol.default_pe = default_pe;
|
||||
return sol;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
191
KineticsCxx.cxx
191
KineticsCxx.cxx
@ -345,194 +345,3 @@ void cxxKinetics::read_raw(CParser& parser)
|
||||
parser.error_msg("Use_cvode not defined for KINETICS_RAW input.", CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
#ifdef SKIP
|
||||
cxxKinetics& cxxKinetics::read(CParser& parser)
|
||||
{
|
||||
static std::vector<std::string> vopts;
|
||||
if (vopts.empty()) {
|
||||
vopts.reserve(11);
|
||||
vopts.push_back("temp"); // 0
|
||||
vopts.push_back("temperature"); // 1
|
||||
vopts.push_back("dens"); // 2
|
||||
vopts.push_back("density"); // 3
|
||||
vopts.push_back("units"); // 4
|
||||
vopts.push_back("redox"); // 5
|
||||
vopts.push_back("ph"); // 6
|
||||
vopts.push_back("pe"); // 7
|
||||
vopts.push_back("unit"); // 8
|
||||
vopts.push_back("isotope"); // 9
|
||||
vopts.push_back("water"); // 10
|
||||
}
|
||||
// const int count_opt_list = vopts.size();
|
||||
|
||||
cxxKinetics numkey;
|
||||
|
||||
// Read kinetics number and description
|
||||
numkey.read_number_description(parser);
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
CParser::TOKEN_TYPE j;
|
||||
|
||||
//cxxKinetics& sol = s_map[numkey.n_user()];
|
||||
int default_pe = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPTION_DEFAULT)
|
||||
{
|
||||
ptr = next_char;
|
||||
if (parser.copy_token(token, ptr) == CParser::TT_DIGIT) {
|
||||
opt = 9;
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPTION_EOF:
|
||||
break;
|
||||
case CParser::OPTION_KEYWORD:
|
||||
break;
|
||||
case CParser::OPTION_ERROR:
|
||||
opt = CParser::OPTION_EOF;
|
||||
parser.error_msg("Unknown input in KINETICS keyword.", CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
break;
|
||||
|
||||
case 0: // temp
|
||||
case 1: // temperature
|
||||
if (!(parser.get_iss() >> sol.tc))
|
||||
{
|
||||
sol.tc = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // dens
|
||||
case 3: // density
|
||||
parser.get_iss() >> sol.density;
|
||||
break;
|
||||
|
||||
case 4: // units
|
||||
case 8: // unit
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.check_units(token, false, false, sol.units, true) == CParser::OK) {
|
||||
sol.units = token;
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // redox
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
default_pe = cxxPe_Data::store(sol.pe, token);
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.ph = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("H(1)");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.kinetics_pe = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("E");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // isotope
|
||||
{
|
||||
cxxIsotope isotope;
|
||||
if (isotope.read(parser) == cxxIsotope::OK) {
|
||||
sol.add(isotope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // water
|
||||
j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY) {
|
||||
sol.mass_water = 1.0;
|
||||
} else if (j != CParser::TT_DIGIT) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("Expected numeric value for mass of water in kinetics.", CParser::OT_CONTINUE);
|
||||
} else {
|
||||
std::istringstream(token) >> sol.mass_water;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (opt == CParser::OPTION_EOF || opt == CParser::OPTION_KEYWORD) break;
|
||||
}
|
||||
#ifdef SKIP
|
||||
//
|
||||
// Sort totals by description
|
||||
//
|
||||
std::sort(sol.totals.begin(), sol.totals.end());
|
||||
#endif
|
||||
|
||||
//
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
Utilities::str_tolower(token);
|
||||
if ((*iter).get_units().empty()) {
|
||||
(*iter).set_units(sol.units);
|
||||
} else {
|
||||
bool alk = false;
|
||||
if (token.find("alk") == 0) alk = true;
|
||||
token1 = (*iter).get_units();
|
||||
if (parser.check_units(token1, alk, true, sol.get_units(), true) == CParser::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
(*iter).set_units(token1);
|
||||
}
|
||||
}
|
||||
if ((*iter).get_n_pe() < 0) {
|
||||
(*iter).set_n_pe(default_pe);
|
||||
}
|
||||
}
|
||||
sol.default_pe = default_pe;
|
||||
return sol;
|
||||
}
|
||||
#endif
|
||||
|
||||
102
Makefile
102
Makefile
@ -139,7 +139,6 @@ COMMON_COBJS = \
|
||||
utilities.o
|
||||
|
||||
COMMON_CXXOBJS = \
|
||||
Conc.o \
|
||||
Exchange.o \
|
||||
ExchComp.o \
|
||||
GasPhase.o \
|
||||
@ -156,6 +155,7 @@ COMMON_CXXOBJS = \
|
||||
Reaction.o \
|
||||
ReadClass.o \
|
||||
Solution.o \
|
||||
SolutionComp.o \
|
||||
SSassemblage.o \
|
||||
SSassemblageSS.o \
|
||||
Surface.o \
|
||||
@ -178,43 +178,43 @@ ${PROGRAM} : ${OBJECT_FILES}
|
||||
#
|
||||
# CXX files
|
||||
#
|
||||
Conc.o: ../Conc.cxx ../Conc.h ../Utils.h ../char_star.h ../ISolution.h \
|
||||
../NumKeyword.h ../Parser.h ../char_star.h ../Solution.h \
|
||||
../NumKeyword.h ../Isotope.h ../Parser.h ../Conc.h ../NameDouble.h \
|
||||
../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h ../Parser.h \
|
||||
../char_star.h ../Conc.h ../Utils.h ../phreeqc/phrqproto.h \
|
||||
../phqalloc.h
|
||||
Exchange.o: ../Exchange.cxx ../Utils.h ../Exchange.h ../NumKeyword.h \
|
||||
../Parser.h ../char_star.h ../phreeqc/global.h ../phreeqc/phrqtype.h \
|
||||
../char_star.h ../ExchComp.h ../NameDouble.h ../char_star.h ../Parser.h \
|
||||
../char_star.h ../ExchComp.h ../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../char_star.h ../ExchComp.h ../phreeqc/phqalloc.h \
|
||||
../phreeqc/phrqproto.h
|
||||
ExchComp.o: ../ExchComp.cxx ../Utils.h ../ExchComp.h ../NameDouble.h \
|
||||
../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h ../Parser.h \
|
||||
../char_star.h ../char_star.h ../phqalloc.h ../phreeqc/phrqproto.h \
|
||||
../phreeqc/output.h
|
||||
../char_star.h ../char_star.h ../phreeqc/phqalloc.h \
|
||||
../phreeqc/phrqproto.h ../phreeqc/output.h
|
||||
GasPhase.o: ../GasPhase.cxx ../Utils.h ../GasPhase.h ../NumKeyword.h \
|
||||
../Parser.h ../char_star.h ../NameDouble.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
ISolution.o: ../ISolution.cxx ../ISolution.h ../NumKeyword.h ../Parser.h \
|
||||
../char_star.h ../Solution.h ../NumKeyword.h ../Isotope.h ../Parser.h \
|
||||
../SolutionComp.h ../Utils.h ../char_star.h ../NameDouble.h \
|
||||
../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h ../Parser.h \
|
||||
../char_star.h ../SolutionComp.h ../phreeqc/phqalloc.h \
|
||||
../phreeqc/phrqproto.h
|
||||
Isotope.o: ../Isotope.cxx ../Isotope.h ../Parser.h ../char_star.h \
|
||||
../Utils.h ../Parser.h ../phreeqc/global.h ../phreeqc/phrqtype.h \
|
||||
../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
KineticsComp.o: ../KineticsComp.cxx ../Utils.h ../KineticsComp.h \
|
||||
../NameDouble.h ../phreeqc/global.h ../phreeqc/phrqtype.h \
|
||||
../char_star.h ../Parser.h ../char_star.h ../char_star.h ../phqalloc.h \
|
||||
../phreeqc/phrqproto.h
|
||||
../char_star.h ../Parser.h ../char_star.h ../char_star.h \
|
||||
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
KineticsCxx.o: ../KineticsCxx.cxx ../Utils.h ../KineticsCxx.h \
|
||||
../NumKeyword.h ../Parser.h ../char_star.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../KineticsComp.h ../NameDouble.h \
|
||||
../char_star.h ../Parser.h ../char_star.h ../KineticsComp.h \
|
||||
../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
Mix.o: ../Mix.cxx ../Utils.h ../Mix.h ../NumKeyword.h ../Parser.h \
|
||||
../char_star.h ../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h \
|
||||
../phqalloc.h ../phreeqc/phrqproto.h
|
||||
NameDouble.o: ../NameDouble.cxx ../Utils.h ../Conc.h ../Utils.h \
|
||||
../char_star.h ../NameDouble.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
NameDouble.o: ../NameDouble.cxx ../Utils.h ../NameDouble.h \
|
||||
../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h ../Parser.h \
|
||||
../char_star.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
NumKeyword.o: ../NumKeyword.cxx ../NumKeyword.h ../Parser.h \
|
||||
../char_star.h
|
||||
Parser.o: ../Parser.cxx ../Parser.h ../char_star.h ../Utils.h \
|
||||
@ -222,18 +222,18 @@ Parser.o: ../Parser.cxx ../Parser.h ../char_star.h ../Utils.h \
|
||||
PPassemblageComp.o: ../PPassemblageComp.cxx ../Utils.h \
|
||||
../PPassemblageComp.h ../NameDouble.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../char_star.h ../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../char_star.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
PPassemblage.o: ../PPassemblage.cxx ../Utils.h ../PPassemblage.h \
|
||||
../NumKeyword.h ../Parser.h ../char_star.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../PPassemblageComp.h \
|
||||
../NameDouble.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../PPassemblageComp.h ../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../PPassemblageComp.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
Reaction.o: ../Reaction.cxx ../Utils.h ../Reaction.h ../NumKeyword.h \
|
||||
../Parser.h ../char_star.h ../NameDouble.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
ReadClass.o: ../ReadClass.cxx ../Parser.h ../char_star.h ../Solution.h \
|
||||
../NumKeyword.h ../Parser.h ../Isotope.h ../Parser.h ../Conc.h \
|
||||
../NumKeyword.h ../Parser.h ../Isotope.h ../Parser.h ../SolutionComp.h \
|
||||
../Utils.h ../char_star.h ../NameDouble.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../Exchange.h ../NumKeyword.h ../char_star.h ../ExchComp.h \
|
||||
@ -247,50 +247,58 @@ ReadClass.o: ../ReadClass.cxx ../Parser.h ../char_star.h ../Solution.h \
|
||||
../char_star.h ../GasPhase.h ../NumKeyword.h ../NameDouble.h \
|
||||
../char_star.h ../Reaction.h ../NumKeyword.h ../NameDouble.h \
|
||||
../char_star.h ../Mix.h ../NumKeyword.h ../char_star.h ../Temperature.h \
|
||||
../NumKeyword.h ../char_star.h ../phqalloc.h ../phreeqc/output.h \
|
||||
../phreeqc/phrqproto.h
|
||||
../NumKeyword.h ../char_star.h ../phreeqc/phqalloc.h \
|
||||
../phreeqc/output.h ../phreeqc/phrqproto.h
|
||||
SolutionComp.o: ../SolutionComp.cxx ../SolutionComp.h ../Utils.h \
|
||||
../char_star.h ../ISolution.h ../NumKeyword.h ../Parser.h \
|
||||
../char_star.h ../Solution.h ../NumKeyword.h ../Isotope.h ../Parser.h \
|
||||
../SolutionComp.h ../NameDouble.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../SolutionComp.h ../Utils.h ../phreeqc/phrqproto.h \
|
||||
../phreeqc/phqalloc.h
|
||||
Solution.o: ../Solution.cxx ../Utils.h ../Solution.h ../NumKeyword.h \
|
||||
../Parser.h ../char_star.h ../Isotope.h ../Parser.h ../Conc.h \
|
||||
../Parser.h ../char_star.h ../Isotope.h ../Parser.h ../SolutionComp.h \
|
||||
../Utils.h ../char_star.h ../NameDouble.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../phqalloc.h ../phreeqc/phrqproto.h ../ISolution.h ../NumKeyword.h \
|
||||
../Solution.h ../Conc.h ../Exchange.h ../NumKeyword.h ../char_star.h \
|
||||
../ExchComp.h ../NameDouble.h ../char_star.h ../Surface.h \
|
||||
../NumKeyword.h ../char_star.h ../SurfComp.h ../NameDouble.h \
|
||||
../char_star.h ../SurfCharge.h ../NameDouble.h ../char_star.h \
|
||||
../PPassemblage.h ../NumKeyword.h ../char_star.h ../PPassemblageComp.h \
|
||||
../NameDouble.h ../char_star.h ../KineticsCxx.h ../NumKeyword.h \
|
||||
../char_star.h ../KineticsComp.h ../NameDouble.h ../char_star.h \
|
||||
../SSassemblage.h ../NumKeyword.h ../char_star.h ../SSassemblageSS.h \
|
||||
../NameDouble.h ../char_star.h ../GasPhase.h ../NumKeyword.h \
|
||||
../NameDouble.h ../char_star.h ../Reaction.h ../NumKeyword.h \
|
||||
../NameDouble.h ../char_star.h ../Mix.h ../NumKeyword.h ../char_star.h \
|
||||
../Temperature.h ../NumKeyword.h ../char_star.h
|
||||
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ../ISolution.h \
|
||||
../NumKeyword.h ../Solution.h ../SolutionComp.h ../Exchange.h \
|
||||
../NumKeyword.h ../char_star.h ../ExchComp.h ../NameDouble.h \
|
||||
../char_star.h ../Surface.h ../NumKeyword.h ../char_star.h \
|
||||
../SurfComp.h ../NameDouble.h ../char_star.h ../SurfCharge.h \
|
||||
../NameDouble.h ../char_star.h ../PPassemblage.h ../NumKeyword.h \
|
||||
../char_star.h ../PPassemblageComp.h ../NameDouble.h ../char_star.h \
|
||||
../KineticsCxx.h ../NumKeyword.h ../char_star.h ../KineticsComp.h \
|
||||
../NameDouble.h ../char_star.h ../SSassemblage.h ../NumKeyword.h \
|
||||
../char_star.h ../SSassemblageSS.h ../NameDouble.h ../char_star.h \
|
||||
../GasPhase.h ../NumKeyword.h ../NameDouble.h ../char_star.h \
|
||||
../Reaction.h ../NumKeyword.h ../NameDouble.h ../char_star.h ../Mix.h \
|
||||
../NumKeyword.h ../char_star.h ../Temperature.h ../NumKeyword.h \
|
||||
../char_star.h
|
||||
SSassemblage.o: ../SSassemblage.cxx ../Utils.h ../SSassemblage.h \
|
||||
../NumKeyword.h ../Parser.h ../char_star.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../SSassemblageSS.h \
|
||||
../NameDouble.h ../char_star.h ../Parser.h ../char_star.h \
|
||||
../SSassemblageSS.h ../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../SSassemblageSS.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
SSassemblageSS.o: ../SSassemblageSS.cxx ../Utils.h ../SSassemblageSS.h \
|
||||
../NameDouble.h ../phreeqc/global.h ../phreeqc/phrqtype.h \
|
||||
../char_star.h ../Parser.h ../char_star.h ../char_star.h \
|
||||
../NameDouble.h ../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../NameDouble.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
Surface.o: ../Surface.cxx ../Utils.h ../Surface.h ../NumKeyword.h \
|
||||
../Parser.h ../char_star.h ../phreeqc/global.h ../phreeqc/phrqtype.h \
|
||||
../char_star.h ../SurfComp.h ../NameDouble.h ../char_star.h ../Parser.h \
|
||||
../char_star.h ../SurfCharge.h ../NameDouble.h ../char_star.h \
|
||||
../SurfComp.h ../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../SurfComp.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
SurfCharge.o: ../SurfCharge.cxx ../Utils.h ../SurfCharge.h \
|
||||
../NameDouble.h ../phreeqc/global.h ../phreeqc/phrqtype.h \
|
||||
../char_star.h ../Parser.h ../char_star.h ../char_star.h \
|
||||
../phreeqc/output.h ../phqalloc.h ../phreeqc/phrqproto.h
|
||||
../phreeqc/output.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
|
||||
SurfComp.o: ../SurfComp.cxx ../Utils.h ../SurfComp.h ../NameDouble.h \
|
||||
../phreeqc/global.h ../phreeqc/phrqtype.h ../char_star.h ../Parser.h \
|
||||
../char_star.h ../char_star.h ../phqalloc.h ../phreeqc/phrqproto.h \
|
||||
../phreeqc/output.h
|
||||
../char_star.h ../char_star.h ../phreeqc/phqalloc.h \
|
||||
../phreeqc/phrqproto.h ../phreeqc/output.h
|
||||
Temperature.o: ../Temperature.cxx ../Utils.h ../Temperature.h \
|
||||
../NumKeyword.h ../Parser.h ../char_star.h ../phreeqc/global.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../phqalloc.h \
|
||||
../phreeqc/phrqtype.h ../char_star.h ../phreeqc/phqalloc.h \
|
||||
../phreeqc/phrqproto.h
|
||||
Utils.o: ../Utils.cxx ../Utils.h ../Parser.h ../char_star.h \
|
||||
../phreeqc/output.h
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#endif
|
||||
|
||||
#include "Utils.h" // define first
|
||||
#include "Conc.h"
|
||||
#include "NameDouble.h"
|
||||
#define EXTERNAL extern
|
||||
#include "global.h"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include "NumKeyword.h"
|
||||
#include "Isotope.h"
|
||||
#include "Conc.h"
|
||||
#include "SolutionComp.h"
|
||||
#include "NameDouble.h"
|
||||
#define EXTERNAL extern
|
||||
#include "global.h"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
|
||||
#endif
|
||||
|
||||
#include "Conc.h"
|
||||
#include "SolutionComp.h"
|
||||
#include "ISolution.h"
|
||||
#include "Utils.h"
|
||||
#include <cassert>
|
||||
@ -11,7 +11,7 @@
|
||||
#include "phrqproto.h"
|
||||
#include "phqalloc.h"
|
||||
|
||||
cxxConc::cxxConc(void)
|
||||
cxxSolutionComp::cxxSolutionComp(void)
|
||||
: description(NULL)
|
||||
, moles(0.0)
|
||||
, input_conc(0.0)
|
||||
@ -25,7 +25,7 @@ cxxConc::cxxConc(void)
|
||||
//, phase(NULL)
|
||||
{
|
||||
}
|
||||
cxxConc::cxxConc(struct conc *conc_ptr)
|
||||
cxxSolutionComp::cxxSolutionComp(struct conc *conc_ptr)
|
||||
{
|
||||
description = conc_ptr->description;
|
||||
moles = conc_ptr->moles;
|
||||
@ -40,11 +40,11 @@ cxxConc::cxxConc(struct conc *conc_ptr)
|
||||
//phase = conc_ptr->phase;
|
||||
}
|
||||
|
||||
cxxConc::~cxxConc(void)
|
||||
cxxSolutionComp::~cxxSolutionComp(void)
|
||||
{
|
||||
}
|
||||
/*
|
||||
struct conc *cxxConc::concarray(std::map <char *, double, CHARSTAR_LESS> &totals)
|
||||
struct conc *cxxSolutionComp::concarray(std::map <char *, double, CHARSTAR_LESS> &totals)
|
||||
// for Solutions, not ISolutions
|
||||
// takes a map of (elt name, moles)
|
||||
// returns list of conc structures
|
||||
@ -71,16 +71,16 @@ struct conc *cxxConc::concarray(std::map <char *, double, CHARSTAR_LESS> &totals
|
||||
return(c);
|
||||
}
|
||||
*/
|
||||
struct conc *cxxConc::cxxConc2conc(const std::set <cxxConc> &totals)
|
||||
struct conc *cxxSolutionComp::cxxSolutionComp2conc(const std::set <cxxSolutionComp> &totals)
|
||||
// for ISolutions
|
||||
// takes a std::vector cxxConc structures
|
||||
// takes a std::vector cxxSolutionComp structures
|
||||
// returns list of conc structures
|
||||
{
|
||||
struct conc *c;
|
||||
c = (struct conc *) PHRQ_malloc((size_t) ((totals.size() + 1) * sizeof(struct conc)));
|
||||
if (c == NULL) malloc_error();
|
||||
int i = 0;
|
||||
for (std::set<cxxConc>::const_iterator it = totals.begin(); it != totals.end(); ++it) {
|
||||
for (std::set<cxxSolutionComp>::const_iterator it = totals.begin(); it != totals.end(); ++it) {
|
||||
c[i].description = it->description;
|
||||
c[i].moles = it->moles;
|
||||
c[i].input_conc = it->input_conc;
|
||||
@ -99,7 +99,7 @@ struct conc *cxxConc::cxxConc2conc(const std::set <cxxConc> &totals)
|
||||
}
|
||||
|
||||
#ifdef SKIP
|
||||
cxxConc::STATUS_TYPE cxxConc::read(CParser& parser, cxxISolution& solution)
|
||||
cxxSolutionComp::STATUS_TYPE cxxSolutionComp::read(CParser& parser, cxxISolution& solution)
|
||||
{
|
||||
// std::string& str = parser.line();
|
||||
std::string str = parser.line();
|
||||
@ -133,7 +133,7 @@ cxxConc::STATUS_TYPE cxxConc::read(CParser& parser, cxxISolution& solution)
|
||||
if (count_redox_states == 0) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("No element or master species given for concentration input.", CParser::OT_CONTINUE);
|
||||
return cxxConc::ERROR;
|
||||
return cxxSolutionComp::ERROR;
|
||||
}
|
||||
description = token1;
|
||||
|
||||
@ -149,9 +149,9 @@ cxxConc::STATUS_TYPE cxxConc::read(CParser& parser, cxxISolution& solution)
|
||||
std::ostringstream err;
|
||||
err << "Concentration data error for " << token1 << " in solution input.";
|
||||
parser.error_msg(err, CParser::OT_CONTINUE);
|
||||
return cxxConc::ERROR;
|
||||
return cxxSolutionComp::ERROR;
|
||||
}
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxConc::OK;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK;
|
||||
|
||||
// Read optional data
|
||||
token1 = token;
|
||||
@ -160,9 +160,9 @@ cxxConc::STATUS_TYPE cxxConc::read(CParser& parser, cxxISolution& solution)
|
||||
if (parser.check_units(token1, alk, false, solution.get_units(), false) == CParser::OK) {
|
||||
if (parser.check_units(token1, alk, false, solution.get_units(), true) == CParser::OK) {
|
||||
this->units = token1;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxConc::OK;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK;
|
||||
} else {
|
||||
return cxxConc::ERROR;
|
||||
return cxxSolutionComp::ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,49 +173,49 @@ cxxConc::STATUS_TYPE cxxConc::read(CParser& parser, cxxISolution& solution)
|
||||
{
|
||||
parser.copy_token(token, ptr);
|
||||
this->as = token;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxConc::OK;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK;
|
||||
}
|
||||
// Check for "gfw" followed by gram formula weight
|
||||
else if (token1.compare("gfw") == 0)
|
||||
{
|
||||
if (parser.copy_token(token, ptr) != CParser::TT_DIGIT) {
|
||||
parser.error_msg("Expecting gram formula weight.", CParser::OT_CONTINUE);
|
||||
return cxxConc::ERROR;
|
||||
return cxxSolutionComp::ERROR;
|
||||
} else {
|
||||
parser.get_iss() >> this->gfw;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxConc::OK;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for redox couple for pe
|
||||
if ( Utilities::strcmp_nocase_arg1(token.c_str(), "pe") == 0 ) {
|
||||
this->n_pe = cxxPe_Data::store(solution.pe, token);
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxConc::OK;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK;
|
||||
} else if (token.find("/") != std::string::npos) {
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
this->n_pe = cxxPe_Data::store(solution.pe, token);
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxConc::OK;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK;
|
||||
} else {
|
||||
return cxxConc::ERROR;
|
||||
return cxxSolutionComp::ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
// Must have phase
|
||||
this->equation_name = token;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxConc::OK;
|
||||
if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK;
|
||||
|
||||
// Check for saturation index
|
||||
if (!(std::istringstream(token) >> this->phase_si))
|
||||
{
|
||||
parser.error_msg("Expected saturation index.", CParser::OT_CONTINUE);
|
||||
return cxxConc::ERROR;
|
||||
return cxxSolutionComp::ERROR;
|
||||
}
|
||||
return cxxConc::OK;
|
||||
return cxxSolutionComp::OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SKIP
|
||||
void cxxConc::dump_xml(std::ostream& s_oss, unsigned int indent)const
|
||||
void cxxSolutionComp::dump_xml(std::ostream& s_oss, unsigned int indent)const
|
||||
{
|
||||
unsigned int i;
|
||||
std::string indent0("");
|
||||
@ -1,5 +1,5 @@
|
||||
#if !defined(CONC_H_INCLUDED)
|
||||
#define CONC_H_INCLUDED
|
||||
#if !defined(SOLUTIONCOMP_H_INCLUDED)
|
||||
#define SOLUTIONCOMP_H_INCLUDED
|
||||
|
||||
//#include "Parser.h"
|
||||
#include "Utils.h"
|
||||
@ -13,12 +13,12 @@
|
||||
// forward declarations
|
||||
class cxxISolution; // reqd for read and dump_xml
|
||||
|
||||
class cxxConc
|
||||
class cxxSolutionComp
|
||||
{
|
||||
public:
|
||||
cxxConc(void);
|
||||
cxxConc(struct conc *conc_ptr);
|
||||
~cxxConc(void);
|
||||
cxxSolutionComp(void);
|
||||
cxxSolutionComp(struct conc *conc_ptr);
|
||||
~cxxSolutionComp(void);
|
||||
|
||||
enum STATUS_TYPE {
|
||||
ERROR = 0,
|
||||
@ -46,12 +46,9 @@ public:
|
||||
int get_n_pe()const {return this->n_pe;}
|
||||
void set_n_pe(int n_pe) {this->n_pe = n_pe;}
|
||||
|
||||
//bool operator<(const cxxConc& conc)const { return (this->description < conc.description); }
|
||||
bool operator<(const cxxConc& conc)const { return ::strcmp(this->description, conc.description) < 0; }
|
||||
bool operator<(const cxxSolutionComp& conc)const { return ::strcmp(this->description, conc.description) < 0; }
|
||||
|
||||
//static struct conc * concarray(std::map<char *, double, CHARSTAR_LESS> &t );
|
||||
|
||||
static struct conc * cxxConc2conc(const std::set<cxxConc> &t );
|
||||
static struct conc * cxxSolutionComp2conc(const std::set<cxxSolutionComp> &t );
|
||||
|
||||
private:
|
||||
char * description;
|
||||
@ -59,12 +56,10 @@ private:
|
||||
double input_conc;
|
||||
char * units;
|
||||
char * equation_name;
|
||||
//struct phase *phase;
|
||||
double phase_si;
|
||||
int n_pe;
|
||||
char * as;
|
||||
double gfw;
|
||||
//int skip;
|
||||
};
|
||||
|
||||
#endif // CONC_H_INCLUDED
|
||||
#endif // SOLUTIONCOMP_H_INCLUDED
|
||||
193
SurfCharge.cxx
193
SurfCharge.cxx
@ -298,196 +298,3 @@ void cxxSurfCharge::read_raw(CParser& parser)
|
||||
parser.error_msg("La_psi not defined for SurfCharge input.", CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SKIP
|
||||
cxxSurfCharge& cxxSurfCharge::read(CParser& parser)
|
||||
{
|
||||
static std::vector<std::string> vopts;
|
||||
if (vopts.empty()) {
|
||||
vopts.reserve(11);
|
||||
vopts.push_back("temp"); // 0
|
||||
vopts.push_back("temperature"); // 1
|
||||
vopts.push_back("dens"); // 2
|
||||
vopts.push_back("density"); // 3
|
||||
vopts.push_back("units"); // 4
|
||||
vopts.push_back("redox"); // 5
|
||||
vopts.push_back("ph"); // 6
|
||||
vopts.push_back("pe"); // 7
|
||||
vopts.push_back("unit"); // 8
|
||||
vopts.push_back("isotope"); // 9
|
||||
vopts.push_back("water"); // 10
|
||||
}
|
||||
// const int count_opt_list = vopts.size();
|
||||
|
||||
cxxSurfCharge numkey;
|
||||
|
||||
// Read surf_charge number and description
|
||||
numkey.read_number_description(parser);
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
CParser::TOKEN_TYPE j;
|
||||
|
||||
//cxxSurfCharge& sol = s_map[numkey.n_user()];
|
||||
int default_pe = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPTION_DEFAULT)
|
||||
{
|
||||
ptr = next_char;
|
||||
if (parser.copy_token(token, ptr) == CParser::TT_DIGIT) {
|
||||
opt = 9;
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPTION_EOF:
|
||||
break;
|
||||
case CParser::OPTION_KEYWORD:
|
||||
break;
|
||||
case CParser::OPTION_ERROR:
|
||||
opt = CParser::OPTION_EOF;
|
||||
parser.error_msg("Unknown input in SURF_CHARGE keyword.", CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
break;
|
||||
|
||||
case 0: // temp
|
||||
case 1: // temperature
|
||||
if (!(parser.get_iss() >> sol.tc))
|
||||
{
|
||||
sol.tc = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // dens
|
||||
case 3: // density
|
||||
parser.get_iss() >> sol.density;
|
||||
break;
|
||||
|
||||
case 4: // units
|
||||
case 8: // unit
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.check_units(token, false, false, sol.units, true) == CParser::OK) {
|
||||
sol.units = token;
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // redox
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
default_pe = cxxPe_Data::store(sol.pe, token);
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.ph = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("H(1)");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.surf_charge_pe = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("E");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // isotope
|
||||
{
|
||||
cxxIsotope isotope;
|
||||
if (isotope.read(parser) == cxxIsotope::OK) {
|
||||
sol.add(isotope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // water
|
||||
j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY) {
|
||||
sol.mass_water = 1.0;
|
||||
} else if (j != CParser::TT_DIGIT) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("Expected numeric value for mass of water in surf_charge.", CParser::OT_CONTINUE);
|
||||
} else {
|
||||
std::istringstream(token) >> sol.mass_water;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (opt == CParser::OPTION_EOF || opt == CParser::OPTION_KEYWORD) break;
|
||||
}
|
||||
#ifdef SKIP
|
||||
//
|
||||
// Sort totals by description
|
||||
//
|
||||
std::sort(sol.totals.begin(), sol.totals.end());
|
||||
#endif
|
||||
|
||||
//
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
Utilities::str_tolower(token);
|
||||
if ((*iter).get_units().empty()) {
|
||||
(*iter).set_units(sol.units);
|
||||
} else {
|
||||
bool alk = false;
|
||||
if (token.find("alk") == 0) alk = true;
|
||||
token1 = (*iter).get_units();
|
||||
if (parser.check_units(token1, alk, true, sol.get_units(), true) == CParser::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
(*iter).set_units(token1);
|
||||
}
|
||||
}
|
||||
if ((*iter).get_n_pe() < 0) {
|
||||
(*iter).set_n_pe(default_pe);
|
||||
}
|
||||
}
|
||||
sol.default_pe = default_pe;
|
||||
return sol;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
193
SurfComp.cxx
193
SurfComp.cxx
@ -342,196 +342,3 @@ void cxxSurfComp::read_raw(CParser& parser)
|
||||
parser.error_msg("Charge_balance not defined for SurfComp input.", CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SKIP
|
||||
cxxSurfComp& cxxSurfComp::read(CParser& parser)
|
||||
{
|
||||
static std::vector<std::string> vopts;
|
||||
if (vopts.empty()) {
|
||||
vopts.reserve(11);
|
||||
vopts.push_back("temp"); // 0
|
||||
vopts.push_back("temperature"); // 1
|
||||
vopts.push_back("dens"); // 2
|
||||
vopts.push_back("density"); // 3
|
||||
vopts.push_back("units"); // 4
|
||||
vopts.push_back("redox"); // 5
|
||||
vopts.push_back("ph"); // 6
|
||||
vopts.push_back("pe"); // 7
|
||||
vopts.push_back("unit"); // 8
|
||||
vopts.push_back("isotope"); // 9
|
||||
vopts.push_back("water"); // 10
|
||||
}
|
||||
// const int count_opt_list = vopts.size();
|
||||
|
||||
cxxSurfComp numkey;
|
||||
|
||||
// Read surf_comp number and description
|
||||
numkey.read_number_description(parser);
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
CParser::TOKEN_TYPE j;
|
||||
|
||||
//cxxSurfComp& sol = s_map[numkey.n_user()];
|
||||
int default_pe = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPTION_DEFAULT)
|
||||
{
|
||||
ptr = next_char;
|
||||
if (parser.copy_token(token, ptr) == CParser::TT_DIGIT) {
|
||||
opt = 9;
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPTION_EOF:
|
||||
break;
|
||||
case CParser::OPTION_KEYWORD:
|
||||
break;
|
||||
case CParser::OPTION_ERROR:
|
||||
opt = CParser::OPTION_EOF;
|
||||
parser.error_msg("Unknown input in SURF_COMP keyword.", CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
break;
|
||||
|
||||
case 0: // temp
|
||||
case 1: // temperature
|
||||
if (!(parser.get_iss() >> sol.tc))
|
||||
{
|
||||
sol.tc = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // dens
|
||||
case 3: // density
|
||||
parser.get_iss() >> sol.density;
|
||||
break;
|
||||
|
||||
case 4: // units
|
||||
case 8: // unit
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.check_units(token, false, false, sol.units, true) == CParser::OK) {
|
||||
sol.units = token;
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // redox
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
default_pe = cxxPe_Data::store(sol.pe, token);
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.ph = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("H(1)");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.surf_comp_pe = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("E");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // isotope
|
||||
{
|
||||
cxxIsotope isotope;
|
||||
if (isotope.read(parser) == cxxIsotope::OK) {
|
||||
sol.add(isotope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // water
|
||||
j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY) {
|
||||
sol.mass_water = 1.0;
|
||||
} else if (j != CParser::TT_DIGIT) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("Expected numeric value for mass of water in surf_comp.", CParser::OT_CONTINUE);
|
||||
} else {
|
||||
std::istringstream(token) >> sol.mass_water;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (opt == CParser::OPTION_EOF || opt == CParser::OPTION_KEYWORD) break;
|
||||
}
|
||||
#ifdef SKIP
|
||||
//
|
||||
// Sort totals by description
|
||||
//
|
||||
std::sort(sol.totals.begin(), sol.totals.end());
|
||||
#endif
|
||||
|
||||
//
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
Utilities::str_tolower(token);
|
||||
if ((*iter).get_units().empty()) {
|
||||
(*iter).set_units(sol.units);
|
||||
} else {
|
||||
bool alk = false;
|
||||
if (token.find("alk") == 0) alk = true;
|
||||
token1 = (*iter).get_units();
|
||||
if (parser.check_units(token1, alk, true, sol.get_units(), true) == CParser::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
(*iter).set_units(token1);
|
||||
}
|
||||
}
|
||||
if ((*iter).get_n_pe() < 0) {
|
||||
(*iter).set_n_pe(default_pe);
|
||||
}
|
||||
}
|
||||
sol.default_pe = default_pe;
|
||||
return sol;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
191
Surface.cxx
191
Surface.cxx
@ -364,194 +364,3 @@ void cxxSurface::read_raw(CParser& parser)
|
||||
parser.error_msg("Thickness not defined for SURFACE_RAW input.", CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
#ifdef SKIP
|
||||
cxxSurface& cxxSurface::read(CParser& parser)
|
||||
{
|
||||
static std::vector<std::string> vopts;
|
||||
if (vopts.empty()) {
|
||||
vopts.reserve(11);
|
||||
vopts.push_back("temp"); // 0
|
||||
vopts.push_back("temperature"); // 1
|
||||
vopts.push_back("dens"); // 2
|
||||
vopts.push_back("density"); // 3
|
||||
vopts.push_back("units"); // 4
|
||||
vopts.push_back("redox"); // 5
|
||||
vopts.push_back("ph"); // 6
|
||||
vopts.push_back("pe"); // 7
|
||||
vopts.push_back("unit"); // 8
|
||||
vopts.push_back("isotope"); // 9
|
||||
vopts.push_back("water"); // 10
|
||||
}
|
||||
// const int count_opt_list = vopts.size();
|
||||
|
||||
cxxSurface numkey;
|
||||
|
||||
// Read surface number and description
|
||||
numkey.read_number_description(parser);
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
CParser::TOKEN_TYPE j;
|
||||
|
||||
//cxxSurface& sol = s_map[numkey.n_user()];
|
||||
int default_pe = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPTION_DEFAULT)
|
||||
{
|
||||
ptr = next_char;
|
||||
if (parser.copy_token(token, ptr) == CParser::TT_DIGIT) {
|
||||
opt = 9;
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPTION_EOF:
|
||||
break;
|
||||
case CParser::OPTION_KEYWORD:
|
||||
break;
|
||||
case CParser::OPTION_ERROR:
|
||||
opt = CParser::OPTION_EOF;
|
||||
parser.error_msg("Unknown input in SURFACE keyword.", CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
break;
|
||||
|
||||
case 0: // temp
|
||||
case 1: // temperature
|
||||
if (!(parser.get_iss() >> sol.tc))
|
||||
{
|
||||
sol.tc = 25;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // dens
|
||||
case 3: // density
|
||||
parser.get_iss() >> sol.density;
|
||||
break;
|
||||
|
||||
case 4: // units
|
||||
case 8: // unit
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.check_units(token, false, false, sol.units, true) == CParser::OK) {
|
||||
sol.units = token;
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // redox
|
||||
if (parser.copy_token(token, next_char) == CParser::TT_EMPTY) break;
|
||||
if (parser.parse_couple(token) == CParser::OK) {
|
||||
default_pe = cxxPe_Data::store(sol.pe, token);
|
||||
} else {
|
||||
parser.incr_input_error();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // ph
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.ph = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("H(1)");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // pe
|
||||
{
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
break;
|
||||
}
|
||||
sol.surface_pe = conc.get_input_conc();
|
||||
if (conc.get_equation_name().empty()) {
|
||||
break;
|
||||
}
|
||||
conc.set_description("E");
|
||||
sol.add(conc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // isotope
|
||||
{
|
||||
cxxIsotope isotope;
|
||||
if (isotope.read(parser) == cxxIsotope::OK) {
|
||||
sol.add(isotope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // water
|
||||
j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY) {
|
||||
sol.mass_water = 1.0;
|
||||
} else if (j != CParser::TT_DIGIT) {
|
||||
parser.incr_input_error();
|
||||
parser.error_msg("Expected numeric value for mass of water in surface.", CParser::OT_CONTINUE);
|
||||
} else {
|
||||
std::istringstream(token) >> sol.mass_water;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::OPTION_DEFAULT:
|
||||
{
|
||||
// Read concentration
|
||||
cxxConc conc;
|
||||
if (conc.read(parser, sol) == cxxConc::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
sol.add(conc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (opt == CParser::OPTION_EOF || opt == CParser::OPTION_KEYWORD) break;
|
||||
}
|
||||
#ifdef SKIP
|
||||
//
|
||||
// Sort totals by description
|
||||
//
|
||||
std::sort(sol.totals.begin(), sol.totals.end());
|
||||
#endif
|
||||
|
||||
//
|
||||
// fix up default units and default pe
|
||||
//
|
||||
std::string token1;
|
||||
std::vector<cxxConc>::iterator iter = sol.totals.begin();
|
||||
for (; iter != sol.totals.end(); ++iter)
|
||||
{
|
||||
token = (*iter).get_description();
|
||||
Utilities::str_tolower(token);
|
||||
if ((*iter).get_units().empty()) {
|
||||
(*iter).set_units(sol.units);
|
||||
} else {
|
||||
bool alk = false;
|
||||
if (token.find("alk") == 0) alk = true;
|
||||
token1 = (*iter).get_units();
|
||||
if (parser.check_units(token1, alk, true, sol.get_units(), true) == CParser::ERROR) {
|
||||
parser.incr_input_error();
|
||||
} else {
|
||||
(*iter).set_units(token1);
|
||||
}
|
||||
}
|
||||
if ((*iter).get_n_pe() < 0) {
|
||||
(*iter).set_n_pe(default_pe);
|
||||
}
|
||||
}
|
||||
sol.default_pe = default_pe;
|
||||
return sol;
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user