Fixed some bugs in C++ classes.

Ran test cases with test_classes enabled. Everything appeared to check
correctly. 

Added new test cases to phreeqcpp/mytest.

Added zero.sed to examples and mytest.





git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@1376 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2006-10-24 22:11:23 +00:00
parent 812bb1adcc
commit 52ab13ec09
4 changed files with 54 additions and 40 deletions

View File

@ -79,7 +79,7 @@ ifeq ($(CFG), RELEASE)
INCLUDES = -I../phreeqc
CXX = g++
CXXFLAGS = -Wall -pedantic -O3 $(DEFINES) $(INCLUDES)
CXXFLAGS_MODEL = -Wall -pedantic -O2 $(DEFINES) $(INCLUDES)
CXXFLAGS_MODEL = -Wall -pedantic -O3 $(DEFINES) $(INCLUDES)
OBJECT_FILES = $(COMMON_COBJS) $(COMMON_CXXOBJS) $(CL1MP_OBJS)
LD_FLAGS = -lm ${CL1MP_LIB}
endif

View File

@ -1072,8 +1072,9 @@ void test_classes(void)
/*
int i;
/*
std::map<int, cxxSolution> Solutions;
cxxSolution soln(solution[0]);
Solutions[solution[0]->n_user] = soln;
@ -1085,10 +1086,12 @@ void test_classes(void)
cxxNumKeyword nk;
x[solution[0]->n_user] = soln;
*/
#ifdef SKIP
std::ostringstream msg;
status_on = FALSE;
std::cout << std::endl << "TEST CLASSES" << std::endl;
for (i=0; i < count_solution; i++) {
if (solution[i]->new_def == TRUE) {
std::cout << "Solution new_def " << solution[i]->n_user << std::endl;
cxxISolution sol(solution[i]);
solution[i] = (struct solution *) solution_free(solution[i]);
solution[i] = sol.cxxISolution2solution();
@ -1096,6 +1099,7 @@ void test_classes(void)
soln_ptr = solution[i];
soln_ptr = solution[i];
} else {
std::cout << "Solution " << solution[i]->n_user << std::endl;
std::ostringstream oss;
cxxSolution sol(solution[i]);
solution[i] = (struct solution *) solution_free(solution[i]);
@ -1121,10 +1125,11 @@ void test_classes(void)
}
for (i=0; i < count_exchange; i++) {
if (exchange[i].new_def != TRUE) {
std::cout << "Exchange " << exchange[i].n_user << std::endl;
std::ostringstream oss;
cxxExchange ex(&(exchange[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxExchange ex1;
std::string keyInput = oss.str();
@ -1147,10 +1152,11 @@ void test_classes(void)
}
for (i=0; i < count_surface; i++) {
if (surface[i].new_def != TRUE) {
std::cout << "Surface " << surface[i].n_user << std::endl;
std::ostringstream oss;
cxxSurface ex(&(surface[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxSurface ex1;
@ -1176,10 +1182,11 @@ void test_classes(void)
}
for (i=0; i < count_pp_assemblage; i++) {
if (pp_assemblage[i].new_def != TRUE) {
std::cout << "PPassemblage " << pp_assemblage[i].n_user << std::endl;
std::ostringstream oss;
cxxPPassemblage ex(&(pp_assemblage[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxPPassemblage ex1;
@ -1204,10 +1211,11 @@ void test_classes(void)
}
for (i=0; i < count_kinetics; i++) {
std::cout << "Kinetics " << kinetics[i].n_user << std::endl;
std::ostringstream oss;
cxxKinetics ex(&(kinetics[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxKinetics ex1;
@ -1231,10 +1239,11 @@ void test_classes(void)
}
for (i=0; i < count_s_s_assemblage; i++) {
if (s_s_assemblage[i].new_def != TRUE) {
std::cout << "Solid solution " << s_s_assemblage[i].n_user << std::endl;
std::ostringstream oss;
cxxSSassemblage ex(&(s_s_assemblage[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxSSassemblage ex1;
@ -1260,10 +1269,11 @@ void test_classes(void)
}
for (i=0; i < count_gas_phase; i++) {
if (gas_phase[i].new_def != TRUE) {
std::cout << "Gas phase " << gas_phase[i].n_user << std::endl;
std::ostringstream oss;
cxxGasPhase ex(&(gas_phase[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxGasPhase ex1;
@ -1288,10 +1298,11 @@ void test_classes(void)
}
for (i=0; i < count_irrev; i++) {
std::cout << "Reaction " << irrev[i].n_user << std::endl;
std::ostringstream oss;
cxxReaction ex(&(irrev[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxReaction ex1;
@ -1315,10 +1326,11 @@ void test_classes(void)
}
for (i=0; i < count_mix; i++) {
std::cout << "Mix " << mix[i].n_user << std::endl;
std::ostringstream oss;
cxxMix ex(&(mix[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxMix ex1;
@ -1342,10 +1354,11 @@ void test_classes(void)
}
for (i=0; i < count_temperature; i++) {
std::cout << "Temperature " << temperature[i].n_user << std::endl;
std::ostringstream oss;
cxxTemperature ex(&(temperature[i]));
ex.dump_raw(oss, 0);
std::cerr << oss.str();
//std::cerr << oss.str();
cxxTemperature ex1;
@ -1368,7 +1381,7 @@ void test_classes(void)
free_check_null(temperature_ptr);
}
#endif
/*
{
// get all c storage
cxxStorageBin cstorage;
@ -1396,4 +1409,5 @@ void test_classes(void)
// read it back
}
*/
}

View File

@ -250,10 +250,10 @@ void cxxSurface::dump_raw(std::ostream& s_oss, unsigned int indent)const
s_oss << "-DDL_viscosity " << this->DDL_viscosity << std::endl;
s_oss << indent1;
s_oss << "-DDL_limit= " << this->DDL_limit << std::endl;
s_oss << "-DDL_limit " << this->DDL_limit << std::endl;
s_oss << indent1;
s_oss << "-transport= " << this->transport << std::endl;
s_oss << "-transport " << this->transport << std::endl;
// surfaceComps structures
for (std::list<cxxSurfaceComp>::const_iterator it = surfaceComps.begin(); it != surfaceComps.end(); ++it) {
@ -290,8 +290,8 @@ void cxxSurface::read_raw(CParser& parser)
vopts.push_back("dl_type"); // 8
vopts.push_back("sites_units"); // 9
vopts.push_back("debye_lengths"); // 10
vopts.push_back("DDL_viscosity"); // 11
vopts.push_back("DDL_limit"); // 12
vopts.push_back("ddl_viscosity"); // 11
vopts.push_back("ddl_limit"); // 12
vopts.push_back("transport"); // 13
}
@ -335,7 +335,7 @@ void cxxSurface::read_raw(CParser& parser)
case CParser::OPT_DEFAULT:
case CParser::OPT_ERROR:
opt = CParser::OPT_EOF;
parser.error_msg("Unknown input in SURF_COMP_RAW keyword.", CParser::OT_CONTINUE);
parser.error_msg("Unknown input in SURFACE keyword.", CParser::OT_CONTINUE);
parser.error_msg(parser.line().c_str(), CParser::OT_CONTINUE);
useLastLine = false;
break;

View File

@ -215,7 +215,7 @@ void cxxSurfaceComp::read_raw(CParser& parser)
vopts.push_back("totals"); // 8
vopts.push_back("formula_z"); // 9
vopts.push_back("formula_totals"); // 10
vopts.push_back("Dw"); // 11
vopts.push_back("dw"); // 11
}
std::istream::pos_type ptr;