Fixed action of dumper. Retains information until next read, only changes what is read.

A DUMP keyword with no body will repeat current definitions.

Fixed DELETE, which was missing pressures.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/branches/ErrorHandling@5871 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2011-12-07 17:36:26 +00:00
parent 8cbaba8ea4
commit c3d019a012
3 changed files with 56 additions and 31 deletions

View File

@ -1031,9 +1031,7 @@ read_dump(void)
parser.set_echo_file(CParser::EO_NOKEYWORDS);
}
dumper dmp(parser, phrq_io);
dump_info = dmp;
dump_info.Read(parser);
// Need to output the next keyword
if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line));
@ -1943,6 +1941,11 @@ int Phreeqc::
dump_entities(void)
/* ---------------------------------------------------------------------- */
{
if (!dump_info.Get_on())
{
return(OK);
}
dump_info.Set_on(false);
if (!dump_info.Get_bool_any())
{
return(OK);
@ -1984,7 +1987,8 @@ delete_entities(void)
!delete_info.Get_kinetics().Get_defined() &&
!delete_info.Get_mix().Get_defined() &&
!delete_info.Get_reaction().Get_defined() &&
!delete_info.Get_temperature().Get_defined() )
!delete_info.Get_temperature().Get_defined() &&
!delete_info.Get_pressure().Get_defined())
{
return(OK);
}
@ -2216,6 +2220,22 @@ delete_entities(void)
}
}
}
// pressures
if (delete_info.Get_pressure().Get_defined())
{
if (delete_info.Get_pressure().Get_numbers().size() == 0)
{
Reaction_pressure_map.clear();
}
else
{
std::set < int >::iterator it;
for (it = delete_info.Get_pressure().Get_numbers().begin(); it != delete_info.Get_pressure().Get_numbers().end(); it++)
{
Reaction_pressure_map.erase(*it);
}
}
}
// Turn off delete until next read
delete_info.SetAll(false);
return (OK);

View File

@ -71,10 +71,9 @@ void dumper::SetAll(bool tf)
int opt_save;
bool useLastLine(false);
// Read mix number and description
//this->read_number_description(parser);
opt_save = CParser::OPT_DEFAULT;
bool cleared_once = false;
this->on = true;
for (;;)
{
@ -89,7 +88,11 @@ void dumper::SetAll(bool tf)
{
opt_save = opt;
}
if (opt > 1 && !cleared_once)
{
binList.SetAll(false);
cleared_once = true;
}
// Select StorageBinListItem
StorageBinListItem *item = NULL;
switch (opt)

View File

@ -15,32 +15,34 @@ public:
~dumper(void);
bool Read(CParser & parser);
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->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()); };
bool Get_bool_mix(void) { return(this->binList.Get_mix().Get_defined()); };
bool Get_bool_reaction(void) { return(this->binList.Get_reaction().Get_defined()); };
bool Get_bool_temperature(void) { return(this->binList.Get_temperature().Get_defined()); };
bool Get_bool_pressure(void) { return(this->binList.Get_pressure().Get_defined()); };
std::string Get_file_name(void) { return(this->file_name); };
bool Get_append(void) { return(this->append); };
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()); };
bool Get_bool_mix(void) { return(this->binList.Get_mix().Get_defined()); };
bool Get_bool_reaction(void) { return(this->binList.Get_reaction().Get_defined()); };
bool Get_bool_temperature(void) { return(this->binList.Get_temperature().Get_defined()); };
bool Get_bool_pressure(void) { return(this->binList.Get_pressure().Get_defined()); };
bool Get_bool_any(void);
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_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()); };
std::set < int > & Get_mix(void) { return(this->binList.Get_mix().Get_numbers()); };
std::set < int > & Get_reaction(void) { return(this->binList.Get_reaction().Get_numbers()); };
std::set < int > & Get_temperature(void) { return(this->binList.Get_temperature().Get_numbers()); };
std::set < int > & Get_pressure(void) { return(this->binList.Get_pressure().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()); };
std::set < int > & Get_mix(void) { return(this->binList.Get_mix().Get_numbers()); };
std::set < int > & Get_reaction(void) { return(this->binList.Get_reaction().Get_numbers()); };
std::set < int > & Get_temperature(void) { return(this->binList.Get_temperature().Get_numbers()); };
std::set < int > & Get_pressure(void) { return(this->binList.Get_pressure().Get_numbers()); };
bool Get_on(void) {return this->on;};
void Set_on(bool tf) {this->on = tf;};
protected:
std::string file_name;
bool append;