Updated phreeqcpp to have examples from phreeqc.

equilibrium_phases_read_raw has duplicate lines.




git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@3724 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2009-10-27 20:29:04 +00:00
parent cbfb768381
commit b9e38f4da8
8 changed files with 60 additions and 33 deletions

View File

@ -59,7 +59,7 @@ debug:
# ============================================================================= # =============================================================================
#SRC = ../phreeqc #SRC = ../phreeqc
.SUFFIXES : .o .c .cxx .SUFFIXES : .o .c .cxx .cpp
# compilers # compilers
@ -70,6 +70,9 @@ debug:
.cxx.o : .cxx.o :
${CXX} ${CXXFLAGS} -c -o $@ $< ${CXX} ${CXXFLAGS} -c -o $@ $<
.cpp.o :
${CXX} ${CXXFLAGS} -c -o $@ $<
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
#hdf options #hdf options
#HDF5_ROOT=$(HOME)/../../usr #HDF5_ROOT=$(HOME)/../../usr
@ -149,6 +152,7 @@ COMMON_COBJS = \
print.o \ print.o \
read.o \ read.o \
readtr.o \ readtr.o \
sit.o \
smalldense.o \ smalldense.o \
spread.o \ spread.o \
step.o \ step.o \
@ -160,6 +164,7 @@ COMMON_COBJS = \
utilities.o utilities.o
COMMON_CXXOBJS = \ COMMON_CXXOBJS = \
dumper.o \
Exchange.o \ Exchange.o \
ExchComp.o \ ExchComp.o \
GasPhase.o \ GasPhase.o \
@ -181,6 +186,7 @@ COMMON_CXXOBJS = \
SSassemblage.o \ SSassemblage.o \
SSassemblageSS.o \ SSassemblageSS.o \
StorageBin.o \ StorageBin.o \
StorageBinList.o \
Surface.o \ Surface.o \
SurfaceCharge.o \ SurfaceCharge.o \
SurfaceComp.o \ SurfaceComp.o \
@ -220,7 +226,9 @@ Exchange.o: ../Exchange.cxx ../Utils.h ../char_star.h ../Exchange.h \
../phreeqc/phrqproto.h ../phreeqc/output.h ../phreeqc/phrqproto.h ../phreeqc/output.h
ExchComp.o: ../ExchComp.cxx ../Utils.h ../char_star.h ../ExchComp.h \ ExchComp.o: ../ExchComp.cxx ../Utils.h ../char_star.h ../ExchComp.h \
../NameDouble.h ../Parser.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ ../NameDouble.h ../Parser.h ../phreeqc/global.h ../phreeqc/phrqtype.h \
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ../phreeqc/output.h ../Dictionary.h ../Solution.h ../NumKeyword.h ../SolutionIsotopeList.h \
../SolutionIsotope.h ../cxxMix.h ../phreeqc/phqalloc.h \
../phreeqc/phrqproto.h ../phreeqc/output.h
GasPhase.o: ../GasPhase.cxx ../Utils.h ../char_star.h ../GasPhase.h \ GasPhase.o: ../GasPhase.cxx ../Utils.h ../char_star.h ../GasPhase.h \
../NumKeyword.h ../Parser.h ../NameDouble.h ../phreeqc/global.h \ ../NumKeyword.h ../Parser.h ../NameDouble.h ../phreeqc/global.h \
../phreeqc/phrqtype.h ../cxxMix.h ../phreeqc/phqalloc.h \ ../phreeqc/phrqtype.h ../cxxMix.h ../phreeqc/phqalloc.h \
@ -237,18 +245,23 @@ ISolution.o: ../ISolution.cxx ../ISolution.h ../ISolutionComp.h \
../NameDouble.h ../cxxMix.h ../phreeqc/output.h ../NameDouble.h ../cxxMix.h ../phreeqc/output.h
KineticsComp.o: ../KineticsComp.cxx ../Utils.h ../char_star.h \ KineticsComp.o: ../KineticsComp.cxx ../Utils.h ../char_star.h \
../KineticsComp.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \ ../KineticsComp.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \
../phreeqc/phrqtype.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ../phreeqc/phrqtype.h ../Dictionary.h ../Solution.h ../NumKeyword.h \
../SolutionIsotopeList.h ../SolutionIsotope.h ../cxxMix.h \
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
NameDouble.o: ../NameDouble.cxx ../Utils.h ../char_star.h ../NameDouble.h \ NameDouble.o: ../NameDouble.cxx ../Utils.h ../char_star.h ../NameDouble.h \
../Parser.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ ../Parser.h ../Dictionary.h ../Solution.h ../NumKeyword.h \
../phreeqc/output.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ../SolutionIsotopeList.h ../SolutionIsotope.h ../cxxMix.h \
../phreeqc/global.h ../phreeqc/phrqtype.h ../phreeqc/output.h \
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
NumKeyword.o: ../NumKeyword.cxx ../NumKeyword.h ../Parser.h \ NumKeyword.o: ../NumKeyword.cxx ../NumKeyword.h ../Parser.h \
../char_star.h ../char_star.h
Parser.o: ../Parser.cxx ../Parser.h ../char_star.h ../Utils.h \ Parser.o: ../Parser.cxx ../Parser.h ../char_star.h ../Utils.h \
../phreeqc/output.h ../phreeqc/output.h
PPassemblageComp.o: ../PPassemblageComp.cxx ../Utils.h ../char_star.h \ PPassemblageComp.o: ../PPassemblageComp.cxx ../Utils.h ../char_star.h \
../PPassemblageComp.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \ ../PPassemblageComp.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \
../phreeqc/phrqtype.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h \ ../phreeqc/phrqtype.h ../Dictionary.h ../Solution.h ../NumKeyword.h \
../phreeqc/output.h ../SolutionIsotopeList.h ../SolutionIsotope.h ../cxxMix.h \
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ../phreeqc/output.h
PPassemblage.o: ../PPassemblage.cxx ../Utils.h ../char_star.h \ PPassemblage.o: ../PPassemblage.cxx ../Utils.h ../char_star.h \
../PPassemblage.h ../NumKeyword.h ../Parser.h ../phreeqc/global.h \ ../PPassemblage.h ../NumKeyword.h ../Parser.h ../phreeqc/global.h \
../phreeqc/phrqtype.h ../PPassemblageComp.h ../NameDouble.h ../cxxMix.h \ ../phreeqc/phrqtype.h ../PPassemblageComp.h ../NameDouble.h ../cxxMix.h \
@ -263,7 +276,8 @@ ReadClass.o: ../ReadClass.cxx ../Parser.h ../char_star.h ../Solution.h \
../phreeqc/phrqproto.h ../SurfaceCharge.h ../PPassemblage.h \ ../phreeqc/phrqproto.h ../SurfaceCharge.h ../PPassemblage.h \
../PPassemblageComp.h ../cxxKinetics.h ../KineticsComp.h \ ../PPassemblageComp.h ../cxxKinetics.h ../KineticsComp.h \
../SSassemblage.h ../SSassemblageSS.h ../GasPhase.h ../Reaction.h \ ../SSassemblage.h ../SSassemblageSS.h ../GasPhase.h ../Reaction.h \
../Temperature.h ../phreeqc/phqalloc.h ../phreeqc/output.h ../Temperature.h ../dumper.h ../StorageBinList.h ../phreeqc/phqalloc.h \
../phreeqc/output.h
SAXPhreeqc.o: ../SAXPhreeqc.cxx ../SAXPhreeqc.h ../SaxPhreeqcHandlers.h \ SAXPhreeqc.o: ../SAXPhreeqc.cxx ../SAXPhreeqc.h ../SaxPhreeqcHandlers.h \
../phreeqc/global.h ../phreeqc/phrqtype.h ../phreeqc/phrqproto.h \ ../phreeqc/global.h ../phreeqc/phrqtype.h ../phreeqc/phrqproto.h \
../phreeqc/phqalloc.h ../phreeqc/output.h ../phreeqc/phqalloc.h ../phreeqc/output.h
@ -289,7 +303,9 @@ SSassemblage.o: ../SSassemblage.cxx ../Utils.h ../char_star.h \
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
SSassemblageSS.o: ../SSassemblageSS.cxx ../Utils.h ../char_star.h \ SSassemblageSS.o: ../SSassemblageSS.cxx ../Utils.h ../char_star.h \
../SSassemblageSS.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \ ../SSassemblageSS.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \
../phreeqc/phrqtype.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ../phreeqc/phrqtype.h ../Dictionary.h ../Solution.h ../NumKeyword.h \
../SolutionIsotopeList.h ../SolutionIsotope.h ../cxxMix.h \
../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
StorageBin.o: ../StorageBin.cxx ../Utils.h ../char_star.h ../StorageBin.h \ StorageBin.o: ../StorageBin.cxx ../Utils.h ../char_star.h ../StorageBin.h \
../Parser.h ../Solution.h ../NumKeyword.h ../SolutionIsotopeList.h \ ../Parser.h ../Solution.h ../NumKeyword.h ../SolutionIsotopeList.h \
../SolutionIsotope.h ../NameDouble.h ../cxxMix.h ../Exchange.h \ ../SolutionIsotope.h ../NameDouble.h ../cxxMix.h ../Exchange.h \
@ -301,11 +317,14 @@ StorageBin.o: ../StorageBin.cxx ../Utils.h ../char_star.h ../StorageBin.h \
../phreeqc/output.h ../phreeqc/output.h
SurfaceCharge.o: ../SurfaceCharge.cxx ../Utils.h ../char_star.h \ SurfaceCharge.o: ../SurfaceCharge.cxx ../Utils.h ../char_star.h \
../SurfaceCharge.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \ ../SurfaceCharge.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \
../phreeqc/phrqtype.h ../phreeqc/output.h ../phreeqc/phqalloc.h \ ../phreeqc/phrqtype.h ../Dictionary.h ../Solution.h ../NumKeyword.h \
../phreeqc/phrqproto.h ../SolutionIsotopeList.h ../SolutionIsotope.h ../cxxMix.h \
../phreeqc/output.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
SurfaceComp.o: ../SurfaceComp.cxx ../Utils.h ../char_star.h \ SurfaceComp.o: ../SurfaceComp.cxx ../Utils.h ../char_star.h \
../SurfaceComp.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \ ../SurfaceComp.h ../NameDouble.h ../Parser.h ../phreeqc/global.h \
../phreeqc/phrqtype.h ../phreeqc/phrqproto.h ../phreeqc/phqalloc.h \ ../phreeqc/phrqtype.h ../phreeqc/phrqproto.h ../Dictionary.h \
../Solution.h ../NumKeyword.h ../SolutionIsotopeList.h \
../SolutionIsotope.h ../cxxMix.h ../phreeqc/phqalloc.h \
../phreeqc/output.h ../phreeqc/output.h
Surface.o: ../Surface.cxx ../Utils.h ../char_star.h ../Surface.h \ Surface.o: ../Surface.cxx ../Utils.h ../char_star.h ../Surface.h \
../NumKeyword.h ../Parser.h ../phreeqc/global.h ../phreeqc/phrqtype.h \ ../NumKeyword.h ../Parser.h ../phreeqc/global.h ../phreeqc/phrqtype.h \
@ -324,6 +343,10 @@ Temperature.o: ../Temperature.cxx ../Utils.h ../char_star.h \
../phreeqc/phrqtype.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h ../phreeqc/phrqtype.h ../phreeqc/phqalloc.h ../phreeqc/phrqproto.h
Utils.o: ../Utils.cxx ../Utils.h ../char_star.h ../Parser.h \ Utils.o: ../Utils.cxx ../Utils.h ../char_star.h ../Parser.h \
../phreeqc/output.h ../phreeqc/output.h
dumper.o: ../dumper.cpp ../dumper.h ../Parser.h ../char_star.h \
../StorageBinList.h
StorageBinList.o: ../StorageBinList.cpp ../StorageBinList.h ../Parser.h \
../char_star.h
# #
# PHREEQC files # PHREEQC files
# #
@ -435,7 +458,7 @@ clean:
dependencies: dependencies:
mkdir -p $(DEBUG_DIR) mkdir -p $(DEBUG_DIR)
cd $(DEBUG_DIR); gcc -MM -I../phreeqc ../*.cxx cd $(DEBUG_DIR); gcc -MM -I../phreeqc ../*.cxx ../*.cpp
tester: tester:
cd ../mytest; make clean; make -k $(SPOOL) make.out $(SPOOL2); make zero; make diff $(SPOOL) diff.out $(SPOOL2) cd ../mytest; make clean; make -k $(SPOOL) make.out $(SPOOL2); make zero; make diff $(SPOOL) diff.out $(SPOOL2)

View File

@ -232,8 +232,10 @@ cxxPPassemblage::read_raw(CParser & parser, bool check)
{ {
std::istream::pos_type pos = parser.tellg(); std::istream::pos_type pos = parser.tellg();
cxxPPassemblageComp ppComp; cxxPPassemblageComp ppComp;
CParser::ECHO_OPTION eo = parser.get_echo_stream();
parser.set_echo_stream(CParser::EO_NONE);
ppComp.read_raw(parser, false); ppComp.read_raw(parser, false);
parser.set_echo_stream(eo);
if (this->ppAssemblageComps.find(ppComp.get_name()) != this->ppAssemblageComps.end()) if (this->ppAssemblageComps.find(ppComp.get_name()) != this->ppAssemblageComps.end())
{ {
@ -241,7 +243,6 @@ cxxPPassemblage::read_raw(CParser & parser, bool check)
parser.seekg(pos).clear(); parser.seekg(pos).clear();
parser.seekg(pos); parser.seekg(pos);
comp.read_raw(parser, false); comp.read_raw(parser, false);
int i=1;
} }
else else
{ {

View File

@ -1085,7 +1085,6 @@ read_delete(void)
output_msg(OUTPUT_CHECKLINE, "\t%s\n", line); output_msg(OUTPUT_CHECKLINE, "\t%s\n", line);
return (return_value); return (return_value);
} }
/*
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int int
read_solution_modify(void) read_solution_modify(void)
@ -1152,7 +1151,7 @@ read_solution_modify(void)
if (solution_bsearch(n_user, &n, FALSE) == NULL) if (solution_bsearch(n_user, &n, FALSE) == NULL)
{ {
input_error++; input_error++;
sprintf(error_string, "Solution %d not found for SOLUTION_MODIFY.\n%s\n", line_save); sprintf(error_string, "Solution %d not found for SOLUTION_MODIFY.\n%s\n", n_user, line_save);
error_msg(error_string, CONTINUE); error_msg(error_string, CONTINUE);
return (ERROR); return (ERROR);
} }
@ -1238,7 +1237,7 @@ read_equilibrium_phases_modify(void)
if (pp_assemblage_bsearch(n_user, &n) == NULL) if (pp_assemblage_bsearch(n_user, &n) == NULL)
{ {
input_error++; input_error++;
sprintf(error_string, "Equlibrium_phases %d not found for EQUILIBRIUM_PHASES_MODIFY.\n%s\n", line_save); sprintf(error_string, "Equlibrium_phases %d not found for EQUILIBRIUM_PHASES_MODIFY.\n%s\n", n_user, line_save);
error_msg(error_string, CONTINUE); error_msg(error_string, CONTINUE);
return (ERROR); return (ERROR);
} }
@ -1322,7 +1321,7 @@ read_exchange_modify(void)
if (exchange_bsearch(n_user, &n) == NULL) if (exchange_bsearch(n_user, &n) == NULL)
{ {
input_error++; input_error++;
sprintf(error_string, "Exchange %d not found for EXCHANGE_MODIFY.\n%s\n", line_save); sprintf(error_string, "Exchange %d not found for EXCHANGE_MODIFY.\n%s\n", n_user, line_save);
error_msg(error_string, CONTINUE); error_msg(error_string, CONTINUE);
return (ERROR); return (ERROR);
} }
@ -1405,7 +1404,7 @@ read_surface_modify(void)
if (surface_bsearch(n_user, &n) == NULL) if (surface_bsearch(n_user, &n) == NULL)
{ {
input_error++; input_error++;
sprintf(error_string, "Surface %d not found for SURFACE_MODIFY.\n%s\n", line_save); sprintf(error_string, "Surface %d not found for SURFACE_MODIFY.\n%s\n", n_user, line_save);
error_msg(error_string, CONTINUE); error_msg(error_string, CONTINUE);
return (ERROR); return (ERROR);
} }
@ -1488,7 +1487,7 @@ read_solid_solutions_modify(void)
if (s_s_assemblage_bsearch(n_user, &n) == NULL) if (s_s_assemblage_bsearch(n_user, &n) == NULL)
{ {
input_error++; input_error++;
sprintf(error_string, "Solid_solutions %d not found for SOLID_SOLUTIONS_MODIFY.\n%s\n", line_save); sprintf(error_string, "Solid_solutions %d not found for SOLID_SOLUTIONS_MODIFY.\n%s\n", n_user, line_save);
error_msg(error_string, CONTINUE); error_msg(error_string, CONTINUE);
return (ERROR); return (ERROR);
} }
@ -1571,7 +1570,7 @@ read_gas_phase_modify(void)
if (gas_phase_bsearch(n_user, &n) == NULL) if (gas_phase_bsearch(n_user, &n) == NULL)
{ {
input_error++; input_error++;
sprintf(error_string, "Gas_phase %d not found for GAS_PHASE_MODIFY.\n%s\n", line_save); sprintf(error_string, "Gas_phase %d not found for GAS_PHASE_MODIFY.\n%s\n", n_user, line_save);
error_msg(error_string, CONTINUE); error_msg(error_string, CONTINUE);
return (ERROR); return (ERROR);
} }
@ -1653,7 +1652,7 @@ read_kinetics_modify(void)
if (kinetics_bsearch(n_user, &n) == NULL) if (kinetics_bsearch(n_user, &n) == NULL)
{ {
input_error++; input_error++;
sprintf(error_string, "Kinetics %d not found for KINETICS_MODIFY.\n%s\n", line_save); sprintf(error_string, "Kinetics %d not found for KINETICS_MODIFY.\n%s\n", n_user, line_save);
error_msg(error_string, CONTINUE); error_msg(error_string, CONTINUE);
return (ERROR); return (ERROR);
} }

View File

@ -3,18 +3,18 @@
StorageBinListItem::StorageBinListItem(void) StorageBinListItem::StorageBinListItem(void)
{ {
this->defined = false; this->defined = false;
}; }
StorageBinListItem::~StorageBinListItem(void) StorageBinListItem::~StorageBinListItem(void)
{ {
}; }
void StorageBinListItem::Augment(std::string token) void StorageBinListItem::Augment(std::string token)
{ {
this->defined = true; this->defined = true;
if (token.size() == 0) return; if (token.size() == 0) return;
// split string accounting for possible negative numbers // split string accounting for possible negative numbers
int pos; unsigned int pos;
if ((pos = token.find("--")) != std::string::npos) if ((pos = token.find("--")) != std::string::npos)
{ {
token.replace(pos,2," &"); token.replace(pos,2," &");
@ -55,7 +55,7 @@ void StorageBinListItem::Augment(std::string token)
this->numbers.insert(i); this->numbers.insert(i);
} }
} }
}; }
StorageBinList::StorageBinList(void) StorageBinList::StorageBinList(void)
{ {
} }
@ -136,7 +136,7 @@ bool StorageBinList::Read(CParser & parser)
} }
// Select StorageBinListItem // Select StorageBinListItem
StorageBinListItem *item; StorageBinListItem *item = NULL;
switch (opt) switch (opt)
{ {
case 0: case 0:
@ -241,3 +241,4 @@ bool StorageBinList::Read(CParser & parser)
} }
return(return_value); return(return_value);
} }

View File

@ -95,6 +95,7 @@ Utilities::error_msg(const std::string & err_str, const int stop)
//+NAN double: 7ff8000000000000 //+NAN double: 7ff8000000000000
//-NAN double: fff8000000000000 //-NAN double: fff8000000000000
/*
double Utilities::get_nan(void) double Utilities::get_nan(void)
{ {
unsigned long long raw = 0x7ff0000000000000; unsigned long long raw = 0x7ff0000000000000;
@ -102,3 +103,5 @@ double Utilities::get_nan(void)
return(d); return(d);
} }
*/

View File

@ -288,7 +288,7 @@ bool dumper::Read(CParser & parser)
} }
// Select StorageBinListItem // Select StorageBinListItem
StorageBinListItem *item; StorageBinListItem *item = NULL;
switch (opt) switch (opt)
{ {
case 0: case 0: