From e93289bcef8803a0fac537f8a60f55dc73fe5bec Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Fri, 18 Apr 2003 23:20:16 +0000 Subject: [PATCH] *** empty log message *** --- Cantera/cxx/Makefile.in | 58 ++++++++++ Cantera/cxx/cxxutils.cpp | 105 ++++++++++++++++++ Cantera/src/ChemEquil.h | 2 +- Cantera/src/Makefile.in | 2 +- Cantera/src/phasereport.cpp | 105 ++++++++++++++++++ Cantera/src/stringUtils.cpp | 104 +---------------- Cantera/src/stringUtils.h | 1 - Makefile.in | 46 +++++--- config/configure | 19 ++-- config/configure.in | 1 + configure | 2 +- examples/cxx/Makefile.in | 8 +- examples/cxx/example_utils.h | 4 +- examples/cxx/examples.cpp | 2 +- examples/cxx/kinetics_example1.cpp | 2 +- examples/cxx/kinetics_example2.cpp | 4 +- examples/cxx/rxnpath_example1.cpp | 4 +- test_problems/silane_equil/Makefile.in | 4 +- test_problems/silane_equil/output_blessed.txt | 1 - test_problems/silane_equil/silane_equil.cpp | 4 +- tools/Makefile.in | 4 + tools/bin/finish_install.py | 25 ++++- tools/src/Makefile.in | 8 +- tools/templates/f77/demo.mak | 99 +++++++++++++++++ tools/testtools/Makefile.in | 2 +- tools/testtools/csvdiff.cpp | 6 +- 26 files changed, 456 insertions(+), 166 deletions(-) create mode 100644 Cantera/cxx/Makefile.in create mode 100644 Cantera/cxx/cxxutils.cpp create mode 100644 Cantera/src/phasereport.cpp create mode 100644 tools/templates/f77/demo.mak diff --git a/Cantera/cxx/Makefile.in b/Cantera/cxx/Makefile.in new file mode 100644 index 000000000..9e413dd4b --- /dev/null +++ b/Cantera/cxx/Makefile.in @@ -0,0 +1,58 @@ +#/bin/sh +############################################################### +# $Author$ +# $Date$ +# $Revision$ +# +# Copyright 2001 California Institute of Technology +# +############################################################### + + +SUFFIXES= +SUFFIXES= .cpp .d .o + +CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) + +OBJS = cxxutils.o + +DEPENDS = $(OBJS:.o=.d) + +# the C++ compiler +CXX = @CXX@ + +# the directory where Cantera include files may be found. +CANTERA_INCDIR=../src + +CXX_INCLUDES = -I$(CANTERA_INCDIR) + +# flags passed to the C++ compiler/linker for the linking step +LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ + +# how to compile C++ source files to object files +.@CXX_EXT@.@OBJ_EXT@: + $(CXX) -c $< $(CXX_INCLUDES) $(CXX_FLAGS) + +LIB_NAME=libctcxx +CXXLIB=$(LIB_NAME).a + +all: $(OBJS) + @ARCHIVE@ $(CXXLIB) $(OBJS) + +clean: + $(RM) $(OBJS) $(CXXLIB) + +install: + @INSTALL@ $(CXXLIB) @prefix@/lib/cantera + + +%.d: + g++ -MM $(CXX_INCLUDES) $*.cpp > $*.d + +depends: $(DEPENDS) + cat *.d > .depends + $(RM) $(DEPENDS) + +ifeq ($(wildcard .depends), .depends) +include .depends +endif diff --git a/Cantera/cxx/cxxutils.cpp b/Cantera/cxx/cxxutils.cpp new file mode 100644 index 000000000..e4a731be9 --- /dev/null +++ b/Cantera/cxx/cxxutils.cpp @@ -0,0 +1,105 @@ +#include "ThermoPhase.h" +#include + +namespace Cantera { + + /** + * Format a summary of the mixture state for output. + */ + string report(const ThermoPhase& th, bool show_thermo) { + + char p[200]; + string s = ""; + + sprintf(p, "\n temperature %12.6g K\n", th.temperature()); + s += p; + sprintf(p, " pressure %12.6g Pa\n", th.pressure()); + s += p; + sprintf(p, " density %12.6g kg/m^3\n", th.density()); + s += p; + sprintf(p, " mean mol. weight %12.6g amu\n", th.meanMolecularWeight()); + s += p; + + if (show_thermo) { + sprintf(p, "\n"); + s += p; + sprintf(p, " 1 kg 1 kmol\n"); + s += p; + sprintf(p, " ----------- ------------\n"); + s += p; + sprintf(p, " enthalpy %12.6g %12.4g J\n", + th.enthalpy_mass(), th.enthalpy_mole()); + s += p; + sprintf(p, " internal energy %12.6g %12.4g J\n", + th.intEnergy_mass(), th.intEnergy_mole()); + s += p; + sprintf(p, " entropy %12.6g %12.4g J/K\n", + th.entropy_mass(), th.entropy_mole()); + s += p; + sprintf(p, " Gibbs function %12.6g %12.4g J\n", + th.gibbs_mass(), th.gibbs_mole()); + s += p; + sprintf(p, " heat capacity c_p %12.6g %12.4g J/K\n", + th.cp_mass(), th.cp_mole()); + s += p; + sprintf(p, " heat capacity c_v %12.6g %12.4g J/K\n", + th.cv_mass(), th.cv_mole()); + s += p; + } + + int kk = th.nSpecies(); + array_fp x(kk); + array_fp y(kk); + th.getMoleFractions(x.begin()); + th.getMassFractions(y.begin()); + + int k; + + sprintf(p, "\n X Y \n"); + s += p; + sprintf(p, " ------------- ------------\n"); + s += p; + for (k = 0; k < kk; k++) { + sprintf(p, "%18s %12.6e %12.6e\n", + th.speciesName(k).c_str(), x[k], y[k]); + s += p; + } + return s; + } + + /** + * Format a composition list for output. + */ + string formatCompList(const Phase& mix, int xyc) { + + const doublereal Threshold = 1.e-20; + + char p[200]; + string s = ""; + int kk = mix.nSpecies(); + array_fp zz(kk); + switch (xyc) { + case 0: mix.getMoleFractions(zz.begin()); break; + case 1: mix.getMassFractions(zz.begin()); break; + case 2: mix.getConcentrations(zz.begin()); break; + default: return "error: xyc must be 0, 1, or 2"; + } + + doublereal z; + int k; + for (k = 0; k < kk; k++) { + z = fabs(zz[k]); + if (z < Threshold) zz[k] = 0.0; + } + + for (k = 0; k < kk; k++) { + sprintf(p, "%18s\t %12.6e\n", mix.speciesName(k).c_str(), + zz[k]); + s += p; + } + return s; + } + +} + + diff --git a/Cantera/src/ChemEquil.h b/Cantera/src/ChemEquil.h index d6ce933f6..577c1cea8 100755 --- a/Cantera/src/ChemEquil.h +++ b/Cantera/src/ChemEquil.h @@ -32,7 +32,7 @@ using namespace std; namespace Cantera { - static int _equilflag(char* xy); + int _equilflag(char* xy); /** * Chemical equilibrium options. Used internally by class ChemEquil. diff --git a/Cantera/src/Makefile.in b/Cantera/src/Makefile.in index 2c20884ab..5c1ee70b2 100755 --- a/Cantera/src/Makefile.in +++ b/Cantera/src/Makefile.in @@ -23,7 +23,7 @@ EXT = ../../ext # basic components always needed BASE = Elements.o Constituents.o stringUtils.o misc.o importCTML.o plots.o \ - xml.o Phase.o DenseMatrix.o ctml.o funcs.o ctvector.o + xml.o Phase.o DenseMatrix.o ctml.o funcs.o ctvector.o phasereport.o # thermodynamic properties THERMO = $(BASE) ThermoPhase.o IdealGasPhase.o ConstDensityThermo.o SpeciesThermoFactory.o ThermoFactory.o diff --git a/Cantera/src/phasereport.cpp b/Cantera/src/phasereport.cpp new file mode 100644 index 000000000..e4a731be9 --- /dev/null +++ b/Cantera/src/phasereport.cpp @@ -0,0 +1,105 @@ +#include "ThermoPhase.h" +#include + +namespace Cantera { + + /** + * Format a summary of the mixture state for output. + */ + string report(const ThermoPhase& th, bool show_thermo) { + + char p[200]; + string s = ""; + + sprintf(p, "\n temperature %12.6g K\n", th.temperature()); + s += p; + sprintf(p, " pressure %12.6g Pa\n", th.pressure()); + s += p; + sprintf(p, " density %12.6g kg/m^3\n", th.density()); + s += p; + sprintf(p, " mean mol. weight %12.6g amu\n", th.meanMolecularWeight()); + s += p; + + if (show_thermo) { + sprintf(p, "\n"); + s += p; + sprintf(p, " 1 kg 1 kmol\n"); + s += p; + sprintf(p, " ----------- ------------\n"); + s += p; + sprintf(p, " enthalpy %12.6g %12.4g J\n", + th.enthalpy_mass(), th.enthalpy_mole()); + s += p; + sprintf(p, " internal energy %12.6g %12.4g J\n", + th.intEnergy_mass(), th.intEnergy_mole()); + s += p; + sprintf(p, " entropy %12.6g %12.4g J/K\n", + th.entropy_mass(), th.entropy_mole()); + s += p; + sprintf(p, " Gibbs function %12.6g %12.4g J\n", + th.gibbs_mass(), th.gibbs_mole()); + s += p; + sprintf(p, " heat capacity c_p %12.6g %12.4g J/K\n", + th.cp_mass(), th.cp_mole()); + s += p; + sprintf(p, " heat capacity c_v %12.6g %12.4g J/K\n", + th.cv_mass(), th.cv_mole()); + s += p; + } + + int kk = th.nSpecies(); + array_fp x(kk); + array_fp y(kk); + th.getMoleFractions(x.begin()); + th.getMassFractions(y.begin()); + + int k; + + sprintf(p, "\n X Y \n"); + s += p; + sprintf(p, " ------------- ------------\n"); + s += p; + for (k = 0; k < kk; k++) { + sprintf(p, "%18s %12.6e %12.6e\n", + th.speciesName(k).c_str(), x[k], y[k]); + s += p; + } + return s; + } + + /** + * Format a composition list for output. + */ + string formatCompList(const Phase& mix, int xyc) { + + const doublereal Threshold = 1.e-20; + + char p[200]; + string s = ""; + int kk = mix.nSpecies(); + array_fp zz(kk); + switch (xyc) { + case 0: mix.getMoleFractions(zz.begin()); break; + case 1: mix.getMassFractions(zz.begin()); break; + case 2: mix.getConcentrations(zz.begin()); break; + default: return "error: xyc must be 0, 1, or 2"; + } + + doublereal z; + int k; + for (k = 0; k < kk; k++) { + z = fabs(zz[k]); + if (z < Threshold) zz[k] = 0.0; + } + + for (k = 0; k < kk; k++) { + sprintf(p, "%18s\t %12.6e\n", mix.speciesName(k).c_str(), + zz[k]); + s += p; + } + return s; + } + +} + + diff --git a/Cantera/src/stringUtils.cpp b/Cantera/src/stringUtils.cpp index 8e872ad13..89d1dc810 100755 --- a/Cantera/src/stringUtils.cpp +++ b/Cantera/src/stringUtils.cpp @@ -12,11 +12,7 @@ #endif #include "ct_defs.h" -//#include "Phase.h" -#include "ThermoPhase.h" - -//#include "IdealGasMix.h" - +#include "ctexceptions.h" #include namespace Cantera { @@ -137,104 +133,6 @@ namespace Cantera { return count; } - /** - * Format a summary of the mixture state for output. - */ - string report(const ThermoPhase& th, bool show_thermo) { - - char p[200]; - string s = ""; - - sprintf(p, "\n temperature %12.6g K\n", th.temperature()); - s += p; - sprintf(p, " pressure %12.6g Pa\n", th.pressure()); - s += p; - sprintf(p, " density %12.6g kg/m^3\n", th.density()); - s += p; - sprintf(p, " mean mol. weight %12.6g amu\n", th.meanMolecularWeight()); - s += p; - - if (show_thermo) { - sprintf(p, "\n"); - s += p; - sprintf(p, " 1 kg 1 kmol\n"); - s += p; - sprintf(p, " ----------- ------------\n"); - s += p; - sprintf(p, " enthalpy %12.6g %12.4g J\n", - th.enthalpy_mass(), th.enthalpy_mole()); - s += p; - sprintf(p, " internal energy %12.6g %12.4g J\n", - th.intEnergy_mass(), th.intEnergy_mole()); - s += p; - sprintf(p, " entropy %12.6g %12.4g J/K\n", - th.entropy_mass(), th.entropy_mole()); - s += p; - sprintf(p, " Gibbs function %12.6g %12.4g J\n", - th.gibbs_mass(), th.gibbs_mole()); - s += p; - sprintf(p, " heat capacity c_p %12.6g %12.4g J/K\n", - th.cp_mass(), th.cp_mole()); - s += p; - sprintf(p, " heat capacity c_v %12.6g %12.4g J/K\n", - th.cv_mass(), th.cv_mole()); - s += p; - } - - int kk = th.nSpecies(); - array_fp x(kk); - array_fp y(kk); - th.getMoleFractions(x.begin()); - th.getMassFractions(y.begin()); - - int k; - - sprintf(p, "\n X Y \n"); - s += p; - sprintf(p, " ------------- ------------\n"); - s += p; - for (k = 0; k < kk; k++) { - sprintf(p, "%18s %12.6e %12.6e\n", - th.speciesName(k).c_str(), x[k], y[k]); - s += p; - } - return s; - } - - /** - * Format a composition list for output. - */ - string formatCompList(const Phase& mix, int xyc) { - - const doublereal Threshold = 1.e-20; - - char p[200]; - string s = ""; - int kk = mix.nSpecies(); - array_fp zz(kk); - switch (xyc) { - case 0: mix.getMoleFractions(zz.begin()); break; - case 1: mix.getMassFractions(zz.begin()); break; - case 2: mix.getConcentrations(zz.begin()); break; - default: return "error: xyc must be 0, 1, or 2"; - } - - doublereal z; - int k; - for (k = 0; k < kk; k++) { - z = fabs(zz[k]); - if (z < Threshold) zz[k] = 0.0; - } - - for (k = 0; k < kk; k++) { - sprintf(p, "%18s\t %12.6e\n", mix.speciesName(k).c_str(), - zz[k]); - s += p; - } - return s; - } - - /** * Get the file name without the path or extension */ diff --git a/Cantera/src/stringUtils.h b/Cantera/src/stringUtils.h index 3725c0545..e80efb5f7 100755 --- a/Cantera/src/stringUtils.h +++ b/Cantera/src/stringUtils.h @@ -25,7 +25,6 @@ namespace Cantera { void parseCompString(const string ss, compositionMap& x); int fillArrayFromString(const string& str, doublereal* a, char delim = ' '); string report(const ThermoPhase& th, bool show_thermo = true); - //void printSummary(IdealGasMix& mix, ostream& s); string formatCompList(const Phase& mix, int xyc); string logfileName(const string& infile); string getFileName(const string& path); diff --git a/Makefile.in b/Makefile.in index f7b2be80c..40f967781 100755 --- a/Makefile.in +++ b/Makefile.in @@ -17,7 +17,7 @@ build_matlab = @BUILD_MATLAB@ LIBDIR=@LIB_DIR@ # removed utils temporarily -all: kernel movelibs clib python matlab +all: kernel movelibs hdr-collect clib python matlab utils install: hdr-install kernel-install data-install python-install matlab-install tools-install finish-install @@ -25,12 +25,15 @@ demos: example_codes kernel: info rm -f lib/*.a + rm -f lib/*.so cd ext; @MAKE@ cd Cantera/src; @MAKE@ clib: cd Cantera/clib/src; @MAKE@ +cxxlib: + cd Cantera/cxx; make movelibs: mv -f Cantera/src/*.a lib @@ -43,6 +46,7 @@ utils: kernel-install: @INSTALL@ -d @prefix@/lib/cantera + rm -f @prefix@/lib/cantera/* @INSTALL@ -m 644 lib/*.a @prefix@/lib/cantera cd Cantera/clib/src; make install ranlib @prefix@/lib/cantera/*.a @@ -58,19 +62,23 @@ tools-install: hdr-install: @INSTALL@ -d @prefix@/include/cantera - @INSTALL@ -d @prefix@/include/kernel - @INSTALL@ -d @prefix@/include/cantera/kernel/oneD - @INSTALL@ -d @prefix@/include/cantera/kernel/zeroD - @INSTALL@ -d @prefix@/include/cantera/kernel/converters - @INSTALL@ -d @prefix@/include/cantera/kernel/transport - rm -r -f @prefix@/include/cantera/*.h - @INSTALL@ include/*.h @prefix@/include/cantera - @INSTALL@ config.h @prefix@/include/cantera - @INSTALL@ Cantera/src/*.h @prefix@/include/cantera/kernel - @INSTALL@ Cantera/src/oneD/*.h @prefix@/include/cantera/kernel/oneD - @INSTALL@ Cantera/src/zeroD/*.h @prefix@/include/cantera/kernel/zeroD - @INSTALL@ Cantera/src/converters/*.h @prefix@/include/cantera/kernel/converters - @INSTALL@ Cantera/src/transport/*.h @prefix@/include/cantera/kernel/transport + cp -r -f build/include/cantera @prefix@/include/cantera + +hdr-collect: + @INSTALL@ -d build/include/cantera + rm -r -f build/include/cantera/* + @INSTALL@ -d build/include/cantera/kernel + @INSTALL@ -d build/include/cantera/kernel/oneD + @INSTALL@ -d build/include/cantera/kernel/zeroD + @INSTALL@ -d build/include/cantera/kernel/converters + @INSTALL@ -d build/include/cantera/kernel/transport + @INSTALL@ include/*.h build/include/cantera + @INSTALL@ config.h build/include/cantera + @INSTALL@ Cantera/src/*.h build/include/cantera/kernel + @INSTALL@ Cantera/src/oneD/*.h build/include/cantera/kernel/oneD + @INSTALL@ Cantera/src/zeroD/*.h build/include/cantera/kernel/zeroD + @INSTALL@ Cantera/src/converters/*.h build/include/cantera/kernel/converters + @INSTALL@ Cantera/src/transport/*.h build/include/cantera/kernel/transport @@ -111,6 +119,9 @@ finish-install: @INSTALL@ -d @prefix@/bin @INSTALL@ -d @prefix@/cantera/demos/c++ @INSTALL@ examples/cxx/*.cpp @prefix@/cantera/demos/c++ + @INSTALL@ examples/cxx/*.h @prefix@/cantera/demos/c++ + @INSTALL@ examples/cxx/Makefile @prefix@/cantera/demos/c++ + chown -R @username@ @prefix@/cantera/demos/c++ @INSTALL@ -d @prefix@/cantera/demos/f77 @PYTHON_CMD@ tools/bin/finish_install.py @prefix@ @PYTHON_CMD@ #@INSTALL@ bin/ctmkmf @prefix@/bin/ctnew @@ -119,7 +130,7 @@ finish-install: example_codes: - cd examples; @MAKE@ all + (cd examples/cxx; make) test: example_codes cd test_problems; @MAKE@ all @@ -128,10 +139,11 @@ test: example_codes uninstall: rm -r -f @prefix@/include/cantera rm -r -f @prefix@/cantera - rm -f @prefix@/lib/lib@CT_SHARED_LIB@.a + rm -r -f @prefix@/lib/cantera + rm -r -f @prefix@/matlab/toolbox/cantera clean: - $(RM) *.*~ lib/Cantera.a lib/*.a lib/*.so bin/ck2ctml bin/ctsetup bin/cxx_examples + rm -f *.*~ lib/Cantera.a lib/*.a lib/*.so bin/ck2ctml bin/ctsetup bin/cxx_examples cd Cantera; @MAKE@ clean cd tools; @MAKE@ clean cd ext; @MAKE@ clean diff --git a/config/configure b/config/configure index 392f5912a..d5aa3053f 100755 --- a/config/configure +++ b/config/configure @@ -2884,7 +2884,7 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -ac_config_files="$ac_config_files ../Cantera/Makefile ../Cantera/src/Makefile ../Cantera/src/zeroD/Makefile ../Cantera/src/oneD/Makefile ../Cantera/src/converters/Makefile ../Cantera/src/transport/Makefile ../Cantera/clib/src/Makefile ../Cantera/matlab/Makefile ../Cantera/python/Makefile ../Cantera/python/src/Makefile ../ext/lapack/Makefile ../ext/blas/Makefile ../ext/cvode/Makefile ../ext/math/Makefile ../ext/tpx/Makefile ../ext/Makefile ../ext/recipes/Makefile ../examples/Makefile ../examples/cxx/Makefile ../Makefile ../tools/Makefile ../tools/src/Makefile ../tools/src/sample.mak ../tools/templates/f77/demo.mak ../tools/testtools/Makefile ../data/inputs/Makefile ../test_problems/Makefile ../test_problems/cxx_ex/Makefile ../test_problems/silane_equil/Makefile" +ac_config_files="$ac_config_files ../Cantera/Makefile ../Cantera/src/Makefile ../Cantera/src/zeroD/Makefile ../Cantera/src/oneD/Makefile ../Cantera/src/converters/Makefile ../Cantera/src/transport/Makefile ../Cantera/clib/src/Makefile ../Cantera/matlab/Makefile ../Cantera/python/Makefile ../Cantera/cxx/Makefile ../Cantera/python/src/Makefile ../ext/lapack/Makefile ../ext/blas/Makefile ../ext/cvode/Makefile ../ext/math/Makefile ../ext/tpx/Makefile ../ext/Makefile ../ext/recipes/Makefile ../examples/Makefile ../examples/cxx/Makefile ../Makefile ../tools/Makefile ../tools/src/Makefile ../tools/src/sample.mak ../tools/templates/f77/demo.mak ../tools/testtools/Makefile ../data/inputs/Makefile ../test_problems/Makefile ../test_problems/cxx_ex/Makefile ../test_problems/silane_equil/Makefile" test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. @@ -3146,6 +3146,7 @@ do "../Cantera/clib/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../Cantera/clib/src/Makefile" ;; "../Cantera/matlab/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../Cantera/matlab/Makefile" ;; "../Cantera/python/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../Cantera/python/Makefile" ;; + "../Cantera/cxx/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../Cantera/cxx/Makefile" ;; "../Cantera/python/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../Cantera/python/src/Makefile" ;; "../ext/lapack/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../ext/lapack/Makefile" ;; "../ext/blas/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../ext/blas/Makefile" ;; @@ -3167,7 +3168,7 @@ do "../test_problems/cxx_ex/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../test_problems/cxx_ex/Makefile" ;; "../test_problems/silane_equil/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../test_problems/silane_equil/Makefile" ;; "../config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS ../config.h" ;; - *) { { echo "$as_me:3170: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:3171: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -3437,7 +3438,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:3440: creating $ac_file" >&5 + { echo "$as_me:3441: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -3455,7 +3456,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:3458: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:3459: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -3468,7 +3469,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:3471: error: cannot find input file: $f" >&5 + { { echo "$as_me:3472: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -3529,7 +3530,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:3532: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:3533: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -3540,7 +3541,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:3543: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:3544: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -3553,7 +3554,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:3556: error: cannot find input file: $f" >&5 + { { echo "$as_me:3557: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -3670,7 +3671,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:3673: $ac_file is unchanged" >&5 + { echo "$as_me:3674: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/config/configure.in b/config/configure.in index cf1497a2e..bdbb5e1a9 100755 --- a/config/configure.in +++ b/config/configure.in @@ -378,6 +378,7 @@ AC_OUTPUT(../Cantera/Makefile \ ../Cantera/clib/src/Makefile \ ../Cantera/matlab/Makefile \ ../Cantera/python/Makefile \ + ../Cantera/cxx/Makefile \ ../Cantera/python/src/Makefile \ ../ext/lapack/Makefile \ ../ext/blas/Makefile \ diff --git a/configure b/configure index 4cd037636..983704fa8 100755 --- a/configure +++ b/configure @@ -150,7 +150,7 @@ LAPACK_FTN_STRING_LEN_AT_END='y' CXX=${CXX:=g++} # C++ compiler flags -CXXFLAGS=${CXXFLAGS:="-O2 -Wall"} +CXXFLAGS=${CXXFLAGS:="-O0 -Wall"} # the C++ flags required for linking #LCXX_FLAGS= diff --git a/examples/cxx/Makefile.in b/examples/cxx/Makefile.in index 4b07f970b..9f63a4b46 100755 --- a/examples/cxx/Makefile.in +++ b/examples/cxx/Makefile.in @@ -50,13 +50,13 @@ LCXX_END_LIBS = @LCXX_END_LIBS@ # the directory where the Cantera libraries are located -CANTERA_LIBDIR=@ctroot@/lib +CANTERA_LIBDIR=@CANTERA_LIBDIR@ # required Cantera libraries -CANTERA_LIBS = -lzeroD -lcantera -lckreader +CANTERA_LIBS = -lctcxx # the directory where Cantera include files may be found. -CANTERA_INC=-I@ctroot@/include +CANTERA_INC=-I@CANTERA_INCDIR@ # flags passed to the C++ compiler/linker for the linking step LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ @@ -69,7 +69,7 @@ LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ .@F77_EXT@.@OBJ_EXT@: $(FORT) -c $< $(FORT_FLAGS) -PROGRAM = @CANTERA_BINDIR@/$(PROG_NAME)$(EXE_EXT) +PROGRAM = ./$(PROG_NAME)$(EXE_EXT) all: $(PROGRAM) diff --git a/examples/cxx/example_utils.h b/examples/cxx/example_utils.h index 2d5b83ae7..2857fafc2 100755 --- a/examples/cxx/example_utils.h +++ b/examples/cxx/example_utils.h @@ -1,8 +1,8 @@ #ifndef CT_EXAMPLE_UTILS_H #define CT_EXAMPLE_UTILS_H -#include "Array.h" -#include "plots.h" +#include "kernel/Array.h" +#include "kernel/plots.h" // Save the temperature, density, pressure, and mole fractions at one // time diff --git a/examples/cxx/examples.cpp b/examples/cxx/examples.cpp index 863badba1..13ea8361d 100755 --- a/examples/cxx/examples.cpp +++ b/examples/cxx/examples.cpp @@ -1,6 +1,6 @@ #include "Cantera.h" -#include "ctexceptions.h" +//#include "ctexceptions.h" #define NUM_EXAMPLES 6 diff --git a/examples/cxx/kinetics_example1.cpp b/examples/cxx/kinetics_example1.cpp index 091cabfa7..644ec890f 100755 --- a/examples/cxx/kinetics_example1.cpp +++ b/examples/cxx/kinetics_example1.cpp @@ -11,7 +11,7 @@ ///////////////////////////////////////////////////////////// -#include "reactors.h" +#include "zerodim.h" #include "IdealGasMix.h" #include #include "example_utils.h" diff --git a/examples/cxx/kinetics_example2.cpp b/examples/cxx/kinetics_example2.cpp index a4fd931c5..c95963d63 100755 --- a/examples/cxx/kinetics_example2.cpp +++ b/examples/cxx/kinetics_example2.cpp @@ -12,8 +12,8 @@ #include "Cantera.h" -#include "IdealGasMix.h" -#include "reactors.h" +#include "GRI30.h" +#include "zerodim.h" #include #include "example_utils.h" diff --git a/examples/cxx/rxnpath_example1.cpp b/examples/cxx/rxnpath_example1.cpp index 842169b68..df9eba075 100755 --- a/examples/cxx/rxnpath_example1.cpp +++ b/examples/cxx/rxnpath_example1.cpp @@ -12,10 +12,10 @@ #include "Cantera.h" -#include "reactors.h" +#include "zerodim.h" #include #include "example_utils.h" -#include "ReactionPath.h" +#include "reactionpaths.h" #include "IdealGasMix.h" // #include diff --git a/test_problems/silane_equil/Makefile.in b/test_problems/silane_equil/Makefile.in index 09a7f8c1a..c03adc499 100644 --- a/test_problems/silane_equil/Makefile.in +++ b/test_problems/silane_equil/Makefile.in @@ -39,10 +39,10 @@ LCXX_END_LIBS = @LCXX_END_LIBS@ CANTERA_LIBDIR=@ctroot@/lib # required Cantera libraries -CANTERA_LIBS = -lcantera +CANTERA_LIBS = # the directory where Cantera include files may be found. -CANTERA_INCDIR=@ctroot@/include +CANTERA_INCDIR=@ctroot@/build/include/cantera # flags passed to the C++ compiler/linker for the linking step LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ diff --git a/test_problems/silane_equil/output_blessed.txt b/test_problems/silane_equil/output_blessed.txt index e62b7cdea..9b2e97f4f 100644 --- a/test_problems/silane_equil/output_blessed.txt +++ b/test_problems/silane_equil/output_blessed.txt @@ -29,4 +29,3 @@ SI3H8 1.244730e-28 5.189160e-27 SI2 1.619905e-05 4.108919e-04 SI3 1.121605e-06 4.267458e-05 - diff --git a/test_problems/silane_equil/silane_equil.cpp b/test_problems/silane_equil/silane_equil.cpp index 4c74b1540..5b36e9ade 100644 --- a/test_problems/silane_equil/silane_equil.cpp +++ b/test_problems/silane_equil/silane_equil.cpp @@ -10,14 +10,14 @@ //#include "Cantera.h" #include "IdealGasMix.h" -#include "ChemEquil.h" +#include "equilibrium.h" int main(int argc, char **argv) { try { IdealGasMix g("silane.xml"); g.setState_TPX(2000.0, 100.0, "SIH4:0.01, H2:0.99"); equilibrate(g, TP); - printSummary(g, cout); + cout << g; return 0; } catch (CanteraError) { diff --git a/tools/Makefile.in b/tools/Makefile.in index 023163330..4ffddb4eb 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -11,6 +11,10 @@ kernel: cd src; @MAKE@ cd testtools; @MAKE@ +apps-install: + @INSTALL@ -d @prefix@/bin + @INSTALL@ ../bin/ck2ctml @prefix@/bin + clean: $(RM) *.*~ cd src; @MAKE@ clean diff --git a/tools/bin/finish_install.py b/tools/bin/finish_install.py index ea277ea8a..730313fc6 100644 --- a/tools/bin/finish_install.py +++ b/tools/bin/finish_install.py @@ -26,18 +26,31 @@ MixMaster() """) f.close() +try: + import Cantera + ctpath = Cantera.__path__[0] +except: + ctpath = "-" + print """ Cantera has been successfully installed. File locations: - applications """+bindir+""" - library files """+libdir+""" - C++ headers """+hdrdir+""" - demos """+prefix+"""/cantera/demos - data files """+prefix+"""/cantera/data - + applications """+bindir+""" + library files """+libdir+""" + C++ headers """+hdrdir+""" + demos """+prefix+"""/cantera/demos + data files """+prefix+"""/cantera/data + + Matlab toolbox """+prefix+"""/matlab/toolbox/cantera/cantera + Matlab demos """+prefix+"""/matlab/toolbox/cantera/cantera-demos + Matlab tutorials """+prefix+"""/matlab/toolbox/cantera/cantera-tutorials""" +if ctpath <> "-": + print """ + Python package """+ctpath +print """ A shell script 'cantera_init' has been written that configures the environment for Cantera. It may be found in """+prefix+"""/cantera. It is recommended that you run this script diff --git a/tools/src/Makefile.in b/tools/src/Makefile.in index 60ffe65e7..fd31744f8 100755 --- a/tools/src/Makefile.in +++ b/tools/src/Makefile.in @@ -9,18 +9,14 @@ LCXX_FLAGS = -L@ctroot@/lib @CXXFLAGS@ LOCAL_LIBS = -lcantera @math_libs@ @LAPACK_LIBRARY@ @BLAS_LIBRARY@ LCXX_END_LIBS = @LCXX_END_LIBS@ -OBJS = ctsetup.o ck2ctml.o +OBJS = ck2ctml.o DEPENDS = $(OBJS:.o=.d) .cpp.o: @CXX@ -c $< @DEFS@ $(INCDIR) @CXXFLAGS@ $(CXX_FLAGS) -all: $(BINDIR)/ctmkmf $(BINDIR)/ck2ctml - -$(BINDIR)/ctmkmf: ctmkmf.o - @CXX@ -o $(BINDIR)/ctmkmf ctmkmf.o $(LCXX_FLAGS) $(LOCAL_LIBS) \ - $(LCXX_END_LIBS) +all: $(BINDIR)/ck2ctml $(BINDIR)/ck2ctml: ck2ctml.o @CXX@ -o $(BINDIR)/ck2ctml ck2ctml.o $(LCXX_FLAGS) -lconverters $(LOCAL_LIBS) \ diff --git a/tools/templates/f77/demo.mak b/tools/templates/f77/demo.mak new file mode 100644 index 000000000..194042c9c --- /dev/null +++ b/tools/templates/f77/demo.mak @@ -0,0 +1,99 @@ +#!/bin/sh + +# This Makefile builds a Fortran 77 application that uses Cantera. By +# default, the main program file is 'demo.f,' which prints out some +# properties of a reacting gas mixture. It uses the library +# 'demo_ftnlib.cpp,' which contains Fortran-callable functions that +# are implemented with C++ calls to Cantera. + +# To build program 'demo', simply type 'make', or 'make -f ' if this file is named something other than 'Makefile.' + +# Once you have verified that the demo runs, edit this file to replace +# object file 'demo.o' with your own object file or files. You may +# continue to use 'demo_ftnlib' if it serves your needs, or else +# replace it with a different interface library. + + +#------------------------ edit this block --------------------------------- + +# the name of the executable program to be created +PROG_NAME = demo + +# the object files to be linked together. +OBJS = demo.o demo_ftnlib.o + +# additional flags to be passed to the linker. If your program +# requires other external libraries, put them here +LINK_OPTIONS = + +#--------------------------------------------------------------------------- +# You probably don't need to edit anything below. + + +# the Fortran compiler +FORT = g77 + +# Fortran compile flags +FORT_FLAGS = -O2 -fno-second-underscore + +# Fortran libraries +FORT_LIBS = -lg2c -lgcc + +# the C++ compiler +CXX = g++ + +# C++ compile flags +CXX_FLAGS = -O0 -Wall + +# external libraries +EXT_LIBS = -loneD -lzeroD -ltransport -lconverters -lcantera -lrecipes -lcvode -lctlapack -lctmath -lctblas + +# the directory where the Cantera libraries are located +CANTERA_LIBDIR=/usr/local/lib/cantera + +# the directory where Cantera include files may be found. +CANTERA_INCDIR=/usr/local/include/cantera + +# flags passed to the C++ compiler/linker for the linking step +LCXX_FLAGS = -L$(CANTERA_LIBDIR) -O0 -Wall + +# how to compile C++ source files to object files +.cpp.o: + $(CXX) -c $< -I$(CANTERA_INCDIR) $(CXX_FLAGS) + +# how to compile Fortran source files to object files +.f.o: + $(FORT) -c $< $(FORT_FLAGS) + +PROGRAM = $(PROG_NAME)$(EXE_EXT) + +DEPENDS = $(OBJS:.o=.d) + +all: $(PROGRAM) + +$(PROGRAM): $(OBJS) + $(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) $(LINK_OPTIONS) $(EXT_LIBS) $(FORT_LIBS) + +%.d: + g++ -MM $*.cpp > $*.d + +clean: + $(RM) $(OBJS) $(PROGRAM) + +depends: $(DEPENDS) + cat *.d > .depends + $(RM) $(DEPENDS) + +TAGS: + etags *.h *.cpp + +ifeq ($(wildcard .depends), .depends) +include .depends +endif + + + + + + diff --git a/tools/testtools/Makefile.in b/tools/testtools/Makefile.in index a74ee239c..d7fe60587 100644 --- a/tools/testtools/Makefile.in +++ b/tools/testtools/Makefile.in @@ -1,7 +1,7 @@ #/bin/sh LIBDIR = @ctroot@/lib -INCDIR = @ctroot@/include +INCDIR = @prefix@/include/cantera BINDIR = @ctroot@/bin build_ck = @BUILD_CK@ diff --git a/tools/testtools/csvdiff.cpp b/tools/testtools/csvdiff.cpp index b4eb04d05..d4741acac 100644 --- a/tools/testtools/csvdiff.cpp +++ b/tools/testtools/csvdiff.cpp @@ -12,7 +12,7 @@ * * csvdiff File1.csv File2.csv * - * Compares the variable values in two Excell formatted + * Compares the variable values in two Excel formatted * comma separated files. * The comparison is done using a weighted norm basis. * @@ -451,12 +451,12 @@ static void print_usage() { printf("\t\n"); printf(" csvdiff [-h] File1.csv File2.csv\n"); printf("\t\n"); - printf("\tCompares the variable values in two Excell formatted " + printf("\tCompares the variable values in two Excel formatted " "comma separated files.\n"); printf("\tThe comparison is done using a weighted norm basis.\n"); printf("\t\n"); printf("\tThe two files should be basically equal. However, File1.csv is\n"); - printf("\ttaken as the reference file, that has precedence, when there is\n"); + printf("\ttaken as the reference file that has precedence, when there is\n"); printf("\tsomething to be decided upon.\n"); printf("\t\n"); printf("\t Arguments:\n");