mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
Tried optimizing get_total_element using std::strings
git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@2374 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
e7ec5c7691
commit
3f93ab5a1c
14
Solution.cxx
14
Solution.cxx
@ -853,6 +853,7 @@ double cxxSolution::get_total_element(char *string)const
|
||||
double d = 0.0;
|
||||
for (it = this->totals.begin(); it != this->totals.end(); ++it)
|
||||
{
|
||||
#ifdef SKIP
|
||||
char token[MAX_LENGTH], token1[MAX_LENGTH];
|
||||
int n;
|
||||
char *ptr;
|
||||
@ -863,6 +864,19 @@ double cxxSolution::get_total_element(char *string)const
|
||||
if (strcmp(token1, string) == 0) {
|
||||
d += it->second;
|
||||
}
|
||||
#endif
|
||||
std::string ename(string);
|
||||
std::string current_ename(string);
|
||||
std::basic_string <char>::size_type indexCh;
|
||||
indexCh = current_ename.find("(");
|
||||
if (indexCh != std::string::npos)
|
||||
{
|
||||
current_ename = current_ename.substr(0, indexCh);
|
||||
}
|
||||
if (current_ename == ename)
|
||||
{
|
||||
d += it->second;
|
||||
}
|
||||
}
|
||||
return(d);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user