mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Added -mix, -reaction, -temperature, -cells to DUMP.
Added warning for use of REACTION and kinetics. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@4800 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
8ff9cd7986
commit
b1fca87a57
@ -366,6 +366,12 @@ CParser::check_key(std::string::iterator begin, std::string::iterator end)
|
||||
s_keyword_map.insert(std::map < std::string,
|
||||
KEY_TYPE >::value_type("surface_raw",
|
||||
KT_SURFACE_RAW));
|
||||
s_keyword_map.insert(std::map < std::string,
|
||||
KEY_TYPE >::value_type("reaction_temperature_raw",
|
||||
KT_TEMPERATURE_RAW));
|
||||
s_keyword_map.insert(std::map < std::string,
|
||||
KEY_TYPE >::value_type("reaction_raw",
|
||||
KT_REACTION_RAW));
|
||||
}
|
||||
|
||||
std::string lowercase;
|
||||
|
||||
4
Parser.h
4
Parser.h
@ -65,7 +65,9 @@ class CParser
|
||||
KT_KINETICS_RAW = 8,
|
||||
KT_PPASSEMBLAGE_RAW = 9,
|
||||
KT_SSASSEMBLAGE_RAW = 10,
|
||||
KT_SURFACE_RAW = 11
|
||||
KT_SURFACE_RAW = 11,
|
||||
KT_TEMPERATURE_RAW = 12,
|
||||
KT_REACTION_RAW = 13
|
||||
};
|
||||
|
||||
enum OPT_TYPE
|
||||
|
||||
@ -2397,7 +2397,7 @@ dump_ostream(std::ostream& os)
|
||||
}
|
||||
}
|
||||
|
||||
// kineticss
|
||||
// kinetics
|
||||
if (dump_info.Get_bool_kinetics())
|
||||
{
|
||||
if (dump_info.Get_kinetics().size() == 0)
|
||||
@ -2423,6 +2423,89 @@ dump_ostream(std::ostream& os)
|
||||
}
|
||||
}
|
||||
|
||||
// mix
|
||||
if (dump_info.Get_bool_mix())
|
||||
{
|
||||
if (dump_info.Get_mix().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_mix; i++)
|
||||
{
|
||||
cxxMix cxxentity(&mix[i]);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.Get_mix().begin(); it != dump_info.Get_mix().end(); it++)
|
||||
{
|
||||
|
||||
if (mix_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
cxxMix cxxentity(&mix[n]);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reaction
|
||||
if (dump_info.Get_bool_reaction())
|
||||
{
|
||||
if (dump_info.Get_reaction().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_irrev; i++)
|
||||
{
|
||||
cxxReaction cxxentity(&irrev[i]);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.Get_reaction().begin(); it != dump_info.Get_reaction().end(); it++)
|
||||
{
|
||||
|
||||
if (irrev_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
cxxReaction cxxentity(&irrev[n]);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// temperature
|
||||
if (dump_info.Get_bool_temperature())
|
||||
{
|
||||
if (dump_info.Get_temperature().size() == 0)
|
||||
{
|
||||
for (i = 0; i < count_temperature; i++)
|
||||
{
|
||||
cxxTemperature cxxentity(&temperature[i]);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = dump_info.Get_temperature().begin(); it != dump_info.Get_temperature().end(); it++)
|
||||
{
|
||||
|
||||
if (temperature_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
cxxTemperature cxxentity(&temperature[n]);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Turn off any reaction calculation
|
||||
os << "USE mix none" << std::endl;
|
||||
os << "USE reaction none" << std::endl;
|
||||
os << "USE reaction_temperature none" << std::endl;
|
||||
|
||||
// Turn off dump until next read
|
||||
dump_info.SetAll(false);
|
||||
}
|
||||
|
||||
@ -588,7 +588,9 @@ cxxStorageBin::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
KT_KINETICS_RAW = 8,
|
||||
KT_PPASSEMBLAGE_RAW = 9,
|
||||
KT_SSASSEMBLAGE_RAW = 10,
|
||||
KT_SURFACE_RAW = 11
|
||||
KT_SURFACE_RAW = 11,
|
||||
KT_TEMPERATURE_RAW = 12,
|
||||
KT_REACTION_RAW = 13
|
||||
*/
|
||||
case CParser::KT_SOLUTION_RAW:
|
||||
{
|
||||
@ -646,6 +648,21 @@ cxxStorageBin::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::KT_TEMPERATURE_RAW:
|
||||
{
|
||||
cxxTemperature entity;
|
||||
entity.read_raw(parser);
|
||||
Temperatures[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::KT_REACTION_RAW:
|
||||
{
|
||||
cxxReaction entity;
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Reactions[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -682,7 +699,9 @@ cxxStorageBin::read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
KT_KINETICS_RAW = 8,
|
||||
KT_PPASSEMBLAGE_RAW = 9,
|
||||
KT_SSASSEMBLAGE_RAW = 10,
|
||||
KT_SURFACE_RAW = 11
|
||||
KT_SURFACE_RAW = 11,
|
||||
KT_TEMPERATURE_RAW = 12,
|
||||
KT_REACTION_RAW = 13
|
||||
*/
|
||||
case CParser::KT_SOLUTION_RAW:
|
||||
{
|
||||
@ -747,6 +766,24 @@ cxxStorageBin::read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::KT_TEMPERATURE_RAW:
|
||||
{
|
||||
cxxTemperature entity;
|
||||
entity.read_raw(parser);
|
||||
Temperatures[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
break;
|
||||
|
||||
case CParser::KT_REACTION_RAW:
|
||||
{
|
||||
cxxReaction entity;
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Reactions[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -90,6 +90,13 @@ void StorageBinListItem::Augment(std::string token)
|
||||
}
|
||||
}
|
||||
}
|
||||
void StorageBinListItem::Augment(int i)
|
||||
{
|
||||
// Skip if all are defined
|
||||
if (this->defined == true && this->numbers.size() == 0) return;
|
||||
this->defined = true;
|
||||
this->numbers.insert(i);
|
||||
}
|
||||
StorageBinList::StorageBinList(void)
|
||||
{
|
||||
}
|
||||
@ -276,3 +283,20 @@ bool StorageBinList::Read(CParser & parser)
|
||||
return(return_value);
|
||||
}
|
||||
|
||||
void StorageBinList::TransferAll(StorageBinListItem &source)
|
||||
{
|
||||
std::set < int >::iterator it;
|
||||
for (it = source.Get_numbers().begin(); it != source.Get_numbers().end(); it++)
|
||||
{
|
||||
this->solution.Augment(*it);
|
||||
this->pp_assemblage.Augment(*it);
|
||||
this->exchange.Augment(*it);
|
||||
this->surface.Augment(*it);
|
||||
this->s_s_assemblage.Augment(*it);
|
||||
this->gas_phase.Augment(*it);
|
||||
this->kinetics.Augment(*it);
|
||||
this->mix.Augment(*it);
|
||||
this->reaction.Augment(*it);
|
||||
this->temperature.Augment(*it);
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ public:
|
||||
void Set_defined(bool tf) { this->defined = tf; };
|
||||
bool Get_defined(void) { return(this->defined); };
|
||||
void Augment(std::string token);
|
||||
void Augment(int i);
|
||||
std::set < int > &Get_numbers(void) { return(this->numbers); };
|
||||
void Clear(void) { this->numbers.clear(); };
|
||||
protected:
|
||||
@ -30,6 +31,7 @@ public:
|
||||
~StorageBinList(void);
|
||||
bool Read(CParser & parser);
|
||||
void SetAll(bool tf);
|
||||
void TransferAll(StorageBinListItem &source);
|
||||
|
||||
StorageBinListItem & Get_solution(void) { return(this->solution); };
|
||||
StorageBinListItem & Get_pp_assemblage(void) { return(this->pp_assemblage); };
|
||||
|
||||
@ -160,10 +160,16 @@ cxxTemperature::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
for (i = 0; i < indent + 2; ++i)
|
||||
indent2.append(Utilities::INDENT);
|
||||
|
||||
// Temperature element and attributes
|
||||
s_oss << indent0;
|
||||
s_oss << "REACTION_TEMPERATURE_RAW " << this->
|
||||
n_user << " " << this->description << std::endl;
|
||||
s_oss << "REACTION_TEMPERATURE_RAW " << this->n_user << " " << this->description << std::endl;
|
||||
|
||||
s_oss << indent1;
|
||||
s_oss << "-count_temps " << this->countTemps << std::endl;
|
||||
|
||||
s_oss << indent1;
|
||||
s_oss << "-equal_increments " << this->equalIncrements << std::endl;
|
||||
|
||||
// Temperature element and attributes
|
||||
|
||||
s_oss << indent1;
|
||||
s_oss << "-temps " << std::endl;
|
||||
@ -183,14 +189,6 @@ cxxTemperature::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
s_oss << std::endl;
|
||||
}
|
||||
|
||||
s_oss << indent1;
|
||||
s_oss << "-equal_increments " << this->equalIncrements << std::endl;
|
||||
|
||||
s_oss << indent1;
|
||||
s_oss << "-count_temps " << this->countTemps << std::endl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
55
dumper.cpp
55
dumper.cpp
@ -263,6 +263,15 @@ bool dumper::Read(CParser & parser)
|
||||
vopts.push_back("file");
|
||||
vopts.push_back("append");
|
||||
vopts.push_back("all");
|
||||
vopts.push_back("cell");
|
||||
vopts.push_back("cells"); // 18
|
||||
vopts.push_back("mix"); // 19
|
||||
vopts.push_back("reaction"); // 20
|
||||
vopts.push_back("reactions"); // 21
|
||||
vopts.push_back("temperature"); // 22
|
||||
vopts.push_back("temperatures"); // 23
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::istream::pos_type ptr;
|
||||
@ -279,6 +288,7 @@ bool dumper::Read(CParser & parser)
|
||||
for (;;)
|
||||
{
|
||||
int opt;
|
||||
StorageBinListItem cells;
|
||||
opt = parser.get_option(vopts, next_char);
|
||||
if (opt == CParser::OPT_DEFAULT)
|
||||
{
|
||||
@ -321,12 +331,27 @@ bool dumper::Read(CParser & parser)
|
||||
case 13:
|
||||
item = &(this->binList.Get_kinetics());
|
||||
break;
|
||||
case 17: // cell
|
||||
case 18: // cells
|
||||
item = &cells;
|
||||
break;
|
||||
case 19: // mix
|
||||
item = &(this->binList.Get_mix());
|
||||
break;
|
||||
case 20: // reaction
|
||||
case 21: // reactions
|
||||
item = &(this->binList.Get_reaction());
|
||||
break;
|
||||
case 22: // temperature
|
||||
case 23: // temperatures
|
||||
item = &(this->binList.Get_temperature());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Read dump entity list of numbers or number ranges for line, store in item
|
||||
if (opt >= 0 && opt <= 13)
|
||||
if ((opt >= 0 && opt <= 13) || (opt >= 17 && opt <= 23))
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
@ -348,6 +373,10 @@ bool dumper::Read(CParser & parser)
|
||||
}
|
||||
}
|
||||
|
||||
if (opt == 17 || opt == 18)
|
||||
{
|
||||
this->binList.TransferAll(cells);
|
||||
}
|
||||
// Process other identifiers
|
||||
std::set < int >::iterator it;
|
||||
switch (opt)
|
||||
@ -371,6 +400,13 @@ bool dumper::Read(CParser & parser)
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
case 20:
|
||||
case 21:
|
||||
case 22:
|
||||
case 23:
|
||||
break;
|
||||
case 14: //file
|
||||
std::getline(parser.get_iss(), this->file_name);
|
||||
@ -417,12 +453,15 @@ bool dumper::Read(CParser & parser)
|
||||
bool dumper::Get_bool_any(void)
|
||||
{
|
||||
return (
|
||||
Get_bool_solution() ||
|
||||
Get_bool_pp_assemblage() ||
|
||||
Get_bool_exchange() ||
|
||||
Get_bool_surface() ||
|
||||
Get_bool_s_s_assemblage() ||
|
||||
Get_bool_gas_phase() ||
|
||||
Get_bool_kinetics()
|
||||
Get_bool_solution() ||
|
||||
Get_bool_pp_assemblage() ||
|
||||
Get_bool_exchange() ||
|
||||
Get_bool_surface() ||
|
||||
Get_bool_s_s_assemblage() ||
|
||||
Get_bool_gas_phase() ||
|
||||
Get_bool_kinetics() ||
|
||||
Get_bool_mix() ||
|
||||
Get_bool_reaction() ||
|
||||
Get_bool_temperature()
|
||||
);
|
||||
}
|
||||
|
||||
6
dumper.h
6
dumper.h
@ -24,6 +24,9 @@ public:
|
||||
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_any(void);
|
||||
|
||||
std::set < int > & Get_solution(void) { return(this->binList.Get_solution().Get_numbers()); };
|
||||
@ -33,6 +36,9 @@ public:
|
||||
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()); };
|
||||
protected:
|
||||
std::string file_name;
|
||||
bool append;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user