IPhreeqc
|
Provides an interface to PHREEQC (Version 3)–A Computer Program for Speciation, Batch-Reaction, One-Dimensional Transport, and Inverse Geochemical Calculations. More...
#include <IPhreeqc.hpp>
Public Member Functions | |
IPhreeqc (void) | |
virtual | ~IPhreeqc (void) |
VRESULT | AccumulateLine (const char *line) |
size_t | AddError (const char *error_msg) |
size_t | AddWarning (const char *warning_msg) |
void | ClearAccumulatedLines (void) |
const std::string & | GetAccumulatedLines (void) |
const char * | GetComponent (int n) |
size_t | GetComponentCount (void) |
int | GetCurrentSelectedOutputUserNumber (void) const |
const char * | GetDumpFileName (void) const |
bool | GetDumpFileOn (void) const |
const char * | GetDumpString (void) const |
const char * | GetDumpStringLine (int n) |
int | GetDumpStringLineCount (void) const |
bool | GetDumpStringOn (void) const |
const char * | GetErrorFileName (void) const |
bool | GetErrorFileOn (void) const |
const char * | GetErrorString (void) |
const char * | GetErrorStringLine (int n) |
int | GetErrorStringLineCount (void) const |
bool | GetErrorStringOn (void) const |
int | GetId (void) const |
const char * | GetLogFileName (void) const |
bool | GetLogFileOn (void) const |
const char * | GetLogString (void) const |
const char * | GetLogStringLine (int n) const |
int | GetLogStringLineCount (void) const |
bool | GetLogStringOn (void) const |
int | GetNthSelectedOutputUserNumber (int n) const |
const char * | GetOutputFileName (void) const |
bool | GetOutputFileOn (void) const |
const char * | GetOutputString (void) const |
const char * | GetOutputStringLine (int n) const |
int | GetOutputStringLineCount (void) const |
bool | GetOutputStringOn (void) const |
int | GetSelectedOutputColumnCount (void) const |
int | GetSelectedOutputCount (void) const |
const char * | GetSelectedOutputFileName (void) const |
bool | GetSelectedOutputFileOn (void) const |
int | GetSelectedOutputRowCount (void) const |
const char * | GetSelectedOutputString (void) const |
const char * | GetSelectedOutputStringLine (int n) |
int | GetSelectedOutputStringLineCount (void) const |
bool | GetSelectedOutputStringOn (void) const |
VRESULT | GetSelectedOutputValue (int row, int col, VAR *pVAR) |
VRESULT | GetSelectedOutputValue2 (int row, int col, int *vtype, double *dvalue, char *svalue, unsigned int svalue_length) |
const char * | GetWarningString (void) |
const char * | GetWarningStringLine (int n) |
int | GetWarningStringLineCount (void) const |
std::list< std::string > | ListComponents (void) |
int | LoadDatabase (const char *filename) |
int | LoadDatabaseString (const char *input) |
void | OutputAccumulatedLines (void) |
void | OutputErrorString (void) |
void | OutputWarningString (void) |
int | RunAccumulated (void) |
int | RunFile (const char *filename) |
int | RunString (const char *input) |
void | SetBasicCallback (double(*fcn)(double x1, double x2, const char *str, void *cookie), void *cookie1) |
void | SetBasicFortranCallback (double(*fcn)(double *x1, double *x2, const char *str, int l)) |
VRESULT | SetCurrentSelectedOutputUserNumber (int n) |
void | SetDumpFileName (const char *filename) |
void | SetDumpFileOn (bool bValue) |
void | SetDumpStringOn (bool bValue) |
void | SetErrorFileName (const char *filename) |
void | SetErrorFileOn (bool bValue) |
void | SetErrorStringOn (bool bValue) |
void | SetLogFileName (const char *filename) |
void | SetLogFileOn (bool bValue) |
void | SetLogStringOn (bool bValue) |
void | SetOutputFileName (const char *filename) |
void | SetOutputFileOn (bool bValue) |
void | SetOutputStringOn (bool bValue) |
void | SetSelectedOutputFileName (const char *filename) |
void | SetSelectedOutputFileOn (bool bValue) |
void | SetSelectedOutputStringOn (bool bValue) |
Static Public Member Functions | |
static const char * | GetVersionString (void) |
Provides an interface to PHREEQC (Version 3)–A Computer Program for Speciation, Batch-Reaction, One-Dimensional Transport, and Inverse Geochemical Calculations.
IPhreeqc::IPhreeqc | ( | void | ) |
|
virtual |
Destructor
VRESULT IPhreeqc::AccumulateLine | ( | const char * | line | ) |
Accumlulate line(s) for input to phreeqc.
line | The line(s) to add for input to phreeqc. |
VR_OK | Success |
VR_OUTOFMEMORY | Out of memory |
size_t IPhreeqc::AddError | ( | const char * | error_msg | ) |
Appends the given error message and increments the error count. Internally used to create an error condition.
error_msg | The error message to display. |
size_t IPhreeqc::AddWarning | ( | const char * | warning_msg | ) |
Appends the given warning message and increments the warning count. Internally used to create a warning condition.
warning_msg | The warning message to display. |
void IPhreeqc::ClearAccumulatedLines | ( | void | ) |
Clears the accumulated input buffer. Input buffer is accumulated from calls to AccumulateLine.
const std::string& IPhreeqc::GetAccumulatedLines | ( | void | ) |
Retrieve the accumulated input string. The accumulated input string can be run with RunAccumulated.
const char* IPhreeqc::GetComponent | ( | int | n | ) |
Retrieves the given component.
n | The zero-based index of the component to retrieve. |
size_t IPhreeqc::GetComponentCount | ( | void | ) |
Retrieves the number of components in the current list of components.
int IPhreeqc::GetCurrentSelectedOutputUserNumber | ( | void | ) | const |
Retrieves the current SELECTED_OUTPUT user number. The initial setting is 1.
const char* IPhreeqc::GetDumpFileName | ( | void | ) | const |
Retrieves the name of the dump file. This file name is used if not specified within DUMP input. The default value is dump.id.out, where id is obtained from GetId.
bool IPhreeqc::GetDumpFileOn | ( | void | ) | const |
Retrieves the current value of the dump file switch.
true | Output is written to the DUMP (dump.id.out if unspecified, where id is obtained from GetId) file. |
false | No output is written. |
const char* IPhreeqc::GetDumpString | ( | void | ) | const |
Retrieves the string buffer containing DUMP output.
const char* IPhreeqc::GetDumpStringLine | ( | int | n | ) |
Retrieves the given dump line.
n | The zero-based index of the line to retrieve. |
int IPhreeqc::GetDumpStringLineCount | ( | void | ) | const |
Retrieves the number of lines in the current dump string buffer.
bool IPhreeqc::GetDumpStringOn | ( | void | ) | const |
Retrieves the current value of the dump string switch.
true | Output defined by the DUMP keyword is stored. |
false | No output is stored. |
const char* IPhreeqc::GetErrorFileName | ( | void | ) | const |
Retrieves the name of the error file. The default value is phreeqc.id.err, where id is obtained from GetId.
bool IPhreeqc::GetErrorFileOn | ( | void | ) | const |
Retrieves the current value of the error file switch.
true | Errors are written to the phreeqc.id.err (where id is obtained from GetId) file. |
false | No errors are written. |
const char* IPhreeqc::GetErrorString | ( | void | ) |
Retrieves the error messages from the last call to RunAccumulated, RunFile, RunString, LoadDatabase, or LoadDatabaseString.
const char* IPhreeqc::GetErrorStringLine | ( | int | n | ) |
Retrieves the given error line.
n | The zero-based index of the line to retrieve. |
int IPhreeqc::GetErrorStringLineCount | ( | void | ) | const |
Retrieves the number of lines in the current error string buffer.
bool IPhreeqc::GetErrorStringOn | ( | void | ) | const |
Retrieves the current value of the error string switch.
true | Error output is stored. |
false | No error output is stored. |
int IPhreeqc::GetId | ( | void | ) | const |
Retrieves the id of this object. Each instance receives an id which is incremented for each instance starting with the value zero.
const char* IPhreeqc::GetLogFileName | ( | void | ) | const |
Retrieves the name of the log file. The default value is phreeqc.id.log, where id is obtained from GetId.
bool IPhreeqc::GetLogFileOn | ( | void | ) | const |
Retrieves the current value of the log file switch.
true | Log messages are written to the phreeqc.id.log (where id is obtained from GetId) file. |
false | No log messages are written. |
const char* IPhreeqc::GetLogString | ( | void | ) | const |
Retrieves the string buffer containing phreeqc log output.
const char* IPhreeqc::GetLogStringLine | ( | int | n | ) | const |
Retrieves the given log line.
n | The zero-based index of the line to retrieve. |
int IPhreeqc::GetLogStringLineCount | ( | void | ) | const |
Retrieves the number of lines in the current log string buffer.
bool IPhreeqc::GetLogStringOn | ( | void | ) | const |
Retrieves the current value of the log string switch.
true | Log output is stored. |
false | No log output is stored. |
int IPhreeqc::GetNthSelectedOutputUserNumber | ( | int | n | ) | const |
Retrieves the nth user number of the currently defined SELECTED_OUTPUT blocks.
n | The zero-based index of the SELECTED_OUTPUT user number to retrieve. |
const char* IPhreeqc::GetOutputFileName | ( | void | ) | const |
Retrieves the name of the output file. The default value is phreeqc.id.out, where id is obtained from GetId.
bool IPhreeqc::GetOutputFileOn | ( | void | ) | const |
Retrieves the current value of the output file switch.
true | Output is written to the phreeqc.id.out (where id is obtained from GetId) file. |
false | No output is written. |
const char* IPhreeqc::GetOutputString | ( | void | ) | const |
Retrieves the string buffer containing phreeqc output.
const char* IPhreeqc::GetOutputStringLine | ( | int | n | ) | const |
Retrieves the given output line.
n | The zero-based index of the line to retrieve. |
int IPhreeqc::GetOutputStringLineCount | ( | void | ) | const |
Retrieves the number of lines in the current output string buffer.
bool IPhreeqc::GetOutputStringOn | ( | void | ) | const |
Retrieves the current value of the output string switch.
true | Phreeqc output is stored. |
false | No phreeqc output is stored. |
int IPhreeqc::GetSelectedOutputColumnCount | ( | void | ) | const |
Retrieves the number of columns in the current selected-output buffer (see SetCurrentSelectedOutputUserNumber).
int IPhreeqc::GetSelectedOutputCount | ( | void | ) | const |
Retrieves the count of SELECTED_OUTPUT blocks that are currently defined.
const char* IPhreeqc::GetSelectedOutputFileName | ( | void | ) | const |
Retrieves the name of the current selected output file (see SetCurrentSelectedOutputUserNumber). This file name is used if not specified within SELECTED_OUTPUT input. The default value is selected_n.id.out, where id is obtained from GetId.
bool IPhreeqc::GetSelectedOutputFileOn | ( | void | ) | const |
Retrieves the current selected-output file switch (see SetCurrentSelectedOutputUserNumber).
true | Output is written to the selected-output (selected_n.id.out if unspecified, where id is obtained from GetId) file. |
false | No output is written. |
int IPhreeqc::GetSelectedOutputRowCount | ( | void | ) | const |
Retrieves the number of rows in the current selected-output buffer (see SetCurrentSelectedOutputUserNumber).
const char* IPhreeqc::GetSelectedOutputString | ( | void | ) | const |
Retrieves the string buffer containing SELECTED_OUTPUT for the currently selected user number (see SetCurrentSelectedOutputUserNumber).
const char* IPhreeqc::GetSelectedOutputStringLine | ( | int | n | ) |
Retrieves the given selected output line of the currently selected user number (see SetCurrentSelectedOutputUserNumber).
n | The zero-based index of the line to retrieve. |
int IPhreeqc::GetSelectedOutputStringLineCount | ( | void | ) | const |
Retrieves the number of lines in the current selected output string buffer (see SetCurrentSelectedOutputUserNumber).
bool IPhreeqc::GetSelectedOutputStringOn | ( | void | ) | const |
Retrieves the value of the current selected output string switch (see SetCurrentSelectedOutputUserNumber).
true | Output defined by the SELECTED_OUTPUT keyword is stored. |
false | No output is stored. |
Returns the VAR
associated with the specified row and column. The current SELECTED_OUTPUT block is set using the SetCurrentSelectedOutputUserNumber method.
row | The row index. |
col | The column index. |
pVAR | Pointer to the VAR to receive the requested data. |
VR_OK | Success. |
VR_INVALIDROW | The given row is out of range. |
VR_INVALIDCOL | The given column is out of range. |
VR_OUTOFMEMORY | Memory could not be allocated. |
VR_BADINSTANCE | The given id is invalid. |
Input | Headings |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VRESULT IPhreeqc::GetSelectedOutputValue2 | ( | int | row, |
int | col, | ||
int * | vtype, | ||
double * | dvalue, | ||
char * | svalue, | ||
unsigned int | svalue_length | ||
) |
Returns the associated data with the specified row and column. The current SELECTED_OUTPUT block is set using the SetCurrentSelectedOutputUserNumber method.
row | The row index. |
col | The column index. |
vtype | Receives the variable type. See VAR_TYPE. |
dvalue | Receives the numeric value when (VTYPE=TT_DOUBLE) or (VTYPE=TT_LONG). |
svalue | Receives the string variable when (VTYPE=TT_STRING). When (VTYPE=TT_DOUBLE) or (VTYPE=TT_LONG) this variable is filled with a string equivalent of DVALUE. |
svalue_length | The length of the svalue buffer. |
IPQ_OK | Success. |
IPQ_INVALIDROW | The given row is out of range. |
IPQ_INVALIDCOL | The given column is out of range. |
IPQ_OUTOFMEMORY | Memory could not be allocated. |
IPQ_BADINSTANCE | The given id is invalid. |
|
static |
Retrieves the string buffer containing the version in the form of X.X.X-XXXX.
const char* IPhreeqc::GetWarningString | ( | void | ) |
Retrieves the warning messages from the last call to RunAccumulated, RunFile, RunString, LoadDatabase, or LoadDatabaseString.
const char* IPhreeqc::GetWarningStringLine | ( | int | n | ) |
Retrieves the given warning line.
n | The zero-based index of the line to retrieve. |
int IPhreeqc::GetWarningStringLineCount | ( | void | ) | const |
Retrieves the number of lines in the current warning string buffer.
std::list< std::string > IPhreeqc::ListComponents | ( | void | ) |
Retrieves the current list of components.
int IPhreeqc::LoadDatabase | ( | const char * | filename | ) |
Load the specified database file into phreeqc.
filename | The name of the phreeqc database to load. The full path (or relative path with respect to the working directory) will be required if the file is not in the current working directory. |
int IPhreeqc::LoadDatabaseString | ( | const char * | input | ) |
Load the specified string as a database into phreeqc.
input | String containing data to be used as the phreeqc database. |
void IPhreeqc::OutputAccumulatedLines | ( | void | ) |
Output the accumulated input buffer to stdout. The input buffer can be run with a call to RunAccumulated.
void IPhreeqc::OutputErrorString | ( | void | ) |
Output the error messages normally stored in the phreeqc.id.err (where id is obtained from GetId) file to stdout.
void IPhreeqc::OutputWarningString | ( | void | ) |
Output the warning messages to stdout.
int IPhreeqc::RunAccumulated | ( | void | ) |
Runs the input buffer as defined by calls to AccumulateLine.
int IPhreeqc::RunFile | ( | const char * | filename | ) |
Runs the specified phreeqc input file.
filename | The name of the phreeqc input file to run. |
int IPhreeqc::RunString | ( | const char * | input | ) |
Runs the specified string as input to phreeqc.
input | String containing phreeqc input. |
void IPhreeqc::SetBasicCallback | ( | double(*)(double x1, double x2, const char *str, void *cookie) | fcn, |
void * | cookie1 | ||
) |
Sets a C callback function for Basic programs. The syntax for the Basic command is 10 result = CALLBACK(x1, x2, string$) The syntax for the C function is double my_callback(double x1, double x2, const char * string)
fcn | The name of a user-defined function. |
cookie1 | A user defined value to be passed to the callback function. |
void IPhreeqc::SetBasicFortranCallback | ( | double(*)(double *x1, double *x2, const char *str, int l) | fcn | ) |
Sets a Fortran callback function for Basic programs. The syntax for the Basic command is 10 result = CALLBACK(x1, x2, string$) The syntax for the Fortran function is double precision my_callback(x1, x2, string), where x1 and x2 are double precision and string is a character variable.
fcn | The name of a user-defined function. |
VRESULT IPhreeqc::SetCurrentSelectedOutputUserNumber | ( | int | n | ) |
Sets the current SELECTED_OUTPUT user number for use in subsequent calls to (GetSelectedOutputColumnCount, GetSelectedOutputFileName, GetSelectedOutputRowCount, GetSelectedOutputString, GetSelectedOutputStringLine, GetSelectedOutputStringLineCount, GetSelectedOutputValue, GetSelectedOutputValue2) routines. The initial setting is 1.
n | The user number as specified in the SELECTED_OUTPUT block. |
VR_OK | Success |
VR_INVALIDARG | The given user number has not been defined. |
void IPhreeqc::SetDumpFileName | ( | const char * | filename | ) |
Sets the name of the dump file. This file name is used if not specified within DUMP input. The default value is dump.id.out, where id is obtained from GetId.
filename | The name of the file to write DUMP output to. |
void IPhreeqc::SetDumpFileOn | ( | bool | bValue | ) |
Sets the dump file switch on or off. This switch controls whether or not phreeqc writes to the DUMP (dump.id.out if unspecified, where id is obtained from GetId) file. The initial setting is false.
bValue | If true, turns on output to the DUMP file; if false, turns off output to the DUMP file. |
void IPhreeqc::SetDumpStringOn | ( | bool | bValue | ) |
Sets the dump string switch on or off. This switch controls whether or not the data normally sent to the dump file are stored in a buffer for retrieval. The initial setting is false.
bValue | If true, captures the output defined by the DUMP keyword into a string buffer; if false, output defined by the DUMP keyword is not captured to a string buffer. |
void IPhreeqc::SetErrorFileName | ( | const char * | filename | ) |
Sets the name of the error file. The default value is phreeqc.id.err, where id is obtained from GetId.
filename | The name of the file to write error output to. |
void IPhreeqc::SetErrorFileOn | ( | bool | bValue | ) |
Sets the error file switch on or off. This switch controls whether or not error messages are written to the phreeqc.id.err (where id is obtained from GetId) file. The initial setting is false.
bValue | If true, writes errors to the error file; if false, no errors are written to the error file. |
void IPhreeqc::SetErrorStringOn | ( | bool | bValue | ) |
Sets the error string switch on or off. This switch controls whether or not the data normally sent to the error file are stored in a buffer for retrieval. The initial setting is true.
bValue | If true, captures error output into a string buffer; if false, error output is not captured to a string buffer. |
void IPhreeqc::SetLogFileName | ( | const char * | filename | ) |
Sets the name of the log file. The default value is phreeqc.id.log, where id is obtained from GetId.
filename | The name of the file to write log output to. |
void IPhreeqc::SetLogFileOn | ( | bool | bValue | ) |
Sets the log file switch on or off. This switch controls whether or not phreeqc writes log messages to the phreeqc.id.log (where id is obtained from GetId) file. The initial setting is false.
bValue | If true, turns on output to the log file; if false, no log messages are written to the log file. |
void IPhreeqc::SetLogStringOn | ( | bool | bValue | ) |
Sets the log string switch on or off. This switch controls whether or not the data normally sent to the log file are stored in a buffer for retrieval. The initial setting is false.
bValue | If true, captures log output into a string buffer; if false, log output is not captured to a string buffer. |
void IPhreeqc::SetOutputFileName | ( | const char * | filename | ) |
Sets the name of the output file. The default value is phreeqc.id.out, where id is obtained from GetId.
filename | The name of the file to write phreeqc output to. |
void IPhreeqc::SetOutputFileOn | ( | bool | bValue | ) |
Sets the output file switch on or off. This switch controls whether or not phreeqc writes to the phreeqc.id.out file (where id is obtained from GetId). This is the output that is normally generated when phreeqc is run. The initial setting is false.
bValue | If true, writes output to the output file; if false, no output is written to the output file. |
void IPhreeqc::SetOutputStringOn | ( | bool | bValue | ) |
Sets the output string switch on or off. This switch controls whether or not the data normally sent to the output file are stored in a buffer for retrieval. The initial setting is false.
bValue | If true, captures output into a string buffer; if false, output is not captured to a string buffer. |
void IPhreeqc::SetSelectedOutputFileName | ( | const char * | filename | ) |
Sets the name of the current selected output file (see SetCurrentSelectedOutputUserNumber). This file name is used if not specified within SELECTED_OUTPUT input. The default value is selected_n.id.out, where id is obtained from GetId.
filename | The name of the file to write SELECTED_OUTPUT output to. |
void IPhreeqc::SetSelectedOutputFileOn | ( | bool | bValue | ) |
Sets the selected-output file switch on or off. This switch controls whether or not phreeqc writes output to the current SELECTED_OUTPUT (selected_n.id.out if unspecified, where id is obtained from GetId) file. The initial setting is false.
bValue | If true, writes output to the selected-output file; if false, no output is written to the selected-output file. |
void IPhreeqc::SetSelectedOutputStringOn | ( | bool | bValue | ) |
Sets the selected output string switch on or off. This switch controls whether or not the data normally sent to the current SELECTED_OUTPUT file (see SetCurrentSelectedOutputUserNumber) are stored in a buffer for retrieval. The initial setting is false.
bValue | If true, captures the output defined by the SELECTED_OUTPUT keyword into a string buffer; if false, output defined by the SELECTED_OUTPUT keyword is not captured to a string buffer. |