Added GetSelectedOutputValue2

git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@6731 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2012-07-06 22:55:42 +00:00
parent 8df5396dd1
commit 306e09c6cc
8 changed files with 466 additions and 45 deletions

View File

@ -1,39 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IPhreeqc", "IPhreeqc.vcproj", "{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "unit\unit.vcproj", "{270BB952-FCB2-4FA8-821E-BB750E83C902}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_c", "tests\test_c.vcproj", "{6F2B675D-2585-4AD6-866D-4DDA00279B00}"
ProjectSection(ProjectDependencies) = postProject
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} = {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_cxx", "tests\test_cxx.vcproj", "{3102214A-D304-48FC-B2DF-94D838DC4B2A}"
ProjectSection(ProjectDependencies) = postProject
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} = {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}
EndProjectSection
EndProject
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "test_f90", "tests\test_f90.vfproj", "{003309EE-36BE-493B-87D4-FE68918DA9AF}"
ProjectSection(ProjectDependencies) = postProject
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} = {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}
EndProjectSection
EndProject
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "test_f", "tests\test_f.vfproj", "{66E68C3F-EFCE-47EE-80F1-4D8F6F8AB450}"
ProjectSection(ProjectDependencies) = postProject
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} = {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}
EndProjectSection
EndProject
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "memory_leak_f", "memory_leak_f\memory_leak_f.vfproj", "{941BC4D5-7D05-4786-BC65-38914514EA9B}"
ProjectSection(ProjectDependencies) = postProject
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} = {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "advect_c", "examples\c\advect\advect_c.vcproj", "{BD883425-1DD0-466A-911B-32AD6D4CE262}"
EndProject
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "advect", "examples\fortran\advect\advect.vfproj", "{28459FF2-3C6C-469E-B0C3-2E4D483E7025}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IPhreeqc", "IPhreeqc.2005.vcproj", "{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -46,22 +31,6 @@ Global
ReleaseDll|x64 = ReleaseDll|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Debug|Win32.ActiveCfg = Debug|Win32
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Debug|Win32.Build.0 = Debug|Win32
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Debug|x64.ActiveCfg = Debug|x64
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Debug|x64.Build.0 = Debug|x64
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.DebugDll|Win32.Build.0 = DebugDll|Win32
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.DebugDll|x64.ActiveCfg = DebugDll|x64
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.DebugDll|x64.Build.0 = DebugDll|x64
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Release|Win32.ActiveCfg = Release|Win32
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Release|Win32.Build.0 = Release|Win32
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Release|x64.ActiveCfg = Release|x64
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Release|x64.Build.0 = Release|x64
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.ReleaseDll|x64.ActiveCfg = ReleaseDll|x64
{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.ReleaseDll|x64.Build.0 = ReleaseDll|x64
{270BB952-FCB2-4FA8-821E-BB750E83C902}.Debug|Win32.ActiveCfg = Debug|Win32
{270BB952-FCB2-4FA8-821E-BB750E83C902}.Debug|Win32.Build.0 = Debug|Win32
{270BB952-FCB2-4FA8-821E-BB750E83C902}.Debug|x64.ActiveCfg = Debug|x64
@ -181,6 +150,22 @@ Global
{28459FF2-3C6C-469E-B0C3-2E4D483E7025}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
{28459FF2-3C6C-469E-B0C3-2E4D483E7025}.ReleaseDll|x64.ActiveCfg = ReleaseDll|x64
{28459FF2-3C6C-469E-B0C3-2E4D483E7025}.ReleaseDll|x64.Build.0 = ReleaseDll|x64
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.Debug|Win32.ActiveCfg = Debug|Win32
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.Debug|Win32.Build.0 = Debug|Win32
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.Debug|x64.ActiveCfg = Debug|x64
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.Debug|x64.Build.0 = Debug|x64
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.DebugDll|Win32.Build.0 = DebugDll|Win32
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.DebugDll|x64.ActiveCfg = DebugDll|x64
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.DebugDll|x64.Build.0 = DebugDll|x64
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.Release|Win32.ActiveCfg = Release|Win32
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.Release|Win32.Build.0 = Release|Win32
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.Release|x64.ActiveCfg = Release|x64
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.Release|x64.Build.0 = Release|x64
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.ReleaseDll|x64.ActiveCfg = ReleaseDll|x64
{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}.ReleaseDll|x64.Build.0 = ReleaseDll|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8.00"
Name="IPhreeqc"
ProjectGUID="{F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}"
ProjectGUID="{B0A40DC6-D218-4028-9FF1-3E25EF0FF5FE}"
RootNamespace="IPhreeqc"
>
<Platforms>

View File

@ -16,6 +16,8 @@ EXAMPLES = \
examples/GetOutputString.c \
examples/GetSelectedOutputString.c \
examples/GetSelectedOutputValue.c \
examples/GetSelectedOutputValue2.c \
examples/IPhreeqc.cpp \
examples/F90ClearAccumulatedLines.f90 \
examples/F90CreateIPhreeqc.f90 \
examples/F90DestroyIPhreeqc.f90 \

View File

@ -0,0 +1,53 @@
#include <stdlib.h>
#include <stdio.h>
#include <IPhreeqc.h>
const int SVALUE_LENGTH = 100;
int main(void)
{
int id, i, j, vtype;
double dvalue
char svalue[SVALUE_LENGTH];
id = CreateIPhreeqc();
if (id < 0) {
return EXIT_FAILURE;
}
if (LoadDatabase(id, "phreeqc.dat") != 0) {
OutputErrorString(id);
return EXIT_FAILURE;
}
if (RunFile(id, "ex2") != 0) {
OutputErrorString(id);
return EXIT_FAILURE;
}
printf("selected-output:\n");
for (i = 0; i < GetSelectedOutputRowCount(id); ++i) {
for (j = 0; j < GetSelectedOutputColumnCount(id); ++j) {
if (GetSelectedOutputValue2(id, i, j, vtype, dvalue, svalue, SVALUE_LENGTH) == VR_OK) {
switch (v.type) {
case TT_LONG:
printf("%ld ", v.lVal);
break;
case TT_DOUBLE:
printf("%g ", v.dVal);
break;
case TT_STRING:
printf("%s ", v.sVal);
break;
}
}
}
printf("\n");
}
if (DestroyIPhreeqc(id)) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@ -1,4 +1,5 @@
#include <memory> // auto_ptr
#include <string.h>
#include "IPhreeqc.hpp" // IPhreeqc
#include "Phreeqc.h" // Phreeqc
@ -405,6 +406,46 @@ VRESULT IPhreeqc::GetSelectedOutputValue(int row, int col, VAR* pVAR)
return v;
}
VRESULT IPhreeqc::GetSelectedOutputValue2(int row, int col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length)
{
VRESULT result;
VAR v;
VarInit(&v);
char buffer[100];
result = this->GetSelectedOutputValue(row, col, &v);
switch (v.type)
{
case TT_EMPTY:
*vtype = v.type;
break;
case TT_ERROR:
*vtype = v.type;
break;
case TT_LONG:
*vtype = TT_DOUBLE;
*dvalue = (double)v.lVal;
::sprintf(buffer, "%ld", v.lVal);
::strncpy(svalue, buffer, svalue_length);
break;
case TT_DOUBLE:
*vtype = v.type;
*dvalue = v.dVal;
::sprintf(buffer, "%23.15e", v.dVal);
::strncpy(svalue, buffer, svalue_length);
break;
case TT_STRING:
*vtype = v.type;
::strncpy(svalue, v.sVal, svalue_length);
break;
default:
assert(0);
}
::VarClear(&v);
return result;
}
const char* IPhreeqc::GetWarningString(void)
{
this->WarningString = ((CErrorReporter<std::ostringstream>*)this->WarningReporter)->GetOS()->str();

View File

@ -288,7 +288,7 @@ extern "C" {
* Retrieves the string buffer containing <b>DUMP</b> output.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return A null terminated string containing <b>DUMP</b> output.
* @pre \ref SetDumpStringOn must have been set to true (non-zero) in order to recieve <b>DUMP</b> output.
* @pre \ref SetDumpStringOn must have been set to true (non-zero) in order to receive <b>DUMP</b> output.
* @see GetDumpFileOn, GetDumpStringLine, GetDumpStringLineCount, SetDumpFileOn, GetDumpStringOn, SetDumpStringOn
* @par Fortran90 Interface:
* Not implemented. (see \ref GetDumpStringLineCount, \ref GetDumpStringLine)
@ -540,7 +540,7 @@ extern "C" {
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return A null terminated string containing log output.
* @remarks Logging must be enabled through the use of the KNOBS -logfile option in order to receive any log messages.
* @pre \ref SetLogStringOn must have been set to true (non-zero) in order to recieve log output.
* @pre \ref SetLogStringOn must have been set to true (non-zero) in order to receive log output.
* @see GetLogFileOn, GetLogStringLine, GetLogStringLineCount, SetLogFileOn, GetLogStringOn, SetLogStringOn
* @par Fortran90 Interface:
* Not implemented. (see \ref GetLogStringLineCount, \ref GetLogStringLine)
@ -667,7 +667,7 @@ extern "C" {
* Retrieves the string buffer containing phreeqc output.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return A null terminated string containing phreeqc output.
* @pre \ref SetOutputStringOn must have been set to true (non-zero) in order to recieve phreeqc output.
* @pre \ref SetOutputStringOn must have been set to true (non-zero) in order to receive phreeqc output.
* @see GetOutputFileOn, GetOutputStringLine, GetOutputStringLineCount, SetOutputFileOn, GetOutputStringOn, SetOutputStringOn
* @par Fortran90 Interface:
* Not implemented. (see \ref GetOutputStringLineCount, \ref GetOutputStringLine)
@ -814,7 +814,7 @@ extern "C" {
* Retrieves the string buffer containing <b>SELECTED_OUTPUT</b>.
* @param id The instance id returned from \ref CreateIPhreeqc.
* @return A null terminated string containing <b>SELECTED_OUTPUT</b>.
* @pre \ref SetSelectedOutputStringOn must have been set to true (non-zero) in order to recieve <b>SELECTED_OUTPUT</b>.
* @pre \ref SetSelectedOutputStringOn must have been set to true (non-zero) in order to receive <b>SELECTED_OUTPUT</b>.
* @see GetSelectedOutputFileOn, GetSelectedOutputStringLine, GetSelectedOutputStringLineCount, SetSelectedOutputFileOn, GetSelectedOutputStringOn, SetSelectedOutputStringOn
* @par Fortran90 Interface:
* Not implemented. (see \ref GetSelectedOutputStringLineCount, \ref GetSelectedOutputStringLine)
@ -924,13 +924,13 @@ extern "C" {
* @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.
* @param pVAR Pointer to the \c VAR to receive 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.
* @see GetSelectedOutputFileOn, GetSelectedOutputColumnCount, GetSelectedOutputRowCount, SetSelectedOutputFileOn
* @see GetSelectedOutputFileOn, GetSelectedOutputColumnCount, GetSelectedOutputRowCount, GetSelectedOutputValue2, SetSelectedOutputFileOn
* @remarks
* Row 0 contains the column headings to the selected_ouput.
* @par Examples:
@ -1106,6 +1106,169 @@ Headings
IPQ_DLL_EXPORT IPQ_RESULT GetSelectedOutputValue(int id, int row, int col, VAR* pVAR);
/**
* Returns the associated data 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 vtype Receives the variable type. See \ref VAR_TYPE.
* @param dvalue Receives the numeric value when (VTYPE=\ref TT_DOUBLE) or (VTYPE=\ref TT_LONG).
* @param svalue Receives 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.
* @param svalue_length The length of the svalue buffer.
* @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.
* @see GetSelectedOutputFileOn, GetSelectedOutputColumnCount, GetSelectedOutputRowCount, GetSelectedOutputValue, SetSelectedOutputFileOn
* @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
<p>
<table border=1>
<TR VALIGN="top">
<TH width=65%>
Input
</TH>
<TH width=35%>
Headings
</TH>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-totals Ca Na
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
Ca(mol/kgw) Na(mol/kgw)
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-molalities Fe+2 Hfo_sOZn+
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
m_Fe+2(mol/kgw) m_Hfo_sOZn+(mol/kgw)
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-activities H+ Ca+2
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
la_H+ la_Ca+2
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-equilibrium_phases Calcite Dolomite
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
Calcite d_Calcite Dolomite d_Dolomite
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-saturation_indices CO2(g) Siderite
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
si_CO2(g) si_Siderite
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-gases CO2(g) N2(g)
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
pressure "total mol" volume g_CO2(g) g_N2(g)
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-kinetic_reactants CH2O Pyrite
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
k_CH2O dk_CH2O k_Pyrite dk_Pyrite
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-solid_solutions CaSO4 SrSO4
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
s_CaSO4 s_SrSO4
</PRE></CODE>
</TD>
</TR>
</table>
* @endhtmlonly
* \anchor GetSelectedOutputValue2_c
* @par C Example:
* \include GetSelectedOutputValue2.c
*/
IPQ_DLL_EXPORT IPQ_RESULT GetSelectedOutputValue2(int id, int row, int col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length);
/**
* 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.

View File

@ -137,7 +137,7 @@ public:
* Retrieves the string buffer containing <b>DUMP</b> output.
* @return A null terminated string containing <b>DUMP</b> output.
* @pre
* \ref SetDumpStringOn must have been set to true in order to recieve <b>DUMP</b> output.
* \ref SetDumpStringOn must have been set to true in order to receive <b>DUMP</b> output.
* @see GetDumpStringLine, GetDumpFileOn, GetDumpStringLineCount, GetDumpStringOn, SetDumpFileOn, SetDumpStringOn
*/
const char* GetDumpString(void)const;
@ -291,7 +291,7 @@ public:
* Retrieves the string buffer containing phreeqc output.
* @return A null terminated string containing phreeqc output.
* @pre
* \ref SetOutputStringOn must have been set to true in order to recieve output.
* \ref SetOutputStringOn must have been set to true in order to receive output.
* @see GetOutputStringLine, GetOutputFileOn, GetOutputStringLineCount, GetOutputStringOn, SetOutputFileOn, SetOutputStringOn
*/
const char* GetOutputString(void)const;
@ -357,7 +357,7 @@ public:
* Retrieves the string buffer containing <b>SELECTED_OUTPUT</b>.
* @return A null terminated string containing <b>SELECTED_OUTPUT</b>.
* @pre
* \ref SetSelectedOutputStringOn must have been set to true in order to recieve <b>SELECTED_OUTPUT</b>.
* \ref SetSelectedOutputStringOn must have been set to true in order to receive <b>SELECTED_OUTPUT</b>.
* @see GetSelectedOutputStringLine, GetSelectedOutputFileOn, GetSelectedOutputStringLineCount, GetSelectedOutputStringOn, SetSelectedOutputFileOn, SetSelectedOutputStringOn
*/
const char* GetSelectedOutputString(void)const;
@ -392,13 +392,13 @@ public:
* Returns the \c VAR associated with the specified row and column.
* @param row The row index.
* @param col The column index.
* @param pVAR Pointer to the \c VAR to recieve the requested data.
* @param pVAR Pointer to the \c VAR to receive the requested data.
* @retval VR_OK Success.
* @retval VR_INVALIDROW The given row is out of range.
* @retval VR_INVALIDCOL The given column is out of range.
* @retval VR_OUTOFMEMORY Memory could not be allocated.
* @retval VR_BADINSTANCE The given id is invalid.
* @see GetSelectedOutputColumnCount, GetSelectedOutputFileOn, GetSelectedOutputRowCount, SetSelectedOutputFileOn
* @see GetSelectedOutputColumnCount, GetSelectedOutputFileOn, GetSelectedOutputRowCount, GetSelectedOutputValue2, SetSelectedOutputFileOn
* @remarks
* Row 0 contains the column headings to the selected_ouput.
* @par Examples:
@ -542,6 +542,162 @@ public:
*/
VRESULT GetSelectedOutputValue(int row, int col, VAR* pVAR);
/**
* Returns the associated data with the specified row and column.
* @param row The row index.
* @param col The column index.
* @param vtype Receives the variable type. See \ref VAR_TYPE.
* @param dvalue Receives the numeric value when (VTYPE=\ref TT_DOUBLE) or (VTYPE=\ref TT_LONG).
* @param svalue Receives 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.
* @param svalue_length The length of the svalue buffer.
* @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.
* @see GetSelectedOutputFileOn, GetSelectedOutputColumnCount, GetSelectedOutputRowCount, GetSelectedOutputValue, SetSelectedOutputFileOn
* @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
<p>
<table border=1>
<TR VALIGN="top">
<TH width=65%>
Input
</TH>
<TH width=35%>
Headings
</TH>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-totals Ca Na
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
Ca(mol/kgw) Na(mol/kgw)
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-molalities Fe+2 Hfo_sOZn+
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
m_Fe+2(mol/kgw) m_Hfo_sOZn+(mol/kgw)
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-activities H+ Ca+2
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
la_H+ la_Ca+2
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-equilibrium_phases Calcite Dolomite
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
Calcite d_Calcite Dolomite d_Dolomite
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-saturation_indices CO2(g) Siderite
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
si_CO2(g) si_Siderite
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-gases CO2(g) N2(g)
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
pressure "total mol" volume g_CO2(g) g_N2(g)
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-kinetic_reactants CH2O Pyrite
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
k_CH2O dk_CH2O k_Pyrite dk_Pyrite
</PRE></CODE>
</TD>
</TR>
<TR VALIGN="top">
<TD width=65%>
<CODE><PRE>
SELECTED_OUTPUT
-reset false
-solid_solutions CaSO4 SrSO4
</PRE></CODE>
</TD>
<TD width=35%>
<CODE><PRE>
s_CaSO4 s_SrSO4
</PRE></CODE>
</TD>
</TR>
</table>
*/
VRESULT GetSelectedOutputValue2(int row, int col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length);
/**
* Retrieves the warning messages from the last call to \ref RunAccumulated, \ref RunFile, \ref RunString, \ref LoadDatabase, or \ref LoadDatabaseString.
* @return A null terminated string containing warning messages.

View File

@ -562,6 +562,27 @@ GetSelectedOutputValue(int id, int row, int col, VAR* pVAR)
return IPQ_BADINSTANCE;
}
IPQ_RESULT
GetSelectedOutputValue2(int id, int row, int col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length)
{
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
{
switch(IPhreeqcPtr->GetSelectedOutputValue(row, col, vtype, dvalue, svalue, svalue_length))
{
case VR_OK: return IPQ_OK;
case VR_OUTOFMEMORY: return IPQ_OUTOFMEMORY;
case VR_BADVARTYPE: return IPQ_BADVARTYPE;
case VR_INVALIDARG: return IPQ_INVALIDARG;
case VR_INVALIDROW: return IPQ_INVALIDROW;
case VR_INVALIDCOL: return IPQ_INVALIDCOL;
default:
assert(false);
}
}
return IPQ_BADINSTANCE;
}
const char*
GetWarningString(int id)
{