mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
Have added delete, but parser is not working correctly. Am going back to 3705 to see if it worked correctly then.
git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@3716 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
6ca3a6d3b2
commit
79092e94b4
366
ReadClass.cxx
366
ReadClass.cxx
@ -27,6 +27,7 @@ extern int reading_database(void);
|
||||
extern int check_line(const char *string, int allow_empty, int allow_eof,
|
||||
int allow_keyword, int print);
|
||||
dumper dump_info;
|
||||
StorageBinList delete_info;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
int
|
||||
read_solution_raw(void)
|
||||
@ -1028,6 +1029,58 @@ read_dump(void)
|
||||
dump_info = dmp;
|
||||
|
||||
|
||||
// Need to output the next keyword
|
||||
output_msg(OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||
return (return_value);
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
int
|
||||
read_delete(void)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
/*
|
||||
* Reads DELETE data block
|
||||
*
|
||||
* Arguments:
|
||||
* none
|
||||
*
|
||||
* Returns:
|
||||
* KEYWORD if keyword encountered, input_error may be incremented if
|
||||
* a keyword is encountered in an unexpected position
|
||||
* EOF if eof encountered while reading mass balance concentrations
|
||||
* ERROR if error occurred reading data
|
||||
*
|
||||
*/
|
||||
int return_value;
|
||||
/*
|
||||
* Make parser
|
||||
*/
|
||||
std::istringstream iss_in;
|
||||
return_value = streamify_to_next_keyword(iss_in);
|
||||
std::ostringstream oss_out;
|
||||
std::ostringstream oss_err;
|
||||
CParser parser(iss_in, oss_out, oss_err);
|
||||
assert(!reading_database());
|
||||
|
||||
//For testing, need to read line to get started
|
||||
parser.set_echo_file(CParser::EO_NONE);
|
||||
std::vector < std::string > vopts;
|
||||
std::istream::pos_type next_char;
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
if (pr.echo_input == FALSE)
|
||||
{
|
||||
parser.set_echo_file(CParser::EO_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
parser.set_echo_file(CParser::EO_NOKEYWORDS);
|
||||
}
|
||||
|
||||
StorageBinList deleter(parser);
|
||||
delete_info = deleter;
|
||||
|
||||
|
||||
// Need to output the next keyword
|
||||
output_msg(OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||
return (return_value);
|
||||
@ -1669,13 +1722,13 @@ dump_entities(void)
|
||||
{
|
||||
int i, n, return_value;
|
||||
return_value = OK;
|
||||
if (!dump_info.get_bool_solution() &&
|
||||
!dump_info.get_bool_pp_assemblage() &&
|
||||
!dump_info.get_bool_exchange() &&
|
||||
!dump_info.get_bool_surface() &&
|
||||
!dump_info.get_bool_s_s_assemblage() &&
|
||||
!dump_info.get_bool_gas_phase() &&
|
||||
!dump_info.get_bool_kinetics())
|
||||
if (!dump_info.Get_bool_solution() &&
|
||||
!dump_info.Get_bool_pp_assemblage() &&
|
||||
!dump_info.Get_bool_exchange() &&
|
||||
!dump_info.Get_bool_surface() &&
|
||||
!dump_info.Get_bool_s_s_assemblage() &&
|
||||
!dump_info.Get_bool_gas_phase() &&
|
||||
!dump_info.Get_bool_kinetics())
|
||||
{
|
||||
return(OK);
|
||||
}
|
||||
@ -1692,9 +1745,9 @@ dump_entities(void)
|
||||
dump_stream.open(dump_info.get_file_name().c_str());
|
||||
}
|
||||
// solutions
|
||||
if (dump_info.get_bool_solution())
|
||||
if (dump_info.Get_bool_solution())
|
||||
{
|
||||
if (dump_info.get_solution().size() == 0)
|
||||
if (dump_info.Get_solution().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_solution; i++)
|
||||
{
|
||||
@ -1705,7 +1758,7 @@ dump_entities(void)
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.get_solution().begin(); it != dump_info.get_solution().end(); it++)
|
||||
for (it = dump_info.Get_solution().begin(); it != dump_info.Get_solution().end(); it++)
|
||||
{
|
||||
if (solution_bsearch(*it, &n, FALSE) != NULL)
|
||||
{
|
||||
@ -1717,9 +1770,9 @@ dump_entities(void)
|
||||
}
|
||||
|
||||
// pp_assemblages
|
||||
if (dump_info.get_bool_pp_assemblage())
|
||||
if (dump_info.Get_bool_pp_assemblage())
|
||||
{
|
||||
if (dump_info.get_pp_assemblage().size() == 0)
|
||||
if (dump_info.Get_pp_assemblage().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_pp_assemblage; i++)
|
||||
{
|
||||
@ -1730,7 +1783,7 @@ dump_entities(void)
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.get_pp_assemblage().begin(); it != dump_info.get_pp_assemblage().end(); it++)
|
||||
for (it = dump_info.Get_pp_assemblage().begin(); it != dump_info.Get_pp_assemblage().end(); it++)
|
||||
{
|
||||
|
||||
if (pp_assemblage_bsearch(*it, &n) != NULL)
|
||||
@ -1743,9 +1796,9 @@ dump_entities(void)
|
||||
}
|
||||
|
||||
// exchanges
|
||||
if (dump_info.get_bool_exchange())
|
||||
if (dump_info.Get_bool_exchange())
|
||||
{
|
||||
if (dump_info.get_exchange().size() == 0)
|
||||
if (dump_info.Get_exchange().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_exchange; i++)
|
||||
{
|
||||
@ -1756,7 +1809,7 @@ dump_entities(void)
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.get_exchange().begin(); it != dump_info.get_exchange().end(); it++)
|
||||
for (it = dump_info.Get_exchange().begin(); it != dump_info.Get_exchange().end(); it++)
|
||||
{
|
||||
|
||||
if (exchange_bsearch(*it, &n) != NULL)
|
||||
@ -1769,9 +1822,9 @@ dump_entities(void)
|
||||
}
|
||||
|
||||
// surfaces
|
||||
if (dump_info.get_bool_surface())
|
||||
if (dump_info.Get_bool_surface())
|
||||
{
|
||||
if (dump_info.get_surface().size() == 0)
|
||||
if (dump_info.Get_surface().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_surface; i++)
|
||||
{
|
||||
@ -1782,7 +1835,7 @@ dump_entities(void)
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.get_surface().begin(); it != dump_info.get_surface().end(); it++)
|
||||
for (it = dump_info.Get_surface().begin(); it != dump_info.Get_surface().end(); it++)
|
||||
{
|
||||
|
||||
if (surface_bsearch(*it, &n) != NULL)
|
||||
@ -1795,9 +1848,9 @@ dump_entities(void)
|
||||
}
|
||||
|
||||
// s_s_assemblages
|
||||
if (dump_info.get_bool_s_s_assemblage())
|
||||
if (dump_info.Get_bool_s_s_assemblage())
|
||||
{
|
||||
if (dump_info.get_s_s_assemblage().size() == 0)
|
||||
if (dump_info.Get_s_s_assemblage().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_s_s_assemblage; i++)
|
||||
{
|
||||
@ -1808,7 +1861,7 @@ dump_entities(void)
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.get_s_s_assemblage().begin(); it != dump_info.get_s_s_assemblage().end(); it++)
|
||||
for (it = dump_info.Get_s_s_assemblage().begin(); it != dump_info.Get_s_s_assemblage().end(); it++)
|
||||
{
|
||||
|
||||
if (s_s_assemblage_bsearch(*it, &n) != NULL)
|
||||
@ -1821,9 +1874,9 @@ dump_entities(void)
|
||||
}
|
||||
|
||||
// gas_phases
|
||||
if (dump_info.get_bool_gas_phase())
|
||||
if (dump_info.Get_bool_gas_phase())
|
||||
{
|
||||
if (dump_info.get_gas_phase().size() == 0)
|
||||
if (dump_info.Get_gas_phase().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_gas_phase; i++)
|
||||
{
|
||||
@ -1834,7 +1887,7 @@ dump_entities(void)
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.get_gas_phase().begin(); it != dump_info.get_gas_phase().end(); it++)
|
||||
for (it = dump_info.Get_gas_phase().begin(); it != dump_info.Get_gas_phase().end(); it++)
|
||||
{
|
||||
|
||||
if (gas_phase_bsearch(*it, &n) != NULL)
|
||||
@ -1847,9 +1900,9 @@ dump_entities(void)
|
||||
}
|
||||
|
||||
// kineticss
|
||||
if (dump_info.get_bool_kinetics())
|
||||
if (dump_info.Get_bool_kinetics())
|
||||
{
|
||||
if (dump_info.get_kinetics().size() == 0)
|
||||
if (dump_info.Get_kinetics().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_kinetics; i++)
|
||||
{
|
||||
@ -1860,7 +1913,7 @@ dump_entities(void)
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.get_kinetics().begin(); it != dump_info.get_kinetics().end(); it++)
|
||||
for (it = dump_info.Get_kinetics().begin(); it != dump_info.Get_kinetics().end(); it++)
|
||||
{
|
||||
|
||||
if (kinetics_bsearch(*it, &n) != NULL)
|
||||
@ -1872,8 +1925,259 @@ dump_entities(void)
|
||||
}
|
||||
}
|
||||
|
||||
dump_info.DumpAll(false);
|
||||
|
||||
|
||||
// Turn off dump until next read
|
||||
dump_info.SetAll(false);
|
||||
return (OK);
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
int
|
||||
delete_entities(void)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
int i, n, return_value;
|
||||
return_value = OK;
|
||||
if (!delete_info.Get_solution().Get_defined() &&
|
||||
!delete_info.Get_pp_assemblage().Get_defined() &&
|
||||
!delete_info.Get_exchange().Get_defined() &&
|
||||
!delete_info.Get_surface().Get_defined() &&
|
||||
!delete_info.Get_s_s_assemblage().Get_defined() &&
|
||||
!delete_info.Get_gas_phase().Get_defined() &&
|
||||
!delete_info.Get_kinetics().Get_defined() &&
|
||||
!delete_info.Get_mix().Get_defined() &&
|
||||
!delete_info.Get_reaction().Get_defined() &&
|
||||
!delete_info.Get_temperature().Get_defined() )
|
||||
{
|
||||
return(OK);
|
||||
}
|
||||
|
||||
// solutions
|
||||
if (delete_info.Get_solution().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_solution().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_solution; i++)
|
||||
{
|
||||
solution_delete_n(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_solution().Get_numbers().begin(); it != delete_info.Get_solution().Get_numbers().end(); it++)
|
||||
{
|
||||
if (solution_bsearch(*it, &n, FALSE) != NULL)
|
||||
{
|
||||
solution_delete_n(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pp_assemblages
|
||||
if (delete_info.Get_pp_assemblage().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_pp_assemblage().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_pp_assemblage; i++)
|
||||
{
|
||||
pp_assemblage_delete(pp_assemblage[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_pp_assemblage().Get_numbers().begin(); it != delete_info.Get_pp_assemblage().Get_numbers().end(); it++)
|
||||
{
|
||||
|
||||
if (pp_assemblage_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
pp_assemblage_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// exchangers
|
||||
if (delete_info.Get_exchange().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_exchange().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_exchange; i++)
|
||||
{
|
||||
exchange_delete(exchange[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_exchange().Get_numbers().begin(); it != delete_info.Get_exchange().Get_numbers().end(); it++)
|
||||
{
|
||||
if (exchange_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
exchange_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// surfaces
|
||||
if (delete_info.Get_surface().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_surface().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_surface; i++)
|
||||
{
|
||||
surface_delete(surface[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_surface().Get_numbers().begin(); it != delete_info.Get_surface().Get_numbers().end(); it++)
|
||||
{
|
||||
if (surface_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
surface_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// s_s_assemblages
|
||||
if (delete_info.Get_s_s_assemblage().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_s_s_assemblage().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_s_s_assemblage; i++)
|
||||
{
|
||||
s_s_assemblage_delete(s_s_assemblage[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_s_s_assemblage().Get_numbers().begin(); it != delete_info.Get_s_s_assemblage().Get_numbers().end(); it++)
|
||||
{
|
||||
if (s_s_assemblage_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
s_s_assemblage_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// gas_phases
|
||||
if (delete_info.Get_gas_phase().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_gas_phase().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_gas_phase; i++)
|
||||
{
|
||||
gas_phase_delete(gas_phase[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_gas_phase().Get_numbers().begin(); it != delete_info.Get_gas_phase().Get_numbers().end(); it++)
|
||||
{
|
||||
if (gas_phase_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
gas_phase_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// kineticss
|
||||
if (delete_info.Get_kinetics().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_kinetics().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_kinetics; i++)
|
||||
{
|
||||
kinetics_delete(kinetics[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_kinetics().Get_numbers().begin(); it != delete_info.Get_kinetics().Get_numbers().end(); it++)
|
||||
{
|
||||
if (kinetics_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
kinetics_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// mixes
|
||||
if (delete_info.Get_mix().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_mix().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_mix; i++)
|
||||
{
|
||||
mix_delete(mix[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_mix().Get_numbers().begin(); it != delete_info.Get_mix().Get_numbers().end(); it++)
|
||||
{
|
||||
if (mix_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
mix_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// reactions
|
||||
if (delete_info.Get_reaction().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_reaction().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_irrev; i++)
|
||||
{
|
||||
irrev_delete(irrev[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_reaction().Get_numbers().begin(); it != delete_info.Get_reaction().Get_numbers().end(); it++)
|
||||
{
|
||||
if (irrev_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
irrev_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// temperatures
|
||||
if (delete_info.Get_temperature().Get_defined())
|
||||
{
|
||||
if (delete_info.Get_temperature().Get_numbers().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_temperature; i++)
|
||||
{
|
||||
temperature_delete(temperature[i].n_user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = delete_info.Get_temperature().Get_numbers().begin(); it != delete_info.Get_temperature().Get_numbers().end(); it++)
|
||||
{
|
||||
if (temperature_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
temperature_delete(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Turn off delete until next read
|
||||
delete_info.SetAll(false);
|
||||
return (OK);
|
||||
}
|
||||
202
dumper.cpp
202
dumper.cpp
@ -5,26 +5,12 @@ dumper::dumper(void)
|
||||
{
|
||||
this->file_name = "dump.out";
|
||||
this->append = false;
|
||||
this->bool_solution = false;
|
||||
this->bool_pp_assemblage = false;
|
||||
this->bool_exchange = false;
|
||||
this->bool_surface = false;
|
||||
this->bool_s_s_assemblage = false;
|
||||
this->bool_gas_phase = false;
|
||||
this->bool_kinetics = false;
|
||||
this->on = false;
|
||||
}
|
||||
dumper::dumper(CParser & parser)
|
||||
{
|
||||
this->file_name = "dump.out";
|
||||
this->append = false;
|
||||
|
||||
this->bool_solution = false;
|
||||
this->bool_pp_assemblage = false;
|
||||
this->bool_exchange = false;
|
||||
this->bool_surface = false;
|
||||
this->bool_s_s_assemblage = false;
|
||||
this->bool_gas_phase = false;
|
||||
this->bool_kinetics = false;
|
||||
this->Read(parser);
|
||||
}
|
||||
|
||||
@ -32,37 +18,12 @@ dumper::~dumper(void)
|
||||
{
|
||||
}
|
||||
|
||||
void dumper::DumpAll(bool tf)
|
||||
void dumper::SetAll(bool tf)
|
||||
{
|
||||
this->solution.clear();
|
||||
this->pp_assemblage.clear();
|
||||
this->exchange.clear();
|
||||
this->surface.clear();
|
||||
this->s_s_assemblage.clear();
|
||||
this->gas_phase.clear();
|
||||
this->kinetics.clear();
|
||||
this->binList.SetAll(tf);
|
||||
|
||||
if (tf)
|
||||
{
|
||||
this->bool_solution = true;
|
||||
this->bool_pp_assemblage = true;
|
||||
this->bool_exchange = true;
|
||||
this->bool_surface = true;
|
||||
this->bool_s_s_assemblage = true;
|
||||
this->bool_gas_phase = true;
|
||||
this->bool_kinetics = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->bool_solution = false;
|
||||
this->bool_pp_assemblage = false;
|
||||
this->bool_exchange = false;
|
||||
this->bool_surface = false;
|
||||
this->bool_s_s_assemblage = false;
|
||||
this->bool_gas_phase = false;
|
||||
this->bool_kinetics = false;
|
||||
}
|
||||
}
|
||||
#ifdef SKIP
|
||||
bool dumper::Read(CParser & parser)
|
||||
{
|
||||
|
||||
@ -269,6 +230,161 @@ bool dumper::Read(CParser & parser)
|
||||
}
|
||||
|
||||
|
||||
if (opt == CParser::OPT_EOF || opt == CParser::OPT_KEYWORD)
|
||||
break;
|
||||
}
|
||||
return(return_value);
|
||||
}
|
||||
#endif
|
||||
bool dumper::Read(CParser & parser)
|
||||
{
|
||||
|
||||
bool return_value(true);
|
||||
static std::vector < std::string > vopts;
|
||||
if (vopts.empty())
|
||||
{
|
||||
vopts.reserve(15);
|
||||
vopts.push_back("solution");
|
||||
vopts.push_back("pp_assemblage");
|
||||
vopts.push_back("equilibrium_phases");
|
||||
vopts.push_back("exchange");
|
||||
vopts.push_back("surface");
|
||||
vopts.push_back("s_s_assemblage");
|
||||
vopts.push_back("gas_phase");
|
||||
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;
|
||||
std::istream::pos_type next_char;
|
||||
std::string token;
|
||||
int opt_save;
|
||||
bool useLastLine(false);
|
||||
|
||||
// Read mix number and description
|
||||
//this->read_number_description(parser);
|
||||
|
||||
opt_save = CParser::OPT_DEFAULT;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int opt;
|
||||
opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPT_DEFAULT)
|
||||
{
|
||||
opt = opt_save;
|
||||
}
|
||||
else
|
||||
{
|
||||
opt_save = opt;
|
||||
}
|
||||
|
||||
// Select StorageBinListItem
|
||||
StorageBinListItem &item(binList.Get_solution());
|
||||
switch (opt)
|
||||
{
|
||||
case 0:
|
||||
item = this->binList.Get_solution();
|
||||
break;
|
||||
case 1:
|
||||
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();
|
||||
break;
|
||||
case 6:
|
||||
item = this->binList.Get_gas_phase();
|
||||
break;
|
||||
case 7:
|
||||
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)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
CParser::TOKEN_TYPE j = parser.copy_token(token, next_char);
|
||||
if (j == CParser::TT_EMPTY || j == CParser::TT_DIGIT)
|
||||
{
|
||||
item.Augment(token);
|
||||
}
|
||||
else
|
||||
{
|
||||
parser.error_msg("Expected single number or range of numbers.",
|
||||
CParser::OT_CONTINUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process other identifiers
|
||||
std::set < int >::iterator it;
|
||||
switch (opt)
|
||||
{
|
||||
case CParser::OPT_EOF:
|
||||
break;
|
||||
case CParser::OPT_KEYWORD:
|
||||
break;
|
||||
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
break;
|
||||
case 8: //file
|
||||
std::getline(parser.get_iss(), this->file_name);
|
||||
this->file_name = trim(this->file_name, " \t");
|
||||
if (this->file_name.size() == 0)
|
||||
{
|
||||
this->file_name = "dump.out";
|
||||
}
|
||||
|
||||
break;
|
||||
case 9: //append
|
||||
{
|
||||
CParser::TOKEN_TYPE j = parser.copy_token(token, next_char);
|
||||
//if (!(parser.get_iss() >> this->append))
|
||||
this->append = true;
|
||||
if (token.c_str()[0] == 'f' || token.c_str()[0] == 'F')
|
||||
{
|
||||
this->append = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10: //all
|
||||
this->SetAll(true);
|
||||
break;
|
||||
default:
|
||||
case CParser::OPT_DEFAULT:
|
||||
case CParser::OPT_ERROR:
|
||||
opt = CParser::OPT_EOF;
|
||||
parser.error_msg("Unknown input reading DUMP definition.",
|
||||
CParser::OT_CONTINUE);
|
||||
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
|
||||
useLastLine = false;
|
||||
return_value = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (opt == CParser::OPT_EOF || opt == CParser::OPT_KEYWORD)
|
||||
break;
|
||||
}
|
||||
|
||||
50
dumper.h
50
dumper.h
@ -5,49 +5,37 @@
|
||||
#include <list> // std::list
|
||||
#include <vector> // std::vector
|
||||
#include "Parser.h"
|
||||
class dumper
|
||||
#include "StorageBinList.h"
|
||||
class dumper
|
||||
{
|
||||
public:
|
||||
dumper(void);
|
||||
dumper(CParser & parser);
|
||||
~dumper(void);
|
||||
bool Read(CParser & parser);
|
||||
void DumpAll(bool tf);
|
||||
void SetAll(bool tf);
|
||||
std::string get_file_name(void) { return(this->file_name); };
|
||||
bool get_append(void) { return(this->append); };
|
||||
bool get_bool_solution(void) { return(this->bool_solution); };
|
||||
bool get_bool_pp_assemblage(void) { return(this->bool_pp_assemblage); };
|
||||
bool get_bool_exchange(void) { return(this->bool_exchange); };
|
||||
bool get_bool_surface(void) { return(this->bool_surface); };
|
||||
bool get_bool_s_s_assemblage(void) { return(this->bool_s_s_assemblage); };
|
||||
bool get_bool_gas_phase(void) { return(this->bool_gas_phase); };
|
||||
bool get_bool_kinetics(void) { return(this->bool_kinetics); };
|
||||
bool Get_bool_solution(void) { return(this->binList.Get_solution().Get_defined()); };
|
||||
bool Get_bool_pp_assemblage(void) { return(this->binList.Get_pp_assemblage().Get_defined()); };
|
||||
bool Get_bool_exchange(void) { return(this->binList.Get_exchange().Get_defined()); };
|
||||
bool Get_bool_surface(void) { return(this->binList.Get_surface().Get_defined()); };
|
||||
bool Get_bool_s_s_assemblage(void) { return(this->binList.Get_s_s_assemblage().Get_defined()); };
|
||||
bool Get_bool_gas_phase(void) { return(this->binList.Get_gas_phase().Get_defined()); };
|
||||
bool Get_bool_kinetics(void) { return(this->binList.Get_kinetics().Get_defined()); };
|
||||
|
||||
std::set < int > & get_solution(void) { return(this->solution); };
|
||||
std::set < int > & get_pp_assemblage(void) { return(this->pp_assemblage); };
|
||||
std::set < int > & get_exchange(void) { return(this->exchange); };
|
||||
std::set < int > & get_surface(void) { return(this->surface); };
|
||||
std::set < int > & get_s_s_assemblage(void) { return(this->s_s_assemblage); };
|
||||
std::set < int > & get_gas_phase(void) { return(this->gas_phase); };
|
||||
std::set < int > & get_kinetics(void) { return(this->kinetics); };
|
||||
std::set < int > & Get_solution(void) { return(this->binList.Get_solution().Get_numbers()); };
|
||||
std::set < int > & Get_pp_assemblage(void) { return(this->binList.Get_pp_assemblage().Get_numbers()); };
|
||||
std::set < int > & Get_exchange(void) { return(this->binList.Get_exchange().Get_numbers()); };
|
||||
std::set < int > & Get_surface(void) { return(this->binList.Get_surface().Get_numbers()); };
|
||||
std::set < int > & Get_s_s_assemblage(void) { return(this->binList.Get_s_s_assemblage().Get_numbers()); };
|
||||
std::set < int > & Get_gas_phase(void) { return(this->binList.Get_gas_phase().Get_numbers()); };
|
||||
std::set < int > & Get_kinetics(void) { return(this->binList.Get_kinetics().Get_numbers()); };
|
||||
protected:
|
||||
std::string file_name;
|
||||
bool append;
|
||||
bool bool_solution;
|
||||
bool bool_pp_assemblage;
|
||||
bool bool_exchange;
|
||||
bool bool_surface;
|
||||
bool bool_s_s_assemblage;
|
||||
bool bool_gas_phase;
|
||||
bool bool_kinetics;
|
||||
|
||||
std::set < int > solution;
|
||||
std::set < int > pp_assemblage;
|
||||
std::set < int > exchange;
|
||||
std::set < int > surface;
|
||||
std::set < int > s_s_assemblage;
|
||||
std::set < int > gas_phase;
|
||||
std::set < int > kinetics;
|
||||
bool on;
|
||||
StorageBinList binList;
|
||||
};
|
||||
|
||||
#endif // !defined(DUMPER_H_INCLUDED)
|
||||
Loading…
x
Reference in New Issue
Block a user