diff --git a/ChartObject.cpp b/ChartObject.cpp index 230c4805..f225594e 100644 --- a/ChartObject.cpp +++ b/ChartObject.cpp @@ -1318,7 +1318,7 @@ ChartObject::dump(std::ostream & oss, unsigned int indent) oss << indent1 << "-end" << "\n"; /* - struct rate *user_graph; + class rate *user_graph; // C++ for rate struct std::string rate_name; std::list rate_command_list; diff --git a/ChartObject.h b/ChartObject.h index 5e7e2eb0..3402febf 100644 --- a/ChartObject.h +++ b/ChartObject.h @@ -230,11 +230,11 @@ class ChartObject:public cxxNumKeyword { return this->point_added; } - struct rate *Get_user_graph() + class rate *Get_user_graph() { return this->user_graph; } - const struct rate *Get_user_graph()const + const class rate *Get_user_graph()const { return this->user_graph; } @@ -399,8 +399,8 @@ class ChartObject:public cxxNumKeyword bool curve_added; bool point_added; - struct rate *user_graph; - // C++ for rate struct + class rate *user_graph; + // C++ for rate class std::string rate_name; std::list rate_command_list; std::list rate_command_list_original; diff --git a/GasPhase.cxx b/GasPhase.cxx index bfe9bac7..859f3b81 100644 --- a/GasPhase.cxx +++ b/GasPhase.cxx @@ -458,7 +458,7 @@ cxxGasPhase::totalize(Phreeqc * phreeqc_ptr) // component structures for (size_t i = 0; i < this->gas_comps.size(); i++) { - struct phase *phase_ptr; + class phase *phase_ptr; int l; phase_ptr = phreeqc_ptr-> phase_bsearch(this->gas_comps[i].Get_phase_name().c_str(), &l, FALSE); if (phase_ptr != NULL) diff --git a/NameDouble.cxx b/NameDouble.cxx index 0f8e667e..46ef9544 100644 --- a/NameDouble.cxx +++ b/NameDouble.cxx @@ -29,11 +29,11 @@ cxxNameDouble::cxxNameDouble() { this->type = ND_ELT_MOLES; } -cxxNameDouble::cxxNameDouble(const std::vector& el) +cxxNameDouble::cxxNameDouble(const std::vector& el) // constructor for cxxNameDouble from vector of elt_list { size_t i; - const struct elt_list* elt_list_ptr = &el[0]; + const class elt_list* elt_list_ptr = &el[0]; for (i = 0; elt_list_ptr[i].elt != NULL; i++) { (*this)[elt_list_ptr[i].elt->name] = elt_list_ptr[i].coef; @@ -74,7 +74,7 @@ cxxNameDouble::cxxNameDouble(std::map < std::string, cxxISolutionComp > &comps) } this->type = ND_ELT_MOLES; } -cxxNameDouble::cxxNameDouble(struct name_coef *nc, int count) +cxxNameDouble::cxxNameDouble(class name_coef *nc, int count) // // constructor for cxxNameDouble from list of elt_list // diff --git a/NameDouble.h b/NameDouble.h index 7edb65ff..cbc9091f 100644 --- a/NameDouble.h +++ b/NameDouble.h @@ -28,10 +28,10 @@ class IPQ_DLL_EXPORT cxxNameDouble:public }; cxxNameDouble(); - cxxNameDouble(const std::vector& el); + cxxNameDouble(const std::vector& el); cxxNameDouble(std::map < std::string, cxxISolutionComp > &comps); - cxxNameDouble(struct name_coef *nc, int count); + cxxNameDouble(class name_coef *nc, int count); cxxNameDouble(const cxxNameDouble & old, LDBLE factor); ~cxxNameDouble(); diff --git a/PPassemblageComp.cxx b/PPassemblageComp.cxx index ea35b2b6..ab75edac 100644 --- a/PPassemblageComp.cxx +++ b/PPassemblageComp.cxx @@ -315,7 +315,7 @@ cxxPPassemblageComp::totalize(Phreeqc * phreeqc_ptr) // component structures if (this->add_formula.size() != 0) return; - struct phase *phase_ptr; + class phase *phase_ptr; int l; phase_ptr = phreeqc_ptr-> phase_bsearch(this->name.c_str(), &l, FALSE); if (phase_ptr != NULL) diff --git a/Phreeqc.cpp b/Phreeqc.cpp index e23b3572..85975752 100644 --- a/Phreeqc.cpp +++ b/Phreeqc.cpp @@ -15,24 +15,40 @@ #include "Temperature.h" #include "SSassemblage.h" -const struct const_iso Phreeqc::iso_defaults[] = { - {"13C", -10, 1}, - {"13C(4)", -10, 1}, - {"13C(-4)", -50, 5}, - {"34S", 10, 1}, - {"34S(6)", 10, 1}, - {"34S(-2)", -30, 5}, - {"2H", -28, 1}, - {"2H(1)", -28, 1}, - {"2H(0)", -28, 1}, - {"18O", -5, .1}, - {"18O(-2)", -5, .1}, - {"18O(0)", -5, .1}, - {"87Sr", .71, .01}, - {"11B", 20, 5} +//const const_iso Phreeqc::iso_defaults[] = { +// {"13C", -10, 1}, +// {"13C(4)", -10, 1}, +// {"13C(-4)", -50, 5}, +// {"34S", 10, 1}, +// {"34S(6)", 10, 1}, +// {"34S(-2)", -30, 5}, +// {"2H", -28, 1}, +// {"2H(1)", -28, 1}, +// {"2H(0)", -28, 1}, +// {"18O", -5, .1}, +// {"18O(-2)", -5, .1}, +// {"18O(0)", -5, .1}, +// {"87Sr", .71, .01}, +// {"11B", 20, 5} +//}; +const class const_iso Phreeqc::iso_defaults[] = { + const_iso("13C", -10, 1), + const_iso("13C(4)", -10, 1), + const_iso("13C(-4)", -50, 5), + const_iso("34S", 10, 1), + const_iso("34S(6)", 10, 1), + const_iso("34S(-2)", -30, 5), + const_iso("2H", -28, 1), + const_iso("2H(1)", -28, 1), + const_iso("2H(0)", -28, 1), + const_iso("18O", -5, .1), + const_iso("18O(-2)", -5, .1), + const_iso("18O(0)", -5, .1), + const_iso("87Sr", .71, .01), + const_iso("11B", 20, 5) }; -const int Phreeqc::count_iso_defaults = (sizeof(iso_defaults) / sizeof(struct const_iso)); +const int Phreeqc::count_iso_defaults = (sizeof(iso_defaults) / sizeof(class const_iso)); Phreeqc::~Phreeqc(void) { @@ -150,7 +166,7 @@ size_t Phreeqc::list_components(std::list &list_c) if (it->first == "Charge") continue; char string[MAX_LENGTH]; strcpy(string, it->first.c_str()); - struct master *master_ptr = master_bsearch_primary(string); + class master *master_ptr = master_bsearch_primary(string); if (master_ptr == NULL) continue; if (master_ptr->type != AQ) continue; accumulator.add(master_ptr->elt->name, 1); @@ -158,7 +174,7 @@ size_t Phreeqc::list_components(std::list &list_c) // print list for (it = accumulator.begin(); it != accumulator.end(); it++) { - struct master *master_ptr = master_bsearch(it->first.c_str()); + class master *master_ptr = master_bsearch(it->first.c_str()); if (master_ptr == NULL) continue; if (master_ptr->type != AQ) continue; if (master_ptr->primary == 0) continue; @@ -385,7 +401,7 @@ size_t Phreeqc::list_Exchangers(std::list &list_exname) cxxNameDouble::iterator it = nd.begin(); for (; it != nd.end(); it++) { - struct master *m = master_bsearch(it->first.c_str()); + class master *m = master_bsearch(it->first.c_str()); if (m != NULL) { if (m->type == EX) @@ -769,7 +785,7 @@ void Phreeqc::init(void) fpunchf_user_buffer[0] = 0; #if defined PHREEQ98 - struct rate *user_graph; + class rate *user_graph; char **user_graph_headings; int user_graph_count_headings; #endif @@ -1172,19 +1188,19 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) use_kinetics_limiter = pSrc->use_kinetics_limiter; save_values = pSrc->save_values; save = pSrc->save; - //struct copier copy_solution; - //struct copier copy_pp_assemblage; - //struct copier copy_exchange; - //struct copier copy_surface; - //struct copier copy_ss_assemblage; - //struct copier copy_gas_phase; - //struct copier copy_kinetics; - //struct copier copy_mix; - //struct copier copy_reaction; - //struct copier copy_temperature; - //struct copier copy_pressure; + //class copier copy_solution; + //class copier copy_pp_assemblage; + //class copier copy_exchange; + //class copier copy_surface; + //class copier copy_ss_assemblage; + //class copier copy_gas_phase; + //class copier copy_kinetics; + //class copier copy_mix; + //class copier copy_reaction; + //class copier copy_temperature; + //class copier copy_pressure; // Inverse not implemented - //std::vector inverse; + //std::vector inverse; count_inverse = 0; // Mix Rxn_mix_map = pSrc->Rxn_mix_map; @@ -1213,14 +1229,14 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) Rxn_ss_assemblage_map = pSrc->Rxn_ss_assemblage_map; Rxn_pp_assemblage_map = pSrc->Rxn_pp_assemblage_map; - std::vector species_list; + std::vector species_list; // will be rebuilt - //std::vector sum_jacob0; - //std::vector sum_mb1; - //std::vector sum_jacob1; - //std::vector sum_mb2; - //std::vector sum_jacob2; - //std::vector sum_delta; + //std::vector sum_jacob0; + //std::vector sum_mb1; + //std::vector sum_jacob1; + //std::vector sum_mb2; + //std::vector sum_jacob2; + //std::vector sum_delta; // Solution Rxn_solution_map = pSrc->Rxn_solution_map; unnumbered_solutions = pSrc->unnumbered_solutions; @@ -1336,7 +1352,7 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) for (int i = 0; i < (int)pSrc->elements.size(); i++) { const char* ptr = string_hsave(pSrc->elements[i]->name); - struct element* elt_ptr = element_store(ptr); + class element* elt_ptr = element_store(ptr); elt_ptr->gfw = pSrc->elements[i]->gfw; } element_h_one = element_store("H(1)"); @@ -1348,15 +1364,15 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) //logk.clear(); //for (size_t i = 0; i < pSrc->logk.size(); i++) //{ - // struct logk* tlk = new struct logk; + // class logk* tlk = new class logk; // *tlk = *pSrc->logk[i]; // tlk->name = string_hsave(pSrc->logk[i]->name); // logk.push_back(tlk); //} for (int i = 0; i < (int)pSrc->logk.size(); i++) { - struct logk* logk_ptr = logk_store(pSrc->logk[i]->name, FALSE); - //memcpy(logk_ptr, pSrc->logk[i], sizeof(struct logk)); + class logk* logk_ptr = logk_store(pSrc->logk[i]->name, FALSE); + //memcpy(logk_ptr, pSrc->logk[i], sizeof(class logk)); *logk_ptr = *pSrc->logk[i]; logk_ptr->name = string_hsave(pSrc->logk[i]->name); logk_ptr->add_logk.resize(pSrc->logk[i]->add_logk.size()); @@ -1369,8 +1385,8 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) // s, species for (int i = 0; i < (int)pSrc->s.size(); i++) { - struct species* s_ptr = s_store(pSrc->s[i]->name, pSrc->s[i]->z, FALSE); - //memcpy(s_ptr, pSrc->s[i], sizeof(struct species)); + class species* s_ptr = s_store(pSrc->s[i]->name, pSrc->s[i]->z, FALSE); + //memcpy(s_ptr, pSrc->s[i], sizeof(class species)); *s_ptr = *pSrc->s[i]; // fix up all pointers s_ptr->name = string_hsave(pSrc->s[i]->name); @@ -1410,8 +1426,8 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) *---------------------------------------------------------------------- */ for (int i = 0; i < (int)pSrc->phases.size(); i++) { - struct phase* phase_ptr = phase_store(pSrc->phases[i]->name); - //memcpy(phase_ptr, pSrc->phases[i], sizeof(struct phase)); + class phase* phase_ptr = phase_store(pSrc->phases[i]->name); + //memcpy(phase_ptr, pSrc->phases[i], sizeof(class phase)); *phase_ptr = *pSrc->phases[i]; // clean up pointers phase_ptr->name = string_hsave(pSrc->phases[i]->name); @@ -1435,8 +1451,8 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) for (size_t i = 0; i < pSrc->master.size(); i++) { master.resize(i + 1); - master[i] = new struct master; - //memcpy(master[i], pSrc->master[i], sizeof(struct master)); + master[i] = new class master; + //memcpy(master[i], pSrc->master[i], sizeof(class master)); *master[i] = *pSrc->master[i]; // clean up pointers master[i]->gfw_formula = string_hsave(pSrc->master[i]->gfw_formula); @@ -1470,7 +1486,7 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) //gas_unknowns; //mb_unknowns // Reaction work space - // struct reaction_temp trxn; + // class reaction_temp trxn; count_trxn = 0; // Print pr = pSrc->pr; @@ -1602,7 +1618,7 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) std::map::iterator it = UserPunch_map.begin(); for (; it != UserPunch_map.end(); it++) { - struct rate* rate_new = new struct rate; + class rate* rate_new = new class rate; rate_new = rate_copy(it->second.Get_rate()); it->second.Set_rate(rate_new); it->second.Set_PhreeqcPtr(this); @@ -1613,18 +1629,18 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) spread_length = pSrc->spread_length; //maps set by store below //std::map strings_map; - //std::map elements_map; - //std::map species_map; - //std::map phases_map; - //std::map logk_map; - //std::map master_isotope_map; + //std::map elements_map; + //std::map species_map; + //std::map phases_map; + //std::map logk_map; + //std::map master_isotope_map; /* ---------------------------------------------------------------------- * ISOTOPES * ---------------------------------------------------------------------- */ for (int i = 0; i < (int)pSrc->master_isotope.size(); i++) { - struct master_isotope* master_isotope_ptr = master_isotope_store(pSrc->master_isotope[i]->name, FALSE); - memcpy(master_isotope_ptr, pSrc->master_isotope[i], sizeof(struct master_isotope)); + class master_isotope* master_isotope_ptr = master_isotope_store(pSrc->master_isotope[i]->name, FALSE); + memcpy(master_isotope_ptr, pSrc->master_isotope[i], sizeof(class master_isotope)); master_isotope_ptr->name = string_hsave(pSrc->master_isotope[i]->name); int n; master_isotope_ptr->master = NULL; @@ -1651,27 +1667,27 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) // Calculate values for (int i = 0; i < pSrc->calculate_value.size(); i++) { - struct calculate_value* calculate_value_ptr = calculate_value_store(pSrc->calculate_value[i]->name, FALSE); + class calculate_value* calculate_value_ptr = calculate_value_store(pSrc->calculate_value[i]->name, FALSE); calculate_value_ptr->value = pSrc->calculate_value[i]->value; calculate_value[i]->commands = pSrc->calculate_value[i]->commands; } // More isotopes for (int i = 0; i < (int)pSrc->isotope_ratio.size(); i++) { - struct isotope_ratio* isotope_ratio_ptr = isotope_ratio_store(pSrc->isotope_ratio[i]->name, FALSE); + class isotope_ratio* isotope_ratio_ptr = isotope_ratio_store(pSrc->isotope_ratio[i]->name, FALSE); isotope_ratio_ptr->name = string_hsave(pSrc->isotope_ratio[i]->name); isotope_ratio_ptr->isotope_name = string_hsave(pSrc->isotope_ratio[i]->isotope_name); isotope_ratio_ptr->ratio = pSrc->isotope_ratio[i]->ratio; isotope_ratio_ptr->converted_ratio = pSrc->isotope_ratio[i]->converted_ratio; } - //std::map isotope_ratio_map; + //std::map isotope_ratio_map; for (int i = 0; i < (int)pSrc->isotope_alpha.size(); i++) { - struct isotope_alpha* isotope_alpha_ptr = isotope_alpha_store(pSrc->isotope_alpha[i]->name, FALSE); + class isotope_alpha* isotope_alpha_ptr = isotope_alpha_store(pSrc->isotope_alpha[i]->name, FALSE); isotope_alpha_ptr->named_logk = string_hsave(pSrc->isotope_alpha[i]->named_logk); isotope_alpha_ptr->value = pSrc->isotope_alpha[i]->value; } - //std::map isotope_alpha_map; + //std::map isotope_alpha_map; // Misc phreeqc_mpi_myself = 0; first_read_input = pSrc->first_read_input; @@ -1838,7 +1854,7 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc) { size_t count_theta_params = theta_params.size(); theta_params.resize(count_theta_params + 1); - theta_params[count_theta_params] = new struct theta_param; + theta_params[count_theta_params] = new class theta_param; *theta_params[count_theta_params] = *pSrc->theta_params[i]; } use_etheta = pSrc->use_etheta; diff --git a/Phreeqc.h b/Phreeqc.h index c5cd1ca6..92d188aa 100644 --- a/Phreeqc.h +++ b/Phreeqc.h @@ -284,26 +284,26 @@ public: int inverse_models(void); int add_to_file(const char* filename, const char* string); int bit_print(unsigned long bits, int l); - int carbon_derivs(struct inverse* inv_ptr); - int check_isotopes(struct inverse* inv_ptr); - int check_solns(struct inverse* inv_ptr); - bool set_isotope_unknowns(struct inverse* inv_ptrs); + int carbon_derivs(class inverse* inv_ptr); + int check_isotopes(class inverse* inv_ptr); + int check_solns(class inverse* inv_ptr); + bool set_isotope_unknowns(class inverse* inv_ptrs); cxxSolutionIsotope* get_isotope(cxxSolution* solution_ptr, const char* elt); LDBLE get_inv_total(cxxSolution* solution_ptr, const char* elt); - int isotope_balance_equation(struct inverse* inv_ptr, int row, int n); + int isotope_balance_equation(class inverse* inv_ptr, int row, int n); int post_mortem(void); bool test_cl1_solution(void); unsigned long get_bits(unsigned long bits, int position, int number); - unsigned long minimal_solve(struct inverse* inv_ptr, + unsigned long minimal_solve(class inverse* inv_ptr, unsigned long minimal_bits); - void dump_netpath(struct inverse* inv_ptr); - int dump_netpath_pat(struct inverse* inv_ptr); - int next_set_phases(struct inverse* inv_ptr, int first_of_model_size, + void dump_netpath(class inverse* inv_ptr); + int dump_netpath_pat(class inverse* inv_ptr); + int next_set_phases(class inverse* inv_ptr, int first_of_model_size, int model_size); - int phase_isotope_inequalities(struct inverse* inv_ptr); - int print_model(struct inverse* inv_ptr); - int punch_model_heading(struct inverse* inv_ptr); - int punch_model(struct inverse* inv_ptr); + int phase_isotope_inequalities(class inverse* inv_ptr); + int print_model(class inverse* inv_ptr); + int punch_model_heading(class inverse* inv_ptr); + int punch_model(class inverse* inv_ptr); void print_isotope(FILE* netpath_file, cxxSolution* solution_ptr, const char* elt, const char* string); void print_total(FILE* netpath_file, cxxSolution* solution_ptr, @@ -315,54 +315,54 @@ public: void print_total_pat(FILE* netpath_file, const char* elt, const char* string); - int range(struct inverse* inv_ptr, unsigned long cur_bits); + int range(class inverse* inv_ptr, unsigned long cur_bits); int save_bad(unsigned long bits); int save_good(unsigned long bits); int save_minimal(unsigned long bits); unsigned long set_bit(unsigned long bits, int position, int value); - int setup_inverse(struct inverse* inv_ptr); + int setup_inverse(class inverse* inv_ptr); int set_initial_solution(int n_user_old, int n_user_new); - int set_ph_c(struct inverse* inv_ptr, + int set_ph_c(class inverse* inv_ptr, int i, cxxSolution* soln_ptr_orig, int n_user_new, LDBLE d_alk, LDBLE ph_factor, LDBLE alk_factor); - int shrink(struct inverse* inv_ptr, LDBLE* array_in, + int shrink(class inverse* inv_ptr, LDBLE* array_in, LDBLE* array_out, int* k, int* l, int* m, int* n, unsigned long cur_bits, LDBLE* delta_l, int* col_back_l, int* row_back_l); - int solve_inverse(struct inverse* inv_ptr); - int solve_with_mask(struct inverse* inv_ptr, unsigned long cur_bits); + int solve_inverse(class inverse* inv_ptr); + int solve_with_mask(class inverse* inv_ptr, unsigned long cur_bits); int subset_bad(unsigned long bits); int subset_minimal(unsigned long bits); int superset_minimal(unsigned long bits); - int write_optimize_names(struct inverse* inv_ptr); + int write_optimize_names(class inverse* inv_ptr); // isotopes.cpp ------------------------------- int add_isotopes(cxxSolution& solution_ptr); int calculate_values(void); - int calculate_isotope_moles(struct element* elt_ptr, + int calculate_isotope_moles(class element* elt_ptr, cxxSolution* solution_ptr, LDBLE total_moles); - LDBLE convert_isotope(struct master_isotope* master_isotope_ptr, LDBLE ratio); - int from_pcil(struct master_isotope* master_isotope_ptr); - int from_permil(struct master_isotope* master_isotope_ptr, LDBLE major_total); - int from_pct(struct master_isotope* master_isotope_ptr, LDBLE major_total); - int from_tu(struct master_isotope* master_isotope_ptr); - struct calculate_value* calculate_value_alloc(void); - int calculate_value_free(struct calculate_value* calculate_value_ptr); - struct calculate_value* calculate_value_search(const char* name); - struct calculate_value* calculate_value_store(const char* name, + LDBLE convert_isotope(class master_isotope* master_isotope_ptr, LDBLE ratio); + int from_pcil(class master_isotope* master_isotope_ptr); + int from_permil(class master_isotope* master_isotope_ptr, LDBLE major_total); + int from_pct(class master_isotope* master_isotope_ptr, LDBLE major_total); + int from_tu(class master_isotope* master_isotope_ptr); + class calculate_value* calculate_value_alloc(void); + int calculate_value_free(class calculate_value* calculate_value_ptr); + class calculate_value* calculate_value_search(const char* name); + class calculate_value* calculate_value_store(const char* name, int replace_if_found); - struct isotope_alpha* isotope_alpha_alloc(void); - struct isotope_alpha* isotope_alpha_search(const char* name); - struct isotope_alpha* isotope_alpha_store(const char* name, + class isotope_alpha* isotope_alpha_alloc(void); + class isotope_alpha* isotope_alpha_search(const char* name); + class isotope_alpha* isotope_alpha_store(const char* name, int replace_if_found); - struct isotope_ratio* isotope_ratio_alloc(void); - struct isotope_ratio* isotope_ratio_search(const char* name); - struct isotope_ratio* isotope_ratio_store(const char* name, + class isotope_ratio* isotope_ratio_alloc(void); + class isotope_ratio* isotope_ratio_search(const char* name); + class isotope_ratio* isotope_ratio_store(const char* name, int replace_if_found); - struct master_isotope* master_isotope_store(const char* name, + class master_isotope* master_isotope_store(const char* name, int replace_if_found); - struct master_isotope* master_isotope_alloc(void); - struct master_isotope* master_isotope_search(const char* name); + class master_isotope* master_isotope_alloc(void); + class master_isotope* master_isotope_search(const char* name); int print_initial_solution_isotopes(void); int print_isotope_ratios(void); int print_isotope_alphas(void); @@ -372,10 +372,10 @@ public: int read_isotopes(void); int read_isotope_ratios(void); int read_isotope_alphas(void); - int calculate_value_init(struct calculate_value* calculate_value_ptr); - int isotope_alpha_init(struct isotope_alpha* isotope_alpha_ptr); - int isotope_ratio_init(struct isotope_ratio* isotope_ratio_ptr); - int master_isotope_init(struct master_isotope* master_isotope_ptr); + int calculate_value_init(class calculate_value* calculate_value_ptr); + int isotope_alpha_init(class isotope_alpha* isotope_alpha_ptr); + int isotope_ratio_init(class isotope_ratio* isotope_ratio_ptr); + int master_isotope_init(class master_isotope* master_isotope_ptr); // kinetics.cpp ------------------------------- void cvode_init(void); @@ -476,7 +476,7 @@ public: int get_elts_in_species(const char** t_ptr, LDBLE coef); int get_num(const char** t_ptr, LDBLE* num); int get_secondary_in_species(const char** t_ptr, LDBLE coef); - int parse_eq(char* eqn, std::vector& new_elt_list, int association); + int parse_eq(char* eqn, std::vector& new_elt_list, int association); int get_coef(LDBLE* coef, const char** eqnaddr); int get_secondary(const char** t_ptr, char* element, int* i); int get_species(const char** ptr); @@ -498,11 +498,11 @@ public: public: // pitzer.cpp ------------------------------- - struct pitz_param* pitz_param_read(char* string, int n); - void pitz_param_store(const struct pitz_param* pzp_ptr); - void sit_param_store(const struct pitz_param* pzp_ptr); - struct pitz_param* pitz_param_copy(const struct pitz_param* src); - struct theta_param* theta_param_search(LDBLE zj, LDBLE zk); + class pitz_param* pitz_param_read(char* string, int n); + void pitz_param_store(const class pitz_param* pzp_ptr); + void sit_param_store(const class pitz_param* pzp_ptr); + class pitz_param* pitz_param_copy(const class pitz_param* src); + class theta_param* theta_param_search(LDBLE zj, LDBLE zk); void pitzer_make_lists(void); int gammas_pz(bool exch_a_f); int model_pz(void); @@ -512,7 +512,7 @@ public: int pitzer_tidy(void); int read_pitzer(void); int set_pz(int initial); - int calc_pitz_param(struct pitz_param* pz_ptr, LDBLE TK, LDBLE TR); + int calc_pitz_param(class pitz_param* pz_ptr, LDBLE TK, LDBLE TR); int check_gammas_pz(void); int ISPEC(const char* name); LDBLE G(LDBLE Y); @@ -542,15 +542,15 @@ public: int build_species_list(int n); int build_min_surface(void); LDBLE calc_lk_phase(phase* p_ptr, LDBLE TK, LDBLE pa); - LDBLE calc_PR(std::vector phase_ptrs, LDBLE P, LDBLE TK, LDBLE V_m); + LDBLE calc_PR(std::vector phase_ptrs, LDBLE P, LDBLE TK, LDBLE V_m); LDBLE calc_PR(); int calc_vm(LDBLE tc, LDBLE pa); int clear(void); int convert_units(cxxSolution* solution_ptr); - struct unknown* find_surface_charge_unknown(std::string& str_ptr, int plane); - std::vector get_list_master_ptrs(const char* cptr, struct master* master_ptr); + class unknown* find_surface_charge_unknown(std::string& str_ptr, int plane); + std::vector get_list_master_ptrs(const char* cptr, class master* master_ptr); int inout(void); - int is_special(struct species* spec); + int is_special(class species* spec); int mb_for_species_aq(int n); int mb_for_species_ex(int n); int mb_for_species_surf(int n); @@ -560,7 +560,7 @@ public: int setup_exchange(void); int setup_gas_phase(void); int setup_fixed_volume_gas(void); - int setup_master_rxn(const std::vector& master_ptr_list, + int setup_master_rxn(const std::vector& master_ptr_list, const std::string& pe_rxn); int setup_pure_phases(void); int adjust_setup_pure_phases(void); @@ -575,7 +575,7 @@ public: int store_jacob(LDBLE* source, LDBLE* target, LDBLE coef); int store_jacob0(int row, int column, LDBLE coef); int store_mb(LDBLE* source, LDBLE* target, LDBLE coef); - int store_mb_unknowns(struct unknown* unknown_ptr, LDBLE* LDBLE_ptr, + int store_mb_unknowns(class unknown* unknown_ptr, LDBLE* LDBLE_ptr, LDBLE coef, LDBLE* gamma_ptr); int store_sum_deltas(LDBLE* source, LDBLE* target, LDBLE coef); int tidy_redox(void); @@ -588,8 +588,8 @@ public: LDBLE k_calc(LDBLE* logk, LDBLE tempk, LDBLE presPa); int prep(void); int reprep(void); - int rewrite_master_to_secondary(struct master* master_ptr1, - struct master* master_ptr2); + int rewrite_master_to_secondary(class master* master_ptr1, + class master* master_ptr2); int switch_bases(void); int write_phase_sys_total(int n); @@ -673,9 +673,9 @@ public: int read_gas_phase(void); int read_incremental_reactions(void); int read_inverse(void); - int read_inv_balances(struct inverse* inverse_ptr, const char* next_char); - int read_inv_isotopes(struct inverse* inverse_ptr, const char* cptr); - int read_inv_phases(struct inverse* inverse_ptr, const char* next_char); + int read_inv_balances(class inverse* inverse_ptr, const char* next_char); + int read_inv_isotopes(class inverse* inverse_ptr, const char* cptr); + int read_inv_phases(class inverse* inverse_ptr, const char* next_char); int read_kinetics(void); bool read_vector_doubles(const char** ptr, std::vector& v); bool read_vector_ints(const char** cptr, std::vector& v, int positive); @@ -749,7 +749,7 @@ public: int sit_tidy(void); int read_sit(void); int set_sit(int initial); - int calc_sit_param(struct pitz_param* pz_ptr, LDBLE TK, LDBLE TR); + int calc_sit_param(class pitz_param* pz_ptr, LDBLE TK, LDBLE TR); int check_gammas_sit(void); int sit_ISPEC(const char* name); /*int DH_AB (LDBLE TK, LDBLE *A, LDBLE *B);*/ @@ -764,18 +764,18 @@ public: int copy_token_tab(std::string& token, const char** cptr); int get_option_string(const char** opt_list, int count_opt_list, const char** next_char); - int spread_row_free(struct spread_row* spread_row_ptr); - int spread_row_to_solution(struct spread_row* heading, - struct spread_row* units, - struct spread_row* data, - struct defaults defaults); - struct spread_row* string_to_spread_row(char* string); + int spread_row_free(class spread_row* spread_row_ptr); + int spread_row_to_solution(class spread_row* heading, + class spread_row* units, + class spread_row* data, + class defaults defaults); + class spread_row* string_to_spread_row(char* string); #ifdef PHREEQCI_GUI - void add_row(struct spread_row* spread_row_ptr); - void copy_defaults(struct defaults* dest_ptr, - struct defaults* src_ptr); + void add_row(class spread_row* spread_row_ptr); + void copy_defaults(class defaults* dest_ptr, + class defaults* src_ptr); void free_spread(void); - struct spread_row* copy_row(struct spread_row* spread_row_ptr); + class spread_row* copy_row(class spread_row* spread_row_ptr); #endif // step.cpp ------------------------------- @@ -802,61 +802,61 @@ public: int clean_up(void); int reinitialize(void); - int copier_add(struct copier* copier_ptr, int n_user, int start, int end); - int copier_clear(struct copier* copier_ptr); + int copier_add(class copier* copier_ptr, int n_user, int start, int end); + int copier_clear(class copier* copier_ptr); // CReaction CReaction_internal_copy(CReaction& rxn_ref); double rxn_find_coef(CReaction& r_ptr, const char* str); // static int element_compare(const void* ptr1, const void* ptr2); - struct element* element_store(const char* element); + class element* element_store(const char* element); // int add_elt_list(const cxxNameDouble& nd, LDBLE coef); - int add_elt_list(const std::vector& el, double coef); + int add_elt_list(const std::vector& el, double coef); int change_hydrogen_in_elt_list(LDBLE charge); int elt_list_combine(void); static int elt_list_compare(const void* ptr1, const void* ptr2); - std::vector elt_list_internal_copy(const std::vector& el); - std::vector elt_list_vsave(void); + std::vector elt_list_internal_copy(const std::vector& el); + std::vector elt_list_vsave(void); cxxNameDouble elt_list_NameDouble(void); // enum entity_type get_entity_enum(char* name); // - struct inverse* inverse_alloc(void); + class inverse* inverse_alloc(void); int inverse_delete(int i); static int inverse_isotope_compare(const void* ptr1, const void* ptr2); - struct inverse* inverse_search(int n_user, int* n); + class inverse* inverse_search(int n_user, int* n); int inverse_sort(void); // - struct logk* logk_alloc(void); - int logk_copy2orig(struct logk* logk_ptr); - struct logk* logk_store(const char* name, int replace_if_found); - struct logk* logk_search(const char* name); + class logk* logk_alloc(void); + int logk_copy2orig(class logk* logk_ptr); + class logk* logk_store(const char* name, int replace_if_found); + class logk* logk_search(const char* name); // - struct master* master_alloc(void); + class master* master_alloc(void); static int master_compare(const void* ptr1, const void* ptr2); int master_delete(const char* cptr); - struct master* master_bsearch(const char* cptr); - struct master* master_bsearch_primary(const char* cptr); - struct master* master_bsearch_secondary(const char* cptr); - struct master* master_search(const char* cptr, int* n); - struct master* surface_get_psi_master(const char* name, int plane); + class master* master_bsearch(const char* cptr); + class master* master_bsearch_primary(const char* cptr); + class master* master_bsearch_secondary(const char* cptr); + class master* master_search(const char* cptr, int* n); + class master* surface_get_psi_master(const char* name, int plane); // - struct phase* phase_bsearch(const char* cptr, int* j, int print); + class phase* phase_bsearch(const char* cptr, int* j, int print); static int phase_compare(const void* ptr1, const void* ptr2); int phase_delete(int i); - struct phase* phase_store(const char* name); + class phase* phase_store(const char* name); // - struct rate* rate_bsearch(const char* cptr, int* j); - int rate_free(struct rate* rate_ptr); - struct rate* rate_copy(const struct rate* rate_ptr); - struct rate* rate_search(const char* name, int* n); + class rate* rate_bsearch(const char* cptr, int* j); + int rate_free(class rate* rate_ptr); + class rate* rate_copy(const class rate* rate_ptr); + class rate* rate_search(const char* name, int* n); int rate_sort(void); // static int s_compare(const void* ptr1, const void* ptr2); int s_delete(int i); - struct species* s_search(const char* name); - struct species* s_store(const char* name, LDBLE z, int replace_if_found); + class species* s_search(const char* name); + class species* s_store(const char* name, LDBLE z, int replace_if_found); // static int isotope_compare(const void* ptr1, const void* ptr2); // @@ -869,7 +869,7 @@ public: int system_duplicate(int i, int save_old); // // - bool phase_rxn_to_trxn(struct phase* phase_ptr, CReaction& rxn_ptr); + bool phase_rxn_to_trxn(class phase* phase_ptr, CReaction& rxn_ptr); bool trxn_add(CReaction& r_ptr, double coef, bool combine); bool trxn_add_phase(CReaction& r_ref, double coef, bool combine); int trxn_combine(void); @@ -882,24 +882,24 @@ public: int trxn_sort(void); int trxn_swap(const char* token); - struct unknown* unknown_alloc(void); + class unknown* unknown_alloc(void); int unknown_delete(int i); - int unknown_free(struct unknown* unknown_ptr); + int unknown_free(class unknown* unknown_ptr); int entity_exists(const char* name, int n_user); static int inverse_compare(const void* ptr1, const void* ptr2); - int inverse_free(struct inverse* inverse_ptr); - int logk_init(struct logk* logk_ptr); + int inverse_free(class inverse* inverse_ptr); + int logk_init(class logk* logk_ptr); static int master_compare_string(const void* ptr1, const void* ptr2); - int master_free(struct master* master_ptr); - struct phase* phase_alloc(void); + int master_free(class master* master_ptr); + class phase* phase_alloc(void); static int phase_compare_string(const void* ptr1, const void* ptr2); - int phase_free(struct phase* phase_ptr); - int phase_init(struct phase* phase_ptr); + int phase_free(class phase* phase_ptr); + int phase_init(class phase* phase_ptr); static int rate_compare(const void* ptr1, const void* ptr2); static int rate_compare_string(const void* ptr1, const void* ptr2); - struct species* s_alloc(void); - int s_free(struct species* s_ptr); - int s_init(struct species* s_ptr); + class species* s_alloc(void); + int s_free(class species* s_ptr); + int s_init(class species* s_ptr); static int species_list_compare(const void* ptr1, const void* ptr2); void Use2cxxStorageBin(cxxStorageBin& sb); @@ -922,8 +922,8 @@ public: int store_tally_table(LDBLE* array, int row_dim, int col_dim, LDBLE fill_factor); int zero_tally_table(void); - int elt_list_to_tally_table(struct tally_buffer* buffer_ptr); - int master_to_tally_table(struct tally_buffer* buffer_ptr); + int elt_list_to_tally_table(class tally_buffer* buffer_ptr); + int master_to_tally_table(class tally_buffer* buffer_ptr); int get_all_components(void); int print_tally_table(void); int set_reaction_moles(int n_user, LDBLE moles); @@ -931,8 +931,8 @@ public: int set_kinetics_time(int n_user, LDBLE step); // tidy.cpp ------------------------------- - int add_other_logk(LDBLE* source_k, std::vector& add_logk); - int add_logks(struct logk* logk_ptr, int repeats); + int add_other_logk(LDBLE* source_k, std::vector& add_logk); + int add_logks(class logk* logk_ptr, int repeats); LDBLE halve(LDBLE f(LDBLE x, void*), LDBLE x0, LDBLE x1, LDBLE tol); int replace_solids_gases(void); int ss_prep(LDBLE t, cxxSS* ss_ptr, int print); @@ -942,11 +942,11 @@ public: int tidy_punch(void); int tidy_model(void); int check_species_input(void); - LDBLE coef_in_master(struct master* master_ptr); + LDBLE coef_in_master(class master* master_ptr); int reset_last_model(void); int rewrite_eqn_to_primary(void); int rewrite_eqn_to_secondary(void); - int species_rxn_to_trxn(struct species* s_ptr); + int species_rxn_to_trxn(class species* s_ptr); int tidy_logk(void); int tidy_exchange(void); int tidy_min_exchange(void); @@ -993,7 +993,7 @@ public: LDBLE moles_from_redox_states(cxxSolution* sptr, const char* name); LDBLE moles_from_donnan_layer(cxxSurface* sptr, const char* name, LDBLE moles_needed); LDBLE add_MCD_moles(LDBLE moles, LDBLE min_mol, int i, cxxSolution* sptr, const char* name); - int fill_m_s(struct J_ij* J_ij, int J_ij_count_spec, int i, int stagnant); + int fill_m_s(class J_ij* J_ij, int J_ij_count_spec, int i, int stagnant); static int sort_species_name(const void* ptr1, const void* ptr2); int disp_surf(LDBLE stagkin_time); int diff_stag_surf(int mobile_cell); @@ -1141,7 +1141,7 @@ protected: * Save *---------------------------------------------------------------------- */ std::map save_values; - struct save save; + class save save; /*---------------------------------------------------------------------- * Use @@ -1151,22 +1151,22 @@ protected: /*---------------------------------------------------------------------- * Copy *---------------------------------------------------------------------- */ - struct copier copy_solution; - struct copier copy_pp_assemblage; - struct copier copy_exchange; - struct copier copy_surface; - struct copier copy_ss_assemblage; - struct copier copy_gas_phase; - struct copier copy_kinetics; - struct copier copy_mix; - struct copier copy_reaction; - struct copier copy_temperature; - struct copier copy_pressure; + class copier copy_solution; + class copier copy_pp_assemblage; + class copier copy_exchange; + class copier copy_surface; + class copier copy_ss_assemblage; + class copier copy_gas_phase; + class copier copy_kinetics; + class copier copy_mix; + class copier copy_reaction; + class copier copy_temperature; + class copier copy_pressure; /*---------------------------------------------------------------------- * Inverse *---------------------------------------------------------------------- */ - std::vector inverse; + std::vector inverse; int count_inverse; /*---------------------------------------------------------------------- @@ -1218,22 +1218,22 @@ protected: /*---------------------------------------------------------------------- * Species_list *---------------------------------------------------------------------- */ - std::vector species_list; + std::vector species_list; /*---------------------------------------------------------------------- * Jacobian and Mass balance lists *---------------------------------------------------------------------- */ - std::vector sum_jacob0; /* array of pointers to targets and coefficients for array */ + std::vector sum_jacob0; /* array of pointers to targets and coefficients for array */ - std::vector sum_mb1; /* array of pointers to sources and targets for mass + std::vector sum_mb1; /* array of pointers to sources and targets for mass balance summations with coef = 1.0 */ - std::vector sum_jacob1; /* array of pointers to sources and targets for array + std::vector sum_jacob1; /* array of pointers to sources and targets for array equations with coef = 1.0 */ - std::vector sum_mb2; /* array of coefficients and pointers to sources and + std::vector sum_mb2; /* array of coefficients and pointers to sources and targets for mass balance summations with coef != 1.0 */ - std::vector sum_jacob2; /* array of coefficients and pointers to sources and + std::vector sum_jacob2; /* array of coefficients and pointers to sources and targets, coef != 1.0 */ - std::vector sum_delta; /* array of pointers to sources, targets and coefficients for + std::vector sum_delta; /* array of pointers to sources, targets and coefficients for summing deltas for mass balance equations */ /*---------------------------------------------------------------------- * Solution @@ -1297,13 +1297,13 @@ protected: LDBLE heat_diffc; int cell; LDBLE mcd_substeps; - struct stag_data stag_data; + class stag_data stag_data; int print_modulus; int punch_modulus; int dump_in; int dump_modulus; int transport_warnings; - std::vector cell_data; + std::vector cell_data; int old_cells, max_cells, all_cells; int multi_Dflag; /* signals calc'n of multicomponent diffusion */ int interlayer_Dflag; /* multicomponent diffusion and diffusion through interlayer porosity */ @@ -1345,13 +1345,13 @@ protected: /*---------------------------------------------------------------------- * Elements *---------------------------------------------------------------------- */ - std::vector elements; - struct element* element_h_one; + std::vector elements; + class element* element_h_one; /*---------------------------------------------------------------------- * Element List *---------------------------------------------------------------------- */ - std::vector elt_list; + std::vector elt_list; size_t count_elts = 0; /* number of elements in elt_list = position of next */ /*---------------------------------------------------------------------- * Reaction @@ -1360,70 +1360,70 @@ protected: /*---------------------------------------------------------------------- * Species *---------------------------------------------------------------------- */ - std::vector logk; + std::vector logk; std::string moles_per_kilogram_string; - std::vector s; + std::vector s; std::vector< std::map < std::string, cxxSpeciesDL > > s_diff_layer; - std::vector s_x; + std::vector s_x; - struct species* s_h2o; - struct species* s_hplus; - struct species* s_h3oplus; - struct species* s_eminus; - struct species* s_co3; - struct species* s_h2; - struct species* s_o2; + class species* s_h2o; + class species* s_hplus; + class species* s_h3oplus; + class species* s_eminus; + class species* s_co3; + class species* s_h2; + class species* s_o2; /*---------------------------------------------------------------------- * Phases *---------------------------------------------------------------------- */ - std::vector phases; + std::vector phases; /*---------------------------------------------------------------------- * Master species *---------------------------------------------------------------------- */ - std::vector master; + std::vector master; /*---------------------------------------------------------------------- * Unknowns *---------------------------------------------------------------------- */ - std::vector x; + std::vector x; size_t count_unknowns; size_t max_unknowns; - struct unknown* ah2o_unknown; - struct unknown* alkalinity_unknown; - struct unknown* carbon_unknown; - struct unknown* charge_balance_unknown; - struct unknown* exchange_unknown; - struct unknown* mass_hydrogen_unknown; - struct unknown* mass_oxygen_unknown; - struct unknown* mb_unknown; - struct unknown* mu_unknown; - struct unknown* pe_unknown; - struct unknown* ph_unknown; - struct unknown* pure_phase_unknown; - struct unknown* solution_phase_boundary_unknown; - struct unknown* surface_unknown; - struct unknown* gas_unknown; - struct unknown* ss_unknown; - std::vector gas_unknowns; + class unknown* ah2o_unknown; + class unknown* alkalinity_unknown; + class unknown* carbon_unknown; + class unknown* charge_balance_unknown; + class unknown* exchange_unknown; + class unknown* mass_hydrogen_unknown; + class unknown* mass_oxygen_unknown; + class unknown* mb_unknown; + class unknown* mu_unknown; + class unknown* pe_unknown; + class unknown* ph_unknown; + class unknown* pure_phase_unknown; + class unknown* solution_phase_boundary_unknown; + class unknown* surface_unknown; + class unknown* gas_unknown; + class unknown* ss_unknown; + std::vector gas_unknowns; /*---------------------------------------------------------------------- * Reaction work space *---------------------------------------------------------------------- */ - struct reaction_temp trxn; /* structure array of working space while reading equations + class reaction_temp trxn; /* structure array of working space while reading equations species names are in "temp_strings" */ size_t count_trxn; /* number of reactants in trxn = position of next */ - std::vector mb_unknowns; + std::vector mb_unknowns; /* ---------------------------------------------------------------------- * Print * ---------------------------------------------------------------------- */ - struct prints pr; + class prints pr; bool status_on; clock_t status_interval; clock_t status_timer; @@ -1433,7 +1433,7 @@ protected: /* ---------------------------------------------------------------------- * RATES * ---------------------------------------------------------------------- */ - std::vector rates; + std::vector rates; LDBLE rate_m, rate_m0, rate_time, rate_kin_time, rate_sim_time_start, rate_sim_time_end, rate_sim_time, rate_moles, initial_total_time; std::vector rate_p; @@ -1442,7 +1442,7 @@ protected: /* ---------------------------------------------------------------------- * USER PRINT COMMANDS * ---------------------------------------------------------------------- */ - struct rate* user_print = 0; + class rate* user_print = 0; int n_user_punch_index; int fpunchf_user_s_warning; @@ -1552,7 +1552,7 @@ protected: int remove_unstable_phases; std::string screen_string; #ifdef PHREEQCI_GUI - struct spread_sheet g_spread_sheet; + class spread_sheet g_spread_sheet; #endif int spread_length; @@ -1562,11 +1562,11 @@ protected: */ std::map strings_map; - std::map elements_map; - std::map species_map; - std::map phases_map; - std::map logk_map; - std::map master_isotope_map; + std::map elements_map; + std::map species_map; + std::map phases_map; + std::map logk_map; + std::map master_isotope_map; #if defined(PHREEQCI_GUI) #include "../../phreeqci_gui.h" @@ -1574,14 +1574,14 @@ protected: /* ---------------------------------------------------------------------- * ISOTOPES * ---------------------------------------------------------------------- */ - std::vector master_isotope; + std::vector master_isotope; int initial_solution_isotopes; - std::vector calculate_value; - std::map calculate_value_map; - std::vector isotope_ratio; - std::map isotope_ratio_map; - std::vector isotope_alpha; - std::map isotope_alpha_map; + std::vector calculate_value; + std::map calculate_value_map; + std::vector isotope_ratio; + std::map isotope_ratio_map; + std::vector isotope_alpha; + std::map isotope_alpha_map; int phreeqc_mpi_myself; int first_read_input; std::string user_database; @@ -1597,7 +1597,7 @@ protected: LDBLE cell_porosity; LDBLE cell_volume; LDBLE cell_saturation; - std::vector sys; + std::vector sys; LDBLE sys_tot; LDBLE V_solutes, rho_0, rho_0_sat, kappa_0, p_sat/*, ah2o_x0*/; @@ -1658,7 +1658,7 @@ protected: size_t klmd, nklmd, n2d; int kode, iter; LDBLE toler, error, max_pct, scaled_error; - struct master* master_alk; + class master* master_alk; std::vector row_back, col_back; std::vector good, bad, minimal; size_t max_good, max_bad, max_minimal; @@ -1710,18 +1710,18 @@ protected: LDBLE COSMOT; LDBLE AW; LDBLE VP, DW0; - std::vector pitz_params; + std::vector pitz_params; std::map< std::string, size_t > pitz_param_map; - std::vector theta_params; + std::vector theta_params; int use_etheta; LDBLE OTEMP, OPRESS; LDBLE A0; - struct pitz_param* aphi = NULL; - std::vector spec; - struct species** cations, ** anions, ** neutrals; // pointers to spec + class pitz_param* aphi = NULL; + std::vector spec; + class species** cations, ** anions, ** neutrals; // pointers to spec int count_cations, count_anions, count_neutrals; int MAXCATIONS, FIRSTANION, MAXNEUTRAL; - struct pitz_param* mcb0, * mcb1, * mcc0; + class pitz_param* mcb0, * mcb1, * mcc0; std::vector IPRSNT; std::vector M, LGAMMA; LDBLE BK[23], DK[23]; @@ -1747,7 +1747,7 @@ protected: std::string dump_file_name_cpp; /* sit.cpp ------------------------------- */ - std::vector sit_params; + std::vector sit_params; std::map< std::string, size_t > sit_param_map; LDBLE sit_A0; int sit_count_cations, sit_count_anions, sit_count_neutrals; @@ -1760,19 +1760,19 @@ protected: LDBLE a0, a1, kc, kb; /* tally.cpp ------------------------------- */ - struct tally_buffer* t_buffer; + class tally_buffer* t_buffer; size_t tally_count_component; - struct tally* tally_table; + class tally* tally_table; size_t count_tally_table_columns; size_t count_tally_table_rows; /* transport.cpp ------------------------------- */ - struct sol_D* sol_D; - struct sol_D* sol_D_dbg; - struct J_ij* J_ij, * J_ij_il; + class sol_D* sol_D; + class sol_D* sol_D_dbg; + class J_ij* J_ij, * J_ij_il; int J_ij_count_spec; - struct M_S* m_s; + class M_S* m_s; int count_m_s; LDBLE tot1_h, tot1_o, tot2_h, tot2_o; LDBLE diffc_max, diffc_tr, J_ij_sum; @@ -1805,7 +1805,7 @@ protected: std::vector keycount; // used to mark keywords that have been read public: - static const struct const_iso iso_defaults[]; + static const class const_iso iso_defaults[]; static const int count_iso_defaults; }; #endif /* _INC_PHREEQC_H */ diff --git a/ReadClass.cxx b/ReadClass.cxx index a6350745..cf3ec206 100644 --- a/ReadClass.cxx +++ b/ReadClass.cxx @@ -459,7 +459,7 @@ int Phreeqc:: run_as_cells(void) /* ---------------------------------------------------------------------- */ { - struct save save_data; + class save save_data; LDBLE kin_time; int count_steps, use_mix; char token[2 * MAX_LENGTH]; @@ -534,7 +534,7 @@ run_as_cells(void) /* * save data for saving solutions */ - memcpy(&save_data, &save, sizeof(struct save)); + memcpy(&save_data, &save, sizeof(class save)); /* *Copy everything to -2 */ @@ -611,7 +611,7 @@ run_as_cells(void) /* * save end of reaction */ - memcpy(&save, &save_data, sizeof(struct save)); + memcpy(&save, &save_data, sizeof(class save)); if (use.Get_kinetics_in() == TRUE) { Utilities::Rxn_copy(Rxn_kinetics_map, -2, use.Get_n_kinetics_user()); @@ -669,7 +669,7 @@ int Phreeqc:: run_as_cells(void) /* ---------------------------------------------------------------------- */ { - struct save save_data; + class save save_data; LDBLE kin_time; int count_steps, use_mix; char token[2 * MAX_LENGTH]; @@ -745,7 +745,7 @@ run_as_cells(void) /* * save data for saving solutions */ - memcpy(&save_data, &save, sizeof(struct save)); + memcpy(&save_data, &save, sizeof(class save)); /* *Copy everything to -2 */ @@ -825,7 +825,7 @@ run_as_cells(void) /* * save end of reaction */ - memcpy(&save, &save_data, sizeof(struct save)); + memcpy(&save, &save_data, sizeof(class save)); if (use.Get_kinetics_in() == TRUE) { Utilities::Rxn_copy(Rxn_kinetics_map, -2, use.Get_n_kinetics_user()); diff --git a/SS.cxx b/SS.cxx index 6274f2e2..1e21e98a 100644 --- a/SS.cxx +++ b/SS.cxx @@ -421,7 +421,7 @@ cxxSS::totalize(Phreeqc * phreeqc_ptr) // component structures for (size_t i = 0; i < this->ss_comps.size(); i++) { - struct phase *phase_ptr; + class phase *phase_ptr; int l; phase_ptr = phreeqc_ptr-> phase_bsearch(ss_comps[i].Get_name().c_str(), &l, FALSE); if (phase_ptr != NULL) diff --git a/SolutionIsotope.h b/SolutionIsotope.h index 231fe0ab..13fdd041 100644 --- a/SolutionIsotope.h +++ b/SolutionIsotope.h @@ -11,7 +11,7 @@ class cxxSolutionIsotope: public PHRQ_base { public: cxxSolutionIsotope(PHRQ_io *io=NULL); - cxxSolutionIsotope(struct isotope *isotope_ptr, PHRQ_io *io=NULL); + cxxSolutionIsotope(class isotope *isotope_ptr, PHRQ_io *io=NULL); virtual ~cxxSolutionIsotope(void); void dump_xml(std::ostream & os, unsigned int indent) const; diff --git a/SurfaceCharge.h b/SurfaceCharge.h index 669172a1..091b26b7 100644 --- a/SurfaceCharge.h +++ b/SurfaceCharge.h @@ -70,7 +70,7 @@ public: cxxSurfaceCharge(struct surface_charge *, PHRQ_io *io=NULL); virtual ~cxxSurfaceCharge(); - struct master *Get_psi_master(); + class master *Get_psi_master(); 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); diff --git a/Use.h b/Use.h index 90a22a5c..a1ff1094 100644 --- a/Use.h +++ b/Use.h @@ -87,7 +87,7 @@ public: cxxPressure * Get_pressure_ptr(void) const {return this->pressure_ptr;} cxxTemperature * Get_temperature_ptr(void) const {return this->temperature_ptr;} cxxGasPhase * Get_gas_phase_ptr(void) const {return this->gas_phase_ptr;} - struct inverse * Get_inverse_ptr(void) const {return this->inverse_ptr;} + class inverse * Get_inverse_ptr(void) const {return this->inverse_ptr;} cxxSSassemblage * Get_ss_assemblage_ptr(void) {return this->ss_assemblage_ptr;} void Set_solution_ptr(cxxSolution * p) {this->solution_ptr = p;} @@ -100,7 +100,7 @@ public: void Set_pressure_ptr(cxxPressure * p) {this->pressure_ptr = p;} void Set_temperature_ptr(cxxTemperature * p) {this->temperature_ptr = p;} void Set_gas_phase_ptr(cxxGasPhase * p) {this->gas_phase_ptr = p;} - void Set_inverse_ptr(struct inverse * p) {this->inverse_ptr = p;} + void Set_inverse_ptr(class inverse * p) {this->inverse_ptr = p;} void Set_ss_assemblage_ptr(cxxSSassemblage * p) {this->ss_assemblage_ptr = p;} protected: @@ -143,7 +143,7 @@ protected: bool inverse_in; int n_inverse_user; - struct inverse *inverse_ptr; + class inverse *inverse_ptr; bool gas_phase_in; int n_gas_phase_user; diff --git a/UserPunch.h b/UserPunch.h index fb8c123f..599137b1 100644 --- a/UserPunch.h +++ b/UserPunch.h @@ -26,14 +26,14 @@ public: // rate // - struct rate * Get_rate() {return this->rate;} - const struct rate * Get_rate()const {return this->rate;} + class rate * Get_rate() {return this->rate;} + const class rate * Get_rate()const {return this->rate;} - void Set_rate(struct rate * r) {this->rate = r;} + void Set_rate(class rate * r) {this->rate = r;} protected: std::vector headings; - struct rate * rate; + class rate * rate; Phreeqc * PhreeqcPtr; }; #endif // !defined(USERPUNCH_H_INCLUDED) \ No newline at end of file diff --git a/basicsubs.cpp b/basicsubs.cpp index 3b8a642a..6bbabc65 100644 --- a/basicsubs.cpp +++ b/basicsubs.cpp @@ -16,7 +16,7 @@ LDBLE Phreeqc:: activity(const char *species_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE a; s_ptr = s_search(species_name); @@ -44,7 +44,7 @@ LDBLE Phreeqc:: activity_coefficient(const char *species_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE g, dum = 0.0; s_ptr = s_search(species_name); @@ -66,7 +66,7 @@ LDBLE Phreeqc:: log_activity_coefficient(const char *species_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE g, dum = 0.0; s_ptr = s_search(species_name); @@ -88,7 +88,7 @@ LDBLE Phreeqc:: aqueous_vm(const char *species_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE g; s_ptr = s_search(species_name); @@ -107,7 +107,7 @@ LDBLE Phreeqc:: phase_vm(const char *phase_name) /* ---------------------------------------------------------------------- */ { - struct phase *phase_ptr; + class phase *phase_ptr; int l; LDBLE g; @@ -177,7 +177,7 @@ LDBLE Phreeqc:: diff_c(const char *species_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE g; s_ptr = s_search(species_name); @@ -199,7 +199,7 @@ LDBLE Phreeqc:: setdiff_c(const char *species_name, double d) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE g; s_ptr = s_search(species_name); @@ -470,7 +470,7 @@ calc_dens(void) /* 2 options: original VP, assign the volumes of species with zero molar volume to their master species, but this doubles counts of complexes with -Vm defined. And, cation-OH and H-anion complexes are counted once. Also, must add H+ and OH-... */ - //struct species *s_ptr; + //class species *s_ptr; //V_solutes = M_T = 0.0; //for (i = 0; i < count_species_list; i++) @@ -586,7 +586,7 @@ calc_solution_volume(void) for (int i = 0; i < (int)master.size(); i++) { if (master[i]->s->type != AQ) continue; - struct master *master_ptr = master[i]; + class master *master_ptr = master[i]; if (master_ptr->primary == TRUE && strcmp(master_ptr->elt->name, "Alkalinity")) { total_mass += master_ptr->total_primary * master_ptr->elt->gfw; @@ -605,10 +605,10 @@ calc_logk_n(const char *name) char token[MAX_LENGTH]; int i; LDBLE lk; - struct logk *logk_ptr; + class logk *logk_ptr; LDBLE l_logk[MAX_LOG_K_INDICES]; - struct name_coef add_logk; - std::vector add_logk_v; + class name_coef add_logk; + std::vector add_logk_v; for (i = 0; i < MAX_LOG_K_INDICES; i++) { @@ -635,7 +635,7 @@ calc_logk_p(const char *name) { int i, j; char token[MAX_LENGTH]; - struct phase *phase_ptr; + class phase *phase_ptr; LDBLE lk=-999.9; LDBLE l_logk[MAX_LOG_K_INDICES]; @@ -675,7 +675,7 @@ calc_logk_s(const char *name) { int i; char token[MAX_LENGTH]; - struct species *s_ptr; + class species *s_ptr; LDBLE lk, l_logk[MAX_LOG_K_INDICES]; strcpy(token, name); @@ -703,7 +703,7 @@ dh_a0(const char* name) /* ---------------------------------------------------------------------- */ { char token[MAX_LENGTH]; - struct species* s_ptr; + class species* s_ptr; double a = -999.99; strcpy(token, name); @@ -720,7 +720,7 @@ dh_bdot(const char* name) /* ---------------------------------------------------------------------- */ { char token[MAX_LENGTH]; - struct species* s_ptr; + class species* s_ptr; double b = -999.99; if (llnl_temp.size() > 0) { @@ -744,7 +744,7 @@ calc_deltah_p(const char* name) { int i, j; char token[MAX_LENGTH]; - struct phase* phase_ptr; + class phase* phase_ptr; LDBLE lkm, lkp; LDBLE l_logk[MAX_LOG_K_INDICES]; double dh = -999.99; @@ -785,7 +785,7 @@ calc_deltah_s(const char* name) { int i; char token[MAX_LENGTH]; - struct species* s_ptr; + class species* s_ptr; LDBLE lkm, lkp, l_logk[MAX_LOG_K_INDICES]; double dh = -999.99; strcpy(token, name); @@ -817,8 +817,8 @@ calc_surface_charge(const char *surface_name) const char* cptr; int i, j, k; LDBLE charge; - struct rxn_token_temp *token_ptr; - struct master *master_ptr; + class rxn_token_temp *token_ptr; + class master *master_ptr; /* * Go through species, sum charge */ @@ -860,7 +860,7 @@ diff_layer_total(const char *total_name, const char *surface_name) */ cxxSurfaceCharge *surface_charge_ptr1; std::string name, token, surface_name_local; - struct master *master_ptr; + class master *master_ptr; LDBLE mass_water_surface; LDBLE molality, moles_excess, moles_surface, charge; @@ -1144,7 +1144,7 @@ calc_t_sc(const char *name) /* ---------------------------------------------------------------------- */ { char token[MAX_LENGTH]; - struct species *s_ptr; + class species *s_ptr; strcpy(token, name); s_ptr = s_search(token); @@ -1281,14 +1281,14 @@ LDBLE Phreeqc:: equivalent_fraction(const char *name, LDBLE *eq, std::string &elt_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr = s_search(name); + class species *s_ptr = s_search(name); *eq = 0; elt_name.clear(); LDBLE f = 0; if (s_ptr != NULL && (s_ptr->type == EX || s_ptr->type == SURF)) { *eq = s_ptr->equiv; - const struct elt_list *next_elt; + const class elt_list *next_elt; LDBLE tot=0.0; for (next_elt = &s_ptr->next_elt[0]; next_elt->elt != NULL; next_elt++) { @@ -1320,7 +1320,7 @@ find_gas_comp(const char *gas_comp_name) { if (strcmp_nocase(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), gas_comp_name) == 0) { - struct phase *phase_ptr = phase_bsearch(gas_comp_name, &i, false); + class phase *phase_ptr = phase_bsearch(gas_comp_name, &i, false); if (phase_ptr) { return (phase_ptr->moles_x); @@ -1461,7 +1461,7 @@ get_calculate_value(const char *name) * return: LDBLE of value */ { - struct calculate_value *calculate_value_ptr; + class calculate_value *calculate_value_ptr; calculate_value_ptr = calculate_value_search(name); if (calculate_value_ptr == NULL) { @@ -1592,7 +1592,7 @@ LDBLE Phreeqc:: log_activity(const char *species_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE la; s_ptr = s_search(species_name); @@ -1621,7 +1621,7 @@ LDBLE Phreeqc:: log_molality(const char *species_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE lm; s_ptr = s_search(species_name); @@ -1650,7 +1650,7 @@ LDBLE Phreeqc:: molality(const char *species_name) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; + class species *s_ptr; LDBLE m; s_ptr = s_search(species_name); @@ -1670,7 +1670,7 @@ LDBLE Phreeqc:: pr_pressure(const char *phase_name) /* ---------------------------------------------------------------------- */ { - struct phase *phase_ptr; + class phase *phase_ptr; int l; phase_ptr = phase_bsearch(phase_name, &l, FALSE); @@ -1699,7 +1699,7 @@ LDBLE Phreeqc:: pr_phi(const char *phase_name) /* ---------------------------------------------------------------------- */ { - struct phase *phase_ptr; + class phase *phase_ptr; int l; phase_ptr = phase_bsearch(phase_name, &l, FALSE); @@ -1720,8 +1720,8 @@ LDBLE Phreeqc:: saturation_ratio(const char *phase_name) /* ---------------------------------------------------------------------- */ { - struct rxn_token *rxn_ptr; - struct phase *phase_ptr; + class rxn_token *rxn_ptr; + class phase *phase_ptr; int l; LDBLE si, iap; @@ -1752,8 +1752,8 @@ int Phreeqc:: saturation_index(const char *phase_name, LDBLE * iap, LDBLE * si) /* ---------------------------------------------------------------------- */ { - struct rxn_token *rxn_ptr; - struct phase *phase_ptr; + class rxn_token *rxn_ptr; + class phase *phase_ptr; int l; *si = -99.99; @@ -1787,7 +1787,7 @@ sum_match_gases(const char *mytemplate, const char *name) { int i; LDBLE tot; - const struct elt_list *next_elt; + const class elt_list *next_elt; if (use.Get_gas_phase_in() == FALSE || use.Get_gas_phase_ptr() == NULL) return (0); @@ -1795,7 +1795,7 @@ sum_match_gases(const char *mytemplate, const char *name) tot = 0; for (size_t j = 0; j < gas_phase_ptr->Get_gas_comps().size(); j++) { - struct phase * phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), + class phase * phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), &i, FALSE); if (match_elts_in_species(phase_ptr->formula, mytemplate) == TRUE) { @@ -1827,7 +1827,7 @@ sum_match_species(const char *mytemplate, const char *name) { int i; LDBLE tot; - const struct elt_list *next_elt; + const class elt_list *next_elt; count_elts = 0; paren_count = 0; @@ -1837,7 +1837,7 @@ sum_match_species(const char *mytemplate, const char *name) std::vector species_list; for (i = 0; i < (int)this->s_x.size(); i++) { - struct species *s_ptr = s_x[i]; + class species *s_ptr = s_x[i]; if (match_elts_in_species(s_ptr->name, mytemplate) == TRUE) { species_list.push_back(s_ptr->name); @@ -1848,7 +1848,7 @@ sum_match_species(const char *mytemplate, const char *name) std::vector &species_list = (sum_species_map.find(mytemplate))->second; for (size_t i=0; i < species_list.size(); i++) { - struct species *s_ptr = s_search(species_list[i].c_str()); + class species *s_ptr = s_search(species_list[i].c_str()); if (s_ptr->in == FALSE) continue; if (name == NULL) { @@ -1878,7 +1878,7 @@ sum_match_ss(const char *mytemplate, const char *name) /* ---------------------------------------------------------------------- */ { LDBLE tot; - const struct elt_list *next_elt; + const class elt_list *next_elt; if (use.Get_ss_assemblage_in() == FALSE || use.Get_ss_assemblage_ptr() == NULL) return (0); @@ -1904,7 +1904,7 @@ sum_match_ss(const char *mytemplate, const char *name) else { int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); for (next_elt = &phase_ptr->next_elt[0]; next_elt->elt != NULL; next_elt++) { if (strcmp(next_elt->elt->name, name) == 0) @@ -2290,7 +2290,7 @@ surf_total(const char *total_name, const char *surface_name) if (!match) continue; // surface matches, now match element or redox state - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; if (s_x[j]->mole_balance == NULL) { for (rxn_ptr = &s_x[j]->rxn_s.token[0] + 1; rxn_ptr->s != NULL; rxn_ptr++) @@ -2436,7 +2436,7 @@ LDBLE Phreeqc:: total(const char *total_name) /* ---------------------------------------------------------------------- */ { - struct master *master_ptr; + class master *master_ptr; LDBLE t; if (strcmp(total_name, "H") == 0) @@ -2505,7 +2505,7 @@ LDBLE Phreeqc:: total_mole(const char *total_name) /* ---------------------------------------------------------------------- */ { - struct master *master_ptr; + class master *master_ptr; LDBLE t; if (strcmp(total_name, "H") == 0) @@ -2640,7 +2640,7 @@ edl_species(const char *surf_name, LDBLE * count, char ***names, LDBLE ** moles, if (sys.size() > 1) { qsort(&sys[0], sys.size(), - sizeof(struct system_species), system_species_compare); + sizeof(class system_species), system_species_compare); } /* * malloc space @@ -2731,12 +2731,12 @@ system_total(const char *total_name, LDBLE * count, char ***names, if (sys.size() > 1 && isort == 0) { qsort(&sys[0], sys.size(), - sizeof(struct system_species), system_species_compare); + sizeof(class system_species), system_species_compare); } else if (sys.size() > 1) { qsort(&sys[0], sys.size(), - sizeof(struct system_species), system_species_compare_name); + sizeof(class system_species), system_species_compare_name); } /* * malloc space @@ -2809,7 +2809,7 @@ kinetics_formula(std::string kin_name, cxxNameDouble &stoichiometry) { // Try Phases int l; - struct phase *phase_ptr = phase_bsearch(it->first.c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(it->first.c_str(), &l, FALSE); if (phase_ptr != NULL) { add_elt_list(phase_ptr->next_elt, it->second); @@ -2845,7 +2845,7 @@ phase_formula(std::string phase_name, cxxNameDouble &stoichiometry) std::string formula; int j; - struct phase *phase_ptr = phase_bsearch(phase_name.c_str(), &j, FALSE); + class phase *phase_ptr = phase_bsearch(phase_name.c_str(), &j, FALSE); if (phase_ptr != NULL) { formula.append(phase_ptr->formula); @@ -2867,7 +2867,7 @@ species_formula(std::string phase_name, cxxNameDouble &stoichiometry) stoichiometry.clear(); std::string formula; formula = "none"; - struct species *s_ptr = s_search(phase_name.c_str()); + class species *s_ptr = s_search(phase_name.c_str()); if (s_ptr != NULL) { cxxNameDouble nd(s_ptr->next_elt); @@ -2897,7 +2897,7 @@ system_total_elements(void) int i; LDBLE t; char name[MAX_LENGTH]; - struct master *master_ptr; + class master *master_ptr; /* * Include H and O @@ -3012,7 +3012,7 @@ system_total_si(void) { int i; LDBLE si, iap; - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; char name[MAX_LENGTH]; sys_tot = -999.9; @@ -3140,7 +3140,7 @@ system_total_gas(void) cxxGasPhase *gas_phase_ptr = use.Get_gas_phase_ptr(); for (size_t j = 0; j < gas_phase_ptr->Get_gas_comps().size(); j++) { - struct phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), + class phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), &i, FALSE); assert(phase_ptr); size_t count_sys = sys.size(); @@ -3168,7 +3168,7 @@ system_total_equi(void) { cxxPPassemblageComp *comp_ptr = &(it->second); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); size_t count_sys = sys.size(); sys.resize(count_sys + 1); sys[count_sys].name = string_duplicate(phase_ptr->name); @@ -3223,7 +3223,7 @@ system_total_ss(void) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[i]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); size_t count_sys = sys.size(); sys.resize(count_sys + 1); sys[count_sys].name = string_duplicate(phase_ptr->name); @@ -3377,8 +3377,8 @@ system_total_elt(const char *total_name) count_elts = 0; paren_count = 0; int j; - //struct phase * phase_ptr = phase_bsearch(x[i]->pp_assemblage_comp_name, &j, FALSE); - struct phase * phase_ptr = x[i]->phase; + //class phase * phase_ptr = phase_bsearch(x[i]->pp_assemblage_comp_name, &j, FALSE); + class phase * phase_ptr = x[i]->phase; add_elt_list(phase_ptr->next_elt, x[i]->moles); elt_list_combine(); for (j = 0; j < count_elts; j++) @@ -3411,7 +3411,7 @@ system_total_elt(const char *total_name) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[i]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); count_elts = 0; paren_count = 0; add_elt_list(phase_ptr->next_elt, @@ -3443,7 +3443,7 @@ system_total_elt(const char *total_name) cxxGasPhase *gas_phase_ptr = use.Get_gas_phase_ptr(); for (size_t i = 0; i < gas_phase_ptr->Get_gas_comps().size(); i++) { - struct phase *phase_ptr = + class phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[i].Get_phase_name().c_str(), &k, FALSE); assert(phase_ptr); if (phase_ptr->in == TRUE) @@ -3623,8 +3623,8 @@ system_total_elt_secondary(const char *total_name) count_elts = 0; paren_count = 0; int j; - //struct phase * phase_ptr = phase_bsearch(x[i]->pp_assemblage_comp_name, &j, FALSE); - struct phase * phase_ptr = x[i]->phase; + //class phase * phase_ptr = phase_bsearch(x[i]->pp_assemblage_comp_name, &j, FALSE); + class phase * phase_ptr = x[i]->phase; add_elt_list(phase_ptr->next_sys_total, x[i]->moles); elt_list_combine(); for (j = 0; j < count_elts; j++) @@ -3658,7 +3658,7 @@ system_total_elt_secondary(const char *total_name) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[k]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); count_elts = 0; paren_count = 0; add_elt_list(phase_ptr->next_sys_total, @@ -3690,7 +3690,7 @@ system_total_elt_secondary(const char *total_name) cxxGasPhase *gas_phase_ptr = use.Get_gas_phase_ptr(); for (size_t j = 0; j < gas_phase_ptr->Get_gas_comps().size(); j++) { - struct phase *phase_ptr = + class phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), &i, FALSE); assert(phase_ptr); if (phase_ptr->in == TRUE) @@ -3808,10 +3808,10 @@ int Phreeqc:: system_species_compare(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { - const struct system_species *a, *b; + const class system_species *a, *b; - a = (const struct system_species *) ptr1; - b = (const struct system_species *) ptr2; + a = (const class system_species *) ptr1; + b = (const class system_species *) ptr2; if (a->moles < b->moles) return (1); if (a->moles > b->moles) @@ -3822,10 +3822,10 @@ int Phreeqc:: system_species_compare_name(const void* ptr1, const void* ptr2) /* ---------------------------------------------------------------------- */ { - const struct system_species* a, * b; + const class system_species* a, * b; - a = (const struct system_species*)ptr1; - b = (const struct system_species*)ptr2; + a = (const class system_species*)ptr1; + b = (const class system_species*)ptr2; return (strncmp(a->name, b->name, MAX_LENGTH)); } @@ -3870,7 +3870,7 @@ system_total_solids(cxxExchange *exchange_ptr, { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[j]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); add_elt_list(phase_ptr->next_elt, comp_ptr->Get_moles()); } @@ -3881,7 +3881,7 @@ system_total_solids(cxxExchange *exchange_ptr, for (size_t j = 0; j < gas_phase_ptr->Get_gas_comps().size(); j++) { int i; - struct phase *phase_ptr = + class phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), &i, FALSE); add_elt_list(phase_ptr->next_elt, gas_phase_ptr->Get_gas_comps()[j].Get_moles()); } @@ -3893,7 +3893,7 @@ system_total_solids(cxxExchange *exchange_ptr, for ( ; it != pp_assemblage_ptr->Get_pp_assemblage_comps().end(); it++) { int j; - struct phase * phase_ptr = phase_bsearch(it->first.c_str(), &j, FALSE); + class phase * phase_ptr = phase_bsearch(it->first.c_str(), &j, FALSE); add_elt_list(phase_ptr->next_elt, it->second.Get_moles()); } @@ -3941,7 +3941,7 @@ iso_unit(const char *total_name) { int j; char token[MAX_LENGTH], unit[MAX_LENGTH]; - struct master_isotope *master_isotope_ptr; + class master_isotope *master_isotope_ptr; char my_total_name[MAX_LENGTH]; strcpy(token, ""); strcpy(my_total_name, total_name); diff --git a/gases.cpp b/gases.cpp index b499bb00..02c35972 100644 --- a/gases.cpp +++ b/gases.cpp @@ -22,7 +22,7 @@ setup_fixed_volume_gas(void) { const cxxGasComp *comp_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int j; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_phase_name().c_str(), &j, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_phase_name().c_str(), &j, FALSE); x[count_unknowns]->type = GAS_MOLES; x[count_unknowns]->description = phase_ptr->name; x[count_unknowns]->phase = phase_ptr; @@ -57,9 +57,9 @@ build_fixed_volume_gas(void) * mass balance equations for elements contained in gases */ size_t row, col; - struct master *master_ptr; - struct rxn_token *rxn_ptr; - struct unknown *unknown_ptr; + class master *master_ptr; + class rxn_token *rxn_ptr; + class unknown *unknown_ptr; LDBLE coef, coef_elt; if (gas_unknown == NULL) @@ -69,7 +69,7 @@ build_fixed_volume_gas(void) { const cxxGasComp *comp_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int j; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_phase_name().c_str(), &j, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_phase_name().c_str(), &j, FALSE); /* * Determine elements in gas component */ @@ -351,7 +351,7 @@ calc_PR(void) LDBLE r3[4], r3_12, rp, rp3, rq, rz, ri, ri1, one_3 = 0.33333333333333333; LDBLE disct, vinit, v1, ddp, dp_dv, dp_dv2; int it; - struct phase *phase_ptr; + class phase *phase_ptr; LDBLE V_m = 0, P = 0; LDBLE TK = tk_x; @@ -413,7 +413,7 @@ calc_PR(void) // continue; b_sum += phase_ptr->fraction_x * phase_ptr->pr_b; size_t i1; - struct phase *phase_ptr1; + class phase *phase_ptr1; for (i1 = 0; i1 < gas_unknowns.size(); i1++) { phase_ptr1 = gas_unknowns[i1]->phase; @@ -609,8 +609,8 @@ calc_fixed_volume_gas_pressures(void) { int n_g = 0; LDBLE lp; - struct rxn_token *rxn_ptr; - struct phase *phase_ptr; + class rxn_token *rxn_ptr; + class phase *phase_ptr; bool PR = false, pr_done = false; size_t i; /* diff --git a/global_structures.h b/global_structures.h index 0009613c..9b685ab0 100644 --- a/global_structures.h +++ b/global_structures.h @@ -193,17 +193,16 @@ typedef struct PHRQMemHeader struct Change_Surf { - const char *comp_name = NULL; - LDBLE fraction = 0.5; - const char *new_comp_name = NULL; - LDBLE new_Dw = 1e-9; - int cell_no = 0; - int next = 0; + const char *comp_name; + LDBLE fraction; + const char *new_comp_name; + LDBLE new_Dw; + int cell_no; + int next; }; /*---------------------------------------------------------------------- * CReaction *---------------------------------------------------------------------- */ - class CReaction { public: @@ -215,120 +214,226 @@ public: double* Get_dz(void) { return this->dz; } void Set_dz(double* d); size_t size() { return token.size(); } - std::vector& Get_tokens(void) { return this->token; } - void Set_tokens(const std::vector& t) { this->token = t; } + std::vector& Get_tokens(void) { return this->token; } + void Set_tokens(const std::vector& t) { this->token = t; } public: double logk[MAX_LOG_K_INDICES]; double dz[3]; - std::vector token; + std::vector token; }; -struct rxn_token +class rxn_token { - struct species* s = NULL; - LDBLE coef = 0.0; - const char* name = NULL; +public: + ~rxn_token() {}; + rxn_token::rxn_token() + { + s = NULL; + coef = 0.0; + name = NULL; + } + class species* s; + LDBLE coef; + const char* name; }; -struct save +class save { - int solution = 0; - int n_solution_user = 0; - int n_solution_user_end = 0; - int mix = 0; - int n_mix_user = 0; - int n_mix_user_end = 0; - int reaction = 0; - int n_reaction_user = 0; - int n_reaction_user_end = 0; - int pp_assemblage = 0; - int n_pp_assemblage_user = 0; - int n_pp_assemblage_user_end = 0; - int exchange = 0; - int n_exchange_user = 0; - int n_exchange_user_end = 0; - int kinetics = 0; - int n_kinetics_user = 0; - int n_kinetics_user_end = 0; - int surface = 0; - int n_surface_user = 0; - int n_surface_user_end = 0; - int gas_phase = 0; - int n_gas_phase_user = 0; - int n_gas_phase_user_end = 0; - int ss_assemblage = 0; - int n_ss_assemblage_user = 0; - int n_ss_assemblage_user_end = 0; +public: + ~save() {}; + save::save() + { + solution = 0; + n_solution_user = 0; + n_solution_user_end = 0; + mix = 0; + n_mix_user = 0; + n_mix_user_end = 0; + reaction = 0; + n_reaction_user = 0; + n_reaction_user_end = 0; + pp_assemblage = 0; + n_pp_assemblage_user = 0; + n_pp_assemblage_user_end = 0; + exchange = 0; + n_exchange_user = 0; + n_exchange_user_end = 0; + kinetics = 0; + n_kinetics_user = 0; + n_kinetics_user_end = 0; + surface = 0; + n_surface_user = 0; + n_surface_user_end = 0; + gas_phase = 0; + n_gas_phase_user = 0; + n_gas_phase_user_end = 0; + ss_assemblage = 0; + n_ss_assemblage_user = 0; + n_ss_assemblage_user_end = 0; + } + int solution; + int n_solution_user; + int n_solution_user_end; + int mix; + int n_mix_user; + int n_mix_user_end; + int reaction; + int n_reaction_user; + int n_reaction_user_end; + int pp_assemblage; + int n_pp_assemblage_user; + int n_pp_assemblage_user_end; + int exchange; + int n_exchange_user; + int n_exchange_user_end; + int kinetics; + int n_kinetics_user; + int n_kinetics_user_end; + int surface; + int n_surface_user; + int n_surface_user_end; + int gas_phase; + int n_gas_phase_user; + int n_gas_phase_user_end; + int ss_assemblage; + int n_ss_assemblage_user; + int n_ss_assemblage_user_end; }; /*---------------------------------------------------------------------- * Copy *---------------------------------------------------------------------- */ -struct copier +class copier { - std::vector n_user, start, end; +public: + ~copier() {}; + copier::copier() + {} + std::vector n_user; + std::vector start; + std::vector end; }; - /*---------------------------------------------------------------------- * Inverse *---------------------------------------------------------------------- */ -struct inverse +class inverse { - int n_user = -1; - char *description = NULL; - int new_def = FALSE; - int minimal = FALSE; - int range = FALSE; - int mp = FALSE; - LDBLE mp_censor = 1e-20; - LDBLE range_max = 1000.0; - LDBLE tolerance = 1e-10; - LDBLE mp_tolerance = 1e-12; +public: + ~inverse() {}; + inverse::inverse() + { + n_user = -1; + description = NULL; + new_def = FALSE; + minimal = FALSE; + range = FALSE; + mp = FALSE; + mp_censor = 1e-20; + range_max = 1000.0; + tolerance = 1e-10; + mp_tolerance = 1e-12; + uncertainties.clear(); + ph_uncertainties.clear(); + water_uncertainty = 0.0; + mineral_water = TRUE; + carbon = TRUE; + dalk_dph.clear(); + dalk_dc.clear(); + size_t count_solns = 0; + solns.clear(); + force_solns.clear(); + elts.clear(); + phases.clear(); + size_t count_redox_rxns = 0; + isotopes.clear(); + i_u.clear(); + isotope_unknowns.clear(); + netpath = NULL; + pat = NULL; + } + int n_user; + char* description; + int new_def; + int minimal; + int range; + int mp; + LDBLE mp_censor; + LDBLE range_max; + LDBLE tolerance; + LDBLE mp_tolerance; std::vector uncertainties; std::vector ph_uncertainties; - LDBLE water_uncertainty = 0.0; - int mineral_water = TRUE; - int carbon = TRUE; + LDBLE water_uncertainty; + int mineral_water; + int carbon; std::vector dalk_dph; std::vector dalk_dc; - size_t count_solns = 0; + size_t count_solns; std::vector solns; std::vector force_solns; - std::vector elts; - std::vector phases; - size_t count_redox_rxns = 0; - std::vector isotopes; - std::vector i_u; - std::vector isotope_unknowns; - const char *netpath = NULL; - const char *pat = NULL; + std::vector elts; + std::vector phases; + size_t count_redox_rxns; + std::vector isotopes; + std::vector i_u; + std::vector isotope_unknowns; + const char* netpath; + const char* pat; }; -struct inv_elts +class inv_elts { - const char *name = NULL; - struct master *master = NULL; - size_t row = 0; +public: + ~inv_elts() {}; + inv_elts::inv_elts() + { + name = NULL; + master = NULL; + row = 0; + uncertainties.clear(); + } + const char* name; + class master* master; + size_t row; std::vector uncertainties; }; -struct inv_isotope +class inv_isotope { - const char *isotope_name = NULL; - LDBLE isotope_number = 0; - const char *elt_name = NULL; +public: + ~inv_isotope() {}; + inv_isotope::inv_isotope() + { + isotope_name = NULL; + isotope_number = 0; + elt_name = NULL; + uncertainties.clear(); + } + const char* isotope_name; + LDBLE isotope_number; + const char* elt_name; std::vector uncertainties; }; -struct inv_phases +class inv_phases { - const char *name = NULL; - struct phase *phase = NULL; - int column = 0; - int constraint = EITHER; - int force = FALSE; - std::vector isotopes; +public: + ~inv_phases() {}; + inv_phases::inv_phases() + { + name = NULL; + phase = NULL; + column = 0; + constraint = EITHER; + force = FALSE; + isotopes.clear(); + } + const char* name; + class phase* phase; + int column; + int constraint; + int force; + std::vector isotopes; }; /*---------------------------------------------------------------------- * Jacobian and Mass balance lists *---------------------------------------------------------------------- */ - class Model { public: @@ -343,13 +448,12 @@ public: ~Model() { }; - bool force_prep = false; bool numerical_fixed_volume = false; cxxGasPhase::GP_TYPE gas_phase_type = cxxGasPhase::GP_UNKNOWN; - std::vector gas_phase; + std::vector gas_phase; std::vector ss_assemblage; - std::vector pp_assemblage; + std::vector pp_assemblage; std::vector si; std::vector add_formula; cxxSurface::DIFFUSE_LAYER_TYPE dl_type = cxxSurface::NO_DL; @@ -357,593 +461,1098 @@ public: std::vector surface_comp; std::vector surface_charge; }; - -struct name_coef +class name_coef { - const char* name = NULL; - LDBLE coef = 0; +public: + ~name_coef() {}; + name_coef::name_coef() + { + name = NULL; + coef = 0; + } + const char* name; + LDBLE coef; }; /*---------------------------------------------------------------------- * Species_list *---------------------------------------------------------------------- */ -struct species_list +class species_list { - struct species *master_s = NULL; - struct species *s = NULL; - LDBLE coef = 0; +public: + ~species_list() {}; + species_list::species_list() + { + master_s = NULL; + s = NULL; + coef = 0; + } + class species* master_s; + class species* s; + LDBLE coef; }; - /*---------------------------------------------------------------------- * Jacobian and Mass balance lists *---------------------------------------------------------------------- */ -struct list0 +class list0 { - LDBLE *target = NULL; - LDBLE coef = 0; +public: + ~list0() {}; + list0::list0() + { + target = NULL; + coef = 0; + } + LDBLE* target; + LDBLE coef; }; -struct list1 +class list1 { - LDBLE *source = NULL; - LDBLE *target = NULL; +public: + ~list1() {}; + list1::list1() + { + source = NULL; + target = NULL; + } + LDBLE* source; + LDBLE* target; }; -struct list2 +class list2 { - LDBLE *source = NULL; - LDBLE *target = NULL; - LDBLE coef = 0; +public: + ~list2() {}; + list2::list2() + { + source = NULL; + target = NULL; + coef = 0; + } + LDBLE* source; + LDBLE* target; + LDBLE coef; }; - - struct isotope - { - LDBLE isotope_number = 0; - const char *elt_name = NULL; - const char *isotope_name = NULL; - LDBLE total = 0; - LDBLE ratio = 0; - LDBLE ratio_uncertainty = 0; - LDBLE x_ratio_uncertainty = 0; - struct master *master = NULL; - struct master *primary = NULL; - LDBLE coef = 0; /* coefficient of element in phase */ -}; -struct iso +class isotope { - const char *name = NULL; - LDBLE value = 0; - LDBLE uncertainty = 0.05; +public: + ~isotope() {}; + isotope::isotope() + { + isotope_number = 0; + elt_name = NULL; + isotope_name = NULL; + total = 0; + ratio = 0; + ratio_uncertainty = 0; + x_ratio_uncertainty = 0; + master = NULL; + primary = NULL; + coef = 0; /* coefficient of element in phase */ + } + LDBLE isotope_number; + const char* elt_name; + const char* isotope_name; + LDBLE total; + LDBLE ratio; + LDBLE ratio_uncertainty; + LDBLE x_ratio_uncertainty; + class master* master; + class master* primary; + LDBLE coef; +}; +class iso +{ +public: + ~iso() {}; + iso::iso() + { + name = NULL; + value = 0; + uncertainty = 0.05; + } + const char* name; + LDBLE value; + LDBLE uncertainty; }; /*---------------------------------------------------------------------- * Transport data *---------------------------------------------------------------------- */ -struct stag_data +class stag_data { - int count_stag = 0; - LDBLE exch_f = 0; - LDBLE th_m = 0; - LDBLE th_im = 0; +public: + ~stag_data() {}; + stag_data::stag_data() + { + count_stag = 0; + exch_f = 0; + th_m = 0; + th_im = 0; + } + int count_stag; + LDBLE exch_f; + LDBLE th_m; + LDBLE th_im; }; -struct cell_data +class cell_data { - LDBLE length = 1; - LDBLE mid_cell_x = 1.; - LDBLE disp = 1.0; - LDBLE temp = 25.; - // free (uncharged) porewater porosities - LDBLE por = 0.1; - // interlayer water porosities - LDBLE por_il = 0.01; - // potential (V) - LDBLE potV = 0; - int punch = FALSE; - int print = FALSE; - int same_model = FALSE; +public: + ~cell_data() {}; + cell_data::cell_data() + { + length = 1; + mid_cell_x = 1.; + disp = 1.0; + temp = 25.; + // free (uncharged) porewater porosities + por = 0.1; + // interlayer water porosities + por_il = 0.01; + // potential (V) + potV = 0; + punch = FALSE; + print = FALSE; + same_model = FALSE; + } + LDBLE length; + LDBLE mid_cell_x; + LDBLE disp; + LDBLE temp; + LDBLE por; + LDBLE por_il; + LDBLE potV; + int punch; + int print; + int same_model; }; - /*---------------------------------------------------------------------- * Keywords *---------------------------------------------------------------------- */ - struct key - { - char *name = NULL; - int keycount = 0; - }; - struct const_key - { - const char *name = NULL; - int keycount = 0; -}; - +//class key +//{ +//public: +// ~key() {}; +// key::key() +// { +// name = NULL; +// keycount = 0; +// } +// char* name; +// int keycount = 0; +// }; +//class const_key +//{ +//public: +// ~const_key() {}; +// const_key::const_key() +// { +// name = NULL; +// keycount = 0; +// } +// const char* name; +// int keycount; +//}; /*---------------------------------------------------------------------- * Elements *---------------------------------------------------------------------- */ -struct element +class element { - // element name - const char *name = NULL; - /* int in; */ - struct master *master = NULL; - struct master *primary = NULL; - LDBLE gfw = 0; +public: + ~element() {}; + element::element() + { + // element name + name = NULL; + /* int in; */ + master = NULL; + primary = NULL; + gfw = 0; + } + const char* name; + class master* master; + class master* primary; + LDBLE gfw; }; /*---------------------------------------------------------------------- * Element List *---------------------------------------------------------------------- */ -struct elt_list -{ /* list of name and number of elements in an equation */ - struct element *elt = NULL; /* pointer to element structure */ - LDBLE coef = 0.0; /* number of element e's in eqn */ +class elt_list +{ +public: + ~elt_list() {}; + elt_list::elt_list() + { /* list of name and number of elements in an equation */ + elt = NULL; /* pointer to element structure */ + coef = 0.0; /* number of element e's in eqn */ + } + class element* elt; + LDBLE coef; }; - /*---------------------------------------------------------------------- * Species *---------------------------------------------------------------------- */ -struct species -{ /* all data pertinent to an aqueous species */ - // name of species - const char *name = NULL; - // formula for mole balance - const char *mole_balance = NULL; - // set internally if species in model - int in = FALSE; - int number = 0; - // points to master species list, NULL if not primary master - struct master *primary = NULL; - // points to master species list, NULL if not secondary master - struct master *secondary = NULL; - // gram formula wt of species - LDBLE gfw = 0; - // charge of species - LDBLE z = 0; - // tracer diffusion coefficient in water at 25oC, m2/s - LDBLE dw = 0; - // correct Dw for temperature: Dw(TK) = Dw(298.15) * exp(dw_t / TK - dw_t / 298.15) - LDBLE dw_t = 0; - // parms for calc'ng SC = SC0 * exp(-dw_a * z * mu^0.5 / (1 + DH_B * dw_a2 * mu^0.5)) - LDBLE dw_a = 0; - LDBLE dw_a2 = 0; - // viscosity correction of SC - LDBLE dw_a_visc = 0; - // contribution to SC, for calc'ng transport number with BASIC - LDBLE dw_t_SC = 0; - // dw corrected for TK and mu - LDBLE dw_corr = 0; - // enrichment factor in DDL - LDBLE erm_ddl = 0; - // equivalents in exchange species - LDBLE equiv = 0; - // alkalinity of species, used for cec in exchange - LDBLE alk = 0; - // stoichiometric coefficient of carbon in species - LDBLE carbon = 0; - // stoichiometric coefficient of C(4) in species - LDBLE co2 = 0; - // stoichiometric coefficient of H in species - LDBLE h = 0; - // stoichiometric coefficient of O in species - LDBLE o = 0; - // WATEQ Debye Huckel a and b-dot; active_fraction coef for exchange species - LDBLE dha = 0, dhb = 0, a_f = 0; - // log10 k at working temperature - LDBLE lk = 0; - // log kt0, delh, 6 coefficients analytical expression + volume terms - LDBLE logk[MAX_LOG_K_INDICES] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - // 7 coefficients analytical expression for B, D, anion terms and pressure in Jones_Dole viscosity eqn - LDBLE Jones_Dole[10] = { 0,0,0,0,0,0,0,0,0,0 }; -/* VP: Density Start */ - // regression coefficients to calculate temperature dependent phi_0and b_v of Millero density model - LDBLE millero[7] = { 0,0,0,0,0,0,0 }; - /* VP: Density End */ - // enum with original delta H units - DELTA_H_UNIT original_units = kjoules; - std::vector add_logk; - // log10 activity coefficient, gamma - LDBLE lg = 0; - // log10 activity coefficient, from pitzer calculation - LDBLE lg_pitzer = 0; - // log10 molality - LDBLE lm = 0; - // log10 activity - LDBLE la = 0; - // gamma term for jacobian - LDBLE dg = 0; - LDBLE dg_total_g = 0; - // moles in solution; moles/mass_water = molality - LDBLE moles = 0; - // flag indicating presence in model and types of equations - int type = 0; - // flag for preferred activity coef eqn - int gflag = 0; - // flag for preferred activity coef eqn - int exch_gflag = 0; - // vector of elements - std::vector next_elt; - std::vector next_secondary; - std::vector next_sys_total; - // switch to check equation for charge and element balance - int check_equation = TRUE; - // data base reaction +class species +{ +public: + ~species() {}; + species::species() + { /* all data pertinent to an aqueous species */ + name = NULL; // name of species + mole_balance = NULL; // formula for mole balance + in = FALSE; // set internally if species in model + number = 0; + // points to master species list, NULL if not primary master + primary = NULL; + // points to master species list, NULL if not secondary master + secondary = NULL; + gfw = 0; // gram formula wt of species + z = 0; // charge of species + // tracer diffusion coefficient in water at 25oC, m2/s + dw = 0; + // correct Dw for temperature: Dw(TK) = Dw(298.15) * exp(dw_t / TK - dw_t / 298.15) + dw_t = 0; + // parms for calc'ng SC = SC0 * exp(-dw_a * z * mu^0.5 / (1 + DH_B * dw_a2 * mu^0.5)) + dw_a = 0; + dw_a2 = 0; + dw_a_visc = 0; // viscosity correction of SC + dw_t_SC = 0; // contribution to SC, for calc'ng transport number with BASIC + dw_corr = 0; // dw corrected for TK and mu + erm_ddl = 0; // enrichment factor in DDL + equiv = 0; // equivalents in exchange species + alk = 0; // alkalinity of species, used for cec in exchange + carbon = 0; // stoichiometric coefficient of carbon in species + co2 = 0; // stoichiometric coefficient of C(4) in species + h = 0; // stoichiometric coefficient of H in species + // stoichiometric coefficient of O in species + o = 0; + // WATEQ Debye Huckel a and b-dot; active_fraction coef for exchange species + dha = 0, dhb = 0, a_f = 0; + lk = 0; // log10 k at working temperature + // log kt0, delh, 6 coefficients analytical expression + volume terms + for (size_t i = 0; i < MAX_LOG_K_INDICES; i++) logk[i] = 0; + // 7 coefficients analytical expression for B, D, anion terms and pressure in Jones_Dole viscosity eqn + for (size_t i = 0; i < 10; i++) Jones_Dole[i] = 0; + // regression coefficients to calculate temperature dependent phi_0and b_v of Millero density model + for (size_t i = 0; i < 7; i++) millero[i] = 0; + original_units = kjoules; // enum with original delta H units + add_logk.clear(); + lg = 0; // log10 activity coefficient, gamma + lg_pitzer = 0; // log10 activity coefficient, from pitzer calculation + lm = 0; // log10 molality + la = 0; // log10 activity + dg = 0; // gamma term for jacobian + dg_total_g = 0; + moles = 0; // moles in solution; moles/mass_water = molality + type = 0; // flag indicating presence in model and types of equations + gflag = 0; // flag for preferred activity coef eqn + exch_gflag = 0; // flag for preferred activity coef eqn + // vector of elements + next_elt.clear(); + next_secondary.clear(); + next_sys_total.clear(); + // switch to check equation for charge and element balance + check_equation = TRUE; + //CReaction rxn; // data base reaction + //CReaction rxn_s; // reaction converted to secondary and primary master species + //CReaction rxn_x; // reaction to be used in model + // (1 + sum(g)) * moles + tot_g_moles = 0; + // sum(moles*g*Ws/Waq) + tot_dh2o_moles = 0; + for (size_t i = 0; i < 5; i++) cd_music[i] = 0; + for (size_t i = 0; i < 3; i++) dz[i] = 0; + original_deltav_units = cm3_per_mol; + } + const char* name; + const char* mole_balance; + int in = FALSE; + int number; + class master* primary; + class master* secondary; + LDBLE gfw; + LDBLE z; + LDBLE dw; + LDBLE dw_t; + LDBLE dw_a; + LDBLE dw_a2; + LDBLE dw_a_visc; + LDBLE dw_t_SC; + LDBLE dw_corr; + LDBLE erm_ddl; + LDBLE equiv; + LDBLE alk; + LDBLE carbon; + LDBLE co2; + LDBLE h; + LDBLE o; + LDBLE dha, dhb, a_f; + LDBLE lk; + LDBLE logk[MAX_LOG_K_INDICES]; + LDBLE Jones_Dole[10]; + LDBLE millero[7]; + DELTA_H_UNIT original_units; + std::vector add_logk; + LDBLE lg; + LDBLE lg_pitzer; + LDBLE lm; + LDBLE la; + LDBLE dg; + LDBLE dg_total_g; + LDBLE moles; + int type; + int gflag; + int exch_gflag; + std::vector next_elt; + std::vector next_secondary; + std::vector next_sys_total; + int check_equation; CReaction rxn; - // reaction converted to secondary and primary master species CReaction rxn_s; - // reaction to be used in model CReaction rxn_x; - // (1 + sum(g)) * moles - LDBLE tot_g_moles = 0; - // sum(moles*g*Ws/Waq) - LDBLE tot_dh2o_moles = 0; - LDBLE cd_music[5] = { 0,0,0,0,0 }; - LDBLE dz[3] = { 0,0,0 }; - DELTA_V_UNIT original_deltav_units = cm3_per_mol; + LDBLE tot_g_moles; + LDBLE tot_dh2o_moles; + LDBLE cd_music[5]; + LDBLE dz[3]; + DELTA_V_UNIT original_deltav_units; }; -struct logk -{ /* Named log K's */ - const char *name = NULL; // name of species - LDBLE lk = 0.0; // log10 k at working temperature - LDBLE log_k[MAX_LOG_K_INDICES] = // log kt0, delh, 6 coefficients analalytical expression - { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - DELTA_H_UNIT original_units = kjoules; // enum with original delta H units - int done = FALSE; - std::vector add_logk; - LDBLE log_k_original[MAX_LOG_K_INDICES] = // log kt0, delh, 5 coefficients analalytical expression */ - { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - DELTA_V_UNIT original_deltav_units = cm3_per_mol; +class logk +{ +public: + ~logk() {}; + logk::logk() + { /* Named log K's */ + name = NULL; // name of species + lk = 0.0; // log10 k at working temperature + // log kt0, delh, 6 coefficients analalytical expression + for (size_t i = 0; i < MAX_LOG_K_INDICES; i++) log_k[i] = 0; + // enum with original delta H units + original_units = kjoules; + done = FALSE; + add_logk.clear(); + // log kt0, delh, 5 coefficients analalytical expression + for (size_t i = 0; i < MAX_LOG_K_INDICES; i++) log_k_original[i] = 0; + original_deltav_units = cm3_per_mol; + } + const char* name; + LDBLE lk; + LDBLE log_k[MAX_LOG_K_INDICES]; + DELTA_H_UNIT original_units; + int done; + std::vector add_logk; + LDBLE log_k_original[MAX_LOG_K_INDICES]; + DELTA_V_UNIT original_deltav_units; }; - /*---------------------------------------------------------------------- * Phases *---------------------------------------------------------------------- */ -struct phase -{ /* all data pertinent to a pure solid phase */ - const char *name = NULL; //name of species - const char *formula = NULL; // chemical formula - int in = FALSE; // species used in model if TRUE - LDBLE lk = 0; // log10 k at working temperature - LDBLE logk[MAX_LOG_K_INDICES] = // log kt0, delh, 6 coefficients analalytical expression - { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - DELTA_H_UNIT original_units = kjoules; // enum with original delta H units - DELTA_V_UNIT original_deltav_units = cm3_per_mol; - std::vector add_logk; - LDBLE moles_x = 0; - LDBLE delta_max = 0; - LDBLE p_soln_x = 0; - LDBLE fraction_x = 0; - LDBLE log10_lambda = 0; - LDBLE log10_fraction_x = 0; - LDBLE dn = 0, dnb = 0, dnc = 0; - LDBLE gn = 0, gntot = 0; - LDBLE gn_n = 0, gntot_n = 0; - LDBLE t_c = 0, p_c = 0, omega = 0; // gas: critical TK, critical P(atm), Pitzer acentric coeff - LDBLE pr_a = 0, pr_b = 0, pr_alpha = 0; // Peng-Robinson parm's - LDBLE pr_tk = 0, pr_p = 0; // Temperature (K), Pressure (atm) - LDBLE pr_phi = 0; // fugacity coefficient (-) - LDBLE pr_aa_sum2 = 0; // for calculating multicomponent phi - LDBLE delta_v[9] = { 0,0,0,0,0,0,0,0,0 }; // delta_v[0] = [1] + [2]*T + [3]/T + [4]*log10(T) + [5]/T^2 + [6]*T^2 + [7]*P - LDBLE pr_si_f = 0; // si adapter: log10(phi) - delta_v[0] * (P - 1) /RT - bool pr_in = false; // Peng-Robinson in the calc's, or not - int type = SOLID; // flag indicating presence in model and types of equations - std::vector next_elt; // list of elements in phase - std::vector next_sys_total; - int check_equation = TRUE; // switch to check equation for charge and element balance - CReaction rxn; // pointer to data base reaction - CReaction rxn_s; // pointer to reaction converted to secondary and primary master species - CReaction rxn_x; // reaction to be used in model - int replaced = FALSE; // equation contains solids or gases +class phase +{ +public: + ~phase() {}; + phase::phase() + { /* all data pertinent to a pure solid phase */ + name = NULL; //name of species + formula = NULL; // chemical formula + in = FALSE; // species used in model if TRUE + lk = 0; // log10 k at working temperature + // log kt0, delh, 6 coefficients analalytical expression + for (size_t i = 0; i < MAX_LOG_K_INDICES; i++) logk[i] = 0; + // enum with original delta H units + original_units = kjoules; + original_deltav_units = cm3_per_mol; + add_logk.clear(); + moles_x = 0; + delta_max = 0; + p_soln_x = 0; + fraction_x = 0; + log10_lambda = 0; + log10_fraction_x = 0; + dn = 0, dnb = 0, dnc = 0; + gn = 0, gntot = 0; + gn_n = 0, gntot_n = 0; + // gas: critical TK, critical P(atm), Pitzer acentric coeff + t_c = 0, p_c = 0, omega = 0; + // Peng-Robinson parm's + pr_a = 0, pr_b = 0, pr_alpha = 0; + // Temperature (K), Pressure (atm) + pr_tk = 0, pr_p = 0; + // fugacity coefficient (-) + pr_phi = 0; + // for calculating multicomponent phi + pr_aa_sum2 = 0; + // delta_v[0] = [1] + [2]*T + [3]/T + [4]*log10(T) + [5]/T^2 + [6]*T^2 + [7]*P + for (size_t i = 0; i < 9; i++) delta_v[9] = 0; + // si adapter: log10(phi) - delta_v[0] * (P - 1) /RT + pr_si_f = 0; + // Peng-Robinson in the calc's, or not + pr_in = false; + // flag indicating presence in model and types of equations + type = SOLID; + // list of elements in phase + next_elt.clear(); + next_sys_total.clear(); + // switch to check equation for charge and element balance + check_equation = TRUE; + // data base reaction + //CReaction rxn; + // reaction converted to secondary and primary master species + //CReaction rxn_s; + // reaction to be used in model + //CReaction rxn_x; + // equation contains solids or gases + replaced = FALSE; + in_system = FALSE; + } + const char* name; + const char* formula; + int in; + LDBLE lk; + LDBLE logk[MAX_LOG_K_INDICES]; + DELTA_H_UNIT original_units; + DELTA_V_UNIT original_deltav_units; + std::vector add_logk; + LDBLE moles_x; + LDBLE delta_max; + LDBLE p_soln_x; + LDBLE fraction_x; + LDBLE log10_lambda; + LDBLE log10_fraction_x; + LDBLE dn, dnb, dnc; + LDBLE gn, gntot; + LDBLE gn_n, gntot_n; + LDBLE t_c, p_c, omega; + LDBLE pr_a, pr_b, pr_alpha; + LDBLE pr_tk, pr_p; + LDBLE pr_phi; + LDBLE pr_aa_sum2; + LDBLE delta_v[9]; + LDBLE pr_si_f; + bool pr_in; + int type = SOLID; + std::vector next_elt; + std::vector next_sys_total; + int check_equation; + CReaction rxn; + CReaction rxn_s; + CReaction rxn_x; + int replaced = FALSE; int in_system = FALSE; }; /*---------------------------------------------------------------------- * Master species *---------------------------------------------------------------------- */ - struct master - { // list of name and number of elements in an equation - // TRUE if in model, FALSE if out, REWRITE if other mb eq - int in = 0; - // sequence number in list of masters - size_t number = 0; - // saved to determine if model has changed - int last_model = FALSE; - // AQ or EX - int type = 0; - // TRUE if master species is primary - int primary = FALSE; - // coefficient of element in master species - LDBLE coef = 0; - // total concentration for element or valence state - LDBLE total = 0; - LDBLE isotope_ratio = 0; - LDBLE isotope_ratio_uncertainty = 0; - int isotope = 0; - LDBLE total_primary = 0; - // element structure - struct element *elt = NULL; - // alkalinity of species - LDBLE alk = 0; - // default gfw for species - LDBLE gfw = 1; - // formula from which to calcuate gfw - const char *gfw_formula = NULL; - // pointer to unknown structure - struct unknown *unknown = NULL; - // pointer to species structure - struct species *s = NULL; - // reaction writes master species in terms of primary master species +class master +{ +public: + ~master() {}; + master::master() + { + // TRUE if in model, FALSE if out, REWRITE if other mb eq + in = 0; + // sequence number in list of masters + number = 0; + // saved to determine if model has changed + last_model = FALSE; + // AQ or EX + type = 0; + // TRUE if master species is primary + primary = FALSE; + // coefficient of element in master species + coef = 0; + // total concentration for element or valence state + total = 0; + isotope_ratio = 0; + isotope_ratio_uncertainty = 0; + isotope = 0; + total_primary = 0; + // element structure + elt = NULL; + // alkalinity of species + alk = 0; + // default gfw for species + gfw = 1; + // formula from which to calcuate gfw + gfw_formula = NULL; + // pointer to unknown structure + unknown = NULL; + // pointer to species structure + s = NULL; + // reaction writes master species in terms of primary master species + //CReaction rxn_primary; + // reaction writes master species in terms of secondary master species + //CReaction rxn_secondary; + pe_rxn = NULL; + minor_isotope = FALSE; + } + int in; + size_t number; + int last_model; + int type; + int primary; + LDBLE coef; + LDBLE total; + LDBLE isotope_ratio; + LDBLE isotope_ratio_uncertainty; + int isotope; + LDBLE total_primary; + class element* elt; + LDBLE alk; + LDBLE gfw = 1; + const char* gfw_formula; + class unknown* unknown; + class species* s; CReaction rxn_primary; - // reaction writes master species in terms of secondary master species CReaction rxn_secondary; - const char * pe_rxn = NULL; - int minor_isotope = FALSE; + const char* pe_rxn; + int minor_isotope; }; /*---------------------------------------------------------------------- * Unknowns *---------------------------------------------------------------------- */ -struct unknown +class unknown { - int type = 0; - LDBLE moles = 0; - LDBLE ln_moles = 0; - LDBLE f = 0; - LDBLE sum = 0; - LDBLE delta = 0; - LDBLE la = 0; - size_t number = 0; - const char *description = NULL; - std::vector master; - struct phase *phase = NULL; - LDBLE si = 0; - int n_gas_phase_user = 0; - struct species *s = NULL; - const char * exch_comp = NULL; - const char *pp_assemblage_comp_name = NULL; - void *pp_assemblage_comp_ptr = NULL; - const char * ss_name = NULL; - void *ss_ptr = NULL; - const char * ss_comp_name = NULL; - void *ss_comp_ptr = NULL; - int ss_comp_number = 0; +public: + ~unknown() {}; + unknown::unknown() + { + type = 0; + moles = 0; + ln_moles = 0; + f = 0; + sum = 0; + delta = 0; + la = 0; + number = 0; + description = NULL; + master.clear(); + phase = NULL; + si = 0; + n_gas_phase_user = 0; + s = NULL; + exch_comp = NULL; + pp_assemblage_comp_name = NULL; + pp_assemblage_comp_ptr = NULL; + ss_name = NULL; + ss_ptr = NULL; + ss_comp_name = NULL; + ss_comp_ptr = NULL; + ss_comp_number = 0; + ss_in = FALSE; + surface_comp = NULL; + surface_charge = NULL; + related_moles = 0; + potential_unknown = NULL; + potential_unknown1 = NULL; + potential_unknown2 = NULL; + // list for CD_MUSIC of comps that contribute to 0 plane mass-balance term + comp_unknowns.clear(); + phase_unknown = NULL; + mass_water = 1; + dissolve_only = FALSE; + inert_moles = 0; + V_m = 0; + pressure = 1; + mb_number = 0; + iteration = 0; + } + int type; + LDBLE moles; + LDBLE ln_moles; + LDBLE f; + LDBLE sum; + LDBLE delta; + LDBLE la; + size_t number; + const char* description; + std::vector master; + class phase* phase; + LDBLE si; + int n_gas_phase_user; + class species* s; + const char* exch_comp; + const char* pp_assemblage_comp_name; + void* pp_assemblage_comp_ptr; + const char* ss_name; + void* ss_ptr; + const char* ss_comp_name; + void* ss_comp_ptr; + int ss_comp_number; int ss_in = FALSE; - const char *surface_comp = NULL; - const char *surface_charge = NULL; - LDBLE related_moles = 0; - struct unknown *potential_unknown = NULL, *potential_unknown1 = NULL, - *potential_unknown2 = NULL; - std::vector comp_unknowns; /* list for CD_MUSIC of comps that contribute to 0 plane mass-balance term */ - struct unknown *phase_unknown = NULL; - LDBLE mass_water = 1; + const char* surface_comp; + const char* surface_charge; + LDBLE related_moles; + class unknown* potential_unknown; + class unknown* potential_unknown1; + class unknown* potential_unknown2; + std::vector comp_unknowns; + class unknown* phase_unknown; + LDBLE mass_water; int dissolve_only = FALSE; - LDBLE inert_moles = 0; - LDBLE V_m = 0; - LDBLE pressure = 1; - int mb_number = 0; - int iteration = 0; + LDBLE inert_moles; + LDBLE V_m; + LDBLE pressure; + int mb_number; + int iteration; }; - /*---------------------------------------------------------------------- * Reaction work space *---------------------------------------------------------------------- */ -struct reaction_temp +class reaction_temp { - LDBLE logk[MAX_LOG_K_INDICES] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - LDBLE dz[3] = { 0,0,0 }; - std::vector token; +public: + ~reaction_temp() {}; + reaction_temp::reaction_temp() + { + for (size_t i = 0; i < MAX_LOG_K_INDICES; i++) logk[i] = 0; + for (size_t i = 0; i < 3; i++) dz[i] = 0; + token.clear(); + } + LDBLE logk[MAX_LOG_K_INDICES]; + LDBLE dz[3]; + std::vector token; }; -struct rxn_token_temp -{ /* data for equations, aq. species or minerals */ - const char *name = NULL; /* pointer to a species name (formula) */ - LDBLE z = 0; /* charge on species */ - struct species *s = NULL; - struct unknown *unknown = NULL; - LDBLE coef = 0; /* coefficient of species name */ -}; -struct unknown_list +class rxn_token_temp { - struct unknown *unknown = NULL; - LDBLE *source = NULL; - LDBLE *gamma_source = NULL; - /* int row; */ - /* int col; */ +public: + ~rxn_token_temp() {}; + rxn_token_temp::rxn_token_temp() + { // data for equations, aq. species or minerals + name = NULL; // pointer to a species name (formula) + LDBLE z = 0; // charge on species + s = NULL; + unknown = NULL; + coef = 0; // coefficient of species name + } + const char* name; + LDBLE z = 0; + class species* s; + class unknown* unknown; LDBLE coef = 0; }; +class unknown_list +{ +public: + ~unknown_list() {}; + unknown_list::unknown_list() + { + unknown = NULL; + source = NULL; + gamma_source = NULL; + coef = 0; + } + class unknown* unknown; + LDBLE* source; + LDBLE* gamma_source; + LDBLE coef; +}; /* ---------------------------------------------------------------------- * Print * ---------------------------------------------------------------------- */ -struct prints +class prints { - int all = 0; - int initial_solutions = 0; - int initial_exchangers = 0; - int reactions = 0; - int gas_phase = 0; - int ss_assemblage = 0; - int pp_assemblage = 0; - int surface = 0; - int exchange = 0; - int kinetics = 0; - int totals = 0; - int eh = 0; - int species = 0; - int saturation_indices = 0; - int irrev = 0; - int mix = 0; - int reaction = 0; - int use = 0; - int logfile = 0; - int punch = 0; - int status = 0; - int inverse = 0; - int dump = 0; - int user_print = 0; - int headings = 0; - int user_graph = 0; - int echo_input = 0; - int warnings = 0; - int initial_isotopes = 0; - int isotope_ratios = 0; - int isotope_alphas = 0; - int hdf = 0; - int alkalinity = 0; +public: + ~prints() {}; + prints::prints() + { + all = 0; + initial_solutions = 0; + initial_exchangers = 0; + reactions = 0; + gas_phase = 0; + ss_assemblage = 0; + pp_assemblage = 0; + surface = 0; + exchange = 0; + kinetics = 0; + totals = 0; + eh = 0; + species = 0; + saturation_indices = 0; + irrev = 0; + mix = 0; + reaction = 0; + use = 0; + logfile = 0; + punch = 0; + status = 0; + inverse = 0; + dump = 0; + user_print = 0; + headings = 0; + user_graph = 0; + echo_input = 0; + warnings = 0; + initial_isotopes = 0; + isotope_ratios = 0; + isotope_alphas = 0; + hdf = 0; + alkalinity = 0; + } + int all; + int initial_solutions; + int initial_exchangers; + int reactions; + int gas_phase; + int ss_assemblage; + int pp_assemblage; + int surface; + int exchange; + int kinetics; + int totals; + int eh; + int species; + int saturation_indices; + int irrev; + int mix; + int reaction; + int use; + int logfile; + int punch; + int status; + int inverse; + int dump; + int user_print; + int headings; + int user_graph; + int echo_input; + int warnings; + int initial_isotopes; + int isotope_ratios; + int isotope_alphas; + int hdf; + int alkalinity; }; /* ---------------------------------------------------------------------- * RATES * ---------------------------------------------------------------------- */ -struct rate +class rate { - const char *name = NULL; +public: + ~rate() {}; + rate::rate() + { + name = NULL; + //std::string commands; + new_def = 0; + linebase = NULL; + varbase = NULL; + loopbase = NULL; + } + const char* name = NULL; std::string commands; - int new_def = 0; - void *linebase = NULL; - void *varbase = NULL; - void *loopbase = NULL; + int new_def; + void* linebase; + void* varbase; + void* loopbase; }; /* ---------------------------------------------------------------------- * GLOBAL DECLARATIONS * ---------------------------------------------------------------------- */ -struct spread_row +class spread_row { - int count = 0; - int empty = 0, string = 0, number = 0; +public: + ~spread_row() {}; + spread_row::spread_row() + { + count = 0; + empty = 0, string = 0, number = 0; + char_vector.clear(); + d_vector.clear(); + type_vector.clear(); + } + int count; + int empty, string, number; std::vector char_vector; std::vector d_vector; std::vector type_vector; }; -struct defaults +class defaults { - LDBLE temp = 0; - LDBLE density = 0; - bool calc_density = 0; - const char *units = NULL; - const char *redox = NULL; - LDBLE ph = 7; - LDBLE pe = 4; - LDBLE water = 1; - std::vector iso; - LDBLE pressure = 1; /* pressure in atm */ +public: + ~defaults() {}; + defaults::defaults() + { + temp = 25; + density = 1; + calc_density = false; + units = NULL; + redox = NULL; + ph = 7; + pe = 4; + water = 1; + iso.clear(); + pressure = 1; /* pressure in atm */ + } + LDBLE temp; + LDBLE density; + bool calc_density; + const char* units; + const char* redox; + LDBLE ph; + LDBLE pe; + LDBLE water; + std::vector iso; + LDBLE pressure; }; -struct spread_sheet +class spread_sheet { - struct spread_row *heading = NULL; - struct spread_row *units = NULL; +public: + ~spread_sheet() {}; + spread_sheet::spread_sheet() + { + heading = NULL; + units = NULL; + count_rows = 0; + rows = NULL; + //class defaults defaults; + } + class spread_row* heading; + class spread_row* units; int count_rows = 0; - struct spread_row **rows = NULL; - struct defaults defaults; + class spread_row** rows; + class defaults defaults; }; /* ---------------------------------------------------------------------- * ISOTOPES * ---------------------------------------------------------------------- */ -struct master_isotope +class master_isotope { - const char *name = NULL; - struct master *master = NULL; - struct element *elt = NULL; - const char *units = NULL; - LDBLE standard = 0; - LDBLE ratio = 0; - LDBLE moles = 0; - int total_is_major = 0; - int minor_isotope = 0; +public: + ~master_isotope() {}; + master_isotope::master_isotope() + { + name = NULL; + master = NULL; + elt = NULL; + units = NULL; + standard = 0; + ratio = 0; + moles = 0; + total_is_major = 0; + minor_isotope = 0; + } + const char* name; + class master* master; + class element* elt; + const char* units; + LDBLE standard; + LDBLE ratio; + LDBLE moles; + int total_is_major; + int minor_isotope; }; -struct calculate_value +class calculate_value { - const char *name = NULL; - LDBLE value = 0; +public: + ~calculate_value() {}; + calculate_value::calculate_value() + { + name = NULL; + value = 0; + commands.clear(); + new_def = 0; + calculated = 0; + linebase = NULL; + varbase = NULL; + loopbase = NULL; + } + const char* name; + LDBLE value; std::string commands; - int new_def = 0; - int calculated = 0; - void *linebase = NULL; - void *varbase = NULL; - void *loopbase = NULL; + int new_def; + int calculated; + void* linebase; + void* varbase; + void* loopbase; }; -struct isotope_ratio +class isotope_ratio { - const char *name = NULL; - const char *isotope_name = NULL; - LDBLE ratio = 0; - LDBLE converted_ratio = 0; -}; -struct isotope_alpha -{ - const char *name = NULL; - const char *named_logk = NULL; - LDBLE value = 0; -}; -struct system_species -{ - char *name = NULL; - char *type = NULL; - LDBLE moles = 0; -}; +public: + isotope_ratio::isotope_ratio() + { + name = NULL; + isotope_name = NULL; + ratio = 0; + converted_ratio = 0; + } + ~isotope_ratio() {}; -/* tally.c ------------------------------- */ -struct tally_buffer -{ - const char *name = NULL; - struct master *master = NULL; - LDBLE moles = 0; - LDBLE gfw = 0; + const char* name; + const char* isotope_name; + LDBLE ratio; + LDBLE converted_ratio; }; -struct tally +class isotope_alpha { - const char *name = NULL; - enum entity_type type = UnKnown; - const char *add_formula = NULL; - LDBLE moles = 0; - std::vector formula; +public: + isotope_alpha::isotope_alpha() + { + name = NULL; + named_logk = NULL; + value = 0; + } + ~isotope_alpha() {}; + const char* name; + const char* named_logk; + LDBLE value; +}; +class system_species +{ +public: + ~system_species() {}; + system_species::system_species() + { + name = NULL; + type = NULL; + moles = 0; + } + char* name; + char* type; + LDBLE moles; +}; +/* tally.c ------------------------------- */ +class tally_buffer +{ +public: + ~tally_buffer() {}; + tally_buffer::tally_buffer() + { + name = NULL; + master = NULL; + moles = 0; + gfw = 0; + } + const char* name; + class master* master; + LDBLE moles; + LDBLE gfw; +}; +class tally +{ +public: + ~tally() {}; + tally::tally() + { + name = NULL; + type = UnKnown; + add_formula = NULL; + moles = 0; + formula.clear(); + /* + * first total is initial + * second total is final + * third total is difference (final - initial) + */ + //class tally_buffer* total[3]; + } + const char* name; + enum entity_type type; + const char* add_formula; + LDBLE moles; + std::vector formula; /* * first total is initial * second total is final * third total is difference (final - initial) */ - struct tally_buffer* total[3] = { NULL, NULL, NULL }; + class tally_buffer* total[3]; +}; +/* transport.c ------------------------------- */ +class spec +{ +public: + ~spec() {}; + spec::spec() + { + // name of species + name = NULL; + // name of aqueous species in EX species + aq_name = NULL; + // type: AQ or EX + type = 0; + // activity + a = 0; + // log(concentration) + lm = 0; + // log(gamma) + lg = 0; + // concentration for AQ, equivalent fraction for EX + c = 0; + // charge number + z = 0; + // temperature corrected free water diffusion coefficient, m2/s + Dwt = 0; + // temperature factor for Dw + dw_t = 0; + // enrichment factor in ddl + erm_ddl = 0; + } + const char* name; + const char* aq_name; + int type; + LDBLE a; + LDBLE lm; + LDBLE lg; + LDBLE c; + LDBLE z; + LDBLE Dwt; + LDBLE dw_t; + LDBLE erm_ddl; }; -/* transport.c ------------------------------- */ -struct spec +class sol_D { - // name of species - const char *name = NULL; - // name of aqueous species in EX species - const char *aq_name = NULL; - // type: AQ or EX - int type = 0; - // activity - LDBLE a = 0; - // log(concentration) - LDBLE lm = 0; - // log(gamma) - LDBLE lg = 0; - // concentration for AQ, equivalent fraction for EX - LDBLE c = 0; - // charge number - LDBLE z = 0; - // temperature corrected free water diffusion coefficient, m2/s - LDBLE Dwt = 0; - // temperature factor for Dw - LDBLE dw_t = 0; - // enrichment factor in ddl - LDBLE erm_ddl = 0; +public: + ~sol_D() {}; + sol_D::sol_D() + { + // number of aqueous + exchange species + count_spec = 0; + // number of exchange species + count_exch_spec = 0; + // total moles of X-, max X- in transport step in sol_D[1], tk + exch_total = 0, x_max = 0, tk_x = 0; + // (tk_x * viscos_0_25) / (298 * viscos) + viscos_f = 0; + spec = NULL; + spec_size = 0; + } + int count_spec; + int count_exch_spec; + LDBLE exch_total, x_max, tk_x; + LDBLE viscos_f; + class spec* spec; + int spec_size; }; -struct sol_D +class J_ij { - // number of aqueous + exchange species - int count_spec = 0; - // number of exchange species - int count_exch_spec = 0; - // total moles of X-, max X- in transport step in sol_D[1], tk - LDBLE exch_total = 0, x_max = 0, tk_x = 0; - // (tk_x * viscos_0_25) / (298 * viscos) - LDBLE viscos_f = 0; - struct spec *spec = NULL; - int spec_size = 0; +public: + ~J_ij() {}; + J_ij::J_ij() + { + name = NULL; + // species change in cells i and j + tot1 = 0; + tot2 = 0; + tot_stag = 0; + charge = 0; + } + const char* name = NULL; + LDBLE tot1, tot2, tot_stag, charge; }; -struct J_ij +class M_S { - const char *name = NULL; - // species change in cells i and j - LDBLE tot1 = 0, tot2 = 0, tot_stag = 0, charge = 0; -}; -struct M_S -{ - const char *name = NULL; - // master species transport in cells i and j - LDBLE tot1 = 0, tot2 = 0, tot_stag = 0, charge = 0; +public: + ~M_S() {}; + M_S::M_S() + { + name = NULL; + // master species transport in cells i and j + tot1 = 0; + tot2 = 0; + tot_stag = 0; + charge = 0; + } + const char* name; + LDBLE tot1, tot2, tot_stag, charge; }; // Pitzer definitions typedef enum @@ -951,16 +1560,30 @@ typedef enum TYPE_PSI, TYPE_ETHETA, TYPE_ALPHAS, TYPE_MU, TYPE_ETA, TYPE_Other, TYPE_SIT_EPSILON, TYPE_SIT_EPSILON_MU, TYPE_APHI } pitz_param_type; - -struct pitz_param +class pitz_param { - const char* species[3] = { NULL,NULL,NULL }; - int ispec[3] = { -1,-1,-1 }; - pitz_param_type type = TYPE_Other; +public: + ~pitz_param() {}; + pitz_param::pitz_param() + { + for(size_t i = 0; i < 3; i++) species[i] = NULL; + for (size_t i = 0; i < 3; i++) ispec[i] = -1; + type = TYPE_Other; + p = 0; + U.b0 = 0; + for (size_t i = 0; i < 6; i++) a[i] = 0; + alpha = 0; + os_coef = 0; + for (size_t i = 0; i < 3; i++) ln_coef[i] = 0; + thetas = NULL; + } + const char* species[3]; + int ispec[3]; + pitz_param_type type; LDBLE p = 0; union { - LDBLE b0 = 0; + LDBLE b0; LDBLE b1; LDBLE b2; LDBLE c0; @@ -975,27 +1598,47 @@ struct pitz_param LDBLE eps1; LDBLE aphi; } U; - LDBLE a[6] = { 0,0,0,0,0,0 }; - LDBLE alpha = 0; - LDBLE os_coef = 0; - LDBLE ln_coef[3] = { 0,0,0 }; - struct theta_param *thetas = NULL; + LDBLE a[6]; + LDBLE alpha; + LDBLE os_coef; + LDBLE ln_coef[3]; + class theta_param* thetas; }; - -struct theta_param +class theta_param { - LDBLE zj = 0; - LDBLE zk = 0; - LDBLE etheta = 0; - LDBLE ethetap = 0; +public: + ~theta_param() {}; + theta_param::theta_param() + { + zj = 0; + zk = 0; + etheta = 0; + ethetap = 0; + } + LDBLE zj; + LDBLE zk; + LDBLE etheta; + LDBLE ethetap; }; - -struct const_iso +class const_iso { - const char *name = NULL; - LDBLE value = 0; - LDBLE uncertainty = 0; +public: + ~const_iso() {}; + const_iso::const_iso() + { + name = NULL; + value = 0; + uncertainty = 0; + } + const_iso::const_iso(const char *n, LDBLE v, LDBLE u) + { + name = n; + value = v; + uncertainty = u; + } + const char* name; + LDBLE value; + LDBLE uncertainty; }; -#endif /* _INC_GLOBAL_STRUCTURES_H */ - +#endif /* _INC_GLOBAL_STRUCTURES_H */ \ No newline at end of file diff --git a/inverse.cpp b/inverse.cpp index e22c0f7b..0042ab93 100644 --- a/inverse.cpp +++ b/inverse.cpp @@ -125,7 +125,7 @@ inverse_models(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -setup_inverse(struct inverse *inv_ptr) +setup_inverse(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -139,10 +139,10 @@ setup_inverse(struct inverse *inv_ptr) LDBLE isotope_number; LDBLE f, coef, cb, conc; char token[MAX_LENGTH]; - struct phase *phase_ptr; + class phase *phase_ptr; cxxSolution *solution_ptr; CReaction *rxn_ptr; - struct master *master_ptr; + class master *master_ptr; /* * Determine array sizes, row and column positions */ @@ -866,7 +866,7 @@ setup_inverse(struct inverse *inv_ptr) std::map < std::string, cxxSolutionIsotope >::iterator kit = solution_ptr->Get_isotopes().begin(); for ( ; kit != solution_ptr->Get_isotopes().end(); kit++) { - struct master *master_kit = master_bsearch(kit->second.Get_elt_name().c_str()); + class master *master_kit = master_bsearch(kit->second.Get_elt_name().c_str()); if (master_kit == master_ptr && kit->second.Get_isotope_number() == isotope_number) @@ -988,7 +988,7 @@ setup_inverse(struct inverse *inv_ptr) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -solve_inverse(struct inverse *inv_ptr) +solve_inverse(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -1253,7 +1253,7 @@ solve_inverse(struct inverse *inv_ptr) /* ---------------------------------------------------------------------- */ unsigned long Phreeqc:: -minimal_solve(struct inverse *inv_ptr, unsigned long minimal_bits) +minimal_solve(class inverse *inv_ptr, unsigned long minimal_bits) /* ---------------------------------------------------------------------- */ { /* @@ -1329,7 +1329,7 @@ minimal_solve(struct inverse *inv_ptr, unsigned long minimal_bits) /* ---------------------------------------------------------------------- */ int Phreeqc:: -solve_with_mask(struct inverse *inv_ptr, unsigned long cur_bits) +solve_with_mask(class inverse *inv_ptr, unsigned long cur_bits) /* ---------------------------------------------------------------------- */ { /* @@ -1629,7 +1629,7 @@ bit_print(unsigned long bits, int l) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -print_model(struct inverse *inv_ptr) +print_model(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -1639,7 +1639,7 @@ print_model(struct inverse *inv_ptr) size_t column; int print_msg; cxxSolution *solution_ptr; - struct master *master_ptr; + class master *master_ptr; LDBLE d1, d2, d3, d4; char token[MAX_LENGTH]; /* @@ -1819,7 +1819,7 @@ print_model(struct inverse *inv_ptr) equal(min_delta[j], 0.0, toler) == TRUE && equal(max_delta[j], 0.0, toler) == TRUE) continue; - std::vector& isotope_ref = inv_ptr->phases[i].isotopes; + std::vector& isotope_ref = inv_ptr->phases[i].isotopes; for (size_t j = 0; j < inv_ptr->isotopes.size(); j++) { for (size_t k = 0; k < inv_ptr->phases[i].isotopes.size(); k++) @@ -1907,7 +1907,7 @@ print_model(struct inverse *inv_ptr) // appt, calculate and print SI's LDBLE t_i, p_i, iap, lk, t; const char *name; - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; CReaction *reaction_ptr; output_msg(sformatf( "\n%-25.25s %2s %12.12s %12.12s %-18.18s (Approximate SI in solution ", @@ -2018,7 +2018,7 @@ print_model(struct inverse *inv_ptr) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -punch_model_heading(struct inverse *inv_ptr) +punch_model_heading(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -2095,7 +2095,7 @@ punch_model_heading(struct inverse *inv_ptr) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -punch_model(struct inverse *inv_ptr) +punch_model(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -2228,7 +2228,7 @@ set_bit(unsigned long bits, int position, int value) /* ---------------------------------------------------------------------- */ int Phreeqc:: -next_set_phases(struct inverse *inv_ptr, +next_set_phases(class inverse *inv_ptr, int first_of_model_size, int model_size) /* ---------------------------------------------------------------------- */ { @@ -2295,7 +2295,7 @@ next_set_phases(struct inverse *inv_ptr, /* ---------------------------------------------------------------------- */ int Phreeqc:: -range(struct inverse *inv_ptr, unsigned long cur_bits) +range(class inverse *inv_ptr, unsigned long cur_bits) /* ---------------------------------------------------------------------- */ { /* @@ -2489,7 +2489,7 @@ range(struct inverse *inv_ptr, unsigned long cur_bits) /* ---------------------------------------------------------------------- */ int Phreeqc:: -shrink(struct inverse *inv_ptr, LDBLE * array_in, LDBLE * array_out, +shrink(class inverse *inv_ptr, LDBLE * array_in, LDBLE * array_out, int *k, int *l, int *m, int *n, unsigned long cur_bits, LDBLE * delta_l, int *col_back_l, int *row_back_l) @@ -2759,7 +2759,7 @@ shrink(struct inverse *inv_ptr, LDBLE * array_in, LDBLE * array_out, /* ---------------------------------------------------------------------- */ int Phreeqc:: -check_solns(struct inverse *inv_ptr) +check_solns(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -3097,7 +3097,7 @@ test_cl1_solution(void) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -carbon_derivs(struct inverse *inv_ptr) +carbon_derivs(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { int i, j, temp; @@ -3199,7 +3199,7 @@ carbon_derivs(struct inverse *inv_ptr) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -set_ph_c(struct inverse *inv_ptr, +set_ph_c(class inverse *inv_ptr, int i, cxxSolution *solution_ptr_orig, int n_user_new, LDBLE d_carbon, LDBLE ph_factor, LDBLE c_factor) @@ -3238,7 +3238,7 @@ set_ph_c(struct inverse *inv_ptr, } /* ---------------------------------------------------------------------- */ int Phreeqc:: -isotope_balance_equation(struct inverse *inv_ptr, int row, int n) +isotope_balance_equation(class inverse *inv_ptr, int row, int n) /* ---------------------------------------------------------------------- */ /* * routine fills in an isotope balance equation @@ -3251,7 +3251,7 @@ isotope_balance_equation(struct inverse *inv_ptr, int row, int n) LDBLE isotope_number; size_t column; LDBLE f; - struct master *primary_ptr; + class master *primary_ptr; cxxSolution *solution_ptr; /* * Determine primary master species and isotope number for @@ -3300,7 +3300,7 @@ isotope_balance_equation(struct inverse *inv_ptr, int row, int n) std::map < std::string, cxxSolutionIsotope >::iterator jit = solution_ptr->Get_isotopes().begin(); for ( ; jit != solution_ptr->Get_isotopes().end(); jit++) { - struct master *primary_jit = master_bsearch_primary(jit->second.Get_elt_name().c_str()); + class master *primary_jit = master_bsearch_primary(jit->second.Get_elt_name().c_str()); if (primary_jit == primary_ptr && jit->second.Get_isotope_number() == isotope_number) { @@ -3317,8 +3317,8 @@ isotope_balance_equation(struct inverse *inv_ptr, int row, int n) if (primary_ptr == s_hplus->primary || primary_ptr == s_h2o->primary) continue; - struct master *master_jit = master_bsearch(jit->second.Get_elt_name().c_str()); - struct master *primary_jit = master_bsearch_primary(jit->second.Get_elt_name().c_str()); + class master *master_jit = master_bsearch(jit->second.Get_elt_name().c_str()); + class master *primary_jit = master_bsearch_primary(jit->second.Get_elt_name().c_str()); if (primary_jit == primary_ptr && jit->second.Get_isotope_number() == isotope_number) { @@ -3338,8 +3338,8 @@ isotope_balance_equation(struct inverse *inv_ptr, int row, int n) jit = solution_ptr->Get_isotopes().begin(); for ( ; jit != solution_ptr->Get_isotopes().end(); jit++) { - struct master *master_jit = master_bsearch(jit->second.Get_elt_name().c_str()); - struct master *primary_jit = master_bsearch_primary(jit->second.Get_elt_name().c_str()); + class master *master_jit = master_bsearch(jit->second.Get_elt_name().c_str()); + class master *primary_jit = master_bsearch_primary(jit->second.Get_elt_name().c_str()); if (primary_jit == primary_ptr && jit->second.Get_isotope_number() == isotope_number) { @@ -3369,7 +3369,7 @@ isotope_balance_equation(struct inverse *inv_ptr, int row, int n) { if (inv_ptr->phases[i].isotopes.size() == 0) continue; - std::vector& isotope_ref = inv_ptr->phases[i].isotopes; + std::vector& isotope_ref = inv_ptr->phases[i].isotopes; for (j = 0; j < inv_ptr->phases[i].isotopes.size(); j++) { if (isotope_ref[j].primary == primary_ptr && @@ -3391,7 +3391,7 @@ isotope_balance_equation(struct inverse *inv_ptr, int row, int n) } /* ---------------------------------------------------------------------- */ bool Phreeqc:: -set_isotope_unknowns(struct inverse* inv_ptr) +set_isotope_unknowns(class inverse* inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -3401,9 +3401,9 @@ set_isotope_unknowns(struct inverse* inv_ptr) */ int i, k; LDBLE isotope_number; - struct master* primary_ptr; + class master* primary_ptr; size_t count_isotopes; - std::vector& isotopes = inv_ptr->isotope_unknowns; + std::vector& isotopes = inv_ptr->isotope_unknowns; if (inv_ptr->isotopes.size() == 0) { @@ -3475,7 +3475,7 @@ set_isotope_unknowns(struct inverse* inv_ptr) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -check_isotopes(struct inverse *inv_ptr) +check_isotopes(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -3485,9 +3485,9 @@ check_isotopes(struct inverse *inv_ptr) int i, ii, j, k, l; int err, found_isotope; LDBLE isotope_number; - struct master *master_ptr, *primary_ptr; + class master *master_ptr, *primary_ptr; cxxSolution *solution_ptr; - struct phase *phase_ptr; + class phase *phase_ptr; char token[MAX_LENGTH]; /* @@ -3511,7 +3511,7 @@ check_isotopes(struct inverse *inv_ptr) std::map < std::string, cxxSolutionIsotope >::iterator kit = solution_ptr->Get_isotopes().begin(); for ( ; kit != solution_ptr->Get_isotopes().end(); kit++) { - struct master *primary_kit = master_bsearch_primary(kit->second.Get_elt_name().c_str()); + class master *primary_kit = master_bsearch_primary(kit->second.Get_elt_name().c_str()); if (primary_kit == primary_ptr && kit->second.Get_isotope_number() == isotope_number) @@ -3550,8 +3550,8 @@ check_isotopes(struct inverse *inv_ptr) std::map < std::string, cxxSolutionIsotope >::iterator kit = solution_ptr->Get_isotopes().begin(); for ( ; kit != solution_ptr->Get_isotopes().end(); kit++) { - struct master *master_kit = master_bsearch(kit->second.Get_elt_name().c_str()); - struct master *primary_kit = master_bsearch_primary(kit->second.Get_elt_name().c_str()); + class master *master_kit = master_bsearch(kit->second.Get_elt_name().c_str()); + class master *primary_kit = master_bsearch_primary(kit->second.Get_elt_name().c_str()); kit->second.Set_x_ratio_uncertainty(NAN); /* * Search for secondary or primary master in inverse uncertainties @@ -3703,7 +3703,7 @@ check_isotopes(struct inverse *inv_ptr) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -phase_isotope_inequalities(struct inverse *inv_ptr) +phase_isotope_inequalities(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { size_t column; @@ -3810,7 +3810,7 @@ phase_isotope_inequalities(struct inverse *inv_ptr) /* ---------------------------------------------------------------------- */ int Phreeqc:: -write_optimize_names(struct inverse *inv_ptr) +write_optimize_names(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { int i, j, row; @@ -3882,7 +3882,7 @@ write_optimize_names(struct inverse *inv_ptr) /* ---------------------------------------------------------------------- */ void Phreeqc:: -dump_netpath(struct inverse *inverse_ptr) +dump_netpath(class inverse *inverse_ptr) /* ---------------------------------------------------------------------- */ { std::string string; @@ -4224,7 +4224,7 @@ print_total_multi(FILE * l_netpath_file, cxxSolution *solution_ptr, } /* ---------------------------------------------------------------------- */ int Phreeqc:: -dump_netpath_pat(struct inverse *inv_ptr) +dump_netpath_pat(class inverse *inv_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -4232,7 +4232,7 @@ dump_netpath_pat(struct inverse *inv_ptr) */ int i, j, k; cxxSolution *solution_ptr, *solution_ptr_orig; - struct master *master_ptr; + class master *master_ptr; LDBLE d1, d2, d3; LDBLE sum, sum1, sum_iso, d; std::vector array_save, l_delta_save; @@ -4241,11 +4241,11 @@ dump_netpath_pat(struct inverse *inv_ptr) int temp, temp_punch; int solnmap[10][2]; FILE *model_file; - const struct elt_list *next_elt; + const class elt_list *next_elt; int exch; size_t column; LDBLE f; - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; /* * print solution data, epsilons, and revised data */ @@ -4932,7 +4932,7 @@ dump_netpath_pat(struct inverse *inv_ptr) for (k = 0; k < inv_ptr->phases[i].isotopes.size(); k++) { - std::vector& isotope_ref = inv_ptr->phases[i].isotopes; + std::vector& isotope_ref = inv_ptr->phases[i].isotopes; d1 = isotope_ref[k].ratio; for (j = 0; j < inv_ptr->isotopes.size(); j++) { diff --git a/isotopes.cpp b/isotopes.cpp index 93aa551e..58f54b6a 100644 --- a/isotopes.cpp +++ b/isotopes.cpp @@ -23,9 +23,9 @@ read_isotopes(void) */ int l; - struct master_isotope *master_isotope_ptr; + class master_isotope *master_isotope_ptr; char token[MAX_LENGTH]; - struct element *elt_ptr; + class element *elt_ptr; int return_value, opt, opt_save; const char* next_char; @@ -163,7 +163,7 @@ read_calculate_values(void) int l; int return_value, opt, opt_save; char token[MAX_LENGTH]; - struct calculate_value *calculate_value_ptr; + class calculate_value *calculate_value_ptr; const char* next_char; const char *opt_list[] = { "start", /* 0 */ @@ -270,7 +270,7 @@ read_isotope_ratios(void) int l; int return_value, opt, opt_save; char token[MAX_LENGTH]; - struct isotope_ratio *isotope_ratio_ptr; + class isotope_ratio *isotope_ratio_ptr; const char* next_char; const char *opt_list[] = { "no_options" /* 0 */ @@ -360,7 +360,7 @@ read_isotope_alphas(void) int l; int return_value, opt, opt_save; char token[MAX_LENGTH]; - struct isotope_alpha *isotope_alpha_ptr; + class isotope_alpha *isotope_alpha_ptr; const char* next_char; const char *opt_list[] = { "no_options" /* 0 */ @@ -428,7 +428,7 @@ add_isotopes(cxxSolution &solution_ref) /* ---------------------------------------------------------------------- */ { int i; - struct master_isotope *master_isotope_ptr; + class master_isotope *master_isotope_ptr; LDBLE total_moles; /* * zero out isotopes @@ -481,14 +481,14 @@ add_isotopes(cxxSolution &solution_ref) /* ---------------------------------------------------------------------- */ int Phreeqc:: -calculate_isotope_moles(struct element *elt_ptr, +calculate_isotope_moles(class element *elt_ptr, cxxSolution *solution_ptr, LDBLE total_moles) /* ---------------------------------------------------------------------- */ { int i, j, l_iter; int count_isotopes, total_is_major; - struct master_isotope *master_isotope_ptr, *master_isotope_ptr1; - struct master_isotope list[MAX_ELTS]; + class master_isotope *master_isotope_ptr, *master_isotope_ptr1; + class master_isotope list[MAX_ELTS]; LDBLE m_major, tot; /* * Get total concentration of elt_ptr @@ -511,7 +511,7 @@ calculate_isotope_moles(struct element *elt_ptr, if ((master_isotope_ptr != NULL) && (master_isotope_ptr->elt == elt_ptr)) { memcpy(&(list[count_isotopes]), master_isotope_ptr, - sizeof(struct master_isotope)); + sizeof(class master_isotope)); list[count_isotopes].ratio = 1.0; if (list[count_isotopes].minor_isotope == FALSE) { @@ -523,7 +523,7 @@ calculate_isotope_moles(struct element *elt_ptr, if ((master_isotope_ptr != NULL) && (master_isotope_ptr->elt == elt_ptr)) { memcpy(&(list[count_isotopes]), master_isotope_ptr, - sizeof(struct master_isotope)); + sizeof(class master_isotope)); list[count_isotopes].ratio = 1.0; if (list[count_isotopes].minor_isotope == FALSE) { @@ -542,7 +542,7 @@ calculate_isotope_moles(struct element *elt_ptr, if (master_isotope_ptr->elt != elt_ptr) continue; memcpy(&(list[count_isotopes]), master_isotope_ptr, - sizeof(struct master_isotope)); + sizeof(class master_isotope)); if (list[count_isotopes].minor_isotope == FALSE) { total_is_major = list[count_isotopes].total_is_major; @@ -624,7 +624,7 @@ calculate_isotope_moles(struct element *elt_ptr, if (list[i].name == master_isotope[j]->name) { memcpy(master_isotope[j], &(list[i]), - sizeof(struct master_isotope)); + sizeof(class master_isotope)); } } } @@ -658,7 +658,7 @@ calculate_isotope_moles(struct element *elt_ptr, /* ---------------------------------------------------------------------- */ int Phreeqc:: -from_permil(struct master_isotope *master_isotope_ptr, LDBLE major_total) +from_permil(class master_isotope *master_isotope_ptr, LDBLE major_total) /* ---------------------------------------------------------------------- */ { LDBLE r; @@ -671,7 +671,7 @@ from_permil(struct master_isotope *master_isotope_ptr, LDBLE major_total) /* ---------------------------------------------------------------------- */ int Phreeqc:: -from_pct(struct master_isotope *master_isotope_ptr, LDBLE total_moles) +from_pct(class master_isotope *master_isotope_ptr, LDBLE total_moles) /* ---------------------------------------------------------------------- */ { master_isotope_ptr->moles = @@ -682,7 +682,7 @@ from_pct(struct master_isotope *master_isotope_ptr, LDBLE total_moles) /* ---------------------------------------------------------------------- */ int Phreeqc:: -from_tu(struct master_isotope *master_isotope_ptr) +from_tu(class master_isotope *master_isotope_ptr) /* ---------------------------------------------------------------------- */ { master_isotope_ptr->moles = @@ -693,7 +693,7 @@ from_tu(struct master_isotope *master_isotope_ptr) /* ---------------------------------------------------------------------- */ int Phreeqc:: -from_pcil(struct master_isotope *master_isotope_ptr) +from_pcil(class master_isotope *master_isotope_ptr) /* ---------------------------------------------------------------------- */ { master_isotope_ptr->moles = @@ -782,8 +782,8 @@ punch_isotopes(void) */ //int i; LDBLE iso; - struct isotope_ratio *isotope_ratio_ptr; - struct master_isotope *master_isotope_ptr; + class isotope_ratio *isotope_ratio_ptr; + class master_isotope *master_isotope_ptr; //if (punch.in == FALSE || punch.isotopes == FALSE) // return (OK); @@ -842,7 +842,7 @@ punch_calculate_values(void) */ //int i; LDBLE result; - struct calculate_value *calculate_value_ptr; + class calculate_value *calculate_value_ptr; char l_command[] = "run"; if (current_selected_output->Get_calculate_values().size() == 0) @@ -933,8 +933,8 @@ print_isotope_ratios(void) */ int i, j; int print_isotope; - struct master *master_ptr; - struct master_isotope *master_isotope_ptr; + class master *master_ptr; + class master_isotope *master_isotope_ptr; char token[MAX_LENGTH]; @@ -996,7 +996,7 @@ print_isotope_alphas(void) */ int i, j; int print_isotope; - struct master *master_ptr; + class master *master_ptr; char token[MAX_LENGTH]; LDBLE log_alpha; @@ -1073,10 +1073,10 @@ calculate_values(void) /* ---------------------------------------------------------------------- */ { int j; - struct calculate_value *calculate_value_ptr; - struct isotope_ratio *isotope_ratio_ptr; - struct isotope_alpha *isotope_alpha_ptr; - struct master_isotope *master_isotope_ptr; + class calculate_value *calculate_value_ptr; + class isotope_ratio *isotope_ratio_ptr; + class isotope_alpha *isotope_alpha_ptr; + class master_isotope *master_isotope_ptr; char l_command[] = "run"; @@ -1219,7 +1219,7 @@ calculate_values(void) } /* ---------------------------------------------------------------------- */ LDBLE Phreeqc:: -convert_isotope(struct master_isotope * master_isotope_ptr, LDBLE ratio) +convert_isotope(class master_isotope * master_isotope_ptr, LDBLE ratio) /* ---------------------------------------------------------------------- */ { const char *units; @@ -1256,7 +1256,7 @@ convert_isotope(struct master_isotope * master_isotope_ptr, LDBLE ratio) */ /* ---------------------------------------------------------------------- */ -struct master_isotope * Phreeqc:: +class master_isotope * Phreeqc:: master_isotope_store(const char *name, int replace_if_found) /* ---------------------------------------------------------------------- */ { @@ -1281,11 +1281,11 @@ master_isotope_store(const char *name, int replace_if_found) * pointer to master_isotope structure "master_isotope" where "name" can be found. */ int n; - struct master_isotope *master_isotope_ptr; + class master_isotope *master_isotope_ptr; /* * Search list */ - std::map::iterator mi_it = + std::map::iterator mi_it = master_isotope_map.find(name); if (mi_it != master_isotope_map.end() && replace_if_found == FALSE) { @@ -1315,7 +1315,7 @@ master_isotope_store(const char *name, int replace_if_found) } /* ---------------------------------------------------------------------- */ -struct master_isotope * Phreeqc:: +class master_isotope * Phreeqc:: master_isotope_alloc(void) /* ---------------------------------------------------------------------- */ /* @@ -1324,7 +1324,7 @@ master_isotope_alloc(void) * return: pointer to a master_isotope structure */ { - struct master_isotope *master_isotope_ptr = new struct master_isotope; + class master_isotope *master_isotope_ptr = new class master_isotope; /* * set pointers in structure to NULL, variables to zero */ @@ -1335,7 +1335,7 @@ master_isotope_alloc(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -master_isotope_init(struct master_isotope *master_isotope_ptr) +master_isotope_init(class master_isotope *master_isotope_ptr) /* ---------------------------------------------------------------------- */ /* * return: pointer to a master_isotope structure @@ -1361,7 +1361,7 @@ master_isotope_init(struct master_isotope *master_isotope_ptr) } /* ---------------------------------------------------------------------- */ -struct master_isotope * Phreeqc:: +class master_isotope * Phreeqc:: master_isotope_search(const char *name) /* ---------------------------------------------------------------------- */ { @@ -1375,11 +1375,11 @@ master_isotope_search(const char *name) * pointer to master_isotope structure "master_isotope" where "name" can be found. * or NULL if not found. */ - struct master_isotope* master_isotope_ptr = NULL; + class master_isotope* master_isotope_ptr = NULL; /* * Search list */ - std::map::iterator mi_it = + std::map::iterator mi_it = master_isotope_map.find(name); if (mi_it != master_isotope_map.end()) { @@ -1394,7 +1394,7 @@ master_isotope_search(const char *name) */ /* ---------------------------------------------------------------------- */ -struct calculate_value * Phreeqc:: +class calculate_value * Phreeqc:: calculate_value_store(const char *name_in, int replace_if_found) /* ---------------------------------------------------------------------- */ { @@ -1418,13 +1418,13 @@ calculate_value_store(const char *name_in, int replace_if_found) * Returns: * pointer to calculate_value structure "calculate_value" where "name" can be found. */ - struct calculate_value *calculate_value_ptr=NULL; + class calculate_value *calculate_value_ptr=NULL; /* * Search list */ std::string name = name_in; str_tolower(name); - std::map::iterator cv_it = + std::map::iterator cv_it = calculate_value_map.find(name); if (cv_it != calculate_value_map.end() && replace_if_found == FALSE) { @@ -1455,7 +1455,7 @@ calculate_value_store(const char *name_in, int replace_if_found) } /* ---------------------------------------------------------------------- */ -struct calculate_value * Phreeqc:: +class calculate_value * Phreeqc:: calculate_value_alloc(void) /* ---------------------------------------------------------------------- */ /* @@ -1464,8 +1464,8 @@ calculate_value_alloc(void) * return: pointer to a calculate_value structure */ { - struct calculate_value *calculate_value_ptr = - new struct calculate_value; + class calculate_value *calculate_value_ptr = + new class calculate_value; /* * set pointers in structure to NULL, variables to zero */ @@ -1476,7 +1476,7 @@ calculate_value_alloc(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -calculate_value_init(struct calculate_value *calculate_value_ptr) +calculate_value_init(class calculate_value *calculate_value_ptr) /* ---------------------------------------------------------------------- */ /* * return: pointer to a calculate_value structure @@ -1501,7 +1501,7 @@ calculate_value_init(struct calculate_value *calculate_value_ptr) } /* ---------------------------------------------------------------------- */ -struct calculate_value * Phreeqc:: +class calculate_value * Phreeqc:: calculate_value_search(const char *name_in) /* ---------------------------------------------------------------------- */ { @@ -1517,7 +1517,7 @@ calculate_value_search(const char *name_in) */ std::string name = name_in; str_tolower(name); - std::map::iterator cv_it = + std::map::iterator cv_it = calculate_value_map.find(name); if (cv_it != calculate_value_map.end()) { @@ -1528,7 +1528,7 @@ calculate_value_search(const char *name_in) /* ---------------------------------------------------------------------- */ int Phreeqc:: -calculate_value_free(struct calculate_value *calculate_value_ptr) +calculate_value_free(class calculate_value *calculate_value_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -1554,7 +1554,7 @@ calculate_value_free(struct calculate_value *calculate_value_ptr) */ /* ---------------------------------------------------------------------- */ -struct isotope_ratio * Phreeqc:: +class isotope_ratio * Phreeqc:: isotope_ratio_store(const char *name_in, int replace_if_found) /* ---------------------------------------------------------------------- */ { @@ -1578,13 +1578,13 @@ isotope_ratio_store(const char *name_in, int replace_if_found) * Returns: * pointer to isotope_ratio structure "isotope_ratio" where "name" can be found. */ - struct isotope_ratio *isotope_ratio_ptr; + class isotope_ratio *isotope_ratio_ptr; /* * Search list */ std::string name = name_in; str_tolower(name); - std::map::iterator it = + std::map::iterator it = isotope_ratio_map.find(name); if (it != isotope_ratio_map.end() && replace_if_found == FALSE) @@ -1615,7 +1615,7 @@ isotope_ratio_store(const char *name_in, int replace_if_found) } /* ---------------------------------------------------------------------- */ -struct isotope_ratio * Phreeqc:: +class isotope_ratio * Phreeqc:: isotope_ratio_alloc(void) /* ---------------------------------------------------------------------- */ /* @@ -1624,8 +1624,8 @@ isotope_ratio_alloc(void) * return: pointer to a isotope_ratio structure */ { - struct isotope_ratio* isotope_ratio_ptr = - new struct isotope_ratio; + class isotope_ratio* isotope_ratio_ptr = + new class isotope_ratio; /* * set pointers in structure to NULL, variables to zero */ @@ -1636,7 +1636,7 @@ isotope_ratio_alloc(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -isotope_ratio_init(struct isotope_ratio *isotope_ratio_ptr) +isotope_ratio_init(class isotope_ratio *isotope_ratio_ptr) /* ---------------------------------------------------------------------- */ /* * return: pointer to a isotope_ratio structure @@ -1657,7 +1657,7 @@ isotope_ratio_init(struct isotope_ratio *isotope_ratio_ptr) } /* ---------------------------------------------------------------------- */ -struct isotope_ratio * Phreeqc:: +class isotope_ratio * Phreeqc:: isotope_ratio_search(const char *name_in) /* ---------------------------------------------------------------------- */ { @@ -1673,7 +1673,7 @@ isotope_ratio_search(const char *name_in) */ std::string name = name_in; str_tolower(name); - std::map::iterator it = + std::map::iterator it = isotope_ratio_map.find(name); if (it != isotope_ratio_map.end()) @@ -1688,7 +1688,7 @@ isotope_ratio_search(const char *name_in) */ /* ---------------------------------------------------------------------- */ -struct isotope_alpha * Phreeqc:: +class isotope_alpha * Phreeqc:: isotope_alpha_store(const char *name_in, int replace_if_found) /* ---------------------------------------------------------------------- */ { @@ -1712,10 +1712,10 @@ isotope_alpha_store(const char *name_in, int replace_if_found) * Returns: * pointer to isotope_alpha structure "isotope_alpha" where "name" can be found. */ - struct isotope_alpha *isotope_alpha_ptr; + class isotope_alpha *isotope_alpha_ptr; std::string name = name_in; str_tolower(name); - std::map::iterator it = + std::map::iterator it = isotope_alpha_map.find(name); if (it != isotope_alpha_map.end() && replace_if_found == FALSE) @@ -1745,7 +1745,7 @@ isotope_alpha_store(const char *name_in, int replace_if_found) } /* ---------------------------------------------------------------------- */ -struct isotope_alpha * Phreeqc:: +class isotope_alpha * Phreeqc:: isotope_alpha_alloc(void) /* ---------------------------------------------------------------------- */ /* @@ -1754,8 +1754,8 @@ isotope_alpha_alloc(void) * return: pointer to a isotope_alpha structure */ { - struct isotope_alpha* isotope_alpha_ptr = - new struct isotope_alpha; + class isotope_alpha* isotope_alpha_ptr = + new class isotope_alpha; /* * set pointers in structure to NULL, variables to zero */ @@ -1766,7 +1766,7 @@ isotope_alpha_alloc(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -isotope_alpha_init(struct isotope_alpha *isotope_alpha_ptr) +isotope_alpha_init(class isotope_alpha *isotope_alpha_ptr) /* ---------------------------------------------------------------------- */ /* * return: pointer to a isotope_alpha structure @@ -1786,7 +1786,7 @@ isotope_alpha_init(struct isotope_alpha *isotope_alpha_ptr) } /* ---------------------------------------------------------------------- */ -struct isotope_alpha * Phreeqc:: +class isotope_alpha * Phreeqc:: isotope_alpha_search(const char *name_in) /* ---------------------------------------------------------------------- */ { @@ -1802,7 +1802,7 @@ isotope_alpha_search(const char *name_in) */ std::string name = name_in; str_tolower(name); - std::map::iterator it = + std::map::iterator it = isotope_alpha_map.find(name); if (it != isotope_alpha_map.end()) diff --git a/kinetics.cpp b/kinetics.cpp index 5f604fcb..19ed0206 100644 --- a/kinetics.cpp +++ b/kinetics.cpp @@ -53,7 +53,7 @@ calc_kinetic_reaction(cxxKinetics *kinetics_ptr, LDBLE time_step) int j, return_value; LDBLE coef; char l_command[] = "run"; - struct rate *rate_ptr; + class rate *rate_ptr; /* * Go through list and generate list of elements and * coefficient of elements in reaction @@ -145,8 +145,8 @@ calc_final_kinetic_reaction(cxxKinetics *kinetics_ptr) * stored in moles in run_kinetics */ LDBLE coef; - struct phase *phase_ptr; - struct master *master_ptr; + class phase *phase_ptr; + class master *master_ptr; int count= 0; /* * Go through list and generate list of elements and diff --git a/mainsubs.cpp b/mainsubs.cpp index b2af77d9..d7e86ddf 100644 --- a/mainsubs.cpp +++ b/mainsubs.cpp @@ -39,7 +39,7 @@ initialize(void) // one stag_data in phreeqc.h, initialized in global_structures // user_print - user_print = new struct rate; + user_print = new class rate; user_print->name = string_hsave("User_print"); user_print->commands.clear(); user_print->linebase = NULL; @@ -556,8 +556,8 @@ initial_gas_phases(int print) int converge, converge1; int last, n_user, print1; char token[2 * MAX_LENGTH]; - struct phase *phase_ptr; - struct rxn_token *rxn_ptr; + class phase *phase_ptr; + class rxn_token *rxn_ptr; LDBLE lp; bool PR = false; @@ -759,7 +759,7 @@ reactions(void) */ int count_steps, use_mix; char token[2 * MAX_LENGTH]; - struct save save_data; + class save save_data; LDBLE kin_time; cxxKinetics *kinetics_ptr; @@ -803,7 +803,7 @@ reactions(void) /* * save data for saving solutions */ - memcpy(&save_data, &save, sizeof(struct save)); + memcpy(&save_data, &save, sizeof(class save)); /* *Copy everything to -2 */ @@ -866,7 +866,7 @@ reactions(void) /* * save end of reaction */ - memcpy(&save, &save_data, sizeof(struct save)); + memcpy(&save, &save_data, sizeof(class save)); if (use.Get_kinetics_in() == TRUE) { Utilities::Rxn_copy(Rxn_kinetics_map, -2, use.Get_n_kinetics_user()); @@ -890,7 +890,7 @@ reactions(void) // { // cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); // int k; -// struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE); +// class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE); // assert(phase_ptr); // phase_ptr->pr_in = false; // } @@ -1106,7 +1106,7 @@ xgas_save(int n_user) { cxxGasComp* gc_ptr = &(temp_gas_phase.Get_gas_comps()[i]); int k; - struct phase* phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE); + class phase* phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE); assert(phase_ptr); if (PR) { @@ -1224,7 +1224,7 @@ xsolution_save(int n_user) * * input: n_user is user solution number of target */ - struct master *master_i_ptr, *master_ptr; + class master *master_i_ptr, *master_ptr; /* * Malloc space for solution data */ @@ -1341,7 +1341,7 @@ xsolution_save(int n_user) std::map< std::string, cxxSolutionIsotope >::iterator it; for (it = temp_solution.Get_isotopes().begin(); it != temp_solution.Get_isotopes().end(); it++) { - struct master *iso_master_ptr = master_bsearch(it->second.Get_elt_name().c_str()); + class master *iso_master_ptr = master_bsearch(it->second.Get_elt_name().c_str()); if (iso_master_ptr != NULL) { it->second.Set_total(iso_master_ptr->total); diff --git a/model.cpp b/model.cpp index 7918ae43..6f5145e6 100644 --- a/model.cpp +++ b/model.cpp @@ -869,7 +869,7 @@ int Phreeqc::gammas_a_f(int i1) LDBLE d2, d3, sum = 0; //char name[MAX_LENGTH]; std::string name; - //struct master *m_ptr; + //class master *m_ptr; i = i1; for (j = 1; s_x[i]->rxn_x.token[j].s != NULL; j++) @@ -2171,7 +2171,7 @@ mb_ss(void) LDBLE iapc, iapb, l_kc, l_kb, lc, lb, xcaq, xbaq, xb, xc; LDBLE sigmapi_aq, sigmapi_solid; LDBLE total_p; - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; /* * Determines whether solid solution equation is needed */ @@ -2186,7 +2186,7 @@ mb_ss(void) for (size_t j = 0; j < ss_ptr->Get_ss_comps().size(); j++) { int l; - struct phase *phase_ptr = phase_bsearch(ss_ptr->Get_ss_comps()[j].Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(ss_ptr->Get_ss_comps()[j].Get_name().c_str(), &l, FALSE); if (phase_ptr->in == FALSE) { continue; @@ -2202,8 +2202,8 @@ mb_ss(void) else if (ss_ptr->Get_a0() != 0.0 || ss_ptr->Get_a1() != 0.0) { int l; - struct phase *phase0_ptr = phase_bsearch(ss_ptr->Get_ss_comps()[0].Get_name().c_str(), &l, FALSE); - struct phase *phase1_ptr = phase_bsearch(ss_ptr->Get_ss_comps()[1].Get_name().c_str(), &l, FALSE); + class phase *phase0_ptr = phase_bsearch(ss_ptr->Get_ss_comps()[0].Get_name().c_str(), &l, FALSE); + class phase *phase1_ptr = phase_bsearch(ss_ptr->Get_ss_comps()[1].Get_name().c_str(), &l, FALSE); /* * Calculate IAPc and IAPb */ @@ -2285,7 +2285,7 @@ mb_ss(void) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[j]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); if (phase_ptr->in == TRUE) { lp = -phase_ptr->lk; @@ -2332,7 +2332,7 @@ molalities(int allow_overflow) */ int i, j; LDBLE total_g; - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; /* * la for master species */ @@ -2413,7 +2413,7 @@ molalities(int allow_overflow) calc_all_donnan(); } - struct species *s_ptr = NULL; + class species *s_ptr = NULL; for (i = 0; i < (int)this->s_x.size(); i++) { s_ptr = s_x[i]; @@ -2537,8 +2537,8 @@ calc_gas_pressures(void) { int n_g = 0; LDBLE lp, V_m = 0; - struct rxn_token *rxn_ptr; - std::vector phase_ptrs; + class rxn_token *rxn_ptr; + std::vector phase_ptrs; bool PR = false, pr_done = false; /* * moles and partial pressures for gases @@ -2562,7 +2562,7 @@ calc_gas_pressures(void) { const cxxGasComp * gas_comp_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int j; - struct phase *phase_ptr = phase_bsearch(gas_comp_ptr->Get_phase_name().c_str(), &j, FALSE); + class phase *phase_ptr = phase_bsearch(gas_comp_ptr->Get_phase_name().c_str(), &j, FALSE); if (phase_ptr->in == TRUE) { phase_ptrs.push_back(phase_ptr); @@ -2631,7 +2631,7 @@ calc_gas_pressures(void) { const cxxGasComp *gas_comp = &(gas_phase_ptr->Get_gas_comps()[i]); int j; - struct phase *phase_ptr = phase_bsearch(gas_comp->Get_phase_name().c_str(), &j, FALSE); + class phase *phase_ptr = phase_bsearch(gas_comp->Get_phase_name().c_str(), &j, FALSE); if (phase_ptr->in == TRUE) { lp = -phase_ptr->lk; @@ -2693,7 +2693,7 @@ calc_gas_pressures(void) { const cxxGasComp *gas_comp = &(gas_phase_ptr->Get_gas_comps()[i]); int j; - struct phase *phase_ptr = phase_bsearch(gas_comp->Get_phase_name().c_str(), &j, FALSE); + class phase *phase_ptr = phase_bsearch(gas_comp->Get_phase_name().c_str(), &j, FALSE); if (phase_ptr->in == TRUE) { phase_ptr->moles_x *= MAX_P_NONLLNL / gas_phase_ptr->Get_total_p(); @@ -2744,7 +2744,7 @@ calc_ss_fractions(void) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[k]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); moles = comp_ptr->Get_moles(); if (moles < 0) { @@ -2789,8 +2789,8 @@ ss_binary(cxxSS *ss_ptr) cxxSScomp *comp0_ptr = &(ss_ptr->Get_ss_comps()[0]); cxxSScomp *comp1_ptr = &(ss_ptr->Get_ss_comps()[1]); int l; - struct phase *phase0_ptr = phase_bsearch(comp0_ptr->Get_name().c_str(), &l, FALSE); - struct phase *phase1_ptr = phase_bsearch(comp1_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase0_ptr = phase_bsearch(comp0_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase1_ptr = phase_bsearch(comp1_ptr->Get_name().c_str(), &l, FALSE); nc = comp0_ptr->Get_moles(); xc = nc / n_tot; @@ -2920,7 +2920,7 @@ ss_ideal(cxxSS *ss_ptr) { cxxSScomp *compk_ptr = &(ss_ptr->Get_ss_comps()[k]); int l; - struct phase *phasek_ptr = phase_bsearch(compk_ptr->Get_name().c_str(), &l, FALSE); + class phase *phasek_ptr = phase_bsearch(compk_ptr->Get_name().c_str(), &l, FALSE); n_tot1 = 0; for (size_t j = 0; j < ss_ptr->Get_ss_comps().size(); j++) { @@ -3774,7 +3774,7 @@ residuals(void) LDBLE sum_residual; LDBLE sinh_constant; LDBLE sum, sum1; - struct master *master_ptr, *master_ptr1, *master_ptr2; + class master *master_ptr, *master_ptr1, *master_ptr2; LDBLE sigmaddl, negfpsirt; int print_fail; std::vector cd_psi; @@ -4877,7 +4877,7 @@ sum_species(void) * Sums total valence states and stores in master[i]->total. */ int i; - struct master *master_ptr; + class master *master_ptr; /* * Set global variables */ diff --git a/parse.cpp b/parse.cpp index 2ec53683..0430c528 100644 --- a/parse.cpp +++ b/parse.cpp @@ -3,7 +3,7 @@ /* ---------------------------------------------------------------------- */ int Phreeqc:: -parse_eq(char* eqn, std::vector& new_elt_list, int association) +parse_eq(char* eqn, std::vector& new_elt_list, int association) /* ---------------------------------------------------------------------- */ /* * function to break equation up into component species diff --git a/pitzer.cpp b/pitzer.cpp index a8cc1d5e..6ac2d5c6 100644 --- a/pitzer.cpp +++ b/pitzer.cpp @@ -46,8 +46,8 @@ pitzer_tidy(void) int i0, i1, i2; int count_pos, count_neg, count_neut, count[3], jj; LDBLE z0, z1; - struct pitz_param *pzp_ptr; - struct theta_param *theta_param_ptr; + class pitz_param *pzp_ptr; + class theta_param *theta_param_ptr; /* * Ensure new parameters are calculated */ @@ -310,7 +310,7 @@ pitzer_tidy(void) { size_t count_theta_param = theta_params.size(); theta_params.resize(count_theta_param + 1); - theta_params[count_theta_param] = new struct theta_param; + theta_params[count_theta_param] = new class theta_param; theta_params[count_theta_param]->zj = z0; theta_params[count_theta_param]->zk = z1; theta_param_ptr = theta_params[count_theta_param]; @@ -564,7 +564,7 @@ read_pitzer(void) * number of shifts; */ int n; - struct pitz_param *pzp_ptr; + class pitz_param *pzp_ptr; pitz_param_type pzp_type; int return_value, opt, opt_save; @@ -773,7 +773,7 @@ C /* ---------------------------------------------------------------------- */ int Phreeqc:: -calc_pitz_param(struct pitz_param *pz_ptr, LDBLE TK, LDBLE TR) +calc_pitz_param(class pitz_param *pz_ptr, LDBLE TK, LDBLE TR) /* ---------------------------------------------------------------------- */ { LDBLE param; diff --git a/pitzer_structures.cpp b/pitzer_structures.cpp index 0d5c6a2f..141ca49f 100644 --- a/pitzer_structures.cpp +++ b/pitzer_structures.cpp @@ -11,7 +11,7 @@ * ********************************************************************** */ /* ---------------------------------------------------------------------- */ -struct pitz_param * Phreeqc:: +class pitz_param * Phreeqc:: pitz_param_read(char *string, int n) /* ---------------------------------------------------------------------- */ { @@ -23,7 +23,7 @@ pitz_param_read(char *string, int n) int l, i, j, k; const char* cptr; char token[2 * MAX_LENGTH]; - struct pitz_param pzp, *pzp_ptr; + class pitz_param pzp, *pzp_ptr; if (n != 2 && n != 3 && n != 0) return (NULL); @@ -60,13 +60,13 @@ pitz_param_read(char *string, int n) } if (k <= 0) return (NULL); - pzp_ptr = new struct pitz_param; + pzp_ptr = new class pitz_param; *pzp_ptr = pzp; return (pzp_ptr); } /* ---------------------------------------------------------------------- */ void Phreeqc:: -pitz_param_store(const struct pitz_param *pzp_ptr) +pitz_param_store(const class pitz_param *pzp_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -78,7 +78,7 @@ pitz_param_store(const struct pitz_param *pzp_ptr) return; if (pzp_ptr->type == TYPE_Other) return; - struct pitz_param* dest = pitz_param_copy(pzp_ptr); + class pitz_param* dest = pitz_param_copy(pzp_ptr); std::set< std::string > header; for (i = 0; i < 3; i++) { @@ -121,7 +121,7 @@ pitz_param_store(const struct pitz_param *pzp_ptr) /* ---------------------------------------------------------------------- */ void Phreeqc:: -sit_param_store(const struct pitz_param *pzp_ptr) +sit_param_store(const class pitz_param *pzp_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -133,7 +133,7 @@ sit_param_store(const struct pitz_param *pzp_ptr) return; if (pzp_ptr->type == TYPE_Other) return; - struct pitz_param* dest = pitz_param_copy(pzp_ptr); + class pitz_param* dest = pitz_param_copy(pzp_ptr); std::set< std::string > header; for (i = 0; i < 3; i++) @@ -175,11 +175,11 @@ sit_param_store(const struct pitz_param *pzp_ptr) sit_param_map[key] = count_sit_param; } } -struct pitz_param* Phreeqc:: -pitz_param_copy(const struct pitz_param* src) +class pitz_param* Phreeqc:: +pitz_param_copy(const class pitz_param* src) { if (src == NULL) return NULL; - struct pitz_param* dest = new struct pitz_param; + class pitz_param* dest = new class pitz_param; *dest = *src; for (size_t i = 0; i < 3; i++) { @@ -198,7 +198,7 @@ pitz_param_copy(const struct pitz_param* src) * * ********************************************************************** */ /* ---------------------------------------------------------------------- */ -struct theta_param * Phreeqc:: +class theta_param * Phreeqc:: theta_param_search(LDBLE zj, LDBLE zk) /* ---------------------------------------------------------------------- */ { diff --git a/prep.cpp b/prep.cpp index a1477f15..897f5115 100644 --- a/prep.cpp +++ b/prep.cpp @@ -19,7 +19,7 @@ prep(void) * Input is model defined by the structure use. * Most of routine is skipped if model, as defined by master.total * plus use.pure_phases, is same as previous calculation. - * Routine sets up struct unknown for each unknown. + * Routine sets up class unknown for each unknown. * Determines elements, species, and phases that are in the model. * Calculates mass-action equations for each species and phase. * Routine builds a set of lists for calculating mass balance and @@ -322,8 +322,8 @@ quick_setup(void) cxxNameDouble::iterator lit; for (lit = comp_ptr->Get_totals().begin(); lit != comp_ptr->Get_totals().end(); lit++) { - struct element *elt_ptr = element_store(lit->first.c_str()); - struct master *master_ptr = elt_ptr->master; + class element *elt_ptr = element_store(lit->first.c_str()); + class master *master_ptr = elt_ptr->master; if (master_ptr->type != SURF) continue; if (strcmp_nocase(x[i]->description, lit->first.c_str()) == 0) @@ -355,9 +355,9 @@ build_gas_phase(void) * mass balance equations for elements contained in gases */ size_t row, col; - struct master *master_ptr; - struct rxn_token *rxn_ptr; - struct unknown *unknown_ptr; + class master *master_ptr; + class rxn_token *rxn_ptr; + class unknown *unknown_ptr; LDBLE coef, coef_elt; if (gas_unknown == NULL) @@ -373,7 +373,7 @@ build_gas_phase(void) { cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int k; - struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); assert(phase_ptr); /* * Determine elements in gas component @@ -631,8 +631,8 @@ build_ss_assemblage(void) */ bool stop; size_t row, col; - struct master *master_ptr; - struct rxn_token *rxn_ptr; + class master *master_ptr; + class rxn_token *rxn_ptr; const char* cptr; if (ss_unknown == NULL) @@ -1315,7 +1315,7 @@ build_model(void) * Sort species list, by master only */ if (species_list.size() > 1) qsort(&species_list[0], species_list.size(), - sizeof(struct species_list), species_list_compare_master); + sizeof(class species_list), species_list_compare_master); /* * Save model description */ @@ -1339,8 +1339,8 @@ build_pure_phases(void) bool stop; std::string token; const char* cptr; - struct master *master_ptr; - struct rxn_token *rxn_ptr; + class master *master_ptr; + class rxn_token *rxn_ptr; /* * Build into sums the logic to calculate inverse saturation indices for * pure phases @@ -1516,8 +1516,8 @@ build_solution_phase_boundaries(void) /* ---------------------------------------------------------------------- */ { int i; - struct master *master_ptr; - struct rxn_token *rxn_ptr; + class master *master_ptr; + class rxn_token *rxn_ptr; /* * Build into sums the logic to calculate inverse saturation indices for * solution phase boundaries @@ -1590,7 +1590,7 @@ build_species_list(int n) * printing results. */ int j; - struct master *master_ptr; + class master *master_ptr; /* * Treat species made only with H+, e-, and H2O specially */ @@ -1779,7 +1779,7 @@ convert_units(cxxSolution *solution_ptr) * Uses totals.input conc to calculate totals.moles. */ LDBLE sum_solutes; - struct master *master_ptr; + class master *master_ptr; std::string token; if (!solution_ptr->Get_new_def() || !solution_ptr->Get_initial_data()) { @@ -1944,8 +1944,8 @@ convert_units(cxxSolution *solution_ptr) } /* ---------------------------------------------------------------------- */ -std::vector Phreeqc:: -get_list_master_ptrs(const char* cptr, struct master *master_ptr) +std::vector Phreeqc:: +get_list_master_ptrs(const char* cptr, class master *master_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -1955,8 +1955,8 @@ get_list_master_ptrs(const char* cptr, struct master *master_ptr) */ int j, l, count_list; char token[MAX_LENGTH]; - std::vector master_ptr_list; - struct master *master_ptr0; + std::vector master_ptr_list; + class master *master_ptr0; /* * Make list of master species pointers */ @@ -2029,7 +2029,7 @@ inout(void) /* ---------------------------------------------------------------------- */ { int i; - struct rxn_token_temp *token_ptr; + class rxn_token_temp *token_ptr; /* * Routine goes through trxn to determine if each master species is * in this model. @@ -2059,7 +2059,7 @@ inout(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -is_special(struct species *l_spec) +is_special(class species *l_spec) /* ---------------------------------------------------------------------- */ { /* @@ -2068,7 +2068,7 @@ is_special(struct species *l_spec) * FALSE if not */ int special; - struct rxn_token *token_ptr; + class rxn_token *token_ptr; special = TRUE; for (token_ptr = &l_spec->rxn_s.token[0] + 1; token_ptr->s != NULL; @@ -2086,7 +2086,7 @@ is_special(struct species *l_spec) /* ---------------------------------------------------------------------- */ int Phreeqc:: -store_mb_unknowns(struct unknown *unknown_ptr, LDBLE * LDBLE_ptr, LDBLE coef, +store_mb_unknowns(class unknown *unknown_ptr, LDBLE * LDBLE_ptr, LDBLE coef, LDBLE * gamma_ptr) /* ---------------------------------------------------------------------- */ /* @@ -2121,8 +2121,8 @@ mb_for_species_aq(int n) * mb_unknowns.coef - coefficient of s[n] in equation or relation */ int i, j; - struct master *master_ptr; - struct unknown *unknown_ptr; + class master *master_ptr; + class unknown *unknown_ptr; mb_unknowns.clear(); /* @@ -2286,7 +2286,7 @@ mb_for_species_ex(int n) * mb_unknowns.coef - coefficient of s[n] in equation or relation */ int i; - struct master *master_ptr; + class master *master_ptr; mb_unknowns.clear(); /* @@ -2376,7 +2376,7 @@ mb_for_species_surf(int n) * mb_unknowns.coef - coefficient of s[n] in equation or relation */ int i; - struct master *master_ptr; + class master *master_ptr; mb_unknowns.clear(); /* @@ -2548,7 +2548,7 @@ resetup_master(void) * and special cases for alkalinity, carbon, and pH. */ int i, j; - struct master *master_ptr, *master_ptr0; + class master *master_ptr, *master_ptr0; for (i = 0; i < count_unknowns; i++) { @@ -2676,8 +2676,8 @@ add_potential_factor(void) int i; std::string token; LDBLE sum_z; - struct master *master_ptr; - struct unknown *unknown_ptr; + class master *master_ptr; + class unknown *unknown_ptr; if (use.Get_surface_ptr() == NULL) { @@ -2776,8 +2776,8 @@ add_cd_music_factors(int n) */ int i; std::string token; - struct master *master_ptr; - struct unknown *unknown_ptr; + class master *master_ptr; + class unknown *unknown_ptr; if (use.Get_surface_ptr() == NULL) { input_error++; @@ -2904,8 +2904,8 @@ add_surface_charge_balance(void) const char* cptr; std::string token; - struct master *master_ptr; - struct unknown *unknown_ptr; + class master *master_ptr; + class unknown *unknown_ptr; if (use.Get_surface_ptr() == NULL) { input_error++; @@ -2971,8 +2971,8 @@ add_cd_music_charge_balances(int n) int i; std::string token; - struct master *master_ptr; - struct unknown *unknown_ptr; + class master *master_ptr; + class unknown *unknown_ptr; if (use.Get_surface_ptr() == NULL) { input_error++; @@ -3048,8 +3048,8 @@ add_cd_music_charge_balances(int n) /* ---------------------------------------------------------------------- */ int Phreeqc:: -rewrite_master_to_secondary(struct master *master_ptr1, - struct master *master_ptr2) +rewrite_master_to_secondary(class master *master_ptr1, + class master *master_ptr2) /* ---------------------------------------------------------------------- */ { /* @@ -3057,7 +3057,7 @@ rewrite_master_to_secondary(struct master *master_ptr1, * Store result in rxn_secondary of master_ptr. */ LDBLE coef1, coef2; - struct master *master_ptr_p1, *master_ptr_p2; + class master *master_ptr_p1, *master_ptr_p2; /* * Check that the two master species have the same primary master species */ @@ -3102,8 +3102,8 @@ setup_exchange(void) /* * Fill in data for exchanger in unknowns structures */ - struct master *master_ptr; - std::vector master_ptr_list; + class master *master_ptr; + std::vector master_ptr_list; if (use.Get_exchange_ptr() == NULL) return (OK); @@ -3232,7 +3232,7 @@ setup_ss_assemblage(void) { cxxSScomp *comp_ptr = &(ss_ptrs[j]->Get_ss_comps()[i]); int l; - struct phase* phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase* phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); x[count_unknowns]->type = SS_MOLES; x[count_unknowns]->description = string_hsave(comp_ptr->Get_name().c_str()); x[count_unknowns]->moles = 0.0; @@ -3270,7 +3270,7 @@ setup_surface(void) /* * Fill in data for surface assemblage in unknown structure */ - std::vector master_ptr_list; + std::vector master_ptr_list; size_t mb_unknown_number; if (use.Get_surface_ptr() == NULL) @@ -3285,8 +3285,8 @@ setup_surface(void) cxxNameDouble::iterator jit; for (jit = comp_ptr->Get_totals().begin(); jit != comp_ptr->Get_totals().end(); jit++) { - struct element *elt_ptr = element_store(jit->first.c_str()); - struct master *master_ptr = elt_ptr->master; + class element *elt_ptr = element_store(jit->first.c_str()); + class master *master_ptr = elt_ptr->master; if (master_ptr == NULL) { error_string = sformatf( @@ -3336,7 +3336,7 @@ setup_surface(void) * Setup surface-potential unknown */ std::string token = master_ptr->elt->name; - struct unknown *unknown_ptr = find_surface_charge_unknown(token, SURF_PSI); + class unknown *unknown_ptr = find_surface_charge_unknown(token, SURF_PSI); if (unknown_ptr != NULL) { x[count_unknowns - 1]->potential_unknown = unknown_ptr; @@ -3389,7 +3389,7 @@ setup_surface(void) { std::string cb_suffix("_CB"); std::string psi_suffix("_psi"); - struct unknown **unknown_target; + class unknown **unknown_target; unknown_target = NULL; int type = SURFACE_CB; switch (plane) @@ -3412,7 +3412,7 @@ setup_surface(void) unknown_target = &(x[mb_unknown_number]->potential_unknown2); break; } - struct unknown *unknown_ptr = find_surface_charge_unknown(token, plane); + class unknown *unknown_ptr = find_surface_charge_unknown(token, plane); if (unknown_ptr != NULL) { *unknown_target = unknown_ptr; @@ -3469,7 +3469,7 @@ setup_surface(void) } } /* Add SURFACE unknown to a list for SURF_PSI */ - struct unknown *unknown_ptr = find_surface_charge_unknown(token, SURF_PSI); + class unknown *unknown_ptr = find_surface_charge_unknown(token, SURF_PSI); unknown_ptr->comp_unknowns.push_back(x[mb_unknown_number]); } @@ -3604,7 +3604,7 @@ setup_surface(void) return (OK); } /* ---------------------------------------------------------------------- */ -struct unknown * Phreeqc:: +class unknown * Phreeqc:: find_surface_charge_unknown(std::string &str, int plane) /* ---------------------------------------------------------------------- */ { @@ -3642,14 +3642,14 @@ find_surface_charge_unknown(std::string &str, int plane) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -setup_master_rxn(const std::vector &master_ptr_list, const std::string &pe_rxn) +setup_master_rxn(const std::vector &master_ptr_list, const std::string &pe_rxn) /* ---------------------------------------------------------------------- */ { /* * Rewrites rxn_secondary for all redox states in list * First, in = TRUE; others, in = REWRITE */ - struct master *master_ptr, *master_ptr0; + class master *master_ptr, *master_ptr0; /* * Set master_ptr->in, master_ptr->rxn */ @@ -3707,7 +3707,7 @@ setup_master_rxn(const std::vector &master_ptr_list, const std: } /* ---------------------------------------------------------------------- */ LDBLE Phreeqc:: -calc_PR(std::vector phase_ptrs, LDBLE P, LDBLE TK, LDBLE V_m) +calc_PR(std::vector phase_ptrs, LDBLE P, LDBLE TK, LDBLE V_m) /* ---------------------------------------------------------------------- */ /* Calculate fugacity and fugacity coefficient for gas pressures if critical T and P are defined. @@ -3741,7 +3741,7 @@ calc_PR(std::vector phase_ptrs, LDBLE P, LDBLE TK, LDBLE V_m) LDBLE r3[4], r3_12, rp, rp3, rq, rz, ri, ri1, one_3 = 0.33333333333333333; LDBLE disct, vinit, v1, ddp, dp_dv, dp_dv2; int it; - struct phase *phase_ptr, *phase_ptr1; + class phase *phase_ptr, *phase_ptr1; cxxGasPhase * gas_phase_ptr = use.Get_gas_phase_ptr(); bool halved; R_TK = R * TK; @@ -4045,7 +4045,7 @@ setup_pure_phases(void) { cxxPPassemblageComp * comp_ptr = &(it->second); int j; - struct phase * phase_ptr = phase_bsearch(it->first.c_str(), &j, FALSE); + class phase * phase_ptr = phase_bsearch(it->first.c_str(), &j, FALSE); assert(phase_ptr); x[count_unknowns]->type = PP; x[count_unknowns]->description = string_hsave(comp_ptr->Get_name().c_str()); @@ -4072,7 +4072,7 @@ adjust_setup_pure_phases(void) /* ---------------------------------------------------------------------- */ { int i; - struct phase *phase_ptr; + class phase *phase_ptr; LDBLE si_org, p, t; /* * Fills in data for pure_phase assemglage in unknown structure @@ -4085,7 +4085,7 @@ adjust_setup_pure_phases(void) */ for (i = 0; i < count_unknowns; i++) { - std::vector phase_ptrs; + std::vector phase_ptrs; if (x[i]->type == PP) { phase_ptr = x[i]->phase; @@ -4118,12 +4118,12 @@ setup_solution(void) /* * Fills in data in unknown structure for the solution */ - struct master *master_ptr; + class master *master_ptr; cxxSolution *solution_ptr; const char* cptr; std::string token; - struct master_isotope *master_isotope_ptr; - struct phase *phase_ptr; + class master_isotope *master_isotope_ptr; + class phase *phase_ptr; solution_ptr = use.Get_solution_ptr(); count_unknowns = 0; @@ -4476,12 +4476,12 @@ adjust_setup_solution(void) * Fills in data in unknown structure for the solution */ int i; - struct phase *phase_ptr; + class phase *phase_ptr; LDBLE p, t; for (i = 0; i < count_unknowns; i++) { - std::vector phase_ptrs; + std::vector phase_ptrs; if (x[i]->type == SOLUTION_PHASE_BOUNDARY) { x[count_unknowns]->type = SOLUTION_PHASE_BOUNDARY; @@ -4631,7 +4631,7 @@ setup_unknowns(void) x.resize(max_unknowns); for (i = 0; i < max_unknowns; i++) { - x[i] = (struct unknown *) unknown_alloc(); + x[i] = (class unknown *) unknown_alloc(); x[i]->number = i; } return (OK); @@ -4648,8 +4648,8 @@ store_dn(int k, LDBLE * source, int row, LDBLE coef_in, LDBLE * gamma_source) */ size_t col; LDBLE coef; - struct rxn_token *rxn_ptr; - struct master *master_ptr; + class rxn_token *rxn_ptr; + class master *master_ptr; if (equal(coef_in, 0.0, TOL) == TRUE) { @@ -4833,7 +4833,7 @@ switch_bases(void) int first; int return_value; LDBLE la, la1; - struct master *master_ptr; + class master *master_ptr; return_value = FALSE; for (i = 0; i < count_unknowns; i++) @@ -4889,7 +4889,7 @@ tidy_redox(void) * */ std::string token, tok1, tok2; - struct master *master_ptr1, *master_ptr2; + class master *master_ptr1, *master_ptr2; /* * Keep valences of oxygen and hydrogen in model, if not already in */ @@ -5009,7 +5009,7 @@ write_mb_eqn_x(void) int count, repeat; int i; size_t count_rxn_orig; - struct master *master_ptr; + class master *master_ptr; /* * Rewrite any secondary master species flagged REWRITE * Don`t add in any pe reactions @@ -5527,7 +5527,7 @@ save_model(void) { cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int k; - struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); assert(phase_ptr); last_model.gas_phase[i] = phase_ptr; } @@ -5568,7 +5568,7 @@ save_model(void) for ( ; it != pp_assemblage_ptr->Get_pp_assemblage_comps().end(); it++) { int j; - struct phase * phase_ptr = phase_bsearch(it->first.c_str(), &j, false); + class phase * phase_ptr = phase_bsearch(it->first.c_str(), &j, false); assert(phase_ptr); last_model.pp_assemblage[i] = phase_ptr; last_model.add_formula[i] = string_hsave(it->second.Get_add_formula().c_str()); @@ -5682,7 +5682,7 @@ check_same_model(void) { cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int k; - struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); assert(phase_ptr); if (last_model.gas_phase[i] != phase_ptr) { @@ -5731,7 +5731,7 @@ check_same_model(void) for ( ; it != pp_assemblage_ptr->Get_pp_assemblage_comps().end(); it++) { int j; - struct phase * phase_ptr = phase_bsearch(it->first.c_str(), &j, FALSE); + class phase * phase_ptr = phase_bsearch(it->first.c_str(), &j, FALSE); assert(phase_ptr); if (last_model.pp_assemblage[i] != phase_ptr) { @@ -5833,8 +5833,8 @@ build_min_exch(void) */ int j, k, jj; size_t row; - struct master *master_ptr; - struct unknown *unknown_ptr; + class master *master_ptr; + class unknown *unknown_ptr; LDBLE coef; if (use.Get_exchange_ptr() == NULL) @@ -5861,7 +5861,7 @@ build_min_exch(void) // Find exchange master cxxNameDouble nd(comp_ref.Get_totals()); cxxNameDouble::iterator it = nd.begin(); - struct master *exchange_master = NULL; + class master *exchange_master = NULL; for ( ; it != nd.end(); it++) { element * elt_ptr = element_store(it->first.c_str()); @@ -6006,7 +6006,7 @@ build_min_surface(void) cxxSurfaceComp *comp_ptr = &(surface_ptr->Get_surface_comps()[i]); if (comp_ptr->Get_phase_name().size() == 0) continue; - struct element *elt_ptr = element_store(comp_ptr->Get_master_element().c_str()); + class element *elt_ptr = element_store(comp_ptr->Get_master_element().c_str()); /* find unknown number */ int j; for (j = (int)count_unknowns - 1; j >= 0; j--) @@ -6059,7 +6059,7 @@ build_min_surface(void) #endif for (int jj = 0; jj < count_elts; jj++) { - struct master * master_ptr = elt_list[jj].elt->primary; + class master * master_ptr = elt_list[jj].elt->primary; if (master_ptr->in == FALSE) { master_ptr = master_ptr->s->secondary; @@ -6095,7 +6095,7 @@ build_min_surface(void) } LDBLE coef = elt_list[jj].coef; size_t row; - struct unknown *unknown_ptr; + class unknown *unknown_ptr; if (master_ptr->s == s_hplus) { row = mass_hydrogen_unknown->number; diff --git a/print.cpp b/print.cpp index a86b7ec1..be7be47c 100644 --- a/print.cpp +++ b/print.cpp @@ -67,7 +67,7 @@ set_pr_in_false(void) { cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int k; - struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE); if (phase_ptr) phase_ptr->pr_in = false; } @@ -357,7 +357,7 @@ print_eh(void) */ int i, j, k, first; LDBLE pe, eh; - struct master *master_ptr0, *master_ptr1; + class master *master_ptr0, *master_ptr1; char token[MAX_LENGTH]; if (pr.eh == FALSE || pr.all == FALSE) @@ -436,7 +436,7 @@ print_exchange(void) int i; cxxExchange * exchange_ptr; const char *name, *name1; - struct master *master_ptr; + class master *master_ptr; LDBLE dum, dum2; /* * Print exchange data @@ -562,7 +562,7 @@ print_gas_phase(void) * Prints gas phase composition if present */ LDBLE lp, moles, initial_moles, delta_moles; - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; char info[MAX_LENGTH]; bool PR = false; @@ -643,7 +643,7 @@ print_gas_phase(void) */ cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[j]); int k; - struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE); if (phase_ptr->in == TRUE) { lp = -phase_ptr->lk; @@ -876,7 +876,7 @@ print_reaction(void) cit = reaction_ptr->Get_elementList().begin(); for ( ; cit != reaction_ptr->Get_elementList().end(); cit++) { - struct element * elt_ptr = element_store(cit->first.c_str()); + class element * elt_ptr = element_store(cit->first.c_str()); assert(elt_ptr); output_msg(sformatf("\t%-15s%13.5f\n", elt_ptr->name, @@ -1067,7 +1067,7 @@ print_master_reactions(void) * Debugging print routine to test primary and secondary reactions */ int i; - struct rxn_token *next_token; + class rxn_token *next_token; for (i = 0; i < (int)master.size(); i++) { @@ -1177,7 +1177,7 @@ print_saturation_indices(void) LDBLE si, iap; LDBLE lk; LDBLE la_eminus; - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; CReaction *reaction_ptr; bool gas = true; @@ -1295,8 +1295,8 @@ print_pp_assemblage(void) int j, k; LDBLE si, iap, lk; char token[MAX_LENGTH]; - struct rxn_token *rxn_ptr; - struct phase *phase_ptr; + class rxn_token *rxn_ptr; + class phase *phase_ptr; if (pr.pp_assemblage == FALSE || pr.all == FALSE) return (OK); @@ -1413,7 +1413,7 @@ print_species(void) */ int i; const char *name, *name1; - struct master *master_ptr; + class master *master_ptr; LDBLE min; LDBLE lm; @@ -1538,7 +1538,7 @@ print_surface(void) */ cxxSurface *surface_ptr; std::string name, token; - struct master *master_ptr; + class master *master_ptr; LDBLE molfrac, charge; /* * Print surface speciation @@ -1829,8 +1829,8 @@ print_surface_cd_music(void) */ cxxSurface *surface_ptr; std::string name; - struct master *master_ptr, *master_ptr0, *master_ptr1, *master_ptr2; - struct unknown *unknown_ptr0, *unknown_ptr1, *unknown_ptr2; + class master *master_ptr, *master_ptr0, *master_ptr1, *master_ptr2; + class unknown *unknown_ptr0, *unknown_ptr1, *unknown_ptr2; LDBLE molfrac, charge0, charge1, charge2, sum; /* * Print surface speciation @@ -2574,7 +2574,7 @@ punch_gas_phase(void) { cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[j]); int k; - struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); if (phase_ptr != current_selected_output->Get_gases()[i].second) continue; moles = phase_ptr->moles_x; @@ -2684,19 +2684,19 @@ punch_totals(void) { molality = 0.0; } - else if (((struct master *) current_selected_output->Get_totals()[j].second)->primary == TRUE) + else if (((class master *) current_selected_output->Get_totals()[j].second)->primary == TRUE) { if (strncmp(current_selected_output->Get_totals()[j].first.c_str(), "Alkalinity", 20) == 0) { molality = total_alkalinity / mass_water_aq_x; } else { - molality = ((struct master *) current_selected_output->Get_totals()[j].second)->total_primary / mass_water_aq_x; + molality = ((class master *) current_selected_output->Get_totals()[j].second)->total_primary / mass_water_aq_x; } } else { - molality = ((struct master *) current_selected_output->Get_totals()[j].second)->total / mass_water_aq_x; + molality = ((class master *) current_selected_output->Get_totals()[j].second)->total / mass_water_aq_x; } if (!current_selected_output->Get_high_precision()) { @@ -2727,9 +2727,9 @@ punch_molalities(void) { molality = 0.0; if (current_selected_output->Get_molalities()[j].second != NULL - && ((struct species *) current_selected_output->Get_molalities()[j].second)->in == TRUE) + && ((class species *) current_selected_output->Get_molalities()[j].second)->in == TRUE) { - molality = ((struct species *) current_selected_output->Get_molalities()[j].second)->moles / mass_water_aq_x; + molality = ((class species *) current_selected_output->Get_molalities()[j].second)->moles / mass_water_aq_x; } if (!current_selected_output->Get_high_precision()) { @@ -2760,7 +2760,7 @@ punch_activities(void) { la = -999.999; if (current_selected_output->Get_activities()[j].second != NULL - && ((struct species *) current_selected_output->Get_activities()[j].second)->in == TRUE) + && ((class species *) current_selected_output->Get_activities()[j].second)->in == TRUE) { /*la = punch.activities[j].s->lm + punch.activities[j].s->lg; */ la = log_activity(current_selected_output->Get_activities()[j].first.c_str()); @@ -3194,11 +3194,11 @@ punch_saturation_indices(void) */ //int i; LDBLE si, iap; - struct rxn_token *rxn_ptr; + class rxn_token *rxn_ptr; for (size_t i = 0; i < current_selected_output->Get_si().size(); i++) { - if (current_selected_output->Get_si()[i].second == NULL || ((struct phase *) current_selected_output->Get_si()[i].second)->in == FALSE) + if (current_selected_output->Get_si()[i].second == NULL || ((class phase *) current_selected_output->Get_si()[i].second)->in == FALSE) { si = -999.999; } @@ -3208,12 +3208,12 @@ punch_saturation_indices(void) * Print saturation index */ iap = 0.0; - for (rxn_ptr = &(((struct phase *) current_selected_output->Get_si()[i].second)->rxn_x.token[0]) + 1; + for (rxn_ptr = &(((class phase *) current_selected_output->Get_si()[i].second)->rxn_x.token[0]) + 1; rxn_ptr->s != NULL; rxn_ptr++) { iap += rxn_ptr->s->la * rxn_ptr->coef; } - si = -((struct phase *) current_selected_output->Get_si()[i].second)->lk + iap; + si = -((class phase *) current_selected_output->Get_si()[i].second)->lk + iap; } if (!current_selected_output->Get_high_precision()) { @@ -3312,7 +3312,7 @@ punch_user_punch(void) if (current_user_punch == NULL || !current_selected_output->Get_user_punch()) return OK; - struct rate * user_punch = current_user_punch->Get_rate(); + class rate * user_punch = current_user_punch->Get_rate(); if (user_punch->commands.c_str() == 0) return (OK); @@ -3576,7 +3576,7 @@ print_alkalinity(void) * order of aqueous species. */ int j; - std::vector alk_list; + std::vector alk_list; LDBLE min; if (pr.alkalinity == FALSE || pr.all == FALSE) @@ -3603,7 +3603,7 @@ print_alkalinity(void) output_msg(sformatf("\t%-15s%12s%12s%10s\n\n", "Species", "Alkalinity", "Molality", "Alk/Mol")); if (alk_list.size() > 1) qsort(&alk_list[0], alk_list.size(), - (size_t) sizeof(struct species_list), species_list_compare_alk); + (size_t) sizeof(class species_list), species_list_compare_alk); for (size_t i = 0; i < alk_list.size(); i++) { if (fabs(alk_list[i].s->alk * (alk_list[i].s->moles) / diff --git a/read.cpp b/read.cpp index fbf6216c..26c69f2a 100644 --- a/read.cpp +++ b/read.cpp @@ -392,10 +392,10 @@ read_exchange_species(void) int association; char token[MAX_LENGTH]; const char* cptr; - struct phase *phase_ptr; + class phase *phase_ptr; - struct species *s_ptr; - const struct elt_list *next_elt; + class species *s_ptr; + const class elt_list *next_elt; //LDBLE exchange_coef; LDBLE offset; @@ -713,7 +713,7 @@ read_exchange_species(void) */ { s_ptr = NULL; - std::vector new_elt_list; + std::vector new_elt_list; if (parse_eq(line, new_elt_list, association) == ERROR) { parse_error++; @@ -1061,8 +1061,8 @@ read_exchange_master_species(void) int j, l; const char* cptr, *cptr1; LDBLE l_z; - struct element *elts_ptr; - struct species *s_ptr; + class element *elts_ptr; + class species *s_ptr; char token[MAX_LENGTH]; for (;;) { @@ -1578,14 +1578,14 @@ read_inverse(void) { qsort(&inverse[n].isotopes[0], inverse[n].isotopes.size(), - sizeof(struct inv_isotope), inverse_isotope_compare); + sizeof(class inv_isotope), inverse_isotope_compare); } if (inverse[n].i_u.size() > 1) { qsort(&inverse[n].i_u[0], inverse[n].i_u.size(), - (size_t) sizeof(struct inv_isotope), inverse_isotope_compare); + (size_t) sizeof(class inv_isotope), inverse_isotope_compare); } return (return_value); @@ -1593,7 +1593,7 @@ read_inverse(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -read_inv_balances(struct inverse *inverse_ptr, const char* cptr) +read_inv_balances(class inverse *inverse_ptr, const char* cptr) /* ---------------------------------------------------------------------- */ { int j, l; @@ -1633,7 +1633,7 @@ read_inv_balances(struct inverse *inverse_ptr, const char* cptr) /* ---------------------------------------------------------------------- */ int Phreeqc:: -read_inv_isotopes(struct inverse *inverse_ptr, const char* cptr) +read_inv_isotopes(class inverse *inverse_ptr, const char* cptr) /* ---------------------------------------------------------------------- */ { int i, j, l, l1, l2; @@ -1716,7 +1716,7 @@ read_inv_isotopes(struct inverse *inverse_ptr, const char* cptr) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -read_inv_phases(struct inverse *inverse_ptr, const char* cptr) +read_inv_phases(class inverse *inverse_ptr, const char* cptr) /* ---------------------------------------------------------------------- */ { int j, l; @@ -1820,7 +1820,7 @@ read_inv_phases(struct inverse *inverse_ptr, const char* cptr) inverse_ptr->phases[count_phases].isotopes.resize(isotopes.size()); for (size_t i = 0; i < isotopes.size(); i++) { - struct isotope *iso_ptr = &(inverse_ptr->phases[count_phases].isotopes[i]); + class isotope *iso_ptr = &(inverse_ptr->phases[count_phases].isotopes[i]); iso_ptr->isotope_number = isotopes[i].Get_isotope_number(); iso_ptr->elt_name = string_hsave(isotopes[i].Get_elt_name().c_str()); iso_ptr->isotope_name = string_hsave(isotopes[i].Get_isotope_name().c_str()); @@ -2989,8 +2989,8 @@ read_master_species(void) int j, i, l; const char* cptr, *cptr1; LDBLE l_z; - struct element *elts_ptr; - struct species *s_ptr; + class element *elts_ptr; + class species *s_ptr; char token[MAX_LENGTH]; elts_ptr = NULL; @@ -3439,8 +3439,8 @@ read_phases(void) const char* cptr; char token[MAX_LENGTH]; char token1[MAX_LENGTH]; - struct phase *phase_ptr; - struct rxn_token *token_ptr; + class phase *phase_ptr; + class rxn_token *token_ptr; int return_value, opt, opt_save; const char* next_char; @@ -3626,7 +3626,7 @@ read_phases(void) error_msg(line_save, CONTINUE); break; } - std::vector new_elt_list; + std::vector new_elt_list; if (parse_eq(line, new_elt_list, association) == ERROR) { parse_error++; @@ -5109,8 +5109,8 @@ read_species(void) */ int i; int association; - struct species *s_ptr; - const struct elt_list *next_elt; + class species *s_ptr; + const class elt_list *next_elt; const char* cptr; char token[MAX_LENGTH]; //bool vm_read = false; @@ -5494,7 +5494,7 @@ read_species(void) * Get space for species information and parse equation */ s_ptr = NULL; - std::vector new_elt_list; + std::vector new_elt_list; if (parse_eq(line, new_elt_list, association) == ERROR) { parse_error++; @@ -5839,8 +5839,8 @@ read_surface_species(void) const char* cptr; LDBLE offset; - struct species *s_ptr; - const struct elt_list *next_elt; + class species *s_ptr; + const class elt_list *next_elt; int return_value, opt, opt_save; const char* next_char; @@ -6116,7 +6116,7 @@ read_surface_species(void) * Get surface species information and parse equation */ s_ptr = NULL; - std::vector new_elt_list; + std::vector new_elt_list; if (parse_eq(line, new_elt_list, association) == ERROR) { parse_error++; @@ -6802,7 +6802,7 @@ read_surface_master_species(void) int l, return_value; const char* cptr, *cptr1; LDBLE l_z; - struct species *s_ptr; + class species *s_ptr; char token[MAX_LENGTH], token1[MAX_LENGTH]; int opt, opt_save; const char* next_char; @@ -6907,8 +6907,8 @@ int Phreeqc:: add_psi_master_species(char *token) /* ---------------------------------------------------------------------- */ { - struct species *s_ptr; - struct master *master_ptr; + class species *s_ptr; + class master *master_ptr; const char* cptr; char token1[MAX_LENGTH]; int i, n, plane; @@ -8057,7 +8057,7 @@ read_rates(void) int l, n; int return_value, opt, opt_save; char token[MAX_LENGTH]; - struct rate *rate_ptr; + class rate *rate_ptr; const char* next_char; const char *opt_list[] = { "start", /* 0 */ @@ -8273,7 +8273,7 @@ read_user_punch(void) //} // Malloc rate structure - struct rate* r = new struct rate; + class rate* r = new class rate; r->commands.clear(); r->new_def = TRUE; r->linebase = NULL; @@ -9128,7 +9128,7 @@ read_named_logk(void) int l; int i, empty; - struct logk *logk_ptr; + class logk *logk_ptr; char token[MAX_LENGTH]; int return_value, opt, opt_save; diff --git a/sit.cpp b/sit.cpp index 0e89cbde..0c2c430f 100644 --- a/sit.cpp +++ b/sit.cpp @@ -173,7 +173,7 @@ read_sit(void) * number of shifts; */ int n; - struct pitz_param *pzp_ptr; + class pitz_param *pzp_ptr; pitz_param_type pzp_type; int return_value, opt, opt_save; @@ -239,7 +239,7 @@ read_sit(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -calc_sit_param(struct pitz_param *pz_ptr, LDBLE TK, LDBLE TR) +calc_sit_param(class pitz_param *pz_ptr, LDBLE TK, LDBLE TR) /* ---------------------------------------------------------------------- */ { LDBLE param; diff --git a/spread.cpp b/spread.cpp index 6ba237ce..dfd09291 100644 --- a/spread.cpp +++ b/spread.cpp @@ -34,11 +34,11 @@ read_solution_spread(void) * ERROR if error occurred reading data * */ - struct spread_row *heading, *row_ptr, *units; + class spread_row *heading, *row_ptr, *units; int count, strings, numbers; int spread_lines; const char* cptr; - struct defaults soln_defaults; + class defaults soln_defaults; int return_value, opt; const char* next_char; const char *opt_list[] = { @@ -83,7 +83,7 @@ read_solution_spread(void) /* all iso[i].name is hsave'd, so no conflicts */ memcpy(&soln_defaults.iso[0], iso_defaults, - soln_defaults.iso.size() * sizeof(struct iso)); + soln_defaults.iso.size() * sizeof(class iso)); heading = NULL; units = NULL; @@ -523,8 +523,8 @@ read_solution_spread(void) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -spread_row_to_solution(struct spread_row *heading, struct spread_row *units, - struct spread_row *data, struct defaults defaults) +spread_row_to_solution(class spread_row *heading, class spread_row *units, + class spread_row *data, class defaults defaults) /* ---------------------------------------------------------------------- */ { Keywords::KEYWORDS next_keyword_save; @@ -805,7 +805,7 @@ spread_row_to_solution(struct spread_row *heading, struct spread_row *units, error_msg(error_string, PHRQ_io::OT_CONTINUE); error_string = sformatf( "\t%s\t%s\n", "line_save: ", line_save); error_msg(error_string, PHRQ_io::OT_CONTINUE); -//struct spread_row +//class spread_row //{ // int count; // int empty, string, number; @@ -1032,7 +1032,7 @@ spread_row_to_solution(struct spread_row *heading, struct spread_row *units, return (return_value); } /* ---------------------------------------------------------------------- */ -struct spread_row * Phreeqc:: +class spread_row * Phreeqc:: string_to_spread_row(char *string) /* ---------------------------------------------------------------------- */ { @@ -1042,7 +1042,7 @@ string_to_spread_row(char *string) /* * Allocate space */ - struct spread_row* spread_row_ptr = new struct spread_row; + class spread_row* spread_row_ptr = new class spread_row; if (spread_row_ptr == NULL) { malloc_error(); @@ -1094,7 +1094,7 @@ string_to_spread_row(char *string) /* ---------------------------------------------------------------------- */ int Phreeqc:: -spread_row_free(struct spread_row *spread_row_ptr) +spread_row_free(class spread_row *spread_row_ptr) /* ---------------------------------------------------------------------- */ { int i; @@ -1275,7 +1275,7 @@ free_spread(void) (const char *)free_check_null((void*)g_spread_sheet.defaults.iso[i].name); } g_spread_sheet.defaults.iso = - (struct iso*)free_check_null(g_spread_sheet.defaults.iso); + (class iso*)free_check_null(g_spread_sheet.defaults.iso); g_spread_sheet.defaults.redox = (const char *)free_check_null((void*)g_spread_sheet.defaults.redox); @@ -1290,12 +1290,12 @@ free_spread(void) /* ---------------------------------------------------------------------- */ void Phreeqc:: -add_row(struct spread_row *spread_row_ptr) +add_row(class spread_row *spread_row_ptr) /* ---------------------------------------------------------------------- */ { g_spread_sheet.rows = - (struct spread_row **) PHRQ_realloc(g_spread_sheet.rows, - sizeof(struct spread_row *) * + (class spread_row **) PHRQ_realloc(g_spread_sheet.rows, + sizeof(class spread_row *) * (g_spread_sheet.count_rows + 1)); if (g_spread_sheet.rows == NULL) { @@ -1309,17 +1309,17 @@ add_row(struct spread_row *spread_row_ptr) } /* ---------------------------------------------------------------------- */ -struct spread_row * Phreeqc:: -copy_row(struct spread_row *spread_row_ptr) +class spread_row * Phreeqc:: +copy_row(class spread_row *spread_row_ptr) /* ---------------------------------------------------------------------- */ { int i; - struct spread_row *new_spread_row_ptr; + class spread_row *new_spread_row_ptr; /* * Allocate space */ new_spread_row_ptr = - (struct spread_row *) PHRQ_malloc((size_t) sizeof(struct spread_row)); + (class spread_row *) PHRQ_malloc((size_t) sizeof(class spread_row)); if (new_spread_row_ptr == NULL) malloc_error(); new_spread_row_ptr->char_vector = @@ -1353,14 +1353,14 @@ copy_row(struct spread_row *spread_row_ptr) /* ---------------------------------------------------------------------- */ void Phreeqc:: -copy_defaults(struct defaults *dest_ptr, struct defaults *src_ptr) +copy_defaults(class defaults *dest_ptr, class defaults *src_ptr) /* ---------------------------------------------------------------------- */ { int i; dest_ptr->count_iso = src_ptr->count_iso; dest_ptr->density = src_ptr->density; dest_ptr->iso = - (struct iso *) PHRQ_malloc(sizeof(struct iso) * src_ptr->count_iso); + (class iso *) PHRQ_malloc(sizeof(class iso) * src_ptr->count_iso); if (dest_ptr->iso == NULL) { malloc_error(); diff --git a/step.cpp b/step.cpp index 8ae534c2..19049c0f 100644 --- a/step.cpp +++ b/step.cpp @@ -237,8 +237,8 @@ step(LDBLE step_fraction) for ( ; it != pp_assemblage_ptr->Get_pp_assemblage_comps().end(); it++) { int n; - struct phase *p_ptr = phase_bsearch((it->first).c_str(), &n, FALSE); - const struct elt_list *e_ptr; + class phase *p_ptr = phase_bsearch((it->first).c_str(), &n, FALSE); + const class elt_list *e_ptr; LDBLE min = 1e10; for (e_ptr = &p_ptr->next_elt[0]; e_ptr->elt != NULL; e_ptr++) { @@ -264,9 +264,9 @@ step(LDBLE step_fraction) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[k]); int n; - struct phase *p_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &n, FALSE); + class phase *p_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &n, FALSE); - const struct elt_list *e_ptr; + const class elt_list *e_ptr; LDBLE min = 1e10; for (e_ptr = &p_ptr->next_elt[0]; e_ptr->elt != NULL; e_ptr++) { @@ -351,8 +351,8 @@ add_solution(cxxSolution *solution_ptr, LDBLE extensive, LDBLE intensive) * extensive is multiplication factor for solution * intensive is fraction of all multiplication factors for all solutions */ - struct master *master_ptr; - struct species *species_ptr; + class master *master_ptr; + class species *species_ptr; /* * Add solution to global variables */ @@ -425,7 +425,7 @@ add_exchange(cxxExchange *exchange_ptr) /* * Accumulate exchange data in master->totals and _x variables. */ - struct master *master_ptr; + class master *master_ptr; if (exchange_ptr == NULL) return (OK); @@ -439,7 +439,7 @@ add_exchange(cxxExchange *exchange_ptr) cxxNameDouble::iterator it = nd.begin(); for ( ; it != nd.end(); it++) { - struct element *elt_ptr = element_store(it->first.c_str()); + class element *elt_ptr = element_store(it->first.c_str()); LDBLE coef = it->second; assert(elt_ptr != NULL && elt_ptr->primary != NULL); master_ptr = elt_ptr->primary; @@ -476,7 +476,7 @@ add_exchange(cxxExchange *exchange_ptr) cxxNameDouble::iterator it = nd.begin(); for ( ; it != nd.end(); it++) { - struct element *elt_ptr = element_store(it->first.c_str()); + class element *elt_ptr = element_store(it->first.c_str()); assert(elt_ptr->master); if (elt_ptr->master->type == EX) { @@ -505,12 +505,12 @@ add_surface(cxxSurface *surface_ptr) for (size_t i = 0; i < surface_ptr->Get_surface_comps().size(); i++) { cxxSurfaceComp *comp_ptr = &(surface_ptr->Get_surface_comps()[i]); - struct element *elt_ptr = element_store(comp_ptr->Get_master_element().c_str()); + class element *elt_ptr = element_store(comp_ptr->Get_master_element().c_str()); if (elt_ptr->master == NULL) { error_msg(sformatf("Data not defined for master in SURFACE, %s\n", comp_ptr->Get_formula().c_str()), STOP); } - struct master *master_i_ptr = elt_ptr->master; + class master *master_i_ptr = elt_ptr->master; if (surface_ptr->Get_type() == cxxSurface::NO_EDL) { @@ -527,8 +527,8 @@ add_surface(cxxSurface *surface_ptr) for (jit = comp_ptr->Get_totals().begin(); jit != comp_ptr->Get_totals().end(); jit++) { LDBLE coef = jit->second; - struct element *elt_j_ptr = element_store(jit->first.c_str()); - struct master *master_j_ptr = elt_j_ptr->primary; + class element *elt_j_ptr = element_store(jit->first.c_str()); + class master *master_j_ptr = elt_j_ptr->primary; if (master_j_ptr == NULL) { input_error++; @@ -561,7 +561,7 @@ add_surface(cxxSurface *surface_ptr) } if (!surface_ptr->Get_new_def()) { - struct master *master_ptr = surface_get_psi_master(charge_ptr->Get_name().c_str(), SURF_PSI); + class master *master_ptr = surface_get_psi_master(charge_ptr->Get_name().c_str(), SURF_PSI); master_ptr->s->la = charge_ptr->Get_la_psi(); } /* @@ -573,8 +573,8 @@ add_surface(cxxSurface *surface_ptr) for (jit = charge_ptr->Get_diffuse_layer_totals().begin(); jit != charge_ptr->Get_diffuse_layer_totals().end(); jit++) { LDBLE coef = jit->second; - struct element *elt_j_ptr = element_store(jit->first.c_str()); - struct master * master_j_ptr = elt_j_ptr->master; + class element *elt_j_ptr = element_store(jit->first.c_str()); + class master * master_j_ptr = elt_j_ptr->master; if (master_j_ptr->s == s_hplus) { total_h_x += coef; @@ -664,7 +664,7 @@ add_pp_assemblage(cxxPPassemblage *pp_assemblage_ptr) LDBLE amount_to_add, total; char token[MAX_LENGTH]; const char* cptr; - struct master *master_ptr; + class master *master_ptr; if (check_pp_assemblage(pp_assemblage_ptr) == OK) return (OK); @@ -684,7 +684,7 @@ add_pp_assemblage(cxxPPassemblage *pp_assemblage_ptr) cxxPPassemblageComp * comp_ptr = &(it->second); if (comp_ptr->Get_precipitate_only()) continue; int l; - struct phase * phase_ptr = phase_bsearch(it->first.c_str(), &l, FALSE); + class phase * phase_ptr = phase_bsearch(it->first.c_str(), &l, FALSE); count_elts = 0; paren_count = 0; amount_to_add = 0.0; @@ -768,13 +768,13 @@ check_pp_assemblage(cxxPPassemblage *pp_assemblage_ptr) * if all are in model. Return true if all are present, * Return false if one or more is missing. */ - struct master *master_ptr; + class master *master_ptr; cxxNameDouble nd = pp_assemblage_ptr->Get_eltList(); cxxNameDouble::iterator it; for (it = nd.begin(); it != nd.end(); it++) { - struct element *elt_ptr = element_store(it->first.c_str()); + class element *elt_ptr = element_store(it->first.c_str()); if (elt_ptr == NULL || elt_ptr->primary == NULL) { return FALSE; @@ -798,7 +798,7 @@ add_reaction(cxxReaction *reaction_ptr, int step_number, LDBLE step_fraction) * Add irreversible reaction */ char c; - struct master *master_ptr; + class master *master_ptr; /* * Calculate and save reaction */ @@ -896,7 +896,7 @@ add_reaction(cxxReaction *reaction_ptr, int step_number, LDBLE step_fraction) cxxNameDouble::const_iterator it = reaction_ptr->Get_elementList().begin(); for ( ; it != reaction_ptr->Get_elementList().end(); it++) { - struct element * elt_ptr = element_store(it->first.c_str()); + class element * elt_ptr = element_store(it->first.c_str()); LDBLE coef = it->second; if (elt_ptr == NULL) { @@ -939,7 +939,7 @@ reaction_calc(cxxReaction *reaction_ptr) int return_value; LDBLE coef; const char* cptr; - struct phase *phase_ptr; + class phase *phase_ptr; /* * Go through list and generate list of elements and * coefficient of elements in reaction @@ -996,7 +996,7 @@ add_gas_phase(cxxGasPhase *gas_phase_ptr) * Accumulate gas data in master->totals and _x variables. */ int i; - struct master *master_ptr; + class master *master_ptr; if (gas_phase_ptr == NULL) return (OK); @@ -1009,7 +1009,7 @@ add_gas_phase(cxxGasPhase *gas_phase_ptr) { cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int k; - struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); if (phase_ptr == NULL) { input_error++; @@ -1061,7 +1061,7 @@ add_ss_assemblage(cxxSSassemblage *ss_assemblage_ptr) */ int i, j, k; LDBLE amount_to_add, total; - struct master *master_ptr; + class master *master_ptr; const char* cptr; if (ss_assemblage_ptr == NULL) @@ -1081,7 +1081,7 @@ add_ss_assemblage(cxxSSassemblage *ss_assemblage_ptr) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[j]); int l; - struct phase * phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase * phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); amount_to_add = 0.0; comp_ptr->Set_delta(0.0); @@ -1156,7 +1156,7 @@ add_kinetics(cxxKinetics *kinetics_ptr) /* * Add kinetic reaction */ - struct master *master_ptr = NULL; + class master *master_ptr = NULL; /* * Add reaction to totals */ @@ -1166,7 +1166,7 @@ add_kinetics(cxxKinetics *kinetics_ptr) for (; it != kinetics_ptr->Get_totals().end(); it++) { LDBLE coef = it->second; - struct element *elt_ptr = element_store(it->first.c_str()); + class element *elt_ptr = element_store(it->first.c_str()); if (elt_ptr == NULL || (master_ptr = elt_ptr->primary) == NULL) { input_error++; @@ -1201,7 +1201,7 @@ gas_phase_check(cxxGasPhase *gas_phase_ptr) /* * Check for missing elements */ - struct master *master_ptr; + class master *master_ptr; if (gas_phase_ptr == NULL) return (OK); @@ -1219,7 +1219,7 @@ gas_phase_check(cxxGasPhase *gas_phase_ptr) { cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); int k; - struct phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE); count_elts = 0; paren_count = 0; if (gc_ptr->Get_moles() <= 0.0) @@ -1267,7 +1267,7 @@ pp_assemblage_check(cxxPPassemblage *pp_assemblage_ptr) */ std::string token; const char* cptr; - struct master *master_ptr; + class master *master_ptr; if (check_pp_assemblage(pp_assemblage_ptr) == OK) return (OK); @@ -1280,7 +1280,7 @@ pp_assemblage_check(cxxPPassemblage *pp_assemblage_ptr) { cxxPPassemblageComp * comp_ptr = &(it->second); int l; - struct phase * phase_ptr = phase_bsearch(it->first.c_str(), &l, FALSE); + class phase * phase_ptr = phase_bsearch(it->first.c_str(), &l, FALSE); count_elts = 0; paren_count = 0; if (comp_ptr->Get_moles() <= 0.0) @@ -1350,7 +1350,7 @@ ss_assemblage_check(cxxSSassemblage *ss_assemblage_ptr) * Check for missing elements */ int j, k; - struct master *master_ptr; + class master *master_ptr; if (ss_assemblage_ptr == NULL) return (OK); @@ -1365,7 +1365,7 @@ ss_assemblage_check(cxxSSassemblage *ss_assemblage_ptr) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[k]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); count_elts = 0; paren_count = 0; if (comp_ptr->Get_moles() <= 0.0) @@ -1425,7 +1425,7 @@ solution_check(void) * Check for missing elements */ int i; - struct master *master_ptr; + class master *master_ptr; /* * Check that all elements are in solution for phases with zero mass diff --git a/structures.cpp b/structures.cpp index 477d1cc7..78b88c25 100644 --- a/structures.cpp +++ b/structures.cpp @@ -300,7 +300,7 @@ rxn_find_coef(CReaction& r_ref, const char* str) * Return: 0.0, if token not found * coefficient of token, if found. */ - struct rxn_token* r_token; + class rxn_token* r_token; LDBLE coef; r_token = &r_ref.token[1]; @@ -326,16 +326,16 @@ int Phreeqc:: element_compare(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { - const struct element *element_ptr1, *element_ptr2; - element_ptr1 = *(const struct element **) ptr1; - element_ptr2 = *(const struct element **) ptr2; + const class element *element_ptr1, *element_ptr2; + element_ptr1 = *(const class element **) ptr1; + element_ptr2 = *(const class element **) ptr2; /* return(strcmp_nocase(element_ptr1->name, element_ptr2->name)); */ return (strcmp(element_ptr1->name, element_ptr2->name)); } /* ---------------------------------------------------------------------- */ -struct element* Phreeqc:: +class element* Phreeqc:: element_store(const char * element) /* ---------------------------------------------------------------------- */ { @@ -357,7 +357,7 @@ element_store(const char * element) /* * Search list */ - std::map::const_iterator it; + std::map::const_iterator it; it = elements_map.find(element); if (it != elements_map.end()) { @@ -366,7 +366,7 @@ element_store(const char * element) /* * Save new element structure and return pointer to it */ - struct element *elt_ptr = new struct element; + class element *elt_ptr = new class element; elt_ptr->name = string_hsave(element); elt_ptr->master = NULL; elt_ptr->primary = NULL; @@ -399,10 +399,10 @@ add_elt_list(const cxxNameDouble& nd, LDBLE coef) return (OK); } int Phreeqc:: -add_elt_list(const std::vector& el, double coef) +add_elt_list(const std::vector& el, double coef) /* ---------------------------------------------------------------------- */ { - const struct elt_list* elt_list_ptr = &el[0]; + const class elt_list* elt_list_ptr = &el[0]; for (; elt_list_ptr->elt != NULL; elt_list_ptr++) { @@ -480,7 +480,7 @@ elt_list_combine(void) return (OK); } qsort(&elt_list[0], count_elts, - sizeof(struct elt_list), Phreeqc::elt_list_compare); + sizeof(class elt_list), Phreeqc::elt_list_compare); j = 0; for (i = 1; i < count_elts; i++) { @@ -506,20 +506,20 @@ int Phreeqc:: elt_list_compare(const void* ptr1, const void* ptr2) /* ---------------------------------------------------------------------- */ { - const struct elt_list* a, * b; + const class elt_list* a, * b; - a = (const struct elt_list*)ptr1; - b = (const struct elt_list*)ptr2; + a = (const class elt_list*)ptr1; + b = (const class elt_list*)ptr2; return (strncmp(a->elt->name, b->elt->name, MAX_LENGTH)); } /* ---------------------------------------------------------------------- */ -std::vector Phreeqc:: -elt_list_internal_copy(const std::vector& el) +std::vector Phreeqc:: +elt_list_internal_copy(const std::vector& el) /* ---------------------------------------------------------------------- */ { - std::vector new_elt_list; + std::vector new_elt_list; if (el.size() == 0) return new_elt_list; - const struct elt_list* elt_list_ptr = &el[0]; + const class elt_list* elt_list_ptr = &el[0]; new_elt_list.resize(el.size()); size_t count = 0; @@ -533,7 +533,7 @@ elt_list_internal_copy(const std::vector& el) return new_elt_list; } /* ---------------------------------------------------------------------- */ -std::vector Phreeqc:: +std::vector Phreeqc:: elt_list_vsave(void) /* ---------------------------------------------------------------------- */ { @@ -543,7 +543,7 @@ elt_list_vsave(void) * new structure. */ size_t j; - std::vector new_elt_list; + std::vector new_elt_list; /* * Sort elements in reaction and combine */ @@ -582,7 +582,7 @@ elt_list_NameDouble(void) * * ********************************************************************** */ /* ---------------------------------------------------------------------- */ -struct inverse * Phreeqc:: +class inverse * Phreeqc:: inverse_alloc(void) /* ---------------------------------------------------------------------- */ /* @@ -594,7 +594,7 @@ inverse_alloc(void) * return: OK */ { - struct inverse *inverse_ptr = NULL; + class inverse *inverse_ptr = NULL; inverse.resize(count_inverse + 1); inverse_ptr = &(inverse[count_inverse++]); /* @@ -618,11 +618,11 @@ inverse_compare(const void *ptr1, const void *ptr2) /* * Compare inverse values for n_user */ - const struct inverse *nptr1; - const struct inverse *nptr2; + const class inverse *nptr1; + const class inverse *nptr2; - nptr1 = (const struct inverse *) ptr1; - nptr2 = (const struct inverse *) ptr2; + nptr1 = (const class inverse *) ptr1; + nptr2 = (const class inverse *) ptr2; if (nptr1->n_user > nptr2->n_user) return (1); if (nptr1->n_user < nptr2->n_user) @@ -649,7 +649,7 @@ inverse_delete(int i) /* ---------------------------------------------------------------------- */ int Phreeqc:: -inverse_free(struct inverse *inverse_ptr) +inverse_free(class inverse *inverse_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -709,10 +709,10 @@ inverse_isotope_compare(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { int i; - const struct inv_isotope *iso_ptr1, *iso_ptr2; + const class inv_isotope *iso_ptr1, *iso_ptr2; - iso_ptr1 = (const struct inv_isotope *) ptr1; - iso_ptr2 = (const struct inv_isotope *) ptr2; + iso_ptr1 = (const class inv_isotope *) ptr1; + iso_ptr2 = (const class inv_isotope *) ptr2; i = strcmp_nocase(iso_ptr1->elt_name, iso_ptr2->elt_name); if (i != 0) return (i); @@ -728,7 +728,7 @@ inverse_isotope_compare(const void *ptr1, const void *ptr2) } /* ---------------------------------------------------------------------- */ -struct inverse * Phreeqc:: +class inverse * Phreeqc:: inverse_search(int n_user, int *n) /* ---------------------------------------------------------------------- */ { @@ -769,7 +769,7 @@ inverse_sort(void) if (count_inverse > 1) { qsort(&inverse[0], (size_t) count_inverse, - sizeof(struct inverse), inverse_compare); + sizeof(class inverse), inverse_compare); } return (OK); } @@ -780,7 +780,7 @@ inverse_sort(void) * * ********************************************************************** */ /* ---------------------------------------------------------------------- */ -struct master * Phreeqc:: +class master * Phreeqc:: master_alloc(void) /* ---------------------------------------------------------------------- */ /* @@ -789,7 +789,7 @@ master_alloc(void) * return: pointer to a master structure */ { - struct master *ptr = new struct master; + class master *ptr = new class master; /* * set pointers in structure to NULL */ @@ -841,7 +841,7 @@ master_delete(const char* cptr) /* ---------------------------------------------------------------------- */ int Phreeqc:: -master_free(struct master *master_ptr) +master_free(class master *master_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -855,7 +855,7 @@ master_free(struct master *master_ptr) } /* ---------------------------------------------------------------------- */ -struct master * Phreeqc:: +class master * Phreeqc:: master_bsearch(const char* cptr) /* ---------------------------------------------------------------------- */ { @@ -875,13 +875,13 @@ master_bsearch(const char* cptr) void_ptr = bsearch((const char *) cptr, (char *) &master[0], master.size(), - sizeof(struct master *), master_compare_string); + sizeof(class master *), master_compare_string); if (void_ptr == NULL) { void_ptr = bsearch(cptr, (char*)&master[0], master.size(), - sizeof(struct master*), master_compare_string); + sizeof(class master*), master_compare_string); } if (void_ptr == NULL) { @@ -889,7 +889,7 @@ master_bsearch(const char* cptr) } else { - return (*(struct master **) void_ptr); + return (*(class master **) void_ptr); } } @@ -899,10 +899,10 @@ master_compare_string(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { const char *string_ptr; - const struct master *master_ptr; + const class master *master_ptr; string_ptr = (const char *) ptr1; - master_ptr = *(const struct master **) ptr2; + master_ptr = *(const class master **) ptr2; return (strcmp_nocase(string_ptr, master_ptr->elt->name)); } @@ -911,14 +911,14 @@ int Phreeqc:: master_compare(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { - const struct master *master_ptr1, *master_ptr2; - master_ptr1 = *(const struct master **) ptr1; - master_ptr2 = *(const struct master **) ptr2; + const class master *master_ptr1, *master_ptr2; + master_ptr1 = *(const class master **) ptr1; + master_ptr2 = *(const class master **) ptr2; return (strcmp_nocase(master_ptr1->elt->name, master_ptr2->elt->name)); } /* ---------------------------------------------------------------------- */ -struct master * Phreeqc:: +class master * Phreeqc:: master_bsearch_primary(const char* cptr) /* ---------------------------------------------------------------------- */ { @@ -928,7 +928,7 @@ master_bsearch_primary(const char* cptr) */ int l; const char* cptr1; - struct master *master_ptr_primary; + class master *master_ptr_primary; /* * Find element name */ @@ -951,7 +951,7 @@ master_bsearch_primary(const char* cptr) return (master_ptr_primary); } /* ---------------------------------------------------------------------- */ -struct master * Phreeqc:: +class master * Phreeqc:: master_bsearch_secondary(const char* cptr) /* ---------------------------------------------------------------------- */ { @@ -962,7 +962,7 @@ master_bsearch_secondary(const char* cptr) int l; const char* cptr1; std::string elt; - struct master *master_ptr_primary, *master_ptr=NULL, *master_ptr_secondary=NULL; + class master *master_ptr_primary, *master_ptr=NULL, *master_ptr_secondary=NULL; /* * Find element name */ @@ -1020,7 +1020,7 @@ master_bsearch_secondary(const char* cptr) return (master_ptr_secondary); } /* ---------------------------------------------------------------------- */ -struct master * Phreeqc:: +class master * Phreeqc:: master_search(const char* cptr, int *n) /* ---------------------------------------------------------------------- */ { @@ -1030,7 +1030,7 @@ master_search(const char* cptr, int *n) * Returns NULL if not found. */ int i; - struct master *master_ptr; + class master *master_ptr; /* * Search master species list */ @@ -1052,7 +1052,7 @@ master_search(const char* cptr, int *n) * * ********************************************************************** */ /* ---------------------------------------------------------------------- */ -struct phase * Phreeqc:: +class phase * Phreeqc:: phase_alloc(void) /* ---------------------------------------------------------------------- */ { @@ -1061,11 +1061,11 @@ phase_alloc(void) * arguments: void * return: pointer to new phase structure */ - struct phase *phase_ptr; + class phase *phase_ptr; /* * Allocate space */ - phase_ptr = new struct phase; + phase_ptr = new class phase; /* * Initialize space */ @@ -1081,9 +1081,9 @@ phase_compare(const void *ptr1, const void *ptr2) /* * Compares names of phases for sort */ - const struct phase *phase_ptr1, *phase_ptr2; - phase_ptr1 = *(const struct phase **) ptr1; - phase_ptr2 = *(const struct phase **) ptr2; + const class phase *phase_ptr1, *phase_ptr2; + phase_ptr1 = *(const class phase **) ptr1; + phase_ptr2 = *(const class phase **) ptr2; return (strcmp_nocase(phase_ptr1->name, phase_ptr2->name)); } @@ -1093,9 +1093,9 @@ phase_compare_string(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { const char *char_ptr; - const struct phase *phase_ptr; + const class phase *phase_ptr; char_ptr = (const char *) ptr1; - phase_ptr = *(const struct phase **) ptr2; + phase_ptr = *(const class phase **) ptr2; return (strcmp_nocase(char_ptr, phase_ptr->name)); } @@ -1117,7 +1117,7 @@ phase_delete(int i) /* ---------------------------------------------------------------------- */ int Phreeqc:: -phase_free(struct phase *phase_ptr) +phase_free(class phase *phase_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -1134,7 +1134,7 @@ phase_free(struct phase *phase_ptr) } /* ---------------------------------------------------------------------- */ -struct phase * Phreeqc:: +class phase * Phreeqc:: phase_bsearch(const char* cptr, int *j, int print) /* ---------------------------------------------------------------------- */ { @@ -1159,7 +1159,7 @@ phase_bsearch(const char* cptr, int *j, int print) bsearch((char *) cptr, (char *) &phases[0], phases.size(), - sizeof(struct phase *), phase_compare_string); + sizeof(class phase *), phase_compare_string); } if (void_ptr == NULL && print == TRUE) { @@ -1173,13 +1173,13 @@ phase_bsearch(const char* cptr, int *j, int print) return (NULL); } - *j = (int) ((struct phase **) void_ptr - &phases[0]); - return (*(struct phase **) void_ptr); + *j = (int) ((class phase **) void_ptr - &phases[0]); + return (*(class phase **) void_ptr); } /* ---------------------------------------------------------------------- */ int Phreeqc:: -phase_init(struct phase *phase_ptr) +phase_init(class phase *phase_ptr) /* ---------------------------------------------------------------------- */ /* * set pointers in phase structure to NULL @@ -1229,7 +1229,7 @@ phase_init(struct phase *phase_ptr) } /* ---------------------------------------------------------------------- */ -struct phase * Phreeqc:: +class phase * Phreeqc:: phase_store(const char *name_in) /* ---------------------------------------------------------------------- */ { @@ -1250,13 +1250,13 @@ phase_store(const char *name_in) * If phase existed, it is reinitialized. The structure returned * contains only the name of the phase. */ - struct phase *phase_ptr = NULL; + class phase *phase_ptr = NULL; /* * Search list */ std::string name = name_in; str_tolower(name); - std::map::iterator p_it = + std::map::iterator p_it = phases_map.find(name); if (p_it != phases_map.end()) { @@ -1286,7 +1286,7 @@ phase_store(const char *name_in) * * ********************************************************************** */ /* ---------------------------------------------------------------------- */ -struct rate * Phreeqc:: +class rate * Phreeqc:: rate_bsearch(const char* cptr, int *j) /* ---------------------------------------------------------------------- */ { @@ -1313,7 +1313,7 @@ rate_bsearch(const char* cptr, int *j) bsearch((char *) cptr, (char *) &rates[0], rates.size(), - sizeof(struct rate *), rate_compare_string); + sizeof(class rate *), rate_compare_string); if (void_ptr == NULL) { @@ -1321,8 +1321,8 @@ rate_bsearch(const char* cptr, int *j) return (NULL); } - *j = (int) ((struct rate *) void_ptr - &rates[0]); - return ((struct rate *) void_ptr); + *j = (int) ((class rate *) void_ptr - &rates[0]); + return ((class rate *) void_ptr); } /* ---------------------------------------------------------------------- */ @@ -1333,9 +1333,9 @@ rate_compare(const void *ptr1, const void *ptr2) /* * Compares names of rates for sort */ - const struct rate *rate_ptr1, *rate_ptr2; - rate_ptr1 = *(const struct rate **) ptr1; - rate_ptr2 = *(const struct rate **) ptr2; + const class rate *rate_ptr1, *rate_ptr2; + rate_ptr1 = *(const class rate **) ptr1; + rate_ptr2 = *(const class rate **) ptr2; return (strcmp_nocase(rate_ptr1->name, rate_ptr2->name)); } @@ -1345,15 +1345,15 @@ rate_compare_string(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { const char *char_ptr; - const struct rate *rate_ptr; + const class rate *rate_ptr; char_ptr = (const char *) ptr1; - rate_ptr = *(const struct rate **) ptr2; + rate_ptr = *(const class rate **) ptr2; return (strcmp_nocase(char_ptr, rate_ptr->name)); } /* ---------------------------------------------------------------------- */ int Phreeqc:: -rate_free(struct rate *rate_ptr) +rate_free(class rate *rate_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -1378,8 +1378,8 @@ rate_free(struct rate *rate_ptr) } /* ---------------------------------------------------------------------- */ -struct rate * Phreeqc:: -rate_copy(const struct rate *rate_ptr) +class rate * Phreeqc:: +rate_copy(const class rate *rate_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -1387,7 +1387,7 @@ rate_copy(const struct rate *rate_ptr) */ if (rate_ptr == NULL) return (NULL); - struct rate* rate_new = new struct rate; + class rate* rate_new = new class rate; rate_new->name = string_hsave(rate_ptr->name); rate_new->commands = rate_ptr->commands; rate_new->new_def = TRUE; @@ -1398,7 +1398,7 @@ rate_copy(const struct rate *rate_ptr) } /* ---------------------------------------------------------------------- */ -struct rate * Phreeqc:: +class rate * Phreeqc:: rate_search(const char *name_in, int *n) /* ---------------------------------------------------------------------- */ { @@ -1456,7 +1456,7 @@ rate_sort(void) */ if (rates.size() > 1) { - qsort(&rates[0], rates.size(), sizeof(struct rate), + qsort(&rates[0], rates.size(), sizeof(class rate), rate_compare); } return (OK); @@ -1467,7 +1467,7 @@ rate_sort(void) * * ********************************************************************** */ /* ---------------------------------------------------------------------- */ -struct species * Phreeqc:: +class species * Phreeqc:: s_alloc(void) /* ---------------------------------------------------------------------- */ /* @@ -1476,8 +1476,8 @@ s_alloc(void) * return: pointer to a species structure */ { - struct species *s_ptr; - s_ptr = new struct species; + class species *s_ptr; + s_ptr = new class species; /* * set pointers in structure to NULL, variables to zero */ @@ -1491,9 +1491,9 @@ int Phreeqc:: s_compare(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { - const struct species *s_ptr1, *s_ptr2; - s_ptr1 = *(const struct species **) ptr1; - s_ptr2 = *(const struct species **) ptr2; + const class species *s_ptr1, *s_ptr2; + s_ptr1 = *(const class species **) ptr1; + s_ptr2 = *(const class species **) ptr2; return (strcmp(s_ptr1->name, s_ptr2->name)); } @@ -1507,14 +1507,14 @@ s_delete(int i) * Delete species i: free memory and renumber array of pointers, s. */ s_free(s[i]); - s[i] = (struct species *) free_check_null(s[i]); + s[i] = (class species *) free_check_null(s[i]); s.erase(s.begin() + i); return (OK); } /* ---------------------------------------------------------------------- */ int Phreeqc:: -s_free(struct species *s_ptr) +s_free(class species *s_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -1531,7 +1531,7 @@ s_free(struct species *s_ptr) /* ---------------------------------------------------------------------- */ int Phreeqc:: -s_init(struct species *s_ptr) +s_init(class species *s_ptr) /* ---------------------------------------------------------------------- */ /* * return: pointer to a species structure @@ -1605,7 +1605,7 @@ s_init(struct species *s_ptr) return (OK); } /* ---------------------------------------------------------------------- */ -struct species* Phreeqc:: +class species* Phreeqc:: s_search(const char* name) /* ---------------------------------------------------------------------- */ { @@ -1619,8 +1619,8 @@ s_search(const char* name) * If found, pointer to the appropriate species structure is returned. * else, NULL pointer is returned. */ - struct species* s_ptr = NULL; - std::map::iterator s_it = + class species* s_ptr = NULL; + std::map::iterator s_it = species_map.find(name); if (s_it != species_map.end()) { @@ -1629,7 +1629,7 @@ s_search(const char* name) return (s_ptr); } /* ---------------------------------------------------------------------- */ -struct species * Phreeqc:: +class species * Phreeqc:: s_store(const char *name, LDBLE l_z, int replace_if_found) /* ---------------------------------------------------------------------- */ { @@ -1660,7 +1660,7 @@ s_store(const char *name, LDBLE l_z, int replace_if_found) /* * Search list */ - struct species* s_ptr = NULL; + class species* s_ptr = NULL; s_ptr = s_search(name); if (s_ptr != NULL && replace_if_found == FALSE) { @@ -1694,10 +1694,10 @@ isotope_compare(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { int i; - const struct isotope *iso_ptr1, *iso_ptr2; + const class isotope *iso_ptr1, *iso_ptr2; - iso_ptr1 = (const struct isotope *) ptr1; - iso_ptr2 = (const struct isotope *) ptr2; + iso_ptr1 = (const class isotope *) ptr1; + iso_ptr2 = (const class isotope *) ptr2; i = strcmp_nocase(iso_ptr1->elt_name, iso_ptr2->elt_name); if (i != 0) return (i); @@ -1723,10 +1723,10 @@ species_list_compare(const void *ptr1, const void *ptr2) { int j; const char *name1, *name2; - const struct species_list *nptr1, *nptr2; + const class species_list *nptr1, *nptr2; - nptr1 = (const struct species_list *) ptr1; - nptr2 = (const struct species_list *) ptr2; + nptr1 = (const class species_list *) ptr1; + nptr2 = (const class species_list *) ptr2; /* * Put H+ first @@ -1797,11 +1797,11 @@ int Phreeqc:: species_list_compare_alk(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { - const struct species_list *nptr1, *nptr2; + const class species_list *nptr1, *nptr2; LDBLE alk1, alk2; - nptr1 = (const struct species_list *) ptr1; - nptr2 = (const struct species_list *) ptr2; + nptr1 = (const class species_list *) ptr1; + nptr2 = (const class species_list *) ptr2; /* * Else, descending order by log molality */ @@ -1827,10 +1827,10 @@ species_list_compare_master(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { const char *name1, *name2; - const struct species_list *nptr1, *nptr2; + const class species_list *nptr1, *nptr2; - nptr1 = (const struct species_list *) ptr1; - nptr2 = (const struct species_list *) ptr2; + nptr1 = (const class species_list *) ptr1; + nptr2 = (const class species_list *) ptr2; /* * Put H+ first @@ -1886,7 +1886,7 @@ species_list_sort(void) if (species_list.size() > 1) { qsort(&species_list[0], species_list.size(), - sizeof(struct species_list), species_list_compare); + sizeof(class species_list), species_list_compare); } return (OK); } @@ -1916,11 +1916,11 @@ change_surf_alloc(int count) return (change_surf); } /* ---------------------------------------------------------------------- */ -struct master * Phreeqc:: +class master * Phreeqc:: surface_get_psi_master(const char *name, int plane) /* ---------------------------------------------------------------------- */ { - struct master *master_ptr; + class master *master_ptr; std::string token; if (name == NULL) @@ -1951,7 +1951,7 @@ surface_get_psi_master(const char *name, int plane) /* ---------------------------------------------------------------------- */ bool Phreeqc:: -phase_rxn_to_trxn(struct phase* phase_ptr, CReaction& rxn_ref) +phase_rxn_to_trxn(class phase* phase_ptr, CReaction& rxn_ref) /* ---------------------------------------------------------------------- */ { /* @@ -2021,7 +2021,7 @@ trxn_add(CReaction& r_ref, double coef, bool combine) /* * Copy equation into work space */ - struct rxn_token* next_token = &r_ref.token[0]; + class rxn_token* next_token = &r_ref.token[0]; while (next_token->s != NULL) { if (count_trxn + 1 > trxn.token.size()) @@ -2056,7 +2056,7 @@ trxn_add_phase(CReaction& r_ref, double coef, bool combine) * like terms combined. */ int i; - struct rxn_token* next_token; + class rxn_token* next_token; /* * Accumulate log k for reaction */ @@ -2164,9 +2164,9 @@ int Phreeqc:: trxn_compare(const void* ptr1, const void* ptr2) /* ---------------------------------------------------------------------- */ { - const struct rxn_token_temp* rxn_token_temp_ptr1, * rxn_token_temp_ptr2; - rxn_token_temp_ptr1 = (const struct rxn_token_temp*)ptr1; - rxn_token_temp_ptr2 = (const struct rxn_token_temp*)ptr2; + const class rxn_token_temp* rxn_token_temp_ptr1, * rxn_token_temp_ptr2; + rxn_token_temp_ptr1 = (const class rxn_token_temp*)ptr1; + rxn_token_temp_ptr2 = (const class rxn_token_temp*)ptr2; return (strcmp(rxn_token_temp_ptr1->name, rxn_token_temp_ptr2->name)); } /* ---------------------------------------------------------------------- */ @@ -2347,7 +2347,7 @@ trxn_sort(void) { qsort(&trxn.token[1], (size_t)count_trxn - 1, - sizeof(struct rxn_token_temp), + sizeof(class rxn_token_temp), trxn_compare); } return (OK); @@ -2416,7 +2416,7 @@ trxn_swap(const char *token) * * ********************************************************************** */ /* ---------------------------------------------------------------------- */ -struct unknown * Phreeqc:: +class unknown * Phreeqc:: unknown_alloc(void) /* ---------------------------------------------------------------------- */ { @@ -2425,11 +2425,11 @@ unknown_alloc(void) * arguments: void * return: pointer to an "unknown" structure */ - struct unknown *unknown_ptr; + class unknown *unknown_ptr; /* * Allocate space */ - unknown_ptr = new struct unknown; + unknown_ptr = new class unknown; /* * set pointers in structure to NULL */ @@ -2488,7 +2488,7 @@ unknown_delete(int i) /* ---------------------------------------------------------------------- */ int Phreeqc:: -unknown_free(struct unknown *unknown_ptr) +unknown_free(class unknown *unknown_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -2532,7 +2532,7 @@ system_duplicate(int i, int save_old) } /* ---------------------------------------------------------------------- */ -struct logk * Phreeqc:: +class logk * Phreeqc:: logk_store(const char *name_in, int replace_if_found) /* ---------------------------------------------------------------------- */ { @@ -2559,10 +2559,10 @@ logk_store(const char *name_in, int replace_if_found) /* * Search list */ - struct logk* logk_ptr = NULL; + class logk* logk_ptr = NULL; std::string name = name_in; str_tolower(name); - std::map::iterator it = + std::map::iterator it = logk_map.find(name); if (it != logk_map.end() && replace_if_found == FALSE) @@ -2593,7 +2593,7 @@ logk_store(const char *name_in, int replace_if_found) } /* ---------------------------------------------------------------------- */ -struct logk * Phreeqc:: +class logk * Phreeqc:: logk_alloc(void) /* ---------------------------------------------------------------------- */ /* @@ -2602,8 +2602,8 @@ logk_alloc(void) * return: pointer to a logk structure */ { - struct logk *logk_ptr; - logk_ptr = new struct logk; + class logk *logk_ptr; + logk_ptr = new class logk; /* * set pointers in structure to NULL, variables to zero */ @@ -2614,7 +2614,7 @@ logk_alloc(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -logk_init(struct logk *logk_ptr) +logk_init(class logk *logk_ptr) /* ---------------------------------------------------------------------- */ /* * return: pointer to a logk structure @@ -2640,7 +2640,7 @@ logk_init(struct logk *logk_ptr) /* ---------------------------------------------------------------------- */ int Phreeqc:: -logk_copy2orig(struct logk *logk_ptr) +logk_copy2orig(class logk *logk_ptr) /* ---------------------------------------------------------------------- */ /* * Copies log k data to logk_original @@ -2655,7 +2655,7 @@ logk_copy2orig(struct logk *logk_ptr) } /* ---------------------------------------------------------------------- */ -struct logk * Phreeqc:: +class logk * Phreeqc:: logk_search(const char *name_in) /* ---------------------------------------------------------------------- */ { @@ -2669,13 +2669,13 @@ logk_search(const char *name_in) * pointer to logk structure "logk" where "name" can be found. * or NULL if not found. */ - struct logk *logk_ptr; + class logk *logk_ptr; /* * Search list */ std::string name = name_in; str_tolower(name); - std::map::iterator l_it = + std::map::iterator l_it = logk_map.find(name); if (l_it != logk_map.end()) { @@ -2866,7 +2866,7 @@ get_entity_enum(char *name) */ /* ---------------------------------------------------------------------- */ int Phreeqc:: -copier_add(struct copier *copier_ptr, int n_user, int start, int end) +copier_add(class copier *copier_ptr, int n_user, int start, int end) /* ---------------------------------------------------------------------- */ /* * add new set of copy instructions @@ -2879,7 +2879,7 @@ copier_add(struct copier *copier_ptr, int n_user, int start, int end) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -copier_clear(struct copier* copier_ptr) +copier_clear(class copier* copier_ptr) /* ---------------------------------------------------------------------- */ /* * clear copier diff --git a/tally.cpp b/tally.cpp index 6e6f6d00..74d080a0 100644 --- a/tally.cpp +++ b/tally.cpp @@ -117,8 +117,8 @@ get_all_components(void) * Buffer contains an entry for every primary master * species that can be used in the transport problem. */ - t_buffer = (struct tally_buffer *) PHRQ_malloc( - (size_t)tally_count_component * sizeof(struct tally_buffer)); + t_buffer = (class tally_buffer *) PHRQ_malloc( + (size_t)tally_count_component * sizeof(class tally_buffer)); // store alkalinity j = 0; @@ -320,12 +320,12 @@ free_tally_table(void) tally_table[i].formula.clear(); for (k = 0; k < 3; k++) { - tally_table[i].total[k] = (struct tally_buffer *) free_check_null( + tally_table[i].total[k] = (class tally_buffer *) free_check_null( tally_table[i].total[k]); } } - tally_table = (struct tally *) free_check_null(tally_table); - t_buffer = (struct tally_buffer *) free_check_null(t_buffer); + tally_table = (class tally *) free_check_null(tally_table); + t_buffer = (class tally_buffer *) free_check_null(t_buffer); return (OK); } @@ -458,7 +458,7 @@ fill_tally_table(int *n_user, int index_conservative, int n_buffer) cxxNameDouble::iterator jit = solution_ptr->Get_totals().begin(); for ( ; jit != solution_ptr->Get_totals().end(); jit++) { - struct master *master_ptr = master_bsearch(jit->first.c_str()); + class master *master_ptr = master_bsearch(jit->first.c_str()); master_ptr->total = jit->second; } @@ -594,7 +594,7 @@ fill_tally_table(int *n_user, int index_conservative, int n_buffer) { comp_ptr = &(ss_ptr->Get_ss_comps()[k]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); if (phase_ptr->name == tally_table[i].name) break; if (strcmp_nocase(phase_ptr->name, tally_table[i].name) == 0) @@ -632,7 +632,7 @@ fill_tally_table(int *n_user, int index_conservative, int n_buffer) for (size_t l = 0; l < gc->size(); l++) { int k; - struct phase *phase_ptr = phase_bsearch((*gc)[l].Get_phase_name().c_str(), &k, FALSE); + class phase *phase_ptr = phase_bsearch((*gc)[l].Get_phase_name().c_str(), &k, FALSE); add_elt_list(phase_ptr->next_elt, (*gc)[l].Get_moles()); } @@ -690,7 +690,7 @@ fill_tally_table(int *n_user, int index_conservative, int n_buffer) /* ---------------------------------------------------------------------- */ int Phreeqc:: -elt_list_to_tally_table(struct tally_buffer *buffer_ptr) +elt_list_to_tally_table(class tally_buffer *buffer_ptr) /* ---------------------------------------------------------------------- */ { int i, j; @@ -735,7 +735,7 @@ elt_list_to_tally_table(struct tally_buffer *buffer_ptr) /* ---------------------------------------------------------------------- */ int Phreeqc:: -master_to_tally_table(struct tally_buffer *buffer_ptr) +master_to_tally_table(class tally_buffer *buffer_ptr) /* ---------------------------------------------------------------------- */ { int i, j; @@ -789,7 +789,7 @@ build_tally_table(void) int j, k, l, p, save_print_use; size_t n; int count_tt_pure_phase, count_tt_ss_phase, count_tt_kinetics; - struct phase *phase_ptr; + class phase *phase_ptr; char token[MAX_LENGTH]; const char* cptr; /* @@ -877,7 +877,7 @@ build_tally_table(void) { cxxPPassemblageComp * comp_ptr = &(jit->second); int l; - struct phase * phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); + class phase * phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); /* * check if already in tally_table */ @@ -939,7 +939,7 @@ build_tally_table(void) { cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[k]); int l; - struct phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(comp_ptr->Get_name().c_str(), &l, FALSE); /* * check if already in tally_table */ @@ -1155,7 +1155,7 @@ calc_dummy_kinetic_reaction_tally(cxxKinetics *kinetics_ptr) */ LDBLE coef; const char* cptr; - struct phase *phase_ptr; + class phase *phase_ptr; /* * Go through list and generate list of elements and * coefficient of elements in reaction @@ -1205,14 +1205,14 @@ extend_tally_table(void) * adds another column to tally_table * increments number of columns */ - tally_table = (struct tally *) PHRQ_realloc((void *) tally_table, - (count_tally_table_columns + 1) * sizeof(struct tally)); + tally_table = (class tally *) PHRQ_realloc((void *) tally_table, + (count_tally_table_columns + 1) * sizeof(class tally)); if (tally_table == NULL) malloc_error(); for (i = 0; i < 3; i++) { - tally_table[count_tally_table_columns].total[i] = (struct tally_buffer *) - PHRQ_malloc(count_tally_table_rows * sizeof(struct tally_buffer)); + tally_table[count_tally_table_columns].total[i] = (class tally_buffer *) + PHRQ_malloc(count_tally_table_rows * sizeof(class tally_buffer)); if (tally_table[count_tally_table_columns].total[i] == NULL) malloc_error(); for (j = 0; j < count_tally_table_rows; j++) diff --git a/tidy.cpp b/tidy.cpp index a1b8ac11..47d3dee8 100644 --- a/tidy.cpp +++ b/tidy.cpp @@ -150,14 +150,14 @@ tidy_model(void) /* species */ if (new_model == TRUE) { - if (s.size() > 1) qsort(&s[0], s.size(), sizeof(struct species *), s_compare); + if (s.size() > 1) qsort(&s[0], s.size(), sizeof(class species *), s_compare); /* master species */ - if (master.size() > 1) qsort(&master[0], master.size(), sizeof(struct master *), master_compare); + if (master.size() > 1) qsort(&master[0], master.size(), sizeof(class master *), master_compare); /* elements */ - if (elements.size() > 1) qsort(&elements[0], elements.size(), sizeof(struct element *), element_compare); + if (elements.size() > 1) qsort(&elements[0], elements.size(), sizeof(class element *), element_compare); /* phases */ - if (phases.size() > 1) qsort(&phases[0], phases.size(), sizeof(struct phase *), phase_compare); + if (phases.size() > 1) qsort(&phases[0], phases.size(), sizeof(class phase *), phase_compare); } @@ -550,12 +550,12 @@ tidy_logk(void) /* ---------------------------------------------------------------------- */ int Phreeqc:: -add_other_logk(LDBLE * source_k, std::vector &add_logk) +add_other_logk(LDBLE * source_k, std::vector &add_logk) /* ---------------------------------------------------------------------- */ { int j; bool analytic; - struct logk *logk_ptr; + class logk *logk_ptr; LDBLE coef; for (size_t i = 0; i < add_logk.size(); i++) @@ -563,7 +563,7 @@ add_other_logk(LDBLE * source_k, std::vector &add_logk) coef = add_logk[i].coef; std::string token = add_logk[i].name; str_tolower(token); - std::map::iterator l_it = logk_map.find(token); + std::map::iterator l_it = logk_map.find(token); if (l_it == logk_map.end()) { input_error++; @@ -605,11 +605,11 @@ add_other_logk(LDBLE * source_k, std::vector &add_logk) /* ---------------------------------------------------------------------- */ int Phreeqc:: -add_logks(struct logk *logk_ptr, int repeats) +add_logks(class logk *logk_ptr, int repeats) /* ---------------------------------------------------------------------- */ { int i, j; - struct logk *next_logk_ptr; + class logk *next_logk_ptr; LDBLE coef; /* * Adds in other named_expressions to get complete log K @@ -628,7 +628,7 @@ add_logks(struct logk *logk_ptr, int repeats) coef = logk_ptr->add_logk[i].coef; std::string token = logk_ptr->add_logk[i].name; str_tolower(token); - std::map::iterator l_it = logk_map.find(token); + std::map::iterator l_it = logk_map.find(token); if (l_it == logk_map.end()) { input_error++; @@ -658,14 +658,14 @@ add_logks(struct logk *logk_ptr, int repeats) /* ---------------------------------------------------------------------- */ LDBLE Phreeqc:: -coef_in_master(struct master * master_ptr) +coef_in_master(class master * master_ptr) /* ---------------------------------------------------------------------- */ { int l; LDBLE coef; const char* cptr; std::string elt_name; - const struct elt_list *next_elt; + const class elt_list *next_elt; coef = 0.0; cptr = master_ptr->elt->name; @@ -693,7 +693,7 @@ rewrite_eqn_to_secondary(void) */ LDBLE coef; int repeat, i, add_count; - struct rxn_token_temp *token_ptr; + class rxn_token_temp *token_ptr; /* * */ @@ -754,8 +754,8 @@ replace_solids_gases(void) LDBLE coef; int n; int repeat, i, add_count; - struct rxn_token_temp *token_ptr; - struct phase *phase_ptr; + class rxn_token_temp *token_ptr; + class phase *phase_ptr; int replaced; char token[MAX_LENGTH]; /* @@ -914,7 +914,7 @@ tidy_gas_phase(void) for (size_t j = 0; j < gas_phase_ptr->Get_gas_comps().size(); j++) { int k; - struct phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), &k, FALSE); + class phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j].Get_phase_name().c_str(), &k, FALSE); if (phase_ptr == NULL) { input_error++; @@ -1016,13 +1016,13 @@ tidy_gas_phase(void) if (PR && P > 0) { - std::vector phase_ptrs; + std::vector phase_ptrs; size_t j_PR; std::vector &gc = gas_phase_ptr->Get_gas_comps(); for (j_PR = 0; j_PR < gas_phase_ptr->Get_gas_comps().size(); j_PR++) { int k; - struct phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j_PR].Get_phase_name().c_str(), &k, FALSE); + class phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j_PR].Get_phase_name().c_str(), &k, FALSE); if (gc[j_PR].Get_p_read() == 0) { gc[j_PR].Set_moles(0.0); @@ -1046,7 +1046,7 @@ tidy_gas_phase(void) for (j_PR = 0; j_PR < gas_phase_ptr->Get_gas_comps().size(); j_PR++) { int k; - struct phase *phase_ptr = phase_bsearch(gc[j_PR].Get_phase_name().c_str(), &k, FALSE); + class phase *phase_ptr = phase_bsearch(gc[j_PR].Get_phase_name().c_str(), &k, FALSE); if (gc[j_PR].Get_p_read() == 0) { gc[j_PR].Set_moles(0.0); @@ -1102,9 +1102,9 @@ tidy_inverse(void) int i, j, k, l; int count_in; LDBLE value; - struct master *master_ptr; - struct master *master_alk_ptr; - const struct elt_list *elt_list_ptr; + class master *master_ptr; + class master *master_alk_ptr; + const class elt_list *elt_list_ptr; master_alk_ptr = master_bsearch("Alkalinity"); for (i = 0; i < count_inverse; i++) { @@ -1259,7 +1259,7 @@ tidy_inverse(void) } qsort(&inverse[i].phases[j].isotopes[0], inverse[i].phases[j].isotopes.size(), - sizeof(struct isotope), isotope_compare); + sizeof(class isotope), isotope_compare); } add_elt_list(inverse[i].phases[j].phase->next_elt, 1.0); @@ -1336,7 +1336,7 @@ tidy_inverse(void) /* * Save list of master species in inv_elts structure */ - std::vector inv_elts; + std::vector inv_elts; inv_elts.resize(count_in); count_in = 0; for (j = 0; j < (int)master.size(); j++) @@ -1547,7 +1547,7 @@ tidy_pp_assemblage(void) for ( ; it != pp_assemblage_ptr->Get_pp_assemblage_comps().end(); it++) { int k; - struct phase *phase_ptr = phase_bsearch(it->first.c_str(), &k, FALSE); + class phase *phase_ptr = phase_bsearch(it->first.c_str(), &k, FALSE); if (phase_ptr == NULL) { input_error++; @@ -1610,7 +1610,7 @@ int Phreeqc:: tidy_ss_assemblage(void) /* ---------------------------------------------------------------------- */ { - struct phase *phase_ptr; + class phase *phase_ptr; LDBLE nb, nc, n_tot, xb, xc, dnb, dnc, l_a0, l_a1; LDBLE xb2, xb3, xb4, xc2, xc3; LDBLE moles; @@ -2242,7 +2242,7 @@ tidy_species(void) /* ---------------------------------------------------------------------- */ { int i, j; - struct master *master_ptr; + class master *master_ptr; char c; const char* cptr; /* @@ -2610,8 +2610,8 @@ tidy_surface(void) cxxNameDouble::iterator jit = comp_ptr->Get_totals().begin(); for ( ; jit != comp_ptr->Get_totals().end(); jit++ ) { - struct element *elt_ptr = element_store(jit->first.c_str()); - struct master *master_ptr = elt_ptr->master; + class element *elt_ptr = element_store(jit->first.c_str()); + class master *master_ptr = elt_ptr->master; if (master_ptr == NULL) { input_error++; @@ -2713,7 +2713,7 @@ tidy_solutions(void) * Define n_user for any solutions read by solution_spread that * don`t have n_user defined */ - struct master *master_ptr; + class master *master_ptr; /* * Calculate solution numbers @@ -2806,7 +2806,7 @@ tidy_solutions(void) } /* ---------------------------------------------------------------------- */ int Phreeqc:: -species_rxn_to_trxn(struct species *s_ptr) +species_rxn_to_trxn(class species *s_ptr) /* ---------------------------------------------------------------------- */ { /* @@ -2841,7 +2841,7 @@ tidy_isotopes(void) * Isotope ratios for each element or element valence state */ LDBLE isotope_number; - struct master *master_ptr, *primary_ptr; + class master *master_ptr, *primary_ptr; size_t primary_number = 0; primary_ptr = NULL; @@ -3049,7 +3049,7 @@ tidy_kin_exchange(void) for (; kit != nd.end(); kit++) { /* Find master species */ - struct element *elt_ptr = element_store(kit->first.c_str()); + class element *elt_ptr = element_store(kit->first.c_str()); if (elt_ptr == NULL || elt_ptr->master == NULL) { input_error++; @@ -3155,7 +3155,7 @@ update_kin_exchange(void) for (; kit != nd.end(); kit++) { /* Find master species */ - struct element* elt_ptr = element_store(kit->first.c_str()); + class element* elt_ptr = element_store(kit->first.c_str()); if (elt_ptr == NULL || elt_ptr->master == NULL) { input_error++; @@ -3230,7 +3230,7 @@ update_kin_exchange(void) for (kit = nd_formula.begin(); kit != nd_formula.end(); kit++) { /* Find master species */ - struct element* elt_ptr = element_store(kit->first.c_str()); + class element* elt_ptr = element_store(kit->first.c_str()); if (elt_ptr->master->type == EX) { comp_coef = kit->second; @@ -3297,7 +3297,7 @@ tidy_min_exchange(void) for (; kit != nd.end(); kit++) { /* Find master species */ - struct element *elt_ptr = element_store(kit->first.c_str()); + class element *elt_ptr = element_store(kit->first.c_str()); if (elt_ptr == NULL || elt_ptr->master == NULL) { input_error++; @@ -3371,7 +3371,7 @@ tidy_min_exchange(void) get_elts_in_species(&cptr, -comp_ref.Get_phase_proportion()); } int l; - struct phase *phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); if (phase_ptr != NULL) { cptr = phase_ptr->formula; @@ -3440,7 +3440,7 @@ update_min_exchange(void) for (; kit != nd.end(); kit++) { /* Find master species */ - struct element* elt_ptr = element_store(kit->first.c_str()); + class element* elt_ptr = element_store(kit->first.c_str()); if (elt_ptr == NULL || elt_ptr->master == NULL) { input_error++; @@ -3514,7 +3514,7 @@ update_min_exchange(void) for (kit = nd_formula.begin(); kit != nd_formula.end(); kit++) { /* Find master species */ - struct element* elt_ptr = element_store(kit->first.c_str()); + class element* elt_ptr = element_store(kit->first.c_str()); if (elt_ptr->master->type == EX) { comp_coef = kit->second; @@ -3541,7 +3541,7 @@ update_min_exchange(void) get_elts_in_species(&cptr, -comp_ref.Get_phase_proportion()); } int l; - struct phase* phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); + class phase* phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); if (phase_ptr != NULL) { cptr = phase_ptr->formula; @@ -3619,8 +3619,8 @@ tidy_min_surface(void) for (it = surface_comp_ptr->Get_totals().begin(); it != surface_comp_ptr->Get_totals().end(); it++) { /* Find master species */ - struct element *elt_ptr = element_store(it->first.c_str()); - struct master *master_ptr = elt_ptr->master; + class element *elt_ptr = element_store(it->first.c_str()); + class master *master_ptr = elt_ptr->master; if (master_ptr == NULL) { input_error++; @@ -3676,7 +3676,7 @@ tidy_min_surface(void) continue; } int l; - struct phase *phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); + class phase *phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); if (phase_ptr == NULL) { input_error++; @@ -3739,7 +3739,7 @@ tidy_min_surface(void) { // Warn if not master species and charge balanced - struct element *elt_ptr = element_store(comp_jj_ptr->Get_master_element().c_str()); + class element *elt_ptr = element_store(comp_jj_ptr->Get_master_element().c_str()); if (elt_ptr->master == NULL) { input_error++; @@ -3798,7 +3798,7 @@ tidy_min_surface(void) //&& elt_list[jj].elt->primary->s != s_h2o ) { - struct element *elt_ptr = element_store(surface_comp_ptr->Get_master_element().c_str()); + class element *elt_ptr = element_store(surface_comp_ptr->Get_master_element().c_str()); error_string = sformatf( "Element %s in sum of surface sites,\n" "\t including %s * %g mol sites/mol phase,\n" @@ -3857,8 +3857,8 @@ update_min_surface(void) for (it = surface_comp_ptr->Get_totals().begin(); it != surface_comp_ptr->Get_totals().end(); it++) { /* Find master species */ - struct element* elt_ptr = element_store(it->first.c_str()); - struct master* master_ptr = elt_ptr->master; + class element* elt_ptr = element_store(it->first.c_str()); + class master* master_ptr = elt_ptr->master; if (master_ptr == NULL) { input_error++; @@ -3914,7 +3914,7 @@ update_min_surface(void) continue; } int l; - struct phase* phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); + class phase* phase_ptr = phase_bsearch(jit->first.c_str(), &l, FALSE); if (phase_ptr == NULL) { input_error++; @@ -3972,8 +3972,8 @@ tidy_kin_surface(void) */ { cxxKinetics *kinetics_ptr; - struct phase *phase_ptr; - std::vector elt_list_kinetics; + class phase *phase_ptr; + std::vector elt_list_kinetics; size_t count_elts_kinetics; //std::map::iterator it; @@ -4008,8 +4008,8 @@ tidy_kin_surface(void) for (kit = comp_ptr->Get_totals().begin(); kit != comp_ptr->Get_totals().end(); kit++) { /* Find master species */ - struct element *elt_ptr = element_store(kit->first.c_str()); - struct master *master_ptr = elt_ptr->master; + class element *elt_ptr = element_store(kit->first.c_str()); + class master *master_ptr = elt_ptr->master; if (master_ptr == NULL) { input_error++; @@ -4262,8 +4262,8 @@ update_kin_surface(void) for (kit = comp_ptr->Get_totals().begin(); kit != comp_ptr->Get_totals().end(); kit++) { /* Find master species */ - struct element* elt_ptr = element_store(kit->first.c_str()); - struct master* master_ptr = elt_ptr->master; + class element* elt_ptr = element_store(kit->first.c_str()); + class master* master_ptr = elt_ptr->master; if (master_ptr == NULL) { input_error++; @@ -4395,8 +4395,8 @@ ss_prep(LDBLE t, cxxSS *ss_ptr, int print) ag1 = a1 * rt; cxxSScomp *comp0_ptr = &(ss_ptr->Get_ss_comps()[0]); cxxSScomp *comp1_ptr = &(ss_ptr->Get_ss_comps()[1]); - struct phase *phase0_ptr = phase_bsearch(comp0_ptr->Get_name().c_str(), &k, FALSE); - struct phase *phase1_ptr = phase_bsearch(comp1_ptr->Get_name().c_str(), &k, FALSE); + class phase *phase0_ptr = phase_bsearch(comp0_ptr->Get_name().c_str(), &k, FALSE); + class phase *phase1_ptr = phase_bsearch(comp1_ptr->Get_name().c_str(), &k, FALSE); kc = exp(k_calc(phase0_ptr->rxn.logk, t, REF_PRES_PASCAL) * LOG_10); kb = exp(k_calc(phase1_ptr->rxn.logk, t, REF_PRES_PASCAL) * LOG_10); crit_pt = fabs(a0) + fabs(a1); @@ -5006,8 +5006,8 @@ ss_calc_a0_a1(cxxSS *ss_ptr) cxxSScomp *comp0_ptr = &(ss_ptr->Get_ss_comps()[0]); cxxSScomp *comp1_ptr = &(ss_ptr->Get_ss_comps()[1]); int k; - struct phase *phase0_ptr = phase_bsearch(comp0_ptr->Get_name().c_str(), &k, FALSE); - struct phase *phase1_ptr = phase_bsearch(comp1_ptr->Get_name().c_str(), &k, FALSE); + class phase *phase0_ptr = phase_bsearch(comp0_ptr->Get_name().c_str(), &k, FALSE); + class phase *phase1_ptr = phase_bsearch(comp1_ptr->Get_name().c_str(), &k, FALSE); if (phase0_ptr == NULL || phase1_ptr == NULL) { input_error++; @@ -5356,7 +5356,7 @@ tidy_master_isotope(void) /* ---------------------------------------------------------------------- */ { int i; - struct master *master_ptr; + class master *master_ptr; for (i = 0; i < (int)master_isotope.size(); i++) { @@ -5392,9 +5392,9 @@ tidy_isotope_ratios(void) /* ---------------------------------------------------------------------- */ { int i; - struct master *master_ptr; - struct master_isotope *master_isotope_ptr; - struct calculate_value *calculate_value_ptr; + class master *master_ptr; + class master_isotope *master_isotope_ptr; + class calculate_value *calculate_value_ptr; for (i = 0; i < (int)isotope_ratio.size(); i++) { @@ -5439,8 +5439,8 @@ tidy_isotope_alphas(void) /* ---------------------------------------------------------------------- */ { int i; - struct calculate_value *calculate_value_ptr; - struct logk *logk_ptr; + class calculate_value *calculate_value_ptr; + class logk *logk_ptr; for (i = 0; i < (int)isotope_alpha.size(); i++) { @@ -5533,7 +5533,7 @@ tidy_exchange(void) for (; kit != nd.end(); kit++) { /* Find master species */ - struct element *elt_ptr = element_store(kit->first.c_str()); + class element *elt_ptr = element_store(kit->first.c_str()); if (elt_ptr == NULL || elt_ptr->master == NULL) { input_error++; diff --git a/transport.cpp b/transport.cpp index 3c8a00e4..29998930 100644 --- a/transport.cpp +++ b/transport.cpp @@ -39,9 +39,9 @@ struct CT /* summed parts of V_M and mcd transfer in a timestep for all cells, f LDBLE A_ij_il, Dz2c_il, mixf_il; int J_ij_count_spec, J_ij_il_count_spec; struct V_M *v_m, *v_m_il; - struct J_ij *J_ij, *J_ij_il; + class J_ij *J_ij, *J_ij_il; int count_m_s; - struct M_S *m_s; + class M_S *m_s; int v_m_size, J_ij_size, m_s_size; } *ct = NULL; struct MOLES_ADDED /* total moles added to balance negative conc's */ @@ -97,7 +97,7 @@ transport(void) if (multi_Dflag) { - sol_D = (struct sol_D *) PHRQ_malloc((size_t) (all_cells)* sizeof(struct sol_D)); + sol_D = (class sol_D *) PHRQ_malloc((size_t) (all_cells)* sizeof(class sol_D)); if (sol_D == NULL) malloc_error(); for (i = 0; i < all_cells; i++) @@ -994,16 +994,16 @@ transport_cleanup(void) { for (i = 0; i < all_cells; i++) { - sol_D[i].spec = (struct spec *) free_check_null(sol_D[i].spec); + sol_D[i].spec = (class spec *) free_check_null(sol_D[i].spec); } - sol_D = (struct sol_D *) free_check_null(sol_D); + sol_D = (class sol_D *) free_check_null(sol_D); for (int i = 0; i < all_cells; i++) { ct[i].v_m = (struct V_M *) free_check_null(ct[i].v_m); ct[i].v_m_il = (struct V_M *) free_check_null(ct[i].v_m_il); - ct[i].J_ij = (struct J_ij *) free_check_null(ct[i].J_ij); - ct[i].J_ij_il = (struct J_ij *) free_check_null(ct[i].J_ij_il); - ct[i].m_s = (struct M_S *) free_check_null(ct[i].m_s); + ct[i].J_ij = (class J_ij *) free_check_null(ct[i].J_ij); + ct[i].J_ij_il = (class J_ij *) free_check_null(ct[i].J_ij_il); + ct[i].m_s = (class M_S *) free_check_null(ct[i].m_s); } ct = (struct CT *) free_check_null(ct); for (int i = 0; i < count_moles_added; i++) @@ -1796,8 +1796,8 @@ fill_spec(int l_cell_no, int ref_cell) int i, i1, i2, i3, count_spec, count_exch_spec, size_xt; char token[MAX_LENGTH]; const char * name; - struct species *s_ptr, *s_ptr2; - struct master *master_ptr; + class species *s_ptr, *s_ptr2; + class master *master_ptr; LDBLE dum, dum2; LDBLE lm; LDBLE por, por_il, viscos_f, viscos_il_f, viscos; @@ -1813,15 +1813,15 @@ fill_spec(int l_cell_no, int ref_cell) dif_spec_names.clear(); size_xt = 5; - //sol_D[l_cell_no].spec = (struct spec *) free_check_null(sol_D[l_cell_no].spec); + //sol_D[l_cell_no].spec = (class spec *) free_check_null(sol_D[l_cell_no].spec); if (sol_D[l_cell_no].spec == NULL) { - sol_D[l_cell_no].spec = (struct spec *) PHRQ_malloc((species_list.size() + (size_t)size_xt) * sizeof(struct spec)); + sol_D[l_cell_no].spec = (class spec *) PHRQ_malloc((species_list.size() + (size_t)size_xt) * sizeof(class spec)); sol_D[l_cell_no].spec_size = (int)species_list.size() + size_xt; } else if ((int)species_list.size() + size_xt > sol_D[l_cell_no].spec_size) { - sol_D[l_cell_no].spec = (struct spec *) PHRQ_realloc(sol_D[l_cell_no].spec, (species_list.size() + (size_t)size_xt) * sizeof(struct spec)); + sol_D[l_cell_no].spec = (class spec *) PHRQ_realloc(sol_D[l_cell_no].spec, (species_list.size() + (size_t)size_xt) * sizeof(class spec)); sol_D[l_cell_no].spec_size = (int)species_list.size() + size_xt; } if (sol_D[l_cell_no].spec == NULL) @@ -1885,7 +1885,7 @@ fill_spec(int l_cell_no, int ref_cell) if (species_list.size() > 1) { qsort(&species_list[0], species_list.size(), - sizeof(struct species_list), sort_species_name); + sizeof(class species_list), sort_species_name); } for (i = 0; i < (int)species_list.size(); i++) @@ -2025,15 +2025,15 @@ fill_spec(int l_cell_no, int ref_cell) i3 = i2 - i1; if (i3 + count_spec + 1 > sol_D[l_cell_no].spec_size) { - sol_D[l_cell_no].spec = (struct spec *) PHRQ_realloc(sol_D[l_cell_no].spec, - ((size_t)i3 + count_spec + 1 + (size_t)size_xt) * sizeof(struct spec)); + sol_D[l_cell_no].spec = (class spec *) PHRQ_realloc(sol_D[l_cell_no].spec, + ((size_t)i3 + count_spec + 1 + (size_t)size_xt) * sizeof(class spec)); if (sol_D[l_cell_no].spec == NULL) malloc_error(); sol_D[l_cell_no].spec_size = i3 + count_spec + 1 + size_xt; } for (; i1 < i2; i1++) // i1 is loop variable { - memmove(&sol_D[l_cell_no].spec[i1], &sol_D[ref_cell].spec[i1], sizeof(struct spec)); + memmove(&sol_D[l_cell_no].spec[i1], &sol_D[ref_cell].spec[i1], sizeof(class spec)); sol_D[l_cell_no].spec[i1].c = 0.0; sol_D[l_cell_no].spec[i1].a = 0.0; sol_D[l_cell_no].spec[i1].lm = min_dif_LM; @@ -2047,8 +2047,8 @@ fill_spec(int l_cell_no, int ref_cell) } if (count_spec >= sol_D[l_cell_no].spec_size) { - sol_D[l_cell_no].spec = (struct spec *) PHRQ_realloc(sol_D[l_cell_no].spec, - (count_spec + (size_t)size_xt) * sizeof(struct spec)); + sol_D[l_cell_no].spec = (class spec *) PHRQ_realloc(sol_D[l_cell_no].spec, + (count_spec + (size_t)size_xt) * sizeof(class spec)); if (sol_D[l_cell_no].spec == NULL) malloc_error(); sol_D[l_cell_no].spec_size = count_spec + size_xt; @@ -2099,8 +2099,8 @@ fill_spec(int l_cell_no, int ref_cell) i2 = sol_D[i1].count_spec + 1; if (i2 > sol_D[i1].spec_size) { - sol_D[i1].spec = (struct spec *) PHRQ_realloc(sol_D[i1].spec, - ((size_t)i2 + (size_t)size_xt) * sizeof(struct spec)); + sol_D[i1].spec = (class spec *) PHRQ_realloc(sol_D[i1].spec, + ((size_t)i2 + (size_t)size_xt) * sizeof(class spec)); if (sol_D[i1].spec == NULL) malloc_error(); sol_D[i1].spec_size = i2 + size_xt; @@ -2109,7 +2109,7 @@ fill_spec(int l_cell_no, int ref_cell) for (; i2 > i3; i2--) // i2 is loop variable sol_D[i1].spec[i2] = sol_D[i1].spec[i2 - 1]; - memmove(&sol_D[i1].spec[i2], &sol_D[l_cell_no].spec[i2], sizeof(struct spec)); + memmove(&sol_D[i1].spec[i2], &sol_D[l_cell_no].spec[i2], sizeof(class spec)); sol_D[i1].spec[i2].a = 0.0; sol_D[i1].spec[i2].lm = min_dif_LM; sol_D[i1].spec[i2].lg = -0.04; @@ -2128,15 +2128,15 @@ fill_spec(int l_cell_no, int ref_cell) i3 = (int) dif_spec_names.size(); if (i3 > sol_D[l_cell_no].spec_size) { - sol_D[l_cell_no].spec = (struct spec *) PHRQ_realloc(sol_D[l_cell_no].spec, - ((size_t)i3 + (size_t)size_xt) * sizeof(struct spec)); + sol_D[l_cell_no].spec = (class spec *) PHRQ_realloc(sol_D[l_cell_no].spec, + ((size_t)i3 + (size_t)size_xt) * sizeof(class spec)); if (sol_D[l_cell_no].spec == NULL) malloc_error(); sol_D[l_cell_no].spec_size = i3 + size_xt; } for (i1 = count_spec; i1 < i3; i1++) { - memmove(&sol_D[l_cell_no].spec[i1], &sol_D[ref_cell].spec[i1], sizeof(struct spec)); + memmove(&sol_D[l_cell_no].spec[i1], &sol_D[ref_cell].spec[i1], sizeof(class spec)); sol_D[l_cell_no].spec[i1].c = 0.0; sol_D[l_cell_no].spec[i1].a = 0.0; sol_D[l_cell_no].spec[i1].lm = min_dif_LM; @@ -2176,10 +2176,10 @@ int Phreeqc:: sort_species_name(const void *ptr1, const void *ptr2) /* ---------------------------------------------------------------------- */ { - const struct species_list *nptr1, *nptr2; + const class species_list *nptr1, *nptr2; - nptr1 = (const struct species_list *) ptr1; - nptr2 = (const struct species_list *) ptr2; + nptr1 = (const class species_list *) ptr1; + nptr2 = (const class species_list *) ptr2; return (strcmp(nptr1->s->name, nptr2->s->name)); } @@ -2846,15 +2846,15 @@ diffuse_implicit(LDBLE DDt, int stagnant) // Translate transport of the solute species into master species... ct[i].count_m_s = count_m_s; if (ct[i].m_s_size == 0 && ct[i].m_s != NULL) - ct[i].m_s = (struct M_S *) free_check_null(ct[i].m_s); + ct[i].m_s = (class M_S *) free_check_null(ct[i].m_s); if (ct[i].m_s == NULL) { - ct[i].m_s = (struct M_S *) PHRQ_malloc((count_m_s + 5) * sizeof(struct M_S)); + ct[i].m_s = (class M_S *) PHRQ_malloc((count_m_s + 5) * sizeof(class M_S)); ct[i].m_s_size = count_m_s + 5; } else if (count_m_s > ct[i].m_s_size) { - ct[i].m_s = (struct M_S *) PHRQ_realloc(ct[i].m_s, (count_m_s + 5) * sizeof(struct M_S)); + ct[i].m_s = (class M_S *) PHRQ_realloc(ct[i].m_s, (count_m_s + 5) * sizeof(class M_S)); ct[i].m_s_size = count_m_s + 5; } if (ct[i].m_s == NULL) @@ -3385,11 +3385,11 @@ multi_D(LDBLE DDt, int mobile_cell, int stagnant) if (!il_calcs) { tot1_h = tot1_o = tot2_h = tot2_o = 0.0; - m_s = (struct M_S *) free_check_null(m_s); + m_s = (class M_S *) free_check_null(m_s); count_m_s = (ct[icell].J_ij_count_spec < count_moles_added ? ct[icell].J_ij_count_spec : count_moles_added); - m_s = (struct M_S *) PHRQ_malloc((size_t) count_m_s * - sizeof(struct M_S)); + m_s = (class M_S *) PHRQ_malloc((size_t) count_m_s * + sizeof(class M_S)); if (m_s == NULL) malloc_error(); for (i1 = 0; i1 < count_m_s; i1++) @@ -3564,15 +3564,15 @@ multi_D(LDBLE DDt, int mobile_cell, int stagnant) } } - m_s = (struct M_S *) free_check_null(m_s); + m_s = (class M_S *) free_check_null(m_s); for (i = first_c; i < last_c2; i++) { if (stagnant && i > first_c && i <= count_cells + first_c) continue; - ct[i].J_ij = (struct J_ij *) free_check_null(ct[i].J_ij); + ct[i].J_ij = (class J_ij *) free_check_null(ct[i].J_ij); if (il_calcs) - ct[i].J_ij_il = (struct J_ij *) free_check_null(ct[i].J_ij_il); + ct[i].J_ij_il = (class J_ij *) free_check_null(ct[i].J_ij_il); ct[i].v_m = (struct V_M *) free_check_null(ct[i].v_m); } if (dVtemp && stagnant) @@ -3585,7 +3585,7 @@ multi_D(LDBLE DDt, int mobile_cell, int stagnant) /* ---------------------------------------------------------------------- */ int Phreeqc:: -fill_m_s(struct J_ij *l_J_ij, int l_J_ij_count_spec, int icell, int stagnant) +fill_m_s(class J_ij *l_J_ij, int l_J_ij_count_spec, int icell, int stagnant) /* ---------------------------------------------------------------------- */ { /* sum up the primary or secondary master_species from solute species @@ -4042,12 +4042,12 @@ find_J(int icell, int jcell, LDBLE mixf, LDBLE DDt, int stagnant) if (ct[icell].J_ij == NULL) { - ct[icell].J_ij = (struct J_ij *) PHRQ_malloc((size_t)(k) * sizeof(struct J_ij)); + ct[icell].J_ij = (class J_ij *) PHRQ_malloc((size_t)(k) * sizeof(class J_ij)); ct[icell].J_ij_size = k; } else if (k > ct[icell].J_ij_size) { - ct[icell].J_ij = (struct J_ij *) PHRQ_realloc(ct[icell].J_ij, (size_t)(k) * sizeof(struct J_ij)); + ct[icell].J_ij = (class J_ij *) PHRQ_realloc(ct[icell].J_ij, (size_t)(k) * sizeof(class J_ij)); ct[icell].J_ij_size = k; } if (ct[icell].J_ij == NULL) @@ -4085,8 +4085,8 @@ find_J(int icell, int jcell, LDBLE mixf, LDBLE DDt, int stagnant) /* also for interlayer cations */ k = sol_D[icell].count_exch_spec + sol_D[jcell].count_exch_spec; - ct[icell].J_ij_il = (struct J_ij *) free_check_null(ct[icell].J_ij_il); - ct[icell].J_ij_il = (struct J_ij *) PHRQ_malloc((size_t) k * sizeof(struct J_ij)); + ct[icell].J_ij_il = (class J_ij *) free_check_null(ct[icell].J_ij_il); + ct[icell].J_ij_il = (class J_ij *) PHRQ_malloc((size_t) k * sizeof(class J_ij)); if (ct[icell].J_ij_il == NULL) malloc_error(); @@ -4539,9 +4539,9 @@ dV_dcell2: /* express the transfer in elemental moles... */ tot1_h = tot1_o = tot2_h = tot2_o = 0.0; - m_s = (struct M_S *) free_check_null(m_s); - m_s = (struct M_S *) PHRQ_malloc((size_t) count_moles_added * - sizeof(struct M_S)); + m_s = (class M_S *) free_check_null(m_s); + m_s = (class M_S *) PHRQ_malloc((size_t) count_moles_added * + sizeof(class M_S)); if (m_s == NULL) malloc_error(); for (i1 = 0; i1 < count_moles_added; i1++) @@ -4580,7 +4580,7 @@ dV_dcell2: /* transfer O and H... */ for (; it != nd.end(); it++) { - struct element *elt_ptr = element_store(it->first.c_str()); + class element *elt_ptr = element_store(it->first.c_str()); LDBLE coef = it->second; if (strcmp("H", elt_ptr->name) == 0) { @@ -4620,7 +4620,7 @@ dV_dcell2: cxxNameDouble::iterator it = nd.begin(); for (; it != nd.end(); it++) { - struct element *elt_ptr = element_store(it->first.c_str()); + class element *elt_ptr = element_store(it->first.c_str()); LDBLE coef = it->second; if (strcmp(m_s[j].name, elt_ptr->name) != 0) continue; @@ -4665,7 +4665,7 @@ dV_dcell2: /* transfer O and H... */ for (; it != nd.end(); it++) { - struct element *elt_ptr = element_store(it->first.c_str()); + class element *elt_ptr = element_store(it->first.c_str()); LDBLE coef = it->second; if (strcmp("H", elt_ptr->name) == 0) @@ -4705,7 +4705,7 @@ dV_dcell2: cxxNameDouble::iterator it = nd.begin(); for (; it != nd.end(); it++) { - struct element *elt_ptr = element_store(it->first.c_str()); + class element *elt_ptr = element_store(it->first.c_str()); LDBLE coef = it->second; if (strcmp(m_s[j].name, elt_ptr->name) != 0) continue; @@ -6033,7 +6033,7 @@ calc_vm_Cl(void) */ LDBLE V_Cl = 0; LDBLE pb_s = 2600. + patm_x * 1.01325, TK_s = tc_x + 45.15, sqrt_mu = sqrt(mu_x); - struct species *s_ptr; + class species *s_ptr; s_ptr = s_search("Cl-"); if (!s_ptr) diff --git a/utilities.cpp b/utilities.cpp index 4e5a28cc..23f310ec 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -13,10 +13,10 @@ calc_alk(CReaction& rxn_ref) /* ---------------------------------------------------------------------- */ { LDBLE return_value; - struct master* master_ptr; + class master* master_ptr; return_value = 0.0; - struct rxn_token* r_token = &rxn_ref.token[1]; + class rxn_token* r_token = &rxn_ref.token[1]; while (r_token->s != NULL) { master_ptr = r_token->s->secondary;