mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
Made all the changes to add phreeqc pointer as argument to
Phreeqcpp class methods. Still compiles on Debug and Release, but problem with phrq_malloc in cvdense and cvode. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@3876 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
157e5cc729
commit
9f4eefd214
46
ExchComp.cxx
46
ExchComp.cxx
@ -129,7 +129,7 @@ cxxExchComp::~cxxExchComp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct master *
|
struct master *
|
||||||
cxxExchComp::get_master()
|
cxxExchComp::get_master(PHREEQC_PTR_ARG)
|
||||||
{
|
{
|
||||||
struct master *master_ptr = NULL;
|
struct master *master_ptr = NULL;
|
||||||
for (std::map < std::string, double >::iterator it =
|
for (std::map < std::string, double >::iterator it =
|
||||||
@ -137,16 +137,16 @@ cxxExchComp::get_master()
|
|||||||
{
|
{
|
||||||
|
|
||||||
/* Find master species */
|
/* Find master species */
|
||||||
char *eltName = string_hsave(it->first.c_str());
|
char *eltName = P_INSTANCE_POINTER string_hsave(it->first.c_str());
|
||||||
assert(it->first.size() != 0);
|
assert(it->first.size() != 0);
|
||||||
struct element *elt_ptr = element_store(eltName);
|
struct element *elt_ptr = P_INSTANCE_POINTER element_store(eltName);
|
||||||
if (elt_ptr->master == NULL)
|
if (elt_ptr->master == NULL)
|
||||||
{
|
{
|
||||||
std::ostringstream error_oss;
|
std::ostringstream error_oss;
|
||||||
error_oss << "Master species not in data base for " << elt_ptr->
|
error_oss << "Master species not in data base for " << elt_ptr->
|
||||||
name << std::endl;
|
name << std::endl;
|
||||||
//Utilities::error_msg(error_oss.str(), STOP);
|
//Utilities::error_msg(error_oss.str(), STOP);
|
||||||
error_msg(error_oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(error_oss.str().c_str(), CONTINUE);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
if (elt_ptr->master->type != EX)
|
if (elt_ptr->master->type != EX)
|
||||||
@ -161,16 +161,16 @@ cxxExchComp::get_master()
|
|||||||
{
|
{
|
||||||
|
|
||||||
/* Find master species */
|
/* Find master species */
|
||||||
char *eltName = string_hsave(it->first.c_str());
|
char *eltName = P_INSTANCE_POINTER string_hsave(it->first.c_str());
|
||||||
assert(it->first.size() != 0);
|
assert(it->first.size() != 0);
|
||||||
struct element *elt_ptr = element_store(eltName);
|
struct element *elt_ptr = P_INSTANCE_POINTER element_store(eltName);
|
||||||
if (elt_ptr->master == NULL)
|
if (elt_ptr->master == NULL)
|
||||||
{
|
{
|
||||||
std::ostringstream error_oss;
|
std::ostringstream error_oss;
|
||||||
error_oss << "Master species not in data base for " <<
|
error_oss << "Master species not in data base for " <<
|
||||||
elt_ptr->name << std::endl;
|
elt_ptr->name << std::endl;
|
||||||
//Utilities::error_msg(error_oss.str(), STOP);
|
//Utilities::error_msg(error_oss.str(), STOP);
|
||||||
error_msg(error_oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(error_oss.str().c_str(), CONTINUE);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
if (elt_ptr->master->type != EX)
|
if (elt_ptr->master->type != EX)
|
||||||
@ -186,7 +186,7 @@ cxxExchComp::get_master()
|
|||||||
"Exchange formula does not contain an exchange master species, "
|
"Exchange formula does not contain an exchange master species, "
|
||||||
<< this->formula << std::endl;
|
<< this->formula << std::endl;
|
||||||
//Utilities::error_msg(error_oss.str(), CONTINUE);
|
//Utilities::error_msg(error_oss.str(), CONTINUE);
|
||||||
error_msg(error_oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(error_oss.str().c_str(), CONTINUE);
|
||||||
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
this->dump_raw(oss, 0);
|
this->dump_raw(oss, 0);
|
||||||
@ -197,7 +197,7 @@ cxxExchComp::get_master()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct exch_comp *
|
struct exch_comp *
|
||||||
cxxExchComp::cxxExchComp2exch_comp(std::map < std::string, cxxExchComp > &el)
|
cxxExchComp::cxxExchComp2exch_comp(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxExchComp > &el)
|
||||||
//
|
//
|
||||||
// Builds exch_comp structure from of cxxExchComp
|
// Builds exch_comp structure from of cxxExchComp
|
||||||
//
|
//
|
||||||
@ -206,7 +206,7 @@ struct exch_comp *
|
|||||||
(struct exch_comp *)
|
(struct exch_comp *)
|
||||||
PHRQ_malloc((size_t) (el.size() * sizeof(struct exch_comp)));
|
PHRQ_malloc((size_t) (el.size() * sizeof(struct exch_comp)));
|
||||||
if (exch_comp_ptr == NULL)
|
if (exch_comp_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::map < std::string, cxxExchComp >::iterator it = el.begin(); it != el.end();
|
for (std::map < std::string, cxxExchComp >::iterator it = el.begin(); it != el.end();
|
||||||
@ -215,23 +215,23 @@ struct exch_comp *
|
|||||||
if ((*it).second.formula.size() == 0)
|
if ((*it).second.formula.size() == 0)
|
||||||
exch_comp_ptr[i].formula = NULL;
|
exch_comp_ptr[i].formula = NULL;
|
||||||
else
|
else
|
||||||
exch_comp_ptr[i].formula = string_hsave((*it).second.formula.c_str());
|
exch_comp_ptr[i].formula = P_INSTANCE_POINTER string_hsave((*it).second.formula.c_str());
|
||||||
exch_comp_ptr[i].formula_z = (*it).second.formula_z;
|
exch_comp_ptr[i].formula_z = (*it).second.formula_z;
|
||||||
exch_comp_ptr[i].totals = (*it).second.totals.elt_list();
|
exch_comp_ptr[i].totals = (*it).second.totals.elt_list(P_INSTANCE);
|
||||||
exch_comp_ptr[i].moles = (*it).second.moles;
|
exch_comp_ptr[i].moles = (*it).second.moles;
|
||||||
exch_comp_ptr[i].formula_totals = (*it).second.formula_totals.elt_list();
|
exch_comp_ptr[i].formula_totals = (*it).second.formula_totals.elt_list(P_INSTANCE);
|
||||||
exch_comp_ptr[i].la = (*it).second.la;
|
exch_comp_ptr[i].la = (*it).second.la;
|
||||||
exch_comp_ptr[i].charge_balance = (*it).second.charge_balance;
|
exch_comp_ptr[i].charge_balance = (*it).second.charge_balance;
|
||||||
if ((*it).second.phase_name.size() == 0)
|
if ((*it).second.phase_name.size() == 0)
|
||||||
exch_comp_ptr[i].phase_name = NULL;
|
exch_comp_ptr[i].phase_name = NULL;
|
||||||
else
|
else
|
||||||
exch_comp_ptr[i].phase_name = string_hsave((*it).second.phase_name.c_str());
|
exch_comp_ptr[i].phase_name = P_INSTANCE_POINTER string_hsave((*it).second.phase_name.c_str());
|
||||||
exch_comp_ptr[i].phase_proportion = (*it).second.phase_proportion;
|
exch_comp_ptr[i].phase_proportion = (*it).second.phase_proportion;
|
||||||
if ((*it).second.rate_name.size() == 0)
|
if ((*it).second.rate_name.size() == 0)
|
||||||
exch_comp_ptr[i].rate_name = NULL;
|
exch_comp_ptr[i].rate_name = NULL;
|
||||||
else
|
else
|
||||||
exch_comp_ptr[i].rate_name = string_hsave((*it).second.rate_name.c_str());
|
exch_comp_ptr[i].rate_name = P_INSTANCE_POINTER string_hsave((*it).second.rate_name.c_str());
|
||||||
exch_comp_ptr[i].master = (*it).second.get_master();
|
exch_comp_ptr[i].master = (*it).second.get_master(P_INSTANCE);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return (exch_comp_ptr);
|
return (exch_comp_ptr);
|
||||||
@ -333,7 +333,7 @@ cxxExchComp::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxExchComp::read_raw(CParser & parser, bool check)
|
cxxExchComp::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ cxxExchComp::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 8: // totals
|
case 8: // totals
|
||||||
if (this->totals.read_raw(parser, next_char) !=
|
if (this->totals.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -499,7 +499,7 @@ cxxExchComp::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 9: // formula_totals
|
case 9: // formula_totals
|
||||||
if (this->formula_totals.read_raw(parser, next_char) !=
|
if (this->formula_totals.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -550,7 +550,7 @@ cxxExchComp::read_raw(CParser & parser, bool check)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
cxxExchComp::add(const cxxExchComp & addee, double extensive)
|
cxxExchComp::add(PHREEQC_PTR_ARG_COMMA const cxxExchComp & addee, double extensive)
|
||||||
{
|
{
|
||||||
double ext1, ext2, f1, f2;
|
double ext1, ext2, f1, f2;
|
||||||
if (extensive == 0.0)
|
if (extensive == 0.0)
|
||||||
@ -602,7 +602,7 @@ cxxExchComp::add(const cxxExchComp & addee, double extensive)
|
|||||||
oss <<
|
oss <<
|
||||||
"Can not mix two exchange components with same formula and different related phases, "
|
"Can not mix two exchange components with same formula and different related phases, "
|
||||||
<< this->formula;
|
<< this->formula;
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
input_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ cxxExchComp::add(const cxxExchComp & addee, double extensive)
|
|||||||
oss <<
|
oss <<
|
||||||
"Can not mix two exchange components with same formula and different related kinetics, "
|
"Can not mix two exchange components with same formula and different related kinetics, "
|
||||||
<< this->formula;
|
<< this->formula;
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
input_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -635,7 +635,7 @@ cxxExchComp::add(const cxxExchComp & addee, double extensive)
|
|||||||
oss <<
|
oss <<
|
||||||
"Can not mix exchange components related to phase with exchange components related to kinetics, "
|
"Can not mix exchange components related to phase with exchange components related to kinetics, "
|
||||||
<< this->formula;
|
<< this->formula;
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
input_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,16 +17,16 @@ class cxxExchComp
|
|||||||
cxxExchComp(struct exch_comp *);
|
cxxExchComp(struct exch_comp *);
|
||||||
~cxxExchComp();
|
~cxxExchComp();
|
||||||
|
|
||||||
struct master *get_master();
|
struct master *get_master(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
static struct exch_comp *cxxExchComp2exch_comp(std::map < std::string, cxxExchComp >
|
static struct exch_comp *cxxExchComp2exch_comp(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxExchComp >
|
||||||
&el);
|
&el);
|
||||||
|
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check=true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check=true);
|
||||||
|
|
||||||
const std::string &get_formula() const
|
const std::string &get_formula() const
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ class cxxExchComp
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void add(const cxxExchComp & comp, double extensive);
|
void add(PHREEQC_PTR_ARG_COMMA const cxxExchComp & comp, double extensive);
|
||||||
void multiply(double extensive);
|
void multiply(double extensive);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
74
Exchange.cxx
74
Exchange.cxx
@ -58,7 +58,7 @@ cxxNumKeyword()
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
cxxExchange::cxxExchange(const std::map < int, cxxExchange > &entities,
|
cxxExchange::cxxExchange(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxExchange > &entities,
|
||||||
cxxMix & mix, int n_user):
|
cxxMix & mix, int n_user):
|
||||||
cxxNumKeyword()
|
cxxNumKeyword()
|
||||||
{
|
{
|
||||||
@ -75,7 +75,7 @@ cxxNumKeyword()
|
|||||||
{
|
{
|
||||||
const cxxExchange *entity_ptr =
|
const cxxExchange *entity_ptr =
|
||||||
&(entities.find(it->first)->second);
|
&(entities.find(it->first)->second);
|
||||||
this->add(*entity_ptr, it->second);
|
this->add(P_INSTANCE_COMMA *entity_ptr, it->second);
|
||||||
this->pitzer_exchange_gammas = entity_ptr->pitzer_exchange_gammas;
|
this->pitzer_exchange_gammas = entity_ptr->pitzer_exchange_gammas;
|
||||||
}
|
}
|
||||||
#ifdef SKIP
|
#ifdef SKIP
|
||||||
@ -92,7 +92,7 @@ cxxNumKeyword()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cxxExchange::cxxExchange(int n_user)
|
cxxExchange::cxxExchange(PHREEQC_PTR_ARG_COMMA int n_user)
|
||||||
//
|
//
|
||||||
// constructor for cxxExchange from reaction calculation
|
// constructor for cxxExchange from reaction calculation
|
||||||
// equivalent of xexchange_save
|
// equivalent of xexchange_save
|
||||||
@ -108,61 +108,61 @@ cxxNumKeyword()
|
|||||||
this->n_user = n_user;
|
this->n_user = n_user;
|
||||||
this->n_user_end = n_user;
|
this->n_user_end = n_user;
|
||||||
this->pitzer_exchange_gammas =
|
this->pitzer_exchange_gammas =
|
||||||
(use.exchange_ptr->pitzer_exchange_gammas == TRUE);
|
(P_INSTANCE_POINTER use.exchange_ptr->pitzer_exchange_gammas == TRUE);
|
||||||
this->totals.type = cxxNameDouble::ND_ELT_MOLES;
|
this->totals.type = cxxNameDouble::ND_ELT_MOLES;
|
||||||
for (i = 0; i < count_unknowns; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_unknowns; i++)
|
||||||
{
|
{
|
||||||
if (x[i]->type == EXCH)
|
if (P_INSTANCE_POINTER x[i]->type == EXCH)
|
||||||
{
|
{
|
||||||
cxxExchComp ec;
|
cxxExchComp ec;
|
||||||
//char * formula;
|
//char * formula;
|
||||||
ec.set_formula(x[i]->exch_comp->formula);
|
ec.set_formula(P_INSTANCE_POINTER x[i]->exch_comp->formula);
|
||||||
//double moles;
|
//double moles;
|
||||||
ec.set_moles(0.0);
|
ec.set_moles(0.0);
|
||||||
//cxxNameDouble formula_totals;
|
//cxxNameDouble formula_totals;
|
||||||
ec.set_formula_totals(x[i]->exch_comp->formula_totals);
|
ec.set_formula_totals(P_INSTANCE_POINTER x[i]->exch_comp->formula_totals);
|
||||||
//cxxNameDouble totals; see below
|
//cxxNameDouble totals; see below
|
||||||
//double la;
|
//double la;
|
||||||
ec.set_la(x[i]->master[0]->s->la);
|
ec.set_la(P_INSTANCE_POINTER x[i]->master[0]->s->la);
|
||||||
//double charge_balance; see below
|
//double charge_balance; see below
|
||||||
//char *phase_name;
|
//char *phase_name;
|
||||||
ec.set_phase_name(x[i]->exch_comp->phase_name);
|
ec.set_phase_name(P_INSTANCE_POINTER x[i]->exch_comp->phase_name);
|
||||||
//double phase_proportion;
|
//double phase_proportion;
|
||||||
ec.set_phase_proportion(x[i]->exch_comp->phase_proportion);
|
ec.set_phase_proportion(P_INSTANCE_POINTER x[i]->exch_comp->phase_proportion);
|
||||||
//char *rate_name;
|
//char *rate_name;
|
||||||
ec.set_rate_name(x[i]->exch_comp->rate_name);
|
ec.set_rate_name(P_INSTANCE_POINTER x[i]->exch_comp->rate_name);
|
||||||
//double formula_z;
|
//double formula_z;
|
||||||
ec.set_formula_z(x[i]->exch_comp->formula_z);
|
ec.set_formula_z(P_INSTANCE_POINTER x[i]->exch_comp->formula_z);
|
||||||
|
|
||||||
// calculate charge and totals
|
// calculate charge and totals
|
||||||
count_elts = 0;
|
P_INSTANCE_POINTER count_elts = 0;
|
||||||
paren_count = 0;
|
P_INSTANCE_POINTER paren_count = 0;
|
||||||
double charge = 0.0;
|
double charge = 0.0;
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < count_species_list; j++)
|
for (j = 0; j < P_INSTANCE_POINTER count_species_list; j++)
|
||||||
{
|
{
|
||||||
if (species_list[j].master_s == x[i]->master[0]->s)
|
if (P_INSTANCE_POINTER species_list[j].master_s == P_INSTANCE_POINTER x[i]->master[0]->s)
|
||||||
{
|
{
|
||||||
add_elt_list(species_list[j].s->next_elt,
|
P_INSTANCE_POINTER add_elt_list(P_INSTANCE_POINTER species_list[j].s->next_elt,
|
||||||
species_list[j].s->moles);
|
P_INSTANCE_POINTER species_list[j].s->moles);
|
||||||
charge += species_list[j].s->moles * species_list[j].s->z;
|
charge += P_INSTANCE_POINTER species_list[j].s->moles * P_INSTANCE_POINTER species_list[j].s->z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Keep exchanger related to phase even if none currently in solution
|
// Keep exchanger related to phase even if none currently in solution
|
||||||
if (x[i]->exch_comp->phase_name != NULL && count_elts == 0)
|
if (P_INSTANCE_POINTER x[i]->exch_comp->phase_name != NULL && P_INSTANCE_POINTER count_elts == 0)
|
||||||
{
|
{
|
||||||
add_elt_list(x[i]->master[0]->s->next_elt, 1e-20);
|
P_INSTANCE_POINTER add_elt_list(P_INSTANCE_POINTER x[i]->master[0]->s->next_elt, 1e-20);
|
||||||
}
|
}
|
||||||
//double charge_balance
|
//double charge_balance
|
||||||
ec.set_charge_balance(charge);
|
ec.set_charge_balance(charge);
|
||||||
//cxxNameDouble totals;
|
//cxxNameDouble totals;
|
||||||
if (count_elts > 0)
|
if (P_INSTANCE_POINTER count_elts > 0)
|
||||||
{
|
{
|
||||||
qsort(elt_list, (size_t) count_elts,
|
qsort(P_INSTANCE_POINTER elt_list, (size_t) P_INSTANCE_POINTER count_elts,
|
||||||
(size_t) sizeof(struct elt_list), elt_list_compare);
|
(size_t) sizeof(struct elt_list), P_INSTANCE_POINTER elt_list_compare);
|
||||||
elt_list_combine();
|
P_INSTANCE_POINTER elt_list_combine();
|
||||||
}
|
}
|
||||||
ec.set_totals(elt_list, count_elts);
|
ec.set_totals(P_INSTANCE_POINTER elt_list, P_INSTANCE_POINTER count_elts);
|
||||||
|
|
||||||
// add to comp list
|
// add to comp list
|
||||||
std::string str(ec.get_formula());
|
std::string str(ec.get_formula());
|
||||||
@ -202,12 +202,12 @@ cxxExchange::get_related_rate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct exchange *
|
struct exchange *
|
||||||
cxxExchange::cxxExchange2exchange()
|
cxxExchange::cxxExchange2exchange(PHREEQC_PTR_ARG)
|
||||||
//
|
//
|
||||||
// Builds a exchange structure from instance of cxxExchange
|
// Builds a exchange structure from instance of cxxExchange
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
struct exchange *exchange_ptr = exchange_alloc();
|
struct exchange *exchange_ptr = P_INSTANCE_POINTER exchange_alloc();
|
||||||
|
|
||||||
exchange_ptr->description = this->get_description();
|
exchange_ptr->description = this->get_description();
|
||||||
exchange_ptr->n_user = this->n_user;
|
exchange_ptr->n_user = this->n_user;
|
||||||
@ -219,8 +219,8 @@ cxxExchange::cxxExchange2exchange()
|
|||||||
exchange_ptr->related_rate = (int) this->get_related_rate();
|
exchange_ptr->related_rate = (int) this->get_related_rate();
|
||||||
exchange_ptr->pitzer_exchange_gammas = (int) this->pitzer_exchange_gammas;
|
exchange_ptr->pitzer_exchange_gammas = (int) this->pitzer_exchange_gammas;
|
||||||
exchange_ptr->count_comps = (int) this->exchComps.size();
|
exchange_ptr->count_comps = (int) this->exchComps.size();
|
||||||
exchange_ptr->comps = (struct exch_comp *) free_check_null(exchange_ptr->comps);
|
exchange_ptr->comps = (struct exch_comp *) P_INSTANCE_POINTER free_check_null(exchange_ptr->comps);
|
||||||
exchange_ptr->comps = cxxExchComp::cxxExchComp2exch_comp(this->exchComps);
|
exchange_ptr->comps = cxxExchComp::cxxExchComp2exch_comp(P_INSTANCE_COMMA this->exchComps);
|
||||||
return (exchange_ptr);
|
return (exchange_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ cxxExchange::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxExchange::read_raw(CParser & parser, bool check)
|
cxxExchange::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
static std::vector < std::string > vopts;
|
static std::vector < std::string > vopts;
|
||||||
if (vopts.empty())
|
if (vopts.empty())
|
||||||
@ -387,7 +387,7 @@ cxxExchange::read_raw(CParser & parser, bool check)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
parser.set_accumulate(true);
|
parser.set_accumulate(true);
|
||||||
ec.read_raw(parser, false);
|
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||||
parser.set_accumulate(false);
|
parser.set_accumulate(false);
|
||||||
std::istringstream is(parser.get_accumulated());
|
std::istringstream is(parser.get_accumulated());
|
||||||
CParser reread(is);
|
CParser reread(is);
|
||||||
@ -396,12 +396,12 @@ cxxExchange::read_raw(CParser & parser, bool check)
|
|||||||
if (this->exchComps.find(ec.get_formula()) != this->exchComps.end())
|
if (this->exchComps.find(ec.get_formula()) != this->exchComps.end())
|
||||||
{
|
{
|
||||||
cxxExchComp & comp = this->exchComps.find(ec.get_formula())->second;
|
cxxExchComp & comp = this->exchComps.find(ec.get_formula())->second;
|
||||||
comp.read_raw(reread, false);
|
comp.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cxxExchComp ec1;
|
cxxExchComp ec1;
|
||||||
ec1.read_raw(reread, false);
|
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
std::string str(ec1.get_formula());
|
std::string str(ec1.get_formula());
|
||||||
this->exchComps[str] = ec1;
|
this->exchComps[str] = ec1;
|
||||||
}
|
}
|
||||||
@ -463,7 +463,7 @@ cxxExchange::add(const cxxExchange & addee, double extensive)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
cxxExchange::add(const cxxExchange & addee, double extensive)
|
cxxExchange::add(PHREEQC_PTR_ARG_COMMA const cxxExchange & addee, double extensive)
|
||||||
//
|
//
|
||||||
// Add existing exchange to "this" exchange
|
// Add existing exchange to "this" exchange
|
||||||
//
|
//
|
||||||
@ -477,7 +477,7 @@ cxxExchange::add(const cxxExchange & addee, double extensive)
|
|||||||
std::map < std::string, cxxExchComp >::iterator it = this->exchComps.find((*itadd).first);
|
std::map < std::string, cxxExchComp >::iterator it = this->exchComps.find((*itadd).first);
|
||||||
if (it != this->exchComps.end())
|
if (it != this->exchComps.end())
|
||||||
{
|
{
|
||||||
(*it).second.add((*itadd).second, extensive);
|
(*it).second.add(P_INSTANCE_COMMA (*itadd).second, extensive);
|
||||||
//bool found = false;
|
//bool found = false;
|
||||||
//for (std::list < cxxExchComp >::iterator it = this->exchComps.begin();
|
//for (std::list < cxxExchComp >::iterator it = this->exchComps.begin();
|
||||||
// it != this->exchComps.end(); ++it)
|
// it != this->exchComps.end(); ++it)
|
||||||
|
|||||||
10
Exchange.h
10
Exchange.h
@ -15,19 +15,19 @@ class cxxExchange:public cxxNumKeyword
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
cxxExchange();
|
cxxExchange();
|
||||||
cxxExchange(int n_user);
|
cxxExchange(PHREEQC_PTR_ARG_COMMA int n_user);
|
||||||
cxxExchange(struct exchange *);
|
cxxExchange(struct exchange *);
|
||||||
cxxExchange(const std::map < int, cxxExchange > &exchange_map,
|
cxxExchange(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxExchange > &exchange_map,
|
||||||
cxxMix & mx, int n_user);
|
cxxMix & mx, int n_user);
|
||||||
~cxxExchange();
|
~cxxExchange();
|
||||||
|
|
||||||
struct exchange *cxxExchange2exchange();
|
struct exchange *cxxExchange2exchange(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
struct exch_comp *cxxExchComp2exch_comp();
|
struct exch_comp *cxxExchComp2exch_comp();
|
||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
bool get_related_phases(void);
|
bool get_related_phases(void);
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
void add(const cxxExchange & addee, double extensive);
|
void add(PHREEQC_PTR_ARG_COMMA const cxxExchange & addee, double extensive);
|
||||||
// not written
|
// not written
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|
||||||
|
|||||||
28
GasPhase.cxx
28
GasPhase.cxx
@ -69,7 +69,7 @@ cxxNumKeyword()
|
|||||||
gas_phase_ptr->comps[i].moles;
|
gas_phase_ptr->comps[i].moles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cxxGasPhase::cxxGasPhase(const std::map < int, cxxGasPhase > &entities,
|
cxxGasPhase::cxxGasPhase(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxGasPhase > &entities,
|
||||||
cxxMix & mix, int n_user):
|
cxxMix & mix, int n_user):
|
||||||
cxxNumKeyword()
|
cxxNumKeyword()
|
||||||
{
|
{
|
||||||
@ -108,7 +108,7 @@ cxxNumKeyword()
|
|||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Can not mix two gas_phases with differing types.";
|
oss << "Can not mix two gas_phases with differing types.";
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
input_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ cxxGasPhase::~cxxGasPhase()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct gas_comp *
|
struct gas_comp *
|
||||||
cxxGasPhase::cxxGasPhaseComp2gas_comp()
|
cxxGasPhase::cxxGasPhaseComp2gas_comp(PHREEQC_PTR_ARG)
|
||||||
{
|
{
|
||||||
//struct gas_comp *gas_comp_ptr(NULL);
|
//struct gas_comp *gas_comp_ptr(NULL);
|
||||||
struct gas_comp *gas_comp_ptr = NULL;
|
struct gas_comp *gas_comp_ptr = NULL;
|
||||||
@ -139,13 +139,13 @@ cxxGasPhase::cxxGasPhaseComp2gas_comp()
|
|||||||
(this->gasPhaseComps.size() *
|
(this->gasPhaseComps.size() *
|
||||||
sizeof(struct gas_comp)));
|
sizeof(struct gas_comp)));
|
||||||
if (gas_comp_ptr == NULL)
|
if (gas_comp_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
for (cxxNameDouble::iterator it = this->gasPhaseComps.begin();
|
for (cxxNameDouble::iterator it = this->gasPhaseComps.begin();
|
||||||
it != this->gasPhaseComps.end(); it++)
|
it != this->gasPhaseComps.end(); it++)
|
||||||
{
|
{
|
||||||
gas_comp_ptr[i].name = string_hsave(it->first.c_str());
|
gas_comp_ptr[i].name = P_INSTANCE_POINTER string_hsave(it->first.c_str());
|
||||||
assert(it->first.size() != 0);
|
assert(it->first.size() != 0);
|
||||||
gas_comp_ptr[i].phase = phase_bsearch(it->first.c_str(), &n, TRUE);
|
gas_comp_ptr[i].phase = P_INSTANCE_POINTER phase_bsearch(it->first.c_str(), &n, TRUE);
|
||||||
gas_comp_ptr[i].p_read = 0;
|
gas_comp_ptr[i].p_read = 0;
|
||||||
gas_comp_ptr[i].moles = it->second;
|
gas_comp_ptr[i].moles = it->second;
|
||||||
gas_comp_ptr[i].initial_moles = 0;
|
gas_comp_ptr[i].initial_moles = 0;
|
||||||
@ -156,12 +156,12 @@ cxxGasPhase::cxxGasPhaseComp2gas_comp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct gas_phase *
|
struct gas_phase *
|
||||||
cxxGasPhase::cxxGasPhase2gas_phase()
|
cxxGasPhase::cxxGasPhase2gas_phase(PHREEQC_PTR_ARG)
|
||||||
//
|
//
|
||||||
// Builds a gas_phase structure from instance of cxxGasPhase
|
// Builds a gas_phase structure from instance of cxxGasPhase
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
struct gas_phase *gas_phase_ptr = gas_phase_alloc();
|
struct gas_phase *gas_phase_ptr = P_INSTANCE_POINTER gas_phase_alloc();
|
||||||
|
|
||||||
gas_phase_ptr->description = this->get_description();
|
gas_phase_ptr->description = this->get_description();
|
||||||
gas_phase_ptr->n_user = this->n_user;
|
gas_phase_ptr->n_user = this->n_user;
|
||||||
@ -184,8 +184,8 @@ cxxGasPhase::cxxGasPhase2gas_phase()
|
|||||||
// comps
|
// comps
|
||||||
gas_phase_ptr->count_comps = (int) this->gasPhaseComps.size();
|
gas_phase_ptr->count_comps = (int) this->gasPhaseComps.size();
|
||||||
gas_phase_ptr->comps =
|
gas_phase_ptr->comps =
|
||||||
(struct gas_comp *) free_check_null(gas_phase_ptr->comps);
|
(struct gas_comp *) P_INSTANCE_POINTER free_check_null(gas_phase_ptr->comps);
|
||||||
gas_phase_ptr->comps = this->cxxGasPhaseComp2gas_comp();
|
gas_phase_ptr->comps = this->cxxGasPhaseComp2gas_comp(P_INSTANCE);
|
||||||
|
|
||||||
return (gas_phase_ptr);
|
return (gas_phase_ptr);
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ cxxGasPhase::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxGasPhase::read_raw(CParser & parser, bool check)
|
cxxGasPhase::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@ -361,7 +361,7 @@ cxxGasPhase::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // component
|
case 3: // component
|
||||||
if (this->gasPhaseComps.read_raw(parser, next_char) !=
|
if (this->gasPhaseComps.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -445,7 +445,7 @@ cxxGasPhase::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
cxxGasPhase::totalize()
|
cxxGasPhase::totalize(PHREEQC_PTR_ARG)
|
||||||
{
|
{
|
||||||
this->totals.clear();
|
this->totals.clear();
|
||||||
// component structures
|
// component structures
|
||||||
@ -454,7 +454,7 @@ cxxGasPhase::totalize()
|
|||||||
{
|
{
|
||||||
struct phase *phase_ptr;
|
struct phase *phase_ptr;
|
||||||
int l;
|
int l;
|
||||||
phase_ptr = phase_bsearch(it->first.c_str(), &l, FALSE);
|
phase_ptr = P_INSTANCE_POINTER phase_bsearch(it->first.c_str(), &l, FALSE);
|
||||||
if (phase_ptr != NULL)
|
if (phase_ptr != NULL)
|
||||||
{
|
{
|
||||||
cxxNameDouble phase_formula(phase_ptr->next_elt);
|
cxxNameDouble phase_formula(phase_ptr->next_elt);
|
||||||
|
|||||||
10
GasPhase.h
10
GasPhase.h
@ -17,7 +17,7 @@ class cxxGasPhase:public cxxNumKeyword
|
|||||||
public:
|
public:
|
||||||
cxxGasPhase();
|
cxxGasPhase();
|
||||||
cxxGasPhase(struct gas_phase *);
|
cxxGasPhase(struct gas_phase *);
|
||||||
cxxGasPhase(const std::map < int, cxxGasPhase > &entity_map,
|
cxxGasPhase(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxGasPhase > &entity_map,
|
||||||
cxxMix & mx, int n_user);
|
cxxMix & mx, int n_user);
|
||||||
~cxxGasPhase();
|
~cxxGasPhase();
|
||||||
|
|
||||||
@ -27,22 +27,22 @@ class cxxGasPhase:public cxxNumKeyword
|
|||||||
GP_VOLUME = 1
|
GP_VOLUME = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gas_phase *cxxGasPhase2gas_phase();
|
struct gas_phase *cxxGasPhase2gas_phase(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
struct gas_comp *cxxGasPhaseComp2gas_comp();
|
struct gas_comp *cxxGasPhaseComp2gas_comp(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
#ifdef USE_MPI
|
#ifdef USE_MPI
|
||||||
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
||||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void totalize();
|
void totalize(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
const cxxNameDouble & get_totals() const
|
const cxxNameDouble & get_totals() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,7 +38,7 @@ units("mMol/kgw")
|
|||||||
pes = NULL;
|
pes = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cxxISolution::cxxISolution(struct solution *solution_ptr):
|
cxxISolution::cxxISolution(PHREEQC_PTR_ARG_COMMA struct solution *solution_ptr):
|
||||||
cxxSolution(solution_ptr)
|
cxxSolution(solution_ptr)
|
||||||
//, pe(cxxPe_Data::alloc())
|
//, pe(cxxPe_Data::alloc())
|
||||||
{
|
{
|
||||||
@ -53,39 +53,39 @@ cxxSolution(solution_ptr)
|
|||||||
}
|
}
|
||||||
default_pe = solution_ptr->default_pe;
|
default_pe = solution_ptr->default_pe;
|
||||||
// pe_data
|
// pe_data
|
||||||
pes = pe_data_dup(solution_ptr->pe);
|
pes = P_INSTANCE_POINTER pe_data_dup(solution_ptr->pe);
|
||||||
}
|
}
|
||||||
|
|
||||||
cxxISolution::~cxxISolution()
|
cxxISolution::~cxxISolution()
|
||||||
{
|
{
|
||||||
pe_data_free(this->pes);
|
//// ToDo //pe_data_free(this->pes);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct solution *
|
struct solution *
|
||||||
cxxISolution::cxxISolution2solution()
|
cxxISolution::cxxISolution2solution(PHREEQC_PTR_ARG)
|
||||||
//
|
//
|
||||||
// Builds a solution structure from instance of cxxISolution
|
// Builds a solution structure from instance of cxxISolution
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
struct solution *soln_ptr = this->cxxSolution2solution();
|
struct solution *soln_ptr = this->cxxSolution2solution(P_INSTANCE);
|
||||||
soln_ptr->new_def = TRUE;
|
soln_ptr->new_def = TRUE;
|
||||||
soln_ptr->density = this->density;
|
soln_ptr->density = this->density;
|
||||||
if (this->units.size() == 0)
|
if (this->units.size() == 0)
|
||||||
soln_ptr->units = NULL;
|
soln_ptr->units = NULL;
|
||||||
else
|
else
|
||||||
soln_ptr->units = string_hsave(this->units.c_str());
|
soln_ptr->units = P_INSTANCE_POINTER string_hsave(this->units.c_str());
|
||||||
soln_ptr->default_pe = this->default_pe;
|
soln_ptr->default_pe = this->default_pe;
|
||||||
// pe
|
// pe
|
||||||
soln_ptr->pe = (struct pe_data *) pe_data_free(soln_ptr->pe);
|
soln_ptr->pe = (struct pe_data *) P_INSTANCE_POINTER pe_data_free(soln_ptr->pe);
|
||||||
soln_ptr->pe = pe_data_dup(this->pes);
|
soln_ptr->pe = P_INSTANCE_POINTER pe_data_dup(this->pes);
|
||||||
// totals
|
// totals
|
||||||
soln_ptr->totals = (struct conc *) free_check_null(soln_ptr->totals);
|
soln_ptr->totals = (struct conc *) P_INSTANCE_POINTER free_check_null(soln_ptr->totals);
|
||||||
soln_ptr->totals = cxxISolutionComp::cxxISolutionComp2conc(this->comps);
|
soln_ptr->totals = cxxISolutionComp::cxxISolutionComp2conc(P_INSTANCE_COMMA this->comps);
|
||||||
return (soln_ptr);
|
return (soln_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxISolution::ConvertUnits()
|
cxxISolution::ConvertUnits(PHREEQC_PTR_ARG)
|
||||||
//
|
//
|
||||||
// Converts from input units to moles per kilogram water
|
// Converts from input units to moles per kilogram water
|
||||||
//
|
//
|
||||||
@ -96,7 +96,7 @@ cxxISolution::ConvertUnits()
|
|||||||
this->comps.begin();
|
this->comps.begin();
|
||||||
for (; iter != this->comps.end(); ++iter)
|
for (; iter != this->comps.end(); ++iter)
|
||||||
{
|
{
|
||||||
struct master *master_ptr = master_bsearch(iter->first.c_str());
|
struct master *master_ptr = P_INSTANCE_POINTER master_bsearch(iter->first.c_str());
|
||||||
if (master_ptr != NULL && (master_ptr->minor_isotope == TRUE))
|
if (master_ptr != NULL && (master_ptr->minor_isotope == TRUE))
|
||||||
continue;
|
continue;
|
||||||
//if (iter->second.get_description() == "H(1)" || iter->second.get_description() == "E") continue;
|
//if (iter->second.get_description() == "H(1)" || iter->second.get_description() == "E") continue;
|
||||||
@ -117,7 +117,7 @@ cxxISolution::ConvertUnits()
|
|||||||
* Convert to moles
|
* Convert to moles
|
||||||
*/
|
*/
|
||||||
//set gfw for element
|
//set gfw for element
|
||||||
iter->second.set_gfw();
|
iter->second.set_gfw(P_INSTANCE);
|
||||||
// convert to moles
|
// convert to moles
|
||||||
if (iter->second.get_units().find("g/") != std::string::npos)
|
if (iter->second.get_units().find("g/") != std::string::npos)
|
||||||
{
|
{
|
||||||
@ -130,7 +130,7 @@ cxxISolution::ConvertUnits()
|
|||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Could not find gfw, " << iter->second.
|
oss << "Could not find gfw, " << iter->second.
|
||||||
get_description();
|
get_description();
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
input_error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ class cxxISolution:public cxxSolution
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
cxxISolution();
|
cxxISolution();
|
||||||
cxxISolution(struct solution *);
|
cxxISolution(PHREEQC_PTR_ARG_COMMA struct solution *);
|
||||||
//cxxISolution(const cxxISolution&);
|
//cxxISolution(const cxxISolution&);
|
||||||
~cxxISolution();
|
~cxxISolution();
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class cxxISolution:public cxxSolution
|
|||||||
|
|
||||||
//void add(cxxISolutionComp conc) { this->concs.push_back(conc); }
|
//void add(cxxISolutionComp conc) { this->concs.push_back(conc); }
|
||||||
|
|
||||||
struct solution *cxxISolution2solution();
|
struct solution *cxxISolution2solution(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
double get_density() const
|
double get_density() const
|
||||||
{
|
{
|
||||||
@ -59,7 +59,7 @@ class cxxISolution:public cxxSolution
|
|||||||
|
|
||||||
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
||||||
|
|
||||||
void ConvertUnits();
|
void ConvertUnits(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
#ifdef ORCHESTRA
|
#ifdef ORCHESTRA
|
||||||
void ORCH_write(std::ostream & chemistry_dat, std::ostream & input_dat,
|
void ORCH_write(std::ostream & chemistry_dat, std::ostream & input_dat,
|
||||||
|
|||||||
@ -59,7 +59,7 @@ cxxKineticsComp::~cxxKineticsComp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct kinetics_comp *
|
struct kinetics_comp *
|
||||||
cxxKineticsComp::cxxKineticsComp2kinetics_comp(std::map < std::string, cxxKineticsComp >
|
cxxKineticsComp::cxxKineticsComp2kinetics_comp(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxKineticsComp >
|
||||||
&el)
|
&el)
|
||||||
//
|
//
|
||||||
// Builds kinetics_comp structure from of cxxKineticsComp
|
// Builds kinetics_comp structure from of cxxKineticsComp
|
||||||
@ -69,7 +69,7 @@ struct kinetics_comp *
|
|||||||
(struct kinetics_comp *)
|
(struct kinetics_comp *)
|
||||||
PHRQ_malloc((size_t) (el.size() * sizeof(struct kinetics_comp)));
|
PHRQ_malloc((size_t) (el.size() * sizeof(struct kinetics_comp)));
|
||||||
if (kinetics_comp_ptr == NULL)
|
if (kinetics_comp_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::map < std::string, cxxKineticsComp >::iterator it = el.begin();
|
for (std::map < std::string, cxxKineticsComp >::iterator it = el.begin();
|
||||||
@ -78,8 +78,8 @@ struct kinetics_comp *
|
|||||||
if ((*it).second.rate_name.size() == 0)
|
if ((*it).second.rate_name.size() == 0)
|
||||||
kinetics_comp_ptr[i].rate_name = NULL;
|
kinetics_comp_ptr[i].rate_name = NULL;
|
||||||
else
|
else
|
||||||
kinetics_comp_ptr[i].rate_name = string_hsave((*it).second.rate_name.c_str());
|
kinetics_comp_ptr[i].rate_name = P_INSTANCE_POINTER string_hsave((*it).second.rate_name.c_str());
|
||||||
kinetics_comp_ptr[i].list = (*it).second.namecoef.name_coef();
|
kinetics_comp_ptr[i].list = (*it).second.namecoef.name_coef(P_INSTANCE);
|
||||||
kinetics_comp_ptr[i].count_list = (int) (*it).second.namecoef.size();
|
kinetics_comp_ptr[i].count_list = (int) (*it).second.namecoef.size();
|
||||||
kinetics_comp_ptr[i].tol = (*it).second.tol;
|
kinetics_comp_ptr[i].tol = (*it).second.tol;
|
||||||
kinetics_comp_ptr[i].m = (*it).second.m;
|
kinetics_comp_ptr[i].m = (*it).second.m;
|
||||||
@ -100,7 +100,7 @@ struct kinetics_comp *
|
|||||||
kinetics_comp_ptr[i].d_params = (double *)
|
kinetics_comp_ptr[i].d_params = (double *)
|
||||||
PHRQ_malloc((size_t) ((*it).second.d_params.size() * sizeof(double)));
|
PHRQ_malloc((size_t) ((*it).second.d_params.size() * sizeof(double)));
|
||||||
if (kinetics_comp_ptr[i].d_params == NULL)
|
if (kinetics_comp_ptr[i].d_params == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
std::copy((*it).second.d_params.begin(), (*it).second.d_params.end(),
|
std::copy((*it).second.d_params.begin(), (*it).second.d_params.end(),
|
||||||
kinetics_comp_ptr[i].d_params);
|
kinetics_comp_ptr[i].d_params);
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ cxxKineticsComp::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxKineticsComp::read_raw(CParser & parser, bool check)
|
cxxKineticsComp::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
double d;
|
double d;
|
||||||
@ -321,7 +321,7 @@ cxxKineticsComp::read_raw(CParser & parser, bool check)
|
|||||||
|
|
||||||
|
|
||||||
case 5: // namecoef
|
case 5: // namecoef
|
||||||
if (this->namecoef.read_raw(parser, next_char) !=
|
if (this->namecoef.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
|
|||||||
@ -17,13 +17,13 @@ public:
|
|||||||
cxxKineticsComp(struct kinetics_comp *);
|
cxxKineticsComp(struct kinetics_comp *);
|
||||||
~cxxKineticsComp();
|
~cxxKineticsComp();
|
||||||
|
|
||||||
static struct kinetics_comp *cxxKineticsComp2kinetics_comp(std::map < std::string, cxxKineticsComp > &el);
|
static struct kinetics_comp *cxxKineticsComp2kinetics_comp(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxKineticsComp > &el);
|
||||||
|
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
const std::string &get_rate_name() const
|
const std::string &get_rate_name() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -157,7 +157,7 @@ cxxNameDouble::elt_list(PHREEQC_PTR_ARG)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct master_activity *
|
struct master_activity *
|
||||||
cxxNameDouble::master_activity() const
|
cxxNameDouble::master_activity(PHREEQC_PTR_ARG) const
|
||||||
//
|
//
|
||||||
// Builds a list of master_activity structures from instance of cxxNameDouble
|
// Builds a list of master_activity structures from instance of cxxNameDouble
|
||||||
//
|
//
|
||||||
@ -180,7 +180,7 @@ cxxNameDouble::master_activity() const
|
|||||||
for (const_iterator it = (*this).begin(); it != (*this).end();
|
for (const_iterator it = (*this).begin(); it != (*this).end();
|
||||||
it++)
|
it++)
|
||||||
{
|
{
|
||||||
master_activity_ptr[i].description = string_hsave(it->first.c_str());
|
master_activity_ptr[i].description = P_INSTANCE_POINTER string_hsave(it->first.c_str());
|
||||||
master_activity_ptr[i].la = it->second;
|
master_activity_ptr[i].la = it->second;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -197,11 +197,11 @@ cxxNameDouble::master_activity() const
|
|||||||
(((*this).size()) *
|
(((*this).size()) *
|
||||||
sizeof(struct master_activity)));
|
sizeof(struct master_activity)));
|
||||||
if (master_activity_ptr == NULL)
|
if (master_activity_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
for (const_iterator it = (*this).begin(); it != (*this).end();
|
for (const_iterator it = (*this).begin(); it != (*this).end();
|
||||||
it++)
|
it++)
|
||||||
{
|
{
|
||||||
master_activity_ptr[i].description = string_hsave(it->first.c_str());
|
master_activity_ptr[i].description = P_INSTANCE_POINTER string_hsave(it->first.c_str());
|
||||||
master_activity_ptr[i].la = it->second;
|
master_activity_ptr[i].la = it->second;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ cxxNameDouble::master_activity() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct conc *
|
struct conc *
|
||||||
cxxNameDouble::conc() const
|
cxxNameDouble::conc(PHREEQC_PTR_ARG) const
|
||||||
// for Solutions, not ISolutions
|
// for Solutions, not ISolutions
|
||||||
// takes a map of (elt name, moles)
|
// takes a map of (elt name, moles)
|
||||||
// returns list of conc structures
|
// returns list of conc structures
|
||||||
@ -226,11 +226,11 @@ cxxNameDouble::conc() const
|
|||||||
c = (struct conc *)
|
c = (struct conc *)
|
||||||
PHRQ_malloc((size_t) (((*this).size() + 1) * sizeof(struct conc)));
|
PHRQ_malloc((size_t) (((*this).size() + 1) * sizeof(struct conc)));
|
||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (const_iterator it = (*this).begin(); it != (*this).end(); ++it)
|
for (const_iterator it = (*this).begin(); it != (*this).end(); ++it)
|
||||||
{
|
{
|
||||||
c[i].description = string_hsave(it->first.c_str());
|
c[i].description = P_INSTANCE_POINTER string_hsave(it->first.c_str());
|
||||||
c[i].moles = it->second;
|
c[i].moles = it->second;
|
||||||
c[i].input_conc = it->second;
|
c[i].input_conc = it->second;
|
||||||
c[i].units = NULL;
|
c[i].units = NULL;
|
||||||
@ -248,7 +248,7 @@ cxxNameDouble::conc() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct name_coef *
|
struct name_coef *
|
||||||
cxxNameDouble::name_coef() const
|
cxxNameDouble::name_coef(PHREEQC_PTR_ARG) const
|
||||||
//
|
//
|
||||||
// Builds a name_coef structure from instance of cxxNameDouble
|
// Builds a name_coef structure from instance of cxxNameDouble
|
||||||
//
|
//
|
||||||
@ -258,11 +258,11 @@ cxxNameDouble::name_coef() const
|
|||||||
(struct name_coef *)
|
(struct name_coef *)
|
||||||
PHRQ_malloc((size_t) ((this->size()) * sizeof(struct name_coef)));
|
PHRQ_malloc((size_t) ((this->size()) * sizeof(struct name_coef)));
|
||||||
if (name_coef_ptr == NULL)
|
if (name_coef_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (const_iterator it = (*this).begin(); it != (*this).end(); ++it)
|
for (const_iterator it = (*this).begin(); it != (*this).end(); ++it)
|
||||||
{
|
{
|
||||||
name_coef_ptr[i].name = string_hsave(it->first.c_str());
|
name_coef_ptr[i].name = P_INSTANCE_POINTER string_hsave(it->first.c_str());
|
||||||
name_coef_ptr[i].coef = it->second;
|
name_coef_ptr[i].coef = it->second;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ cxxNameDouble::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CParser::STATUS_TYPE cxxNameDouble::read_raw(CParser & parser,
|
CParser::STATUS_TYPE cxxNameDouble::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser,
|
||||||
std::istream::pos_type & pos)
|
std::istream::pos_type & pos)
|
||||||
{
|
{
|
||||||
std::string token;
|
std::string token;
|
||||||
@ -353,7 +353,7 @@ CParser::STATUS_TYPE cxxNameDouble::read_raw(CParser & parser,
|
|||||||
{
|
{
|
||||||
return CParser::PARSER_ERROR;
|
return CParser::PARSER_ERROR;
|
||||||
}
|
}
|
||||||
ctoken = string_hsave(token.c_str());
|
ctoken = P_INSTANCE_POINTER string_hsave(token.c_str());
|
||||||
(*this)[ctoken] = d;
|
(*this)[ctoken] = d;
|
||||||
return CParser::PARSER_OK;
|
return CParser::PARSER_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include <list> // std::list
|
#include <list> // std::list
|
||||||
#include <vector> // std::vector
|
#include <vector> // std::vector
|
||||||
#include "Phreeqc_class.h"
|
#include "Phreeqc_class.h"
|
||||||
|
class Phreeqc;
|
||||||
#include "Parser.h"
|
#include "Parser.h"
|
||||||
|
|
||||||
class cxxNameDouble:public
|
class cxxNameDouble:public
|
||||||
@ -37,13 +38,13 @@ class cxxNameDouble:public
|
|||||||
elt_list(PHREEQC_PTR_ARG);
|
elt_list(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
struct master_activity *
|
struct master_activity *
|
||||||
master_activity() const;
|
master_activity(PHREEQC_PTR_ARG) const;
|
||||||
|
|
||||||
struct conc *
|
struct conc *
|
||||||
conc() const;
|
conc(PHREEQC_PTR_ARG) const;
|
||||||
|
|
||||||
struct name_coef *
|
struct name_coef *
|
||||||
name_coef() const;
|
name_coef(PHREEQC_PTR_ARG) const;
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_xml(std::ostream & s_oss, unsigned int indent) const;
|
dump_xml(std::ostream & s_oss, unsigned int indent) const;
|
||||||
@ -52,7 +53,7 @@ class cxxNameDouble:public
|
|||||||
dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
CParser::STATUS_TYPE
|
CParser::STATUS_TYPE
|
||||||
read_raw(CParser & parser, std::istream::pos_type & pos);
|
read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, std::istream::pos_type & pos);
|
||||||
|
|
||||||
void
|
void
|
||||||
add_extensive(const cxxNameDouble & old, double factor);
|
add_extensive(const cxxNameDouble & old, double factor);
|
||||||
|
|||||||
@ -53,7 +53,7 @@ eltList(pp_assemblage_ptr->next_elt)
|
|||||||
this->ppAssemblageComps[str] = ppComp;
|
this->ppAssemblageComps[str] = ppComp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cxxPPassemblage::cxxPPassemblage(const std::map < int,
|
cxxPPassemblage::cxxPPassemblage(PHREEQC_PTR_ARG_COMMA const std::map < int,
|
||||||
cxxPPassemblage > &entities, cxxMix & mix,
|
cxxPPassemblage > &entities, cxxMix & mix,
|
||||||
int n_user):
|
int n_user):
|
||||||
cxxNumKeyword()
|
cxxNumKeyword()
|
||||||
@ -71,7 +71,7 @@ cxxNumKeyword()
|
|||||||
{
|
{
|
||||||
const cxxPPassemblage *entity_ptr =
|
const cxxPPassemblage *entity_ptr =
|
||||||
&(entities.find(it->first)->second);
|
&(entities.find(it->first)->second);
|
||||||
this->add(*entity_ptr, it->second);
|
this->add(P_INSTANCE_COMMA *entity_ptr, it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,12 +81,12 @@ cxxPPassemblage::~cxxPPassemblage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct pp_assemblage *
|
struct pp_assemblage *
|
||||||
cxxPPassemblage::cxxPPassemblage2pp_assemblage()
|
cxxPPassemblage::cxxPPassemblage2pp_assemblage(PHREEQC_PTR_ARG)
|
||||||
//
|
//
|
||||||
// Builds a pp_assemblage structure from instance of cxxPPassemblage
|
// Builds a pp_assemblage structure from instance of cxxPPassemblage
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
struct pp_assemblage *pp_assemblage_ptr = pp_assemblage_alloc();
|
struct pp_assemblage *pp_assemblage_ptr = P_INSTANCE_POINTER pp_assemblage_alloc();
|
||||||
|
|
||||||
pp_assemblage_ptr->description = this->get_description();
|
pp_assemblage_ptr->description = this->get_description();
|
||||||
pp_assemblage_ptr->n_user = this->n_user;
|
pp_assemblage_ptr->n_user = this->n_user;
|
||||||
@ -94,10 +94,10 @@ cxxPPassemblage::cxxPPassemblage2pp_assemblage()
|
|||||||
pp_assemblage_ptr->new_def = FALSE;
|
pp_assemblage_ptr->new_def = FALSE;
|
||||||
pp_assemblage_ptr->count_comps = (int) this->ppAssemblageComps.size();
|
pp_assemblage_ptr->count_comps = (int) this->ppAssemblageComps.size();
|
||||||
pp_assemblage_ptr->pure_phases =
|
pp_assemblage_ptr->pure_phases =
|
||||||
(struct pure_phase *) free_check_null(pp_assemblage_ptr->pure_phases);
|
(struct pure_phase *) P_INSTANCE_POINTER free_check_null(pp_assemblage_ptr->pure_phases);
|
||||||
pp_assemblage_ptr->pure_phases =
|
pp_assemblage_ptr->pure_phases =
|
||||||
cxxPPassemblageComp::cxxPPassemblageComp2pure_phase(this->ppAssemblageComps);
|
cxxPPassemblageComp::cxxPPassemblageComp2pure_phase(P_INSTANCE_COMMA this->ppAssemblageComps);
|
||||||
pp_assemblage_ptr->next_elt = this->eltList.elt_list();
|
pp_assemblage_ptr->next_elt = this->eltList.elt_list(P_INSTANCE);
|
||||||
return (pp_assemblage_ptr);
|
return (pp_assemblage_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ cxxPPassemblage::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxPPassemblage::read_raw(CParser & parser, bool check)
|
cxxPPassemblage::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
static std::vector < std::string > vopts;
|
static std::vector < std::string > vopts;
|
||||||
if (vopts.empty())
|
if (vopts.empty())
|
||||||
@ -221,7 +221,7 @@ cxxPPassemblage::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0: // eltList
|
case 0: // eltList
|
||||||
if (this->eltList.read_raw(parser, next_char) !=
|
if (this->eltList.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -340,21 +340,21 @@ cxxPPassemblage::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxPPassemblage::totalize()
|
cxxPPassemblage::totalize(PHREEQC_PTR_ARG)
|
||||||
{
|
{
|
||||||
this->totals.clear();
|
this->totals.clear();
|
||||||
// component structures
|
// component structures
|
||||||
for (std::map < std::string, cxxPPassemblageComp >::iterator it =
|
for (std::map < std::string, cxxPPassemblageComp >::iterator it =
|
||||||
ppAssemblageComps.begin(); it != ppAssemblageComps.end(); ++it)
|
ppAssemblageComps.begin(); it != ppAssemblageComps.end(); ++it)
|
||||||
{
|
{
|
||||||
(*it).second.totalize();
|
(*it).second.totalize(P_INSTANCE);
|
||||||
this->totals.add_extensive((*it).second.get_totals(), 1.0);
|
this->totals.add_extensive((*it).second.get_totals(), 1.0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxPPassemblage::add(const cxxPPassemblage & addee, double extensive)
|
cxxPPassemblage::add(PHREEQC_PTR_ARG_COMMA const cxxPPassemblage & addee, double extensive)
|
||||||
//
|
//
|
||||||
// Add to existing ppassemblage to "this" ppassemblage
|
// Add to existing ppassemblage to "this" ppassemblage
|
||||||
//
|
//
|
||||||
@ -372,7 +372,7 @@ cxxPPassemblage::add(const cxxPPassemblage & addee, double extensive)
|
|||||||
{
|
{
|
||||||
if ((*it).second.get_name() == itadd->second.get_name())
|
if ((*it).second.get_name() == itadd->second.get_name())
|
||||||
{
|
{
|
||||||
(*it).second.add((*itadd).second, extensive);
|
(*it).second.add(P_INSTANCE_COMMA (*itadd).second, extensive);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,17 +17,17 @@ class cxxPPassemblage:public cxxNumKeyword
|
|||||||
public:
|
public:
|
||||||
cxxPPassemblage();
|
cxxPPassemblage();
|
||||||
cxxPPassemblage(struct pp_assemblage *);
|
cxxPPassemblage(struct pp_assemblage *);
|
||||||
cxxPPassemblage(const std::map < int, cxxPPassemblage > &entity_map,
|
cxxPPassemblage(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxPPassemblage > &entity_map,
|
||||||
cxxMix & mx, int n_user);
|
cxxMix & mx, int n_user);
|
||||||
~cxxPPassemblage();
|
~cxxPPassemblage();
|
||||||
|
|
||||||
struct pp_assemblage *cxxPPassemblage2pp_assemblage();
|
struct pp_assemblage *cxxPPassemblage2pp_assemblage(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
struct pure_phase *cxxPPassemblageComp2pure_phase();
|
struct pure_phase *cxxPPassemblageComp2pure_phase();
|
||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
const cxxNameDouble & get_totals() const
|
const cxxNameDouble & get_totals() const
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ class cxxPPassemblage:public cxxNumKeyword
|
|||||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void totalize();
|
void totalize(PHREEQC_PTR_ARG);
|
||||||
#ifdef ORCHESTRA
|
#ifdef ORCHESTRA
|
||||||
void ORCH_write_chemistry(std::ostream & chemistry_dat);
|
void ORCH_write_chemistry(std::ostream & chemistry_dat);
|
||||||
void ORCH_write_output_vars(std::ostream & outstream);
|
void ORCH_write_output_vars(std::ostream & outstream);
|
||||||
@ -51,7 +51,7 @@ class cxxPPassemblage:public cxxNumKeyword
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void add(const cxxPPassemblage & addee, double extensive);
|
void add(PHREEQC_PTR_ARG_COMMA const cxxPPassemblage & addee, double extensive);
|
||||||
// not written
|
// not written
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|
||||||
|
|||||||
@ -60,14 +60,14 @@ cxxPPassemblageComp::~cxxPPassemblageComp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct phase *
|
struct phase *
|
||||||
cxxPPassemblageComp::get_phase()
|
cxxPPassemblageComp::get_phase(PHREEQC_PTR_ARG)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
return phase_bsearch(this->name.c_str(), &i, FALSE);
|
return P_INSTANCE_POINTER phase_bsearch(this->name.c_str(), &i, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pure_phase *
|
struct pure_phase *
|
||||||
cxxPPassemblageComp::cxxPPassemblageComp2pure_phase(std::map < std::string, cxxPPassemblageComp > &el)
|
cxxPPassemblageComp::cxxPPassemblageComp2pure_phase(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxPPassemblageComp > &el)
|
||||||
//
|
//
|
||||||
// Builds pure_phase structure from of cxxPPassemblageComp
|
// Builds pure_phase structure from of cxxPPassemblageComp
|
||||||
//
|
//
|
||||||
@ -76,21 +76,21 @@ struct pure_phase *
|
|||||||
(struct pure_phase *)
|
(struct pure_phase *)
|
||||||
PHRQ_malloc((size_t) (el.size() * sizeof(struct pure_phase)));
|
PHRQ_malloc((size_t) (el.size() * sizeof(struct pure_phase)));
|
||||||
if (pure_phase_ptr == NULL)
|
if (pure_phase_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::map < std::string, cxxPPassemblageComp >::iterator it = el.begin();
|
for (std::map < std::string, cxxPPassemblageComp >::iterator it = el.begin();
|
||||||
it != el.end(); ++it)
|
it != el.end(); ++it)
|
||||||
{
|
{
|
||||||
pure_phase_ptr[i].phase = (*it).second.get_phase();
|
pure_phase_ptr[i].phase = (*it).second.get_phase(P_INSTANCE);
|
||||||
if ((*it).second.name.size() == 0)
|
if ((*it).second.name.size() == 0)
|
||||||
pure_phase_ptr[i].name = NULL;
|
pure_phase_ptr[i].name = NULL;
|
||||||
else
|
else
|
||||||
pure_phase_ptr[i].name = string_hsave((*it).second.name.c_str());
|
pure_phase_ptr[i].name = P_INSTANCE_POINTER string_hsave((*it).second.name.c_str());
|
||||||
if ((*it).second.add_formula.size() == 0)
|
if ((*it).second.add_formula.size() == 0)
|
||||||
pure_phase_ptr[i].add_formula = NULL;
|
pure_phase_ptr[i].add_formula = NULL;
|
||||||
else
|
else
|
||||||
pure_phase_ptr[i].add_formula = string_hsave((*it).second.add_formula.c_str());
|
pure_phase_ptr[i].add_formula = P_INSTANCE_POINTER string_hsave((*it).second.add_formula.c_str());
|
||||||
pure_phase_ptr[i].si = (*it).second.si;
|
pure_phase_ptr[i].si = (*it).second.si;
|
||||||
pure_phase_ptr[i].moles = (*it).second.moles;
|
pure_phase_ptr[i].moles = (*it).second.moles;
|
||||||
pure_phase_ptr[i].delta = (*it).second.delta;
|
pure_phase_ptr[i].delta = (*it).second.delta;
|
||||||
@ -437,7 +437,7 @@ cxxPPassemblageComp::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxPPassemblageComp::totalize()
|
cxxPPassemblageComp::totalize(PHREEQC_PTR_ARG)
|
||||||
{
|
{
|
||||||
this->totals.clear();
|
this->totals.clear();
|
||||||
// component structures
|
// component structures
|
||||||
@ -445,7 +445,7 @@ cxxPPassemblageComp::totalize()
|
|||||||
return;
|
return;
|
||||||
struct phase *phase_ptr;
|
struct phase *phase_ptr;
|
||||||
int l;
|
int l;
|
||||||
phase_ptr = phase_bsearch(this->name.c_str(), &l, FALSE);
|
phase_ptr = P_INSTANCE_POINTER phase_bsearch(this->name.c_str(), &l, FALSE);
|
||||||
if (phase_ptr != NULL)
|
if (phase_ptr != NULL)
|
||||||
{
|
{
|
||||||
cxxNameDouble phase_formula(phase_ptr->next_elt);
|
cxxNameDouble phase_formula(phase_ptr->next_elt);
|
||||||
@ -460,7 +460,7 @@ cxxPPassemblageComp::totalize()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxPPassemblageComp::add(const cxxPPassemblageComp & addee, double extensive)
|
cxxPPassemblageComp::add(PHREEQC_PTR_ARG_COMMA const cxxPPassemblageComp & addee, double extensive)
|
||||||
{
|
{
|
||||||
double ext1, ext2, f1, f2;
|
double ext1, ext2, f1, f2;
|
||||||
if (extensive == 0.0)
|
if (extensive == 0.0)
|
||||||
@ -496,7 +496,7 @@ cxxPPassemblageComp::add(const cxxPPassemblageComp & addee, double extensive)
|
|||||||
oss <<
|
oss <<
|
||||||
"Can not mix two Equilibrium_phases with differing add_formulae., "
|
"Can not mix two Equilibrium_phases with differing add_formulae., "
|
||||||
<< this->name;
|
<< this->name;
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
input_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class cxxPPassemblageComp
|
|||||||
~cxxPPassemblageComp();
|
~cxxPPassemblageComp();
|
||||||
|
|
||||||
|
|
||||||
static struct pure_phase *cxxPPassemblageComp2pure_phase(std::map < std::string, cxxPPassemblageComp > &el);
|
static struct pure_phase *cxxPPassemblageComp2pure_phase(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxPPassemblageComp > &el);
|
||||||
|
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|
||||||
@ -48,15 +48,15 @@ class cxxPPassemblageComp
|
|||||||
else
|
else
|
||||||
this->add_formula.clear();
|
this->add_formula.clear();
|
||||||
}
|
}
|
||||||
struct phase *get_phase();
|
struct phase *get_phase(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
void totalize();
|
void totalize(PHREEQC_PTR_ARG);
|
||||||
const cxxNameDouble & get_totals() const
|
const cxxNameDouble & get_totals() const
|
||||||
{
|
{
|
||||||
return (this->totals);
|
return (this->totals);
|
||||||
};
|
};
|
||||||
|
|
||||||
void add(const cxxPPassemblageComp & comp, double extensive);
|
void add(PHREEQC_PTR_ARG_COMMA const cxxPPassemblageComp & comp, double extensive);
|
||||||
void multiply(double extensive);
|
void multiply(double extensive);
|
||||||
|
|
||||||
#ifdef USE_MPI
|
#ifdef USE_MPI
|
||||||
|
|||||||
85
Phreeqc.h
85
Phreeqc.h
@ -870,6 +870,7 @@ int dump_reaction(int k);
|
|||||||
int dump_s_s_assemblage(int k);
|
int dump_s_s_assemblage(int k);
|
||||||
int dump_solution(int k);
|
int dump_solution(int k);
|
||||||
int dump_surface(int k);
|
int dump_surface(int k);
|
||||||
|
int dump_cpp(void);
|
||||||
|
|
||||||
int read_line_LDBLEs(char *next_char, LDBLE ** d, int *count_d,
|
int read_line_LDBLEs(char *next_char, LDBLE ** d, int *count_d,
|
||||||
int *count_alloc);
|
int *count_alloc);
|
||||||
@ -948,42 +949,56 @@ int copier_add(struct copier *copier_ptr, int n_user, int start, int end);
|
|||||||
int copier_free(struct copier *copier_ptr);
|
int copier_free(struct copier *copier_ptr);
|
||||||
int copier_init(struct copier *copier_ptr);
|
int copier_init(struct copier *copier_ptr);
|
||||||
CLASS_STATIC int element_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int element_compare(const void *ptr1, const void *ptr2);
|
||||||
struct element *element_store(const char *element);
|
public:
|
||||||
int elt_list_combine(void);
|
struct element *element_store(const char *element);
|
||||||
CLASS_STATIC int elt_list_compare(const void *ptr1, const void *ptr2);
|
int elt_list_combine(void);
|
||||||
|
CLASS_STATIC int elt_list_compare(const void *ptr1, const void *ptr2);
|
||||||
|
private:
|
||||||
struct elt_list *elt_list_dup(struct elt_list *elt_list_ptr_old);
|
struct elt_list *elt_list_dup(struct elt_list *elt_list_ptr_old);
|
||||||
int elt_list_print(struct elt_list *elt_list_ptr);
|
int elt_list_print(struct elt_list *elt_list_ptr);
|
||||||
struct elt_list *elt_list_save(void);
|
struct elt_list *elt_list_save(void);
|
||||||
struct exchange *exchange_alloc(void);
|
public:
|
||||||
struct exchange *exchange_bsearch(int k, int *n);
|
struct exchange *exchange_alloc(void);
|
||||||
|
struct exchange *exchange_bsearch(int k, int *n);
|
||||||
|
private:
|
||||||
int exchange_comp_compare(const void *ptr1, const void *ptr2);
|
int exchange_comp_compare(const void *ptr1, const void *ptr2);
|
||||||
void exchange_comp_init(struct exch_comp *exch_comp_ptr);
|
void exchange_comp_init(struct exch_comp *exch_comp_ptr);
|
||||||
int exchange_copy(struct exchange *exchange_old_ptr,
|
public:
|
||||||
struct exchange *exchange_new_ptr, int n_user_new);
|
int exchange_copy(struct exchange *exchange_old_ptr,
|
||||||
|
struct exchange *exchange_new_ptr, int n_user_new);
|
||||||
|
private:
|
||||||
CLASS_STATIC int exchange_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int exchange_compare(const void *ptr1, const void *ptr2);
|
||||||
int exchange_copy_to_last(int n, int n_user);
|
int exchange_copy_to_last(int n, int n_user);
|
||||||
int exchange_delete(int n_user_old);
|
int exchange_delete(int n_user_old);
|
||||||
int exchange_duplicate(int n_user_old, int n_user_new);
|
int exchange_duplicate(int n_user_old, int n_user_new);
|
||||||
int exchange_init(struct exchange *exchange_ptr, int n_user, int n_user_end,
|
int exchange_init(struct exchange *exchange_ptr, int n_user, int n_user_end,
|
||||||
const char *description);
|
const char *description);
|
||||||
int exchange_free(struct exchange *exchange_ptr);
|
public:
|
||||||
|
int exchange_free(struct exchange *exchange_ptr);
|
||||||
|
private:
|
||||||
int exchange_ptr_to_user(struct exchange *exchange_old_ptr, int n_user_new);
|
int exchange_ptr_to_user(struct exchange *exchange_old_ptr, int n_user_new);
|
||||||
struct exchange *exchange_replicate(struct exchange *exchange_old_ptr,
|
struct exchange *exchange_replicate(struct exchange *exchange_old_ptr,
|
||||||
int n_user_new);
|
int n_user_new);
|
||||||
struct exchange *exchange_search(int n_user, int *n, int print);
|
struct exchange *exchange_search(int n_user, int *n, int print);
|
||||||
int exchange_sort(void);
|
int exchange_sort(void);
|
||||||
CLASS_STATIC int gas_comp_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int gas_comp_compare(const void *ptr1, const void *ptr2);
|
||||||
struct gas_phase *gas_phase_alloc(void);
|
public:
|
||||||
struct gas_phase *gas_phase_bsearch(int k, int *n);
|
struct gas_phase *gas_phase_alloc(void);
|
||||||
|
struct gas_phase *gas_phase_bsearch(int k, int *n);
|
||||||
|
private:
|
||||||
CLASS_STATIC int gas_phase_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int gas_phase_compare(const void *ptr1, const void *ptr2);
|
||||||
|
public:
|
||||||
int gas_phase_copy(struct gas_phase *gas_phase_old_ptr,
|
int gas_phase_copy(struct gas_phase *gas_phase_old_ptr,
|
||||||
struct gas_phase *gas_phase_new_ptr, int n_user_new);
|
struct gas_phase *gas_phase_new_ptr, int n_user_new);
|
||||||
|
private:
|
||||||
int gas_phase_copy_to_last(int n, int n_user);
|
int gas_phase_copy_to_last(int n, int n_user);
|
||||||
int gas_phase_delete(int n_user_old);
|
int gas_phase_delete(int n_user_old);
|
||||||
int gas_phase_duplicate(int n_user_old, int n_user_new);
|
int gas_phase_duplicate(int n_user_old, int n_user_new);
|
||||||
int gas_phase_init(struct gas_phase *gas_phase_ptr, int n_user,
|
int gas_phase_init(struct gas_phase *gas_phase_ptr, int n_user,
|
||||||
int n_user_end, char *description);
|
int n_user_end, char *description);
|
||||||
|
public:
|
||||||
int gas_phase_free(struct gas_phase *gas_phase_ptr);
|
int gas_phase_free(struct gas_phase *gas_phase_ptr);
|
||||||
|
private:
|
||||||
int gas_phase_ptr_to_user(struct gas_phase *gas_phase_ptr_old,
|
int gas_phase_ptr_to_user(struct gas_phase *gas_phase_ptr_old,
|
||||||
int n_user_new);
|
int n_user_new);
|
||||||
struct gas_phase *gas_phase_replicate(struct gas_phase *gas_phase_old_ptr,
|
struct gas_phase *gas_phase_replicate(struct gas_phase *gas_phase_old_ptr,
|
||||||
@ -1004,19 +1019,25 @@ int irrev_duplicate(int n_user_old, int n_user_new);
|
|||||||
int irrev_free(struct irrev *irrev_ptr);
|
int irrev_free(struct irrev *irrev_ptr);
|
||||||
struct irrev *irrev_search(int n_user, int *n);
|
struct irrev *irrev_search(int n_user, int *n);
|
||||||
int irrev_sort(void);
|
int irrev_sort(void);
|
||||||
struct kinetics *kinetics_alloc(void);
|
public:
|
||||||
struct kinetics *kinetics_bsearch(int k, int *n);
|
struct kinetics *kinetics_alloc(void);
|
||||||
|
struct kinetics *kinetics_bsearch(int k, int *n);
|
||||||
|
private:
|
||||||
int kinetics_delete(int n_user_old);
|
int kinetics_delete(int n_user_old);
|
||||||
int kinetics_comp_duplicate(struct kinetics_comp *kinetics_comp_new_ptr,
|
int kinetics_comp_duplicate(struct kinetics_comp *kinetics_comp_new_ptr,
|
||||||
struct kinetics_comp *kinetics_comp_old_ptr);
|
struct kinetics_comp *kinetics_comp_old_ptr);
|
||||||
CLASS_STATIC int kinetics_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int kinetics_compare(const void *ptr1, const void *ptr2);
|
||||||
|
public:
|
||||||
int kinetics_copy(struct kinetics *kinetics_old_ptr,
|
int kinetics_copy(struct kinetics *kinetics_old_ptr,
|
||||||
struct kinetics *kinetics_new_ptr, int n_user_new);
|
struct kinetics *kinetics_new_ptr, int n_user_new);
|
||||||
|
private:
|
||||||
int kinetics_copy_to_last(int n, int n_user);
|
int kinetics_copy_to_last(int n, int n_user);
|
||||||
int kinetics_duplicate(int n_user_old, int n_user_new);
|
int kinetics_duplicate(int n_user_old, int n_user_new);
|
||||||
int kinetics_init(struct kinetics *kinetics_ptr, int n_user, int n_user_end,
|
int kinetics_init(struct kinetics *kinetics_ptr, int n_user, int n_user_end,
|
||||||
char *description);
|
char *description);
|
||||||
|
public:
|
||||||
int kinetics_free(struct kinetics *kinetics_ptr);
|
int kinetics_free(struct kinetics *kinetics_ptr);
|
||||||
|
private:
|
||||||
int kinetics_ptr_to_user(struct kinetics *kinetics_ptr_old, int n_user_new);
|
int kinetics_ptr_to_user(struct kinetics *kinetics_ptr_old, int n_user_new);
|
||||||
struct kinetics *kinetics_replicate(struct kinetics *kinetics_old_ptr,
|
struct kinetics *kinetics_replicate(struct kinetics *kinetics_old_ptr,
|
||||||
int n_user_new);
|
int n_user_new);
|
||||||
@ -1043,8 +1064,10 @@ int mix_free(struct mix *mix_ptr);
|
|||||||
struct mix *mix_search(int n_user, int *n, int print);
|
struct mix *mix_search(int n_user, int *n, int print);
|
||||||
int mix_sort(void);
|
int mix_sort(void);
|
||||||
struct pe_data *pe_data_alloc(void);
|
struct pe_data *pe_data_alloc(void);
|
||||||
struct pe_data *pe_data_dup(struct pe_data *pe_ptr_old);
|
public:
|
||||||
struct pe_data *pe_data_free(struct pe_data *pe_data_ptr);
|
struct pe_data *pe_data_dup(struct pe_data *pe_ptr_old);
|
||||||
|
struct pe_data *pe_data_free(struct pe_data *pe_data_ptr);
|
||||||
|
private:
|
||||||
int pe_data_store(struct pe_data **pe, const char *token);
|
int pe_data_store(struct pe_data **pe, const char *token);
|
||||||
public:
|
public:
|
||||||
struct phase *phase_bsearch(const char *ptr, int *j, int print);
|
struct phase *phase_bsearch(const char *ptr, int *j, int print);
|
||||||
@ -1052,16 +1075,22 @@ private:
|
|||||||
CLASS_STATIC int phase_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int phase_compare(const void *ptr1, const void *ptr2);
|
||||||
int phase_delete(int i);
|
int phase_delete(int i);
|
||||||
struct phase *phase_store(char *name);
|
struct phase *phase_store(char *name);
|
||||||
|
public:
|
||||||
struct pp_assemblage *pp_assemblage_alloc(void);
|
struct pp_assemblage *pp_assemblage_alloc(void);
|
||||||
struct pp_assemblage *pp_assemblage_bsearch(int k, int *n);
|
struct pp_assemblage *pp_assemblage_bsearch(int k, int *n);
|
||||||
|
private:
|
||||||
CLASS_STATIC int pp_assemblage_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int pp_assemblage_compare(const void *ptr1, const void *ptr2);
|
||||||
|
public:
|
||||||
int pp_assemblage_copy(struct pp_assemblage *pp_assemblage_old_ptr,
|
int pp_assemblage_copy(struct pp_assemblage *pp_assemblage_old_ptr,
|
||||||
struct pp_assemblage *pp_assemblage_new_ptr,
|
struct pp_assemblage *pp_assemblage_new_ptr,
|
||||||
int n_user_new);
|
int n_user_new);
|
||||||
|
private:
|
||||||
int pp_assemblage_copy_to_last(int n, int n_user);
|
int pp_assemblage_copy_to_last(int n, int n_user);
|
||||||
int pp_assemblage_delete(int n_user_old);
|
int pp_assemblage_delete(int n_user_old);
|
||||||
int pp_assemblage_duplicate(int n_user_old, int n_user_new);
|
int pp_assemblage_duplicate(int n_user_old, int n_user_new);
|
||||||
|
public:
|
||||||
int pp_assemblage_free(struct pp_assemblage *pp_assemblage_ptr);
|
int pp_assemblage_free(struct pp_assemblage *pp_assemblage_ptr);
|
||||||
|
private:
|
||||||
int pp_assemblage_init(struct pp_assemblage *pp_assemblage_ptr, int n_user,
|
int pp_assemblage_init(struct pp_assemblage *pp_assemblage_ptr, int n_user,
|
||||||
int n_user_end, char *description);
|
int n_user_end, char *description);
|
||||||
int pp_assemblage_ptr_to_user(struct pp_assemblage *pp_assemblage_ptr_old,
|
int pp_assemblage_ptr_to_user(struct pp_assemblage *pp_assemblage_ptr_old,
|
||||||
@ -1087,17 +1116,20 @@ struct species *s_search(const char *name);
|
|||||||
struct species *s_store(char *name, LDBLE z, int replace_if_found);
|
struct species *s_store(char *name, LDBLE z, int replace_if_found);
|
||||||
public:
|
public:
|
||||||
struct s_s_assemblage *s_s_assemblage_alloc(void);
|
struct s_s_assemblage *s_s_assemblage_alloc(void);
|
||||||
|
struct s_s_assemblage *s_s_assemblage_bsearch(int k, int *n);
|
||||||
private:
|
private:
|
||||||
struct s_s_assemblage *s_s_assemblage_bsearch(int k, int *n);
|
|
||||||
CLASS_STATIC int s_s_assemblage_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int s_s_assemblage_compare(const void *ptr1, const void *ptr2);
|
||||||
|
public:
|
||||||
int s_s_assemblage_copy(struct s_s_assemblage *s_s_assemblage_old_ptr,
|
int s_s_assemblage_copy(struct s_s_assemblage *s_s_assemblage_old_ptr,
|
||||||
struct s_s_assemblage *s_s_assemblage_new_ptr,
|
struct s_s_assemblage *s_s_assemblage_new_ptr,
|
||||||
int n_user_new);
|
int n_user_new);
|
||||||
|
private:
|
||||||
int s_s_assemblage_copy_to_last(int n, int n_user);
|
int s_s_assemblage_copy_to_last(int n, int n_user);
|
||||||
int s_s_assemblage_duplicate(int n_user_old, int n_user_new);
|
int s_s_assemblage_duplicate(int n_user_old, int n_user_new);
|
||||||
int s_s_assemblage_delete(int n_user_old);
|
int s_s_assemblage_delete(int n_user_old);
|
||||||
int s_s_assemblage_free(struct s_s_assemblage *s_s_assemblage_ptr);
|
public:
|
||||||
|
int s_s_assemblage_free(struct s_s_assemblage *s_s_assemblage_ptr);
|
||||||
|
private:
|
||||||
int s_s_assemblage_init(struct s_s_assemblage *s_s_assemblage_ptr,
|
int s_s_assemblage_init(struct s_s_assemblage *s_s_assemblage_ptr,
|
||||||
int n_user, int n_user_end, char *description);
|
int n_user, int n_user_end, char *description);
|
||||||
int s_s_assemblage_ptr_to_user(struct s_s_assemblage *s_s_assemblage_ptr_old,
|
int s_s_assemblage_ptr_to_user(struct s_s_assemblage *s_s_assemblage_ptr_old,
|
||||||
@ -1117,9 +1149,9 @@ int conc_init(struct conc *conc_ptr);
|
|||||||
CLASS_STATIC int isotope_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int isotope_compare(const void *ptr1, const void *ptr2);
|
||||||
public:
|
public:
|
||||||
struct solution *solution_alloc(void);
|
struct solution *solution_alloc(void);
|
||||||
|
struct solution *solution_bsearch(int k, int *n, int print);
|
||||||
private:
|
private:
|
||||||
struct solution *solution_bsearch(int k, int *n, int print);
|
struct solution *solution_copy(struct solution *solution_old_ptr,
|
||||||
struct solution *solution_copy(struct solution *solution_old_ptr,
|
|
||||||
int n_user_new);
|
int n_user_new);
|
||||||
int solution_copy_to_last(int n, int n_user_new);
|
int solution_copy_to_last(int n, int n_user_new);
|
||||||
int solution_duplicate(int n_user_old, int n_user_new);
|
int solution_duplicate(int n_user_old, int n_user_new);
|
||||||
@ -1136,20 +1168,24 @@ int species_list_sort(void);
|
|||||||
struct Change_Surf *change_surf_alloc(int count);
|
struct Change_Surf *change_surf_alloc(int count);
|
||||||
public:
|
public:
|
||||||
struct surface *surface_alloc(void);
|
struct surface *surface_alloc(void);
|
||||||
|
struct surface *surface_bsearch(int k, int *n);
|
||||||
private:
|
private:
|
||||||
struct surface *surface_bsearch(int k, int *n);
|
|
||||||
struct master *surface_get_psi_master(const char *name, int plane);
|
struct master *surface_get_psi_master(const char *name, int plane);
|
||||||
CLASS_STATIC int surface_comp_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int surface_comp_compare(const void *ptr1, const void *ptr2);
|
||||||
CLASS_STATIC int surface_charge_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int surface_charge_compare(const void *ptr1, const void *ptr2);
|
||||||
struct surface_charge * surface_charge_duplicate(struct surface_charge *charge_old_ptr);
|
struct surface_charge * surface_charge_duplicate(struct surface_charge *charge_old_ptr);
|
||||||
int surface_charge_free(struct surface_charge *charge);
|
int surface_charge_free(struct surface_charge *charge);
|
||||||
CLASS_STATIC int surface_compare(const void *ptr1, const void *ptr2);
|
CLASS_STATIC int surface_compare(const void *ptr1, const void *ptr2);
|
||||||
int surface_copy(struct surface *surface_old_ptr,
|
public:
|
||||||
|
int surface_copy(struct surface *surface_old_ptr,
|
||||||
struct surface *surface_new_ptr, int n_user_new);
|
struct surface *surface_new_ptr, int n_user_new);
|
||||||
|
private:
|
||||||
int surface_copy_to_last(int n, int n_user);
|
int surface_copy_to_last(int n, int n_user);
|
||||||
int surface_delete(int n_user_old);
|
int surface_delete(int n_user_old);
|
||||||
int surface_duplicate(int n_user_old, int n_user_new);
|
int surface_duplicate(int n_user_old, int n_user_new);
|
||||||
int surface_free(struct surface *surface_ptr);
|
public:
|
||||||
|
int surface_free(struct surface *surface_ptr);
|
||||||
|
private:
|
||||||
int surface_init(struct surface *surface_ptr, int n_user, int n_user_end,
|
int surface_init(struct surface *surface_ptr, int n_user, int n_user_end,
|
||||||
char *description);
|
char *description);
|
||||||
int surface_ptr_to_user(struct surface *surface_ptr_old, int n_user_new);
|
int surface_ptr_to_user(struct surface *surface_ptr_old, int n_user_new);
|
||||||
@ -1315,8 +1351,9 @@ int mix_stag(int i, LDBLE stagkin_time, int punch,
|
|||||||
|
|
||||||
|
|
||||||
// utilities.c -------------------------------
|
// utilities.c -------------------------------
|
||||||
|
public:
|
||||||
int add_elt_list(struct elt_list *elt_list_ptr, LDBLE coef);
|
int add_elt_list(struct elt_list *elt_list_ptr, LDBLE coef);
|
||||||
|
private:
|
||||||
int backspace_screen(int spaces);
|
int backspace_screen(int spaces);
|
||||||
LDBLE calc_alk(struct reaction *rxn_ptr);
|
LDBLE calc_alk(struct reaction *rxn_ptr);
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -91,7 +91,7 @@ cxxReaction::cxxReaction2irrev(PHREEQC_PTR_ARG)
|
|||||||
irrev_ptr->n_user = this->n_user;
|
irrev_ptr->n_user = this->n_user;
|
||||||
irrev_ptr->n_user_end = this->n_user_end;
|
irrev_ptr->n_user_end = this->n_user_end;
|
||||||
|
|
||||||
irrev_ptr->list = this->reactantList.name_coef();
|
irrev_ptr->list = this->reactantList.name_coef(P_INSTANCE);
|
||||||
irrev_ptr->count_list = (int) this->reactantList.size();
|
irrev_ptr->count_list = (int) this->reactantList.size();
|
||||||
if (this->elementList.size() > 0)
|
if (this->elementList.size() > 0)
|
||||||
{
|
{
|
||||||
@ -223,7 +223,7 @@ cxxReaction::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxReaction::read_raw(CParser & parser)
|
cxxReaction::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||||
{
|
{
|
||||||
|
|
||||||
int j;
|
int j;
|
||||||
@ -296,7 +296,7 @@ cxxReaction::read_raw(CParser & parser)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // reactant_list
|
case 1: // reactant_list
|
||||||
if (this->reactantList.read_raw(parser, next_char) !=
|
if (this->reactantList.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -308,7 +308,7 @@ cxxReaction::read_raw(CParser & parser)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // element_list
|
case 2: // element_list
|
||||||
if (this->elementList.read_raw(parser, next_char) !=
|
if (this->elementList.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class cxxReaction:public cxxNumKeyword
|
|||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser);
|
||||||
|
|
||||||
void set_units(const char * s)
|
void set_units(const char * s)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#else
|
#else
|
||||||
#include "Phreeqc.h"
|
#include "Phreeqc.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "Phreeqc_class.h"
|
||||||
#include "Parser.h"
|
#include "Parser.h"
|
||||||
#include "Solution.h"
|
#include "Solution.h"
|
||||||
#include "Exchange.h"
|
#include "Exchange.h"
|
||||||
@ -102,8 +103,8 @@ read_solution_raw(void)
|
|||||||
|
|
||||||
|
|
||||||
cxxSolution sol;
|
cxxSolution sol;
|
||||||
sol.read_raw(parser);
|
sol.read_raw(PHREEQC_THIS_COMMA parser);
|
||||||
struct solution *soln_ptr = sol.cxxSolution2solution();
|
struct solution *soln_ptr = sol.cxxSolution2solution(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -194,8 +195,8 @@ read_exchange_raw(void)
|
|||||||
parser.get_option(vopts, next_char);
|
parser.get_option(vopts, next_char);
|
||||||
|
|
||||||
cxxExchange ex;
|
cxxExchange ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||||
struct exchange *exchange_ptr = ex.cxxExchange2exchange();
|
struct exchange *exchange_ptr = ex.cxxExchange2exchange(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -288,8 +289,8 @@ read_surface_raw(void)
|
|||||||
parser.get_option(vopts, next_char);
|
parser.get_option(vopts, next_char);
|
||||||
|
|
||||||
cxxSurface ex;
|
cxxSurface ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||||
struct surface *surface_ptr = ex.cxxSurface2surface();
|
struct surface *surface_ptr = ex.cxxSurface2surface(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -383,8 +384,8 @@ read_equilibrium_phases_raw(void)
|
|||||||
parser.get_option(vopts, next_char);
|
parser.get_option(vopts, next_char);
|
||||||
|
|
||||||
cxxPPassemblage ex;
|
cxxPPassemblage ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||||
struct pp_assemblage *pp_assemblage_ptr = ex.cxxPPassemblage2pp_assemblage();
|
struct pp_assemblage *pp_assemblage_ptr = ex.cxxPPassemblage2pp_assemblage(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -479,8 +480,8 @@ read_kinetics_raw(void)
|
|||||||
parser.get_option(vopts, next_char);
|
parser.get_option(vopts, next_char);
|
||||||
|
|
||||||
cxxKinetics ex;
|
cxxKinetics ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||||
struct kinetics *kinetics_ptr = ex.cxxKinetics2kinetics();
|
struct kinetics *kinetics_ptr = ex.cxxKinetics2kinetics(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -574,9 +575,8 @@ read_solid_solutions_raw(void)
|
|||||||
parser.get_option(vopts, next_char);
|
parser.get_option(vopts, next_char);
|
||||||
|
|
||||||
cxxSSassemblage ex;
|
cxxSSassemblage ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||||
struct s_s_assemblage *s_s_assemblage_ptr =
|
struct s_s_assemblage *s_s_assemblage_ptr = ex.cxxSSassemblage2s_s_assemblage(PHREEQC_THIS);
|
||||||
ex.cxxSSassemblage2s_s_assemblage();
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -672,8 +672,8 @@ read_gas_phase_raw(void)
|
|||||||
parser.get_option(vopts, next_char);
|
parser.get_option(vopts, next_char);
|
||||||
|
|
||||||
cxxGasPhase ex;
|
cxxGasPhase ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||||
struct gas_phase *gas_phase_ptr = ex.cxxGasPhase2gas_phase();
|
struct gas_phase *gas_phase_ptr = ex.cxxGasPhase2gas_phase(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -766,8 +766,8 @@ read_reaction_raw(void)
|
|||||||
parser.get_option(vopts, next_char);
|
parser.get_option(vopts, next_char);
|
||||||
|
|
||||||
cxxReaction ex;
|
cxxReaction ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||||
struct irrev *irrev_ptr = ex.cxxReaction2irrev();
|
struct irrev *irrev_ptr = ex.cxxReaction2irrev(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -862,7 +862,7 @@ read_mix_raw(void)
|
|||||||
|
|
||||||
cxxMix ex;
|
cxxMix ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(parser);
|
||||||
struct mix *mix_ptr = ex.cxxMix2mix();
|
struct mix *mix_ptr = ex.cxxMix2mix(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -958,7 +958,7 @@ read_temperature_raw(void)
|
|||||||
|
|
||||||
cxxTemperature ex;
|
cxxTemperature ex;
|
||||||
ex.read_raw(parser);
|
ex.read_raw(parser);
|
||||||
struct temperature *temperature_ptr = ex.cxxTemperature2temperature();
|
struct temperature *temperature_ptr = ex.cxxTemperature2temperature(PHREEQC_THIS);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1219,9 +1219,9 @@ read_solution_modify(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cxxSolution sol(solution[n]);
|
cxxSolution sol(solution[n]);
|
||||||
sol.read_raw(parser, false);
|
sol.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||||
|
|
||||||
struct solution *soln_ptr = sol.cxxSolution2solution();
|
struct solution *soln_ptr = sol.cxxSolution2solution(PHREEQC_THIS);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order, forced sort
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
@ -1306,10 +1306,10 @@ read_equilibrium_phases_modify(void)
|
|||||||
|
|
||||||
// read entity
|
// read entity
|
||||||
cxxPPassemblage entity(&(pp_assemblage[n]));
|
cxxPPassemblage entity(&(pp_assemblage[n]));
|
||||||
entity.read_raw(parser, false);
|
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||||
|
|
||||||
// save entity
|
// save entity
|
||||||
struct pp_assemblage *entity_ptr = entity.cxxPPassemblage2pp_assemblage();
|
struct pp_assemblage *entity_ptr = entity.cxxPPassemblage2pp_assemblage(PHREEQC_THIS);
|
||||||
pp_assemblage_free(&(pp_assemblage[n]));
|
pp_assemblage_free(&(pp_assemblage[n]));
|
||||||
pp_assemblage_copy(entity_ptr, &(pp_assemblage[n]), entity_ptr->n_user);
|
pp_assemblage_copy(entity_ptr, &(pp_assemblage[n]), entity_ptr->n_user);
|
||||||
free_check_null(pp_assemblage[n].description);
|
free_check_null(pp_assemblage[n].description);
|
||||||
@ -1394,10 +1394,10 @@ read_exchange_modify(void)
|
|||||||
|
|
||||||
// read entity
|
// read entity
|
||||||
cxxExchange entity(&(exchange[n]));
|
cxxExchange entity(&(exchange[n]));
|
||||||
entity.read_raw(parser, false);
|
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||||
|
|
||||||
// save entity
|
// save entity
|
||||||
struct exchange *entity_ptr = entity.cxxExchange2exchange();
|
struct exchange *entity_ptr = entity.cxxExchange2exchange(PHREEQC_THIS);
|
||||||
exchange_free(&(exchange[n]));
|
exchange_free(&(exchange[n]));
|
||||||
exchange_copy(entity_ptr, &(exchange[n]), entity_ptr->n_user);
|
exchange_copy(entity_ptr, &(exchange[n]), entity_ptr->n_user);
|
||||||
free_check_null(exchange[n].description);
|
free_check_null(exchange[n].description);
|
||||||
@ -1482,10 +1482,10 @@ read_surface_modify(void)
|
|||||||
|
|
||||||
// read entity
|
// read entity
|
||||||
cxxSurface entity(&(surface[n]));
|
cxxSurface entity(&(surface[n]));
|
||||||
entity.read_raw(parser, false);
|
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||||
|
|
||||||
// save entity
|
// save entity
|
||||||
struct surface *entity_ptr = entity.cxxSurface2surface();
|
struct surface *entity_ptr = entity.cxxSurface2surface(PHREEQC_THIS);
|
||||||
surface_free(&(surface[n]));
|
surface_free(&(surface[n]));
|
||||||
surface_copy(entity_ptr, &(surface[n]), entity_ptr->n_user);
|
surface_copy(entity_ptr, &(surface[n]), entity_ptr->n_user);
|
||||||
free_check_null(surface[n].description);
|
free_check_null(surface[n].description);
|
||||||
@ -1569,10 +1569,10 @@ read_solid_solutions_modify(void)
|
|||||||
|
|
||||||
// read entity
|
// read entity
|
||||||
cxxSSassemblage entity(&(s_s_assemblage[n]));
|
cxxSSassemblage entity(&(s_s_assemblage[n]));
|
||||||
entity.read_raw(parser, false);
|
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||||
|
|
||||||
// save entity
|
// save entity
|
||||||
struct s_s_assemblage *entity_ptr = entity.cxxSSassemblage2s_s_assemblage();
|
struct s_s_assemblage *entity_ptr = entity.cxxSSassemblage2s_s_assemblage(PHREEQC_THIS);
|
||||||
s_s_assemblage_free(&(s_s_assemblage[n]));
|
s_s_assemblage_free(&(s_s_assemblage[n]));
|
||||||
s_s_assemblage_copy(entity_ptr, &(s_s_assemblage[n]), entity_ptr->n_user);
|
s_s_assemblage_copy(entity_ptr, &(s_s_assemblage[n]), entity_ptr->n_user);
|
||||||
free_check_null(s_s_assemblage[n].description);
|
free_check_null(s_s_assemblage[n].description);
|
||||||
@ -1655,9 +1655,9 @@ read_gas_phase_modify(void)
|
|||||||
|
|
||||||
// read entity
|
// read entity
|
||||||
cxxGasPhase entity(&(gas_phase[n]));
|
cxxGasPhase entity(&(gas_phase[n]));
|
||||||
entity.read_raw(parser, false);
|
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||||
// save entity
|
// save entity
|
||||||
struct gas_phase *entity_ptr = entity.cxxGasPhase2gas_phase();
|
struct gas_phase *entity_ptr = entity.cxxGasPhase2gas_phase(PHREEQC_THIS);
|
||||||
gas_phase_free(&(gas_phase[n]));
|
gas_phase_free(&(gas_phase[n]));
|
||||||
gas_phase_copy(entity_ptr, &(gas_phase[n]), entity_ptr->n_user);
|
gas_phase_copy(entity_ptr, &(gas_phase[n]), entity_ptr->n_user);
|
||||||
free_check_null(gas_phase[n].description);
|
free_check_null(gas_phase[n].description);
|
||||||
@ -1741,10 +1741,10 @@ read_kinetics_modify(void)
|
|||||||
|
|
||||||
// read entity
|
// read entity
|
||||||
cxxKinetics entity(&(kinetics[n]));
|
cxxKinetics entity(&(kinetics[n]));
|
||||||
entity.read_raw(parser, false);
|
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||||
|
|
||||||
// save entity
|
// save entity
|
||||||
struct kinetics *entity_ptr = entity.cxxKinetics2kinetics();
|
struct kinetics *entity_ptr = entity.cxxKinetics2kinetics(PHREEQC_THIS);
|
||||||
kinetics_free(&(kinetics[n]));
|
kinetics_free(&(kinetics[n]));
|
||||||
kinetics_copy(entity_ptr, &(kinetics[n]), entity_ptr->n_user);
|
kinetics_copy(entity_ptr, &(kinetics[n]), entity_ptr->n_user);
|
||||||
free_check_null(kinetics[n].description);
|
free_check_null(kinetics[n].description);
|
||||||
|
|||||||
@ -158,7 +158,7 @@ cxxSSassemblage::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxSSassemblage::read_raw(CParser & parser, bool check)
|
cxxSSassemblage::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
static std::vector < std::string > vopts;
|
static std::vector < std::string > vopts;
|
||||||
if (vopts.empty())
|
if (vopts.empty())
|
||||||
@ -240,7 +240,7 @@ cxxSSassemblage::read_raw(CParser & parser, bool check)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
parser.set_accumulate(true);
|
parser.set_accumulate(true);
|
||||||
ec.read_raw(parser, false);
|
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||||
parser.set_accumulate(false);
|
parser.set_accumulate(false);
|
||||||
std::istringstream is(parser.get_accumulated());
|
std::istringstream is(parser.get_accumulated());
|
||||||
CParser reread(is);
|
CParser reread(is);
|
||||||
@ -249,12 +249,12 @@ cxxSSassemblage::read_raw(CParser & parser, bool check)
|
|||||||
if (this->ssAssemblageSSs.find(ec.get_name()) != this->ssAssemblageSSs.end())
|
if (this->ssAssemblageSSs.find(ec.get_name()) != this->ssAssemblageSSs.end())
|
||||||
{
|
{
|
||||||
cxxSSassemblageSS & ec1 = this->ssAssemblageSSs.find(ec.get_name())->second;
|
cxxSSassemblageSS & ec1 = this->ssAssemblageSSs.find(ec.get_name())->second;
|
||||||
ec1.read_raw(reread, false);
|
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cxxSSassemblageSS ec1;
|
cxxSSassemblageSS ec1;
|
||||||
ec1.read_raw(reread, false);
|
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
std::string str(ec1.get_name());
|
std::string str(ec1.get_name());
|
||||||
this->ssAssemblageSSs[str] = ec1;
|
this->ssAssemblageSSs[str] = ec1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,13 +34,13 @@ public:
|
|||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
#ifdef USE_MPI
|
#ifdef USE_MPI
|
||||||
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
||||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||||
#endif
|
#endif
|
||||||
void totalize();
|
void totalize(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
const cxxNameDouble & get_totals() const
|
const cxxNameDouble & get_totals() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -217,7 +217,7 @@ cxxSSassemblageSS::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxSSassemblageSS::read_raw(CParser & parser, bool check)
|
cxxSSassemblageSS::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ cxxSSassemblageSS::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // components
|
case 4: // components
|
||||||
if (this->comps.read_raw(parser, next_char) != CParser::PARSER_OK)
|
if (this->comps.read_raw(P_INSTANCE_COMMA parser, next_char) != CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
parser.error_msg("Expected phase name and moles for comps.",
|
parser.error_msg("Expected phase name and moles for comps.",
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class cxxSSassemblageSS
|
|||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
const std::string &get_name() const
|
const std::string &get_name() const
|
||||||
{
|
{
|
||||||
|
|||||||
14
Solution.cxx
14
Solution.cxx
@ -306,18 +306,18 @@ cxxSolution::cxxSolution2solution(PHREEQC_PTR_ARG)
|
|||||||
// totals
|
// totals
|
||||||
solution_ptr->totals =
|
solution_ptr->totals =
|
||||||
(struct conc *) P_INSTANCE_POINTER free_check_null(solution_ptr->totals);
|
(struct conc *) P_INSTANCE_POINTER free_check_null(solution_ptr->totals);
|
||||||
solution_ptr->totals = this->totals.conc();
|
solution_ptr->totals = this->totals.conc(P_INSTANCE);
|
||||||
|
|
||||||
// master_activity
|
// master_activity
|
||||||
solution_ptr->master_activity =
|
solution_ptr->master_activity =
|
||||||
(struct master_activity *) P_INSTANCE_POINTER free_check_null(solution_ptr->
|
(struct master_activity *) P_INSTANCE_POINTER free_check_null(solution_ptr->
|
||||||
master_activity);
|
master_activity);
|
||||||
solution_ptr->master_activity = this->master_activity.master_activity();
|
solution_ptr->master_activity = this->master_activity.master_activity(P_INSTANCE);
|
||||||
solution_ptr->count_master_activity =
|
solution_ptr->count_master_activity =
|
||||||
(int) this->master_activity.size() + 1;
|
(int) this->master_activity.size() + 1;
|
||||||
|
|
||||||
// species_gamma
|
// species_gamma
|
||||||
solution_ptr->species_gamma = this->species_gamma.master_activity();
|
solution_ptr->species_gamma = this->species_gamma.master_activity(P_INSTANCE);
|
||||||
solution_ptr->count_species_gamma = (int) this->species_gamma.size();
|
solution_ptr->count_species_gamma = (int) this->species_gamma.size();
|
||||||
|
|
||||||
// isotopes
|
// isotopes
|
||||||
@ -557,7 +557,7 @@ cxxSolution::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxSolution::read_raw(CParser & parser, bool check)
|
cxxSolution::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
static std::vector < std::string > vopts;
|
static std::vector < std::string > vopts;
|
||||||
if (vopts.empty())
|
if (vopts.empty())
|
||||||
@ -629,7 +629,7 @@ cxxSolution::read_raw(CParser & parser, bool check)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 0: // totals
|
case 0: // totals
|
||||||
if (this->totals.read_raw(parser, next_char) !=
|
if (this->totals.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -641,7 +641,7 @@ cxxSolution::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // activities
|
case 1: // activities
|
||||||
if (this->master_activity.read_raw(parser, next_char) !=
|
if (this->master_activity.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -654,7 +654,7 @@ cxxSolution::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // gammas
|
case 2: // gammas
|
||||||
if (this->species_gamma.read_raw(parser, next_char) !=
|
if (this->species_gamma.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
|
|||||||
@ -152,7 +152,7 @@ class cxxSolution:public cxxNumKeyword
|
|||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
void multiply(double extensive);
|
void multiply(double extensive);
|
||||||
#ifdef ORCHESTRA
|
#ifdef ORCHESTRA
|
||||||
void ORCH_write(std::ostream & headings, std::ostream & input_data) const;
|
void ORCH_write(std::ostream & headings, std::ostream & input_data) const;
|
||||||
|
|||||||
198
StorageBin.cxx
198
StorageBin.cxx
@ -372,7 +372,7 @@ cxxStorageBin::getSurfaces() const
|
|||||||
return this->Surfaces;
|
return this->Surfaces;
|
||||||
};
|
};
|
||||||
void
|
void
|
||||||
cxxStorageBin::import_phreeqc(void)
|
cxxStorageBin::import_phreeqc(PHREEQC_PTR_ARG)
|
||||||
//
|
//
|
||||||
// pull data out of c storage
|
// pull data out of c storage
|
||||||
//
|
//
|
||||||
@ -380,65 +380,65 @@ cxxStorageBin::import_phreeqc(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Solutions
|
// Solutions
|
||||||
for (i = 0; i < count_solution; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_solution; i++)
|
||||||
{
|
{
|
||||||
Solutions[solution[i]->n_user] = cxxSolution(solution[i]);
|
Solutions[P_INSTANCE_POINTER solution[i]->n_user] = cxxSolution(P_INSTANCE_POINTER solution[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exchangers
|
// Exchangers
|
||||||
for (i = 0; i < count_exchange; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_exchange; i++)
|
||||||
{
|
{
|
||||||
Exchangers[exchange[i].n_user] = cxxExchange(&exchange[i]);
|
Exchangers[P_INSTANCE_POINTER exchange[i].n_user] = cxxExchange(&P_INSTANCE_POINTER exchange[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GasPhases
|
// GasPhases
|
||||||
for (i = 0; i < count_gas_phase; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_gas_phase; i++)
|
||||||
{
|
{
|
||||||
GasPhases[gas_phase[i].n_user] = cxxGasPhase(&gas_phase[i]);
|
GasPhases[P_INSTANCE_POINTER gas_phase[i].n_user] = cxxGasPhase(&P_INSTANCE_POINTER gas_phase[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kinetics
|
// Kinetics
|
||||||
for (i = 0; i < count_kinetics; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_kinetics; i++)
|
||||||
{
|
{
|
||||||
Kinetics[kinetics[i].n_user] = cxxKinetics(&kinetics[i]);
|
Kinetics[P_INSTANCE_POINTER kinetics[i].n_user] = cxxKinetics(&P_INSTANCE_POINTER kinetics[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PPassemblages
|
// PPassemblages
|
||||||
for (i = 0; i < count_pp_assemblage; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_pp_assemblage; i++)
|
||||||
{
|
{
|
||||||
PPassemblages[pp_assemblage[i].n_user] =
|
PPassemblages[P_INSTANCE_POINTER pp_assemblage[i].n_user] =
|
||||||
cxxPPassemblage(&pp_assemblage[i]);
|
cxxPPassemblage(&P_INSTANCE_POINTER pp_assemblage[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSassemblages
|
// SSassemblages
|
||||||
for (i = 0; i < count_s_s_assemblage; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_s_s_assemblage; i++)
|
||||||
{
|
{
|
||||||
SSassemblages[s_s_assemblage[i].n_user] =
|
SSassemblages[P_INSTANCE_POINTER s_s_assemblage[i].n_user] =
|
||||||
cxxSSassemblage(&s_s_assemblage[i]);
|
cxxSSassemblage(&P_INSTANCE_POINTER s_s_assemblage[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Surfaces
|
// Surfaces
|
||||||
for (i = 0; i < count_surface; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_surface; i++)
|
||||||
{
|
{
|
||||||
Surfaces[surface[i].n_user] = cxxSurface(&surface[i]);
|
Surfaces[P_INSTANCE_POINTER surface[i].n_user] = cxxSurface(&P_INSTANCE_POINTER surface[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mixes
|
// Mixes
|
||||||
for (i = 0; i < count_mix; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_mix; i++)
|
||||||
{
|
{
|
||||||
Mixes[mix[i].n_user] = cxxMix(&mix[i]);
|
Mixes[P_INSTANCE_POINTER mix[i].n_user] = cxxMix(&P_INSTANCE_POINTER mix[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reactions
|
// Reactions
|
||||||
for (i = 0; i < count_irrev; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_irrev; i++)
|
||||||
{
|
{
|
||||||
Reactions[irrev[i].n_user] = cxxReaction(&irrev[i]);
|
Reactions[P_INSTANCE_POINTER irrev[i].n_user] = cxxReaction(&P_INSTANCE_POINTER irrev[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temperatures
|
// Temperatures
|
||||||
for (i = 0; i < count_temperature; i++)
|
for (i = 0; i < P_INSTANCE_POINTER count_temperature; i++)
|
||||||
{
|
{
|
||||||
Temperatures[temperature[i].n_user] = cxxTemperature(&temperature[i]);
|
Temperatures[P_INSTANCE_POINTER temperature[i].n_user] = cxxTemperature(&P_INSTANCE_POINTER temperature[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +561,7 @@ cxxStorageBin::dump_raw(std::ostream & s_oss, int n, unsigned int indent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxStorageBin::read_raw(CParser & parser)
|
cxxStorageBin::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||||
{
|
{
|
||||||
CParser::LINE_TYPE i;
|
CParser::LINE_TYPE i;
|
||||||
while ((i =
|
while ((i =
|
||||||
@ -593,7 +593,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
|||||||
case CParser::KT_SOLUTION_RAW:
|
case CParser::KT_SOLUTION_RAW:
|
||||||
{
|
{
|
||||||
cxxSolution entity;
|
cxxSolution entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
Solutions[entity.get_n_user()] = entity;
|
Solutions[entity.get_n_user()] = entity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -601,7 +601,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
|||||||
case CParser::KT_EXCHANGE_RAW:
|
case CParser::KT_EXCHANGE_RAW:
|
||||||
{
|
{
|
||||||
cxxExchange entity;
|
cxxExchange entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
Exchangers[entity.get_n_user()] = entity;
|
Exchangers[entity.get_n_user()] = entity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -609,7 +609,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
|||||||
case CParser::KT_GASPHASE_RAW:
|
case CParser::KT_GASPHASE_RAW:
|
||||||
{
|
{
|
||||||
cxxGasPhase entity;
|
cxxGasPhase entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
GasPhases[entity.get_n_user()] = entity;
|
GasPhases[entity.get_n_user()] = entity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -617,7 +617,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
|||||||
case CParser::KT_KINETICS_RAW:
|
case CParser::KT_KINETICS_RAW:
|
||||||
{
|
{
|
||||||
cxxKinetics entity;
|
cxxKinetics entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
Kinetics[entity.get_n_user()] = entity;
|
Kinetics[entity.get_n_user()] = entity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -625,7 +625,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
|||||||
case CParser::KT_PPASSEMBLAGE_RAW:
|
case CParser::KT_PPASSEMBLAGE_RAW:
|
||||||
{
|
{
|
||||||
cxxPPassemblage entity;
|
cxxPPassemblage entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
PPassemblages[entity.get_n_user()] = entity;
|
PPassemblages[entity.get_n_user()] = entity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -633,7 +633,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
|||||||
case CParser::KT_SSASSEMBLAGE_RAW:
|
case CParser::KT_SSASSEMBLAGE_RAW:
|
||||||
{
|
{
|
||||||
cxxSSassemblage entity;
|
cxxSSassemblage entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
SSassemblages[entity.get_n_user()] = entity;
|
SSassemblages[entity.get_n_user()] = entity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -641,7 +641,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
|||||||
case CParser::KT_SURFACE_RAW:
|
case CParser::KT_SURFACE_RAW:
|
||||||
{
|
{
|
||||||
cxxSurface entity;
|
cxxSurface entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
Surfaces[entity.get_n_user()] = entity;
|
Surfaces[entity.get_n_user()] = entity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -656,7 +656,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cxxStorageBin::read_raw_keyword(CParser & parser)
|
cxxStorageBin::read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||||
{
|
{
|
||||||
CParser::LINE_TYPE i;
|
CParser::LINE_TYPE i;
|
||||||
int entity_number = -999;
|
int entity_number = -999;
|
||||||
@ -687,7 +687,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
|||||||
case CParser::KT_SOLUTION_RAW:
|
case CParser::KT_SOLUTION_RAW:
|
||||||
{
|
{
|
||||||
cxxSolution entity;
|
cxxSolution entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
Solutions[entity.get_n_user()] = entity;
|
Solutions[entity.get_n_user()] = entity;
|
||||||
entity_number = entity.get_n_user();
|
entity_number = entity.get_n_user();
|
||||||
}
|
}
|
||||||
@ -696,7 +696,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
|||||||
case CParser::KT_EXCHANGE_RAW:
|
case CParser::KT_EXCHANGE_RAW:
|
||||||
{
|
{
|
||||||
cxxExchange entity;
|
cxxExchange entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
Exchangers[entity.get_n_user()] = entity;
|
Exchangers[entity.get_n_user()] = entity;
|
||||||
entity_number = entity.get_n_user();
|
entity_number = entity.get_n_user();
|
||||||
}
|
}
|
||||||
@ -705,7 +705,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
|||||||
case CParser::KT_GASPHASE_RAW:
|
case CParser::KT_GASPHASE_RAW:
|
||||||
{
|
{
|
||||||
cxxGasPhase entity;
|
cxxGasPhase entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
GasPhases[entity.get_n_user()] = entity;
|
GasPhases[entity.get_n_user()] = entity;
|
||||||
entity_number = entity.get_n_user();
|
entity_number = entity.get_n_user();
|
||||||
}
|
}
|
||||||
@ -714,7 +714,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
|||||||
case CParser::KT_KINETICS_RAW:
|
case CParser::KT_KINETICS_RAW:
|
||||||
{
|
{
|
||||||
cxxKinetics entity;
|
cxxKinetics entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
Kinetics[entity.get_n_user()] = entity;
|
Kinetics[entity.get_n_user()] = entity;
|
||||||
entity_number = entity.get_n_user();
|
entity_number = entity.get_n_user();
|
||||||
}
|
}
|
||||||
@ -723,7 +723,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
|||||||
case CParser::KT_PPASSEMBLAGE_RAW:
|
case CParser::KT_PPASSEMBLAGE_RAW:
|
||||||
{
|
{
|
||||||
cxxPPassemblage entity;
|
cxxPPassemblage entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
PPassemblages[entity.get_n_user()] = entity;
|
PPassemblages[entity.get_n_user()] = entity;
|
||||||
entity_number = entity.get_n_user();
|
entity_number = entity.get_n_user();
|
||||||
}
|
}
|
||||||
@ -732,7 +732,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
|||||||
case CParser::KT_SSASSEMBLAGE_RAW:
|
case CParser::KT_SSASSEMBLAGE_RAW:
|
||||||
{
|
{
|
||||||
cxxSSassemblage entity;
|
cxxSSassemblage entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
SSassemblages[entity.get_n_user()] = entity;
|
SSassemblages[entity.get_n_user()] = entity;
|
||||||
entity_number = entity.get_n_user();
|
entity_number = entity.get_n_user();
|
||||||
}
|
}
|
||||||
@ -741,7 +741,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
|||||||
case CParser::KT_SURFACE_RAW:
|
case CParser::KT_SURFACE_RAW:
|
||||||
{
|
{
|
||||||
cxxSurface entity;
|
cxxSurface entity;
|
||||||
entity.read_raw(parser);
|
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||||
Surfaces[entity.get_n_user()] = entity;
|
Surfaces[entity.get_n_user()] = entity;
|
||||||
entity_number = entity.get_n_user();
|
entity_number = entity.get_n_user();
|
||||||
}
|
}
|
||||||
@ -811,7 +811,7 @@ cxxStorageBin::add(struct system *system_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
cxxStorageBin::cxxStorageBin2phreeqc(PHREEQC_PTR_ARG_COMMA int n)
|
||||||
//
|
//
|
||||||
// copy data fromphreeqc storage to storage bin
|
// copy data fromphreeqc storage to storage bin
|
||||||
//
|
//
|
||||||
@ -824,14 +824,14 @@ cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
|||||||
std::map < int, cxxSolution >::iterator it = this->Solutions.find(n);
|
std::map < int, cxxSolution >::iterator it = this->Solutions.find(n);
|
||||||
if (it != this->Solutions.end())
|
if (it != this->Solutions.end())
|
||||||
{
|
{
|
||||||
solution[0] = (it->second).cxxSolution2solution();
|
P_INSTANCE_POINTER solution[0] = (it->second).cxxSolution2solution(P_INSTANCE);
|
||||||
solution[0]->n_user = n;
|
P_INSTANCE_POINTER solution[0]->n_user = n;
|
||||||
solution[0]->n_user_end = n;
|
P_INSTANCE_POINTER solution[0]->n_user_end = n;
|
||||||
count_solution++;
|
P_INSTANCE_POINTER count_solution++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error_msg("cxxSolution not found in system2phreeqc", STOP);
|
P_INSTANCE_POINTER error_msg("cxxSolution not found in system2phreeqc", STOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -841,11 +841,11 @@ cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
|||||||
if (it != this->Exchangers.end())
|
if (it != this->Exchangers.end())
|
||||||
{
|
{
|
||||||
struct exchange *exchange_ptr =
|
struct exchange *exchange_ptr =
|
||||||
(it->second).cxxExchange2exchange();
|
(it->second).cxxExchange2exchange(P_INSTANCE);
|
||||||
exchange_copy(exchange_ptr, &exchange[0], n);
|
P_INSTANCE_POINTER exchange_copy(exchange_ptr, &P_INSTANCE_POINTER exchange[0], n);
|
||||||
count_exchange++;
|
P_INSTANCE_POINTER count_exchange++;
|
||||||
exchange_free(exchange_ptr);
|
P_INSTANCE_POINTER exchange_free(exchange_ptr);
|
||||||
exchange_ptr = (struct exchange *) free_check_null(exchange_ptr);
|
exchange_ptr = (struct exchange *) P_INSTANCE_POINTER free_check_null(exchange_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,12 +855,12 @@ cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
|||||||
if (it != this->GasPhases.end())
|
if (it != this->GasPhases.end())
|
||||||
{
|
{
|
||||||
struct gas_phase *gas_phase_ptr =
|
struct gas_phase *gas_phase_ptr =
|
||||||
(it->second).cxxGasPhase2gas_phase();
|
(it->second).cxxGasPhase2gas_phase(P_INSTANCE);
|
||||||
gas_phase_copy(gas_phase_ptr, &gas_phase[0], n);
|
P_INSTANCE_POINTER gas_phase_copy(gas_phase_ptr, &P_INSTANCE_POINTER gas_phase[0], n);
|
||||||
count_gas_phase++;
|
P_INSTANCE_POINTER count_gas_phase++;
|
||||||
gas_phase_free(gas_phase_ptr);
|
P_INSTANCE_POINTER gas_phase_free(gas_phase_ptr);
|
||||||
gas_phase_ptr =
|
gas_phase_ptr =
|
||||||
(struct gas_phase *) free_check_null(gas_phase_ptr);
|
(struct gas_phase *) P_INSTANCE_POINTER free_check_null(gas_phase_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -870,11 +870,11 @@ cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
|||||||
if (it != this->Kinetics.end())
|
if (it != this->Kinetics.end())
|
||||||
{
|
{
|
||||||
struct kinetics *kinetics_ptr =
|
struct kinetics *kinetics_ptr =
|
||||||
(it->second).cxxKinetics2kinetics();
|
(it->second).cxxKinetics2kinetics(P_INSTANCE);
|
||||||
kinetics_copy(kinetics_ptr, &kinetics[0], n);
|
P_INSTANCE_POINTER kinetics_copy(kinetics_ptr, &P_INSTANCE_POINTER kinetics[0], n);
|
||||||
count_kinetics++;
|
P_INSTANCE_POINTER count_kinetics++;
|
||||||
kinetics_free(kinetics_ptr);
|
P_INSTANCE_POINTER kinetics_free(kinetics_ptr);
|
||||||
kinetics_ptr = (struct kinetics *) free_check_null(kinetics_ptr);
|
kinetics_ptr = (struct kinetics *) P_INSTANCE_POINTER free_check_null(kinetics_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -885,12 +885,12 @@ cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
|||||||
if (it != this->PPassemblages.end())
|
if (it != this->PPassemblages.end())
|
||||||
{
|
{
|
||||||
struct pp_assemblage *pp_assemblage_ptr =
|
struct pp_assemblage *pp_assemblage_ptr =
|
||||||
(it->second).cxxPPassemblage2pp_assemblage();
|
(it->second).cxxPPassemblage2pp_assemblage(P_INSTANCE);
|
||||||
pp_assemblage_copy(pp_assemblage_ptr, &pp_assemblage[0], n);
|
P_INSTANCE_POINTER pp_assemblage_copy(pp_assemblage_ptr, &P_INSTANCE_POINTER pp_assemblage[0], n);
|
||||||
count_pp_assemblage++;
|
P_INSTANCE_POINTER count_pp_assemblage++;
|
||||||
pp_assemblage_free(pp_assemblage_ptr);
|
P_INSTANCE_POINTER pp_assemblage_free(pp_assemblage_ptr);
|
||||||
pp_assemblage_ptr =
|
pp_assemblage_ptr =
|
||||||
(struct pp_assemblage *) free_check_null(pp_assemblage_ptr);
|
(struct pp_assemblage *) P_INSTANCE_POINTER free_check_null(pp_assemblage_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,12 +901,12 @@ cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
|||||||
if (it != this->SSassemblages.end())
|
if (it != this->SSassemblages.end())
|
||||||
{
|
{
|
||||||
struct s_s_assemblage *s_s_assemblage_ptr =
|
struct s_s_assemblage *s_s_assemblage_ptr =
|
||||||
(it->second).cxxSSassemblage2s_s_assemblage();
|
(it->second).cxxSSassemblage2s_s_assemblage(P_INSTANCE);
|
||||||
s_s_assemblage_copy(s_s_assemblage_ptr, &s_s_assemblage[0], n);
|
P_INSTANCE_POINTER s_s_assemblage_copy(s_s_assemblage_ptr, &P_INSTANCE_POINTER s_s_assemblage[0], n);
|
||||||
count_s_s_assemblage++;
|
P_INSTANCE_POINTER count_s_s_assemblage++;
|
||||||
s_s_assemblage_free(s_s_assemblage_ptr);
|
P_INSTANCE_POINTER s_s_assemblage_free(s_s_assemblage_ptr);
|
||||||
s_s_assemblage_ptr =
|
s_s_assemblage_ptr =
|
||||||
(struct s_s_assemblage *) free_check_null(s_s_assemblage_ptr);
|
(struct s_s_assemblage *) P_INSTANCE_POINTER free_check_null(s_s_assemblage_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,18 +915,18 @@ cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
|||||||
std::map < int, cxxSurface >::iterator it = this->Surfaces.find(n);
|
std::map < int, cxxSurface >::iterator it = this->Surfaces.find(n);
|
||||||
if (it != this->Surfaces.end())
|
if (it != this->Surfaces.end())
|
||||||
{
|
{
|
||||||
struct surface *surface_ptr = (it->second).cxxSurface2surface();
|
struct surface *surface_ptr = (it->second).cxxSurface2surface(P_INSTANCE);
|
||||||
surface_copy(surface_ptr, &surface[0], n);
|
P_INSTANCE_POINTER surface_copy(surface_ptr, &P_INSTANCE_POINTER surface[0], n);
|
||||||
count_surface++;
|
P_INSTANCE_POINTER count_surface++;
|
||||||
surface_free(surface_ptr);
|
P_INSTANCE_POINTER surface_free(surface_ptr);
|
||||||
surface_ptr = (struct surface *) free_check_null(surface_ptr);
|
surface_ptr = (struct surface *) P_INSTANCE_POINTER free_check_null(surface_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//std::cerr << oss.str();
|
//std::cerr << oss.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
cxxStorageBin::phreeqc2cxxStorageBin(int n)
|
cxxStorageBin::phreeqc2cxxStorageBin(PHREEQC_PTR_ARG_COMMA int n)
|
||||||
//
|
//
|
||||||
// copy data fromphreeqc storage to storage bin
|
// copy data fromphreeqc storage to storage bin
|
||||||
//
|
//
|
||||||
@ -935,55 +935,55 @@ cxxStorageBin::phreeqc2cxxStorageBin(int n)
|
|||||||
|
|
||||||
// Solutions
|
// Solutions
|
||||||
{
|
{
|
||||||
solution_bsearch(n, &pos, TRUE);
|
P_INSTANCE_POINTER solution_bsearch(n, &pos, TRUE);
|
||||||
this->Solutions[n] = cxxSolution(solution[pos]);
|
this->Solutions[n] = cxxSolution(P_INSTANCE_POINTER solution[pos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exchangers
|
// Exchangers
|
||||||
{
|
{
|
||||||
if (exchange_bsearch(n, &pos) != NULL)
|
if (P_INSTANCE_POINTER exchange_bsearch(n, &pos) != NULL)
|
||||||
{
|
{
|
||||||
this->Exchangers[n] = cxxExchange(&(exchange[pos]));
|
this->Exchangers[n] = cxxExchange(&(P_INSTANCE_POINTER exchange[pos]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GasPhases
|
// GasPhases
|
||||||
{
|
{
|
||||||
if (gas_phase_bsearch(n, &pos) != NULL)
|
if (P_INSTANCE_POINTER gas_phase_bsearch(n, &pos) != NULL)
|
||||||
{
|
{
|
||||||
this->GasPhases[n] = cxxGasPhase(&(gas_phase[pos]));
|
this->GasPhases[n] = cxxGasPhase(&(P_INSTANCE_POINTER gas_phase[pos]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kinetics
|
// Kinetics
|
||||||
{
|
{
|
||||||
if (kinetics_bsearch(n, &pos) != NULL)
|
if (P_INSTANCE_POINTER kinetics_bsearch(n, &pos) != NULL)
|
||||||
{
|
{
|
||||||
this->Kinetics[n] = cxxKinetics(&(kinetics[pos]));
|
this->Kinetics[n] = cxxKinetics(&(P_INSTANCE_POINTER kinetics[pos]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PPassemblages
|
// PPassemblages
|
||||||
{
|
{
|
||||||
if (pp_assemblage_bsearch(n, &pos) != NULL)
|
if (P_INSTANCE_POINTER pp_assemblage_bsearch(n, &pos) != NULL)
|
||||||
{
|
{
|
||||||
this->PPassemblages[n] = cxxPPassemblage(&(pp_assemblage[pos]));
|
this->PPassemblages[n] = cxxPPassemblage(&(P_INSTANCE_POINTER pp_assemblage[pos]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSassemblages
|
// SSassemblages
|
||||||
{
|
{
|
||||||
if (s_s_assemblage_bsearch(n, &pos) != NULL)
|
if (P_INSTANCE_POINTER s_s_assemblage_bsearch(n, &pos) != NULL)
|
||||||
{
|
{
|
||||||
this->SSassemblages[n] = cxxSSassemblage(&(s_s_assemblage[pos]));
|
this->SSassemblages[n] = cxxSSassemblage(&(P_INSTANCE_POINTER s_s_assemblage[pos]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Surfaces
|
// Surfaces
|
||||||
{
|
{
|
||||||
if (surface_bsearch(n, &pos) != NULL)
|
if (P_INSTANCE_POINTER surface_bsearch(n, &pos) != NULL)
|
||||||
{
|
{
|
||||||
this->Surfaces[n] = cxxSurface(&(surface[pos]));
|
this->Surfaces[n] = cxxSurface(&(P_INSTANCE_POINTER surface[pos]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1060,7 +1060,7 @@ cxxStorageBin::mix_cxxSolutions(cxxMix & mixmap)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
struct system *
|
struct system *
|
||||||
cxxStorageBin::cxxStorageBin2system(int n)
|
cxxStorageBin::cxxStorageBin2system(PHREEQC_PTR_ARG_COMMA int n)
|
||||||
//
|
//
|
||||||
// make a system from storagebin
|
// make a system from storagebin
|
||||||
//
|
//
|
||||||
@ -1068,13 +1068,13 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
|||||||
struct system *system_ptr =
|
struct system *system_ptr =
|
||||||
(struct system *) PHRQ_malloc(sizeof(struct system));
|
(struct system *) PHRQ_malloc(sizeof(struct system));
|
||||||
if (system_ptr == NULL)
|
if (system_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
|
|
||||||
// Solutions
|
// Solutions
|
||||||
|
|
||||||
if (this->getSolution(n) != NULL)
|
if (this->getSolution(n) != NULL)
|
||||||
{
|
{
|
||||||
system_ptr->solution = (this->getSolution(n))->cxxSolution2solution();
|
system_ptr->solution = (this->getSolution(n))->cxxSolution2solution(P_INSTANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1084,7 +1084,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
|||||||
// Exchangers
|
// Exchangers
|
||||||
if (this->getExchange(n) != NULL)
|
if (this->getExchange(n) != NULL)
|
||||||
{
|
{
|
||||||
system_ptr->exchange = (this->getExchange(n))->cxxExchange2exchange();
|
system_ptr->exchange = (this->getExchange(n))->cxxExchange2exchange(P_INSTANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1095,7 +1095,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
|||||||
if (this->getGasPhase(n) != NULL)
|
if (this->getGasPhase(n) != NULL)
|
||||||
{
|
{
|
||||||
system_ptr->gas_phase =
|
system_ptr->gas_phase =
|
||||||
(this->getGasPhase(n))->cxxGasPhase2gas_phase();
|
(this->getGasPhase(n))->cxxGasPhase2gas_phase(P_INSTANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1105,7 +1105,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
|||||||
// Kinetics
|
// Kinetics
|
||||||
if (this->getKinetics(n) != NULL)
|
if (this->getKinetics(n) != NULL)
|
||||||
{
|
{
|
||||||
system_ptr->kinetics = (this->getKinetics(n))->cxxKinetics2kinetics();
|
system_ptr->kinetics = (this->getKinetics(n))->cxxKinetics2kinetics(P_INSTANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1116,7 +1116,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
|||||||
if (this->getPPassemblage(n) != NULL)
|
if (this->getPPassemblage(n) != NULL)
|
||||||
{
|
{
|
||||||
system_ptr->pp_assemblage =
|
system_ptr->pp_assemblage =
|
||||||
(this->getPPassemblage(n))->cxxPPassemblage2pp_assemblage();
|
(this->getPPassemblage(n))->cxxPPassemblage2pp_assemblage(P_INSTANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1127,7 +1127,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
|||||||
if (this->getSSassemblage(n) != NULL)
|
if (this->getSSassemblage(n) != NULL)
|
||||||
{
|
{
|
||||||
system_ptr->s_s_assemblage =
|
system_ptr->s_s_assemblage =
|
||||||
(this->getSSassemblage(n))->cxxSSassemblage2s_s_assemblage();
|
(this->getSSassemblage(n))->cxxSSassemblage2s_s_assemblage(P_INSTANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1137,7 +1137,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
|||||||
// Surfaces
|
// Surfaces
|
||||||
if (this->getSurface(n) != NULL)
|
if (this->getSurface(n) != NULL)
|
||||||
{
|
{
|
||||||
system_ptr->surface = (this->getSurface(n))->cxxSurface2surface();
|
system_ptr->surface = (this->getSurface(n))->cxxSurface2surface(P_INSTANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
12
StorageBin.h
12
StorageBin.h
@ -25,11 +25,11 @@ class cxxStorageBin
|
|||||||
cxxStorageBin(struct Use *use_ptr);
|
cxxStorageBin(struct Use *use_ptr);
|
||||||
~cxxStorageBin();
|
~cxxStorageBin();
|
||||||
|
|
||||||
void import_phreeqc(void);
|
void import_phreeqc(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
void cxxStorageBin2phreeqc(int n);
|
void cxxStorageBin2phreeqc(PHREEQC_PTR_ARG_COMMA int n);
|
||||||
|
|
||||||
void phreeqc2cxxStorageBin(int n);
|
void phreeqc2cxxStorageBin(PHREEQC_PTR_ARG_COMMA int n);
|
||||||
|
|
||||||
void remove(int n);
|
void remove(int n);
|
||||||
|
|
||||||
@ -79,12 +79,12 @@ class cxxStorageBin
|
|||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, int i, unsigned int indent);
|
void dump_raw(std::ostream & s_oss, int i, unsigned int indent);
|
||||||
|
|
||||||
void read_raw(CParser & parser);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser);
|
||||||
int read_raw_keyword(CParser & parser);
|
int read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser);
|
||||||
|
|
||||||
void add(struct system *sys_ptr);
|
void add(struct system *sys_ptr);
|
||||||
|
|
||||||
struct system *cxxStorageBin2system(int i);
|
struct system *cxxStorageBin2system(PHREEQC_PTR_ARG_COMMA int i);
|
||||||
|
|
||||||
//cxxSolution *mix_cxxSolutions(cxxMix &mixmap);
|
//cxxSolution *mix_cxxSolutions(cxxMix &mixmap);
|
||||||
cxxExchange *mix_cxxExchange(cxxMix & mixmap);
|
cxxExchange *mix_cxxExchange(cxxMix & mixmap);
|
||||||
|
|||||||
27
Surface.cxx
27
Surface.cxx
@ -82,7 +82,7 @@ cxxNumKeyword()
|
|||||||
surfaceCharges[str] = ec;
|
surfaceCharges[str] = ec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cxxSurface::cxxSurface(const std::map < int, cxxSurface > &entities,
|
cxxSurface::cxxSurface(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxSurface > &entities,
|
||||||
cxxMix & mix, int n_user):
|
cxxMix & mix, int n_user):
|
||||||
cxxNumKeyword()
|
cxxNumKeyword()
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ cxxNumKeyword()
|
|||||||
{
|
{
|
||||||
const cxxSurface *entity_ptr =
|
const cxxSurface *entity_ptr =
|
||||||
&(entities.find(it->first)->second);
|
&(entities.find(it->first)->second);
|
||||||
this->add(*entity_ptr, it->second);
|
this->add(P_INSTANCE_COMMA *entity_ptr, it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ cxxSurface::cxxSurface2surface(PHREEQC_PTR_ARG)
|
|||||||
surface_ptr->comps =
|
surface_ptr->comps =
|
||||||
(struct surface_comp *) P_INSTANCE_POINTER free_check_null(surface_ptr->comps);
|
(struct surface_comp *) P_INSTANCE_POINTER free_check_null(surface_ptr->comps);
|
||||||
surface_ptr->comps =
|
surface_ptr->comps =
|
||||||
cxxSurfaceComp::cxxSurfaceComp2surface_comp(this->surfaceComps);
|
cxxSurfaceComp::cxxSurfaceComp2surface_comp(P_INSTANCE_COMMA this->surfaceComps);
|
||||||
|
|
||||||
// Surface charge
|
// Surface charge
|
||||||
surface_ptr->charge =
|
surface_ptr->charge =
|
||||||
@ -200,8 +200,7 @@ cxxSurface::cxxSurface2surface(PHREEQC_PTR_ARG)
|
|||||||
for (i = 0; i < surface_ptr->count_comps; i++)
|
for (i = 0; i < surface_ptr->count_comps; i++)
|
||||||
{
|
{
|
||||||
char *charge_name = P_INSTANCE_POINTER string_hsave(
|
char *charge_name = P_INSTANCE_POINTER string_hsave(
|
||||||
cxxSurfaceComp::get_charge_name(surface_ptr->comps[i].
|
cxxSurfaceComp::get_charge_name(P_INSTANCE_COMMA surface_ptr->comps[i].formula).c_str());
|
||||||
formula).c_str());
|
|
||||||
for (j = 0; j < surface_ptr->count_charge; j++)
|
for (j = 0; j < surface_ptr->count_charge; j++)
|
||||||
{
|
{
|
||||||
if (charge_name == surface_ptr->charge[j].name)
|
if (charge_name == surface_ptr->charge[j].name)
|
||||||
@ -364,7 +363,7 @@ cxxSurface::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxSurface::read_raw(CParser & parser, bool check)
|
cxxSurface::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
static std::vector < std::string > vopts;
|
static std::vector < std::string > vopts;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -540,7 +539,7 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
parser.set_accumulate(true);
|
parser.set_accumulate(true);
|
||||||
ec.read_raw(parser, false);
|
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||||
parser.set_accumulate(false);
|
parser.set_accumulate(false);
|
||||||
std::istringstream is(parser.get_accumulated());
|
std::istringstream is(parser.get_accumulated());
|
||||||
CParser reread(is);
|
CParser reread(is);
|
||||||
@ -549,12 +548,12 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
|||||||
if (this->surfaceComps.find(ec.get_formula()) != this->surfaceComps.end())
|
if (this->surfaceComps.find(ec.get_formula()) != this->surfaceComps.end())
|
||||||
{
|
{
|
||||||
cxxSurfaceComp & comp = this->surfaceComps.find(ec.get_formula())->second;
|
cxxSurfaceComp & comp = this->surfaceComps.find(ec.get_formula())->second;
|
||||||
comp.read_raw(reread, false);
|
comp.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cxxSurfaceComp ec1;
|
cxxSurfaceComp ec1;
|
||||||
ec1.read_raw(reread, false);
|
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
std::string str(ec1.get_formula());
|
std::string str(ec1.get_formula());
|
||||||
this->surfaceComps[str] = ec1;
|
this->surfaceComps[str] = ec1;
|
||||||
}
|
}
|
||||||
@ -593,7 +592,7 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
parser.set_accumulate(true);
|
parser.set_accumulate(true);
|
||||||
ec.read_raw(parser, false);
|
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||||
parser.set_accumulate(false);
|
parser.set_accumulate(false);
|
||||||
std::istringstream is(parser.get_accumulated());
|
std::istringstream is(parser.get_accumulated());
|
||||||
CParser reread(is);
|
CParser reread(is);
|
||||||
@ -602,12 +601,12 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
|||||||
if (this->surfaceCharges.find(ec.get_name()) != this->surfaceCharges.end())
|
if (this->surfaceCharges.find(ec.get_name()) != this->surfaceCharges.end())
|
||||||
{
|
{
|
||||||
cxxSurfaceCharge & comp = this->surfaceCharges.find(ec.get_name())->second;
|
cxxSurfaceCharge & comp = this->surfaceCharges.find(ec.get_name())->second;
|
||||||
comp.read_raw(reread, false);
|
comp.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cxxSurfaceCharge ec1;
|
cxxSurfaceCharge ec1;
|
||||||
ec1.read_raw(reread, false);
|
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
std::string str(ec1.get_name());
|
std::string str(ec1.get_name());
|
||||||
this->surfaceCharges[str] = ec1;
|
this->surfaceCharges[str] = ec1;
|
||||||
}
|
}
|
||||||
@ -973,7 +972,7 @@ cxxSurface::add(const cxxSurface & addee, double extensive)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
cxxSurface::add(const cxxSurface & addee, double extensive)
|
cxxSurface::add(PHREEQC_PTR_ARG_COMMA const cxxSurface & addee, double extensive)
|
||||||
//
|
//
|
||||||
// Add surface to "this" exchange
|
// Add surface to "this" exchange
|
||||||
//
|
//
|
||||||
@ -1010,7 +1009,7 @@ cxxSurface::add(const cxxSurface & addee, double extensive)
|
|||||||
std::map < std::string, cxxSurfaceComp >::iterator it = this->surfaceComps.find((*itadd).first);
|
std::map < std::string, cxxSurfaceComp >::iterator it = this->surfaceComps.find((*itadd).first);
|
||||||
if (it != this->surfaceComps.end())
|
if (it != this->surfaceComps.end())
|
||||||
{
|
{
|
||||||
(*it).second.add( (*itadd).second, extensive);
|
(*it).second.add(P_INSTANCE_COMMA (*itadd).second, extensive);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class cxxSurface:public cxxNumKeyword
|
|||||||
public:
|
public:
|
||||||
cxxSurface();
|
cxxSurface();
|
||||||
cxxSurface(struct surface *);
|
cxxSurface(struct surface *);
|
||||||
cxxSurface(const std::map < int, cxxSurface > &entity_map, cxxMix & mx,
|
cxxSurface(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxSurface > &entity_map, cxxMix & mx,
|
||||||
int n_user);
|
int n_user);
|
||||||
~cxxSurface();
|
~cxxSurface();
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ class cxxSurface:public cxxNumKeyword
|
|||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
bool get_related_phases(void);
|
bool get_related_phases(void);
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class cxxSurface:public cxxNumKeyword
|
|||||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
void add(const cxxSurface & addee, double extensive);
|
void add(PHREEQC_PTR_ARG_COMMA const cxxSurface & addee, double extensive);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::map < std::string, cxxSurfaceComp > surfaceComps;
|
std::map < std::string, cxxSurfaceComp > surfaceComps;
|
||||||
|
|||||||
@ -203,7 +203,7 @@ cxxSurfaceCharge::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxSurfaceCharge::read_raw(CParser & parser, bool check)
|
cxxSurfaceCharge::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
|
|||||||
|
|
||||||
|
|
||||||
case 6: // diffuse_layer_totals
|
case 6: // diffuse_layer_totals
|
||||||
if (this->diffuse_layer_totals.read_raw(parser, next_char) !=
|
if (this->diffuse_layer_totals.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public:
|
|||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
const std::string &get_name() const
|
const std::string &get_name() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -103,7 +103,7 @@ struct master *
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct surface_comp *
|
struct surface_comp *
|
||||||
cxxSurfaceComp::cxxSurfaceComp2surface_comp(std::map < std::string, cxxSurfaceComp > &el)
|
cxxSurfaceComp::cxxSurfaceComp2surface_comp(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxSurfaceComp > &el)
|
||||||
//
|
//
|
||||||
// Builds surface_comp structure from of cxxSurfaceComp
|
// Builds surface_comp structure from of cxxSurfaceComp
|
||||||
//
|
//
|
||||||
@ -112,33 +112,33 @@ struct surface_comp *
|
|||||||
(struct surface_comp *)
|
(struct surface_comp *)
|
||||||
PHRQ_malloc((size_t) (el.size() * sizeof(struct surface_comp)));
|
PHRQ_malloc((size_t) (el.size() * sizeof(struct surface_comp)));
|
||||||
if (surf_comp_ptr == NULL)
|
if (surf_comp_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::map < std::string, cxxSurfaceComp >::iterator it = el.begin();
|
for (std::map < std::string, cxxSurfaceComp >::iterator it = el.begin();
|
||||||
it != el.end(); ++it)
|
it != el.end(); ++it)
|
||||||
{
|
{
|
||||||
surf_comp_ptr[i].formula = string_hsave((*it).second.formula.c_str());
|
surf_comp_ptr[i].formula = P_INSTANCE_POINTER string_hsave((*it).second.formula.c_str());
|
||||||
assert((*it).second.formula.size() > 0);
|
assert((*it).second.formula.size() > 0);
|
||||||
surf_comp_ptr[i].formula_totals = (*it).second.formula_totals.elt_list();
|
surf_comp_ptr[i].formula_totals = (*it).second.formula_totals.elt_list(P_INSTANCE);
|
||||||
surf_comp_ptr[i].formula_z = (*it).second.formula_z;
|
surf_comp_ptr[i].formula_z = (*it).second.formula_z;
|
||||||
surf_comp_ptr[i].moles = (*it).second.moles;
|
surf_comp_ptr[i].moles = (*it).second.moles;
|
||||||
surf_comp_ptr[i].master = (*it).second.get_master();
|
surf_comp_ptr[i].master = (*it).second.get_master(P_INSTANCE);
|
||||||
surf_comp_ptr[i].totals = (*it).second.totals.elt_list();
|
surf_comp_ptr[i].totals = (*it).second.totals.elt_list(P_INSTANCE);
|
||||||
surf_comp_ptr[i].la = (*it).second.la;
|
surf_comp_ptr[i].la = (*it).second.la;
|
||||||
//surf_comp_ptr[i].charge = it->charge_number;
|
//surf_comp_ptr[i].charge = it->charge_number;
|
||||||
surf_comp_ptr[i].cb = (*it).second.charge_balance;
|
surf_comp_ptr[i].cb = (*it).second.charge_balance;
|
||||||
if ((*it).second.phase_name.size() == 0)
|
if ((*it).second.phase_name.size() == 0)
|
||||||
surf_comp_ptr[i].phase_name = NULL;
|
surf_comp_ptr[i].phase_name = NULL;
|
||||||
else
|
else
|
||||||
surf_comp_ptr[i].phase_name = string_hsave((*it).second.phase_name.c_str());
|
surf_comp_ptr[i].phase_name = P_INSTANCE_POINTER string_hsave((*it).second.phase_name.c_str());
|
||||||
surf_comp_ptr[i].phase_proportion = (*it).second.phase_proportion;
|
surf_comp_ptr[i].phase_proportion = (*it).second.phase_proportion;
|
||||||
if ((*it).second.rate_name.size() == 0)
|
if ((*it).second.rate_name.size() == 0)
|
||||||
surf_comp_ptr[i].rate_name = NULL;
|
surf_comp_ptr[i].rate_name = NULL;
|
||||||
else
|
else
|
||||||
surf_comp_ptr[i].rate_name = string_hsave((*it).second.rate_name.c_str());
|
surf_comp_ptr[i].rate_name = P_INSTANCE_POINTER string_hsave((*it).second.rate_name.c_str());
|
||||||
surf_comp_ptr[i].Dw = (*it).second.Dw;
|
surf_comp_ptr[i].Dw = (*it).second.Dw;
|
||||||
surf_comp_ptr[i].master = (*it).second.get_master();
|
surf_comp_ptr[i].master = (*it).second.get_master(P_INSTANCE);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return (surf_comp_ptr);
|
return (surf_comp_ptr);
|
||||||
@ -246,7 +246,7 @@ cxxSurfaceComp::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxSurfaceComp::read_raw(CParser & parser, bool check)
|
cxxSurfaceComp::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 8: // totals
|
case 8: // totals
|
||||||
if (this->totals.read_raw(parser, next_char) !=
|
if (this->totals.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -427,7 +427,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 10: // formula_totals
|
case 10: // formula_totals
|
||||||
if (this->formula_totals.read_raw(parser, next_char) !=
|
if (this->formula_totals.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
@ -547,7 +547,7 @@ cxxSurfaceComp::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
cxxSurfaceComp::add(const cxxSurfaceComp & addee, double extensive)
|
cxxSurfaceComp::add(PHREEQC_PTR_ARG_COMMA const cxxSurfaceComp & addee, double extensive)
|
||||||
{
|
{
|
||||||
if (extensive == 0.0)
|
if (extensive == 0.0)
|
||||||
return;
|
return;
|
||||||
@ -602,8 +602,8 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, double extensive)
|
|||||||
oss <<
|
oss <<
|
||||||
"Can not mix two Surface components with same formula and different related phases, "
|
"Can not mix two Surface components with same formula and different related phases, "
|
||||||
<< this->formula;
|
<< this->formula;
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
P_INSTANCE_POINTER input_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (this->phase_name.size() != 0)
|
else if (this->phase_name.size() != 0)
|
||||||
@ -619,8 +619,8 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, double extensive)
|
|||||||
oss <<
|
oss <<
|
||||||
"Can not mix two exchange components with same formula and different related kinetics, "
|
"Can not mix two exchange components with same formula and different related kinetics, "
|
||||||
<< this->formula;
|
<< this->formula;
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
P_INSTANCE_POINTER input_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (this->rate_name.size() != 0)
|
else if (this->rate_name.size() != 0)
|
||||||
@ -636,8 +636,8 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, double extensive)
|
|||||||
oss <<
|
oss <<
|
||||||
"Can not mix exchange components related to phase with exchange components related to kinetics, "
|
"Can not mix exchange components related to phase with exchange components related to kinetics, "
|
||||||
<< this->formula;
|
<< this->formula;
|
||||||
error_msg(oss.str().c_str(), CONTINUE);
|
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||||
input_error++;
|
P_INSTANCE_POINTER input_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//double Dw;
|
//double Dw;
|
||||||
@ -717,18 +717,18 @@ cxxSurfaceComp::get_totals() const
|
|||||||
return (this->totals);
|
return (this->totals);
|
||||||
};
|
};
|
||||||
std::string
|
std::string
|
||||||
cxxSurfaceComp::charge_name()
|
cxxSurfaceComp::charge_name(PHREEQC_PTR_ARG)
|
||||||
{
|
{
|
||||||
char * str = string_hsave(this->formula.c_str());
|
char * str = P_INSTANCE_POINTER string_hsave(this->formula.c_str());
|
||||||
return (get_charge_name(str));
|
return (get_charge_name(P_INSTANCE_COMMA str));
|
||||||
};
|
};
|
||||||
std::string
|
std::string
|
||||||
cxxSurfaceComp::get_charge_name(char *token)
|
cxxSurfaceComp::get_charge_name(PHREEQC_PTR_ARG_COMMA char *token)
|
||||||
{
|
{
|
||||||
char name[100];
|
char name[100];
|
||||||
int l;
|
int l;
|
||||||
char *ptr1 = token;
|
char *ptr1 = token;
|
||||||
get_elt(&ptr1, name, &l);
|
P_INSTANCE_POINTER get_elt(&ptr1, name, &l);
|
||||||
ptr1 = strchr(name, '_');
|
ptr1 = strchr(name, '_');
|
||||||
if (ptr1 != NULL)
|
if (ptr1 != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
#include <list> // std::list
|
#include <list> // std::list
|
||||||
#include <vector> // std::vector
|
#include <vector> // std::vector
|
||||||
|
#include "Phreeqc_class.h"
|
||||||
#include "NameDouble.h"
|
#include "NameDouble.h"
|
||||||
|
|
||||||
class cxxSurfaceComp
|
class cxxSurfaceComp
|
||||||
@ -27,15 +27,15 @@ public:
|
|||||||
void set_formula(char * f);
|
void set_formula(char * f);
|
||||||
double get_charge_balance() const;
|
double get_charge_balance() const;
|
||||||
void set_charge_balance(double d);
|
void set_charge_balance(double d);
|
||||||
static struct surface_comp *cxxSurfaceComp2surface_comp(std::map < std::string, cxxSurfaceComp > &el);
|
static struct surface_comp *cxxSurfaceComp2surface_comp(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxSurfaceComp > &el);
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
const cxxNameDouble & get_totals() const;
|
const cxxNameDouble & get_totals() const;
|
||||||
void add(const cxxSurfaceComp & comp, double extensive);
|
void add(PHREEQC_PTR_ARG_COMMA const cxxSurfaceComp & comp, double extensive);
|
||||||
void multiply(double extensive);
|
void multiply(double extensive);
|
||||||
std::string charge_name();
|
std::string charge_name(PHREEQC_PTR_ARG);
|
||||||
static std::string get_charge_name(char *token);
|
static std::string get_charge_name(PHREEQC_PTR_ARG_COMMA char *token);
|
||||||
#ifdef USE_MPI
|
#ifdef USE_MPI
|
||||||
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
||||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||||
|
|||||||
10
System.cxx
10
System.cxx
@ -53,7 +53,7 @@ cxxSystem::Initialize(void)
|
|||||||
this->temperature = NULL;
|
this->temperature = NULL;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
cxxSystem::totalize(void)
|
cxxSystem::totalize(PHREEQC_PTR_ARG)
|
||||||
{
|
{
|
||||||
//initialize
|
//initialize
|
||||||
this->totals.clear();
|
this->totals.clear();
|
||||||
@ -76,22 +76,22 @@ cxxSystem::totalize(void)
|
|||||||
}
|
}
|
||||||
if (this->ppassemblage != NULL)
|
if (this->ppassemblage != NULL)
|
||||||
{
|
{
|
||||||
this->ppassemblage->totalize();
|
this->ppassemblage->totalize(P_INSTANCE);
|
||||||
this->totals.add_extensive(this->ppassemblage->get_totals(), 1.0);
|
this->totals.add_extensive(this->ppassemblage->get_totals(), 1.0);
|
||||||
}
|
}
|
||||||
if (this->gasphase != NULL)
|
if (this->gasphase != NULL)
|
||||||
{
|
{
|
||||||
this->gasphase->totalize();
|
this->gasphase->totalize(P_INSTANCE);
|
||||||
this->totals.add_extensive(this->gasphase->get_totals(), 1.0);
|
this->totals.add_extensive(this->gasphase->get_totals(), 1.0);
|
||||||
}
|
}
|
||||||
if (this->ssassemblage != NULL)
|
if (this->ssassemblage != NULL)
|
||||||
{
|
{
|
||||||
this->ssassemblage->totalize();
|
this->ssassemblage->totalize(P_INSTANCE);
|
||||||
this->totals.add_extensive(this->ssassemblage->get_totals(), 1.0);
|
this->totals.add_extensive(this->ssassemblage->get_totals(), 1.0);
|
||||||
}
|
}
|
||||||
if (this->surface != NULL)
|
if (this->surface != NULL)
|
||||||
{
|
{
|
||||||
this->ssassemblage->totalize();
|
this->ssassemblage->totalize(P_INSTANCE);
|
||||||
this->totals.add_extensive(this->surface->get_totals(), 1.0);
|
this->totals.add_extensive(this->surface->get_totals(), 1.0);
|
||||||
}
|
}
|
||||||
//Need to handle the following 3 reactions:
|
//Need to handle the following 3 reactions:
|
||||||
|
|||||||
39
System.h
39
System.h
@ -24,40 +24,51 @@ class cxxMix;
|
|||||||
|
|
||||||
class cxxSystem
|
class cxxSystem
|
||||||
{
|
{
|
||||||
public:cxxSystem(void);
|
public:
|
||||||
public: ~cxxSystem(void);
|
cxxSystem(void);
|
||||||
void Initialize(void);
|
~cxxSystem(void);
|
||||||
void setSolution(cxxSolution * entity)
|
void Initialize(void);
|
||||||
|
void setSolution(cxxSolution * entity)
|
||||||
{
|
{
|
||||||
this->solution = entity;
|
this->solution = entity;
|
||||||
} void setExchange(cxxExchange * entity)
|
}
|
||||||
|
void setExchange(cxxExchange * entity)
|
||||||
{
|
{
|
||||||
this->exchange = entity;
|
this->exchange = entity;
|
||||||
} void setPPassemblage(cxxPPassemblage * entity)
|
}
|
||||||
|
void setPPassemblage(cxxPPassemblage * entity)
|
||||||
{
|
{
|
||||||
this->ppassemblage = entity;
|
this->ppassemblage = entity;
|
||||||
} void setGasPhase(cxxGasPhase * entity)
|
}
|
||||||
|
void setGasPhase(cxxGasPhase * entity)
|
||||||
{
|
{
|
||||||
this->gasphase = entity;
|
this->gasphase = entity;
|
||||||
} void setSSassemblage(cxxSSassemblage * entity)
|
}
|
||||||
|
void setSSassemblage(cxxSSassemblage * entity)
|
||||||
{
|
{
|
||||||
this->ssassemblage = entity;
|
this->ssassemblage = entity;
|
||||||
} void setKinetics(cxxKinetics * entity)
|
}
|
||||||
|
void setKinetics(cxxKinetics * entity)
|
||||||
{
|
{
|
||||||
this->kinetics = entity;
|
this->kinetics = entity;
|
||||||
} void setSurface(cxxSurface * entity)
|
}
|
||||||
|
void setSurface(cxxSurface * entity)
|
||||||
{
|
{
|
||||||
this->surface = entity;
|
this->surface = entity;
|
||||||
} void setMix(cxxMix * entity)
|
}
|
||||||
|
void setMix(cxxMix * entity)
|
||||||
{
|
{
|
||||||
this->mix = entity;
|
this->mix = entity;
|
||||||
} void setReaction(cxxReaction * entity)
|
}
|
||||||
|
void setReaction(cxxReaction * entity)
|
||||||
{
|
{
|
||||||
this->reaction = entity;
|
this->reaction = entity;
|
||||||
} void setTemperature(cxxTemperature * entity)
|
}
|
||||||
|
void setTemperature(cxxTemperature * entity)
|
||||||
{
|
{
|
||||||
this->temperature = entity;
|
this->temperature = entity;
|
||||||
} void totalize();
|
}
|
||||||
|
void totalize(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
#ifdef ORCHESTRA
|
#ifdef ORCHESTRA
|
||||||
void ORCH_components();
|
void ORCH_components();
|
||||||
|
|||||||
@ -108,12 +108,12 @@ cxxKinetics::~cxxKinetics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct kinetics *
|
struct kinetics *
|
||||||
cxxKinetics::cxxKinetics2kinetics()
|
cxxKinetics::cxxKinetics2kinetics(PHREEQC_PTR_ARG)
|
||||||
//
|
//
|
||||||
// Builds a kinetics structure from instance of cxxKinetics
|
// Builds a kinetics structure from instance of cxxKinetics
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
struct kinetics *kinetics_ptr = kinetics_alloc();
|
struct kinetics *kinetics_ptr = P_INSTANCE_POINTER kinetics_alloc();
|
||||||
|
|
||||||
kinetics_ptr->description = this->get_description();
|
kinetics_ptr->description = this->get_description();
|
||||||
kinetics_ptr->n_user = this->n_user;
|
kinetics_ptr->n_user = this->n_user;
|
||||||
@ -126,25 +126,25 @@ cxxKinetics::cxxKinetics2kinetics()
|
|||||||
kinetics_ptr->cvode_order = this->cvode_order;
|
kinetics_ptr->cvode_order = this->cvode_order;
|
||||||
|
|
||||||
// totals
|
// totals
|
||||||
kinetics_ptr->totals = this->totals.elt_list();
|
kinetics_ptr->totals = this->totals.elt_list(P_INSTANCE);
|
||||||
|
|
||||||
// comps
|
// comps
|
||||||
kinetics_ptr->count_comps = (int) this->kineticsComps.size();
|
kinetics_ptr->count_comps = (int) this->kineticsComps.size();
|
||||||
kinetics_ptr->comps =
|
kinetics_ptr->comps =
|
||||||
(struct kinetics_comp *) free_check_null(kinetics_ptr->comps);
|
(struct kinetics_comp *) P_INSTANCE_POINTER free_check_null(kinetics_ptr->comps);
|
||||||
kinetics_ptr->comps =
|
kinetics_ptr->comps =
|
||||||
cxxKineticsComp::cxxKineticsComp2kinetics_comp(this->kineticsComps);
|
cxxKineticsComp::cxxKineticsComp2kinetics_comp(P_INSTANCE_COMMA this->kineticsComps);
|
||||||
|
|
||||||
// steps
|
// steps
|
||||||
kinetics_ptr->count_steps = (int) this->steps.size();
|
kinetics_ptr->count_steps = (int) this->steps.size();
|
||||||
kinetics_ptr->steps = (double *) free_check_null(kinetics_ptr->steps);
|
kinetics_ptr->steps = (double *) P_INSTANCE_POINTER free_check_null(kinetics_ptr->steps);
|
||||||
if (this->steps.size() > 0)
|
if (this->steps.size() > 0)
|
||||||
{
|
{
|
||||||
kinetics_ptr->steps =
|
kinetics_ptr->steps =
|
||||||
(double *)
|
(double *)
|
||||||
PHRQ_malloc((size_t) (this->steps.size() * sizeof(double)));
|
PHRQ_malloc((size_t) (this->steps.size() * sizeof(double)));
|
||||||
if (kinetics_ptr->steps == NULL)
|
if (kinetics_ptr->steps == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
std::copy(this->steps.begin(), this->steps.end(),
|
std::copy(this->steps.begin(), this->steps.end(),
|
||||||
kinetics_ptr->steps);
|
kinetics_ptr->steps);
|
||||||
/*
|
/*
|
||||||
@ -267,7 +267,7 @@ cxxKinetics::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxKinetics::read_raw(CParser & parser, bool check)
|
cxxKinetics::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
|
|
||||||
double d;
|
double d;
|
||||||
@ -414,7 +414,7 @@ cxxKinetics::read_raw(CParser & parser, bool check)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
parser.set_accumulate(true);
|
parser.set_accumulate(true);
|
||||||
ec.read_raw(parser, false);
|
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||||
parser.set_accumulate(false);
|
parser.set_accumulate(false);
|
||||||
std::istringstream is(parser.get_accumulated());
|
std::istringstream is(parser.get_accumulated());
|
||||||
CParser reread(is);
|
CParser reread(is);
|
||||||
@ -424,12 +424,12 @@ cxxKinetics::read_raw(CParser & parser, bool check)
|
|||||||
if (this->kineticsComps.find(ec.get_rate_name()) != this->kineticsComps.end())
|
if (this->kineticsComps.find(ec.get_rate_name()) != this->kineticsComps.end())
|
||||||
{
|
{
|
||||||
cxxKineticsComp & comp = this->kineticsComps.find(ec.get_rate_name())->second;
|
cxxKineticsComp & comp = this->kineticsComps.find(ec.get_rate_name())->second;
|
||||||
comp.read_raw(reread, false);
|
comp.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cxxKineticsComp ec1;
|
cxxKineticsComp ec1;
|
||||||
ec1.read_raw(reread, false);
|
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||||
std::string str(ec1.get_rate_name());
|
std::string str(ec1.get_rate_name());
|
||||||
this->kineticsComps[str] = ec1;
|
this->kineticsComps[str] = ec1;
|
||||||
}
|
}
|
||||||
@ -438,7 +438,7 @@ cxxKinetics::read_raw(CParser & parser, bool check)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // totals
|
case 5: // totals
|
||||||
if (this->totals.read_raw(parser, next_char) !=
|
if (this->totals.read_raw(P_INSTANCE_COMMA parser, next_char) !=
|
||||||
CParser::PARSER_OK)
|
CParser::PARSER_OK)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class cxxKinetics:public cxxNumKeyword
|
|||||||
int n_user);
|
int n_user);
|
||||||
~cxxKinetics();
|
~cxxKinetics();
|
||||||
|
|
||||||
struct kinetics *cxxKinetics2kinetics();
|
struct kinetics *cxxKinetics2kinetics(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
struct kinetics_comp *cxxKineticsComp2kinetics_comp();
|
struct kinetics_comp *cxxKineticsComp2kinetics_comp();
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ class cxxKinetics:public cxxNumKeyword
|
|||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser, bool check = true);
|
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||||
|
|
||||||
bool get_related_phases(void);
|
bool get_related_phases(void);
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ cxxMix::~cxxMix()
|
|||||||
|
|
||||||
|
|
||||||
struct mix *
|
struct mix *
|
||||||
cxxMix::cxxMix2mix()
|
cxxMix::cxxMix2mix(PHREEQC_PTR_ARG)
|
||||||
//
|
//
|
||||||
// Builds a mix structure from instance of cxxMix
|
// Builds a mix structure from instance of cxxMix
|
||||||
//
|
//
|
||||||
@ -69,7 +69,7 @@ cxxMix::cxxMix2mix()
|
|||||||
struct mix *mix_ptr;
|
struct mix *mix_ptr;
|
||||||
mix_ptr = (struct mix *) PHRQ_malloc(sizeof(struct mix));
|
mix_ptr = (struct mix *) PHRQ_malloc(sizeof(struct mix));
|
||||||
if (mix_ptr == NULL)
|
if (mix_ptr == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
|
|
||||||
mix_ptr->description = this->get_description();
|
mix_ptr->description = this->get_description();
|
||||||
mix_ptr->n_user = this->n_user;
|
mix_ptr->n_user = this->n_user;
|
||||||
@ -85,7 +85,7 @@ cxxMix::cxxMix2mix()
|
|||||||
PHRQ_malloc((size_t)
|
PHRQ_malloc((size_t)
|
||||||
(this->mixComps.size() * sizeof(struct mix_comp)));
|
(this->mixComps.size() * sizeof(struct mix_comp)));
|
||||||
if (mix_ptr->comps == NULL)
|
if (mix_ptr->comps == NULL)
|
||||||
malloc_error();
|
P_INSTANCE_POINTER malloc_error();
|
||||||
for (std::map < int, double >::iterator it = mixComps.begin();
|
for (std::map < int, double >::iterator it = mixComps.begin();
|
||||||
it != mixComps.end(); it++)
|
it != mixComps.end(); it++)
|
||||||
{
|
{
|
||||||
|
|||||||
4
cxxMix.h
4
cxxMix.h
@ -6,7 +6,7 @@
|
|||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
#include <list> // std::list
|
#include <list> // std::list
|
||||||
#include <vector> // std::vector
|
#include <vector> // std::vector
|
||||||
|
#include "Phreeqc_class.h"
|
||||||
#include "NumKeyword.h"
|
#include "NumKeyword.h"
|
||||||
|
|
||||||
class cxxMix:public cxxNumKeyword
|
class cxxMix:public cxxNumKeyword
|
||||||
@ -17,7 +17,7 @@ class cxxMix:public cxxNumKeyword
|
|||||||
cxxMix(struct mix *);
|
cxxMix(struct mix *);
|
||||||
~cxxMix();
|
~cxxMix();
|
||||||
|
|
||||||
struct mix *cxxMix2mix();
|
struct mix *cxxMix2mix(PHREEQC_PTR_ARG);
|
||||||
|
|
||||||
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,21 @@
|
|||||||
|
#ifndef _INC_PHREEQC_CLASS_H
|
||||||
|
#define _INC_PHREEQC_CLASS_H
|
||||||
#if !defined PHREEQC_CLASS
|
#if !defined PHREEQC_CLASS
|
||||||
#define P_INSTANCE
|
#define P_INSTANCE
|
||||||
#define P_INSTANCE_COMMA
|
#define P_INSTANCE_COMMA
|
||||||
#define P_INSTANCE_POINTER
|
#define P_INSTANCE_POINTER
|
||||||
#define PHREEQC_PTR_ARG
|
#define PHREEQC_PTR_ARG
|
||||||
#define PHREEQC_PTR_ARG_COMMA
|
#define PHREEQC_PTR_ARG_COMMA
|
||||||
|
#define PHREEQC_THIS
|
||||||
|
#define PHREEQC_THIS_COMMA
|
||||||
#else
|
#else
|
||||||
#define P_INSTANCE p_instance
|
#define P_INSTANCE p_instance
|
||||||
#define P_INSTANCE_COMMA p_instance,
|
#define P_INSTANCE_COMMA p_instance,
|
||||||
#define P_INSTANCE_POINTER p_instance->
|
#define P_INSTANCE_POINTER p_instance->
|
||||||
#define PHREEQC_PTR_ARG Phreeqc *p_instance
|
#define PHREEQC_PTR_ARG Phreeqc *p_instance
|
||||||
#define PHREEQC_PTR_ARG_COMMA Phreeqc *p_instance,
|
#define PHREEQC_PTR_ARG_COMMA Phreeqc *p_instance,
|
||||||
|
#define PHREEQC_THIS this
|
||||||
|
#define PHREEQC_THIS_COMMA this,
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* _INC_PHREEQC_CLASS_H */
|
||||||
//#include "Phreeqc_class.h"
|
//#include "Phreeqc_class.h"
|
||||||
Loading…
x
Reference in New Issue
Block a user