Worked on bug with DUMP and read_raw of isotopes.

Also checked that dump/read/dump gave equivalent files for isotopes. 

git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@5453 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2011-06-23 22:35:43 +00:00
parent 67258ef6ef
commit a36a7924cd
3 changed files with 16 additions and 7 deletions

View File

@ -684,7 +684,7 @@ cxxSolution::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
case 3: // isotopes
{
cxxSolutionIsotope iso;
if (iso.read_raw(parser) != CParser::PARSER_OK)
if (iso.read_raw(parser, next_char) != CParser::PARSER_OK)
{
parser.incr_input_error();
parser.error_msg("Expected data for isotopes.",

View File

@ -18,13 +18,22 @@
cxxSolutionIsotope::cxxSolutionIsotope(void):
isotope_number(0.0)
{
isotope_number = 0;
elt_name.clear();
isotope_name.clear();
total = 0;
ratio = -9999.9;
ratio_uncertainty = 1;
ratio_uncertainty_defined = false;
}
cxxSolutionIsotope::cxxSolutionIsotope(struct isotope *isotope_ptr)
{
isotope_number = isotope_ptr->isotope_number;
this->set_elt_name(isotope_ptr->elt_name);
this->set_isotope_name(isotope_ptr->isotope_name);
std::ostringstream name;
name << isotope_ptr->isotope_number << isotope_ptr->elt_name;
this->set_isotope_name(name.str().c_str());
total = isotope_ptr->total;
ratio = isotope_ptr->ratio;
ratio_uncertainty = isotope_ptr->ratio_uncertainty;
@ -141,10 +150,9 @@ cxxSolutionIsotope::dump_raw(std::ostream & s_oss, unsigned int indent) const
s_oss << std::endl;
}
CParser::STATUS_TYPE cxxSolutionIsotope::read_raw(CParser & parser)
CParser::STATUS_TYPE cxxSolutionIsotope::read_raw(CParser & parser, std::istream::pos_type next_char )
{
std::string token;
std::istream::pos_type next_char;
CParser::TOKEN_TYPE j;
// isotope_name
@ -183,7 +191,7 @@ CParser::STATUS_TYPE cxxSolutionIsotope::read_raw(CParser & parser)
}
// ratio_uncertainty
j = parser.copy_token(token, next_char);
j = parser.peek_token();
if (j == CParser::TT_EMPTY)
{
this->ratio_uncertainty = NAN;
@ -197,7 +205,8 @@ CParser::STATUS_TYPE cxxSolutionIsotope::read_raw(CParser & parser)
}
else
{
std::istringstream(token) >> this->ratio_uncertainty;
parser.get_iss() >> this->ratio_uncertainty;
this->ratio_uncertainty_defined = true;
}
return CParser::PARSER_OK;

View File

@ -26,7 +26,7 @@ class cxxSolutionIsotope
void dump_xml(std::ostream & os, unsigned int indent) const;
void dump_raw(std::ostream & os, unsigned int indent) const;
CParser::STATUS_TYPE read_raw(CParser & parser);
CParser::STATUS_TYPE read_raw(CParser & parser, std::istream::pos_type next_char);
double get_isotope_number() const
{