|
IPhreeqc 2.18
|
Provides an interface to PHREEQC (Version 2)--A Computer Program for Speciation, Batch-Reaction, One-Dimensional Transport, and Inverse Geochemical Calculations. More...
#include <IPhreeqc.hpp>
Public Member Functions | |
| IPhreeqc (void) | |
| ~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) |
| bool | GetDumpFileOn (void) const |
| const char * | GetDumpString (void) |
| const char * | GetDumpStringLine (int n) |
| int | GetDumpStringLineCount (void) const |
| bool | GetDumpStringOn (void) const |
| bool | GetErrorFileOn (void) const |
| const char * | GetErrorString (void) |
| const char * | GetErrorStringLine (int n) |
| int | GetErrorStringLineCount (void) const |
| bool | GetLogFileOn (void) const |
| bool | GetOutputFileOn (void) const |
| int | GetSelectedOutputColumnCount (void) const |
| bool | GetSelectedOutputFileOn (void) const |
| int | GetSelectedOutputRowCount (void) const |
| VRESULT | GetSelectedOutputValue (int row, int col, VAR *pVAR) |
| 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 | SetDumpFileOn (bool bValue) |
| void | SetDumpStringOn (bool bValue) |
| void | SetErrorFileOn (bool bValue) |
| void | SetLogFileOn (bool bValue) |
| void | SetOutputFileOn (bool bValue) |
| void | SetSelectedOutputFileOn (bool bValue) |
Provides an interface to PHREEQC (Version 2)--A Computer Program for Speciation, Batch-Reaction, One-Dimensional Transport, and Inverse Geochemical Calculations.
| IPhreeqc::IPhreeqc | ( | void | ) |
#include <cstdlib> #include <iostream> #include <IPhreeqc.hpp> int main(void) { IPhreeqc iphreeqc; if (iphreeqc.LoadDatabase("phreeqc.dat") != 0) { std::cout << iphreeqc.GetErrorString() << std::endl; return EXIT_FAILURE; } iphreeqc.AccumulateLine("TITLE Example 2.--Temperature dependence of solubility"); iphreeqc.AccumulateLine(" of gypsum and anhydrite "); iphreeqc.AccumulateLine("SOLUTION 1 Pure water "); iphreeqc.AccumulateLine(" pH 7.0 "); iphreeqc.AccumulateLine(" temp 25.0 "); iphreeqc.AccumulateLine("EQUILIBRIUM_PHASES 1 "); iphreeqc.AccumulateLine(" Gypsum 0.0 1.0 "); iphreeqc.AccumulateLine(" Anhydrite 0.0 1.0 "); iphreeqc.AccumulateLine("REACTION_TEMPERATURE 1 "); iphreeqc.AccumulateLine(" 25.0 75.0 in 51 steps "); iphreeqc.AccumulateLine("SELECTED_OUTPUT "); iphreeqc.AccumulateLine(" -file ex2.sel "); iphreeqc.AccumulateLine(" -temperature "); iphreeqc.AccumulateLine(" -si anhydrite gypsum "); iphreeqc.AccumulateLine("END "); if (iphreeqc.RunAccumulated() != 0) { std::cout << iphreeqc.GetErrorString() << std::endl; return EXIT_FAILURE; } VAR v; ::VarInit(&v); std::cout << "selected-output:" << std::endl; for (int i = 0; i < iphreeqc.GetSelectedOutputRowCount(); ++i) { for (int j = 0; j < iphreeqc.GetSelectedOutputColumnCount(); ++j) { if (iphreeqc.GetSelectedOutputValue(i, j, &v) == VR_OK) { switch (v.type) { case TT_LONG: std::cout << v.lVal << " "; break; case TT_DOUBLE: std::cout << v.dVal << " "; break; case TT_STRING: std::cout << v.sVal << " "; break; } } ::VarClear(&v); } std::cout << std::endl; } return EXIT_SUCCESS; }
| IPhreeqc::~IPhreeqc | ( | void | ) |
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.
| bool IPhreeqc::GetDumpFileOn | ( | void | ) | const |
Retrieves the current value of the dump file switch.
| true | Output is written to the DUMP (dump.out if unspecified) file. |
| false | No output is written. |
| const char* IPhreeqc::GetDumpString | ( | void | ) |
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. |
| bool IPhreeqc::GetErrorFileOn | ( | void | ) | const |
Retrieves the current value of the error file switch.
| true | Errors are written to the phreeqc.err 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::GetLogFileOn | ( | void | ) | const |
Retrieves the current value of the log file switch.
| true | Log messages are written to the phreeqc.log file. |
| false | No log messages are written. |
| bool IPhreeqc::GetOutputFileOn | ( | void | ) | const |
Retrieves the current value of the output file switch.
| true | Output is written to the phreeqc.out file. |
| false | No output is written. |
| int IPhreeqc::GetSelectedOutputColumnCount | ( | void | ) | const |
Retrieves the number of columns in the selected-output buffer.
| bool IPhreeqc::GetSelectedOutputFileOn | ( | void | ) | const |
Retrieves the selected-output file switch.
| true | Output is written to the selected-output (selected.out if unspecified) file. |
| false | No output is written. |
| int IPhreeqc::GetSelectedOutputRowCount | ( | void | ) | const |
Retrieves the number of rows in the selected-output buffer.
Returns the VAR associated with the specified row and column.
| row | The row index. |
| col | The column index. |
| pVAR | Pointer to the VAR to recieve 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 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.err 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::SetDumpFileOn | ( | bool | bValue | ) |
Sets the dump file switch on or off. This switch controls whether or not phreeqc writes to the DUMP (dump.out if unspecified) 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::SetErrorFileOn | ( | bool | bValue | ) |
Sets the error file switch on or off. This switch controls whether or not error messages are written to the phreeqc.err 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::SetLogFileOn | ( | bool | bValue | ) |
Sets the log file switch on or off. This switch controls whether or not phreeqc writes log messages to the phreeqc.log 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::SetOutputFileOn | ( | bool | bValue | ) |
Sets the output file switch on or off. This switch controls whether or not phreeqc writes to the phreeqc.out file. 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::SetSelectedOutputFileOn | ( | bool | bValue | ) |
Sets the selected-output file switch on or off. This switch controls whether or not phreeqc writes output to the SELECTED_OUTPUT (selected.out if unspecified) 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. |
1.7.3