mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
Merge commit '62c51bb410b3f9fd18cc5a21b5341e9652089d86'
This commit is contained in:
commit
606942c6ed
@ -1443,6 +1443,7 @@ listtokens(FILE * f, tokenrec * l_buf)
|
||||
output_msg("TRIM");
|
||||
break;
|
||||
|
||||
case tokpad_:
|
||||
case tokpad:
|
||||
output_msg("PAD");
|
||||
break;
|
||||
@ -2639,6 +2640,7 @@ factor(struct LOC_exec * LINK)
|
||||
n.UU.sval = (parse_all) ? PhreeqcPtr->string_duplicate("unknown") : PhreeqcPtr->iso_unit(STR1.c_str());
|
||||
break;
|
||||
|
||||
case tokpad_:
|
||||
case tokpad:
|
||||
n.stringval = true;
|
||||
require(toklp, LINK);
|
||||
@ -2664,6 +2666,8 @@ factor(struct LOC_exec * LINK)
|
||||
break;
|
||||
|
||||
case toksys:
|
||||
{
|
||||
int isort = 0;
|
||||
require(toklp, LINK);
|
||||
elt_name = stringfactor(STR1, LINK);
|
||||
/*
|
||||
@ -2708,8 +2712,17 @@ factor(struct LOC_exec * LINK)
|
||||
if (LINK->t->kind != tokvar || moles_varrec->stringvar != 0)
|
||||
snerr(": can`t find moles of species");
|
||||
LINK->t = LINK->t->next;
|
||||
if (LINK->t != NULL && LINK->t->kind == tokcomma)
|
||||
{
|
||||
LINK->t = LINK->t->next;
|
||||
isort = intexpr(LINK);
|
||||
arg_num = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg_num = 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
arg_num = 1;
|
||||
@ -2767,7 +2780,7 @@ factor(struct LOC_exec * LINK)
|
||||
else
|
||||
{
|
||||
n.UU.val = PhreeqcPtr->system_total(elt_name, &count_species, &(names_arg),
|
||||
&(types_arg), &(moles_arg));
|
||||
&(types_arg), &(moles_arg), isort);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2804,6 +2817,7 @@ factor(struct LOC_exec * LINK)
|
||||
PhreeqcPtr->free_check_null(types_arg);
|
||||
PhreeqcPtr->free_check_null(moles_arg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case tokedl_species:
|
||||
@ -7415,6 +7429,7 @@ const std::map<const std::string, PBasic::BASIC_TOKEN>::value_type temp_tokens[]
|
||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("rtrim", PBasic::tokrtrim),
|
||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("trim", PBasic::toktrim),
|
||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("pad", PBasic::tokpad),
|
||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("pad$", PBasic::tokpad_),
|
||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("rxn", PBasic::tokrxn),
|
||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("dist", PBasic::tokdist),
|
||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("mol", PBasic::tokmol),
|
||||
|
||||
@ -272,6 +272,7 @@ public:
|
||||
tokrtrim,
|
||||
toktrim,
|
||||
tokpad,
|
||||
tokpad_,
|
||||
tokchange_por,
|
||||
tokget_por,
|
||||
tokosmotic,
|
||||
|
||||
@ -151,8 +151,9 @@ public:
|
||||
LDBLE surf_total(const char *total_name, const char *surface_name);
|
||||
LDBLE surf_total_no_redox(const char *total_name, const char *surface_name);
|
||||
static int system_species_compare(const void *ptr1, const void *ptr2);
|
||||
static int system_species_compare_name(const void* ptr1, const void* ptr2);
|
||||
LDBLE system_total(const char *total_name, LDBLE * count, char ***names,
|
||||
char ***types, LDBLE ** moles);
|
||||
char ***types, LDBLE ** moles, int i);
|
||||
std::string kinetics_formula(std::string kinetics_name, cxxNameDouble &stoichiometry);
|
||||
std::string phase_formula(std::string phase_name, cxxNameDouble &stoichiometry);
|
||||
std::string species_formula(std::string phase_name, cxxNameDouble &stoichiometry);
|
||||
|
||||
@ -2980,7 +2980,7 @@ edl_species(const char *surf_name, LDBLE * count, char ***names, LDBLE ** moles,
|
||||
/* ---------------------------------------------------------------------- */
|
||||
LDBLE Phreeqc::
|
||||
system_total(const char *total_name, LDBLE * count, char ***names,
|
||||
char ***types, LDBLE ** moles)
|
||||
char ***types, LDBLE ** moles, int isort)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
/*
|
||||
@ -3043,11 +3043,16 @@ system_total(const char *total_name, LDBLE * count, char ***names,
|
||||
/*
|
||||
* Sort system species
|
||||
*/
|
||||
if (count_sys > 1)
|
||||
if (count_sys > 1 && isort == 0)
|
||||
{
|
||||
qsort(sys, (size_t) count_sys,
|
||||
(size_t) sizeof(struct system_species), system_species_compare);
|
||||
}
|
||||
else
|
||||
{
|
||||
qsort(sys, (size_t)count_sys,
|
||||
(size_t)sizeof(struct system_species), system_species_compare_name);
|
||||
}
|
||||
/*
|
||||
* malloc space
|
||||
*/
|
||||
@ -4211,6 +4216,16 @@ system_species_compare(const void *ptr1, const void *ptr2)
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
int Phreeqc::
|
||||
system_species_compare_name(const void* ptr1, const void* ptr2)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
const struct system_species* a, * b;
|
||||
|
||||
a = (const struct system_species*)ptr1;
|
||||
b = (const struct system_species*)ptr2;
|
||||
return (strncmp(a->name, b->name, MAX_LENGTH));
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
int Phreeqc::
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user