/*! @file IPhreeqc.h
@brief C/Fortran Documentation
*/
#ifndef INC_IPHREEQC_H
#define INC_IPHREEQC_H
#include "Var.h"
/*! \brief Enumeration used to return error codes.
*/
typedef enum {
IPQ_OK = 0, /*!< Success */
IPQ_OUTOFMEMORY = -1, /*!< Failure, Out of memory */
IPQ_BADVARTYPE = -2, /*!< Failure, Invalid VAR type */
IPQ_INVALIDARG = -3, /*!< Failure, Invalid argument */
IPQ_INVALIDROW = -4, /*!< Failure, Invalid row */
IPQ_INVALIDCOL = -5, /*!< Failure, Invalid column */
IPQ_BADINSTANCE = -6, /*!< Failure, Invalid instance id */
} IPQ_RESULT;
#if defined(__cplusplus)
extern "C" {
#endif
/**
* Accumlulate line(s) for input to phreeqc.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param line The line(s) to add for input to phreeqc.
* @retval IPQ_OK Success
* @retval IPQ_OUTOFMEMORY Out of memory
* @see OutputAccumulatedLines, RunAccumulated
* @par Fortran90 Interface:
* @htmlonly
*
*
* @endhtmlonly
*
* @par C Example:
* \include AccumulateLine.c
*
* @par Fortran90 Example:
* see \ref GetDumpStringLine_f90 "GetDumpStringLine"
*/
IPQ_DLL_EXPORT IPQ_RESULT AccumulateLine(int id, const char *line);
/**
* Appends the given error message and increments the error count.
* Internally used to create an error condition.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param error_msg The error message to display.
* @returns The current error count if successful; otherwise a negative value indicates an error occured (see \ref IPQ_RESULT).
* @par Fortran90 Interface:
* @htmlonly
* Not implemented.
* @endhtmlonly
*/
IPQ_DLL_EXPORT int AddError(int id, const char* error_msg);
/**
* Clears the accumulated input buffer. Input buffer is accumulated from calls to \ref AccumulateLine.
* @retval IPQ_OK Success.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see AccumulateLine, OutputAccumulatedLines, RunAccumulated
*/
IPQ_DLL_EXPORT IPQ_RESULT ClearAccumulatedLines(int id);
/**
* Create a new IPhreeqc instance.
* @return A non-negative value if successful; otherwise a negative value indicates an error occured (see \ref IPQ_RESULT).
* @see DestroyIPhreeqc, UnLoadDatabase
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION AccumulateLine(LINE)
* INTEGER(KIND=4), INTENT(IN) :: ID
* CHARACTER(LEN=*), INTENT(IN) :: LINE
* INTEGER(KIND=4) :: AccumulateLine
* END FUNCTION AccumulateLine
*
*
*
* @endhtmlonly
*
* \anchor CreateIPhreeqc_c
* @par C Example:
* \include CreateIPhreeqc.c
*
* \anchor CreateIPhreeqc_f90
* @par Fortran90 Example:
* \include F90CreateIPhreeqc.f90
*/
IPQ_DLL_EXPORT int CreateIPhreeqc(void);
/**
* Release an IPhreeqc instance from memory.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @retval IPQ_OK Success
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see CreateIPhreeqc, UnLoadDatabase
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION CreateIPhreeqc()
* INTEGER(KIND=4) :: CreateIPhreeqc
* END FUNCTION CreateIPhreeqc
*
*
*
* @endhtmlonly
*
* @par C Example:
* see \ref CreateIPhreeqc_c "CreateIPhreeqc"
*
* @par Fortran90 Example:
* see \ref CreateIPhreeqc_f90 "CreateIPhreeqc"
*/
IPQ_DLL_EXPORT IPQ_RESULT DestroyIPhreeqc(int id);
/**
* Retrieves the given component.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param n The zero-based index of the component to retrieve.
* @return A null terminated string containing the given component.
* Returns an empty string if n is out of range.
* @see GetComponentCount
* @par Fortran90 Interface:
* (Note: N is one-based for the fortran interface)
* @htmlonly
*
* FUNCTION DestroyIPhreeqc(ID)
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4) :: DestroyIPhreeqc
* END FUNCTION DestroyIPhreeqc
*
*
*
* @endhtmlonly
*
* \anchor GetComponent_c
* @par C Example:
* \include GetComponent.c
*
* \anchor GetComponent_f90
* @par Fortran90 Example:
* \include F90GetComponent.f90
*/
IPQ_DLL_EXPORT const char* GetComponent(int id, int n);
/**
* Retrieves the number of components in the current component list .
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return The current count of components.
* A negative value indicates an error occured (see \ref IPQ_RESULT).
* @see GetComponent
* @par Fortran90 Interface:
* @htmlonly
*
* SUBROUTINE GetComponent(ID,N,COMP)
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4), INTENT(IN) :: N
* CHARACTER(LEN=*), INTENT(OUT) :: COMP
* END SUBROUTINE GetComponent
*
*
*
* @endhtmlonly
*
* @par C Example:
* see \ref GetComponent_c "GetComponent"
*
* @par Fortran90 Example:
* see \ref GetComponent_f90 "GetComponent"
*/
IPQ_DLL_EXPORT int GetComponentCount(int id);
/**
* Retrieves the given dump line.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param n The zero-based index of the line to retrieve.
* @return A null terminated string containing the given line.
* Returns an empty string if n is out of range.
* @pre \ref SetDumpStringOn must have been set to true (non-zero).
* @see GetDumpStringLineCount, SetDumpStringOn
* @par Fortran90 Interface:
* @htmlonly
* (Note: N is one-based for the Fortran interface.)
*
* FUNCTION GetComponentCount(ID)
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4) :: GetComponentCount
* END FUNCTION GetComponentCount
*
*
*
* @endhtmlonly
*
* \anchor GetDumpStringLine_f90
* @par Fortran90 Example:
* \include F90GetDumpStringLine.f90
*/
IPQ_DLL_EXPORT const char* GetDumpStringLine(int id, int n);
/**
* Retrieves the number of lines in the current dump string buffer.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return The number of lines.
* @pre \ref SetDumpStringOn must have been set to true (non-zero).
* @see GetDumpStringLine, SetDumpStringOn
* @par Fortran90 Interface:
* @htmlonly
*
* SUBROUTINE GetDumpStringLine(ID,N,LINE)
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4), INTENT(IN) :: N
* CHARACTER(LEN=*), INTENT(OUT) :: LINE
* END SUBROUTINE GetComponent
*
*
*
* @endhtmlonly
*
* @par Fortran90 Example:
* see \ref GetDumpStringLine_f90 "GetDumpStringLine"
*/
IPQ_DLL_EXPORT int GetDumpStringLineCount(int id);
/**
* Retrieves the current value of the dump file switch.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return Non-zero if output is written to the DUMP (dump.out if unspecified) file, 0 (zero) otherwise.
* @see SetDumpFileOn, GetDumpStringLineCount, GetDumpStringLine, GetDumpString
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION GetDumpStringLineCount(ID)
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4) :: GetDumpStringLineCount
* END FUNCTION GetDumpStringLineCount
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetDumpFileOn(int id);
/**
* Retrieves the string buffer containing DUMP output.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return A null terminated string containing DUMP output.
* @pre \ref SetDumpStringOn must have been set to true (non-zero) in order to recieve DUMP output.
* @see SetDumpStringOn
* @par Fortran90 Interface:
* Not implemented. (see \ref GetDumpStringLineCount, \ref GetDumpStringLine)
*
* \anchor GetDumpString_c
* @par C Example:
* \include GetDumpString.c
*/
IPQ_DLL_EXPORT const char* GetDumpString(int id);
/**
* Retrieves the current value of the dump string flag.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return Non-zero if output defined by the DUMP keyword is stored, 0 (zero) otherwise.
* @see SetDumpStringOn, GetDumpString
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION GetDumpFileOn(DUMP_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4) :: GetDumpFileOn
* END FUNCTION SetDumpFileOn
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetDumpStringOn(int id);
/**
* Retrieves the given error line.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param n The zero-based index of the line to retrieve.
* @return A null terminated string containing the given error line message.
* @see GetErrorStringLineCount, OutputErrorString
* @par Fortran90 Interface:
* (Note: N is one-based for the Fortran interface.)
* @htmlonly
*
* FUNCTION GetDumpStringOn(DUMP_STRING_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4) :: GetDumpStringOn
* END FUNCTION GetDumpStringOn
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT const char* GetErrorStringLine(int id, int n);
/**
* Retrieves the number of lines in the current error string buffer.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return The number of lines.
* @see GetErrorStringLine, OutputErrorString
* @par Fortran90 Interface:
* @htmlonly
*
* SUBROUTINE GetErrorStringLine
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4), INTENT(IN) :: N
* CHARACTER(LEN=*), INTENT(OUT) :: LINE
* END SUBROUTINE GetErrorStringLine
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetErrorStringLineCount(int id);
/**
* Retrieves the current value of the error file switch.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return Non-zero if errors are written to the phreeqc.err file, 0 (zero) otherwise.
* @see SetErrorFileOn
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION GetErrorStringLineCount
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4) :: GetErrorStringLineCount
* END FUNCTION GetErrorStringLineCount
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetErrorFileOn(int id);
/**
* Retrieves the error messages from the last call to \ref RunAccumulated, \ref RunFile, \ref RunString, \ref LoadDatabase, or \ref LoadDatabaseString.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return A null terminated string containing error messages.
* @par Fortran90 Interface:
* Not implemented. (see \ref GetErrorStringLineCount, \ref GetErrorStringLine, \ref OutputErrorString)
*/
IPQ_DLL_EXPORT const char* GetErrorString(int id);
/**
* Retrieves the current value of the log file switch.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return Non-zero if output is written to the phreeqc.log file, 0 (zero) otherwise.
* @see SetLogFileOn
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION GetErrorFileOn(ERROR_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4) :: GetErrorFileOn
* END FUNCTION GetErrorFileOn
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetLogFileOn(int id);
/**
* Retrieves the current value of the output file switch.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return Non-zero if output is written to the phreeqc.out file, 0 (zero) otherwise.
* @see SetOutputFileOn
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION GetLogFileOn(ID)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4) :: GetLogFileOn
* END FUNCTION GetLogFileOn
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetOutputFileOn(int id);
/**
* Retrieves the number of columns in the selected-output buffer.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return The number of columns.
* @see GetSelectedOutputRowCount, GetSelectedOutputValue
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION GetOutputFileOn(ID)
* INTEGER(KIND=4), INTENT(IN) :: ID
* END FUNCTION GetOutputFileOn
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetSelectedOutputColumnCount(int id);
/**
* Retrieves the selected-output file switch.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return Non-zero if output is written to the selected-output (selected.out if unspecified) file, 0 (zero) otherwise.
* @see SetSelectedOutputFileOn
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION GetSelectedOutputColumnCount
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4) :: GetSelectedOutputColumnCount
* END FUNCTION GetSelectedOutputColumnCount
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetSelectedOutputFileOn(int id);
/**
* Retrieves the number of rows in the selected-output buffer.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return The number of rows.
* @see GetSelectedOutputColumnCount, GetSelectedOutputValue
* @par Fortran90 Interface:
* @htmlonly
*
* FUNCTION GetSelectedOutputFileOn(SELECTED_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4) :: GetSelectedOutputFileOn
* END FUNCTION GetSelectedOutputFileOn
*
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetSelectedOutputRowCount(int id);
/**
* Returns the \c VAR associated with the specified row and column.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param row The row index.
* @param col The column index.
* @param pVAR Pointer to the \c VAR to recieve the requested data.
* @retval IPQ_OK Success.
* @retval IPQ_INVALIDROW The given row is out of range.
* @retval IPQ_INVALIDCOL The given column is out of range.
* @retval IPQ_OUTOFMEMORY Memory could not be allocated.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @remarks
* Row 0 contains the column headings to the selected_ouput.
* @par Examples:
* The headings will include a suffix and/or prefix in order to differentiate the
* columns.
* @htmlonly
* FUNCTION GetSelectedOutputRowCount
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4) :: GetSelectedOutputRowCount
* END FUNCTION GetSelectedOutputRowCount
*
*
| Input | Headings |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*
* FUNCTION GetSelectedOutputValue(ID,ROW,COL,VTYPE,DVALUE,SVALUE)
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4), INTENT(IN) :: ROW
* INTEGER(KIND=4), INTENT(IN) :: COL
* INTEGER(KIND=4), INTENT(OUT) :: VTYPE
* REAL*8, INTENT(OUT) :: DVALUE
* CHARACTER(LEN=*), INTENT(OUT) :: SVALUE
* INTEGER(KIND=4) :: GetSelectedOutputValue
* END FUNCTION GetSelectedOutputValue
*
*
* @endhtmlonly
* @param ID The instance id returned from \ref CreateIPhreeqc.
* @param ROW The row index.
* @param COL The column index.
* @param VTYPE Returns the variable type. See \ref VAR_TYPE.
* @param DVALUE Returns the numeric value when (VTYPE=\ref TT_DOUBLE) or (VTYPE=\ref TT_LONG).
* @param SVALUE Returns the string variable when (VTYPE=\ref TT_STRING). When (VTYPE=\ref TT_DOUBLE) or (VTYPE=\ref TT_LONG) this variable is filled with a string equivalent of DVALUE.
*/
IPQ_DLL_EXPORT IPQ_RESULT GetSelectedOutputValue(int id, int row, int col, VAR* pVAR);
/**
* Retrieves the given warning line.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param n The zero-based index of the line to retrieve.
* @return A null terminated string containing the given warning line message.
* @see GetWarningStringLineCount, OutputWarningString
* @par Fortran90 Interface:
* (Note: N is one-based for the Fortran interface.)
* @htmlonly
*
*
* SUBROUTINE GetWarningStringLine(ID,N,LINE)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4), INTENT(IN) :: DUMP_ON
* END SUBROUTINE GetWarningStringLine
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT const char* GetWarningStringLine(int id, int n);
/**
* Retrieves the number of lines in the current warning string buffer.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return The number of lines.
* @see GetWarningStringLine, OutputWarningString
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION GetWarningStringLineCount(ID)
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4) :: GetWarningStringLineCount
* END FUNCTION GetWarningStringLineCount
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int GetWarningStringLineCount(int id);
/**
* Retrieves the warning messages from the last call to \ref RunAccumulated, \ref RunFile, \ref RunString, \ref LoadDatabase, or \ref LoadDatabaseString.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return A null terminated string containing warning messages.
* @see GetWarningStringLine, GetWarningStringLineCount, OutputWarningString
* @par Fortran90 Interface:
* Not implemented. (see \ref GetWarningStringLineCount, \ref GetWarningStringLine, \ref OutputWarningString)
*/
IPQ_DLL_EXPORT const char* GetWarningString(int id);
/**
* Load the specified database file into phreeqc.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param filename The name of the phreeqc database to load.
* The full path (or relative path with respect to the working directory)
* must be given if the file is not in the current working directory.
* @return The number of errors encountered.
* @see LoadDatabaseString, UnLoadDatabase
* @remarks
* All previous definitions are cleared.
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION LoadDatabase(FILENAME)
* INTEGER(KIND=4), INTENT(IN) :: ID
* CHARACTER(LEN=*), INTENT(IN) :: FILENAME
* INTEGER(KIND=4) :: LoadDatabase
* END FUNCTION LoadDatabase
*
*
* @endhtmlonly
*
* @par C Example:
* see \ref CreateIPhreeqc_c "CreateIPhreeqc"
*
* @par Fortran90 Example:
* see \ref CreateIPhreeqc_f90 "CreateIPhreeqc"
*/
IPQ_DLL_EXPORT int LoadDatabase(int id, const char* filename);
/**
* Load the specified string as a database into phreeqc.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param input String containing data to be used as the phreeqc database.
* @return The number of errors encountered.
* @see LoadDatabase, UnLoadDatabase
* @remarks
* All previous definitions are cleared.
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION LoadDatabaseString(INPUT)
* INTEGER(KIND=4), INTENT(IN) :: ID
* CHARACTER(LEN=*), INTENT(IN) :: INPUT
* INTEGER(KIND=4) :: LoadDatabaseString
* END FUNCTION LoadDatabaseString
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int LoadDatabaseString(int id, const char* input);
/**
* Output the error messages normally stored in the phreeqc.err file to stdout.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @see GetErrorStringLine, GetErrorStringLineCount
* @par Fortran90 Interface:
* @htmlonly
*
*
* SUBROUTINE OutputErrorString
* INTEGER(KIND=4), INTENT(IN) :: ID
* END SUBROUTINE OutputErrorString
*
*
* @endhtmlonly
*
* @par C Example:
* see \ref GetComponent_c "GetComponent"
*
* @par Fortran90 Example:
* see \ref GetDumpStringLine_f90 "GetDumpStringLine"
*/
IPQ_DLL_EXPORT void OutputErrorString(int id);
/**
* Output the accumulated input buffer to stdout. This input buffer can be run with a call to \ref RunAccumulated.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @see AccumulateLine, ClearAccumulatedLines, RunAccumulated
* @par Fortran90 Interface:
* @htmlonly
*
*
* SUBROUTINE OutputAccumulatedLines
* INTEGER(KIND=4), INTENT(IN) :: ID
* END SUBROUTINE OutputAccumulatedLines
*
*
* @endhtmlonly
*
* @par Fortran90 Example:
* see \ref GetDumpStringLine_f90 "GetDumpStringLine"
*/
IPQ_DLL_EXPORT void OutputAccumulatedLines(int id);
/**
* Output the warning messages to stdout.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @see GetWarningStringLine, GetWarningStringLineCount
* @par Fortran90 Interface:
* @htmlonly
*
*
* SUBROUTINE OutputWarningString
* INTEGER(KIND=4), INTENT(IN) :: ID
* END SUBROUTINE OutputWarningString
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT void OutputWarningString(int id);
/**
* Runs the input buffer as defined by calls to \ref AccumulateLine.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return The number of errors encountered.
* @see AccumulateLine, OutputAccumulatedLines, RunFile, RunString
* @remarks
* The accumulated input is cleared upon a successful run (no errors).
* @pre \ref LoadDatabase/\ref LoadDatabaseString must have been called and returned 0 (zero) errors.
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION RunAccumulated()
* INTEGER(KIND=4), INTENT(IN) :: ID
* INTEGER(KIND=4) :: RunAccumulated
* END FUNCTION RunAccumulated
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int RunAccumulated(int id);
/**
* Runs the specified phreeqc input file.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param filename The name of the phreeqc input file to run.
* @return The number of errors encountered during the run.
* @see RunAccumulated, RunString
* @pre \ref LoadDatabase/\ref LoadDatabaseString must have been called and returned 0 (zero) errors.
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION RunFile(FILENAME)
* INTEGER(KIND=4), INTENT(IN) :: ID
* CHARACTER(LEN=*), INTENT(IN) :: FILENAME
* INTEGER(KIND=4) :: RunFile
* END FUNCTION RunFile
*
*
* @endhtmlonly
*
* @par C Example:
* see \ref CreateIPhreeqc_c "CreateIPhreeqc"
*
* @par Fortran90 Example:
* see \ref CreateIPhreeqc_f90 "CreateIPhreeqc"
*/
IPQ_DLL_EXPORT int RunFile(int id, const char* filename);
/**
* Runs the specified string as input to phreeqc.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param input String containing phreeqc input.
* @return The number of errors encountered during the run.
* @see RunAccumulated, RunFile
* @pre \ref LoadDatabase/\ref LoadDatabaseString must have been called and returned 0 (zero) errors.
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION RunString(INPUT)
* INTEGER(KIND=4), INTENT(IN) :: ID
* CHARACTER(LEN=*), INTENT(IN) :: INPUT
* INTEGER(KIND=4) :: RunString
* END FUNCTION RunString
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT int RunString(int id, const char* input);
/**
* Sets the dump file switch on or off. This switch controls whether or not phreeqc writes to the dump file.
* The initial setting after calling \ref CreateIPhreeqc is off.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param dump_on If non-zero turns on output to the DUMP (dump.out if unspecified) file.
* @retval IPQ_OK Success.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see GetDumpFileOn, GetDumpString, GetDumpStringLine, GetDumpStringLineCount, SetDumpStringOn
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION SetDumpFileOn(ID,DUMP_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4), INTENT(IN) :: DUMP_ON
* END FUNCTION SetDumpFileOn
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT IPQ_RESULT SetDumpFileOn(int id, int dump_on);
/**
* 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 after calling
* \ref CreateIPhreeqc is off.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param dump_string_on If non-zero captures the output defined by the DUMP keyword into a string buffer.
* @retval IPQ_OK Success.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see GetDumpStringOn, GetDumpString, GetDumpStringLine, GetDumpStringLineCount
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION SetDumpStringOn(ID,DUMP_STRING_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4), INTENT(IN) :: DUMP_STRING_ON
* END FUNCTION SetDumpStringOn
*
*
* @endhtmlonly
*
* @par C Example:
* see \ref GetDumpString_c "GetDumpString"
*
* @par Fortran90 Example:
* see \ref GetDumpStringLine_f90 "GetDumpStringLine"
*/
IPQ_DLL_EXPORT IPQ_RESULT SetDumpStringOn(int id, int dump_string_on);
/**
* 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 after calling
* \ref CreateIPhreeqc is off.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param error_on If non-zero turns on output to the phreeqc.err file.
* @retval IPQ_OK Success.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see OutputErrorString, GetErrorStringLine, GetErrorStringLineCount
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION SetErrorFileOn(ERROR_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4), INTENT(IN) :: ERROR_ON
* END FUNCTION SetErrorFileOn
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT IPQ_RESULT SetErrorFileOn(int id, int error_on);
/**
* 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 after calling
* \ref CreateIPhreeqc is off.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param log_on If non-zero turns on output to the phreeqc.log file.
* @retval IPQ_OK Success.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see GetLogFileOn
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION SetLogFileOn(ID,LOG_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4), INTENT(IN) :: LOG_ON
* INTEGER(KIND=4) :: SetLogFileOn
* END FUNCTION SetLogFileOn
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT IPQ_RESULT SetLogFileOn(int id, int log_on);
/**
* Sets the output file switch on or off. This switch controls whether or not phreeqc
* writes to the output file. This is the output normally generated
* when phreeqc is run. The initial setting after calling \ref CreateIPhreeqc is off.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param output_on If non-zero turns on output to the phreeqc.out file.
* @retval IPQ_OK Success.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see GetOutputFileOn
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION SetOutputFileOn(ID,OUTPUT_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4), INTENT(IN) :: OUTPUT_ON
* INTEGER(KIND=4) :: SetOutputFileOn
* END FUNCTION SetOutputFileOn
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT IPQ_RESULT SetOutputFileOn(int id, int output_on);
/**
* Sets the selected-output file switch on or off. This switch controls whether or not phreeqc writes output to
* the selected-output file. The initial setting after calling \ref CreateIPhreeqc is off.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @param sel_on If non-zero turns on output to the SELECTED_OUTPUT (selected.out if unspecified) file.
* @retval IPQ_OK Success.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see GetSelectedOutputFileOn
* @par Fortran90 Interface:
* @htmlonly
*
*
* FUNCTION SetSelectedOutputFileOn(ID,SEL_ON)
* INTEGER(KIND=4), INTENT(IN) :: ID
* LOGICAL(KIND=4), INTENT(IN) :: SEL_ON
* INTEGER(KIND=4) :: SetSelectedOutputFileOn
* END FUNCTION SetSelectedOutputFileOn
*
*
* @endhtmlonly
*/
IPQ_DLL_EXPORT IPQ_RESULT SetSelectedOutputFileOn(int id, int sel_on);
/**
* Unloads the database currently loaded into phreeqc. In addition, all
* previous phreeqc definitions (i.e. SOLUTION, EXCHANGE, etc) are cleared from memory.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @retval IPQ_OK Success.
* @retval IPQ_BADINSTANCE The given id is invalid.
* @see DestroyIPhreeqc, LoadDatabase, LoadDatabaseString
* @remarks
* Use of the method is not normally necessary. It is called automatically
* before each call to \ref LoadDatabase or \ref LoadDatabaseString.
*/
IPQ_DLL_EXPORT IPQ_RESULT UnLoadDatabase(int id);
// TODO int RunWithCallback(PFN_PRERUN_CALLBACK pfn_pre, PFN_POSTRUN_CALLBACK pfn_post, void *cookie, int output_on, int error_on, int log_on, int selected_output_on);
// TODO int CatchErrors(PFN_CATCH_CALLBACK pfn, void *cookie);
#if defined(__cplusplus)
}
#endif
#endif // INC_IPHREEQC_H