mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
Delete, Dump seem to work.
SOLUTION_MODIFY seems to work, but need to check all features. EQUILIBRIUM_PHASES_MODIFY fails. Need to use maps to allow update I think. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@3719 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
74bb0bc5d0
commit
2fd35ce463
@ -59,7 +59,7 @@ class cxxPPassemblage:public cxxNumKeyword
|
||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||
|
||||
protected:
|
||||
std::list < cxxPPassemblageComp > ppAssemblageComps;
|
||||
std::list < cxxPPassemblageComp > ppAssemblageComps;
|
||||
cxxNameDouble eltList;
|
||||
cxxNameDouble totals;
|
||||
|
||||
|
||||
25
Parser.cxx
25
Parser.cxx
@ -816,17 +816,34 @@ CParser::get_option(const std::vector < std::string > &opt_list,
|
||||
}
|
||||
else
|
||||
{
|
||||
pos_ptr = 0;
|
||||
copy_token(option, pos_ptr);
|
||||
//pos_ptr = 0;
|
||||
//copy_token(option, pos_ptr);
|
||||
//if (find_option(option, &opt, opt_list, true) == FT_OK)
|
||||
//{
|
||||
// j = opt;
|
||||
// next_pos = pos_ptr;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// j = OPT_DEFAULT;
|
||||
// next_pos = 0;
|
||||
//}
|
||||
|
||||
//std::istringstream m_line_iss_copy = m_line_iss;
|
||||
pos_ptr = m_line_iss.tellg();
|
||||
m_line_iss >> option;
|
||||
if (find_option(option, &opt, opt_list, true) == FT_OK)
|
||||
{
|
||||
j = opt;
|
||||
next_pos = pos_ptr;
|
||||
next_pos = m_line_iss.tellg();
|
||||
}
|
||||
else
|
||||
{
|
||||
j = OPT_DEFAULT;
|
||||
next_pos = 0;
|
||||
m_line_iss.seekg(pos_ptr);
|
||||
m_line_iss.clear();
|
||||
next_pos = pos_ptr;
|
||||
//m_line_iss >> option;
|
||||
}
|
||||
/*
|
||||
if (true) // pr.echo_input == TRUE
|
||||
|
||||
@ -1105,6 +1105,24 @@ read_solution_modify(void)
|
||||
*
|
||||
*/
|
||||
int return_value;
|
||||
|
||||
// find solution number
|
||||
char token[MAX_LENGTH];
|
||||
char *next;
|
||||
int l, n_user, n;
|
||||
next = line;
|
||||
copy_token(token, &next, &l);
|
||||
if (copy_token(token, &next, &l) != DIGIT)
|
||||
{
|
||||
input_error++;
|
||||
sprintf(error_string, "Expected solution number following SOLUTION_MODIFY.\n%s\n", line_save);
|
||||
error_msg(error_string, CONTINUE);
|
||||
return (ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
sscanf(token,"%d", &n_user);
|
||||
}
|
||||
/*
|
||||
* Make parser
|
||||
*/
|
||||
@ -1130,23 +1148,7 @@ read_solution_modify(void)
|
||||
parser.set_echo_file(CParser::EO_NOKEYWORDS);
|
||||
}
|
||||
|
||||
// find solution number
|
||||
char token[MAX_LENGTH];
|
||||
char *next;
|
||||
int l, n_user, n;
|
||||
next = line;
|
||||
copy_token(token, &next, &l);
|
||||
if (copy_token(token, &next, &l) != DIGIT)
|
||||
{
|
||||
input_error++;
|
||||
sprintf(error_string, "Expected solution number following SOLUTION_MODIFY.\n%s\n", line_save);
|
||||
error_msg(error_string, CONTINUE);
|
||||
return (ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
sscanf(token,"%d", &n_user);
|
||||
}
|
||||
|
||||
if (solution_bsearch(n_user, &n, FALSE) == NULL)
|
||||
{
|
||||
input_error++;
|
||||
@ -1190,6 +1192,24 @@ read_equilibrium_phases_modify(void)
|
||||
*
|
||||
*/
|
||||
int return_value;
|
||||
|
||||
// find equilibrium_phases number
|
||||
char token[MAX_LENGTH];
|
||||
char *next;
|
||||
int l, n_user, n;
|
||||
next = line;
|
||||
copy_token(token, &next, &l);
|
||||
if (copy_token(token, &next, &l) != DIGIT)
|
||||
{
|
||||
input_error++;
|
||||
sprintf(error_string, "Expected equilibrium_phases number following EQUILIBRIUM_PHASES_MODIFY.\n%s\n", line_save);
|
||||
error_msg(error_string, CONTINUE);
|
||||
return (ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
sscanf(token,"%d", &n_user);
|
||||
}
|
||||
/*
|
||||
* Make parser
|
||||
*/
|
||||
@ -1215,23 +1235,6 @@ read_equilibrium_phases_modify(void)
|
||||
parser.set_echo_file(CParser::EO_NOKEYWORDS);
|
||||
}
|
||||
|
||||
// find equilibrium_phases number
|
||||
char token[MAX_LENGTH];
|
||||
char *next;
|
||||
int l, n_user, n;
|
||||
next = line;
|
||||
copy_token(token, &next, &l);
|
||||
if (copy_token(token, &next, &l) != DIGIT)
|
||||
{
|
||||
input_error++;
|
||||
sprintf(error_string, "Expected equilibrium_phases number following EQUILIBRIUM_PHASES_MODIFY.\n%s\n", line_save);
|
||||
error_msg(error_string, CONTINUE);
|
||||
return (ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
sscanf(token,"%d", &n_user);
|
||||
}
|
||||
if (pp_assemblage_bsearch(n_user, &n) == NULL)
|
||||
{
|
||||
input_error++;
|
||||
|
||||
63
dumper.cpp
63
dumper.cpp
@ -243,20 +243,24 @@ bool dumper::Read(CParser & parser)
|
||||
static std::vector < std::string > vopts;
|
||||
if (vopts.empty())
|
||||
{
|
||||
vopts.reserve(15);
|
||||
vopts.reserve(20);
|
||||
vopts.push_back("solution");
|
||||
vopts.push_back("solutions");
|
||||
vopts.push_back("pp_assemblage");
|
||||
vopts.push_back("pp_assemblages");
|
||||
vopts.push_back("equilibrium_phase");
|
||||
vopts.push_back("equilibrium_phases");
|
||||
vopts.push_back("exchange");
|
||||
vopts.push_back("surface");
|
||||
vopts.push_back("s_s_assemblage");
|
||||
vopts.push_back("solid_solution");
|
||||
vopts.push_back("solid_solutions");
|
||||
vopts.push_back("gas_phase");
|
||||
vopts.push_back("gas_phases");
|
||||
vopts.push_back("kinetics");
|
||||
vopts.push_back("file");
|
||||
vopts.push_back("append");
|
||||
vopts.push_back("all");
|
||||
vopts.push_back("on");
|
||||
vopts.push_back("off");
|
||||
}
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
@ -284,44 +288,55 @@ bool dumper::Read(CParser & parser)
|
||||
}
|
||||
|
||||
// Select StorageBinListItem
|
||||
StorageBinListItem &item(binList.Get_solution());
|
||||
StorageBinListItem *item;
|
||||
switch (opt)
|
||||
{
|
||||
case 0:
|
||||
item = this->binList.Get_solution();
|
||||
break;
|
||||
case 1:
|
||||
item = &(this->binList.Get_solution());
|
||||
break;
|
||||
case 2:
|
||||
item = this->binList.Get_pp_assemblage();
|
||||
break;
|
||||
case 3:
|
||||
item = this->binList.Get_exchange();
|
||||
break;
|
||||
case 4:
|
||||
item = this->binList.Get_surface();
|
||||
break;
|
||||
case 5:
|
||||
item = this->binList.Get_s_s_assemblage();
|
||||
item = &(this->binList.Get_pp_assemblage());
|
||||
break;
|
||||
case 6:
|
||||
item = this->binList.Get_gas_phase();
|
||||
item = &(this->binList.Get_exchange());
|
||||
break;
|
||||
case 7:
|
||||
item = this->binList.Get_kinetics();
|
||||
item = &(this->binList.Get_surface());
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
item = &(this->binList.Get_s_s_assemblage());
|
||||
break;
|
||||
case 11:
|
||||
case 12:
|
||||
item = &(this->binList.Get_gas_phase());
|
||||
break;
|
||||
case 13:
|
||||
item = &(this->binList.Get_kinetics());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Read dump entity list of numbers or number ranges for line, store in item
|
||||
if (opt >= 0 && opt <= 7)
|
||||
if (opt >= 0 && opt <= 13)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
CParser::TOKEN_TYPE j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY || j == CParser::TT_DIGIT)
|
||||
if (j == CParser::TT_DIGIT)
|
||||
{
|
||||
item.Augment(token);
|
||||
item->Augment(token);
|
||||
}
|
||||
else if (j == CParser::TT_EMPTY)
|
||||
{
|
||||
item->Augment(token);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -348,8 +363,14 @@ bool dumper::Read(CParser & parser)
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
break;
|
||||
case 8: //file
|
||||
case 14: //file
|
||||
std::getline(parser.get_iss(), this->file_name);
|
||||
this->file_name = trim(this->file_name, " \t");
|
||||
if (this->file_name.size() == 0)
|
||||
@ -358,7 +379,7 @@ bool dumper::Read(CParser & parser)
|
||||
}
|
||||
|
||||
break;
|
||||
case 9: //append
|
||||
case 15: //append
|
||||
{
|
||||
CParser::TOKEN_TYPE j = parser.copy_token(token, next_char);
|
||||
//if (!(parser.get_iss() >> this->append))
|
||||
@ -369,7 +390,7 @@ bool dumper::Read(CParser & parser)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10: //all
|
||||
case 16: //all
|
||||
this->SetAll(true);
|
||||
break;
|
||||
default:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user