mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Have converted std::list to std::map for all entities.
surface is completed but needs testing. SS and kinetics need to have reread of components implemented for MODIFY option. gas_phase may be done, needs to be tested. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@3726 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
f015759286
commit
d54c04039a
@ -56,7 +56,7 @@ class cxxGasPhase:public cxxNumKeyword
|
|||||||
void add(const cxxGasPhase & addee, double extensive);
|
void add(const cxxGasPhase & addee, double extensive);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cxxNameDouble gasPhaseComps;
|
cxxNameDouble gasPhaseComps;
|
||||||
GP_TYPE type;
|
GP_TYPE type;
|
||||||
double total_p;
|
double total_p;
|
||||||
double volume;
|
double volume;
|
||||||
|
|||||||
@ -55,7 +55,7 @@ cxxKineticsComp::~cxxKineticsComp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct kinetics_comp *
|
struct kinetics_comp *
|
||||||
cxxKineticsComp::cxxKineticsComp2kinetics_comp(std::list < cxxKineticsComp >
|
cxxKineticsComp::cxxKineticsComp2kinetics_comp(std::map < std::string, cxxKineticsComp >
|
||||||
&el)
|
&el)
|
||||||
//
|
//
|
||||||
// Builds kinetics_comp structure from of cxxKineticsComp
|
// Builds kinetics_comp structure from of cxxKineticsComp
|
||||||
@ -68,17 +68,17 @@ cxxKineticsComp::cxxKineticsComp2kinetics_comp(std::list < cxxKineticsComp >
|
|||||||
malloc_error();
|
malloc_error();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::list < cxxKineticsComp >::iterator it = el.begin();
|
for (std::map < std::string, cxxKineticsComp >::iterator it = el.begin();
|
||||||
it != el.end(); ++it)
|
it != el.end(); ++it)
|
||||||
{
|
{
|
||||||
kinetics_comp_ptr[i].rate_name = it->rate_name;
|
kinetics_comp_ptr[i].rate_name = (*it).second.rate_name;
|
||||||
kinetics_comp_ptr[i].list = it->namecoef.name_coef();
|
kinetics_comp_ptr[i].list = (*it).second.namecoef.name_coef();
|
||||||
kinetics_comp_ptr[i].count_list = (int) it->namecoef.size();
|
kinetics_comp_ptr[i].count_list = (int) (*it).second.namecoef.size();
|
||||||
kinetics_comp_ptr[i].tol = it->tol;
|
kinetics_comp_ptr[i].tol = (*it).second.tol;
|
||||||
kinetics_comp_ptr[i].m = it->m;
|
kinetics_comp_ptr[i].m = (*it).second.m;
|
||||||
kinetics_comp_ptr[i].initial_moles = 0.;
|
kinetics_comp_ptr[i].initial_moles = 0.;
|
||||||
kinetics_comp_ptr[i].m0 = it->m0;
|
kinetics_comp_ptr[i].m0 = (*it).second.m0;
|
||||||
kinetics_comp_ptr[i].moles = it->moles;
|
kinetics_comp_ptr[i].moles = (*it).second.moles;
|
||||||
kinetics_comp_ptr[i].count_c_params = 0;
|
kinetics_comp_ptr[i].count_c_params = 0;
|
||||||
kinetics_comp_ptr[i].c_params = NULL;
|
kinetics_comp_ptr[i].c_params = NULL;
|
||||||
/*
|
/*
|
||||||
@ -86,16 +86,15 @@ cxxKineticsComp::cxxKineticsComp2kinetics_comp(std::list < cxxKineticsComp >
|
|||||||
kinetics_comp_ptr[i].d_params = NULL;
|
kinetics_comp_ptr[i].d_params = NULL;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
kinetics_comp_ptr[i].count_d_params = (int) it->d_params.size();
|
kinetics_comp_ptr[i].count_d_params = (int) (*it).second.d_params.size();
|
||||||
kinetics_comp_ptr[i].d_params = NULL;
|
kinetics_comp_ptr[i].d_params = NULL;
|
||||||
if (it->d_params.size() > 0)
|
if ((*it).second.d_params.size() > 0)
|
||||||
{
|
{
|
||||||
kinetics_comp_ptr[i].d_params =
|
kinetics_comp_ptr[i].d_params = (double *)
|
||||||
(double *)
|
PHRQ_malloc((size_t) ((*it).second.d_params.size() * sizeof(double)));
|
||||||
PHRQ_malloc((size_t) (it->d_params.size() * sizeof(double)));
|
|
||||||
if (kinetics_comp_ptr[i].d_params == NULL)
|
if (kinetics_comp_ptr[i].d_params == NULL)
|
||||||
malloc_error();
|
malloc_error();
|
||||||
std::copy(it->d_params.begin(), it->d_params.end(),
|
std::copy((*it).second.d_params.begin(), (*it).second.d_params.end(),
|
||||||
kinetics_comp_ptr[i].d_params);
|
kinetics_comp_ptr[i].d_params);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
@ -15,14 +15,12 @@
|
|||||||
class cxxKineticsComp
|
class cxxKineticsComp
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cxxKineticsComp();
|
cxxKineticsComp();
|
||||||
cxxKineticsComp(struct kinetics_comp *);
|
cxxKineticsComp(struct kinetics_comp *);
|
||||||
~cxxKineticsComp();
|
~cxxKineticsComp();
|
||||||
|
|
||||||
static struct kinetics_comp *cxxKineticsComp2kinetics_comp(std::list <
|
static struct kinetics_comp *cxxKineticsComp2kinetics_comp(std::map < std::string, cxxKineticsComp > &el);
|
||||||
cxxKineticsComp
|
|
||||||
> &el);
|
|
||||||
|
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|
||||||
@ -49,7 +47,7 @@ class cxxKineticsComp
|
|||||||
double m;
|
double m;
|
||||||
double m0;
|
double m0;
|
||||||
double moles;
|
double moles;
|
||||||
std::vector < double >d_params;
|
std::vector < double >d_params;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -1366,6 +1366,24 @@ read_surface_modify(void)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int return_value;
|
int return_value;
|
||||||
|
|
||||||
|
// find surface number
|
||||||
|
char token[MAX_LENGTH];
|
||||||
|
char *next;
|
||||||
|
int l, n_user, n;
|
||||||
|
next = line;
|
||||||
|
copy_token(token, &next, &l);
|
||||||
|
if (copy_token(token, &next, &l) != DIGIT)
|
||||||
|
{
|
||||||
|
input_error++;
|
||||||
|
sprintf(error_string, "Expected surface number following SURFACE_MODIFY.\n%s\n", line_save);
|
||||||
|
error_msg(error_string, CONTINUE);
|
||||||
|
return (ERROR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sscanf(token,"%d", &n_user);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Make parser
|
* Make parser
|
||||||
*/
|
*/
|
||||||
@ -1391,23 +1409,6 @@ read_surface_modify(void)
|
|||||||
parser.set_echo_file(CParser::EO_NOKEYWORDS);
|
parser.set_echo_file(CParser::EO_NOKEYWORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// find surface number
|
|
||||||
char token[MAX_LENGTH];
|
|
||||||
char *next;
|
|
||||||
int l, n_user, n;
|
|
||||||
next = line;
|
|
||||||
copy_token(token, &next, &l);
|
|
||||||
if (copy_token(token, &next, &l) != DIGIT)
|
|
||||||
{
|
|
||||||
input_error++;
|
|
||||||
sprintf(error_string, "Expected surface number following SURFACE_MODIFY.\n%s\n", line_save);
|
|
||||||
error_msg(error_string, CONTINUE);
|
|
||||||
return (ERROR);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sscanf(token,"%d", &n_user);
|
|
||||||
}
|
|
||||||
if (surface_bsearch(n_user, &n) == NULL)
|
if (surface_bsearch(n_user, &n) == NULL)
|
||||||
{
|
{
|
||||||
input_error++;
|
input_error++;
|
||||||
|
|||||||
@ -41,7 +41,8 @@ cxxNumKeyword()
|
|||||||
for (i = 0; i < s_s_assemblage_ptr->count_s_s; i++)
|
for (i = 0; i < s_s_assemblage_ptr->count_s_s; i++)
|
||||||
{
|
{
|
||||||
cxxSSassemblageSS ssSS(&(s_s_assemblage_ptr->s_s[i]));
|
cxxSSassemblageSS ssSS(&(s_s_assemblage_ptr->s_s[i]));
|
||||||
ssAssemblageSSs.push_back(ssSS);
|
std::string str(ssSS.get_name());
|
||||||
|
ssAssemblageSSs[str] = ssSS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cxxSSassemblage::cxxSSassemblage(const std::map < int,
|
cxxSSassemblage::cxxSSassemblage(const std::map < int,
|
||||||
@ -141,12 +142,12 @@ cxxSSassemblage::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
description << std::endl;
|
description << std::endl;
|
||||||
|
|
||||||
// ssAssemblageSSs
|
// ssAssemblageSSs
|
||||||
for (std::list < cxxSSassemblageSS >::const_iterator it =
|
for (std::map < std::string, cxxSSassemblageSS >::const_iterator it =
|
||||||
ssAssemblageSSs.begin(); it != ssAssemblageSSs.end(); ++it)
|
ssAssemblageSSs.begin(); it != ssAssemblageSSs.end(); ++it)
|
||||||
{
|
{
|
||||||
s_oss << indent1;
|
s_oss << indent1;
|
||||||
s_oss << "-solid_solution" << std::endl;
|
s_oss << "-solid_solution" << std::endl;
|
||||||
it->dump_raw(s_oss, indent + 2);
|
(*it).second.dump_raw(s_oss, indent + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +207,8 @@ cxxSSassemblage::read_raw(CParser & parser, bool check)
|
|||||||
{
|
{
|
||||||
cxxSSassemblageSS ssSS;
|
cxxSSassemblageSS ssSS;
|
||||||
ssSS.read_raw(parser);
|
ssSS.read_raw(parser);
|
||||||
this->ssAssemblageSSs.push_back(ssSS);
|
std::string str(ssSS.get_name());
|
||||||
|
this->ssAssemblageSSs[str] = ssSS;
|
||||||
}
|
}
|
||||||
useLastLine = true;
|
useLastLine = true;
|
||||||
break;
|
break;
|
||||||
@ -264,15 +266,15 @@ cxxSSassemblage::totalize()
|
|||||||
{
|
{
|
||||||
this->totals.clear();
|
this->totals.clear();
|
||||||
// component structures
|
// component structures
|
||||||
for (std::list < cxxSSassemblageSS >::iterator it =
|
for (std::map < std::string, cxxSSassemblageSS >::iterator it =
|
||||||
ssAssemblageSSs.begin(); it != ssAssemblageSSs.end(); ++it)
|
ssAssemblageSSs.begin(); it != ssAssemblageSSs.end(); ++it)
|
||||||
{
|
{
|
||||||
it->totalize();
|
(*it).second.totalize();
|
||||||
this->totals.add_extensive(it->get_totals(), 1.0);
|
this->totals.add_extensive((*it).second.get_totals(), 1.0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifdef SKIP
|
||||||
void
|
void
|
||||||
cxxSSassemblage::add(const cxxSSassemblage & addee, double extensive)
|
cxxSSassemblage::add(const cxxSSassemblage & addee, double extensive)
|
||||||
//
|
//
|
||||||
@ -306,3 +308,33 @@ cxxSSassemblage::add(const cxxSSassemblage & addee, double extensive)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
void
|
||||||
|
cxxSSassemblage::add(const cxxSSassemblage & addee, double extensive)
|
||||||
|
//
|
||||||
|
// Add to existing ssassemblage to "this" ssassemblage
|
||||||
|
//
|
||||||
|
{
|
||||||
|
if (extensive == 0.0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (std::map < std::string, cxxSSassemblageSS >::const_iterator itadd =
|
||||||
|
addee.ssAssemblageSSs.begin(); itadd != addee.ssAssemblageSSs.end();
|
||||||
|
++itadd)
|
||||||
|
{
|
||||||
|
std::map < std::string, cxxSSassemblageSS >::iterator it =
|
||||||
|
this->ssAssemblageSSs.find((*itadd).first);
|
||||||
|
if (it != this->ssAssemblageSSs.end())
|
||||||
|
{
|
||||||
|
(*it).second.add((*itadd).second, extensive);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cxxSSassemblageSS entity = (*itadd).second;
|
||||||
|
entity.multiply(extensive);
|
||||||
|
std::string str(entity.get_name());
|
||||||
|
this->ssAssemblageSSs[str] = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,12 +17,12 @@
|
|||||||
class cxxSSassemblage:public cxxNumKeyword
|
class cxxSSassemblage:public cxxNumKeyword
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cxxSSassemblage();
|
cxxSSassemblage();
|
||||||
cxxSSassemblage(struct s_s_assemblage *);
|
cxxSSassemblage(struct s_s_assemblage *);
|
||||||
cxxSSassemblage(const std::map < int, cxxSSassemblage > &entity_map,
|
cxxSSassemblage(const std::map < int, cxxSSassemblage > &entity_map,
|
||||||
cxxMix & mx, int n_user);
|
cxxMix & mx, int n_user);
|
||||||
~cxxSSassemblage();
|
~cxxSSassemblage();
|
||||||
|
|
||||||
struct s_s_assemblage *cxxSSassemblage2s_s_assemblage();
|
struct s_s_assemblage *cxxSSassemblage2s_s_assemblage();
|
||||||
|
|
||||||
@ -46,14 +46,14 @@ class cxxSSassemblage:public cxxNumKeyword
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void add(const cxxSSassemblage & addee, double extensive);
|
void add(const cxxSSassemblage & addee, double extensive);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::list < cxxSSassemblageSS > ssAssemblageSSs;
|
std::map < std::string, cxxSSassemblageSS > ssAssemblageSSs;
|
||||||
cxxNameDouble totals;
|
cxxNameDouble totals;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//static std::map<int, cxxSSassemblage>& map;
|
//static std::map<int, cxxSSassemblage>& map;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -74,7 +74,7 @@ cxxSSassemblageSS::~cxxSSassemblageSS()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct s_s *
|
struct s_s *
|
||||||
cxxSSassemblageSS::cxxSSassemblageSS2s_s(std::list < cxxSSassemblageSS > &el)
|
cxxSSassemblageSS::cxxSSassemblageSS2s_s(std::map < std::string, cxxSSassemblageSS > &el)
|
||||||
//
|
//
|
||||||
// Builds s_s structure from of cxxSSassemblageSS
|
// Builds s_s structure from of cxxSSassemblageSS
|
||||||
//
|
//
|
||||||
@ -88,27 +88,27 @@ cxxSSassemblageSS::cxxSSassemblageSS2s_s(std::list < cxxSSassemblageSS > &el)
|
|||||||
if (s_s_ptr == NULL)
|
if (s_s_ptr == NULL)
|
||||||
malloc_error();
|
malloc_error();
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (std::list < cxxSSassemblageSS >::iterator it = el.begin();
|
for (std::map < std::string, cxxSSassemblageSS >::iterator it = el.begin();
|
||||||
it != el.end(); ++it)
|
it != el.end(); ++it)
|
||||||
{
|
{
|
||||||
s_s_ptr[j].name = it->name;
|
s_s_ptr[j].name = (*it).second.name;
|
||||||
//s_s_ptr[j].total_moles = it->total_moles;
|
//s_s_ptr[j].total_moles = it->total_moles;
|
||||||
s_s_ptr[j].total_moles = 0;
|
s_s_ptr[j].total_moles = 0;
|
||||||
s_s_ptr[j].dn = 0;
|
s_s_ptr[j].dn = 0;
|
||||||
s_s_ptr[j].a0 = it->a0;
|
s_s_ptr[j].a0 = (*it).second.a0;
|
||||||
s_s_ptr[j].a1 = it->a1;
|
s_s_ptr[j].a1 = (*it).second.a1;
|
||||||
s_s_ptr[j].ag0 = it->ag0;
|
s_s_ptr[j].ag0 = (*it).second.ag0;
|
||||||
s_s_ptr[j].ag1 = it->ag1;
|
s_s_ptr[j].ag1 = (*it).second.ag1;
|
||||||
//s_s_ptr[j].ag0 = 0;
|
//s_s_ptr[j].ag0 = 0;
|
||||||
//s_s_ptr[j].ag1 = 0;
|
//s_s_ptr[j].ag1 = 0;
|
||||||
s_s_ptr[j].s_s_in = TRUE;
|
s_s_ptr[j].s_s_in = TRUE;
|
||||||
s_s_ptr[j].miscibility = it->miscibility;
|
s_s_ptr[j].miscibility = (*it).second.miscibility;
|
||||||
//s_s_ptr[j].spinodal = it->spinodal;
|
//s_s_ptr[j].spinodal = it->spinodal;
|
||||||
s_s_ptr[j].spinodal = FALSE;
|
s_s_ptr[j].spinodal = FALSE;
|
||||||
//s_s_ptr[j].tk = it->tk;
|
//s_s_ptr[j].tk = it->tk;
|
||||||
s_s_ptr[j].tk = 273.15;
|
s_s_ptr[j].tk = 273.15;
|
||||||
s_s_ptr[j].xb1 = it->xb1;
|
s_s_ptr[j].xb1 = (*it).second.xb1;
|
||||||
s_s_ptr[j].xb2 = it->xb2;
|
s_s_ptr[j].xb2 = (*it).second.xb2;
|
||||||
s_s_ptr[j].input_case = 0;
|
s_s_ptr[j].input_case = 0;
|
||||||
s_s_ptr[j].p[0] = 0;
|
s_s_ptr[j].p[0] = 0;
|
||||||
s_s_ptr[j].p[1] = 0;
|
s_s_ptr[j].p[1] = 0;
|
||||||
@ -117,20 +117,20 @@ cxxSSassemblageSS::cxxSSassemblageSS2s_s(std::list < cxxSSassemblageSS > &el)
|
|||||||
//
|
//
|
||||||
// generate s_s_comp structures
|
// generate s_s_comp structures
|
||||||
//
|
//
|
||||||
s_s_ptr[j].count_comps = (int) it->comps.size();
|
s_s_ptr[j].count_comps = (int) (*it).second.comps.size();
|
||||||
s_s_ptr[j].comps = NULL;
|
s_s_ptr[j].comps = NULL;
|
||||||
if (it->comps.size() > 0)
|
if ((*it).second.comps.size() > 0)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int n;
|
int n;
|
||||||
struct s_s_comp *s_s_comp_ptr =
|
struct s_s_comp *s_s_comp_ptr =
|
||||||
(struct s_s_comp *)
|
(struct s_s_comp *)
|
||||||
PHRQ_malloc((size_t)
|
PHRQ_malloc((size_t)
|
||||||
(it->comps.size() * sizeof(struct s_s_comp)));
|
((*it).second.comps.size() * sizeof(struct s_s_comp)));
|
||||||
if (s_s_comp_ptr == NULL)
|
if (s_s_comp_ptr == NULL)
|
||||||
malloc_error();
|
malloc_error();
|
||||||
for (cxxNameDouble::iterator itc = it->comps.begin();
|
for (cxxNameDouble::iterator itc = (*it).second.comps.begin();
|
||||||
itc != it->comps.end(); ++itc)
|
itc != (*it).second.comps.end(); ++itc)
|
||||||
{
|
{
|
||||||
s_s_comp_ptr[i].name = itc->first;
|
s_s_comp_ptr[i].name = itc->first;
|
||||||
s_s_comp_ptr[i].phase = phase_bsearch(itc->first, &n, TRUE);
|
s_s_comp_ptr[i].phase = phase_bsearch(itc->first, &n, TRUE);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class cxxSSassemblageSS
|
|||||||
SS_PARM_MARGULES = 9
|
SS_PARM_MARGULES = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s_s *cxxSSassemblageSS2s_s(std::list < cxxSSassemblageSS >
|
static struct s_s *cxxSSassemblageSS2s_s(std::map < std::string, cxxSSassemblageSS >
|
||||||
&el);
|
&el);
|
||||||
|
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|||||||
164
Surface.cxx
164
Surface.cxx
@ -67,13 +67,15 @@ cxxNumKeyword()
|
|||||||
for (i = 0; i < surface_ptr->count_comps; i++)
|
for (i = 0; i < surface_ptr->count_comps; i++)
|
||||||
{
|
{
|
||||||
cxxSurfaceComp ec(&(surface_ptr->comps[i]));
|
cxxSurfaceComp ec(&(surface_ptr->comps[i]));
|
||||||
surfaceComps.push_back(ec);
|
std::string str(ec.get_formula());
|
||||||
|
surfaceComps[str] = ec;
|
||||||
}
|
}
|
||||||
// Surface charge
|
// Surface charge
|
||||||
for (i = 0; i < surface_ptr->count_charge; i++)
|
for (i = 0; i < surface_ptr->count_charge; i++)
|
||||||
{
|
{
|
||||||
cxxSurfaceCharge ec(&(surface_ptr->charge[i]));
|
cxxSurfaceCharge ec(&(surface_ptr->charge[i]));
|
||||||
surfaceCharges.push_back(ec);
|
std::string str(ec.get_name());
|
||||||
|
surfaceCharges[str] = ec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cxxSurface::cxxSurface(const std::map < int, cxxSurface > &entities,
|
cxxSurface::cxxSurface(const std::map < int, cxxSurface > &entities,
|
||||||
@ -113,10 +115,10 @@ cxxSurface::~cxxSurface()
|
|||||||
bool
|
bool
|
||||||
cxxSurface::get_related_phases()
|
cxxSurface::get_related_phases()
|
||||||
{
|
{
|
||||||
for (std::list < cxxSurfaceComp >::const_iterator it =
|
for (std::map < std::string, cxxSurfaceComp >::const_iterator it =
|
||||||
this->surfaceComps.begin(); it != this->surfaceComps.end(); ++it)
|
this->surfaceComps.begin(); it != this->surfaceComps.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->get_phase_name() == NULL)
|
if ((*it).second.get_phase_name() == NULL)
|
||||||
continue;
|
continue;
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
@ -126,10 +128,10 @@ cxxSurface::get_related_phases()
|
|||||||
bool
|
bool
|
||||||
cxxSurface::get_related_rate()
|
cxxSurface::get_related_rate()
|
||||||
{
|
{
|
||||||
for (std::list < cxxSurfaceComp >::const_iterator it =
|
for (std::map < std::string, cxxSurfaceComp >::const_iterator it =
|
||||||
this->surfaceComps.begin(); it != this->surfaceComps.end(); ++it)
|
this->surfaceComps.begin(); it != this->surfaceComps.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->get_rate_name() == NULL)
|
if ((*it).second.get_rate_name() == NULL)
|
||||||
continue;
|
continue;
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
@ -181,8 +183,7 @@ cxxSurface::cxxSurface2surface()
|
|||||||
{
|
{
|
||||||
surface_ptr->count_charge = (int) this->surfaceCharges.size();
|
surface_ptr->count_charge = (int) this->surfaceCharges.size();
|
||||||
surface_ptr->charge =
|
surface_ptr->charge =
|
||||||
cxxSurfaceCharge::cxxSurfaceCharge2surface_charge(this->
|
cxxSurfaceCharge::cxxSurfaceCharge2surface_charge(this->surfaceCharges);
|
||||||
surfaceCharges);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -267,19 +268,19 @@ cxxSurface::dump_xml(std::ostream & s_oss, unsigned int indent) const
|
|||||||
s_oss << indent1;
|
s_oss << indent1;
|
||||||
s_oss << "<component " << std::endl;
|
s_oss << "<component " << std::endl;
|
||||||
{
|
{
|
||||||
for (std::list < cxxSurfaceComp >::const_iterator it =
|
for (std::map < std::string, cxxSurfaceComp >::const_iterator it =
|
||||||
this->surfaceComps.begin(); it != this->surfaceComps.end(); ++it)
|
this->surfaceComps.begin(); it != this->surfaceComps.end(); ++it)
|
||||||
{
|
{
|
||||||
it->dump_xml(s_oss, indent + 2);
|
(*it).second.dump_xml(s_oss, indent + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// surface charge structures
|
// surface charge structures
|
||||||
s_oss << indent1;
|
s_oss << indent1;
|
||||||
s_oss << "<charge_component " << std::endl;
|
s_oss << "<charge_component " << std::endl;
|
||||||
for (std::list < cxxSurfaceCharge >::const_iterator it =
|
for (std::map < std::string, cxxSurfaceCharge >::const_iterator it =
|
||||||
surfaceCharges.begin(); it != surfaceCharges.end(); ++it)
|
surfaceCharges.begin(); it != surfaceCharges.end(); ++it)
|
||||||
{
|
{
|
||||||
it->dump_xml(s_oss, indent + 2);
|
(*it).second.dump_xml(s_oss, indent + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -337,21 +338,21 @@ cxxSurface::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
s_oss << "-transport " << this->transport << std::endl;
|
s_oss << "-transport " << this->transport << std::endl;
|
||||||
|
|
||||||
// surfaceComps structures
|
// surfaceComps structures
|
||||||
for (std::list < cxxSurfaceComp >::const_iterator it =
|
for (std::map < std::string, cxxSurfaceComp >::const_iterator it =
|
||||||
surfaceComps.begin(); it != surfaceComps.end(); ++it)
|
surfaceComps.begin(); it != surfaceComps.end(); ++it)
|
||||||
{
|
{
|
||||||
s_oss << indent1;
|
s_oss << indent1;
|
||||||
s_oss << "-component" << std::endl;
|
s_oss << "-component" << std::endl;
|
||||||
it->dump_raw(s_oss, indent + 2);
|
(*it).second.dump_raw(s_oss, indent + 2);
|
||||||
}
|
}
|
||||||
// surface charge structures
|
// surface charge structures
|
||||||
{
|
{
|
||||||
for (std::list < cxxSurfaceCharge >::const_iterator it =
|
for (std::map < std::string, cxxSurfaceCharge >::const_iterator it =
|
||||||
surfaceCharges.begin(); it != surfaceCharges.end(); ++it)
|
surfaceCharges.begin(); it != surfaceCharges.end(); ++it)
|
||||||
{
|
{
|
||||||
s_oss << indent1;
|
s_oss << indent1;
|
||||||
s_oss << "-charge_component " << std::endl;
|
s_oss << "-charge_component " << std::endl;
|
||||||
it->dump_raw(s_oss, indent + 2);
|
(*it).second.dump_raw(s_oss, indent + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,8 +508,31 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
|||||||
case 5: // component
|
case 5: // component
|
||||||
{
|
{
|
||||||
cxxSurfaceComp ec;
|
cxxSurfaceComp ec;
|
||||||
ec.read_raw(parser);
|
|
||||||
this->surfaceComps.push_back(ec);
|
// preliminary read
|
||||||
|
std::istream::pos_type pos = parser.tellg();
|
||||||
|
CParser::ECHO_OPTION eo = parser.get_echo_file();
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
CParser::ECHO_OPTION eo_s = parser.get_echo_stream();
|
||||||
|
parser.set_echo_stream(CParser::EO_NONE);
|
||||||
|
ec.read_raw(parser, false);
|
||||||
|
parser.set_echo_file(eo);
|
||||||
|
parser.set_echo_file(eo_s);
|
||||||
|
parser.seekg(pos).clear();
|
||||||
|
parser.seekg(pos);
|
||||||
|
|
||||||
|
if (this->surfaceComps.find(ec.get_formula()) != this->surfaceComps.end())
|
||||||
|
{
|
||||||
|
cxxSurfaceComp & comp = this->surfaceComps.find(ec.get_formula())->second;
|
||||||
|
comp.read_raw(parser, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cxxSurfaceComp ec1;
|
||||||
|
ec1.read_raw(parser, false);
|
||||||
|
std::string str(ec1.get_formula());
|
||||||
|
this->surfaceComps[str] = ec1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
useLastLine = true;
|
useLastLine = true;
|
||||||
break;
|
break;
|
||||||
@ -516,8 +540,31 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
|||||||
case 6: // charge_component
|
case 6: // charge_component
|
||||||
{
|
{
|
||||||
cxxSurfaceCharge ec;
|
cxxSurfaceCharge ec;
|
||||||
ec.read_raw(parser);
|
|
||||||
this->surfaceCharges.push_back(ec);
|
// preliminary read
|
||||||
|
std::istream::pos_type pos = parser.tellg();
|
||||||
|
CParser::ECHO_OPTION eo = parser.get_echo_file();
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
CParser::ECHO_OPTION eo_s = parser.get_echo_stream();
|
||||||
|
parser.set_echo_stream(CParser::EO_NONE);
|
||||||
|
ec.read_raw(parser, false);
|
||||||
|
parser.set_echo_file(eo);
|
||||||
|
parser.set_echo_file(eo_s);
|
||||||
|
parser.seekg(pos).clear();
|
||||||
|
parser.seekg(pos);
|
||||||
|
|
||||||
|
if (this->surfaceCharges.find(ec.get_name()) != this->surfaceCharges.end())
|
||||||
|
{
|
||||||
|
cxxSurfaceCharge & comp = this->surfaceCharges.find(ec.get_name())->second;
|
||||||
|
comp.read_raw(parser, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cxxSurfaceCharge ec1;
|
||||||
|
ec1.read_raw(parser, false);
|
||||||
|
std::string str(ec1.get_name());
|
||||||
|
this->surfaceCharges[str] = ec1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
useLastLine = true;
|
useLastLine = true;
|
||||||
break;
|
break;
|
||||||
@ -775,15 +822,15 @@ cxxSurface::totalize()
|
|||||||
{
|
{
|
||||||
this->totals.clear();
|
this->totals.clear();
|
||||||
// component structures
|
// component structures
|
||||||
for (std::list < cxxSurfaceComp >::const_iterator it =
|
for (std::map < std::string, cxxSurfaceComp >::const_iterator it =
|
||||||
surfaceComps.begin(); it != surfaceComps.end(); ++it)
|
surfaceComps.begin(); it != surfaceComps.end(); ++it)
|
||||||
{
|
{
|
||||||
this->totals.add_extensive(it->get_totals(), 1.0);
|
this->totals.add_extensive((*it).second.get_totals(), 1.0);
|
||||||
this->totals.add("Charge", it->get_charge_balance());
|
this->totals.add("Charge", (*it).second.get_charge_balance());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifdef SKIP
|
||||||
void
|
void
|
||||||
cxxSurface::add(const cxxSurface & addee, double extensive)
|
cxxSurface::add(const cxxSurface & addee, double extensive)
|
||||||
//
|
//
|
||||||
@ -876,3 +923,72 @@ cxxSurface::add(const cxxSurface & addee, double extensive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
void
|
||||||
|
cxxSurface::add(const cxxSurface & addee, double extensive)
|
||||||
|
//
|
||||||
|
// Add surface to "this" exchange
|
||||||
|
//
|
||||||
|
{
|
||||||
|
if (extensive == 0.0)
|
||||||
|
return;
|
||||||
|
if (this->surfaceComps.size() == 0)
|
||||||
|
{
|
||||||
|
//enum SURFACE_TYPE type;
|
||||||
|
this->type = addee.type;
|
||||||
|
//enum DIFFUSE_LAYER_TYPE dl_type;
|
||||||
|
this->dl_type = addee.dl_type;
|
||||||
|
//enum SITES_UNITS sites_units;
|
||||||
|
this->sites_units = addee.sites_units;
|
||||||
|
//bool only_counter_ions;
|
||||||
|
this->only_counter_ions = addee.only_counter_ions;
|
||||||
|
//double thickness;
|
||||||
|
this->thickness = addee.thickness;
|
||||||
|
//double debye_lengths;
|
||||||
|
this->debye_lengths = addee.debye_lengths;
|
||||||
|
//double DDL_viscosity;
|
||||||
|
this->DDL_viscosity = addee.DDL_viscosity;
|
||||||
|
//double DDL_limit;
|
||||||
|
this->DDL_limit = addee.DDL_limit;
|
||||||
|
//bool transport;
|
||||||
|
this->transport = addee.transport;
|
||||||
|
}
|
||||||
|
|
||||||
|
//std::map <std::string, cxxSurfaceComp> surfaceComps;
|
||||||
|
for (std::map < std::string, cxxSurfaceComp >::const_iterator itadd =
|
||||||
|
addee.surfaceComps.begin(); itadd != addee.surfaceComps.end();
|
||||||
|
++itadd)
|
||||||
|
{
|
||||||
|
std::map < std::string, cxxSurfaceComp >::iterator it = this->surfaceComps.find((*itadd).first);
|
||||||
|
if (it != this->surfaceComps.end())
|
||||||
|
{
|
||||||
|
(*it).second.add( (*itadd).second, extensive);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cxxSurfaceComp entity = (*itadd).second;
|
||||||
|
entity.multiply(extensive);
|
||||||
|
std::string str(entity.get_formula());
|
||||||
|
this->surfaceComps[str] = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//std::map < std::string, cxxSurfaceCharge > surfaceCharges;
|
||||||
|
for (std::map < std::string, cxxSurfaceCharge >::const_iterator itadd =
|
||||||
|
addee.surfaceCharges.begin(); itadd != addee.surfaceCharges.end();
|
||||||
|
++itadd)
|
||||||
|
{
|
||||||
|
std::map < std::string, cxxSurfaceCharge >::iterator it = this->surfaceCharges.find((*itadd).first);
|
||||||
|
if (it != this->surfaceCharges.end())
|
||||||
|
{
|
||||||
|
(*it).second.add( (*itadd).second, extensive);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cxxSurfaceCharge entity = (*itadd).second;
|
||||||
|
entity.multiply(extensive);
|
||||||
|
std::string str(entity.get_name());
|
||||||
|
this->surfaceCharges[str] = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -58,8 +58,8 @@ class cxxSurface:public cxxNumKeyword
|
|||||||
void add(const cxxSurface & addee, double extensive);
|
void add(const cxxSurface & addee, double extensive);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::list < cxxSurfaceComp > surfaceComps;
|
std::map < std::string, cxxSurfaceComp > surfaceComps;
|
||||||
std::list < cxxSurfaceCharge > surfaceCharges;
|
std::map < std::string, cxxSurfaceCharge > surfaceCharges;
|
||||||
enum SURFACE_TYPE type;
|
enum SURFACE_TYPE type;
|
||||||
enum DIFFUSE_LAYER_TYPE dl_type;
|
enum DIFFUSE_LAYER_TYPE dl_type;
|
||||||
enum SITES_UNITS sites_units;
|
enum SITES_UNITS sites_units;
|
||||||
|
|||||||
@ -81,8 +81,7 @@ cxxSurfaceCharge::get_psi_master()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct surface_charge *
|
struct surface_charge *
|
||||||
cxxSurfaceCharge::cxxSurfaceCharge2surface_charge(std::list <
|
cxxSurfaceCharge::cxxSurfaceCharge2surface_charge(std::map < std::string, cxxSurfaceCharge > &el)
|
||||||
cxxSurfaceCharge > &el)
|
|
||||||
//
|
//
|
||||||
// Builds surface_charge structure from of cxxSurfaceCharge
|
// Builds surface_charge structure from of cxxSurfaceCharge
|
||||||
//
|
//
|
||||||
@ -94,25 +93,24 @@ cxxSurfaceCharge::cxxSurfaceCharge2surface_charge(std::list <
|
|||||||
malloc_error();
|
malloc_error();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::list < cxxSurfaceCharge >::iterator it = el.begin();
|
for (std::map < std::string, cxxSurfaceCharge >::iterator it = el.begin();
|
||||||
it != el.end(); ++it)
|
it != el.end(); ++it)
|
||||||
{
|
{
|
||||||
surf_charge_ptr[i].name = it->name;
|
surf_charge_ptr[i].name = (*it).second.name;
|
||||||
surf_charge_ptr[i].specific_area = it->specific_area;
|
surf_charge_ptr[i].specific_area = (*it).second.specific_area;
|
||||||
surf_charge_ptr[i].grams = it->grams;
|
surf_charge_ptr[i].grams = (*it).second.grams;
|
||||||
surf_charge_ptr[i].charge_balance = it->charge_balance;
|
surf_charge_ptr[i].charge_balance = (*it).second.charge_balance;
|
||||||
surf_charge_ptr[i].mass_water = it->mass_water;
|
surf_charge_ptr[i].mass_water = (*it).second.mass_water;
|
||||||
surf_charge_ptr[i].la_psi = it->la_psi;
|
surf_charge_ptr[i].la_psi = (*it).second.la_psi;
|
||||||
surf_charge_ptr[i].la_psi1 = it->la_psi1;
|
surf_charge_ptr[i].la_psi1 = (*it).second.la_psi1;
|
||||||
surf_charge_ptr[i].la_psi2 = it->la_psi2;
|
surf_charge_ptr[i].la_psi2 = (*it).second.la_psi2;
|
||||||
surf_charge_ptr[i].capacitance[0] = it->capacitance[0];
|
surf_charge_ptr[i].capacitance[0] = (*it).second.capacitance[0];
|
||||||
surf_charge_ptr[i].capacitance[1] = it->capacitance[1];
|
surf_charge_ptr[i].capacitance[1] = (*it).second.capacitance[1];
|
||||||
surf_charge_ptr[i].sigma0 = 0;
|
surf_charge_ptr[i].sigma0 = 0;
|
||||||
surf_charge_ptr[i].sigma1 = 0;
|
surf_charge_ptr[i].sigma1 = 0;
|
||||||
surf_charge_ptr[i].sigma2 = 0;
|
surf_charge_ptr[i].sigma2 = 0;
|
||||||
surf_charge_ptr[i].sigmaddl = 0;
|
surf_charge_ptr[i].sigmaddl = 0;
|
||||||
surf_charge_ptr[i].diffuse_layer_totals =
|
surf_charge_ptr[i].diffuse_layer_totals = (*it).second.diffuse_layer_totals.elt_list();
|
||||||
it->diffuse_layer_totals.elt_list();
|
|
||||||
//surf_charge_ptr[i].psi_master = it->get_psi_master();
|
//surf_charge_ptr[i].psi_master = it->get_psi_master();
|
||||||
surf_charge_ptr[i].count_g = 0;
|
surf_charge_ptr[i].count_g = 0;
|
||||||
surf_charge_ptr[i].g = NULL;
|
surf_charge_ptr[i].g = NULL;
|
||||||
@ -175,33 +173,33 @@ cxxSurfaceCharge::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
// Surf_Charge element and attributes
|
// Surf_Charge element and attributes
|
||||||
|
|
||||||
s_oss << indent0 << "-name " << this->name << std::endl;
|
s_oss << indent0 << "-name " << this->name << std::endl;
|
||||||
s_oss << indent0 << "-specific_area " << this->
|
s_oss << indent1 << "-specific_area " << this->
|
||||||
specific_area << std::endl;
|
specific_area << std::endl;
|
||||||
s_oss << indent0 << "-grams " << this->grams << std::endl;
|
s_oss << indent1 << "-grams " << this->grams << std::endl;
|
||||||
s_oss << indent0 << "-charge_balance " << this->
|
s_oss << indent1 << "-charge_balance " << this->
|
||||||
charge_balance << std::endl;
|
charge_balance << std::endl;
|
||||||
s_oss << indent0 << "-mass_water " << this->
|
s_oss << indent1 << "-mass_water " << this->
|
||||||
mass_water << std::endl;
|
mass_water << std::endl;
|
||||||
s_oss << indent0 << "-la_psi " << this->
|
s_oss << indent1 << "-la_psi " << this->
|
||||||
la_psi << std::endl;
|
la_psi << std::endl;
|
||||||
s_oss << indent0 << "-la_psi1 " << this->
|
s_oss << indent1 << "-la_psi1 " << this->
|
||||||
la_psi1 << std::endl;
|
la_psi1 << std::endl;
|
||||||
s_oss << indent0 << "-la_psi2 " << this->
|
s_oss << indent1 << "-la_psi2 " << this->
|
||||||
la_psi2 << std::endl;
|
la_psi2 << std::endl;
|
||||||
s_oss << indent0 << "-capacitance0 " << this->
|
s_oss << indent1 << "-capacitance0 " << this->
|
||||||
capacitance[0] << std::endl;
|
capacitance[0] << std::endl;
|
||||||
s_oss << indent0 << "-capacitance1 " << this->
|
s_oss << indent1 << "-capacitance1 " << this->
|
||||||
capacitance[1] << std::endl;
|
capacitance[1] << std::endl;
|
||||||
|
|
||||||
// totals
|
// totals
|
||||||
s_oss << indent0;
|
s_oss << indent1;
|
||||||
s_oss << "-diffuse_layer_totals" << std::endl;
|
s_oss << "-diffuse_layer_totals" << std::endl;
|
||||||
this->diffuse_layer_totals.dump_raw(s_oss, indent + 1);
|
this->diffuse_layer_totals.dump_raw(s_oss, indent + 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxSurfaceCharge::read_raw(CParser & parser)
|
cxxSurfaceCharge::read_raw(CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
@ -395,67 +393,70 @@ cxxSurfaceCharge::read_raw(CParser & parser)
|
|||||||
if (opt == CParser::OPT_EOF || opt == CParser::OPT_KEYWORD)
|
if (opt == CParser::OPT_EOF || opt == CParser::OPT_KEYWORD)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// members that must be defined
|
if (check)
|
||||||
if (name_defined == false)
|
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
// members that must be defined
|
||||||
parser.error_msg("Name not defined for SurfaceCharge input.",
|
if (name_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (specific_area_defined == false)
|
parser.error_msg("Name not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("Specific_area not defined for SurfaceCharge input.",
|
if (specific_area_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (grams_defined == false)
|
parser.error_msg("Specific_area not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("Grams not defined for SurfaceCharge input.",
|
if (grams_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (charge_balance_defined == false)
|
parser.error_msg("Grams not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.
|
if (charge_balance_defined == false)
|
||||||
error_msg("Charge_balance not defined for SurfaceCharge input.",
|
{
|
||||||
CParser::OT_CONTINUE);
|
parser.incr_input_error();
|
||||||
}
|
parser.
|
||||||
if (mass_water_defined == false)
|
error_msg("Charge_balance not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("Mass_water not defined for SurfaceCharge input.",
|
if (mass_water_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (la_psi_defined == false)
|
parser.error_msg("Mass_water not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("La_psi not defined for SurfaceCharge input.",
|
if (la_psi_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (la_psi1_defined == false)
|
parser.error_msg("La_psi not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("La_psi1 not defined for SurfaceCharge input.",
|
if (la_psi1_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (la_psi2_defined == false)
|
parser.error_msg("La_psi1 not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("La_psi2 not defined for SurfaceCharge input.",
|
if (la_psi2_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (capacitance0_defined == false)
|
parser.error_msg("La_psi2 not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("Capacitance0 not defined for SurfaceCharge input.",
|
if (capacitance0_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (capacitance1_defined == false)
|
parser.error_msg("Capacitance0 not defined for SurfaceCharge input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("Capacitance1 not defined for SurfaceCharge input.",
|
if (capacitance1_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
|
parser.incr_input_error();
|
||||||
|
parser.error_msg("Capacitance1 not defined for SurfaceCharge input.",
|
||||||
|
CParser::OT_CONTINUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,15 +24,13 @@ class cxxSurfaceCharge
|
|||||||
|
|
||||||
struct master *get_psi_master();
|
struct master *get_psi_master();
|
||||||
|
|
||||||
static struct surface_charge *cxxSurfaceCharge2surface_charge(std::list <
|
static struct surface_charge *cxxSurfaceCharge2surface_charge(std::map < std::string, cxxSurfaceCharge > &el);
|
||||||
cxxSurfaceCharge
|
|
||||||
> &el);
|
|
||||||
|
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser);
|
void read_raw(CParser & parser, bool check = true);
|
||||||
|
|
||||||
char *get_name() const
|
char *get_name() const
|
||||||
{
|
{
|
||||||
|
|||||||
143
SurfaceComp.cxx
143
SurfaceComp.cxx
@ -101,7 +101,7 @@ cxxSurfaceComp::get_master()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct surface_comp *
|
struct surface_comp *
|
||||||
cxxSurfaceComp::cxxSurfaceComp2surface_comp(std::list < cxxSurfaceComp > &el)
|
cxxSurfaceComp::cxxSurfaceComp2surface_comp(std::map < std::string, cxxSurfaceComp > &el)
|
||||||
//
|
//
|
||||||
// Builds surface_comp structure from of cxxSurfaceComp
|
// Builds surface_comp structure from of cxxSurfaceComp
|
||||||
//
|
//
|
||||||
@ -113,23 +113,23 @@ cxxSurfaceComp::cxxSurfaceComp2surface_comp(std::list < cxxSurfaceComp > &el)
|
|||||||
malloc_error();
|
malloc_error();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::list < cxxSurfaceComp >::iterator it = el.begin();
|
for (std::map < std::string, cxxSurfaceComp >::iterator it = el.begin();
|
||||||
it != el.end(); ++it)
|
it != el.end(); ++it)
|
||||||
{
|
{
|
||||||
surf_comp_ptr[i].formula = it->formula;
|
surf_comp_ptr[i].formula = (*it).second.formula;
|
||||||
surf_comp_ptr[i].formula_totals = it->formula_totals.elt_list();
|
surf_comp_ptr[i].formula_totals = (*it).second.formula_totals.elt_list();
|
||||||
surf_comp_ptr[i].formula_z = it->formula_z;
|
surf_comp_ptr[i].formula_z = (*it).second.formula_z;
|
||||||
surf_comp_ptr[i].moles = it->moles;
|
surf_comp_ptr[i].moles = (*it).second.moles;
|
||||||
surf_comp_ptr[i].master = it->get_master();
|
surf_comp_ptr[i].master = (*it).second.get_master();
|
||||||
surf_comp_ptr[i].totals = it->totals.elt_list();
|
surf_comp_ptr[i].totals = (*it).second.totals.elt_list();
|
||||||
surf_comp_ptr[i].la = it->la;
|
surf_comp_ptr[i].la = (*it).second.la;
|
||||||
//surf_comp_ptr[i].charge = it->charge_number;
|
//surf_comp_ptr[i].charge = it->charge_number;
|
||||||
surf_comp_ptr[i].cb = it->charge_balance;
|
surf_comp_ptr[i].cb = (*it).second.charge_balance;
|
||||||
surf_comp_ptr[i].phase_name = it->phase_name;
|
surf_comp_ptr[i].phase_name = (*it).second.phase_name;
|
||||||
surf_comp_ptr[i].phase_proportion = it->phase_proportion;
|
surf_comp_ptr[i].phase_proportion = (*it).second.phase_proportion;
|
||||||
surf_comp_ptr[i].rate_name = it->rate_name;
|
surf_comp_ptr[i].rate_name = (*it).second.rate_name;
|
||||||
surf_comp_ptr[i].Dw = it->Dw;
|
surf_comp_ptr[i].Dw = (*it).second.Dw;
|
||||||
surf_comp_ptr[i].master = it->get_master();
|
surf_comp_ptr[i].master = (*it).second.get_master();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return (surf_comp_ptr);
|
return (surf_comp_ptr);
|
||||||
@ -203,41 +203,41 @@ cxxSurfaceComp::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
|
|
||||||
s_oss << indent0 << "-formula " << this->
|
s_oss << indent0 << "-formula " << this->
|
||||||
formula << std::endl;
|
formula << std::endl;
|
||||||
s_oss << indent0 << "-formula_z " << this->
|
s_oss << indent1 << "-formula_z " << this->
|
||||||
formula_z << std::endl;
|
formula_z << std::endl;
|
||||||
s_oss << indent0 << "-moles " << this->moles << std::endl;
|
s_oss << indent1 << "-moles " << this->moles << std::endl;
|
||||||
s_oss << indent0 << "-la " << this->la << std::endl;
|
s_oss << indent1 << "-la " << this->la << std::endl;
|
||||||
//s_oss << indent0 << "-charge_number " << this->charge_number << std::endl;
|
//s_oss << indent1 << "-charge_number " << this->charge_number << std::endl;
|
||||||
s_oss << indent0 << "-charge_balance " << this->
|
s_oss << indent1 << "-charge_balance " << this->
|
||||||
charge_balance << std::endl;
|
charge_balance << std::endl;
|
||||||
if (this->phase_name != NULL)
|
if (this->phase_name != NULL)
|
||||||
{
|
{
|
||||||
s_oss << indent0 << "-phase_name " << this->
|
s_oss << indent1 << "-phase_name " << this->
|
||||||
phase_name << std::endl;
|
phase_name << std::endl;
|
||||||
}
|
}
|
||||||
if (this->rate_name != NULL)
|
if (this->rate_name != NULL)
|
||||||
{
|
{
|
||||||
s_oss << indent0 << "-rate_name " << this->
|
s_oss << indent1 << "-rate_name " << this->
|
||||||
rate_name << std::endl;
|
rate_name << std::endl;
|
||||||
}
|
}
|
||||||
s_oss << indent0 << "-phase_proportion " << this->
|
s_oss << indent1 << "-phase_proportion " << this->
|
||||||
phase_proportion << std::endl;
|
phase_proportion << std::endl;
|
||||||
s_oss << indent0 << "-Dw " << this->Dw << std::endl;
|
s_oss << indent1 << "-Dw " << this->Dw << std::endl;
|
||||||
|
|
||||||
// formula_totals
|
// formula_totals
|
||||||
s_oss << indent0;
|
s_oss << indent1;
|
||||||
s_oss << "-formula_totals" << std::endl;
|
s_oss << "-formula_totals" << std::endl;
|
||||||
this->formula_totals.dump_raw(s_oss, indent + 1);
|
this->formula_totals.dump_raw(s_oss, indent + 2);
|
||||||
|
|
||||||
// totals
|
// totals
|
||||||
s_oss << indent0;
|
s_oss << indent1;
|
||||||
s_oss << "-totals" << std::endl;
|
s_oss << "-totals" << std::endl;
|
||||||
this->totals.dump_raw(s_oss, indent + 1);
|
this->totals.dump_raw(s_oss, indent + 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cxxSurfaceComp::read_raw(CParser & parser)
|
cxxSurfaceComp::read_raw(CParser & parser, bool check)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
@ -444,50 +444,53 @@ cxxSurfaceComp::read_raw(CParser & parser)
|
|||||||
if (opt == CParser::OPT_EOF || opt == CParser::OPT_KEYWORD)
|
if (opt == CParser::OPT_EOF || opt == CParser::OPT_KEYWORD)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// members that must be defined
|
if (check)
|
||||||
if (formula_defined == false)
|
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
// members that must be defined
|
||||||
parser.error_msg("Formula not defined for SurfaceComp input.",
|
if (formula_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (formula_z_defined == false)
|
parser.error_msg("Formula not defined for SurfaceComp input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("Formula_z not defined for ExchComp input.",
|
if (formula_z_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (moles_defined == false)
|
parser.error_msg("Formula_z not defined for ExchComp input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("Moles not defined for SurfaceComp input.",
|
if (moles_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
if (la_defined == false)
|
parser.error_msg("Moles not defined for SurfaceComp input.",
|
||||||
{
|
CParser::OT_CONTINUE);
|
||||||
parser.incr_input_error();
|
}
|
||||||
parser.error_msg("La not defined for SurfaceComp input.",
|
if (la_defined == false)
|
||||||
CParser::OT_CONTINUE);
|
{
|
||||||
}
|
parser.incr_input_error();
|
||||||
|
parser.error_msg("La not defined for SurfaceComp input.",
|
||||||
|
CParser::OT_CONTINUE);
|
||||||
|
}
|
||||||
#ifdef SKIP
|
#ifdef SKIP
|
||||||
if (charge_number_defined == false)
|
if (charge_number_defined == false)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
parser.error_msg("Charge_number not defined for SurfaceComp input.",
|
parser.error_msg("Charge_number not defined for SurfaceComp input.",
|
||||||
CParser::OT_CONTINUE);
|
CParser::OT_CONTINUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (charge_balance_defined == false)
|
if (charge_balance_defined == false)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
parser.error_msg("Charge_balance not defined for SurfaceComp input.",
|
parser.error_msg("Charge_balance not defined for SurfaceComp input.",
|
||||||
CParser::OT_CONTINUE);
|
CParser::OT_CONTINUE);
|
||||||
}
|
}
|
||||||
if (Dw_defined == false)
|
if (Dw_defined == false)
|
||||||
{
|
{
|
||||||
parser.incr_input_error();
|
parser.incr_input_error();
|
||||||
parser.error_msg("Dw not defined for SurfaceComp input.",
|
parser.error_msg("Dw not defined for SurfaceComp input.",
|
||||||
CParser::OT_CONTINUE);
|
CParser::OT_CONTINUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,15 +45,13 @@ class cxxSurfaceComp
|
|||||||
this->charge_balance = d;
|
this->charge_balance = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct surface_comp *cxxSurfaceComp2surface_comp(std::list <
|
static struct surface_comp *cxxSurfaceComp2surface_comp(std::map < std::string, cxxSurfaceComp > &el);
|
||||||
cxxSurfaceComp >
|
|
||||||
&el);
|
|
||||||
|
|
||||||
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
void dump_xml(std::ostream & os, unsigned int indent = 0) const;
|
||||||
|
|
||||||
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
void dump_raw(std::ostream & s_oss, unsigned int indent) const;
|
||||||
|
|
||||||
void read_raw(CParser & parser);
|
void read_raw(CParser & parser, bool check = true);
|
||||||
const cxxNameDouble & get_totals() const
|
const cxxNameDouble & get_totals() const
|
||||||
{
|
{
|
||||||
return (this->totals);
|
return (this->totals);
|
||||||
|
|||||||
@ -58,7 +58,8 @@ totals(kinetics_ptr->totals)
|
|||||||
for (i = 0; i < kinetics_ptr->count_comps; i++)
|
for (i = 0; i < kinetics_ptr->count_comps; i++)
|
||||||
{
|
{
|
||||||
cxxKineticsComp ec(&(kinetics_ptr->comps[i]));
|
cxxKineticsComp ec(&(kinetics_ptr->comps[i]));
|
||||||
this->kineticsComps.push_back(ec);
|
std::string str(ec.get_rate_name());
|
||||||
|
this->kineticsComps[str] = ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
// steps
|
// steps
|
||||||
@ -223,12 +224,12 @@ cxxKinetics::dump_raw(std::ostream & s_oss, unsigned int indent) const
|
|||||||
s_oss << "-cvode_order " << this->cvode_order << std::endl;
|
s_oss << "-cvode_order " << this->cvode_order << std::endl;
|
||||||
|
|
||||||
// kineticsComps structures
|
// kineticsComps structures
|
||||||
for (std::list < cxxKineticsComp >::const_iterator it =
|
for (std::map < std::string, cxxKineticsComp >::const_iterator it =
|
||||||
kineticsComps.begin(); it != kineticsComps.end(); ++it)
|
kineticsComps.begin(); it != kineticsComps.end(); ++it)
|
||||||
{
|
{
|
||||||
s_oss << indent1;
|
s_oss << indent1;
|
||||||
s_oss << "-component" << std::endl;
|
s_oss << "-component" << std::endl;
|
||||||
it->dump_raw(s_oss, indent + 2);
|
(*it).second.dump_raw(s_oss, indent + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// totals
|
// totals
|
||||||
@ -377,7 +378,8 @@ cxxKinetics::read_raw(CParser & parser, bool check)
|
|||||||
{
|
{
|
||||||
cxxKineticsComp kc;
|
cxxKineticsComp kc;
|
||||||
kc.read_raw(parser);
|
kc.read_raw(parser);
|
||||||
this->kineticsComps.push_back(kc);
|
std::string str(kc.get_rate_name());
|
||||||
|
this->kineticsComps[str] = kc;
|
||||||
}
|
}
|
||||||
useLastLine = true;
|
useLastLine = true;
|
||||||
break;
|
break;
|
||||||
@ -546,6 +548,7 @@ cxxKinetics::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
|
|||||||
*dd = d;
|
*dd = d;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SKIP
|
||||||
void
|
void
|
||||||
cxxKinetics::add(const cxxKinetics & addee, double extensive)
|
cxxKinetics::add(const cxxKinetics & addee, double extensive)
|
||||||
//
|
//
|
||||||
@ -592,3 +595,44 @@ cxxKinetics::add(const cxxKinetics & addee, double extensive)
|
|||||||
this->cvode_steps = addee.cvode_steps;
|
this->cvode_steps = addee.cvode_steps;
|
||||||
this->cvode_order = addee.cvode_order;
|
this->cvode_order = addee.cvode_order;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
void
|
||||||
|
cxxKinetics::add(const cxxKinetics & addee, double extensive)
|
||||||
|
//
|
||||||
|
// Add to existing ppassemblage to "this" ppassemblage
|
||||||
|
//
|
||||||
|
{
|
||||||
|
if (extensive == 0.0)
|
||||||
|
return;
|
||||||
|
//std::map < std::string, cxxKineticsComp> kineticsComps;
|
||||||
|
for (std::map < std::string, cxxKineticsComp >::const_iterator itadd =
|
||||||
|
addee.kineticsComps.begin(); itadd != addee.kineticsComps.end();
|
||||||
|
++itadd)
|
||||||
|
{
|
||||||
|
std::map < std::string, cxxKineticsComp >::iterator it = this->kineticsComps.find((*itadd).first);
|
||||||
|
if (it != this->kineticsComps.end())
|
||||||
|
{
|
||||||
|
(*it).second.add((*itadd).second, extensive);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cxxKineticsComp entity = (*itadd).second;
|
||||||
|
entity.multiply(extensive);
|
||||||
|
std::string str(entity.get_rate_name());
|
||||||
|
this->kineticsComps[str] = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//std::vector<double> steps;
|
||||||
|
this->steps = addee.steps;
|
||||||
|
//cxxNameDouble totals;
|
||||||
|
//double step_divide;
|
||||||
|
this->step_divide = addee.step_divide;
|
||||||
|
//int rk;
|
||||||
|
this->rk = addee.rk;
|
||||||
|
//int bad_step_max;
|
||||||
|
this->bad_step_max = addee.bad_step_max;
|
||||||
|
//bool use_cvode;
|
||||||
|
this->use_cvode = addee.use_cvode;
|
||||||
|
this->cvode_steps = addee.cvode_steps;
|
||||||
|
this->cvode_order = addee.cvode_order;
|
||||||
|
}
|
||||||
|
|||||||
@ -46,8 +46,8 @@ class cxxKinetics:public cxxNumKeyword
|
|||||||
void add(const cxxKinetics & addee, double extensive);
|
void add(const cxxKinetics & addee, double extensive);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::list < cxxKineticsComp > kineticsComps;
|
std::map < std::string, cxxKineticsComp > kineticsComps;
|
||||||
std::vector < double >steps;
|
std::vector < double >steps;
|
||||||
cxxNameDouble totals;
|
cxxNameDouble totals;
|
||||||
double step_divide;
|
double step_divide;
|
||||||
int rk;
|
int rk;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user