diff --git a/ExchComp.cxx b/ExchComp.cxx index 2a52469b..b01b1b0f 100644 --- a/ExchComp.cxx +++ b/ExchComp.cxx @@ -38,27 +38,6 @@ cxxExchComp::cxxExchComp(PHRQ_io *io) formula_z = 0.0; } #ifdef SKIP -cxxExchComp::cxxExchComp(struct exch_comp * exch_comp_ptr, PHRQ_io *io) - // - // constructor for cxxExchComp from struct exch_comp - // -: -PHRQ_base(io), -formula_totals(exch_comp_ptr->formula_totals), totals(exch_comp_ptr->totals) -{ - this->Set_formula(exch_comp_ptr->formula); - moles = exch_comp_ptr->moles; - // totals in constructor - //formula_totals in constructor - la = exch_comp_ptr->la; - charge_balance = exch_comp_ptr->charge_balance; - this->Set_phase_name(exch_comp_ptr->phase_name); - phase_proportion = exch_comp_ptr->phase_proportion; - this->Set_rate_name(exch_comp_ptr->rate_name); - formula_z = exch_comp_ptr->formula_z; -} -#endif -#ifdef SKIP cxxExchComp::cxxExchComp(std::vector < cxxExchComp > &ec_vector, std::vector < double >&f_vector) // diff --git a/ExchComp.h b/ExchComp.h index e01202c6..efdfe2c7 100644 --- a/ExchComp.h +++ b/ExchComp.h @@ -14,7 +14,6 @@ class cxxExchComp: public PHRQ_base public: cxxExchComp(PHRQ_io *io=NULL); - //cxxExchComp(struct exch_comp *, PHRQ_io *io=NULL); ~cxxExchComp(); void dump_xml(std::ostream & os, unsigned int indent = 0) const; diff --git a/Exchange.cxx b/Exchange.cxx index d620561a..922d5470 100644 --- a/Exchange.cxx +++ b/Exchange.cxx @@ -31,32 +31,6 @@ cxxExchange::cxxExchange(PHRQ_io *io) n_solution = -999; pitzer_exchange_gammas = true; } -#ifdef SKIP -cxxExchange::cxxExchange(struct exchange * exchange_ptr, PHRQ_io *io) - // - // constructor for cxxExchange from struct exchange - // -: -cxxNumKeyword(io) -{ - int i; - - this->Set_description(exchange_ptr->description); - n_user = exchange_ptr->n_user; - n_user_end = exchange_ptr->n_user_end; - pitzer_exchange_gammas = (exchange_ptr->pitzer_exchange_gammas == TRUE); - for (i = 0; i < exchange_ptr->count_comps; i++) - { - cxxExchComp ec(&(exchange_ptr->comps[i]), this->Get_io()); - std::string str(ec.Get_formula()); - exchComps[str] = ec; - } - - - - -} -#endif cxxExchange::cxxExchange(const std::map < int, cxxExchange > &entities, cxxMix & mix, int l_n_user, PHRQ_io *io): cxxNumKeyword(io) diff --git a/Exchange.h b/Exchange.h index 743a5154..9c4221c2 100644 --- a/Exchange.h +++ b/Exchange.h @@ -16,7 +16,6 @@ class cxxExchange:public cxxNumKeyword public: cxxExchange(PHRQ_io *io=NULL); - //cxxExchange(struct exchange *, PHRQ_io *io=NULL); cxxExchange(const std::map < int, cxxExchange > &exchange_map, cxxMix & mx, int n_user, PHRQ_io *io=NULL); ~cxxExchange(); diff --git a/Parser.cxx b/Parser.cxx index a283023a..45dd80bc 100644 --- a/Parser.cxx +++ b/Parser.cxx @@ -1245,7 +1245,8 @@ CParser::getOptionFromLastLine(const std::vector < std::string > &opt_list, pos_ptr = 0; copy_token(option, pos_ptr); next_pos = pos_ptr; - if (this->echo_file) // pr.echo_input == TRUE + //if (this->echo_file) // pr.echo_input == TRUE + if (false) { if (true) // database_file == NULL { diff --git a/Phreeqc.cpp b/Phreeqc.cpp index 11c7c810..514d3591 100644 --- a/Phreeqc.cpp +++ b/Phreeqc.cpp @@ -195,16 +195,7 @@ size_t Phreeqc::list_components(std::list &list_c) accumulator.add_extensive(r_ptr.Get_elementList(), 1.0); } } -#ifdef SKIP - { - for (i = 0; i < count_irrev; i++) - { - reaction_calc(&irrev[i]); - cxxReaction entity(&irrev[i]); - accumulator.add_extensive(entity.Get_elementList(), 1.0); - } - } -#endif + // pure phases for (i = 0; i < count_pp_assemblage; i++) { @@ -214,14 +205,6 @@ size_t Phreeqc::list_components(std::list &list_c) } // exchangers -#ifdef SKIP - for (i = 0; i < count_exchange; i++) - { - cxxExchange entity(&exchange[i], phrq_io); - entity.totalize(); - accumulator.add_extensive(entity.Get_totals(), 1.0); - } -#endif { std::map::const_iterator cit = Rxn_exchange_map.begin(); for (; cit != Rxn_exchange_map.end(); cit++) @@ -250,14 +233,7 @@ size_t Phreeqc::list_components(std::list &list_c) accumulator.add_extensive(entity.Get_totals(), 1.0); } } -#ifdef SKIP - for (i = 0; i < count_gas_phase; i++) - { - cxxGasPhase entity(&gas_phase[i], phrq_io); - entity.totalize(this); - accumulator.add_extensive(entity.Get_totals(), 1.0); - } -#endif + // solid-solutions for (i = 0; i < count_s_s_assemblage; i++) { diff --git a/Reaction.cxx b/Reaction.cxx index 0bf19517..eede6263 100644 --- a/Reaction.cxx +++ b/Reaction.cxx @@ -29,43 +29,6 @@ cxxReaction::cxxReaction(PHRQ_io *io) reactantList.type = cxxNameDouble::ND_NAME_COEF; elementList.type = cxxNameDouble::ND_ELT_MOLES; } -#ifdef SKIP -cxxReaction::cxxReaction(struct irrev *irrev_ptr, PHRQ_io *io) - // - // constructor for cxxReaction from struct irrev - // - : -cxxNumKeyword(io), -reactantList(irrev_ptr->list, irrev_ptr->count_list), -elementList(irrev_ptr->elts) -{ - int i; - - this->Set_description(irrev_ptr->description); - this->n_user = irrev_ptr->n_user; - this->n_user_end = irrev_ptr->n_user_end; - this->Set_units(irrev_ptr->units); - // steps - if (irrev_ptr->count_steps < 0) - { - for (i = 0; i < 1; i++) - { - this->steps.push_back(irrev_ptr->steps[i]); - } - this->countSteps = -irrev_ptr->count_steps; - this->equalIncrements = true; - } - else - { - for (i = 0; i < irrev_ptr->count_steps; i++) - { - this->steps.push_back(irrev_ptr->steps[i]); - } - this->countSteps = irrev_ptr->count_steps; - this->equalIncrements = false; - } -} -#endif cxxReaction::~cxxReaction() { } diff --git a/Reaction.h b/Reaction.h index 2060ae06..5b3ffe28 100644 --- a/Reaction.h +++ b/Reaction.h @@ -15,7 +15,6 @@ class cxxReaction:public cxxNumKeyword public: cxxReaction(PHRQ_io *io = NULL); - //cxxReaction(struct irrev *, PHRQ_io *io = NULL); ~cxxReaction(); //void dump_xml(std::ostream& os, unsigned int indent = 0)const; diff --git a/ReadClass.cxx b/ReadClass.cxx index 8c2b59ff..072f9d53 100644 --- a/ReadClass.cxx +++ b/ReadClass.cxx @@ -116,113 +116,6 @@ read_solution_raw(void) if (return_value == KEYWORD) echo_msg(sformatf( "\t%s\n", line)); return (return_value); } -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_exchange_raw(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads EXCHANGE_RAW data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - /* - * Accumulate lines in std string - */ - std::string keywordLines(""); - - keywordLines.append(line); - keywordLines.append("\n"); -/* - * Read additonal lines - */ - int save_echo_input = pr.echo_input; - pr.echo_input = FALSE; - for (;;) - { - return_value = check_line("exchange_raw", TRUE, TRUE, TRUE, FALSE); - /* empty, eof, keyword, print */ - if (return_value == EOF || return_value == KEYWORD) - break; - keywordLines.append(line); - keywordLines.append("\n"); - } - pr.echo_input = save_echo_input; - - std::istringstream iss_in(keywordLines); - CParser parser(iss_in, phrq_io); - assert(!reading_database()); - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - //For testing, need to read line to get started - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - cxxExchange ex(phrq_io); - ex.read_raw(parser); - int n_user = ex.Get_n_user(); - int n_user_end = ex.Get_n_user_end(); - ex.Set_n_user_end(n_user); - Rxn_exchange_map[n_user] = ex; - if (n_user_end > n_user) - { - for (int i = n_user + 1; i <= n_user_end; i++) - { - Utilities::Rxn_copy(Rxn_exchange_map, n_user, i); - } - } - -#ifdef SKIP - //struct exchange *exchange_ptr = ex.cxxExchange2exchange(PHREEQC_THIS); - struct exchange *exchange_ptr = cxxExchange2exchange(&ex); - int n; - - /* - * This is not quite right, may not produce sort order, forced sort - */ - - if (exchange_bsearch(exchange_ptr->n_user, &n) != NULL) - { - exchange_free(&exchange[n]); - exchange_copy(exchange_ptr, &exchange[n], exchange_ptr->n_user); - } - else - { - n = count_exchange++; - if (count_exchange >= max_exchange) - { - space((void **) ((void *) &(exchange)), count_exchange, - &max_exchange, sizeof(struct exchange)); - } - exchange_copy(exchange_ptr, &exchange[n], exchange_ptr->n_user); - exchange_sort(); - } - exchange_free(exchange_ptr); - free_check_null(exchange_ptr); -#endif - - // Need to output the next keyword - if (return_value == KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif /* ---------------------------------------------------------------------- */ int Phreeqc:: read_surface_raw(void) @@ -597,363 +490,6 @@ read_solid_solutions_raw(void) if (return_value == KEYWORD) echo_msg(sformatf( "\t%s\n", line)); return (return_value); } -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_gas_phase_raw(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads GAS_PHASE_RAW data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - /* - * Accumulate lines in std string - */ - std::string keywordLines(""); - - keywordLines.append(line); - keywordLines.append("\n"); -/* - * Read additonal lines - */ - int save_echo_input = pr.echo_input; - pr.echo_input = FALSE; - for (;;) - { - return_value = check_line("gas_phase_raw", TRUE, TRUE, TRUE, FALSE); - /* empty, eof, keyword, print */ - if (return_value == EOF || return_value == KEYWORD) - break; - keywordLines.append(line); - keywordLines.append("\n"); - } - pr.echo_input = save_echo_input; - - std::istringstream iss_in(keywordLines); - CParser parser(iss_in, phrq_io); - assert(!reading_database()); - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - //For testing, need to read line to get started - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - cxxGasPhase entity(phrq_io); - entity.read_raw(parser); - - Rxn_gas_phase_map[entity.Get_n_user()] = entity; - - // Need to output the next keyword - if (return_value == KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_gas_phase_raw(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads GAS_PHASE_RAW data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - /* - * Accumulate lines in std string - */ - std::string keywordLines(""); - - keywordLines.append(line); - keywordLines.append("\n"); -/* - * Read additonal lines - */ - int save_echo_input = pr.echo_input; - pr.echo_input = FALSE; - for (;;) - { - return_value = check_line("gas_phase_raw", TRUE, TRUE, TRUE, FALSE); - /* empty, eof, keyword, print */ - if (return_value == EOF || return_value == KEYWORD) - break; - keywordLines.append(line); - keywordLines.append("\n"); - } - pr.echo_input = save_echo_input; - - std::istringstream iss_in(keywordLines); - std::ostringstream oss_out; - std::ostringstream oss_err; - - CParser parser(iss_in, oss_out, oss_err, phrq_io); - assert(!reading_database()); - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - //For testing, need to read line to get started - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - cxxGasPhase ex(phrq_io); - ex.read_raw(parser); - //struct gas_phase *gas_phase_ptr = ex.cxxGasPhase2gas_phase(PHREEQC_THIS); - struct gas_phase *gas_phase_ptr = cxxGasPhase2gas_phase(&ex); - int n; - - /* - * This is not quite right, may not produce sort order, forced sort - */ - - if (gas_phase_bsearch(gas_phase_ptr->n_user, &n) != NULL) - { - gas_phase_free(&gas_phase[n]); - gas_phase_copy(gas_phase_ptr, &gas_phase[n], gas_phase_ptr->n_user); - } - else - { - n = count_gas_phase++; - if (count_gas_phase >= max_gas_phase) - { - space((void **) ((void *) &(gas_phase)), count_gas_phase, - &max_gas_phase, sizeof(struct gas_phase)); - } - gas_phase_copy(gas_phase_ptr, &gas_phase[n], gas_phase_ptr->n_user); - gas_phase_sort(); - } - gas_phase_free(gas_phase_ptr); - free_check_null(gas_phase_ptr); - - // Need to output the next keyword - if (return_value == KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_reaction_raw(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads REACTION_RAW data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - /* - * Accumulate lines in std string - */ - std::string keywordLines(""); - - keywordLines.append(line); - keywordLines.append("\n"); -/* - * Read additonal lines - */ - int save_echo_input = pr.echo_input; - pr.echo_input = FALSE; - for (;;) - { - return_value = check_line("reaction_raw", TRUE, TRUE, TRUE, FALSE); - /* empty, eof, keyword, print */ - if (return_value == EOF || return_value == KEYWORD) - break; - keywordLines.append(line); - keywordLines.append("\n"); - } - pr.echo_input = save_echo_input; - - std::istringstream iss_in(keywordLines); - - CParser parser(iss_in, phrq_io); - assert(!reading_database()); - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - //For testing, need to read line to get started - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - cxxReaction ex; - ex.read_raw(parser, true); - //struct irrev *irrev_ptr = ex.cxxReaction2irrev(PHREEQC_THIS); - struct irrev *irrev_ptr = cxxReaction2irrev(&ex); - int n; - - /* - * This is not quite right, may not produce sort order, forced sort - */ - - if (irrev_bsearch(irrev_ptr->n_user, &n) != NULL) - { - irrev_free(&irrev[n]); - irrev_copy(irrev_ptr, &irrev[n], irrev_ptr->n_user); - } - else - { - n = count_irrev++; - irrev = - (struct irrev *) PHRQ_realloc(irrev, - (size_t) count_irrev * - sizeof(struct irrev)); - if (irrev == NULL) - malloc_error(); - irrev_copy(irrev_ptr, &irrev[n], irrev_ptr->n_user); - irrev_sort(); - } - irrev_free(irrev_ptr); - free_check_null(irrev_ptr); - - // Need to output the next keyword - if (return_value == KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_mix_raw(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads MIX (_RAW) data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - /* - * Accumulate lines in std string - */ - std::string keywordLines(""); - - keywordLines.append(line); - keywordLines.append("\n"); -/* - * Read additonal lines - */ - int save_echo_input = pr.echo_input; - pr.echo_input = FALSE; - for (;;) - { - return_value = check_line("mix_raw", TRUE, TRUE, TRUE, FALSE); - /* empty, eof, keyword, print */ - if (return_value == EOF || return_value == KEYWORD) - break; - keywordLines.append(line); - keywordLines.append("\n"); - } - pr.echo_input = save_echo_input; - - std::istringstream iss_in(keywordLines); - std::ostringstream oss_out; - std::ostringstream oss_err; - - CParser parser(iss_in, oss_out, oss_err, phrq_io); - assert(!reading_database()); - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - //For testing, need to read line to get started - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - cxxMix ex(phrq_io); - ex.read_raw(parser); - //struct mix *mix_ptr = ex.cxxMix2mix(PHREEQC_THIS); - struct mix *mix_ptr = cxxMix2mix(&ex); - int n; - - /* - * This is not quite right, may not produce sort order, forced sort - */ - - if (mix_bsearch(mix_ptr->n_user, &n) != NULL) - { - mix_free(&mix[n]); - mix_copy(mix_ptr, &mix[n], mix_ptr->n_user); - } - else - { - n = count_mix++; - mix = - (struct mix *) PHRQ_realloc(mix, - (size_t) count_mix * - sizeof(struct mix)); - if (mix == NULL) - malloc_error(); - mix_copy(mix_ptr, &mix[n], mix_ptr->n_user); - mix_sort(); - } - mix_free(mix_ptr); - free_check_null(mix_ptr); - - // Need to output the next keyword - if (return_value == KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif /* ---------------------------------------------------------------------- */ int Phreeqc:: read_dump(void) @@ -1290,150 +826,6 @@ read_equilibrium_phases_modify(void) if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line)); return (return_value); } -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_exchange_modify(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads EXCHANGE_MODIFY data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - - // find exchange number - char token[MAX_LENGTH]; - char *next; - int l, n_user; - next = line; - copy_token(token, &next, &l); - if (copy_token(token, &next, &l) != DIGIT) - { - input_error++; - error_string = sformatf( "Expected exchange number following EXCHANGE_MODIFY.\n%s\n", line_save); - error_msg(error_string, CONTINUE); - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - return (ERROR); - } - else - { - sscanf(token,"%d", &n_user); - } - - /* - * Make parser - */ - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - CParser parser(iss_in, phrq_io); - assert(!reading_database()); - - //For testing, need to read line to get started - parser.set_echo_file(CParser::EO_NONE); - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - - cxxExchange * entity = Utilities::Rxn_find(Rxn_exchange_map, n_user); - if (entity == NULL) - { - input_error++; - error_string = sformatf( "Exchange %d not found for EXCHANGE_MODIFY.\n", n_user); - error_msg(error_string, CONTINUE); - return (ERROR); - } - - // read entity - entity->read_raw(parser, false); - - /* recalculate formula_totals */ - std::map::iterator cit = entity->Get_exchComps().begin(); - for ( ; cit != entity->Get_exchComps().end(); cit++) - { - char * temp_formula = string_duplicate(cit->second.Get_formula().c_str()); - char *ptr = temp_formula; - - count_elts = 0; - paren_count = 0; - get_elts_in_species(&ptr, 1.0); - - cxxNameDouble nd(elt_list_save()); - //exchange[n].comps[i].formula_totals = elt_list_save(); - //free_check_null(temp_formula); - cit->second.Set_formula_totals(elt_list_save()); - } - - - -#ifdef SKIP - if (exchange_bsearch(n_user, &n) == NULL) - { - input_error++; - error_string = sformatf( "Exchange %d not found for EXCHANGE_MODIFY.\n", n_user); - error_msg(error_string, CONTINUE); - return (ERROR); - } - - // read entity - cxxExchange entity(&(exchange[n]), phrq_io); - entity.read_raw(parser, false); - - // save entity - //struct exchange *entity_ptr = entity.cxxExchange2exchange(PHREEQC_THIS); - struct exchange *entity_ptr = cxxExchange2exchange(&entity); - exchange_free(&(exchange[n])); - exchange_copy(entity_ptr, &(exchange[n]), entity_ptr->n_user); - - /* tidy description and n_user_end */ - free_check_null(exchange[n].description); - exchange[n].description = string_duplicate(entity_ptr->description); - exchange[n].n_user_end = exchange[n].n_user; - - /* recalculate formula_totals */ - int i; - for (i = 0; i < exchange[n].count_comps; i++) - { - count_elts = 0; - paren_count = 0; - char * temp_formula = string_duplicate(exchange[n].comps[i].formula); - char *ptr = temp_formula; - get_elts_in_species(&ptr, 1.0); - free_check_null(exchange[n].comps[i].formula_totals); - exchange[n].comps[i].formula_totals = elt_list_save(); - free_check_null(temp_formula); - } - - - //exchange[n].new_def = TRUE; - exchange_free(entity_ptr); - free_check_null(entity_ptr); -#endif - - // Need to output the next keyword - if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif /* ---------------------------------------------------------------------- */ int Phreeqc:: read_surface_modify(void) @@ -1610,175 +1002,6 @@ read_solid_solutions_modify(void) if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line)); return (return_value); } -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_gas_phase_modify(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads GAS_PHASE_MODIFY data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - // find gas_phase number - char token[MAX_LENGTH]; - char *next; - int l, n_user; - next = line; - copy_token(token, &next, &l); - if (copy_token(token, &next, &l) != DIGIT) - { - input_error++; - error_string = sformatf( "Expected gas_phase number following GAS_PHASE_MODIFY.\n%s\n", line_save); - error_msg(error_string, CONTINUE); - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - return (ERROR); - } - else - { - sscanf(token,"%d", &n_user); - } - /* - * Make parser - */ - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - CParser parser(iss_in, phrq_io); - assert(!reading_database()); - - //For testing, need to read line to get started - parser.set_echo_file(CParser::EO_NONE); - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - - cxxGasPhase *gas_phase_ptr = Utilities::Rxn_find(Rxn_gas_phase_map, n_user); - if (gas_phase_ptr == NULL) - { - input_error++; - error_string = sformatf( "Gas_phase %d not found for GAS_PHASE_MODIFY.\n", n_user); - error_msg(error_string, CONTINUE); - return (ERROR); - } - - // read entity - gas_phase_ptr->read_raw(parser, false); - - // Need to output the next keyword - if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_gas_phase_modify(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads GAS_PHASE_MODIFY data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - // find gas_phase number - char token[MAX_LENGTH]; - char *next; - int l, n_user, n; - next = line; - copy_token(token, &next, &l); - if (copy_token(token, &next, &l) != DIGIT) - { - input_error++; - error_string = sformatf( "Expected gas_phase number following GAS_PHASE_MODIFY.\n%s\n", line_save); - error_msg(error_string, CONTINUE); - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - return (ERROR); - } - else - { - sscanf(token,"%d", &n_user); - } - /* - * Make parser - */ - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - std::ostringstream oss_out; - std::ostringstream oss_err; - CParser parser(iss_in, oss_out, oss_err, phrq_io); - assert(!reading_database()); - - //For testing, need to read line to get started - parser.set_echo_file(CParser::EO_NONE); - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - - if (gas_phase_bsearch(n_user, &n) == NULL) - { - input_error++; - error_string = sformatf( "Gas_phase %d not found for GAS_PHASE_MODIFY.\n", n_user); - error_msg(error_string, CONTINUE); - return (ERROR); - } - - // read entity - cxxGasPhase entity(&(gas_phase[n]), phrq_io); - entity.read_raw(parser, false); - // save entity - //struct gas_phase *entity_ptr = entity.cxxGasPhase2gas_phase(PHREEQC_THIS); - struct gas_phase *entity_ptr = cxxGasPhase2gas_phase(&entity); - gas_phase_free(&(gas_phase[n])); - gas_phase_copy(entity_ptr, &(gas_phase[n]), entity_ptr->n_user); - free_check_null(gas_phase[n].description); - gas_phase[n].description = string_duplicate(entity_ptr->description); - gas_phase_free(entity_ptr); - free_check_null(entity_ptr); - - // Need to output the next keyword - if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif /* ---------------------------------------------------------------------- */ int Phreeqc:: read_kinetics_modify(void) @@ -1867,94 +1090,6 @@ read_kinetics_modify(void) if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line)); return (return_value); } -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_reaction_modify(void) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads REACTION_MODIFY data block - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - // find gas_phase number - char token[MAX_LENGTH]; - char *next; - int l, n_user, n; - next = line; - copy_token(token, &next, &l); - if (copy_token(token, &next, &l) != DIGIT) - { - input_error++; - error_string = sformatf( "Expected reaction number following REACTION_MODIFY.\n%s\n", line_save); - error_msg(error_string, CONTINUE); - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - return (ERROR); - } - else - { - sscanf(token,"%d", &n_user); - } - /* - * Make parser - */ - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - CParser parser(iss_in, phrq_io); - assert(!reading_database()); - - //For testing, need to read line to get started - parser.set_echo_file(CParser::EO_NONE); - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - - if (irrev_bsearch(n_user, &n) == NULL) - { - input_error++; - error_string = sformatf( "Reaction %d not found for REACTION_MODIFY.\n", n_user); - error_msg(error_string, CONTINUE); - return (ERROR); - } - - // read entity - cxxReaction entity(&(irrev[n])); - entity.read_raw(parser, false); - // save entity - //struct irrev *entity_ptr = entity.cxxReaction2irrev(PHREEQC_THIS); - struct irrev *entity_ptr = cxxReaction2irrev(&entity); - irrev_free(&(irrev[n])); - irrev_copy(entity_ptr, &(irrev[n]), entity_ptr->n_user); - free_check_null(irrev[n].description); - irrev[n].description = string_duplicate(entity_ptr->description); - irrev_free(entity_ptr); - free_check_null(entity_ptr); - - // Need to output the next keyword - if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif /* ---------------------------------------------------------------------- */ int Phreeqc:: streamify_to_next_keyword(std::istringstream & lines) @@ -2122,29 +1257,6 @@ delete_entities(void) } } } -#ifdef SKIP - if (delete_info.Get_exchange().Get_defined()) - { - if (delete_info.Get_exchange().Get_numbers().size() == 0) - { - for (i = 0; i < count_exchange; i++) - { - exchange_delete(exchange[i].n_user); - } - } - else - { - std::set < int >::iterator it; - for (it = delete_info.Get_exchange().Get_numbers().begin(); it != delete_info.Get_exchange().Get_numbers().end(); it++) - { - if (exchange_bsearch(*it, &n) != NULL) - { - exchange_delete(*it); - } - } - } - } -#endif // surfaces if (delete_info.Get_surface().Get_defined()) { @@ -2207,29 +1319,6 @@ delete_entities(void) } } } -#ifdef SKIP - if (delete_info.Get_gas_phase().Get_defined()) - { - if (delete_info.Get_gas_phase().Get_numbers().size() == 0) - { - for (i = 0; i < count_gas_phase; i++) - { - gas_phase_delete(gas_phase[i].n_user); - } - } - else - { - std::set < int >::iterator it; - for (it = delete_info.Get_gas_phase().Get_numbers().begin(); it != delete_info.Get_gas_phase().Get_numbers().end(); it++) - { - if (gas_phase_bsearch(*it, &n) != NULL) - { - gas_phase_delete(*it); - } - } - } - } -#endif // kineticss if (delete_info.Get_kinetics().Get_defined()) { @@ -2268,29 +1357,6 @@ delete_entities(void) } } } -#ifdef SKIP - if (delete_info.Get_mix().Get_defined()) - { - if (delete_info.Get_mix().Get_numbers().size() == 0) - { - for (i = 0; i < count_mix; i++) - { - mix_delete(mix[i].n_user); - } - } - else - { - std::set < int >::iterator it; - for (it = delete_info.Get_mix().Get_numbers().begin(); it != delete_info.Get_mix().Get_numbers().end(); it++) - { - if (mix_bsearch(*it, &n) != NULL) - { - mix_delete(*it); - } - } - } - } -#endif // reactions if (delete_info.Get_reaction().Get_defined()) { @@ -2307,29 +1373,6 @@ delete_entities(void) } } } -#ifdef SKIP - if (delete_info.Get_reaction().Get_defined()) - { - if (delete_info.Get_reaction().Get_numbers().size() == 0) - { - for (i = 0; i < count_irrev; i++) - { - irrev_delete(irrev[i].n_user); - } - } - else - { - std::set < int >::iterator it; - for (it = delete_info.Get_reaction().Get_numbers().begin(); it != delete_info.Get_reaction().Get_numbers().end(); it++) - { - if (irrev_bsearch(*it, &n) != NULL) - { - irrev_delete(*it); - } - } - } - } -#endif // temperatures if (delete_info.Get_temperature().Get_defined()) { @@ -2665,32 +1708,7 @@ dump_ostream(std::ostream& os) } } } -#ifdef SKIP - if (dump_info.Get_bool_exchange()) - { - if (dump_info.Get_exchange().size() == 0) - { - for (i = 0; i < count_exchange; i++) - { - cxxExchange cxxentity(&exchange[i], phrq_io); - cxxentity.dump_raw(os,0); - } - } - else - { - std::set < int >::iterator it; - for (it = dump_info.Get_exchange().begin(); it != dump_info.Get_exchange().end(); it++) - { - if (exchange_bsearch(*it, &n) != NULL) - { - cxxExchange cxxentity(&exchange[n], phrq_io); - cxxentity.dump_raw(os,0); - } - } - } - } -#endif // surfaces if (dump_info.Get_bool_surface()) { @@ -2764,32 +1782,7 @@ dump_ostream(std::ostream& os) } } } -#ifdef SKIP - if (dump_info.Get_bool_gas_phase()) - { - if (dump_info.Get_gas_phase().size() == 0) - { - for (i = 0; i < count_gas_phase; i++) - { - cxxGasPhase cxxentity(&gas_phase[i], phrq_io); - cxxentity.dump_raw(os,0); - } - } - else - { - std::set < int >::iterator it; - for (it = dump_info.Get_gas_phase().begin(); it != dump_info.Get_gas_phase().end(); it++) - { - if (gas_phase_bsearch(*it, &n) != NULL) - { - cxxGasPhase cxxentity(&gas_phase[n], phrq_io); - cxxentity.dump_raw(os,0); - } - } - } - } -#endif // kinetics if (dump_info.Get_bool_kinetics()) { @@ -2837,32 +1830,7 @@ dump_ostream(std::ostream& os) } } } -#ifdef SKIP - if (dump_info.Get_bool_mix()) - { - if (dump_info.Get_mix().size() == 0) - { - for (i = 0; i < count_mix; i++) - { - cxxMix cxxentity(&mix[i], phrq_io); - cxxentity.dump_raw(os,0); - } - } - else - { - std::set < int >::iterator it; - for (it = dump_info.Get_mix().begin(); it != dump_info.Get_mix().end(); it++) - { - if (mix_bsearch(*it, &n) != NULL) - { - cxxMix cxxentity(&mix[n], phrq_io); - cxxentity.dump_raw(os,0); - } - } - } - } -#endif // reaction if (dump_info.Get_bool_reaction()) { @@ -2884,32 +1852,7 @@ dump_ostream(std::ostream& os) } } } -#ifdef SKIP - if (dump_info.Get_bool_reaction()) - { - if (dump_info.Get_reaction().size() == 0) - { - for (i = 0; i < count_irrev; i++) - { - cxxReaction cxxentity(&irrev[i]); - cxxentity.dump_raw(os,0); - } - } - else - { - std::set < int >::iterator it; - for (it = dump_info.Get_reaction().begin(); it != dump_info.Get_reaction().end(); it++) - { - if (irrev_bsearch(*it, &n) != NULL) - { - cxxReaction cxxentity(&irrev[n]); - cxxentity.dump_raw(os,0); - } - } - } - } -#endif // temperature if (dump_info.Get_bool_temperature()) { @@ -3015,85 +1958,3 @@ read_user_graph_handler(void) return (return_value); } #endif -#ifdef SKIP -/* ---------------------------------------------------------------------- */ -int Phreeqc:: -read_generic(Keywords::KEYWORDS key) -/* ---------------------------------------------------------------------- */ -{ -/* - * Reads _raw and _modify data blocks - * - * Arguments: - * none - * - * Returns: - * KEYWORD if keyword encountered, input_error may be incremented if - * a keyword is encountered in an unexpected position - * EOF if eof encountered while reading mass balance concentrations - * ERROR if error occurred reading data - * - */ - int return_value; - - std::string token; - char *next; - int n_user; - next = line; - copy_token(token, &next); - if (copy_token(token, &next) != DIGIT) - { - input_error++; - error_string = sformatf( "Expected reactant number following keyword.\n%s\n", line_save); - error_msg(error_string, CONTINUE); - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - return (ERROR); - } - else - { - sscanf(token.c_str(),"%d", &n_user); - } - /* - * Make parser - */ - std::istringstream iss_in; - return_value = streamify_to_next_keyword(iss_in); - CParser parser(iss_in, phrq_io); - assert(!reading_database()); - - //For testing, need to read line to get started - parser.set_echo_file(CParser::EO_NONE); - std::vector < std::string > vopts; - std::istream::pos_type next_char; - parser.get_option(vopts, next_char); - - if (pr.echo_input == FALSE) - { - parser.set_echo_file(CParser::EO_NONE); - } - else - { - parser.set_echo_file(CParser::EO_NOKEYWORDS); - } - switch (key) - { - case Keywords::KEY_REACTION_PRESSURE_RAW: - { - cxxPressure entity(this->phrq_io); - entity.read_raw(parser); - if (entity.Get_base_error_count() == 0) - { - Rxn_pressure_map[n_user] = entity; - } - // Make copies if necessary - Utilities::Rxn_copies(Rxn_pressure_map, entity.Get_n_user(), entity.Get_n_user_end()); - } - break; - } - - // Need to output the next keyword - if (return_value == OPTION_KEYWORD) echo_msg(sformatf( "\t%s\n", line)); - return (return_value); -} -#endif \ No newline at end of file diff --git a/cxxMix.cxx b/cxxMix.cxx index e3ecf318..6e7a28e5 100644 --- a/cxxMix.cxx +++ b/cxxMix.cxx @@ -26,30 +26,7 @@ cxxMix::cxxMix(PHRQ_io *io) : cxxNumKeyword(io) { } -#ifdef SKIP -cxxMix::cxxMix(struct mix *mix_ptr, PHRQ_io *io) - // - // constructor for cxxMix from struct mix - // - : -cxxNumKeyword(io) -{ - int i; - this->Set_description(mix_ptr->description); - this->n_user = mix_ptr->n_user; - this->n_user_end = mix_ptr->n_user_end; - // comps - if (mix_ptr->count_comps > 0) - { - for (i = 0; i < mix_ptr->count_comps; i++) - { - this->mixComps[mix_ptr->comps[i].n_solution] = - mix_ptr->comps[i].fraction; - } - } -} -#endif cxxMix::~cxxMix() { } diff --git a/cxxMix.h b/cxxMix.h index b966700d..97871bc7 100644 --- a/cxxMix.h +++ b/cxxMix.h @@ -15,7 +15,6 @@ class cxxMix:public cxxNumKeyword public: cxxMix(PHRQ_io *io=NULL); - //cxxMix(struct mix *, PHRQ_io *io=NULL); ~cxxMix(); //void dump_xml(std::ostream& os, unsigned int indent = 0)const; diff --git a/dumper.cpp b/dumper.cpp index 84e574ac..748e2c94 100644 --- a/dumper.cpp +++ b/dumper.cpp @@ -255,231 +255,6 @@ bool dumper::Read(CParser & parser) return(return_value); } -#ifdef SKIP -bool dumper::Read(CParser & parser) -{ - - bool return_value(true); - static std::vector < std::string > vopts; - if (vopts.empty()) - { - vopts.reserve(20); - vopts.push_back("solution"); - vopts.push_back("solutions"); - vopts.push_back("pp_assemblage"); - vopts.push_back("pp_assemblages"); - vopts.push_back("equilibrium_phase"); - vopts.push_back("equilibrium_phases"); - vopts.push_back("exchange"); - vopts.push_back("surface"); - vopts.push_back("s_s_assemblage"); - vopts.push_back("solid_solution"); - vopts.push_back("solid_solutions"); - vopts.push_back("gas_phase"); - vopts.push_back("gas_phases"); - vopts.push_back("kinetics"); - vopts.push_back("file"); - vopts.push_back("append"); - vopts.push_back("all"); - vopts.push_back("cell"); - vopts.push_back("cells"); // 18 - vopts.push_back("mix"); // 19 - vopts.push_back("reaction"); // 20 - vopts.push_back("reactions"); // 21 - vopts.push_back("temperature"); // 22 - vopts.push_back("reaction_temperature"); // 23 - vopts.push_back("reaction_temperatures"); // 24 - vopts.push_back("pressure"); // 25 - vopts.push_back("reaction_pressure"); // 26 - vopts.push_back("reaction_pressures"); // 27 - } - - std::istream::pos_type ptr; - std::istream::pos_type next_char; - std::string token; - int opt_save; - bool useLastLine(false); - - // Read mix number and description - //this->read_number_description(parser); - - opt_save = CParser::OPT_DEFAULT; - - for (;;) - { - int opt; - StorageBinListItem cells; - opt = parser.get_option(vopts, next_char); - if (opt == CParser::OPT_DEFAULT) - { - opt = opt_save; - } - else - { - opt_save = opt; - } - - // Select StorageBinListItem - StorageBinListItem *item = NULL; - switch (opt) - { - case 0: - case 1: - item = &(this->binList.Get_solution()); - break; - case 2: - case 3: - case 4: - case 5: - item = &(this->binList.Get_pp_assemblage()); - break; - case 6: - item = &(this->binList.Get_exchange()); - break; - case 7: - item = &(this->binList.Get_surface()); - break; - case 8: - case 9: - case 10: - item = &(this->binList.Get_s_s_assemblage()); - break; - case 11: - case 12: - item = &(this->binList.Get_gas_phase()); - break; - case 13: - item = &(this->binList.Get_kinetics()); - break; - case 17: // cell - case 18: // cells - item = &cells; - break; - case 19: // mix - item = &(this->binList.Get_mix()); - break; - case 20: // reaction - case 21: // reactions - item = &(this->binList.Get_reaction()); - break; - case 22: // temperature - case 23: // reaction_temperature - case 24: // reaction_temperatures - item = &(this->binList.Get_temperature()); - break; - case 25: // pressure - case 26: // reaction_pressure - case 27: // reaction_pressures - item = &(this->binList.Get_pressure()); - break; - default: - break; - } - - // Read dump entity list of numbers or number ranges for line, store in item - if ((opt >= 0 && opt <= 13) || (opt >= 17 && opt <= 28)) - { - for (;;) - { - CParser::TOKEN_TYPE j = parser.copy_token(token, next_char); - if (j == CParser::TT_DIGIT) - { - item->Augment(token); - } - else if (j == CParser::TT_EMPTY) - { - item->Augment(token); - break; - } - else - { - parser.error_msg("Expected single number or range of numbers.", - PHRQ_io::OT_CONTINUE); - } - } - } - - if (opt == 17 || opt == 18) - { - this->binList.TransferAll(cells); - } - // Process other identifiers - std::set < int >::iterator it; - switch (opt) - { - case CParser::OPT_EOF: - break; - case CParser::OPT_KEYWORD: - break; - - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - break; - case 14: //file - std::getline(parser.get_iss(), this->file_name); - this->file_name = trim(this->file_name, " \t"); - if (this->file_name.size() == 0) - { - this->file_name = "dump.out"; - } - - break; - case 15: //append - { - parser.copy_token(token, next_char); - //if (!(parser.get_iss() >> this->append)) - this->append = true; - if (token.c_str()[0] == 'f' || token.c_str()[0] == 'F') - { - this->append = false; - } - } - break; - case 16: //all - this->SetAll(true); - break; - default: - case CParser::OPT_DEFAULT: - case CParser::OPT_ERROR: - opt = CParser::OPT_EOF; - parser.error_msg("Unknown input reading DUMP definition.", - PHRQ_io::OT_CONTINUE); - parser.error_msg(parser.line().c_str(), PHRQ_io::OT_CONTINUE); - useLastLine = false; - return_value = false; - break; - } - - - if (opt == CParser::OPT_EOF || opt == CParser::OPT_KEYWORD) - break; - } - return(return_value); -} -#endif bool dumper::Get_bool_any(void) { return (