Merge commit '0aa30d21ac10b0ea13ad3cb1f701e7e3cac7eda7'

This commit is contained in:
Darth Vader 2021-04-07 19:26:57 +00:00
commit 5c0e718999
5 changed files with 49 additions and 49 deletions

View File

@ -427,9 +427,11 @@ size_t Phreeqc::list_Exchangers(std::list<std::string> &list_exname)
} }
Phreeqc::Phreeqc(PHRQ_io *io) Phreeqc::Phreeqc(PHRQ_io *io)
{ {
//user_print = NULL; user_print = NULL;
//sformatf_buffer = NULL; sformatf_buffer = NULL;
//basic_interpreter = NULL; basic_interpreter = NULL;
count_elts = 0;
aphi = NULL;
// phrq_io // phrq_io
if (io) if (io)
{ {
@ -1141,9 +1143,11 @@ void Phreeqc::init(void)
/*-----------------------------------------------------*/ /*-----------------------------------------------------*/
Phreeqc::Phreeqc(const Phreeqc &src) Phreeqc::Phreeqc(const Phreeqc &src)
{ {
//user_print = NULL; user_print = NULL;
//sformatf_buffer = NULL; sformatf_buffer = NULL;
//basic_interpreter = NULL; basic_interpreter = NULL;
count_elts = 0;
aphi = NULL;
//this->phrq_io = src.phrq_io; //this->phrq_io = src.phrq_io;
this->phrq_io = &this->ioInstance; this->phrq_io = &this->ioInstance;
this->init(); this->init();

View File

@ -1352,7 +1352,7 @@ protected:
* Element List * Element List
*---------------------------------------------------------------------- */ *---------------------------------------------------------------------- */
std::vector<class elt_list> elt_list; std::vector<class elt_list> elt_list;
size_t count_elts = 0; /* number of elements in elt_list = position of next */ size_t count_elts; /* number of elements in elt_list = position of next */
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
* Reaction * Reaction
*---------------------------------------------------------------------- */ *---------------------------------------------------------------------- */
@ -1442,7 +1442,7 @@ protected:
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* USER PRINT COMMANDS * USER PRINT COMMANDS
* ---------------------------------------------------------------------- */ * ---------------------------------------------------------------------- */
class rate* user_print = 0; class rate* user_print;
int n_user_punch_index; int n_user_punch_index;
int fpunchf_user_s_warning; int fpunchf_user_s_warning;
@ -1615,7 +1615,7 @@ protected:
PHRQMemHeader* s_pTail; PHRQMemHeader* s_pTail;
/* Basic */ /* Basic */
PBasic* basic_interpreter = NULL; PBasic* basic_interpreter;
double (*basic_callback_ptr) (double x1, double x2, const char* str, void* cookie); double (*basic_callback_ptr) (double x1, double x2, const char* str, void* cookie);
void* basic_callback_cookie; void* basic_callback_cookie;
@ -1716,7 +1716,7 @@ protected:
int use_etheta; int use_etheta;
LDBLE OTEMP, OPRESS; LDBLE OTEMP, OPRESS;
LDBLE A0; LDBLE A0;
class pitz_param* aphi = NULL; class pitz_param* aphi/* = NULL*/;
std::vector<class species*> spec; std::vector<class species*> spec;
class species** cations, ** anions, ** neutrals; // pointers to spec class species** cations, ** anions, ** neutrals; // pointers to spec
int count_cations, count_anions, count_neutrals; int count_cations, count_anions, count_neutrals;
@ -1740,8 +1740,8 @@ protected:
dumper dump_info; dumper dump_info;
StorageBinList delete_info; StorageBinList delete_info;
runner run_info; runner run_info;
char* sformatf_buffer = NULL; char* sformatf_buffer;
size_t sformatf_buffer_size = 0; size_t sformatf_buffer_size;
/* readtr.cpp */ /* readtr.cpp */
std::string dump_file_name_cpp; std::string dump_file_name_cpp;

View File

@ -501,8 +501,8 @@ process_file_names(int argc, char *argv[], std::istream **db_cookie,
line = (char *) free_check_null(line); line = (char *) free_check_null(line);
line_save = (char *) free_check_null(line_save); line_save = (char *) free_check_null(line_save);
*db_cookie = new std::ifstream(db_file, std::ios_base::in); *db_cookie = new std::ifstream(db_file.c_str(), std::ios_base::in);
*input_cookie = new std::ifstream(in_file, std::ios_base::in); *input_cookie = new std::ifstream(in_file.c_str(), std::ios_base::in);
} }
catch (const PhreeqcStop&) catch (const PhreeqcStop&)
{ {
@ -547,7 +547,7 @@ open_input_stream(std::string query, std::string& default_name, std::ios_base::o
/* /*
* Open existing file to read * Open existing file to read
*/ */
new_stream = new std::ifstream(name, mode); new_stream = new std::ifstream(name.c_str(), mode);
if (new_stream == NULL || !new_stream->is_open()) if (new_stream == NULL || !new_stream->is_open())
{ {
phrq_io->Set_error_ostream(&std::cerr); phrq_io->Set_error_ostream(&std::cerr);
@ -606,7 +606,7 @@ open_output_stream(std::string query, std::string& default_name, std::ios_base::
/* /*
* Open existing file to read * Open existing file to read
*/ */
new_stream = new std::ofstream(name, mode); new_stream = new std::ofstream(name.c_str(), mode);
if (new_stream == NULL || !new_stream->is_open()) if (new_stream == NULL || !new_stream->is_open())
{ {
phrq_io->Set_error_ostream(&std::cerr); phrq_io->Set_error_ostream(&std::cerr);

View File

@ -448,16 +448,16 @@ public:
~Model() ~Model()
{ {
}; };
bool force_prep = false; bool force_prep;
bool numerical_fixed_volume = false; bool numerical_fixed_volume;
cxxGasPhase::GP_TYPE gas_phase_type = cxxGasPhase::GP_UNKNOWN; cxxGasPhase::GP_TYPE gas_phase_type;
std::vector<class phase*> gas_phase; std::vector<class phase*> gas_phase;
std::vector<const char*> ss_assemblage; std::vector<const char*> ss_assemblage;
std::vector<class phase*> pp_assemblage; std::vector<class phase*> pp_assemblage;
std::vector<double> si; std::vector<double> si;
std::vector<const char*> add_formula; std::vector<const char*> add_formula;
cxxSurface::DIFFUSE_LAYER_TYPE dl_type = cxxSurface::NO_DL; cxxSurface::DIFFUSE_LAYER_TYPE dl_type;
cxxSurface::SURFACE_TYPE surface_type = cxxSurface::UNKNOWN_DL; cxxSurface::SURFACE_TYPE surface_type;
std::vector<const char*> surface_comp; std::vector<const char*> surface_comp;
std::vector<const char*> surface_charge; std::vector<const char*> surface_charge;
}; };
@ -763,7 +763,7 @@ public:
} }
const char* name; const char* name;
const char* mole_balance; const char* mole_balance;
int in = FALSE; int in;
int number; int number;
class master* primary; class master* primary;
class master* secondary; class master* secondary;
@ -926,15 +926,15 @@ public:
LDBLE delta_v[9]; LDBLE delta_v[9];
LDBLE pr_si_f; LDBLE pr_si_f;
bool pr_in; bool pr_in;
int type = SOLID; int type;
std::vector<class elt_list> next_elt; std::vector<class elt_list> next_elt;
std::vector<class elt_list> next_sys_total; std::vector<class elt_list> next_sys_total;
int check_equation; int check_equation;
CReaction rxn; CReaction rxn;
CReaction rxn_s; CReaction rxn_s;
CReaction rxn_x; CReaction rxn_x;
int replaced = FALSE; int replaced;
int in_system = FALSE; int in_system;
}; };
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
* Master species * Master species
@ -995,7 +995,7 @@ public:
LDBLE total_primary; LDBLE total_primary;
class element* elt; class element* elt;
LDBLE alk; LDBLE alk;
LDBLE gfw = 1; LDBLE gfw;
const char* gfw_formula; const char* gfw_formula;
class unknown* unknown; class unknown* unknown;
class species* s; class species* s;
@ -1075,7 +1075,7 @@ public:
const char* ss_comp_name; const char* ss_comp_name;
void* ss_comp_ptr; void* ss_comp_ptr;
int ss_comp_number; int ss_comp_number;
int ss_in = FALSE; int ss_in;
const char* surface_comp; const char* surface_comp;
const char* surface_charge; const char* surface_charge;
LDBLE related_moles; LDBLE related_moles;
@ -1085,7 +1085,7 @@ public:
std::vector<class unknown*> comp_unknowns; std::vector<class unknown*> comp_unknowns;
class unknown* phase_unknown; class unknown* phase_unknown;
LDBLE mass_water; LDBLE mass_water;
int dissolve_only = FALSE; int dissolve_only;
LDBLE inert_moles; LDBLE inert_moles;
LDBLE V_m; LDBLE V_m;
LDBLE pressure; LDBLE pressure;
@ -1122,10 +1122,10 @@ public:
coef = 0; // coefficient of species name coef = 0; // coefficient of species name
} }
const char* name; const char* name;
LDBLE z = 0; LDBLE z;
class species* s; class species* s;
class unknown* unknown; class unknown* unknown;
LDBLE coef = 0; LDBLE coef;
}; };
class unknown_list class unknown_list
{ {
@ -1236,7 +1236,7 @@ public:
varbase = NULL; varbase = NULL;
loopbase = NULL; loopbase = NULL;
} }
const char* name = NULL; const char* name;
std::string commands; std::string commands;
int new_def; int new_def;
void* linebase; void* linebase;
@ -1306,7 +1306,7 @@ public:
} }
class spread_row* heading; class spread_row* heading;
class spread_row* units; class spread_row* units;
int count_rows = 0; int count_rows;
class spread_row** rows; class spread_row** rows;
class defaults defaults; class defaults defaults;
}; };
@ -1535,7 +1535,7 @@ public:
tot_stag = 0; tot_stag = 0;
charge = 0; charge = 0;
} }
const char* name = NULL; const char* name;
LDBLE tot1, tot2, tot_stag, charge; LDBLE tot1, tot2, tot_stag, charge;
}; };
class M_S class M_S
@ -1580,7 +1580,7 @@ public:
const char* species[3]; const char* species[3];
int ispec[3]; int ispec[3];
pitz_param_type type; pitz_param_type type;
LDBLE p = 0; LDBLE p;
union union
{ {
LDBLE b0; LDBLE b0;

View File

@ -1416,20 +1416,18 @@ solve_with_mask(class inverse *inv_ptr, unsigned long cur_bits)
kode = 1; kode = 1;
iter = 100000; iter = 100000;
count_calls++; count_calls++;
#ifdef INVERSE_CL1MP #ifdef INVERSE_CL1MP
if (inv_ptr->mp == TRUE) if (inv_ptr->mp == TRUE)
{ {
cl1mp(k, l, m, n, cl1mp(k, l, m, n, (int)nklmd, (int)n2d, &array1[0],
nklmd, n2d, array1, &kode, inv_ptr->mp_tolerance, &iter, &delta2[0], &inv_res[0],
&kode, inv_ptr->mp_tolerance, &iter, &error, &inv_cu[0], &inv_iu[0], &inv_is[0], TRUE, inv_ptr->mp_censor);
delta2, inv_res, &error, inv_cu, inv_iu, inv_is, TRUE, inv_ptr->mp_censor);
} }
else else
{ {
cl1(k, l, m, n, cl1(k, l, m, n, (int)nklmd, (int)n2d, &array1[0],
nklmd, n2d, array1, &kode, toler, &iter, &delta2[0], &inv_res[0],
&kode, toler, &iter, delta2, inv_res, &error, inv_cu, inv_iu, inv_is, TRUE); &error, &inv_cu[0], &inv_iu[0], &inv_is[0], TRUE);
} }
#else #else
cl1(k, l, m, n, (int)nklmd, (int)n2d, &array1[0], cl1(k, l, m, n, (int)nklmd, (int)n2d, &array1[0],
@ -2422,16 +2420,14 @@ range(class inverse *inv_ptr, unsigned long cur_bits)
#ifdef INVERSE_CL1MP #ifdef INVERSE_CL1MP
if (inv_ptr->mp == TRUE) if (inv_ptr->mp == TRUE)
{ {
cl1mp(k, l, m, n, cl1mp(k, l, m, n, (int)nklmd, (int)n2d, &array1[0],
nklmd, n2d, array1, &kode, inv_ptr->mp_tolerance, &iter, &delta2[0], &inv_res[0],
&kode, inv_ptr->mp_tolerance, &iter, &error2, &inv_cu[0], &inv_iu[0], &inv_is[0], TRUE, inv_ptr->mp_censor);
delta2, inv_res, &error2, inv_cu, inv_iu, inv_is, TRUE,
inv_ptr->mp_censor);
} }
else else
{ {
cl1(k, l, m, n, nklmd, n2d, array1, &kode, toler, &iter, delta2, cl1(k, l, m, n, (int)nklmd, (int)n2d, &array1[0], &kode, toler, &iter, &delta2[0],
inv_res, &error2, inv_cu, inv_iu, inv_is, TRUE); &inv_res[0], &error2, &inv_cu[0], &inv_iu[0], &inv_is[0], TRUE);
} }
#else #else
cl1(k, l, m, n, (int)nklmd, (int)n2d, &array1[0], &kode, toler, &iter, &delta2[0], cl1(k, l, m, n, (int)nklmd, (int)n2d, &array1[0], &kode, toler, &iter, &delta2[0],