mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
changes req'd for multi_punch
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/multi_punch@7967 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
c93bc1968a
commit
459fd958e9
169
src/IPhreeqc.cpp
169
src/IPhreeqc.cpp
@ -42,7 +42,7 @@ IPhreeqc::IPhreeqc(void)
|
|||||||
, WarningStringOn(true)
|
, WarningStringOn(true)
|
||||||
, WarningReporter(0)
|
, WarningReporter(0)
|
||||||
, CurrentSelectedOutputUserNumber(1)
|
, CurrentSelectedOutputUserNumber(1)
|
||||||
, PtrSelectedOutput(0)
|
// COMMENT: {8/23/2013 9:33:02 PM}, PtrSelectedOutput(0)
|
||||||
, SelectedOutputStringOn(false)
|
, SelectedOutputStringOn(false)
|
||||||
, PhreeqcPtr(0)
|
, PhreeqcPtr(0)
|
||||||
, input_file(0)
|
, input_file(0)
|
||||||
@ -52,7 +52,7 @@ IPhreeqc::IPhreeqc(void)
|
|||||||
|
|
||||||
this->ErrorReporter = new CErrorReporter<std::ostringstream>;
|
this->ErrorReporter = new CErrorReporter<std::ostringstream>;
|
||||||
this->WarningReporter = new CErrorReporter<std::ostringstream>;
|
this->WarningReporter = new CErrorReporter<std::ostringstream>;
|
||||||
this->PtrSelectedOutput = new CSelectedOutput();
|
// COMMENT: {8/23/2013 9:33:08 PM} this->PtrSelectedOutput = new CSelectedOutput();
|
||||||
this->PhreeqcPtr = new Phreeqc(this);
|
this->PhreeqcPtr = new Phreeqc(this);
|
||||||
|
|
||||||
ASSERT(this->PhreeqcPtr->phast == 0);
|
ASSERT(this->PhreeqcPtr->phast == 0);
|
||||||
@ -86,10 +86,16 @@ IPhreeqc::~IPhreeqc(void)
|
|||||||
this->OutputFileOn = false;
|
this->OutputFileOn = false;
|
||||||
#endif
|
#endif
|
||||||
delete this->PhreeqcPtr;
|
delete this->PhreeqcPtr;
|
||||||
delete this->PtrSelectedOutput;
|
|
||||||
delete this->WarningReporter;
|
delete this->WarningReporter;
|
||||||
delete this->ErrorReporter;
|
delete this->ErrorReporter;
|
||||||
|
|
||||||
|
std::map< int, CSelectedOutput* >::iterator sit = this->SelectedOutputMap.begin();
|
||||||
|
for (; sit != this->SelectedOutputMap.end(); ++sit)
|
||||||
|
{
|
||||||
|
delete (*sit).second;
|
||||||
|
}
|
||||||
|
this->SelectedOutputMap.clear();
|
||||||
|
|
||||||
mutex_lock(&map_lock);
|
mutex_lock(&map_lock);
|
||||||
std::map<size_t, IPhreeqc*>::iterator it = IPhreeqc::Instances.find(this->Index);
|
std::map<size_t, IPhreeqc*>::iterator it = IPhreeqc::Instances.find(this->Index);
|
||||||
if (it != IPhreeqc::Instances.end())
|
if (it != IPhreeqc::Instances.end())
|
||||||
@ -332,7 +338,14 @@ bool IPhreeqc::GetOutputStringOn(void)const
|
|||||||
|
|
||||||
int IPhreeqc::GetSelectedOutputColumnCount(void)const
|
int IPhreeqc::GetSelectedOutputColumnCount(void)const
|
||||||
{
|
{
|
||||||
return (int)this->PtrSelectedOutput->GetColCount();
|
std::map< int, CSelectedOutput* >::const_iterator ci = this->SelectedOutputMap.find(this->CurrentSelectedOutputUserNumber);
|
||||||
|
if (ci != this->SelectedOutputMap.end())
|
||||||
|
{
|
||||||
|
return (int)(*ci).second->GetColCount();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
// COMMENT: {8/23/2013 9:16:26 PM} this->CurrentSelectedOutputMap[]
|
||||||
|
// COMMENT: {8/23/2013 9:16:26 PM} return (int)this->PtrSelectedOutput->GetColCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* IPhreeqc::GetSelectedOutputFileName(void)const
|
const char* IPhreeqc::GetSelectedOutputFileName(void)const
|
||||||
@ -353,7 +366,12 @@ bool IPhreeqc::GetSelectedOutputFileOn(void)const
|
|||||||
|
|
||||||
int IPhreeqc::GetSelectedOutputRowCount(void)const
|
int IPhreeqc::GetSelectedOutputRowCount(void)const
|
||||||
{
|
{
|
||||||
return (int)this->PtrSelectedOutput->GetRowCount();
|
std::map< int, CSelectedOutput* >::const_iterator ci = this->SelectedOutputMap.find(this->CurrentSelectedOutputUserNumber);
|
||||||
|
if (ci != this->SelectedOutputMap.end())
|
||||||
|
{
|
||||||
|
return (int)(*ci).second->GetRowCount();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* IPhreeqc::GetSelectedOutputString(void)const
|
const char* IPhreeqc::GetSelectedOutputString(void)const
|
||||||
@ -406,7 +424,7 @@ VRESULT IPhreeqc::GetSelectedOutputValue(int row, int col, VAR* pVAR)
|
|||||||
return VR_INVALIDARG;
|
return VR_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
VRESULT v = this->PtrSelectedOutput->Get(row, col, pVAR);
|
VRESULT v = this->SelectedOutputMap[this->CurrentSelectedOutputUserNumber]->Get(row, col, pVAR);
|
||||||
switch (v)
|
switch (v)
|
||||||
{
|
{
|
||||||
case VR_OK:
|
case VR_OK:
|
||||||
@ -514,7 +532,12 @@ int IPhreeqc::LoadDatabase(const char* filename)
|
|||||||
// cleanup
|
// cleanup
|
||||||
//
|
//
|
||||||
this->UnLoadDatabase();
|
this->UnLoadDatabase();
|
||||||
this->PtrSelectedOutput->Clear();
|
std::map< int, CSelectedOutput* >::iterator it = this->SelectedOutputMap.begin();
|
||||||
|
for (; it != this->SelectedOutputMap.end(); ++it)
|
||||||
|
{
|
||||||
|
delete (*it).second;
|
||||||
|
}
|
||||||
|
this->SelectedOutputMap.clear();
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
//
|
//
|
||||||
@ -563,8 +586,12 @@ int IPhreeqc::LoadDatabaseString(const char* input)
|
|||||||
// cleanup
|
// cleanup
|
||||||
//
|
//
|
||||||
this->UnLoadDatabase();
|
this->UnLoadDatabase();
|
||||||
|
std::map< int, CSelectedOutput* >::iterator it = this->SelectedOutputMap.begin();
|
||||||
this->PtrSelectedOutput->Clear();
|
for (; it != this->SelectedOutputMap.end(); ++it)
|
||||||
|
{
|
||||||
|
delete (*it).second;
|
||||||
|
}
|
||||||
|
this->SelectedOutputMap.clear();
|
||||||
|
|
||||||
std::string s(input);
|
std::string s(input);
|
||||||
std::istringstream iss(s);
|
std::istringstream iss(s);
|
||||||
@ -868,11 +895,14 @@ void IPhreeqc::UnLoadDatabase(void)
|
|||||||
|
|
||||||
// clear selectedoutput
|
// clear selectedoutput
|
||||||
//
|
//
|
||||||
ASSERT(this->PtrSelectedOutput);
|
std::map< int, CSelectedOutput* >::iterator itt = this->SelectedOutputMap.begin();
|
||||||
this->PtrSelectedOutput->Clear();
|
for (; itt != this->SelectedOutputMap.end(); ++itt)
|
||||||
|
{
|
||||||
std::map< int, std::string >::iterator mit = SelectedOutputStringMap.begin();
|
delete (*itt).second;
|
||||||
for (; mit != SelectedOutputStringMap.begin(); ++mit)
|
}
|
||||||
|
this->SelectedOutputMap.clear();
|
||||||
|
std::map< int, std::string >::iterator mit = this->SelectedOutputStringMap.begin();
|
||||||
|
for (; mit != this->SelectedOutputStringMap.begin(); ++mit)
|
||||||
{
|
{
|
||||||
(*mit).second.clear();
|
(*mit).second.clear();
|
||||||
}
|
}
|
||||||
@ -899,25 +929,54 @@ void IPhreeqc::UnLoadDatabase(void)
|
|||||||
|
|
||||||
int IPhreeqc::EndRow(void)
|
int IPhreeqc::EndRow(void)
|
||||||
{
|
{
|
||||||
if (this->PtrSelectedOutput->GetRowCount() <= 1)
|
if (this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->GetRowCount() <= 1)
|
||||||
{
|
{
|
||||||
// ensure all user_punch headings are included
|
// ensure all user_punch headings are included
|
||||||
ASSERT(this->PhreeqcPtr->n_user_punch_index >= 0);
|
ASSERT(this->PhreeqcPtr->n_user_punch_index >= 0);
|
||||||
if (this->PhreeqcPtr->current_user_punch != NULL)
|
if (this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output] != NULL)
|
||||||
{
|
{
|
||||||
for (size_t i = this->PhreeqcPtr->n_user_punch_index; i < this->PhreeqcPtr->current_user_punch->Get_headings().size(); ++i)
|
if (this->PhreeqcPtr->current_user_punch)
|
||||||
{
|
{
|
||||||
this->PtrSelectedOutput->PushBackEmpty(this->PhreeqcPtr->current_user_punch->Get_headings()[i].c_str());
|
for (size_t i = this->PhreeqcPtr->n_user_punch_index; i < this->PhreeqcPtr->current_user_punch->Get_headings().size(); ++i)
|
||||||
|
{
|
||||||
|
this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->PushBackEmpty(this->PhreeqcPtr->current_user_punch->Get_headings()[i].c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this->PtrSelectedOutput->EndRow();
|
return this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->EndRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPhreeqc::check_database(const char* sz_routine)
|
void IPhreeqc::check_database(const char* sz_routine)
|
||||||
{
|
{
|
||||||
this->ErrorReporter->Clear();
|
this->ErrorReporter->Clear();
|
||||||
this->PtrSelectedOutput->Clear();
|
|
||||||
|
std::map< int, CSelectedOutput* >::iterator it = this->SelectedOutputMap.begin();
|
||||||
|
for (; it != this->SelectedOutputMap.end(); ++it)
|
||||||
|
{
|
||||||
|
delete (*it).second;
|
||||||
|
}
|
||||||
|
this->SelectedOutputMap.clear();
|
||||||
|
this->CurrentSelectedOutputMap.clear();
|
||||||
|
|
||||||
|
///{{{ REPLACE WITH A CLEAR ROUTINE
|
||||||
|
// release
|
||||||
|
this->LogString.clear();
|
||||||
|
this->LogLines.clear();
|
||||||
|
this->OutputString.clear();
|
||||||
|
this->OutputLines.clear();
|
||||||
|
|
||||||
|
std::map< int, std::string >::iterator mit = SelectedOutputStringMap.begin();
|
||||||
|
for (; mit != SelectedOutputStringMap.begin(); ++mit)
|
||||||
|
{
|
||||||
|
(*mit).second.clear();
|
||||||
|
}
|
||||||
|
std::map< int, std::vector< std::string > >::iterator lit = this->SelectedOutputLinesMap.begin();
|
||||||
|
for (; lit != this->SelectedOutputLinesMap.begin(); ++lit)
|
||||||
|
{
|
||||||
|
(*lit).second.clear();
|
||||||
|
}
|
||||||
|
///}}}
|
||||||
|
|
||||||
if (!this->DatabaseLoaded)
|
if (!this->DatabaseLoaded)
|
||||||
{
|
{
|
||||||
@ -932,6 +991,25 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL
|
|||||||
{
|
{
|
||||||
char token[MAX_LENGTH];
|
char token[MAX_LENGTH];
|
||||||
|
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} ///{{{ REPLACE WITH A CLEAR ROUTINE
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} // release
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} this->LogString.clear();
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} this->LogLines.clear();
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} this->OutputString.clear();
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} this->OutputLines.clear();
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM}
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} std::map< int, std::string >::iterator mit = SelectedOutputStringMap.begin();
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} for (; mit != SelectedOutputStringMap.begin(); ++mit)
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} {
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} (*mit).second.clear();
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} }
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} std::map< int, std::vector< std::string > >::iterator it = this->SelectedOutputLinesMap.begin();
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} for (; it != this->SelectedOutputLinesMap.begin(); ++it)
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} {
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} (*it).second.clear();
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} }
|
||||||
|
// COMMENT: {8/26/2013 10:32:34 PM} ///}}}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call pre-run callback
|
* call pre-run callback
|
||||||
*/
|
*/
|
||||||
@ -940,24 +1018,24 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL
|
|||||||
pfn_pre(cookie);
|
pfn_pre(cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
///{{{ REPLACE WITH A CLEAR ROUTINE
|
// COMMENT: {8/26/2013 10:30:49 PM} ///{{{ REPLACE WITH A CLEAR ROUTINE
|
||||||
// release
|
// COMMENT: {8/26/2013 10:30:49 PM} // release
|
||||||
this->LogString.clear();
|
// COMMENT: {8/26/2013 10:30:49 PM} this->LogString.clear();
|
||||||
this->LogLines.clear();
|
// COMMENT: {8/26/2013 10:30:49 PM} this->LogLines.clear();
|
||||||
this->OutputString.clear();
|
// COMMENT: {8/26/2013 10:30:49 PM} this->OutputString.clear();
|
||||||
this->OutputLines.clear();
|
// COMMENT: {8/26/2013 10:30:49 PM} this->OutputLines.clear();
|
||||||
|
// COMMENT: {8/26/2013 10:30:49 PM}
|
||||||
std::map< int, std::string >::iterator mit = SelectedOutputStringMap.begin();
|
// COMMENT: {8/26/2013 10:30:49 PM} std::map< int, std::string >::iterator mit = SelectedOutputStringMap.begin();
|
||||||
for (; mit != SelectedOutputStringMap.begin(); ++mit)
|
// COMMENT: {8/26/2013 10:30:49 PM} for (; mit != SelectedOutputStringMap.begin(); ++mit)
|
||||||
{
|
// COMMENT: {8/26/2013 10:30:49 PM} {
|
||||||
(*mit).second.clear();
|
// COMMENT: {8/26/2013 10:30:49 PM} (*mit).second.clear();
|
||||||
}
|
// COMMENT: {8/26/2013 10:30:49 PM} }
|
||||||
std::map< int, std::vector< std::string > >::iterator it = this->SelectedOutputLinesMap.begin();
|
// COMMENT: {8/26/2013 10:30:49 PM} std::map< int, std::vector< std::string > >::iterator it = this->SelectedOutputLinesMap.begin();
|
||||||
for (; it != this->SelectedOutputLinesMap.begin(); ++it)
|
// COMMENT: {8/26/2013 10:30:49 PM} for (; it != this->SelectedOutputLinesMap.begin(); ++it)
|
||||||
{
|
// COMMENT: {8/26/2013 10:30:49 PM} {
|
||||||
(*it).second.clear();
|
// COMMENT: {8/26/2013 10:30:49 PM} (*it).second.clear();
|
||||||
}
|
// COMMENT: {8/26/2013 10:30:49 PM} }
|
||||||
///}}}
|
// COMMENT: {8/26/2013 10:30:49 PM} ///}}}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set read callback
|
* set read callback
|
||||||
@ -998,19 +1076,24 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL
|
|||||||
{
|
{
|
||||||
if (this->CurrentSelectedOutputMap.find(&(*mit).second) == this->CurrentSelectedOutputMap.end())
|
if (this->CurrentSelectedOutputMap.find(&(*mit).second) == this->CurrentSelectedOutputMap.end())
|
||||||
{
|
{
|
||||||
|
// int -> CSelectedOutput*
|
||||||
std::map< int, CSelectedOutput* >::value_type item((*mit).first, new CSelectedOutput());
|
std::map< int, CSelectedOutput* >::value_type item((*mit).first, new CSelectedOutput());
|
||||||
this->SelectedOutputMap.insert(item);
|
this->SelectedOutputMap.insert(item);
|
||||||
|
|
||||||
// SelectedOutput
|
// SelectedOutput* -> CSelectedOutput*
|
||||||
this->CurrentSelectedOutputMap.insert(
|
this->CurrentSelectedOutputMap.insert(
|
||||||
std::map< SelectedOutput*, CSelectedOutput* >::value_type(
|
std::map< SelectedOutput*, CSelectedOutput* >::value_type(
|
||||||
&(*mit).second, item.second));
|
&(*mit).second, item.second));
|
||||||
|
|
||||||
// SelectedOutputString
|
// SelectedOutput* -> std::string*
|
||||||
this->CurrentToStringMap.insert(
|
this->CurrentToStringMap.insert(
|
||||||
std::map< SelectedOutput*, std::string* >::value_type(
|
std::map< SelectedOutput*, std::string* >::value_type(
|
||||||
&(*mit).second, &this->SelectedOutputStringMap[(*mit).first]));
|
&(*mit).second, &this->SelectedOutputStringMap[(*mit).first]));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSERT(this->SelectedOutputMap[(*mit).first] == this->CurrentSelectedOutputMap[&(*mit).second]);
|
||||||
|
}
|
||||||
if (this->PhreeqcPtr->simulation > 1 && save_punch_in && (*mit).second.Get_new_def() && !bWarning)
|
if (this->PhreeqcPtr->simulation > 1 && save_punch_in && (*mit).second.Get_new_def() && !bWarning)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@ -1587,7 +1670,7 @@ void IPhreeqc::fpunchf(const char *name, const char *format, double d)
|
|||||||
{
|
{
|
||||||
PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, d);
|
PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, d);
|
||||||
}
|
}
|
||||||
this->PtrSelectedOutput->PushBackDouble(name, d);
|
this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->PushBackDouble(name, d);
|
||||||
}
|
}
|
||||||
catch (std::bad_alloc)
|
catch (std::bad_alloc)
|
||||||
{
|
{
|
||||||
@ -1604,7 +1687,7 @@ void IPhreeqc::fpunchf(const char *name, const char *format, char *s)
|
|||||||
{
|
{
|
||||||
PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, s);
|
PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, s);
|
||||||
}
|
}
|
||||||
this->PtrSelectedOutput->PushBackString(name, s);
|
this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->PushBackString(name, s);
|
||||||
}
|
}
|
||||||
catch (std::bad_alloc)
|
catch (std::bad_alloc)
|
||||||
{
|
{
|
||||||
@ -1621,7 +1704,7 @@ void IPhreeqc::fpunchf(const char *name, const char *format, int i)
|
|||||||
{
|
{
|
||||||
PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, i);
|
PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, i);
|
||||||
}
|
}
|
||||||
this->PtrSelectedOutput->PushBackLong(name, (long)i);
|
this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->PushBackLong(name, (long)i);
|
||||||
}
|
}
|
||||||
catch (std::bad_alloc)
|
catch (std::bad_alloc)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -873,11 +873,11 @@ protected:
|
|||||||
std::vector< std::string > WarningLines;
|
std::vector< std::string > WarningLines;
|
||||||
|
|
||||||
int CurrentSelectedOutputUserNumber;
|
int CurrentSelectedOutputUserNumber;
|
||||||
CSelectedOutput *PtrSelectedOutput;
|
// COMMENT: {8/26/2013 10:29:19 PM} CSelectedOutput *PtrSelectedOutput;
|
||||||
std::map< int, CSelectedOutput* > SelectedOutputMap;
|
std::map< int, CSelectedOutput* > SelectedOutputMap;
|
||||||
std::map< SelectedOutput*, CSelectedOutput* > CurrentSelectedOutputMap;
|
std::map< SelectedOutput*, CSelectedOutput* > CurrentSelectedOutputMap;
|
||||||
std::map< SelectedOutput*, std::string* > CurrentToStringMap;
|
std::map< SelectedOutput*, std::string* > CurrentToStringMap;
|
||||||
std::map< class SelectedOutput*, int > InverseSelectedOutputMap;
|
// COMMENT: {8/26/2013 10:27:53 PM} std::map< class SelectedOutput*, int > InverseSelectedOutputMap;
|
||||||
std::string StringInput;
|
std::string StringInput;
|
||||||
|
|
||||||
std::string DumpString;
|
std::string DumpString;
|
||||||
|
|||||||
@ -3625,7 +3625,7 @@ void TestIPhreeqc::TestMultiPunchSelectedOutputStringOn(void)
|
|||||||
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(5), "react\t") != NULL );
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(5), "react\t") != NULL );
|
||||||
|
|
||||||
obj.SetCurrentSelectedOutputUserNumber(2);
|
obj.SetCurrentSelectedOutputUserNumber(2);
|
||||||
CPPUNIT_ASSERT_EQUAL(7, obj.GetSelectedOutputStringLineCount());
|
CPPUNIT_ASSERT_EQUAL(9, obj.GetSelectedOutputStringLineCount());
|
||||||
|
|
||||||
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(0), "si_Halite\t") != NULL );
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(0), "si_Halite\t") != NULL );
|
||||||
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(0), "si_Calcite\t") != NULL );
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(0), "si_Calcite\t") != NULL );
|
||||||
@ -3641,6 +3641,18 @@ void TestIPhreeqc::TestMultiPunchSelectedOutputStringOn(void)
|
|||||||
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(5), "Dummy1\t") != NULL );
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(5), "Dummy1\t") != NULL );
|
||||||
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(5), "Dummy2\t") != NULL );
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(5), "Dummy2\t") != NULL );
|
||||||
|
|
||||||
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Dummy1\t") != NULL );
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Sum_resid\t") != NULL );
|
||||||
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Dummy2\t") != NULL );
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Sum_Delta/U\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "MaxFracErr\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Soln_2\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Soln_2_min\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Soln_2_max\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Soln_3\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Soln_3_min\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Soln_3_max\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Halite\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(6), "Halite_max\t") != NULL );
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(8), "Dummy1\t") != NULL );
|
||||||
|
CPPUNIT_ASSERT( ::strstr(obj.GetSelectedOutputStringLine(8), "Dummy2\t") != NULL );
|
||||||
}
|
}
|
||||||
|
|||||||
@ -408,74 +408,74 @@ TestSelectedOutput::TestEndRow2()
|
|||||||
void
|
void
|
||||||
TestSelectedOutput::TestTooManyHeadings()
|
TestSelectedOutput::TestTooManyHeadings()
|
||||||
{
|
{
|
||||||
IPhreeqc p;
|
// COMMENT: {8/26/2013 4:12:03 PM} IPhreeqc p;
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)0, p.PtrSelectedOutput->GetColCount());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL((size_t)0, p.PtrSelectedOutput->GetColCount());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)0, p.PtrSelectedOutput->GetRowCount());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL((size_t)0, p.PtrSelectedOutput->GetRowCount());
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
p.PtrSelectedOutput->Clear();
|
// COMMENT: {8/26/2013 4:12:03 PM} p.PtrSelectedOutput->Clear();
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)0, p.PtrSelectedOutput->GetColCount());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL((size_t)0, p.PtrSelectedOutput->GetColCount());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)0, p.PtrSelectedOutput->GetRowCount());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL((size_t)0, p.PtrSelectedOutput->GetRowCount());
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
// USER_PUNCH
|
// COMMENT: {8/26/2013 4:12:03 PM} // USER_PUNCH
|
||||||
// -headings 1.name 1.type 1.moles
|
// COMMENT: {8/26/2013 4:12:03 PM} // -headings 1.name 1.type 1.moles
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
p.PhreeqcPtr->n_user_punch_index = 0;
|
// COMMENT: {8/26/2013 4:12:03 PM} p.PhreeqcPtr->n_user_punch_index = 0;
|
||||||
p.PhreeqcPtr->UserPunch_map[1] = UserPunch();
|
// COMMENT: {8/26/2013 4:12:03 PM} p.PhreeqcPtr->UserPunch_map[1] = UserPunch();
|
||||||
p.PhreeqcPtr->current_user_punch = &(p.PhreeqcPtr->UserPunch_map[1]);
|
// COMMENT: {8/26/2013 4:12:03 PM} p.PhreeqcPtr->current_user_punch = &(p.PhreeqcPtr->UserPunch_map[1]);
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
std::vector< std::string > headings;
|
// COMMENT: {8/26/2013 4:12:03 PM} std::vector< std::string > headings;
|
||||||
headings.push_back("1.name");
|
// COMMENT: {8/26/2013 4:12:03 PM} headings.push_back("1.name");
|
||||||
headings.push_back("1.type");
|
// COMMENT: {8/26/2013 4:12:03 PM} headings.push_back("1.type");
|
||||||
headings.push_back("1.moles");
|
// COMMENT: {8/26/2013 4:12:03 PM} headings.push_back("1.moles");
|
||||||
p.PhreeqcPtr->UserPunch_map[1].Set_headings(headings);
|
// COMMENT: {8/26/2013 4:12:03 PM} p.PhreeqcPtr->UserPunch_map[1].Set_headings(headings);
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL(0, p.EndRow());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(0, p.EndRow());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)3, p.PtrSelectedOutput->GetColCount());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL((size_t)3, p.PtrSelectedOutput->GetColCount());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)2, p.PtrSelectedOutput->GetRowCount());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL((size_t)2, p.PtrSelectedOutput->GetRowCount());
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
#if defined(_DEBUG)
|
// COMMENT: {8/26/2013 4:12:03 PM}#if defined(_DEBUG)
|
||||||
p.PtrSelectedOutput->Dump("TestTooManyHeadings");
|
// COMMENT: {8/26/2013 4:12:03 PM} p.PtrSelectedOutput->Dump("TestTooManyHeadings");
|
||||||
#endif
|
// COMMENT: {8/26/2013 4:12:03 PM}#endif
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
// clean up headings
|
// COMMENT: {8/26/2013 4:12:03 PM} // clean up headings
|
||||||
p.PhreeqcPtr->UserPunch_map[1].Get_headings().empty();
|
// COMMENT: {8/26/2013 4:12:03 PM} p.PhreeqcPtr->UserPunch_map[1].Get_headings().empty();
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CVar head0, head1, head2;
|
// COMMENT: {8/26/2013 4:12:03 PM} CVar head0, head1, head2;
|
||||||
CVar val0, val1, val2;
|
// COMMENT: {8/26/2013 4:12:03 PM} CVar val0, val1, val2;
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(0, 0, &head0));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(0, 0, &head0));
|
||||||
CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(0, 1, &head1));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(0, 1, &head1));
|
||||||
CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(0, 2, &head2));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(0, 2, &head2));
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(1, 0, &val0));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(1, 0, &val0));
|
||||||
CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(1, 1, &val1));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(1, 1, &val1));
|
||||||
CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(1, 2, &val2));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(VR_OK, p.PtrSelectedOutput->Get(1, 2, &val2));
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL(TT_STRING, head0.type);
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(TT_STRING, head0.type);
|
||||||
CPPUNIT_ASSERT_EQUAL(TT_STRING, head1.type);
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(TT_STRING, head1.type);
|
||||||
CPPUNIT_ASSERT_EQUAL(TT_STRING, head2.type);
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(TT_STRING, head2.type);
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL(TT_EMPTY, val0.type);
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(TT_EMPTY, val0.type);
|
||||||
CPPUNIT_ASSERT_EQUAL(TT_EMPTY, val1.type);
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(TT_EMPTY, val1.type);
|
||||||
CPPUNIT_ASSERT_EQUAL(TT_EMPTY, val2.type);
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(TT_EMPTY, val2.type);
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("1.name"), std::string(head0.sVal));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(std::string("1.name"), std::string(head0.sVal));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("1.type"), std::string(head1.sVal));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(std::string("1.type"), std::string(head1.sVal));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("1.moles"), std::string(head2.sVal));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(std::string("1.moles"), std::string(head2.sVal));
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL(0, p.PtrSelectedOutput->PushBackLong("sim", 1));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(0, p.PtrSelectedOutput->PushBackLong("sim", 1));
|
||||||
CPPUNIT_ASSERT_EQUAL(0, p.PtrSelectedOutput->PushBackString("state", "i_soln"));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(0, p.PtrSelectedOutput->PushBackString("state", "i_soln"));
|
||||||
CPPUNIT_ASSERT_EQUAL(0, p.PtrSelectedOutput->PushBackLong("soln", 22));
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(0, p.PtrSelectedOutput->PushBackLong("soln", 22));
|
||||||
|
// COMMENT: {8/26/2013 4:12:03 PM}
|
||||||
CPPUNIT_ASSERT_EQUAL(0, p.PtrSelectedOutput->EndRow());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL(0, p.PtrSelectedOutput->EndRow());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)6, p.PtrSelectedOutput->GetColCount());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL((size_t)6, p.PtrSelectedOutput->GetColCount());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)3, p.PtrSelectedOutput->GetRowCount());
|
// COMMENT: {8/26/2013 4:12:03 PM} CPPUNIT_ASSERT_EQUAL((size_t)3, p.PtrSelectedOutput->GetRowCount());
|
||||||
#if defined(_DEBUG)
|
// COMMENT: {8/26/2013 4:12:03 PM}#if defined(_DEBUG)
|
||||||
p.PtrSelectedOutput->Dump("TestTooManyHeadings");
|
// COMMENT: {8/26/2013 4:12:03 PM} p.PtrSelectedOutput->Dump("TestTooManyHeadings");
|
||||||
#endif
|
// COMMENT: {8/26/2013 4:12:03 PM}#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user