Fixes for cxx version of xsolution_save (constructor(n_user))

git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@2066 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2007-06-04 19:25:10 +00:00
parent 8a84d79562
commit 4145b60e10
2 changed files with 24 additions and 1 deletions

View File

@ -917,7 +917,25 @@ double cxxSolution::get_total(char *string)const
return(it->second);
}
}
double cxxSolution::get_total_element(char *string)const
{
cxxNameDouble::const_iterator it;
double d = 0.0;
for (it = this->totals.begin(); it != this->totals.end(); ++it)
{
char token[MAX_LENGTH], token1[MAX_LENGTH];
int n;
char *ptr;
strcpy(token, it->first);
replace("(", "", token);
ptr = token;
copy_token(token1, &ptr, &n);
if (strcmp(token1, string) == 0) {
d += it->second;
}
}
return(d);
}
void cxxSolution::set_total(char *string, double d)
{
this->totals[string] = d;

View File

@ -59,8 +59,13 @@ public:
void set_total_alkalinity(double total_alkalinity) {this->total_alkalinity = total_alkalinity;}
double get_total(char *string)const;
double get_total_element(char *string)const;
void set_total(char *string, double value);
void set_totals(cxxNameDouble &nd) {this->totals = nd; this->totals.type = cxxNameDouble::ND_ELT_MOLES;}
void clear_totals() {this->totals.clear();}
double get_master_activity(char *string)const;
void set_master_activity(char *string, double value);