mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +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 *
|
||||
cxxExchComp::get_master()
|
||||
cxxExchComp::get_master(PHREEQC_PTR_ARG)
|
||||
{
|
||||
struct master *master_ptr = NULL;
|
||||
for (std::map < std::string, double >::iterator it =
|
||||
@ -137,16 +137,16 @@ cxxExchComp::get_master()
|
||||
{
|
||||
|
||||
/* 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);
|
||||
struct element *elt_ptr = element_store(eltName);
|
||||
struct element *elt_ptr = P_INSTANCE_POINTER element_store(eltName);
|
||||
if (elt_ptr->master == NULL)
|
||||
{
|
||||
std::ostringstream error_oss;
|
||||
error_oss << "Master species not in data base for " << elt_ptr->
|
||||
name << std::endl;
|
||||
//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);
|
||||
}
|
||||
if (elt_ptr->master->type != EX)
|
||||
@ -161,16 +161,16 @@ cxxExchComp::get_master()
|
||||
{
|
||||
|
||||
/* 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);
|
||||
struct element *elt_ptr = element_store(eltName);
|
||||
struct element *elt_ptr = P_INSTANCE_POINTER element_store(eltName);
|
||||
if (elt_ptr->master == NULL)
|
||||
{
|
||||
std::ostringstream error_oss;
|
||||
error_oss << "Master species not in data base for " <<
|
||||
elt_ptr->name << std::endl;
|
||||
//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);
|
||||
}
|
||||
if (elt_ptr->master->type != EX)
|
||||
@ -186,7 +186,7 @@ cxxExchComp::get_master()
|
||||
"Exchange formula does not contain an exchange master species, "
|
||||
<< this->formula << std::endl;
|
||||
//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;
|
||||
this->dump_raw(oss, 0);
|
||||
@ -197,7 +197,7 @@ cxxExchComp::get_master()
|
||||
}
|
||||
|
||||
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
|
||||
//
|
||||
@ -206,7 +206,7 @@ struct exch_comp *
|
||||
(struct exch_comp *)
|
||||
PHRQ_malloc((size_t) (el.size() * sizeof(struct exch_comp)));
|
||||
if (exch_comp_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
|
||||
int i = 0;
|
||||
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)
|
||||
exch_comp_ptr[i].formula = NULL;
|
||||
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].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].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].charge_balance = (*it).second.charge_balance;
|
||||
if ((*it).second.phase_name.size() == 0)
|
||||
exch_comp_ptr[i].phase_name = NULL;
|
||||
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;
|
||||
if ((*it).second.rate_name.size() == 0)
|
||||
exch_comp_ptr[i].rate_name = NULL;
|
||||
else
|
||||
exch_comp_ptr[i].rate_name = string_hsave((*it).second.rate_name.c_str());
|
||||
exch_comp_ptr[i].master = (*it).second.get_master();
|
||||
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(P_INSTANCE);
|
||||
i++;
|
||||
}
|
||||
return (exch_comp_ptr);
|
||||
@ -333,7 +333,7 @@ cxxExchComp::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
void
|
||||
cxxExchComp::read_raw(CParser & parser, bool check)
|
||||
cxxExchComp::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
@ -486,7 +486,7 @@ cxxExchComp::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -499,7 +499,7 @@ cxxExchComp::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -550,7 +550,7 @@ cxxExchComp::read_raw(CParser & parser, bool check)
|
||||
}
|
||||
}
|
||||
void
|
||||
cxxExchComp::add(const cxxExchComp & addee, double extensive)
|
||||
cxxExchComp::add(PHREEQC_PTR_ARG_COMMA const cxxExchComp & addee, double extensive)
|
||||
{
|
||||
double ext1, ext2, f1, f2;
|
||||
if (extensive == 0.0)
|
||||
@ -602,7 +602,7 @@ cxxExchComp::add(const cxxExchComp & addee, double extensive)
|
||||
oss <<
|
||||
"Can not mix two exchange components with same formula and different related phases, "
|
||||
<< this->formula;
|
||||
error_msg(oss.str().c_str(), CONTINUE);
|
||||
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||
input_error++;
|
||||
return;
|
||||
}
|
||||
@ -618,7 +618,7 @@ cxxExchComp::add(const cxxExchComp & addee, double extensive)
|
||||
oss <<
|
||||
"Can not mix two exchange components with same formula and different related kinetics, "
|
||||
<< this->formula;
|
||||
error_msg(oss.str().c_str(), CONTINUE);
|
||||
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||
input_error++;
|
||||
return;
|
||||
}
|
||||
@ -635,7 +635,7 @@ cxxExchComp::add(const cxxExchComp & addee, double extensive)
|
||||
oss <<
|
||||
"Can not mix exchange components related to phase with exchange components related to kinetics, "
|
||||
<< this->formula;
|
||||
error_msg(oss.str().c_str(), CONTINUE);
|
||||
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||
input_error++;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -17,16 +17,16 @@ class cxxExchComp
|
||||
cxxExchComp(struct exch_comp *);
|
||||
~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);
|
||||
|
||||
void dump_xml(std::ostream & os, unsigned int indent = 0) 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
|
||||
{
|
||||
@ -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);
|
||||
|
||||
|
||||
|
||||
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):
|
||||
cxxNumKeyword()
|
||||
{
|
||||
@ -75,7 +75,7 @@ cxxNumKeyword()
|
||||
{
|
||||
const cxxExchange *entity_ptr =
|
||||
&(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;
|
||||
}
|
||||
#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
|
||||
// equivalent of xexchange_save
|
||||
@ -108,61 +108,61 @@ cxxNumKeyword()
|
||||
this->n_user = n_user;
|
||||
this->n_user_end = n_user;
|
||||
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;
|
||||
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;
|
||||
//char * formula;
|
||||
ec.set_formula(x[i]->exch_comp->formula);
|
||||
ec.set_formula(P_INSTANCE_POINTER x[i]->exch_comp->formula);
|
||||
//double moles;
|
||||
ec.set_moles(0.0);
|
||||
//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
|
||||
//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
|
||||
//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;
|
||||
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;
|
||||
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;
|
||||
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
|
||||
count_elts = 0;
|
||||
paren_count = 0;
|
||||
P_INSTANCE_POINTER count_elts = 0;
|
||||
P_INSTANCE_POINTER paren_count = 0;
|
||||
double charge = 0.0;
|
||||
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,
|
||||
species_list[j].s->moles);
|
||||
charge += species_list[j].s->moles * species_list[j].s->z;
|
||||
P_INSTANCE_POINTER add_elt_list(P_INSTANCE_POINTER species_list[j].s->next_elt,
|
||||
P_INSTANCE_POINTER species_list[j].s->moles);
|
||||
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
|
||||
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
|
||||
ec.set_charge_balance(charge);
|
||||
//cxxNameDouble totals;
|
||||
if (count_elts > 0)
|
||||
if (P_INSTANCE_POINTER count_elts > 0)
|
||||
{
|
||||
qsort(elt_list, (size_t) count_elts,
|
||||
(size_t) sizeof(struct elt_list), elt_list_compare);
|
||||
elt_list_combine();
|
||||
qsort(P_INSTANCE_POINTER elt_list, (size_t) P_INSTANCE_POINTER count_elts,
|
||||
(size_t) sizeof(struct elt_list), P_INSTANCE_POINTER elt_list_compare);
|
||||
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
|
||||
std::string str(ec.get_formula());
|
||||
@ -202,12 +202,12 @@ cxxExchange::get_related_rate()
|
||||
}
|
||||
|
||||
struct exchange *
|
||||
cxxExchange::cxxExchange2exchange()
|
||||
cxxExchange::cxxExchange2exchange(PHREEQC_PTR_ARG)
|
||||
//
|
||||
// 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->n_user = this->n_user;
|
||||
@ -219,8 +219,8 @@ cxxExchange::cxxExchange2exchange()
|
||||
exchange_ptr->related_rate = (int) this->get_related_rate();
|
||||
exchange_ptr->pitzer_exchange_gammas = (int) this->pitzer_exchange_gammas;
|
||||
exchange_ptr->count_comps = (int) this->exchComps.size();
|
||||
exchange_ptr->comps = (struct exch_comp *) free_check_null(exchange_ptr->comps);
|
||||
exchange_ptr->comps = cxxExchComp::cxxExchComp2exch_comp(this->exchComps);
|
||||
exchange_ptr->comps = (struct exch_comp *) P_INSTANCE_POINTER free_check_null(exchange_ptr->comps);
|
||||
exchange_ptr->comps = cxxExchComp::cxxExchComp2exch_comp(P_INSTANCE_COMMA this->exchComps);
|
||||
return (exchange_ptr);
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ cxxExchange::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
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;
|
||||
if (vopts.empty())
|
||||
@ -387,7 +387,7 @@ cxxExchange::read_raw(CParser & parser, bool check)
|
||||
}
|
||||
#endif
|
||||
parser.set_accumulate(true);
|
||||
ec.read_raw(parser, false);
|
||||
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||
parser.set_accumulate(false);
|
||||
std::istringstream is(parser.get_accumulated());
|
||||
CParser reread(is);
|
||||
@ -396,12 +396,12 @@ cxxExchange::read_raw(CParser & parser, bool check)
|
||||
if (this->exchComps.find(ec.get_formula()) != this->exchComps.end())
|
||||
{
|
||||
cxxExchComp & comp = this->exchComps.find(ec.get_formula())->second;
|
||||
comp.read_raw(reread, false);
|
||||
comp.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
cxxExchComp ec1;
|
||||
ec1.read_raw(reread, false);
|
||||
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
std::string str(ec1.get_formula());
|
||||
this->exchComps[str] = ec1;
|
||||
}
|
||||
@ -463,7 +463,7 @@ cxxExchange::add(const cxxExchange & addee, double extensive)
|
||||
}
|
||||
#endif
|
||||
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
|
||||
//
|
||||
@ -477,7 +477,7 @@ cxxExchange::add(const cxxExchange & addee, double extensive)
|
||||
std::map < std::string, cxxExchComp >::iterator it = this->exchComps.find((*itadd).first);
|
||||
if (it != this->exchComps.end())
|
||||
{
|
||||
(*it).second.add((*itadd).second, extensive);
|
||||
(*it).second.add(P_INSTANCE_COMMA (*itadd).second, extensive);
|
||||
//bool found = false;
|
||||
//for (std::list < cxxExchComp >::iterator it = this->exchComps.begin();
|
||||
// it != this->exchComps.end(); ++it)
|
||||
|
||||
10
Exchange.h
10
Exchange.h
@ -15,19 +15,19 @@ class cxxExchange:public cxxNumKeyword
|
||||
|
||||
public:
|
||||
cxxExchange();
|
||||
cxxExchange(int n_user);
|
||||
cxxExchange(PHREEQC_PTR_ARG_COMMA int n_user);
|
||||
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);
|
||||
~cxxExchange();
|
||||
|
||||
struct exchange *cxxExchange2exchange();
|
||||
struct exchange *cxxExchange2exchange(PHREEQC_PTR_ARG);
|
||||
|
||||
struct exch_comp *cxxExchComp2exch_comp();
|
||||
|
||||
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);
|
||||
|
||||
@ -46,7 +46,7 @@ public:
|
||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||
#endif
|
||||
private:
|
||||
void add(const cxxExchange & addee, double extensive);
|
||||
void add(PHREEQC_PTR_ARG_COMMA const cxxExchange & addee, double extensive);
|
||||
// not written
|
||||
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;
|
||||
}
|
||||
}
|
||||
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):
|
||||
cxxNumKeyword()
|
||||
{
|
||||
@ -108,7 +108,7 @@ cxxNumKeyword()
|
||||
{
|
||||
std::ostringstream oss;
|
||||
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++;
|
||||
return;
|
||||
}
|
||||
@ -125,7 +125,7 @@ cxxGasPhase::~cxxGasPhase()
|
||||
}
|
||||
|
||||
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;
|
||||
@ -139,13 +139,13 @@ cxxGasPhase::cxxGasPhaseComp2gas_comp()
|
||||
(this->gasPhaseComps.size() *
|
||||
sizeof(struct gas_comp)));
|
||||
if (gas_comp_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
for (cxxNameDouble::iterator it = this->gasPhaseComps.begin();
|
||||
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);
|
||||
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].moles = it->second;
|
||||
gas_comp_ptr[i].initial_moles = 0;
|
||||
@ -156,12 +156,12 @@ cxxGasPhase::cxxGasPhaseComp2gas_comp()
|
||||
}
|
||||
|
||||
struct gas_phase *
|
||||
cxxGasPhase::cxxGasPhase2gas_phase()
|
||||
cxxGasPhase::cxxGasPhase2gas_phase(PHREEQC_PTR_ARG)
|
||||
//
|
||||
// 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->n_user = this->n_user;
|
||||
@ -184,8 +184,8 @@ cxxGasPhase::cxxGasPhase2gas_phase()
|
||||
// comps
|
||||
gas_phase_ptr->count_comps = (int) this->gasPhaseComps.size();
|
||||
gas_phase_ptr->comps =
|
||||
(struct gas_comp *) free_check_null(gas_phase_ptr->comps);
|
||||
gas_phase_ptr->comps = this->cxxGasPhaseComp2gas_comp();
|
||||
(struct gas_comp *) P_INSTANCE_POINTER free_check_null(gas_phase_ptr->comps);
|
||||
gas_phase_ptr->comps = this->cxxGasPhaseComp2gas_comp(P_INSTANCE);
|
||||
|
||||
return (gas_phase_ptr);
|
||||
}
|
||||
@ -261,7 +261,7 @@ cxxGasPhase::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
void
|
||||
cxxGasPhase::read_raw(CParser & parser, bool check)
|
||||
cxxGasPhase::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||
{
|
||||
|
||||
int i;
|
||||
@ -361,7 +361,7 @@ cxxGasPhase::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -445,7 +445,7 @@ cxxGasPhase::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
||||
}
|
||||
#endif
|
||||
void
|
||||
cxxGasPhase::totalize()
|
||||
cxxGasPhase::totalize(PHREEQC_PTR_ARG)
|
||||
{
|
||||
this->totals.clear();
|
||||
// component structures
|
||||
@ -454,7 +454,7 @@ cxxGasPhase::totalize()
|
||||
{
|
||||
struct phase *phase_ptr;
|
||||
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)
|
||||
{
|
||||
cxxNameDouble phase_formula(phase_ptr->next_elt);
|
||||
|
||||
10
GasPhase.h
10
GasPhase.h
@ -17,7 +17,7 @@ class cxxGasPhase:public cxxNumKeyword
|
||||
public:
|
||||
cxxGasPhase();
|
||||
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);
|
||||
~cxxGasPhase();
|
||||
|
||||
@ -27,22 +27,22 @@ class cxxGasPhase:public cxxNumKeyword
|
||||
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_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
|
||||
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||
#endif
|
||||
|
||||
void totalize();
|
||||
void totalize(PHREEQC_PTR_ARG);
|
||||
|
||||
const cxxNameDouble & get_totals() const
|
||||
{
|
||||
|
||||
@ -38,7 +38,7 @@ units("mMol/kgw")
|
||||
pes = NULL;
|
||||
}
|
||||
|
||||
cxxISolution::cxxISolution(struct solution *solution_ptr):
|
||||
cxxISolution::cxxISolution(PHREEQC_PTR_ARG_COMMA struct solution *solution_ptr):
|
||||
cxxSolution(solution_ptr)
|
||||
//, pe(cxxPe_Data::alloc())
|
||||
{
|
||||
@ -53,39 +53,39 @@ cxxSolution(solution_ptr)
|
||||
}
|
||||
default_pe = solution_ptr->default_pe;
|
||||
// pe_data
|
||||
pes = pe_data_dup(solution_ptr->pe);
|
||||
pes = P_INSTANCE_POINTER pe_data_dup(solution_ptr->pe);
|
||||
}
|
||||
|
||||
cxxISolution::~cxxISolution()
|
||||
{
|
||||
pe_data_free(this->pes);
|
||||
//// ToDo //pe_data_free(this->pes);
|
||||
}
|
||||
|
||||
struct solution *
|
||||
cxxISolution::cxxISolution2solution()
|
||||
cxxISolution::cxxISolution2solution(PHREEQC_PTR_ARG)
|
||||
//
|
||||
// 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->density = this->density;
|
||||
if (this->units.size() == 0)
|
||||
soln_ptr->units = NULL;
|
||||
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;
|
||||
// pe
|
||||
soln_ptr->pe = (struct pe_data *) pe_data_free(soln_ptr->pe);
|
||||
soln_ptr->pe = pe_data_dup(this->pes);
|
||||
soln_ptr->pe = (struct pe_data *) P_INSTANCE_POINTER pe_data_free(soln_ptr->pe);
|
||||
soln_ptr->pe = P_INSTANCE_POINTER pe_data_dup(this->pes);
|
||||
// totals
|
||||
soln_ptr->totals = (struct conc *) free_check_null(soln_ptr->totals);
|
||||
soln_ptr->totals = cxxISolutionComp::cxxISolutionComp2conc(this->comps);
|
||||
soln_ptr->totals = (struct conc *) P_INSTANCE_POINTER free_check_null(soln_ptr->totals);
|
||||
soln_ptr->totals = cxxISolutionComp::cxxISolutionComp2conc(P_INSTANCE_COMMA this->comps);
|
||||
return (soln_ptr);
|
||||
}
|
||||
|
||||
void
|
||||
cxxISolution::ConvertUnits()
|
||||
cxxISolution::ConvertUnits(PHREEQC_PTR_ARG)
|
||||
//
|
||||
// Converts from input units to moles per kilogram water
|
||||
//
|
||||
@ -96,7 +96,7 @@ cxxISolution::ConvertUnits()
|
||||
this->comps.begin();
|
||||
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))
|
||||
continue;
|
||||
//if (iter->second.get_description() == "H(1)" || iter->second.get_description() == "E") continue;
|
||||
@ -117,7 +117,7 @@ cxxISolution::ConvertUnits()
|
||||
* Convert to moles
|
||||
*/
|
||||
//set gfw for element
|
||||
iter->second.set_gfw();
|
||||
iter->second.set_gfw(P_INSTANCE);
|
||||
// convert to moles
|
||||
if (iter->second.get_units().find("g/") != std::string::npos)
|
||||
{
|
||||
@ -130,7 +130,7 @@ cxxISolution::ConvertUnits()
|
||||
std::ostringstream oss;
|
||||
oss << "Could not find gfw, " << iter->second.
|
||||
get_description();
|
||||
error_msg(oss.str().c_str(), CONTINUE);
|
||||
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||
input_error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ class cxxISolution:public cxxSolution
|
||||
|
||||
public:
|
||||
cxxISolution();
|
||||
cxxISolution(struct solution *);
|
||||
cxxISolution(PHREEQC_PTR_ARG_COMMA struct solution *);
|
||||
//cxxISolution(const cxxISolution&);
|
||||
~cxxISolution();
|
||||
|
||||
@ -28,7 +28,7 @@ class cxxISolution:public cxxSolution
|
||||
|
||||
//void add(cxxISolutionComp conc) { this->concs.push_back(conc); }
|
||||
|
||||
struct solution *cxxISolution2solution();
|
||||
struct solution *cxxISolution2solution(PHREEQC_PTR_ARG);
|
||||
|
||||
double get_density() const
|
||||
{
|
||||
@ -59,7 +59,7 @@ class cxxISolution:public cxxSolution
|
||||
|
||||
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
||||
|
||||
void ConvertUnits();
|
||||
void ConvertUnits(PHREEQC_PTR_ARG);
|
||||
|
||||
#ifdef ORCHESTRA
|
||||
void ORCH_write(std::ostream & chemistry_dat, std::ostream & input_dat,
|
||||
|
||||
@ -59,7 +59,7 @@ cxxKineticsComp::~cxxKineticsComp()
|
||||
}
|
||||
|
||||
struct kinetics_comp *
|
||||
cxxKineticsComp::cxxKineticsComp2kinetics_comp(std::map < std::string, cxxKineticsComp >
|
||||
cxxKineticsComp::cxxKineticsComp2kinetics_comp(PHREEQC_PTR_ARG_COMMA std::map < std::string, cxxKineticsComp >
|
||||
&el)
|
||||
//
|
||||
// Builds kinetics_comp structure from of cxxKineticsComp
|
||||
@ -69,7 +69,7 @@ struct kinetics_comp *
|
||||
(struct kinetics_comp *)
|
||||
PHRQ_malloc((size_t) (el.size() * sizeof(struct kinetics_comp)));
|
||||
if (kinetics_comp_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
|
||||
int i = 0;
|
||||
for (std::map < std::string, cxxKineticsComp >::iterator it = el.begin();
|
||||
@ -78,8 +78,8 @@ struct kinetics_comp *
|
||||
if ((*it).second.rate_name.size() == 0)
|
||||
kinetics_comp_ptr[i].rate_name = NULL;
|
||||
else
|
||||
kinetics_comp_ptr[i].rate_name = string_hsave((*it).second.rate_name.c_str());
|
||||
kinetics_comp_ptr[i].list = (*it).second.namecoef.name_coef();
|
||||
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(P_INSTANCE);
|
||||
kinetics_comp_ptr[i].count_list = (int) (*it).second.namecoef.size();
|
||||
kinetics_comp_ptr[i].tol = (*it).second.tol;
|
||||
kinetics_comp_ptr[i].m = (*it).second.m;
|
||||
@ -100,7 +100,7 @@ struct kinetics_comp *
|
||||
kinetics_comp_ptr[i].d_params = (double *)
|
||||
PHRQ_malloc((size_t) ((*it).second.d_params.size() * sizeof(double)));
|
||||
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(),
|
||||
kinetics_comp_ptr[i].d_params);
|
||||
}
|
||||
@ -205,7 +205,7 @@ cxxKineticsComp::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
void
|
||||
cxxKineticsComp::read_raw(CParser & parser, bool check)
|
||||
cxxKineticsComp::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||
{
|
||||
std::string str;
|
||||
double d;
|
||||
@ -321,7 +321,7 @@ cxxKineticsComp::read_raw(CParser & parser, bool check)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
|
||||
@ -17,13 +17,13 @@ public:
|
||||
cxxKineticsComp(struct kinetics_comp *);
|
||||
~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_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
|
||||
{
|
||||
|
||||
@ -157,7 +157,7 @@ cxxNameDouble::elt_list(PHREEQC_PTR_ARG)
|
||||
}
|
||||
|
||||
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
|
||||
//
|
||||
@ -180,7 +180,7 @@ cxxNameDouble::master_activity() const
|
||||
for (const_iterator it = (*this).begin(); it != (*this).end();
|
||||
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;
|
||||
i++;
|
||||
}
|
||||
@ -197,11 +197,11 @@ cxxNameDouble::master_activity() const
|
||||
(((*this).size()) *
|
||||
sizeof(struct master_activity)));
|
||||
if (master_activity_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
for (const_iterator it = (*this).begin(); it != (*this).end();
|
||||
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;
|
||||
i++;
|
||||
}
|
||||
@ -216,7 +216,7 @@ cxxNameDouble::master_activity() const
|
||||
}
|
||||
|
||||
struct conc *
|
||||
cxxNameDouble::conc() const
|
||||
cxxNameDouble::conc(PHREEQC_PTR_ARG) const
|
||||
// for Solutions, not ISolutions
|
||||
// takes a map of (elt name, moles)
|
||||
// returns list of conc structures
|
||||
@ -226,11 +226,11 @@ cxxNameDouble::conc() const
|
||||
c = (struct conc *)
|
||||
PHRQ_malloc((size_t) (((*this).size() + 1) * sizeof(struct conc)));
|
||||
if (c == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
int i = 0;
|
||||
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].input_conc = it->second;
|
||||
c[i].units = NULL;
|
||||
@ -248,7 +248,7 @@ cxxNameDouble::conc() const
|
||||
}
|
||||
|
||||
struct name_coef *
|
||||
cxxNameDouble::name_coef() const
|
||||
cxxNameDouble::name_coef(PHREEQC_PTR_ARG) const
|
||||
//
|
||||
// Builds a name_coef structure from instance of cxxNameDouble
|
||||
//
|
||||
@ -258,11 +258,11 @@ cxxNameDouble::name_coef() const
|
||||
(struct name_coef *)
|
||||
PHRQ_malloc((size_t) ((this->size()) * sizeof(struct name_coef)));
|
||||
if (name_coef_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
int i = 0;
|
||||
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;
|
||||
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::string token;
|
||||
@ -353,7 +353,7 @@ CParser::STATUS_TYPE cxxNameDouble::read_raw(CParser & parser,
|
||||
{
|
||||
return CParser::PARSER_ERROR;
|
||||
}
|
||||
ctoken = string_hsave(token.c_str());
|
||||
ctoken = P_INSTANCE_POINTER string_hsave(token.c_str());
|
||||
(*this)[ctoken] = d;
|
||||
return CParser::PARSER_OK;
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include <list> // std::list
|
||||
#include <vector> // std::vector
|
||||
#include "Phreeqc_class.h"
|
||||
class Phreeqc;
|
||||
#include "Parser.h"
|
||||
|
||||
class cxxNameDouble:public
|
||||
@ -37,13 +38,13 @@ class cxxNameDouble:public
|
||||
elt_list(PHREEQC_PTR_ARG);
|
||||
|
||||
struct master_activity *
|
||||
master_activity() const;
|
||||
master_activity(PHREEQC_PTR_ARG) const;
|
||||
|
||||
struct conc *
|
||||
conc() const;
|
||||
conc(PHREEQC_PTR_ARG) const;
|
||||
|
||||
struct name_coef *
|
||||
name_coef() const;
|
||||
name_coef(PHREEQC_PTR_ARG) const;
|
||||
|
||||
void
|
||||
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;
|
||||
|
||||
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
|
||||
add_extensive(const cxxNameDouble & old, double factor);
|
||||
|
||||
@ -53,7 +53,7 @@ eltList(pp_assemblage_ptr->next_elt)
|
||||
this->ppAssemblageComps[str] = ppComp;
|
||||
}
|
||||
}
|
||||
cxxPPassemblage::cxxPPassemblage(const std::map < int,
|
||||
cxxPPassemblage::cxxPPassemblage(PHREEQC_PTR_ARG_COMMA const std::map < int,
|
||||
cxxPPassemblage > &entities, cxxMix & mix,
|
||||
int n_user):
|
||||
cxxNumKeyword()
|
||||
@ -71,7 +71,7 @@ cxxNumKeyword()
|
||||
{
|
||||
const cxxPPassemblage *entity_ptr =
|
||||
&(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 *
|
||||
cxxPPassemblage::cxxPPassemblage2pp_assemblage()
|
||||
cxxPPassemblage::cxxPPassemblage2pp_assemblage(PHREEQC_PTR_ARG)
|
||||
//
|
||||
// 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->n_user = this->n_user;
|
||||
@ -94,10 +94,10 @@ cxxPPassemblage::cxxPPassemblage2pp_assemblage()
|
||||
pp_assemblage_ptr->new_def = FALSE;
|
||||
pp_assemblage_ptr->count_comps = (int) this->ppAssemblageComps.size();
|
||||
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 =
|
||||
cxxPPassemblageComp::cxxPPassemblageComp2pure_phase(this->ppAssemblageComps);
|
||||
pp_assemblage_ptr->next_elt = this->eltList.elt_list();
|
||||
cxxPPassemblageComp::cxxPPassemblageComp2pure_phase(P_INSTANCE_COMMA this->ppAssemblageComps);
|
||||
pp_assemblage_ptr->next_elt = this->eltList.elt_list(P_INSTANCE);
|
||||
return (pp_assemblage_ptr);
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ cxxPPassemblage::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
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;
|
||||
if (vopts.empty())
|
||||
@ -221,7 +221,7 @@ cxxPPassemblage::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -340,21 +340,21 @@ cxxPPassemblage::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
||||
#endif
|
||||
|
||||
void
|
||||
cxxPPassemblage::totalize()
|
||||
cxxPPassemblage::totalize(PHREEQC_PTR_ARG)
|
||||
{
|
||||
this->totals.clear();
|
||||
// component structures
|
||||
for (std::map < std::string, cxxPPassemblageComp >::iterator 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);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
//
|
||||
@ -372,7 +372,7 @@ cxxPPassemblage::add(const cxxPPassemblage & addee, double extensive)
|
||||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -17,17 +17,17 @@ class cxxPPassemblage:public cxxNumKeyword
|
||||
public:
|
||||
cxxPPassemblage();
|
||||
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);
|
||||
~cxxPPassemblage();
|
||||
|
||||
struct pp_assemblage *cxxPPassemblage2pp_assemblage();
|
||||
struct pp_assemblage *cxxPPassemblage2pp_assemblage(PHREEQC_PTR_ARG);
|
||||
|
||||
struct pure_phase *cxxPPassemblageComp2pure_phase();
|
||||
|
||||
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
|
||||
{
|
||||
@ -39,7 +39,7 @@ class cxxPPassemblage:public cxxNumKeyword
|
||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||
#endif
|
||||
|
||||
void totalize();
|
||||
void totalize(PHREEQC_PTR_ARG);
|
||||
#ifdef ORCHESTRA
|
||||
void ORCH_write_chemistry(std::ostream & chemistry_dat);
|
||||
void ORCH_write_output_vars(std::ostream & outstream);
|
||||
@ -51,7 +51,7 @@ class cxxPPassemblage:public cxxNumKeyword
|
||||
#endif
|
||||
|
||||
private:
|
||||
void add(const cxxPPassemblage & addee, double extensive);
|
||||
void add(PHREEQC_PTR_ARG_COMMA const cxxPPassemblage & addee, double extensive);
|
||||
// not written
|
||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||
|
||||
|
||||
@ -60,14 +60,14 @@ cxxPPassemblageComp::~cxxPPassemblageComp()
|
||||
}
|
||||
|
||||
struct phase *
|
||||
cxxPPassemblageComp::get_phase()
|
||||
cxxPPassemblageComp::get_phase(PHREEQC_PTR_ARG)
|
||||
{
|
||||
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 *
|
||||
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
|
||||
//
|
||||
@ -76,21 +76,21 @@ struct pure_phase *
|
||||
(struct pure_phase *)
|
||||
PHRQ_malloc((size_t) (el.size() * sizeof(struct pure_phase)));
|
||||
if (pure_phase_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
|
||||
int i = 0;
|
||||
for (std::map < std::string, cxxPPassemblageComp >::iterator it = el.begin();
|
||||
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)
|
||||
pure_phase_ptr[i].name = NULL;
|
||||
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)
|
||||
pure_phase_ptr[i].add_formula = NULL;
|
||||
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].moles = (*it).second.moles;
|
||||
pure_phase_ptr[i].delta = (*it).second.delta;
|
||||
@ -437,7 +437,7 @@ cxxPPassemblageComp::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
||||
#endif
|
||||
|
||||
void
|
||||
cxxPPassemblageComp::totalize()
|
||||
cxxPPassemblageComp::totalize(PHREEQC_PTR_ARG)
|
||||
{
|
||||
this->totals.clear();
|
||||
// component structures
|
||||
@ -445,7 +445,7 @@ cxxPPassemblageComp::totalize()
|
||||
return;
|
||||
struct phase *phase_ptr;
|
||||
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)
|
||||
{
|
||||
cxxNameDouble phase_formula(phase_ptr->next_elt);
|
||||
@ -460,7 +460,7 @@ cxxPPassemblageComp::totalize()
|
||||
|
||||
|
||||
void
|
||||
cxxPPassemblageComp::add(const cxxPPassemblageComp & addee, double extensive)
|
||||
cxxPPassemblageComp::add(PHREEQC_PTR_ARG_COMMA const cxxPPassemblageComp & addee, double extensive)
|
||||
{
|
||||
double ext1, ext2, f1, f2;
|
||||
if (extensive == 0.0)
|
||||
@ -496,7 +496,7 @@ cxxPPassemblageComp::add(const cxxPPassemblageComp & addee, double extensive)
|
||||
oss <<
|
||||
"Can not mix two Equilibrium_phases with differing add_formulae., "
|
||||
<< this->name;
|
||||
error_msg(oss.str().c_str(), CONTINUE);
|
||||
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||
input_error++;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ class 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;
|
||||
|
||||
@ -48,15 +48,15 @@ class cxxPPassemblageComp
|
||||
else
|
||||
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
|
||||
{
|
||||
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);
|
||||
|
||||
#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_solution(int k);
|
||||
int dump_surface(int k);
|
||||
int dump_cpp(void);
|
||||
|
||||
int read_line_LDBLEs(char *next_char, LDBLE ** d, int *count_d,
|
||||
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_init(struct copier *copier_ptr);
|
||||
CLASS_STATIC int element_compare(const void *ptr1, const void *ptr2);
|
||||
struct element *element_store(const char *element);
|
||||
int elt_list_combine(void);
|
||||
CLASS_STATIC int elt_list_compare(const void *ptr1, const void *ptr2);
|
||||
public:
|
||||
struct element *element_store(const char *element);
|
||||
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);
|
||||
int elt_list_print(struct elt_list *elt_list_ptr);
|
||||
struct elt_list *elt_list_save(void);
|
||||
struct exchange *exchange_alloc(void);
|
||||
struct exchange *exchange_bsearch(int k, int *n);
|
||||
public:
|
||||
struct exchange *exchange_alloc(void);
|
||||
struct exchange *exchange_bsearch(int k, int *n);
|
||||
private:
|
||||
int exchange_comp_compare(const void *ptr1, const void *ptr2);
|
||||
void exchange_comp_init(struct exch_comp *exch_comp_ptr);
|
||||
int exchange_copy(struct exchange *exchange_old_ptr,
|
||||
struct exchange *exchange_new_ptr, int n_user_new);
|
||||
public:
|
||||
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);
|
||||
int exchange_copy_to_last(int n, int n_user);
|
||||
int exchange_delete(int n_user_old);
|
||||
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,
|
||||
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);
|
||||
struct exchange *exchange_replicate(struct exchange *exchange_old_ptr,
|
||||
int n_user_new);
|
||||
struct exchange *exchange_search(int n_user, int *n, int print);
|
||||
int exchange_sort(void);
|
||||
CLASS_STATIC int gas_comp_compare(const void *ptr1, const void *ptr2);
|
||||
struct gas_phase *gas_phase_alloc(void);
|
||||
struct gas_phase *gas_phase_bsearch(int k, int *n);
|
||||
public:
|
||||
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);
|
||||
public:
|
||||
int gas_phase_copy(struct gas_phase *gas_phase_old_ptr,
|
||||
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_delete(int n_user_old);
|
||||
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 n_user_end, char *description);
|
||||
public:
|
||||
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 n_user_new);
|
||||
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);
|
||||
struct irrev *irrev_search(int n_user, int *n);
|
||||
int irrev_sort(void);
|
||||
struct kinetics *kinetics_alloc(void);
|
||||
struct kinetics *kinetics_bsearch(int k, int *n);
|
||||
public:
|
||||
struct kinetics *kinetics_alloc(void);
|
||||
struct kinetics *kinetics_bsearch(int k, int *n);
|
||||
private:
|
||||
int kinetics_delete(int n_user_old);
|
||||
int kinetics_comp_duplicate(struct kinetics_comp *kinetics_comp_new_ptr,
|
||||
struct kinetics_comp *kinetics_comp_old_ptr);
|
||||
CLASS_STATIC int kinetics_compare(const void *ptr1, const void *ptr2);
|
||||
public:
|
||||
int kinetics_copy(struct kinetics *kinetics_old_ptr,
|
||||
struct kinetics *kinetics_new_ptr, int n_user_new);
|
||||
private:
|
||||
int kinetics_copy_to_last(int n, int n_user);
|
||||
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,
|
||||
char *description);
|
||||
public:
|
||||
int kinetics_free(struct kinetics *kinetics_ptr);
|
||||
private:
|
||||
int kinetics_ptr_to_user(struct kinetics *kinetics_ptr_old, int n_user_new);
|
||||
struct kinetics *kinetics_replicate(struct kinetics *kinetics_old_ptr,
|
||||
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);
|
||||
int mix_sort(void);
|
||||
struct pe_data *pe_data_alloc(void);
|
||||
struct pe_data *pe_data_dup(struct pe_data *pe_ptr_old);
|
||||
struct pe_data *pe_data_free(struct pe_data *pe_data_ptr);
|
||||
public:
|
||||
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);
|
||||
public:
|
||||
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);
|
||||
int phase_delete(int i);
|
||||
struct phase *phase_store(char *name);
|
||||
public:
|
||||
struct pp_assemblage *pp_assemblage_alloc(void);
|
||||
struct pp_assemblage *pp_assemblage_bsearch(int k, int *n);
|
||||
private:
|
||||
CLASS_STATIC int pp_assemblage_compare(const void *ptr1, const void *ptr2);
|
||||
public:
|
||||
int pp_assemblage_copy(struct pp_assemblage *pp_assemblage_old_ptr,
|
||||
struct pp_assemblage *pp_assemblage_new_ptr,
|
||||
int n_user_new);
|
||||
private:
|
||||
int pp_assemblage_copy_to_last(int n, int n_user);
|
||||
int pp_assemblage_delete(int n_user_old);
|
||||
int pp_assemblage_duplicate(int n_user_old, int n_user_new);
|
||||
public:
|
||||
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 n_user_end, char *description);
|
||||
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);
|
||||
public:
|
||||
struct s_s_assemblage *s_s_assemblage_alloc(void);
|
||||
struct s_s_assemblage *s_s_assemblage_bsearch(int k, int *n);
|
||||
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);
|
||||
|
||||
int s_s_assemblage_copy(struct s_s_assemblage *s_s_assemblage_old_ptr,
|
||||
public:
|
||||
int s_s_assemblage_copy(struct s_s_assemblage *s_s_assemblage_old_ptr,
|
||||
struct s_s_assemblage *s_s_assemblage_new_ptr,
|
||||
int n_user_new);
|
||||
private:
|
||||
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_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 n_user, int n_user_end, char *description);
|
||||
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);
|
||||
public:
|
||||
struct solution *solution_alloc(void);
|
||||
struct solution *solution_bsearch(int k, int *n, int print);
|
||||
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 solution_copy_to_last(int n, 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);
|
||||
public:
|
||||
struct surface *surface_alloc(void);
|
||||
struct surface *surface_bsearch(int k, int *n);
|
||||
private:
|
||||
struct surface *surface_bsearch(int k, int *n);
|
||||
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_charge_compare(const void *ptr1, const void *ptr2);
|
||||
struct surface_charge * surface_charge_duplicate(struct surface_charge *charge_old_ptr);
|
||||
int surface_charge_free(struct surface_charge *charge);
|
||||
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);
|
||||
private:
|
||||
int surface_copy_to_last(int n, int n_user);
|
||||
int surface_delete(int n_user_old);
|
||||
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,
|
||||
char *description);
|
||||
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 -------------------------------
|
||||
|
||||
public:
|
||||
int add_elt_list(struct elt_list *elt_list_ptr, LDBLE coef);
|
||||
private:
|
||||
int backspace_screen(int spaces);
|
||||
LDBLE calc_alk(struct reaction *rxn_ptr);
|
||||
public:
|
||||
|
||||
@ -91,7 +91,7 @@ cxxReaction::cxxReaction2irrev(PHREEQC_PTR_ARG)
|
||||
irrev_ptr->n_user = this->n_user;
|
||||
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();
|
||||
if (this->elementList.size() > 0)
|
||||
{
|
||||
@ -223,7 +223,7 @@ cxxReaction::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
void
|
||||
cxxReaction::read_raw(CParser & parser)
|
||||
cxxReaction::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
{
|
||||
|
||||
int j;
|
||||
@ -296,7 +296,7 @@ cxxReaction::read_raw(CParser & parser)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -308,7 +308,7 @@ cxxReaction::read_raw(CParser & parser)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
|
||||
@ -24,7 +24,7 @@ class cxxReaction:public cxxNumKeyword
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#else
|
||||
#include "Phreeqc.h"
|
||||
#endif
|
||||
#include "Phreeqc_class.h"
|
||||
#include "Parser.h"
|
||||
#include "Solution.h"
|
||||
#include "Exchange.h"
|
||||
@ -102,8 +103,8 @@ read_solution_raw(void)
|
||||
|
||||
|
||||
cxxSolution sol;
|
||||
sol.read_raw(parser);
|
||||
struct solution *soln_ptr = sol.cxxSolution2solution();
|
||||
sol.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct solution *soln_ptr = sol.cxxSolution2solution(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -194,8 +195,8 @@ read_exchange_raw(void)
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxExchange ex;
|
||||
ex.read_raw(parser);
|
||||
struct exchange *exchange_ptr = ex.cxxExchange2exchange();
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct exchange *exchange_ptr = ex.cxxExchange2exchange(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -288,8 +289,8 @@ read_surface_raw(void)
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxSurface ex;
|
||||
ex.read_raw(parser);
|
||||
struct surface *surface_ptr = ex.cxxSurface2surface();
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct surface *surface_ptr = ex.cxxSurface2surface(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -383,8 +384,8 @@ read_equilibrium_phases_raw(void)
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxPPassemblage ex;
|
||||
ex.read_raw(parser);
|
||||
struct pp_assemblage *pp_assemblage_ptr = ex.cxxPPassemblage2pp_assemblage();
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct pp_assemblage *pp_assemblage_ptr = ex.cxxPPassemblage2pp_assemblage(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -479,8 +480,8 @@ read_kinetics_raw(void)
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxKinetics ex;
|
||||
ex.read_raw(parser);
|
||||
struct kinetics *kinetics_ptr = ex.cxxKinetics2kinetics();
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct kinetics *kinetics_ptr = ex.cxxKinetics2kinetics(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -574,9 +575,8 @@ read_solid_solutions_raw(void)
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxSSassemblage ex;
|
||||
ex.read_raw(parser);
|
||||
struct s_s_assemblage *s_s_assemblage_ptr =
|
||||
ex.cxxSSassemblage2s_s_assemblage();
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct s_s_assemblage *s_s_assemblage_ptr = ex.cxxSSassemblage2s_s_assemblage(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -672,8 +672,8 @@ read_gas_phase_raw(void)
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxGasPhase ex;
|
||||
ex.read_raw(parser);
|
||||
struct gas_phase *gas_phase_ptr = ex.cxxGasPhase2gas_phase();
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct gas_phase *gas_phase_ptr = ex.cxxGasPhase2gas_phase(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -766,8 +766,8 @@ read_reaction_raw(void)
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxReaction ex;
|
||||
ex.read_raw(parser);
|
||||
struct irrev *irrev_ptr = ex.cxxReaction2irrev();
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct irrev *irrev_ptr = ex.cxxReaction2irrev(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -862,7 +862,7 @@ read_mix_raw(void)
|
||||
|
||||
cxxMix ex;
|
||||
ex.read_raw(parser);
|
||||
struct mix *mix_ptr = ex.cxxMix2mix();
|
||||
struct mix *mix_ptr = ex.cxxMix2mix(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -958,7 +958,7 @@ read_temperature_raw(void)
|
||||
|
||||
cxxTemperature ex;
|
||||
ex.read_raw(parser);
|
||||
struct temperature *temperature_ptr = ex.cxxTemperature2temperature();
|
||||
struct temperature *temperature_ptr = ex.cxxTemperature2temperature(PHREEQC_THIS);
|
||||
int n;
|
||||
|
||||
/*
|
||||
@ -1219,9 +1219,9 @@ read_solution_modify(void)
|
||||
}
|
||||
|
||||
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
|
||||
@ -1306,10 +1306,10 @@ read_equilibrium_phases_modify(void)
|
||||
|
||||
// read entity
|
||||
cxxPPassemblage entity(&(pp_assemblage[n]));
|
||||
entity.read_raw(parser, false);
|
||||
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
|
||||
// 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_copy(entity_ptr, &(pp_assemblage[n]), entity_ptr->n_user);
|
||||
free_check_null(pp_assemblage[n].description);
|
||||
@ -1394,10 +1394,10 @@ read_exchange_modify(void)
|
||||
|
||||
// read entity
|
||||
cxxExchange entity(&(exchange[n]));
|
||||
entity.read_raw(parser, false);
|
||||
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
|
||||
// save entity
|
||||
struct exchange *entity_ptr = entity.cxxExchange2exchange();
|
||||
struct exchange *entity_ptr = entity.cxxExchange2exchange(PHREEQC_THIS);
|
||||
exchange_free(&(exchange[n]));
|
||||
exchange_copy(entity_ptr, &(exchange[n]), entity_ptr->n_user);
|
||||
free_check_null(exchange[n].description);
|
||||
@ -1482,10 +1482,10 @@ read_surface_modify(void)
|
||||
|
||||
// read entity
|
||||
cxxSurface entity(&(surface[n]));
|
||||
entity.read_raw(parser, false);
|
||||
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
|
||||
// save entity
|
||||
struct surface *entity_ptr = entity.cxxSurface2surface();
|
||||
struct surface *entity_ptr = entity.cxxSurface2surface(PHREEQC_THIS);
|
||||
surface_free(&(surface[n]));
|
||||
surface_copy(entity_ptr, &(surface[n]), entity_ptr->n_user);
|
||||
free_check_null(surface[n].description);
|
||||
@ -1569,10 +1569,10 @@ read_solid_solutions_modify(void)
|
||||
|
||||
// read entity
|
||||
cxxSSassemblage entity(&(s_s_assemblage[n]));
|
||||
entity.read_raw(parser, false);
|
||||
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
|
||||
// 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_copy(entity_ptr, &(s_s_assemblage[n]), entity_ptr->n_user);
|
||||
free_check_null(s_s_assemblage[n].description);
|
||||
@ -1655,9 +1655,9 @@ read_gas_phase_modify(void)
|
||||
|
||||
// read entity
|
||||
cxxGasPhase entity(&(gas_phase[n]));
|
||||
entity.read_raw(parser, false);
|
||||
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
// 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_copy(entity_ptr, &(gas_phase[n]), entity_ptr->n_user);
|
||||
free_check_null(gas_phase[n].description);
|
||||
@ -1741,10 +1741,10 @@ read_kinetics_modify(void)
|
||||
|
||||
// read entity
|
||||
cxxKinetics entity(&(kinetics[n]));
|
||||
entity.read_raw(parser, false);
|
||||
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
|
||||
// save entity
|
||||
struct kinetics *entity_ptr = entity.cxxKinetics2kinetics();
|
||||
struct kinetics *entity_ptr = entity.cxxKinetics2kinetics(PHREEQC_THIS);
|
||||
kinetics_free(&(kinetics[n]));
|
||||
kinetics_copy(entity_ptr, &(kinetics[n]), entity_ptr->n_user);
|
||||
free_check_null(kinetics[n].description);
|
||||
|
||||
@ -158,7 +158,7 @@ cxxSSassemblage::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
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;
|
||||
if (vopts.empty())
|
||||
@ -240,7 +240,7 @@ cxxSSassemblage::read_raw(CParser & parser, bool check)
|
||||
}
|
||||
#endif
|
||||
parser.set_accumulate(true);
|
||||
ec.read_raw(parser, false);
|
||||
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||
parser.set_accumulate(false);
|
||||
std::istringstream is(parser.get_accumulated());
|
||||
CParser reread(is);
|
||||
@ -249,12 +249,12 @@ cxxSSassemblage::read_raw(CParser & parser, bool check)
|
||||
if (this->ssAssemblageSSs.find(ec.get_name()) != this->ssAssemblageSSs.end())
|
||||
{
|
||||
cxxSSassemblageSS & ec1 = this->ssAssemblageSSs.find(ec.get_name())->second;
|
||||
ec1.read_raw(reread, false);
|
||||
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
cxxSSassemblageSS ec1;
|
||||
ec1.read_raw(reread, false);
|
||||
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
std::string str(ec1.get_name());
|
||||
this->ssAssemblageSSs[str] = ec1;
|
||||
}
|
||||
|
||||
@ -34,13 +34,13 @@ public:
|
||||
|
||||
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
|
||||
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||
#endif
|
||||
void totalize();
|
||||
void totalize(PHREEQC_PTR_ARG);
|
||||
|
||||
const cxxNameDouble & get_totals() const
|
||||
{
|
||||
|
||||
@ -217,7 +217,7 @@ cxxSSassemblageSS::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
void
|
||||
cxxSSassemblageSS::read_raw(CParser & parser, bool check)
|
||||
cxxSSassemblageSS::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
@ -333,7 +333,7 @@ cxxSSassemblageSS::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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.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 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
|
||||
{
|
||||
|
||||
14
Solution.cxx
14
Solution.cxx
@ -306,18 +306,18 @@ cxxSolution::cxxSolution2solution(PHREEQC_PTR_ARG)
|
||||
// totals
|
||||
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
|
||||
solution_ptr->master_activity =
|
||||
(struct master_activity *) P_INSTANCE_POINTER free_check_null(solution_ptr->
|
||||
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 =
|
||||
(int) this->master_activity.size() + 1;
|
||||
|
||||
// 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();
|
||||
|
||||
// isotopes
|
||||
@ -557,7 +557,7 @@ cxxSolution::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
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;
|
||||
if (vopts.empty())
|
||||
@ -629,7 +629,7 @@ cxxSolution::read_raw(CParser & parser, bool check)
|
||||
continue;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -641,7 +641,7 @@ cxxSolution::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -654,7 +654,7 @@ cxxSolution::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
|
||||
@ -152,7 +152,7 @@ class cxxSolution:public cxxNumKeyword
|
||||
|
||||
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);
|
||||
#ifdef ORCHESTRA
|
||||
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;
|
||||
};
|
||||
void
|
||||
cxxStorageBin::import_phreeqc(void)
|
||||
cxxStorageBin::import_phreeqc(PHREEQC_PTR_ARG)
|
||||
//
|
||||
// pull data out of c storage
|
||||
//
|
||||
@ -380,65 +380,65 @@ cxxStorageBin::import_phreeqc(void)
|
||||
int i;
|
||||
|
||||
// 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
|
||||
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
|
||||
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
|
||||
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
|
||||
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] =
|
||||
cxxPPassemblage(&pp_assemblage[i]);
|
||||
PPassemblages[P_INSTANCE_POINTER pp_assemblage[i].n_user] =
|
||||
cxxPPassemblage(&P_INSTANCE_POINTER pp_assemblage[i]);
|
||||
}
|
||||
|
||||
// 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] =
|
||||
cxxSSassemblage(&s_s_assemblage[i]);
|
||||
SSassemblages[P_INSTANCE_POINTER s_s_assemblage[i].n_user] =
|
||||
cxxSSassemblage(&P_INSTANCE_POINTER s_s_assemblage[i]);
|
||||
}
|
||||
|
||||
// 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
|
||||
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
|
||||
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
|
||||
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
|
||||
cxxStorageBin::read_raw(CParser & parser)
|
||||
cxxStorageBin::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
{
|
||||
CParser::LINE_TYPE i;
|
||||
while ((i =
|
||||
@ -593,7 +593,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
||||
case CParser::KT_SOLUTION_RAW:
|
||||
{
|
||||
cxxSolution entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Solutions[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
@ -601,7 +601,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
||||
case CParser::KT_EXCHANGE_RAW:
|
||||
{
|
||||
cxxExchange entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Exchangers[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
@ -609,7 +609,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
||||
case CParser::KT_GASPHASE_RAW:
|
||||
{
|
||||
cxxGasPhase entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
GasPhases[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
@ -617,7 +617,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
||||
case CParser::KT_KINETICS_RAW:
|
||||
{
|
||||
cxxKinetics entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Kinetics[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
@ -625,7 +625,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
||||
case CParser::KT_PPASSEMBLAGE_RAW:
|
||||
{
|
||||
cxxPPassemblage entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
PPassemblages[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
@ -633,7 +633,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
||||
case CParser::KT_SSASSEMBLAGE_RAW:
|
||||
{
|
||||
cxxSSassemblage entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
SSassemblages[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
@ -641,7 +641,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
||||
case CParser::KT_SURFACE_RAW:
|
||||
{
|
||||
cxxSurface entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Surfaces[entity.get_n_user()] = entity;
|
||||
}
|
||||
break;
|
||||
@ -656,7 +656,7 @@ cxxStorageBin::read_raw(CParser & parser)
|
||||
}
|
||||
|
||||
int
|
||||
cxxStorageBin::read_raw_keyword(CParser & parser)
|
||||
cxxStorageBin::read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
{
|
||||
CParser::LINE_TYPE i;
|
||||
int entity_number = -999;
|
||||
@ -687,7 +687,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
||||
case CParser::KT_SOLUTION_RAW:
|
||||
{
|
||||
cxxSolution entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Solutions[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
@ -696,7 +696,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
||||
case CParser::KT_EXCHANGE_RAW:
|
||||
{
|
||||
cxxExchange entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Exchangers[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
@ -705,7 +705,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
||||
case CParser::KT_GASPHASE_RAW:
|
||||
{
|
||||
cxxGasPhase entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
GasPhases[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
@ -714,7 +714,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
||||
case CParser::KT_KINETICS_RAW:
|
||||
{
|
||||
cxxKinetics entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Kinetics[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
@ -723,7 +723,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
||||
case CParser::KT_PPASSEMBLAGE_RAW:
|
||||
{
|
||||
cxxPPassemblage entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
PPassemblages[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
@ -732,7 +732,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
||||
case CParser::KT_SSASSEMBLAGE_RAW:
|
||||
{
|
||||
cxxSSassemblage entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
SSassemblages[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
@ -741,7 +741,7 @@ cxxStorageBin::read_raw_keyword(CParser & parser)
|
||||
case CParser::KT_SURFACE_RAW:
|
||||
{
|
||||
cxxSurface entity;
|
||||
entity.read_raw(parser);
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Surfaces[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
}
|
||||
@ -811,7 +811,7 @@ cxxStorageBin::add(struct system *system_ptr)
|
||||
}
|
||||
|
||||
void
|
||||
cxxStorageBin::cxxStorageBin2phreeqc(int n)
|
||||
cxxStorageBin::cxxStorageBin2phreeqc(PHREEQC_PTR_ARG_COMMA int n)
|
||||
//
|
||||
// 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);
|
||||
if (it != this->Solutions.end())
|
||||
{
|
||||
solution[0] = (it->second).cxxSolution2solution();
|
||||
solution[0]->n_user = n;
|
||||
solution[0]->n_user_end = n;
|
||||
count_solution++;
|
||||
P_INSTANCE_POINTER solution[0] = (it->second).cxxSolution2solution(P_INSTANCE);
|
||||
P_INSTANCE_POINTER solution[0]->n_user = n;
|
||||
P_INSTANCE_POINTER solution[0]->n_user_end = n;
|
||||
P_INSTANCE_POINTER count_solution++;
|
||||
}
|
||||
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())
|
||||
{
|
||||
struct exchange *exchange_ptr =
|
||||
(it->second).cxxExchange2exchange();
|
||||
exchange_copy(exchange_ptr, &exchange[0], n);
|
||||
count_exchange++;
|
||||
exchange_free(exchange_ptr);
|
||||
exchange_ptr = (struct exchange *) free_check_null(exchange_ptr);
|
||||
(it->second).cxxExchange2exchange(P_INSTANCE);
|
||||
P_INSTANCE_POINTER exchange_copy(exchange_ptr, &P_INSTANCE_POINTER exchange[0], n);
|
||||
P_INSTANCE_POINTER count_exchange++;
|
||||
P_INSTANCE_POINTER exchange_free(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())
|
||||
{
|
||||
struct gas_phase *gas_phase_ptr =
|
||||
(it->second).cxxGasPhase2gas_phase();
|
||||
gas_phase_copy(gas_phase_ptr, &gas_phase[0], n);
|
||||
count_gas_phase++;
|
||||
gas_phase_free(gas_phase_ptr);
|
||||
(it->second).cxxGasPhase2gas_phase(P_INSTANCE);
|
||||
P_INSTANCE_POINTER gas_phase_copy(gas_phase_ptr, &P_INSTANCE_POINTER gas_phase[0], n);
|
||||
P_INSTANCE_POINTER count_gas_phase++;
|
||||
P_INSTANCE_POINTER gas_phase_free(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())
|
||||
{
|
||||
struct kinetics *kinetics_ptr =
|
||||
(it->second).cxxKinetics2kinetics();
|
||||
kinetics_copy(kinetics_ptr, &kinetics[0], n);
|
||||
count_kinetics++;
|
||||
kinetics_free(kinetics_ptr);
|
||||
kinetics_ptr = (struct kinetics *) free_check_null(kinetics_ptr);
|
||||
(it->second).cxxKinetics2kinetics(P_INSTANCE);
|
||||
P_INSTANCE_POINTER kinetics_copy(kinetics_ptr, &P_INSTANCE_POINTER kinetics[0], n);
|
||||
P_INSTANCE_POINTER count_kinetics++;
|
||||
P_INSTANCE_POINTER kinetics_free(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())
|
||||
{
|
||||
struct pp_assemblage *pp_assemblage_ptr =
|
||||
(it->second).cxxPPassemblage2pp_assemblage();
|
||||
pp_assemblage_copy(pp_assemblage_ptr, &pp_assemblage[0], n);
|
||||
count_pp_assemblage++;
|
||||
pp_assemblage_free(pp_assemblage_ptr);
|
||||
(it->second).cxxPPassemblage2pp_assemblage(P_INSTANCE);
|
||||
P_INSTANCE_POINTER pp_assemblage_copy(pp_assemblage_ptr, &P_INSTANCE_POINTER pp_assemblage[0], n);
|
||||
P_INSTANCE_POINTER count_pp_assemblage++;
|
||||
P_INSTANCE_POINTER pp_assemblage_free(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())
|
||||
{
|
||||
struct s_s_assemblage *s_s_assemblage_ptr =
|
||||
(it->second).cxxSSassemblage2s_s_assemblage();
|
||||
s_s_assemblage_copy(s_s_assemblage_ptr, &s_s_assemblage[0], n);
|
||||
count_s_s_assemblage++;
|
||||
s_s_assemblage_free(s_s_assemblage_ptr);
|
||||
(it->second).cxxSSassemblage2s_s_assemblage(P_INSTANCE);
|
||||
P_INSTANCE_POINTER s_s_assemblage_copy(s_s_assemblage_ptr, &P_INSTANCE_POINTER s_s_assemblage[0], n);
|
||||
P_INSTANCE_POINTER count_s_s_assemblage++;
|
||||
P_INSTANCE_POINTER s_s_assemblage_free(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);
|
||||
if (it != this->Surfaces.end())
|
||||
{
|
||||
struct surface *surface_ptr = (it->second).cxxSurface2surface();
|
||||
surface_copy(surface_ptr, &surface[0], n);
|
||||
count_surface++;
|
||||
surface_free(surface_ptr);
|
||||
surface_ptr = (struct surface *) free_check_null(surface_ptr);
|
||||
struct surface *surface_ptr = (it->second).cxxSurface2surface(P_INSTANCE);
|
||||
P_INSTANCE_POINTER surface_copy(surface_ptr, &P_INSTANCE_POINTER surface[0], n);
|
||||
P_INSTANCE_POINTER count_surface++;
|
||||
P_INSTANCE_POINTER surface_free(surface_ptr);
|
||||
surface_ptr = (struct surface *) P_INSTANCE_POINTER free_check_null(surface_ptr);
|
||||
}
|
||||
}
|
||||
//std::cerr << oss.str();
|
||||
|
||||
}
|
||||
void
|
||||
cxxStorageBin::phreeqc2cxxStorageBin(int n)
|
||||
cxxStorageBin::phreeqc2cxxStorageBin(PHREEQC_PTR_ARG_COMMA int n)
|
||||
//
|
||||
// copy data fromphreeqc storage to storage bin
|
||||
//
|
||||
@ -935,55 +935,55 @@ cxxStorageBin::phreeqc2cxxStorageBin(int n)
|
||||
|
||||
// Solutions
|
||||
{
|
||||
solution_bsearch(n, &pos, TRUE);
|
||||
this->Solutions[n] = cxxSolution(solution[pos]);
|
||||
P_INSTANCE_POINTER solution_bsearch(n, &pos, TRUE);
|
||||
this->Solutions[n] = cxxSolution(P_INSTANCE_POINTER solution[pos]);
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
struct system *
|
||||
cxxStorageBin::cxxStorageBin2system(int n)
|
||||
cxxStorageBin::cxxStorageBin2system(PHREEQC_PTR_ARG_COMMA int n)
|
||||
//
|
||||
// make a system from storagebin
|
||||
//
|
||||
@ -1068,13 +1068,13 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
||||
struct system *system_ptr =
|
||||
(struct system *) PHRQ_malloc(sizeof(struct system));
|
||||
if (system_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
|
||||
// Solutions
|
||||
|
||||
if (this->getSolution(n) != NULL)
|
||||
{
|
||||
system_ptr->solution = (this->getSolution(n))->cxxSolution2solution();
|
||||
system_ptr->solution = (this->getSolution(n))->cxxSolution2solution(P_INSTANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1084,7 +1084,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
||||
// Exchangers
|
||||
if (this->getExchange(n) != NULL)
|
||||
{
|
||||
system_ptr->exchange = (this->getExchange(n))->cxxExchange2exchange();
|
||||
system_ptr->exchange = (this->getExchange(n))->cxxExchange2exchange(P_INSTANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1095,7 +1095,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
||||
if (this->getGasPhase(n) != NULL)
|
||||
{
|
||||
system_ptr->gas_phase =
|
||||
(this->getGasPhase(n))->cxxGasPhase2gas_phase();
|
||||
(this->getGasPhase(n))->cxxGasPhase2gas_phase(P_INSTANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1105,7 +1105,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
||||
// Kinetics
|
||||
if (this->getKinetics(n) != NULL)
|
||||
{
|
||||
system_ptr->kinetics = (this->getKinetics(n))->cxxKinetics2kinetics();
|
||||
system_ptr->kinetics = (this->getKinetics(n))->cxxKinetics2kinetics(P_INSTANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1116,7 +1116,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
||||
if (this->getPPassemblage(n) != NULL)
|
||||
{
|
||||
system_ptr->pp_assemblage =
|
||||
(this->getPPassemblage(n))->cxxPPassemblage2pp_assemblage();
|
||||
(this->getPPassemblage(n))->cxxPPassemblage2pp_assemblage(P_INSTANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1127,7 +1127,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
||||
if (this->getSSassemblage(n) != NULL)
|
||||
{
|
||||
system_ptr->s_s_assemblage =
|
||||
(this->getSSassemblage(n))->cxxSSassemblage2s_s_assemblage();
|
||||
(this->getSSassemblage(n))->cxxSSassemblage2s_s_assemblage(P_INSTANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1137,7 +1137,7 @@ cxxStorageBin::cxxStorageBin2system(int n)
|
||||
// Surfaces
|
||||
if (this->getSurface(n) != NULL)
|
||||
{
|
||||
system_ptr->surface = (this->getSurface(n))->cxxSurface2surface();
|
||||
system_ptr->surface = (this->getSurface(n))->cxxSurface2surface(P_INSTANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
12
StorageBin.h
12
StorageBin.h
@ -25,11 +25,11 @@ class cxxStorageBin
|
||||
cxxStorageBin(struct Use *use_ptr);
|
||||
~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);
|
||||
|
||||
@ -79,12 +79,12 @@ class cxxStorageBin
|
||||
|
||||
void dump_raw(std::ostream & s_oss, int i, unsigned int indent);
|
||||
|
||||
void read_raw(CParser & parser);
|
||||
int read_raw_keyword(CParser & parser);
|
||||
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser);
|
||||
int read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser);
|
||||
|
||||
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);
|
||||
cxxExchange *mix_cxxExchange(cxxMix & mixmap);
|
||||
|
||||
27
Surface.cxx
27
Surface.cxx
@ -82,7 +82,7 @@ cxxNumKeyword()
|
||||
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):
|
||||
cxxNumKeyword()
|
||||
{
|
||||
@ -107,7 +107,7 @@ cxxNumKeyword()
|
||||
{
|
||||
const cxxSurface *entity_ptr =
|
||||
&(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 =
|
||||
(struct surface_comp *) P_INSTANCE_POINTER free_check_null(surface_ptr->comps);
|
||||
surface_ptr->comps =
|
||||
cxxSurfaceComp::cxxSurfaceComp2surface_comp(this->surfaceComps);
|
||||
cxxSurfaceComp::cxxSurfaceComp2surface_comp(P_INSTANCE_COMMA this->surfaceComps);
|
||||
|
||||
// Surface charge
|
||||
surface_ptr->charge =
|
||||
@ -200,8 +200,7 @@ cxxSurface::cxxSurface2surface(PHREEQC_PTR_ARG)
|
||||
for (i = 0; i < surface_ptr->count_comps; i++)
|
||||
{
|
||||
char *charge_name = P_INSTANCE_POINTER string_hsave(
|
||||
cxxSurfaceComp::get_charge_name(surface_ptr->comps[i].
|
||||
formula).c_str());
|
||||
cxxSurfaceComp::get_charge_name(P_INSTANCE_COMMA surface_ptr->comps[i].formula).c_str());
|
||||
for (j = 0; j < surface_ptr->count_charge; j++)
|
||||
{
|
||||
if (charge_name == surface_ptr->charge[j].name)
|
||||
@ -364,7 +363,7 @@ cxxSurface::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
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;
|
||||
int i = 0;
|
||||
@ -540,7 +539,7 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
||||
}
|
||||
#endif
|
||||
parser.set_accumulate(true);
|
||||
ec.read_raw(parser, false);
|
||||
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||
parser.set_accumulate(false);
|
||||
std::istringstream is(parser.get_accumulated());
|
||||
CParser reread(is);
|
||||
@ -549,12 +548,12 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
||||
if (this->surfaceComps.find(ec.get_formula()) != this->surfaceComps.end())
|
||||
{
|
||||
cxxSurfaceComp & comp = this->surfaceComps.find(ec.get_formula())->second;
|
||||
comp.read_raw(reread, false);
|
||||
comp.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
cxxSurfaceComp ec1;
|
||||
ec1.read_raw(reread, false);
|
||||
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
std::string str(ec1.get_formula());
|
||||
this->surfaceComps[str] = ec1;
|
||||
}
|
||||
@ -593,7 +592,7 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
||||
}
|
||||
#endif
|
||||
parser.set_accumulate(true);
|
||||
ec.read_raw(parser, false);
|
||||
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||
parser.set_accumulate(false);
|
||||
std::istringstream is(parser.get_accumulated());
|
||||
CParser reread(is);
|
||||
@ -602,12 +601,12 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
||||
if (this->surfaceCharges.find(ec.get_name()) != this->surfaceCharges.end())
|
||||
{
|
||||
cxxSurfaceCharge & comp = this->surfaceCharges.find(ec.get_name())->second;
|
||||
comp.read_raw(reread, false);
|
||||
comp.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
cxxSurfaceCharge ec1;
|
||||
ec1.read_raw(reread, false);
|
||||
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
std::string str(ec1.get_name());
|
||||
this->surfaceCharges[str] = ec1;
|
||||
}
|
||||
@ -973,7 +972,7 @@ cxxSurface::add(const cxxSurface & addee, double extensive)
|
||||
}
|
||||
#endif
|
||||
void
|
||||
cxxSurface::add(const cxxSurface & addee, double extensive)
|
||||
cxxSurface::add(PHREEQC_PTR_ARG_COMMA const cxxSurface & addee, double extensive)
|
||||
//
|
||||
// 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);
|
||||
if (it != this->surfaceComps.end())
|
||||
{
|
||||
(*it).second.add( (*itadd).second, extensive);
|
||||
(*it).second.add(P_INSTANCE_COMMA (*itadd).second, extensive);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -18,7 +18,7 @@ class cxxSurface:public cxxNumKeyword
|
||||
public:
|
||||
cxxSurface();
|
||||
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);
|
||||
~cxxSurface();
|
||||
|
||||
@ -34,7 +34,7 @@ class cxxSurface:public cxxNumKeyword
|
||||
|
||||
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);
|
||||
|
||||
@ -52,7 +52,7 @@ class cxxSurface:public cxxNumKeyword
|
||||
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
|
||||
#endif
|
||||
private:
|
||||
void add(const cxxSurface & addee, double extensive);
|
||||
void add(PHREEQC_PTR_ARG_COMMA const cxxSurface & addee, double extensive);
|
||||
|
||||
protected:
|
||||
std::map < std::string, cxxSurfaceComp > surfaceComps;
|
||||
|
||||
@ -203,7 +203,7 @@ cxxSurfaceCharge::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
void
|
||||
cxxSurfaceCharge::read_raw(CParser & parser, bool check)
|
||||
cxxSurfaceCharge::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
@ -337,7 +337,7 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
|
||||
@ -28,7 +28,7 @@ public:
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@ -103,7 +103,7 @@ struct master *
|
||||
}
|
||||
|
||||
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
|
||||
//
|
||||
@ -112,33 +112,33 @@ struct surface_comp *
|
||||
(struct surface_comp *)
|
||||
PHRQ_malloc((size_t) (el.size() * sizeof(struct surface_comp)));
|
||||
if (surf_comp_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
|
||||
int i = 0;
|
||||
for (std::map < std::string, cxxSurfaceComp >::iterator it = el.begin();
|
||||
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);
|
||||
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].moles = (*it).second.moles;
|
||||
surf_comp_ptr[i].master = (*it).second.get_master();
|
||||
surf_comp_ptr[i].totals = (*it).second.totals.elt_list();
|
||||
surf_comp_ptr[i].master = (*it).second.get_master(P_INSTANCE);
|
||||
surf_comp_ptr[i].totals = (*it).second.totals.elt_list(P_INSTANCE);
|
||||
surf_comp_ptr[i].la = (*it).second.la;
|
||||
//surf_comp_ptr[i].charge = it->charge_number;
|
||||
surf_comp_ptr[i].cb = (*it).second.charge_balance;
|
||||
if ((*it).second.phase_name.size() == 0)
|
||||
surf_comp_ptr[i].phase_name = NULL;
|
||||
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;
|
||||
if ((*it).second.rate_name.size() == 0)
|
||||
surf_comp_ptr[i].rate_name = NULL;
|
||||
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].master = (*it).second.get_master();
|
||||
surf_comp_ptr[i].master = (*it).second.get_master(P_INSTANCE);
|
||||
i++;
|
||||
}
|
||||
return (surf_comp_ptr);
|
||||
@ -246,7 +246,7 @@ cxxSurfaceComp::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
void
|
||||
cxxSurfaceComp::read_raw(CParser & parser, bool check)
|
||||
cxxSurfaceComp::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
@ -403,7 +403,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -427,7 +427,7 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
@ -547,7 +547,7 @@ cxxSurfaceComp::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
||||
}
|
||||
#endif
|
||||
void
|
||||
cxxSurfaceComp::add(const cxxSurfaceComp & addee, double extensive)
|
||||
cxxSurfaceComp::add(PHREEQC_PTR_ARG_COMMA const cxxSurfaceComp & addee, double extensive)
|
||||
{
|
||||
if (extensive == 0.0)
|
||||
return;
|
||||
@ -602,8 +602,8 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, double extensive)
|
||||
oss <<
|
||||
"Can not mix two Surface components with same formula and different related phases, "
|
||||
<< this->formula;
|
||||
error_msg(oss.str().c_str(), CONTINUE);
|
||||
input_error++;
|
||||
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||
P_INSTANCE_POINTER input_error++;
|
||||
return;
|
||||
}
|
||||
else if (this->phase_name.size() != 0)
|
||||
@ -619,8 +619,8 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, double extensive)
|
||||
oss <<
|
||||
"Can not mix two exchange components with same formula and different related kinetics, "
|
||||
<< this->formula;
|
||||
error_msg(oss.str().c_str(), CONTINUE);
|
||||
input_error++;
|
||||
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||
P_INSTANCE_POINTER input_error++;
|
||||
return;
|
||||
}
|
||||
else if (this->rate_name.size() != 0)
|
||||
@ -636,8 +636,8 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, double extensive)
|
||||
oss <<
|
||||
"Can not mix exchange components related to phase with exchange components related to kinetics, "
|
||||
<< this->formula;
|
||||
error_msg(oss.str().c_str(), CONTINUE);
|
||||
input_error++;
|
||||
P_INSTANCE_POINTER error_msg(oss.str().c_str(), CONTINUE);
|
||||
P_INSTANCE_POINTER input_error++;
|
||||
return;
|
||||
}
|
||||
//double Dw;
|
||||
@ -717,18 +717,18 @@ cxxSurfaceComp::get_totals() const
|
||||
return (this->totals);
|
||||
};
|
||||
std::string
|
||||
cxxSurfaceComp::charge_name()
|
||||
cxxSurfaceComp::charge_name(PHREEQC_PTR_ARG)
|
||||
{
|
||||
char * str = string_hsave(this->formula.c_str());
|
||||
return (get_charge_name(str));
|
||||
char * str = P_INSTANCE_POINTER string_hsave(this->formula.c_str());
|
||||
return (get_charge_name(P_INSTANCE_COMMA str));
|
||||
};
|
||||
std::string
|
||||
cxxSurfaceComp::get_charge_name(char *token)
|
||||
cxxSurfaceComp::get_charge_name(PHREEQC_PTR_ARG_COMMA char *token)
|
||||
{
|
||||
char name[100];
|
||||
int l;
|
||||
char *ptr1 = token;
|
||||
get_elt(&ptr1, name, &l);
|
||||
P_INSTANCE_POINTER get_elt(&ptr1, name, &l);
|
||||
ptr1 = strchr(name, '_');
|
||||
if (ptr1 != NULL)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include <string> // std::string
|
||||
#include <list> // std::list
|
||||
#include <vector> // std::vector
|
||||
|
||||
#include "Phreeqc_class.h"
|
||||
#include "NameDouble.h"
|
||||
|
||||
class cxxSurfaceComp
|
||||
@ -27,15 +27,15 @@ public:
|
||||
void set_formula(char * f);
|
||||
double get_charge_balance() const;
|
||||
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_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;
|
||||
void add(const cxxSurfaceComp & comp, double extensive);
|
||||
void add(PHREEQC_PTR_ARG_COMMA const cxxSurfaceComp & comp, double extensive);
|
||||
void multiply(double extensive);
|
||||
std::string charge_name();
|
||||
static std::string get_charge_name(char *token);
|
||||
std::string charge_name(PHREEQC_PTR_ARG);
|
||||
static std::string get_charge_name(PHREEQC_PTR_ARG_COMMA char *token);
|
||||
#ifdef USE_MPI
|
||||
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
|
||||
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;
|
||||
}
|
||||
void
|
||||
cxxSystem::totalize(void)
|
||||
cxxSystem::totalize(PHREEQC_PTR_ARG)
|
||||
{
|
||||
//initialize
|
||||
this->totals.clear();
|
||||
@ -76,22 +76,22 @@ cxxSystem::totalize(void)
|
||||
}
|
||||
if (this->ppassemblage != NULL)
|
||||
{
|
||||
this->ppassemblage->totalize();
|
||||
this->ppassemblage->totalize(P_INSTANCE);
|
||||
this->totals.add_extensive(this->ppassemblage->get_totals(), 1.0);
|
||||
}
|
||||
if (this->gasphase != NULL)
|
||||
{
|
||||
this->gasphase->totalize();
|
||||
this->gasphase->totalize(P_INSTANCE);
|
||||
this->totals.add_extensive(this->gasphase->get_totals(), 1.0);
|
||||
}
|
||||
if (this->ssassemblage != NULL)
|
||||
{
|
||||
this->ssassemblage->totalize();
|
||||
this->ssassemblage->totalize(P_INSTANCE);
|
||||
this->totals.add_extensive(this->ssassemblage->get_totals(), 1.0);
|
||||
}
|
||||
if (this->surface != NULL)
|
||||
{
|
||||
this->ssassemblage->totalize();
|
||||
this->ssassemblage->totalize(P_INSTANCE);
|
||||
this->totals.add_extensive(this->surface->get_totals(), 1.0);
|
||||
}
|
||||
//Need to handle the following 3 reactions:
|
||||
|
||||
39
System.h
39
System.h
@ -24,40 +24,51 @@ class cxxMix;
|
||||
|
||||
class cxxSystem
|
||||
{
|
||||
public:cxxSystem(void);
|
||||
public: ~cxxSystem(void);
|
||||
void Initialize(void);
|
||||
void setSolution(cxxSolution * entity)
|
||||
public:
|
||||
cxxSystem(void);
|
||||
~cxxSystem(void);
|
||||
void Initialize(void);
|
||||
void setSolution(cxxSolution * entity)
|
||||
{
|
||||
this->solution = entity;
|
||||
} void setExchange(cxxExchange * entity)
|
||||
}
|
||||
void setExchange(cxxExchange * entity)
|
||||
{
|
||||
this->exchange = entity;
|
||||
} void setPPassemblage(cxxPPassemblage * entity)
|
||||
}
|
||||
void setPPassemblage(cxxPPassemblage * entity)
|
||||
{
|
||||
this->ppassemblage = entity;
|
||||
} void setGasPhase(cxxGasPhase * entity)
|
||||
}
|
||||
void setGasPhase(cxxGasPhase * entity)
|
||||
{
|
||||
this->gasphase = entity;
|
||||
} void setSSassemblage(cxxSSassemblage * entity)
|
||||
}
|
||||
void setSSassemblage(cxxSSassemblage * entity)
|
||||
{
|
||||
this->ssassemblage = entity;
|
||||
} void setKinetics(cxxKinetics * entity)
|
||||
}
|
||||
void setKinetics(cxxKinetics * entity)
|
||||
{
|
||||
this->kinetics = entity;
|
||||
} void setSurface(cxxSurface * entity)
|
||||
}
|
||||
void setSurface(cxxSurface * entity)
|
||||
{
|
||||
this->surface = entity;
|
||||
} void setMix(cxxMix * entity)
|
||||
}
|
||||
void setMix(cxxMix * entity)
|
||||
{
|
||||
this->mix = entity;
|
||||
} void setReaction(cxxReaction * entity)
|
||||
}
|
||||
void setReaction(cxxReaction * entity)
|
||||
{
|
||||
this->reaction = entity;
|
||||
} void setTemperature(cxxTemperature * entity)
|
||||
}
|
||||
void setTemperature(cxxTemperature * entity)
|
||||
{
|
||||
this->temperature = entity;
|
||||
} void totalize();
|
||||
}
|
||||
void totalize(PHREEQC_PTR_ARG);
|
||||
|
||||
#ifdef ORCHESTRA
|
||||
void ORCH_components();
|
||||
|
||||
@ -108,12 +108,12 @@ cxxKinetics::~cxxKinetics()
|
||||
}
|
||||
|
||||
struct kinetics *
|
||||
cxxKinetics::cxxKinetics2kinetics()
|
||||
cxxKinetics::cxxKinetics2kinetics(PHREEQC_PTR_ARG)
|
||||
//
|
||||
// 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->n_user = this->n_user;
|
||||
@ -126,25 +126,25 @@ cxxKinetics::cxxKinetics2kinetics()
|
||||
kinetics_ptr->cvode_order = this->cvode_order;
|
||||
|
||||
// totals
|
||||
kinetics_ptr->totals = this->totals.elt_list();
|
||||
kinetics_ptr->totals = this->totals.elt_list(P_INSTANCE);
|
||||
|
||||
// comps
|
||||
kinetics_ptr->count_comps = (int) this->kineticsComps.size();
|
||||
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 =
|
||||
cxxKineticsComp::cxxKineticsComp2kinetics_comp(this->kineticsComps);
|
||||
cxxKineticsComp::cxxKineticsComp2kinetics_comp(P_INSTANCE_COMMA this->kineticsComps);
|
||||
|
||||
// steps
|
||||
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)
|
||||
{
|
||||
kinetics_ptr->steps =
|
||||
(double *)
|
||||
PHRQ_malloc((size_t) (this->steps.size() * sizeof(double)));
|
||||
if (kinetics_ptr->steps == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
std::copy(this->steps.begin(), this->steps.end(),
|
||||
kinetics_ptr->steps);
|
||||
/*
|
||||
@ -267,7 +267,7 @@ cxxKinetics::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
||||
}
|
||||
|
||||
void
|
||||
cxxKinetics::read_raw(CParser & parser, bool check)
|
||||
cxxKinetics::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check)
|
||||
{
|
||||
|
||||
double d;
|
||||
@ -414,7 +414,7 @@ cxxKinetics::read_raw(CParser & parser, bool check)
|
||||
}
|
||||
#endif
|
||||
parser.set_accumulate(true);
|
||||
ec.read_raw(parser, false);
|
||||
ec.read_raw(P_INSTANCE_COMMA parser, false);
|
||||
parser.set_accumulate(false);
|
||||
std::istringstream is(parser.get_accumulated());
|
||||
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())
|
||||
{
|
||||
cxxKineticsComp & comp = this->kineticsComps.find(ec.get_rate_name())->second;
|
||||
comp.read_raw(reread, false);
|
||||
comp.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
cxxKineticsComp ec1;
|
||||
ec1.read_raw(reread, false);
|
||||
ec1.read_raw(P_INSTANCE_COMMA reread, false);
|
||||
std::string str(ec1.get_rate_name());
|
||||
this->kineticsComps[str] = ec1;
|
||||
}
|
||||
@ -438,7 +438,7 @@ cxxKinetics::read_raw(CParser & parser, bool check)
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
parser.incr_input_error();
|
||||
|
||||
@ -21,7 +21,7 @@ class cxxKinetics:public cxxNumKeyword
|
||||
int n_user);
|
||||
~cxxKinetics();
|
||||
|
||||
struct kinetics *cxxKinetics2kinetics();
|
||||
struct kinetics *cxxKinetics2kinetics(PHREEQC_PTR_ARG);
|
||||
|
||||
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 read_raw(CParser & parser, bool check = true);
|
||||
void read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser, bool check = true);
|
||||
|
||||
bool get_related_phases(void);
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ cxxMix::~cxxMix()
|
||||
|
||||
|
||||
struct mix *
|
||||
cxxMix::cxxMix2mix()
|
||||
cxxMix::cxxMix2mix(PHREEQC_PTR_ARG)
|
||||
//
|
||||
// Builds a mix structure from instance of cxxMix
|
||||
//
|
||||
@ -69,7 +69,7 @@ cxxMix::cxxMix2mix()
|
||||
struct mix *mix_ptr;
|
||||
mix_ptr = (struct mix *) PHRQ_malloc(sizeof(struct mix));
|
||||
if (mix_ptr == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
|
||||
mix_ptr->description = this->get_description();
|
||||
mix_ptr->n_user = this->n_user;
|
||||
@ -85,7 +85,7 @@ cxxMix::cxxMix2mix()
|
||||
PHRQ_malloc((size_t)
|
||||
(this->mixComps.size() * sizeof(struct mix_comp)));
|
||||
if (mix_ptr->comps == NULL)
|
||||
malloc_error();
|
||||
P_INSTANCE_POINTER malloc_error();
|
||||
for (std::map < int, double >::iterator it = mixComps.begin();
|
||||
it != mixComps.end(); it++)
|
||||
{
|
||||
|
||||
4
cxxMix.h
4
cxxMix.h
@ -6,7 +6,7 @@
|
||||
#include <string> // std::string
|
||||
#include <list> // std::list
|
||||
#include <vector> // std::vector
|
||||
|
||||
#include "Phreeqc_class.h"
|
||||
#include "NumKeyword.h"
|
||||
|
||||
class cxxMix:public cxxNumKeyword
|
||||
@ -17,7 +17,7 @@ class cxxMix:public cxxNumKeyword
|
||||
cxxMix(struct mix *);
|
||||
~cxxMix();
|
||||
|
||||
struct mix *cxxMix2mix();
|
||||
struct mix *cxxMix2mix(PHREEQC_PTR_ARG);
|
||||
|
||||
//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
|
||||
#define P_INSTANCE
|
||||
#define P_INSTANCE_COMMA
|
||||
#define P_INSTANCE_POINTER
|
||||
#define PHREEQC_PTR_ARG
|
||||
#define PHREEQC_PTR_ARG_COMMA
|
||||
#define PHREEQC_THIS
|
||||
#define PHREEQC_THIS_COMMA
|
||||
#else
|
||||
#define P_INSTANCE p_instance
|
||||
#define P_INSTANCE_COMMA p_instance,
|
||||
#define P_INSTANCE_POINTER p_instance->
|
||||
#define PHREEQC_PTR_ARG Phreeqc *p_instance
|
||||
#define PHREEQC_PTR_ARG_COMMA Phreeqc *p_instance,
|
||||
#define PHREEQC_THIS this
|
||||
#define PHREEQC_THIS_COMMA this,
|
||||
#endif
|
||||
|
||||
#endif /* _INC_PHREEQC_CLASS_H */
|
||||
//#include "Phreeqc_class.h"
|
||||
Loading…
x
Reference in New Issue
Block a user