Default_pe is now const char *, saves some string_hsave in clear in prep.

Test cases are OK.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@7722 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2013-05-15 20:46:20 +00:00
parent d7321bd3e9
commit f127add44a
4 changed files with 13 additions and 7 deletions

View File

@ -31,8 +31,8 @@ class cxxISolution: public PHRQ_base
else
this->units.clear();
}
std::string Get_default_pe() const {return default_pe;}
void Set_default_pe(std::string pe) {default_pe = pe;}
const char * Get_default_pe() const {return default_pe;}
void Set_default_pe(const char * pe) {default_pe = pe;}
std::map < std::string, cxxISolutionComp > &Get_comps(void) {return this->comps;}
const std::map < std::string, cxxISolutionComp > &Get_comps(void)const {return this->comps;}
void Set_comps(std::map < std::string, cxxISolutionComp > &c) {this->comps = c;}
@ -46,7 +46,7 @@ class cxxISolution: public PHRQ_base
std::string units;
std::map < std::string, cxxISolutionComp > comps;
std::map <std::string, cxxChemRxn > pe_reactions;
std::string default_pe;
const char * default_pe;
};
#endif // !defined(ISOLUTION_H_INCLUDED)

View File

@ -1804,17 +1804,20 @@ clear(void)
/*
* Clear master species solution-dependent data
*/
const char * pe_str = string_hsave("pe");
for (i = 0; i < count_master; i++)
{
master[i]->in = FALSE;
master[i]->unknown = NULL;
if (solution_ptr->Get_initial_data())
{
master[i]->pe_rxn = string_hsave(solution_ptr->Get_initial_data()->Get_default_pe().c_str());
//master[i]->pe_rxn = string_hsave(solution_ptr->Get_initial_data()->Get_default_pe().c_str());
master[i]->pe_rxn = solution_ptr->Get_initial_data()->Get_default_pe();
}
else
{
master[i]->pe_rxn = string_hsave("pe");
//master[i]->pe_rxn = string_hsave("pe");
master[i]->pe_rxn = pe_str;
}
/*
* copy primary reaction to secondary reaction

View File

@ -5172,7 +5172,9 @@ read_solution(void)
break;
if (parser.parse_couple(token) == CParser::PARSER_OK)
{
isoln_ptr->Set_default_pe(token);
const char * str = string_hsave(token.c_str());
//isoln_ptr->Set_default_pe(token);
isoln_ptr->Set_default_pe(str);
cxxChemRxn temp_chem_reaction;
isoln_ptr->Get_pe_reactions()[token] = temp_chem_reaction;
}

View File

@ -688,7 +688,8 @@ spread_row_to_solution(struct spread_row *heading, struct spread_row *units,
break;
if (parser.parse_couple(token) == OK)
{
initial_data_ptr->Set_default_pe(token);
const char * pe_str = string_hsave(token.c_str());
initial_data_ptr->Set_default_pe(pe_str);
cxxChemRxn temp_chem_reaction;
initial_data_ptr->Get_pe_reactions()[token] = temp_chem_reaction;
}