IPhreeqc
Public Member Functions | Static Public Member Functions
IPhreeqc Class Reference

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>

Inheritance diagram for IPhreeqc:

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)
 

Detailed Description

Provides an interface to PHREEQC (Version 3)–A Computer Program for Speciation, Batch-Reaction, One-Dimensional Transport, and Inverse Geochemical Calculations.

Constructor & Destructor Documentation

IPhreeqc::IPhreeqc ( void  )

Constructor.

Example:
#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;
case TT_EMPTY:
std::cout << "<empty> ";
break;
case TT_ERROR:
std::cout << "<error> ";
break;
}
}
}
std::cout << std::endl;
}
return EXIT_SUCCESS;
}
virtual IPhreeqc::~IPhreeqc ( void  )
virtual

Destructor

Member Function Documentation

VRESULT IPhreeqc::AccumulateLine ( const char *  line)

Accumlulate line(s) for input to phreeqc.

Parameters
lineThe line(s) to add for input to phreeqc.
Return values
VR_OKSuccess
VR_OUTOFMEMORYOut of memory
See also
ClearAccumulatedLines, OutputAccumulatedLines, RunAccumulated
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.

Parameters
error_msgThe error message to display.
Returns
The current error count.
See also
GetErrorString, GetErrorStringLine, GetErrorStringLineCount, OutputErrorString
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.

Parameters
warning_msgThe warning message to display.
Returns
The current warning count.
See also
GetWarningString, GetWarningStringLine, GetWarningStringLineCount, OutputWarningString
void IPhreeqc::ClearAccumulatedLines ( void  )

Clears the accumulated input buffer. Input buffer is accumulated from calls to AccumulateLine.

See also
AccumulateLine, GetAccumulatedLines, OutputAccumulatedLines, RunAccumulated
const std::string& IPhreeqc::GetAccumulatedLines ( void  )

Retrieve the accumulated input string. The accumulated input string can be run with RunAccumulated.

Returns
The accumulated input string.
See also
AccumulateLine, ClearAccumulatedLines, OutputAccumulatedLines, RunAccumulated
const char* IPhreeqc::GetComponent ( int  n)

Retrieves the given component.

Parameters
nThe zero-based index of the component to retrieve.
Returns
A null terminated string containing the given component. Returns an empty string if n is out of range.
See also
GetComponentCount, ListComponents
size_t IPhreeqc::GetComponentCount ( void  )

Retrieves the number of components in the current list of components.

Returns
The current count of components.
See also
GetComponent, ListComponents
int IPhreeqc::GetCurrentSelectedOutputUserNumber ( void  ) const

Retrieves the current SELECTED_OUTPUT user number. The initial setting is 1.

Returns
The current SELECTED_OUTPUT user number.
See also
GetSelectedOutputColumnCount, GetSelectedOutputFileName, GetSelectedOutputRowCount, GetSelectedOutputString, GetSelectedOutputStringLine, GetSelectedOutputStringLineCount, GetSelectedOutputValue, SetCurrentSelectedOutputUserNumber
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.

Returns
filename The name of the file to write DUMP output to.
See also
GetDumpFileOn, GetDumpString, GetDumpStringOn, GetDumpStringLine, GetDumpStringLineCount, SetDumpFileName, SetDumpFileOn, SetDumpStringOn
bool IPhreeqc::GetDumpFileOn ( void  ) const

Retrieves the current value of the dump file switch.

Return values
trueOutput is written to the DUMP (dump.id.out if unspecified, where id is obtained from GetId) file.
falseNo output is written.
See also
GetDumpStringLine, GetDumpStringLineCount, GetDumpStringOn, GetDumpString, SetDumpFileOn, SetDumpStringOn
const char* IPhreeqc::GetDumpString ( void  ) const

Retrieves the string buffer containing DUMP output.

Returns
A null terminated string containing DUMP output.
Precondition
SetDumpStringOn must have been set to true in order to receive DUMP output.
See also
GetDumpStringLine, GetDumpFileOn, GetDumpStringLineCount, GetDumpStringOn, SetDumpFileOn, SetDumpStringOn
const char* IPhreeqc::GetDumpStringLine ( int  n)

Retrieves the given dump line.

Parameters
nThe zero-based index of the line to retrieve.
Returns
A null terminated string containing the given line. Returns an empty string if n is out of range.
Precondition
SetDumpStringOn must have been set to true.
See also
GetDumpFileOn, GetDumpString, GetDumpStringLineCount, GetDumpStringOn, SetDumpFileOn, SetDumpStringOn
int IPhreeqc::GetDumpStringLineCount ( void  ) const

Retrieves the number of lines in the current dump string buffer.

Returns
The number of lines.
Precondition
SetDumpStringOn must have been set to true.
See also
GetDumpFileOn, GetDumpString, GetDumpStringLine, GetDumpStringOn, SetDumpFileOn, SetDumpStringOn
bool IPhreeqc::GetDumpStringOn ( void  ) const

Retrieves the current value of the dump string switch.

Return values
trueOutput defined by the DUMP keyword is stored.
falseNo output is stored.
See also
GetDumpFileOn, GetDumpString, GetDumpStringLine, GetDumpStringLineCount, SetDumpFileOn, SetDumpStringOn
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.

Returns
filename The name of the file to write to.
See also
GetErrorFileOn, GetErrorString, GetErrorStringOn, GetErrorStringLine, GetErrorStringLineCount, SetErrorFileName, SetErrorFileOn, SetErrorStringOn
bool IPhreeqc::GetErrorFileOn ( void  ) const

Retrieves the current value of the error file switch.

Return values
trueErrors are written to the phreeqc.id.err (where id is obtained from GetId) file.
falseNo errors are written.
See also
SetErrorFileOn
const char* IPhreeqc::GetErrorString ( void  )

Retrieves the error messages from the last call to RunAccumulated, RunFile, RunString, LoadDatabase, or LoadDatabaseString.

Returns
A null terminated string containing error messages.
See also
GetErrorStringLine, GetErrorStringLineCount, GetErrorFileOn, OutputErrorString, SetErrorFileOn
const char* IPhreeqc::GetErrorStringLine ( int  n)

Retrieves the given error line.

Returns
A null terminated string containing the given line of the error string buffer.
Parameters
nThe zero-based index of the line to retrieve.
See also
GetErrorStringLineCount, OutputErrorString
int IPhreeqc::GetErrorStringLineCount ( void  ) const

Retrieves the number of lines in the current error string buffer.

Returns
The number of lines.
See also
GetErrorStringLine, OutputErrorString
bool IPhreeqc::GetErrorStringOn ( void  ) const

Retrieves the current value of the error string switch.

Return values
trueError output is stored.
falseNo error output is stored.
See also
GetErrorFileOn, GetErrorString, GetErrorStringLine, GetErrorStringLineCount, SetErrorFileOn, SetErrorStringOn
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.

Returns
The id.
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.

Returns
filename The name of the file to write to.
See also
GetLogFileOn, GetLogString, GetLogStringOn, GetLogStringLine, GetLogStringLineCount, SetLogFileName, SetLogFileOn, SetLogStringOn
bool IPhreeqc::GetLogFileOn ( void  ) const

Retrieves the current value of the log file switch.

Return values
trueLog messages are written to the phreeqc.id.log (where id is obtained from GetId) file.
falseNo log messages are written.
Remarks
Logging must be enabled through the use of the KNOBS -logfile option in order to receive any log messages.
See also
SetLogFileOn
const char* IPhreeqc::GetLogString ( void  ) const

Retrieves the string buffer containing phreeqc log output.

Returns
A null terminated string containing log output.
Precondition
SetLogStringOn must have been set to true and enabled through the use of the KNOBS -logfile option in order to receive any log messages.
See also
GetLogStringLine, GetLogFileOn, GetLogStringLineCount, GetLogStringOn, SetLogFileOn, SetLogStringOn
const char* IPhreeqc::GetLogStringLine ( int  n) const

Retrieves the given log line.

Parameters
nThe zero-based index of the line to retrieve.
Returns
A null terminated string containing the given line. Returns an empty string if n is out of range.
Precondition
SetLogStringOn must have been set to true and enabled through the use of the KNOBS -logfile option in order to receive any log messages.
See also
GetLogFileOn, GetLogString, GetLogStringLineCount, GetLogStringOn, SetLogFileOn, SetLogStringOn
int IPhreeqc::GetLogStringLineCount ( void  ) const

Retrieves the number of lines in the current log string buffer.

Returns
The number of lines.
Precondition
SetLogStringOn must have been set to true and enabled through the use of the KNOBS -logfile option in order to receive any log messages.
See also
GetLogFileOn, GetLogString, GetLogStringLine, GetLogStringOn, SetLogFileOn, SetLogStringOn
bool IPhreeqc::GetLogStringOn ( void  ) const

Retrieves the current value of the log string switch.

Return values
trueLog output is stored.
falseNo log output is stored.
See also
GetLogFileOn, GetLogString, GetLogStringLine, GetLogStringLineCount, SetLogFileOn, SetLogStringOn
int IPhreeqc::GetNthSelectedOutputUserNumber ( int  n) const

Retrieves the nth user number of the currently defined SELECTED_OUTPUT blocks.

Parameters
nThe zero-based index of the SELECTED_OUTPUT user number to retrieve.
Returns
The nth defined user number; a negative value indicates an error occured.
See also
GetCurrentSelectedOutputUserNumber, GetSelectedOutputCount, SetCurrentSelectedOutputUserNumber
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.

Returns
filename The name of the file to write phreeqc output to.
See also
GetOutputFileOn, GetOutputString, GetOutputStringOn, GetOutputStringLine, GetOutputStringLineCount, SetOutputFileName, SetOutputFileOn, SetOutputStringOn
bool IPhreeqc::GetOutputFileOn ( void  ) const

Retrieves the current value of the output file switch.

Return values
trueOutput is written to the phreeqc.id.out (where id is obtained from GetId) file.
falseNo output is written.
See also
GetOutputFileOn, GetOutputString, GetOutputStringOn, GetOutputStringLine, GetOutputStringLineCount, SetOutputFileName, SetOutputFileOn, SetOutputStringOn
const char* IPhreeqc::GetOutputString ( void  ) const

Retrieves the string buffer containing phreeqc output.

Returns
A null terminated string containing phreeqc output.
Precondition
SetOutputStringOn must have been set to true in order to receive output.
See also
GetOutputStringLine, GetOutputFileOn, GetOutputStringLineCount, GetOutputStringOn, SetOutputFileOn, SetOutputStringOn
const char* IPhreeqc::GetOutputStringLine ( int  n) const

Retrieves the given output line.

Parameters
nThe zero-based index of the line to retrieve.
Returns
A null terminated string containing the given line. Returns an empty string if n is out of range.
Precondition
SetOutputStringOn must have been set to true.
See also
GetOutputFileOn, GetOutputString, GetOutputStringLineCount, GetOutputStringOn, SetOutputFileOn, SetOutputStringOn
int IPhreeqc::GetOutputStringLineCount ( void  ) const

Retrieves the number of lines in the current output string buffer.

Returns
The number of lines.
Precondition
SetOutputStringOn must have been set to true.
See also
GetOutputFileOn, GetOutputString, GetOutputStringLine, GetOutputStringOn, SetOutputFileOn, SetOutputStringOn
bool IPhreeqc::GetOutputStringOn ( void  ) const

Retrieves the current value of the output string switch.

Return values
truePhreeqc output is stored.
falseNo phreeqc output is stored.
See also
GetOutputFileOn, GetOutputString, GetOutputStringLine, GetOutputStringLineCount, SetOutputFileOn, SetOutputStringOn
int IPhreeqc::GetSelectedOutputColumnCount ( void  ) const

Retrieves the number of columns in the current selected-output buffer (see SetCurrentSelectedOutputUserNumber).

Returns
The number of columns.
See also
GetCurrentSelectedOutputUserNumber, GetSelectedOutputRowCount, GetSelectedOutputValue, SetCurrentSelectedOutputUserNumber
int IPhreeqc::GetSelectedOutputCount ( void  ) const

Retrieves the count of SELECTED_OUTPUT blocks that are currently defined.

Returns
The number of SELECTED_OUTPUT blocks.
See also
GetCurrentSelectedOutputUserNumber, GetNthSelectedOutputUserNumber, SetCurrentSelectedOutputUserNumber
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.

Returns
filename The name of the file to write to.
See also
GetCurrentSelectedOutputUserNumber, GetSelectedOutputFileOn, GetSelectedOutputString, GetSelectedOutputStringOn, GetSelectedOutputStringLine, GetSelectedOutputStringLineCount, SetCurrentSelectedOutputUserNumber, SetSelectedOutputFileName, SetSelectedOutputFileOn, SetSelectedOutputStringOn
bool IPhreeqc::GetSelectedOutputFileOn ( void  ) const

Retrieves the current selected-output file switch (see SetCurrentSelectedOutputUserNumber).

Return values
trueOutput is written to the selected-output (selected_n.id.out if unspecified, where id is obtained from GetId) file.
falseNo output is written.
See also
GetSelectedOutputValue, GetSelectedOutputColumnCount, GetSelectedOutputRowCount, SetCurrentSelectedOutputUserNumber, SetSelectedOutputFileOn
int IPhreeqc::GetSelectedOutputRowCount ( void  ) const
const char* IPhreeqc::GetSelectedOutputString ( void  ) const

Retrieves the string buffer containing SELECTED_OUTPUT for the currently selected user number (see SetCurrentSelectedOutputUserNumber).

Returns
A null terminated string containing SELECTED_OUTPUT.
Precondition
SetSelectedOutputStringOn must have been set to true in order to receive SELECTED_OUTPUT.
See also
GetCurrentSelectedOutputUserNumber, GetSelectedOutputStringLine, GetSelectedOutputFileOn, GetSelectedOutputStringLineCount, GetSelectedOutputStringOn, GetSelectedOutputString, SetCurrentSelectedOutputUserNumber, SetSelectedOutputFileOn, SetSelectedOutputStringOn
const char* IPhreeqc::GetSelectedOutputStringLine ( int  n)

Retrieves the given selected output line of the currently selected user number (see SetCurrentSelectedOutputUserNumber).

Parameters
nThe zero-based index of the line to retrieve.
Returns
A null terminated string containing the given line. Returns an empty string if n is out of range.
Precondition
SetSelectedOutputStringOn must have been set to true.
See also
GetCurrentSelectedOutputUserNumber, GetSelectedOutputFileOn, GetSelectedOutputString, GetSelectedOutputStringLineCount, GetSelectedOutputStringOn, SetCurrentSelectedOutputUserNumber, SetSelectedOutputFileOn, SetSelectedOutputStringOn
int IPhreeqc::GetSelectedOutputStringLineCount ( void  ) const
bool IPhreeqc::GetSelectedOutputStringOn ( void  ) const

Retrieves the value of the current selected output string switch (see SetCurrentSelectedOutputUserNumber).

Return values
trueOutput defined by the SELECTED_OUTPUT keyword is stored.
falseNo output is stored.
See also
GetSelectedOutputFileOn, GetSelectedOutputString, GetSelectedOutputStringLine, GetSelectedOutputStringLineCount, SetCurrentSelectedOutputUserNumber, SetSelectedOutputFileOn, SetSelectedOutputStringOn
VRESULT IPhreeqc::GetSelectedOutputValue ( int  row,
int  col,
VAR pVAR 
)

Returns the VAR associated with the specified row and column. The current SELECTED_OUTPUT block is set using the SetCurrentSelectedOutputUserNumber method.

Parameters
rowThe row index.
colThe column index.
pVARPointer to the VAR to receive the requested data.
Return values
VR_OKSuccess.
VR_INVALIDROWThe given row is out of range.
VR_INVALIDCOLThe given column is out of range.
VR_OUTOFMEMORYMemory could not be allocated.
VR_BADINSTANCEThe given id is invalid.
See also
GetCurrentSelectedOutputUserNumber, GetSelectedOutputColumnCount, GetSelectedOutputFileOn, GetSelectedOutputRowCount, GetSelectedOutputValue2, SetCurrentSelectedOutputUserNumber, SetSelectedOutputFileOn
Remarks
Row 0 contains the column headings to the selected_ouput.
Examples:
The headings will include a suffix and/or prefix in order to differentiate the columns.

Input Headings
  SELECTED_OUTPUT
        -reset false
        -totals Ca Na
  Ca(mol/kgw)  Na(mol/kgw)
  SELECTED_OUTPUT
        -reset false
        -molalities Fe+2 Hfo_sOZn+
  m_Fe+2(mol/kgw)  m_Hfo_sOZn+(mol/kgw)
  SELECTED_OUTPUT
        -reset false
        -activities H+ Ca+2
  la_H+  la_Ca+2
  SELECTED_OUTPUT
        -reset false
        -equilibrium_phases Calcite Dolomite
  Calcite  d_Calcite  Dolomite  d_Dolomite
  SELECTED_OUTPUT
        -reset false
        -saturation_indices CO2(g) Siderite
  si_CO2(g)  si_Siderite
  SELECTED_OUTPUT
        -reset false
        -gases CO2(g) N2(g)
  pressure "total mol" volume g_CO2(g) g_N2(g)
  SELECTED_OUTPUT
        -reset false
        -kinetic_reactants CH2O Pyrite
  k_CH2O dk_CH2O k_Pyrite dk_Pyrite
  SELECTED_OUTPUT
        -reset false
        -solid_solutions CaSO4 SrSO4
  s_CaSO4 s_SrSO4
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.

Parameters
rowThe row index.
colThe column index.
vtypeReceives the variable type. See VAR_TYPE.
dvalueReceives the numeric value when (VTYPE=TT_DOUBLE) or (VTYPE=TT_LONG).
svalueReceives 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_lengthThe length of the svalue buffer.
Return values
IPQ_OKSuccess.
IPQ_INVALIDROWThe given row is out of range.
IPQ_INVALIDCOLThe given column is out of range.
IPQ_OUTOFMEMORYMemory could not be allocated.
IPQ_BADINSTANCEThe given id is invalid.
See also
GetSelectedOutputFileOn, GetSelectedOutputColumnCount, GetSelectedOutputRowCount, GetSelectedOutputValue, SetCurrentSelectedOutputUserNumber, SetSelectedOutputFileOn
Remarks
Row 0 contains the column headings to the selected_ouput.
Examples:
See GetSelectedOutputValue.
static const char* IPhreeqc::GetVersionString ( void  )
static

Retrieves the string buffer containing the version in the form of X.X.X-XXXX.

Returns
A null terminated string containing the IPhreeqc version number.
const char* IPhreeqc::GetWarningString ( void  )

Retrieves the warning messages from the last call to RunAccumulated, RunFile, RunString, LoadDatabase, or LoadDatabaseString.

Returns
A null terminated string containing warning messages.
See also
GetWarningStringLine, GetWarningStringLineCount, OutputWarningString
const char* IPhreeqc::GetWarningStringLine ( int  n)

Retrieves the given warning line.

Parameters
nThe zero-based index of the line to retrieve.
Returns
A null terminated string containing the given warning line message.
See also
GetWarningStringLineCount, OutputWarningString
int IPhreeqc::GetWarningStringLineCount ( void  ) const

Retrieves the number of lines in the current warning string buffer.

Returns
The number of lines.
See also
GetWarningStringLine, GetWarningString, OutputWarningString
std::list< std::string > IPhreeqc::ListComponents ( void  )

Retrieves the current list of components.

Returns
The current list of components.
See also
GetComponent, GetComponentCount
int IPhreeqc::LoadDatabase ( const char *  filename)

Load the specified database file into phreeqc.

Parameters
filenameThe 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.
Returns
The number of errors encountered.
See also
LoadDatabaseString
Remarks
All previous definitions are cleared.
int IPhreeqc::LoadDatabaseString ( const char *  input)

Load the specified string as a database into phreeqc.

Parameters
inputString containing data to be used as the phreeqc database.
Returns
The number of errors encountered.
See also
LoadDatabaseString
Remarks
All previous definitions are cleared.
void IPhreeqc::OutputAccumulatedLines ( void  )

Output the accumulated input buffer to stdout. The input buffer can be run with a call to RunAccumulated.

See also
AccumulateLine, ClearAccumulatedLines, 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.

See also
GetErrorStringLine, GetErrorStringLineCount, GetErrorFileOn, SetErrorFileOn
void IPhreeqc::OutputWarningString ( void  )

Output the warning messages to stdout.

See also
GetWarningStringLine, GetWarningStringLineCount, GetWarningString
int IPhreeqc::RunAccumulated ( void  )

Runs the input buffer as defined by calls to AccumulateLine.

Returns
The number of errors encountered.
See also
AccumulateLine, ClearAccumulatedLines, OutputAccumulatedLines, RunFile, RunString
Remarks
The accumulated input is cleared at the next call to AccumulateLine.
Precondition
LoadDatabase/LoadDatabaseString must have been called and returned 0 (zero) errors.
int IPhreeqc::RunFile ( const char *  filename)

Runs the specified phreeqc input file.

Parameters
filenameThe name of the phreeqc input file to run.
Returns
The number of errors encountered during the run.
See also
RunAccumulated, RunString
Precondition
LoadDatabase/LoadDatabaseString must have been called and returned 0 (zero) errors.
int IPhreeqc::RunString ( const char *  input)

Runs the specified string as input to phreeqc.

Parameters
inputString containing phreeqc input.
Returns
The number of errors encountered during the run.
See also
RunAccumulated, RunFile
Precondition
LoadDatabase/LoadDatabaseString must have been called and returned 0 (zero) errors.
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)

Parameters
fcnThe name of a user-defined function.
cookie1A user defined value to be passed to the callback function.
See also
SetBasicFortranCallback
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.

Parameters
fcnThe name of a user-defined function.
See also
SetBasicCallback
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.

Parameters
nThe user number as specified in the SELECTED_OUTPUT block.
Return values
VR_OKSuccess
VR_INVALIDARGThe given user number has not been defined.
See also
GetCurrentSelectedOutputUserNumber, GetSelectedOutputColumnCount, GetSelectedOutputFileName, GetSelectedOutputRowCount, GetSelectedOutputString, GetSelectedOutputStringLine, GetSelectedOutputStringLineCount, GetSelectedOutputValue
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.

Parameters
filenameThe name of the file to write DUMP output to.
See also
GetDumpFileName, GetDumpFileOn, GetDumpString, GetDumpStringOn, GetDumpStringLine, GetDumpStringLineCount, SetDumpStringOn
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.

Parameters
bValueIf true, turns on output to the DUMP file; if false, turns off output to the DUMP file.
See also
GetDumpFileOn, GetDumpString, GetDumpStringOn, GetDumpStringLine, GetDumpStringLineCount, SetDumpStringOn
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.

Parameters
bValueIf 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.
See also
GetDumpFileOn, GetDumpString, GetDumpStringOn, GetDumpStringLine, GetDumpStringLineCount, SetDumpFileOn
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.

Parameters
filenameThe name of the file to write error output to.
See also
GetErrorFileName, GetErrorFileOn, GetErrorString, GetErrorStringOn, GetErrorStringLine, GetErrorStringLineCount, SetErrorFileOn, SetErrorStringOn
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.

Parameters
bValueIf true, writes errors to the error file; if false, no errors are written to the error file.
See also
GetErrorStringLine, GetErrorStringLineCount, GetErrorFileOn, OutputErrorString
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.

Parameters
bValueIf true, captures error output into a string buffer; if false, error output is not captured to a string buffer.
See also
GetErrorFileOn, GetErrorString, GetErrorStringOn, GetErrorStringLine, GetErrorStringLineCount, SetErrorFileOn
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.

Parameters
filenameThe name of the file to write log output to.
See also
GetLogFileName, GetLogFileOn, GetLogString, GetLogStringOn, GetLogStringLine, GetLogStringLineCount, SetLogFileOn, SetLogStringOn
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.

Parameters
bValueIf true, turns on output to the log file; if false, no log messages are written to the log file.
Remarks
Logging must be enabled through the use of the KNOBS -logfile option in order to receive any log messages.
See also
GetLogFileOn
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.

Parameters
bValueIf true, captures log output into a string buffer; if false, log output is not captured to a string buffer.
See also
GetLogFileOn, GetLogString, GetLogStringOn, GetLogStringLine, GetLogStringLineCount, SetLogFileOn
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.

Parameters
filenameThe name of the file to write phreeqc output to.
See also
GetOutputFileName, GetOutputFileOn, GetOutputString, GetOutputStringOn, GetOutputStringLine, GetOutputStringLineCount, SetOutputFileOn, SetOutputStringOn
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.

Parameters
bValueIf true, writes output to the output file; if false, no output is written to the output file.
See also
GetOutputFileOn
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.

Parameters
bValueIf true, captures output into a string buffer; if false, output is not captured to a string buffer.
See also
GetOutputFileOn, GetOutputString, GetOutputStringOn, GetOutputStringLine, GetOutputStringLineCount, SetOutputFileOn
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.

Parameters
filenameThe name of the file to write SELECTED_OUTPUT output to.
See also
GetSelectedOutputFileName, GetSelectedOutputFileOn, GetSelectedOutputString, GetSelectedOutputStringOn, GetSelectedOutputStringLine, GetSelectedOutputStringLineCount, SetCurrentSelectedOutputUserNumber, SetSelectedOutputStringOn
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.

Parameters
bValueIf true, writes output to the selected-output file; if false, no output is written to the selected-output file.
See also
GetSelectedOutputColumnCount, GetSelectedOutputFileOn, GetSelectedOutputRowCount, GetSelectedOutputValue, SetCurrentSelectedOutputUserNumber
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.

Parameters
bValueIf 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.
See also
GetSelectedOutputFileOn, GetSelectedOutputString, GetSelectedOutputStringOn, GetSelectedOutputStringLine, GetSelectedOutputStringLineCount, SetCurrentSelectedOutputUserNumber, SetSelectedOutputFileOn

The documentation for this class was generated from the following file: