mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
Added file_on variables to PHRQ_io.
Set dump, log, and punch file_on variables whereever pr.dump, pr.log, and pr.punch were set in PHREEQC. Added base class to Solution, ISolution, and StorageBin. Required a PHRQ_io in the constructor to find all places they were constructed. Need to do the same to all other classes (Exchange, Surface, NameDouble, etc.) Then need to take PHREEQC instance out of parser and fix all places a parser is constructed. Need to move phreeqc2class constructors to phreeqc. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/branches/ErrorHandling@5628 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
02797e6934
commit
aba479648c
@ -30,7 +30,9 @@ extern void ORCH_write_chemistry_species(std::ostream & chemistry_dat);
|
||||
//static std::map<int, cxxISolution> ss_map;
|
||||
//std::map<int, cxxISolution>& cxxISolution::s_map = ss_map;
|
||||
|
||||
cxxISolution::cxxISolution():
|
||||
cxxISolution::cxxISolution(PHRQ_io *io)
|
||||
:
|
||||
cxxSolution(io),
|
||||
units("mMol/kgw")
|
||||
{
|
||||
density = 1.0;
|
||||
@ -38,8 +40,9 @@ units("mMol/kgw")
|
||||
pes = NULL;
|
||||
}
|
||||
|
||||
cxxISolution::cxxISolution(PHREEQC_PTR_ARG_COMMA struct solution *solution_ptr):
|
||||
cxxSolution(solution_ptr)
|
||||
cxxISolution::cxxISolution(PHREEQC_PTR_ARG_COMMA struct solution *solution_ptr, PHRQ_io *io)
|
||||
:
|
||||
cxxSolution(solution_ptr, io)
|
||||
//, pe(cxxPe_Data::alloc())
|
||||
{
|
||||
density = solution_ptr->density;
|
||||
|
||||
@ -19,8 +19,8 @@ class cxxISolution:public cxxSolution
|
||||
{
|
||||
|
||||
public:
|
||||
cxxISolution();
|
||||
cxxISolution(PHREEQC_PTR_ARG_COMMA struct solution *);
|
||||
cxxISolution(PHRQ_io *io);
|
||||
cxxISolution(PHREEQC_PTR_ARG_COMMA struct solution *, PHRQ_io *io);
|
||||
//cxxISolution(const cxxISolution&);
|
||||
~cxxISolution();
|
||||
|
||||
|
||||
328
PHRQ_io.cpp
328
PHRQ_io.cpp
@ -18,6 +18,12 @@ PHRQ_io(void)
|
||||
error_file = NULL; /* OUTPUT_ERROR */
|
||||
dump_file = NULL; /* OUTPUT_DUMP */
|
||||
int error_count = 0;
|
||||
|
||||
output_file_on = true;
|
||||
log_file_on = false;
|
||||
punch_file_on = true;
|
||||
error_file_on = true;
|
||||
dump_file_on = true;
|
||||
}
|
||||
|
||||
PHRQ_io::
|
||||
@ -108,261 +114,6 @@ close_input_files(void)
|
||||
return (i);
|
||||
}
|
||||
|
||||
///* ---------------------------------------------------------------------- */
|
||||
//int PHRQ_io::
|
||||
//process_file_names(int argc, char *argv[], void **db_cookie,
|
||||
// void **input_cookie, int log)
|
||||
///* ---------------------------------------------------------------------- */
|
||||
//{
|
||||
// int l;
|
||||
// char token[2 * MAX_LENGTH], default_name[2 * MAX_LENGTH];
|
||||
// char query[2 * MAX_LENGTH];
|
||||
// char in_file[2 * MAX_LENGTH], out_file[2 * MAX_LENGTH], db_file[2 * MAX_LENGTH];
|
||||
// char *env_ptr;
|
||||
// char *ptr;
|
||||
// int errors;
|
||||
// ENTRY item, *found_item;
|
||||
//
|
||||
///*
|
||||
// * Prepare error handling
|
||||
// */
|
||||
// errors = setjmp(mark);
|
||||
// if (errors != 0)
|
||||
// {
|
||||
// return errors;
|
||||
// }
|
||||
//
|
||||
///*
|
||||
// * Prep for get_line
|
||||
// */
|
||||
// max_line = MAX_LINE;
|
||||
// space((void **) ((void *) &line), INIT, &max_line, sizeof(char));
|
||||
// space((void **) ((void *) &line_save), INIT, &max_line, sizeof(char));
|
||||
// hcreate_multi(5, &strings_hash_table);
|
||||
// hcreate_multi(2, &keyword_hash_table);
|
||||
//
|
||||
///*
|
||||
// * Initialize hash table
|
||||
// */
|
||||
// keyword_hash = (struct key *) PHRQ_malloc(sizeof(struct key));
|
||||
// if (keyword_hash == NULL)
|
||||
// {
|
||||
// malloc_error();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// keyword_hash->name = string_hsave("database");
|
||||
// keyword_hash->keycount = 0;
|
||||
// item.key = keyword_hash->name;
|
||||
// item.data = keyword_hash;
|
||||
// found_item = hsearch_multi(keyword_hash_table, item, ENTER);
|
||||
// if (found_item == NULL)
|
||||
// {
|
||||
// sprintf(error_string,
|
||||
// "Hash table error in keyword initialization.");
|
||||
// error_msg(error_string, STOP);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
///*
|
||||
// * Open file for screen output
|
||||
// */
|
||||
// if (argc > 4)
|
||||
// {
|
||||
// error_file = fopen(argv[4], "w");
|
||||
// if (error_file == NULL)
|
||||
// {
|
||||
//#ifdef PHREEQ98
|
||||
// error_file = NULL; /* We can not use stderr in BCB: this causes unexpected behaviour when reopening the input_file... */
|
||||
//#else
|
||||
// error_file = stderr;
|
||||
//#endif
|
||||
// sprintf(error_string, "Error opening file, %s.", argv[4]);
|
||||
// warning_msg(error_string);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//#ifdef PHREEQ98
|
||||
// error_file = NULL; /* We can not use stderr in BCB: this causes unexpected behaviour when reopening the input_file... */
|
||||
//#else
|
||||
// error_file = stderr;
|
||||
//#endif
|
||||
// }
|
||||
//
|
||||
///*
|
||||
// * Open user-input file
|
||||
// */
|
||||
// strcpy(query, "Name of input file?");
|
||||
// if (argc <= 1)
|
||||
// {
|
||||
// default_name[0] = '\0';
|
||||
// input_file = file_open(query, default_name, "r", FALSE);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// strcpy(default_name, argv[1]);
|
||||
// input_file = file_open(query, default_name, "r", TRUE);
|
||||
// }
|
||||
// output_msg(OUTPUT_SCREEN, "Input file: %s\n\n", default_name);
|
||||
// output_msg(OUTPUT_SEND_MESSAGE, "Input file: %s\r\n\r\n", default_name);
|
||||
// strcpy(in_file, default_name);
|
||||
///*
|
||||
// * Open file for output
|
||||
// */
|
||||
// strcpy(query, "Name of output file?");
|
||||
//
|
||||
// ptr = default_name;
|
||||
// copy_token(token, &ptr, &l);
|
||||
// strcat(token, ".out");
|
||||
// if (argc <= 1)
|
||||
// {
|
||||
// output_file = file_open(query, token, "w", FALSE);
|
||||
// }
|
||||
// else if (argc == 2)
|
||||
// {
|
||||
// output_file = file_open(query, token, "w", TRUE);
|
||||
// }
|
||||
// else if (argc >= 3)
|
||||
// {
|
||||
// strcpy(token, argv[2]);
|
||||
// output_file = file_open(query, token, "w", TRUE);
|
||||
// }
|
||||
// output_msg(OUTPUT_SCREEN, "Output file: %s\n\n", token);
|
||||
// output_msg(OUTPUT_SEND_MESSAGE, "Output file: %s\r\n\r\n", token);
|
||||
// strcpy(out_file, token);
|
||||
///*
|
||||
// * Open file for errors
|
||||
// */
|
||||
// if (log == TRUE)
|
||||
// {
|
||||
//#ifdef PHREEQ98
|
||||
// if ((log_file = fopen(LogFileNameC, "w")) == NULL)
|
||||
// {
|
||||
//#else /* PHREEQ98 */
|
||||
// if ((log_file = fopen("phreeqc.log", "w")) == NULL)
|
||||
// {
|
||||
//#endif /* PHREEQ98 */
|
||||
// error_msg("Can't open log file, phreeqc.log.", STOP);
|
||||
// }
|
||||
// }
|
||||
// /*
|
||||
// * Read input file for DATABASE keyword
|
||||
// */
|
||||
// std::ifstream * temp_input = new std::ifstream(in_file, std::ifstream::in);
|
||||
// this->set_cookie(temp_input);
|
||||
// if (get_line(istream_getc, temp_input) == KEYWORD)
|
||||
// {
|
||||
// ptr = line;
|
||||
// copy_token(token, &ptr, &l);
|
||||
// if (strcmp_nocase(token, "database") == 0)
|
||||
// {
|
||||
//#ifdef PHREEQ98
|
||||
// user_database = string_duplicate(prefix_database_dir(ptr));
|
||||
//#else
|
||||
// user_database = string_duplicate(ptr);
|
||||
//#endif
|
||||
// if (string_trim(user_database) == EMPTY)
|
||||
// {
|
||||
// warning_msg
|
||||
// ("DATABASE file name is missing; default database will be used.");
|
||||
// user_database = (char *) free_check_null(user_database);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// fclose(input_file);
|
||||
// this->pop_cookie();
|
||||
//
|
||||
// if ((input_file = fopen(in_file, "r")) == NULL)
|
||||
// {;
|
||||
// error_msg("Can't reopen input file.", STOP);
|
||||
// }
|
||||
///*
|
||||
// * Open data base
|
||||
// */
|
||||
// strcpy(query, "Name of database file?");
|
||||
// env_ptr = getenv("PHREEQC_DATABASE");
|
||||
// if (user_database != NULL)
|
||||
// {
|
||||
// strcpy(token, user_database);
|
||||
// }
|
||||
// else if (env_ptr != NULL)
|
||||
// {
|
||||
// strcpy(token, env_ptr);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// strcpy(token, default_data_base);
|
||||
// }
|
||||
// if (argc <= 1)
|
||||
// {
|
||||
// database_file = file_open(query, token, "r", FALSE);
|
||||
// }
|
||||
// else if (argc < 4)
|
||||
// {
|
||||
// database_file = file_open(query, token, "r", TRUE);
|
||||
// }
|
||||
// else if (argc >= 4)
|
||||
// {
|
||||
// if (user_database == NULL)
|
||||
// {
|
||||
// strcpy(token, argv[3]);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//#ifndef PHREEQCI_GUI
|
||||
// warning_msg
|
||||
// ("Database file from DATABASE keyword is used; command line argument ignored.");
|
||||
//#endif
|
||||
// }
|
||||
// database_file = file_open(query, token, "r", TRUE);
|
||||
// }
|
||||
// output_msg(OUTPUT_SCREEN, "Database file: %s\n\n", token);
|
||||
// output_msg(OUTPUT_SEND_MESSAGE, "Database file: %s\r\n\r\n", token);
|
||||
// strcpy(db_file, token);
|
||||
//
|
||||
// output_msg(OUTPUT_MESSAGE, " Input file: %s\n", in_file);
|
||||
// output_msg(OUTPUT_MESSAGE, " Output file: %s\n", out_file);
|
||||
// output_msg(OUTPUT_MESSAGE, "Database file: %s\n\n", token);
|
||||
///*
|
||||
// * local cleanup
|
||||
// */
|
||||
// user_database = (char *) free_check_null(user_database);
|
||||
// line = (char *) free_check_null(line);
|
||||
// line_save = (char *) free_check_null(line_save);
|
||||
//
|
||||
// hdestroy_multi(keyword_hash_table);
|
||||
// keyword_hash = (struct key *) free_check_null(keyword_hash);
|
||||
// keyword_hash_table = NULL;
|
||||
//
|
||||
// free_hash_strings(strings_hash_table);
|
||||
// hdestroy_multi(strings_hash_table);
|
||||
// strings_hash_table = NULL;
|
||||
//
|
||||
// *db_cookie = database_file;
|
||||
// *input_cookie = input_file;
|
||||
//
|
||||
// this->db_stream = new std::ifstream(db_file, std::ifstream::in);
|
||||
// this->in_stream = new std::ifstream(in_file, std::ifstream::in);
|
||||
// *db_cookie = db_stream;
|
||||
// *input_cookie = in_stream;
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
///* ---------------------------------------------------------------------- */
|
||||
//int PHRQ_io::
|
||||
//getc_callback(void *cookie)
|
||||
///* ---------------------------------------------------------------------- */
|
||||
//{
|
||||
// int i;
|
||||
// assert(cookie);
|
||||
// i = getc((FILE *) cookie);
|
||||
//
|
||||
// return i;
|
||||
//}
|
||||
|
||||
//istream_getc is static ***
|
||||
int PHRQ_io::
|
||||
istream_getc(void *cookie)
|
||||
@ -449,9 +200,9 @@ output_handler(const int type, const char *err_str, const bool stop,
|
||||
#endif
|
||||
fflush(output_file);
|
||||
}
|
||||
//#if defined MULTICHART
|
||||
// chart_handler.End_timer(PHREEQC_THIS);
|
||||
//#endif
|
||||
////#if defined MULTICHART
|
||||
//// chart_handler.End_timer(PHREEQC_THIS);
|
||||
////#endif
|
||||
}
|
||||
break;
|
||||
|
||||
@ -768,53 +519,16 @@ rewind_wrapper(FILE * file_ptr)
|
||||
//return (OK);
|
||||
return 1;
|
||||
}
|
||||
//#if defined(MERGE_INCLUDE_FILES)
|
||||
///* ---------------------------------------------------------------------- */
|
||||
//bool PHRQ_io::
|
||||
//recursive_include(std::ifstream & input_stream, std::iostream & accumulated_stream)
|
||||
///* ---------------------------------------------------------------------- */
|
||||
//{
|
||||
// std::string myline;
|
||||
//
|
||||
// // input_file should be opened before calling recursive_include
|
||||
// assert(input_stream.is_open());
|
||||
//
|
||||
// while (std::getline(input_stream, myline))
|
||||
// {
|
||||
// accumulated_stream << myline << std::endl;
|
||||
//
|
||||
// std::string copy_line = myline;
|
||||
// // remove leading spaces
|
||||
// copy_line.erase(0, copy_line.find_first_not_of(" \t") );
|
||||
// // get first 8 characters
|
||||
// std::string token = copy_line.substr(0,9);
|
||||
// // convert to lower case
|
||||
// std::transform(token.begin(), token.end(), token.begin(),
|
||||
// (int(*)(int)) std::tolower);
|
||||
// // check for #include file_name
|
||||
// if (token == "#$include")
|
||||
// {
|
||||
// // get file name without trailing spaces
|
||||
// token = copy_line.substr(10, copy_line.length());
|
||||
// token.erase(0, token.find_first_not_of(" \t"));
|
||||
// // remove leading, trailing spaces
|
||||
// token = token.substr(0, token.find_last_not_of(" \t\n\0") + 1);
|
||||
// // open stream
|
||||
// std::ifstream next_stream(token.c_str(), std::ifstream::in);
|
||||
// if (next_stream.is_open())
|
||||
// {
|
||||
// recursive_include(next_stream, accumulated_stream);
|
||||
// accumulated_stream << "#Done include " << token << std::endl;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // error opening file
|
||||
// sprintf(error_string, "Could not open include file %s", token.c_str());
|
||||
// error_msg(error_string, STOP);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
//#endif /* defined(MERGE_INCLUDE_FILES) */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
void PHRQ_io::
|
||||
safe_close(FILE * file_ptr)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
if (file_ptr != stderr &&
|
||||
file_ptr != stdout &&
|
||||
file_ptr != stdin)
|
||||
{
|
||||
fclose(file_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
48
PHRQ_io.h
48
PHRQ_io.h
@ -48,7 +48,7 @@ typedef enum
|
||||
const bool stop, const char *format,
|
||||
va_list args);
|
||||
static int rewind_wrapper(FILE * file_ptr);
|
||||
|
||||
static void safe_close(FILE * file_ptr);
|
||||
int close_input_files(void);
|
||||
int close_output_files(void);
|
||||
static int istream_getc(void *cookie);
|
||||
@ -97,6 +97,46 @@ typedef enum
|
||||
fclose(input_file);
|
||||
}
|
||||
}
|
||||
void Set_output_file_on(bool tf)
|
||||
{
|
||||
this->output_file_on = tf;
|
||||
}
|
||||
void Set_log_file_on(bool tf)
|
||||
{
|
||||
this->log_file_on = tf;
|
||||
}
|
||||
void Set_punch_file_on(bool tf)
|
||||
{
|
||||
this->punch_file_on = tf;
|
||||
}
|
||||
void Set_error_file_on(bool tf)
|
||||
{
|
||||
this->error_file_on = tf;
|
||||
}
|
||||
void Set_dump_file_on(bool tf)
|
||||
{
|
||||
this->dump_file_on = tf;
|
||||
}
|
||||
bool Get_output_file_on(void)
|
||||
{
|
||||
return this->output_file_on;
|
||||
}
|
||||
bool Get_log_file_on(void)
|
||||
{
|
||||
return this->log_file_on;
|
||||
}
|
||||
bool Get_punch_file_on(void)
|
||||
{
|
||||
return this->punch_file_on;
|
||||
}
|
||||
bool Get_error_file_on(void)
|
||||
{
|
||||
return this->error_file_on;
|
||||
}
|
||||
bool Get_dump_file_on(void)
|
||||
{
|
||||
return this->dump_file_on;
|
||||
}
|
||||
// data
|
||||
private:
|
||||
FILE *input_file;
|
||||
@ -107,6 +147,12 @@ private:
|
||||
FILE *error_file; /* OUTPUT_ERROR */
|
||||
FILE *dump_file; /* OUTPUT_DUMP */
|
||||
int error_count;
|
||||
|
||||
bool output_file_on;
|
||||
bool log_file_on;
|
||||
bool punch_file_on;
|
||||
bool error_file_on;
|
||||
bool dump_file_on;
|
||||
};
|
||||
|
||||
#endif /* _PHRQIO_H */
|
||||
|
||||
@ -455,7 +455,7 @@ size_t Phreeqc::list_components(std::list<std::string> &list_c)
|
||||
// solutions
|
||||
for (i = 0; i < count_solution; i++)
|
||||
{
|
||||
cxxSolution entity(solution[i]);
|
||||
cxxSolution entity(solution[i], &this->phrq_io);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ read_solution_raw(void)
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
|
||||
cxxSolution sol;
|
||||
cxxSolution sol(&this->phrq_io);
|
||||
sol.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct solution *soln_ptr = sol.cxxSolution2solution(PHREEQC_THIS);
|
||||
int n;
|
||||
@ -1319,14 +1319,14 @@ read_solution_modify(void)
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
cxxSolution sol(solution[n]);
|
||||
cxxSolution sol(solution[n], &this->phrq_io);
|
||||
|
||||
// Clear activities so we can know what was read
|
||||
sol.clear_master_activity();
|
||||
|
||||
sol.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
|
||||
cxxSolution orig(solution[n]);
|
||||
cxxSolution orig(solution[n], &this->phrq_io );
|
||||
|
||||
sol.modify_activities(PHREEQC_THIS_COMMA orig);
|
||||
|
||||
@ -2680,7 +2680,7 @@ dump_ostream(std::ostream& os)
|
||||
{
|
||||
for (i = 0; i < count_solution; i++)
|
||||
{
|
||||
cxxSolution cxxsoln(solution[i]);
|
||||
cxxSolution cxxsoln(solution[i], &this->phrq_io);
|
||||
cxxsoln.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
@ -2691,7 +2691,7 @@ dump_ostream(std::ostream& os)
|
||||
{
|
||||
if (solution_bsearch(*it, &n, FALSE) != NULL)
|
||||
{
|
||||
cxxSolution cxxsoln(solution[n]);
|
||||
cxxSolution cxxsoln(solution[n], &this->phrq_io);
|
||||
cxxsoln.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
|
||||
18
Solution.cxx
18
Solution.cxx
@ -32,11 +32,12 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
cxxSolution::cxxSolution()
|
||||
cxxSolution::cxxSolution(PHRQ_io * io)
|
||||
//
|
||||
// default constructor for cxxSolution
|
||||
//
|
||||
: cxxNumKeyword()
|
||||
: cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
this->tc = 25.0;
|
||||
this->ph = 7.0;
|
||||
@ -53,12 +54,13 @@ cxxSolution::cxxSolution()
|
||||
this->species_gamma.type = cxxNameDouble::ND_SPECIES_GAMMA;
|
||||
}
|
||||
|
||||
cxxSolution::cxxSolution(struct solution * solution_ptr)
|
||||
cxxSolution::cxxSolution(struct solution * solution_ptr, PHRQ_io * io)
|
||||
//
|
||||
// constructor for cxxSolution from struct solution
|
||||
//
|
||||
:
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io),
|
||||
totals(solution_ptr->totals),
|
||||
master_activity(solution_ptr->master_activity,
|
||||
solution_ptr->count_master_activity,
|
||||
@ -96,12 +98,13 @@ species_gamma(solution_ptr->species_gamma, solution_ptr->count_species_gamma,
|
||||
|
||||
|
||||
cxxSolution::cxxSolution(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxSolution > &solutions,
|
||||
cxxMix & mix, int l_n_user)
|
||||
cxxMix & mix, int l_n_user, PHRQ_io * io)
|
||||
//
|
||||
// constructor for cxxSolution from mixture of solutions
|
||||
//
|
||||
:
|
||||
cxxNumKeyword()
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
|
||||
//
|
||||
@ -133,13 +136,14 @@ cxxNumKeyword()
|
||||
}
|
||||
}
|
||||
|
||||
cxxSolution::cxxSolution(PHREEQC_PTR_ARG_COMMA int l_n_user)
|
||||
cxxSolution::cxxSolution(PHREEQC_PTR_ARG_COMMA int l_n_user, PHRQ_io * io)
|
||||
//
|
||||
// constructor for cxxSolution from results of calculation
|
||||
// does not work in phast because phast uses only the total molalities
|
||||
// of elements in buffer, not individual redox states.
|
||||
:
|
||||
cxxNumKeyword()
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
|
||||
//this->set_description none;
|
||||
|
||||
17
Solution.h
17
Solution.h
@ -6,22 +6,23 @@
|
||||
#include <string> // std::string
|
||||
#include <vector> // std::vector
|
||||
#include <iostream>
|
||||
#include "Phreeqc_class.h"
|
||||
#include "NumKeyword.h"
|
||||
#include "SolutionIsotopeList.h"
|
||||
#include "NameDouble.h"
|
||||
#include "PHRQ_base.h"
|
||||
#include "PHRQ_io.h"
|
||||
class cxxMix;
|
||||
|
||||
class cxxSolution:public cxxNumKeyword
|
||||
class cxxSolution:public cxxNumKeyword, public PHRQ_base
|
||||
{
|
||||
|
||||
public:
|
||||
cxxSolution();
|
||||
cxxSolution(struct solution *);
|
||||
cxxSolution(PHREEQC_PTR_ARG_COMMA int n_user);
|
||||
cxxSolution(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxSolution > &solution_map,
|
||||
cxxMix & mx, int n_user);
|
||||
~cxxSolution();
|
||||
cxxSolution(PHRQ_io *io=NULL);
|
||||
cxxSolution(struct solution *, PHRQ_io *io);
|
||||
cxxSolution(PHREEQC_PTR_ARG_COMMA int n_user, PHRQ_io *io);
|
||||
cxxSolution(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxSolution > &solution_map,
|
||||
cxxMix & mx, int n_user, PHRQ_io *io);
|
||||
~cxxSolution();
|
||||
|
||||
//static cxxSolution& read(CParser& parser);
|
||||
|
||||
|
||||
@ -41,7 +41,9 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
cxxStorageBin::cxxStorageBin()
|
||||
cxxStorageBin::cxxStorageBin(PHRQ_io *io)
|
||||
:
|
||||
PHRQ_base(io)
|
||||
{
|
||||
// default constructor for cxxStorageBin
|
||||
}
|
||||
@ -114,7 +116,9 @@ cxxStorageBin::cxxStorageBin(struct Use *use_ptr)
|
||||
this->setSystem(use_ptr);
|
||||
}
|
||||
#endif
|
||||
cxxStorageBin::cxxStorageBin(PHREEQC_PTR_ARG_COMMA struct Use *use_ptr)
|
||||
cxxStorageBin::cxxStorageBin(PHREEQC_PTR_ARG_COMMA struct Use *use_ptr, PHRQ_io * io)
|
||||
:
|
||||
PHRQ_base(io)
|
||||
{
|
||||
//Construct from use pointer
|
||||
|
||||
@ -134,7 +138,7 @@ cxxStorageBin::cxxStorageBin(PHREEQC_PTR_ARG_COMMA struct Use *use_ptr)
|
||||
struct solution *struct_entity1 = P_INSTANCE_POINTER solution_bsearch(it->first, &n, FALSE);
|
||||
if (struct_entity1 != NULL)
|
||||
{
|
||||
cxxSolution entity1(struct_entity1);
|
||||
cxxSolution entity1(struct_entity1, this->Get_io());
|
||||
this->setSolution(it->first, &entity1);
|
||||
}
|
||||
}
|
||||
@ -145,7 +149,7 @@ cxxStorageBin::cxxStorageBin(PHREEQC_PTR_ARG_COMMA struct Use *use_ptr)
|
||||
struct solution *struct_entity = P_INSTANCE_POINTER solution_bsearch(use_ptr->n_solution_user, &n, FALSE);
|
||||
if (struct_entity != NULL)
|
||||
{
|
||||
cxxSolution entity(struct_entity);
|
||||
cxxSolution entity(struct_entity, this->Get_io());
|
||||
this->setSolution(use_ptr->n_solution_user, &entity);
|
||||
}
|
||||
}
|
||||
@ -507,7 +511,7 @@ cxxStorageBin::import_phreeqc(PHREEQC_PTR_ARG)
|
||||
// Solutions
|
||||
for (i = 0; i < P_INSTANCE_POINTER count_solution; i++)
|
||||
{
|
||||
Solutions[P_INSTANCE_POINTER solution[i]->n_user] = cxxSolution(P_INSTANCE_POINTER solution[i]);
|
||||
Solutions[P_INSTANCE_POINTER solution[i]->n_user] = cxxSolution(P_INSTANCE_POINTER solution[i], this->Get_io());
|
||||
}
|
||||
|
||||
// Exchangers
|
||||
@ -728,7 +732,7 @@ cxxStorageBin::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
*/
|
||||
case CParser::KT_SOLUTION_RAW:
|
||||
{
|
||||
cxxSolution entity;
|
||||
cxxSolution entity(this->Get_io());
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Solutions[entity.get_n_user()] = entity;
|
||||
}
|
||||
@ -839,7 +843,7 @@ cxxStorageBin::read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
*/
|
||||
case CParser::KT_SOLUTION_RAW:
|
||||
{
|
||||
cxxSolution entity;
|
||||
cxxSolution entity(this->Get_io());
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Solutions[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
@ -935,7 +939,7 @@ cxxStorageBin::add(struct system *system_ptr)
|
||||
if (system_ptr->solution != NULL)
|
||||
{
|
||||
this->Solutions[system_ptr->solution->n_user] =
|
||||
cxxSolution(system_ptr->solution);
|
||||
cxxSolution(system_ptr->solution, this->Get_io());
|
||||
}
|
||||
|
||||
// Exchangers
|
||||
@ -1107,7 +1111,7 @@ cxxStorageBin::phreeqc2cxxStorageBin(PHREEQC_PTR_ARG_COMMA int n)
|
||||
// Solutions
|
||||
{
|
||||
P_INSTANCE_POINTER solution_bsearch(n, &pos, TRUE);
|
||||
this->Solutions[n] = cxxSolution(P_INSTANCE_POINTER solution[pos]);
|
||||
this->Solutions[n] = cxxSolution(P_INSTANCE_POINTER solution[pos], this->Get_io());
|
||||
}
|
||||
|
||||
// Exchangers
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#include <vector> // std::vector
|
||||
|
||||
#include "System.h"
|
||||
#include "PHRQ_io.h"
|
||||
#include "PHRQ_base.h"
|
||||
class cxxSolution;
|
||||
class cxxExchange;
|
||||
class cxxGasPhase;
|
||||
@ -17,13 +19,13 @@ class cxxSurface;
|
||||
class cxxReaction;
|
||||
class cxxTemperature;
|
||||
|
||||
class cxxStorageBin
|
||||
class cxxStorageBin: public PHRQ_base
|
||||
{
|
||||
|
||||
public:
|
||||
cxxStorageBin();
|
||||
cxxStorageBin(PHRQ_io *io);
|
||||
//cxxStorageBin(struct Use *use_ptr);
|
||||
cxxStorageBin(PHREEQC_PTR_ARG_COMMA struct Use *use_ptr);
|
||||
cxxStorageBin(PHREEQC_PTR_ARG_COMMA struct Use *use_ptr, PHRQ_io *io);
|
||||
~cxxStorageBin();
|
||||
|
||||
void import_phreeqc(PHREEQC_PTR_ARG);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user