diff --git a/Makefile.in b/Makefile.in index 84e51e7e5..7f2c47b74 100755 --- a/Makefile.in +++ b/Makefile.in @@ -77,7 +77,7 @@ tools-install: hdr-install: @INSTALL@ -d @ct_incdir@ - cp -r -f build/include/cantera @ct_incdir@ + cp -r -f build/include/cantera @ct_incroot@ # collect scattered header files abd build the include directory hdr-collect: @@ -158,6 +158,10 @@ finish-install: @INSTALL@ Cantera/fortran/f77demos/f77demos.mak @ct_demodir@/f77/Makefile chown -R @username@ @ct_demodir@/f77 + rm -f @prefix@/cantera/demos + rm -f @prefix@/cantera/data + rm -f @prefix@/cantera/templates + rm -f @prefix@/cantera/tutorials ln -s @ct_demodir@ @prefix@/cantera/demos ln -s @ct_datadir@ @prefix@/cantera/data ln -s @ct_templdir@ @prefix@/cantera/templates diff --git a/config/configure b/config/configure index aac5a7085..4e880ad95 100755 --- a/config/configure +++ b/config/configure @@ -271,7 +271,7 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="Cantera.README" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS local_inst ctversion ct_libdir ct_incdir ct_bindir ct_datadir ct_demodir ct_templdir ct_mandir ct_tutdir ct_docdir ct_dir CANTERA_LIBDIR CANTERA_INCDIR CT_TOOLS_BIN CANTERA_BINDIR CANTERA_EXAMPLES_DIR CANTERA_DATADIR username ctroot build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os buildlib MAKE ARCHIVE SOEXT SHARED PIC LCXX_FLAGS LCXX_END_LIBS USERDIR INCL_USER_CODE KERNEL BUILD_CK LIB_DIR LAPACK_LIBRARY build_lapack BLAS_LIBRARY build_blas LOCAL_LIBS CT_SHARED_LIB BUILD_F90 PYTHON_CMD BUILD_PYTHON BUILD_MATLAB BUILD_CLIB export_name CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX_DEPENDS F77 FFLAGS ac_ct_F77 FLIBS OS_IS_DARWIN OS_IS_WIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT local_math_libs math_libs SO LDSHARED LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS local_inst ctversion ct_libdir ct_incdir ct_incroot ct_bindir ct_datadir ct_demodir ct_templdir ct_mandir ct_tutdir ct_docdir ct_dir CANTERA_LIBDIR CANTERA_INCDIR CT_TOOLS_BIN CANTERA_BINDIR CANTERA_EXAMPLES_DIR CANTERA_DATADIR username ctroot build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os buildlib MAKE ARCHIVE SOEXT SHARED PIC LCXX_FLAGS LCXX_END_LIBS USERDIR INCL_USER_CODE KERNEL BUILD_CK LIB_DIR LAPACK_LIBRARY build_lapack BLAS_LIBRARY build_blas LOCAL_LIBS CT_SHARED_LIB BUILD_F90 PYTHON_CMD BUILD_PYTHON BUILD_MATLAB BUILD_CLIB export_name CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX_DEPENDS F77 FFLAGS ac_ct_F77 FLIBS OS_IS_DARWIN OS_IS_WIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT local_math_libs math_libs SO LDSHARED LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1302,6 +1302,7 @@ ctversion=${CANTERA_VERSION} if test -z $local_inst; then ct_libdir=${prefix}/lib/cantera-${ctversion} ct_incdir=${prefix}/include/cantera +ct_incroot=${prefix}/include ct_bindir=${prefix}/bin ct_datadir=${prefix}/cantera/${ctversion}/data ct_demodir=${prefix}/cantera/${ctversion}/demos @@ -1313,6 +1314,7 @@ ct_mandir=${prefix}/share/man else ct_libdir=${prefix}/lib/cantera-${ctversion} ct_incdir=${prefix}/include/cantera +ct_incroot=${prefix}/include ct_bindir=${prefix}/bin ct_datadir=${prefix}/cantera/${ctversion}/data ct_demodir=${prefix}/cantera/${ctversion}/demos @@ -1334,6 +1336,7 @@ fi + CANTERA_DATADIR=$datadir/cantera/data # @@ -3083,7 +3086,7 @@ fi # Provide some information about the compiler. -echo "$as_me:3086:" \ +echo "$as_me:3089:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -3260,7 +3263,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" -(eval echo $as_me:3263: \"$ac_link\") >&5 +(eval echo $as_me:3266: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -3340,7 +3343,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" -(eval echo $as_me:3343: \"$ac_link\") >&5 +(eval echo $as_me:3346: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -4201,6 +4204,7 @@ s,@local_inst@,$local_inst,;t t s,@ctversion@,$ctversion,;t t s,@ct_libdir@,$ct_libdir,;t t s,@ct_incdir@,$ct_incdir,;t t +s,@ct_incroot@,$ct_incroot,;t t s,@ct_bindir@,$ct_bindir,;t t s,@ct_datadir@,$ct_datadir,;t t s,@ct_demodir@,$ct_demodir,;t t diff --git a/config/configure.in b/config/configure.in index e43fdfdf7..a8d6700d0 100755 --- a/config/configure.in +++ b/config/configure.in @@ -58,6 +58,7 @@ AC_SUBST(ctversion) if test -z $local_inst; then ct_libdir=${prefix}/lib/cantera-${ctversion} ct_incdir=${prefix}/include/cantera +ct_incroot=${prefix}/include ct_bindir=${prefix}/bin ct_datadir=${prefix}/cantera/${ctversion}/data ct_demodir=${prefix}/cantera/${ctversion}/demos @@ -69,6 +70,7 @@ ct_mandir=${prefix}/share/man else ct_libdir=${prefix}/lib/cantera-${ctversion} ct_incdir=${prefix}/include/cantera +ct_incroot=${prefix}/include ct_bindir=${prefix}/bin ct_datadir=${prefix}/cantera/${ctversion}/data ct_demodir=${prefix}/cantera/${ctversion}/demos @@ -81,6 +83,7 @@ fi AC_SUBST(ct_libdir) AC_SUBST(ct_incdir) +AC_SUBST(ct_incroot) AC_SUBST(ct_bindir) AC_SUBST(ct_datadir) AC_SUBST(ct_demodir) diff --git a/tools/templates/cxx/demo.cpp b/tools/templates/cxx/demo.cpp index 3d7a8ae4a..1928ef11c 100644 --- a/tools/templates/cxx/demo.cpp +++ b/tools/templates/cxx/demo.cpp @@ -3,10 +3,10 @@ // // -#include "Cantera.h" -#include "IdealGasMix.h" -#include "equilibrium.h" -#include "transport.h" +#include +#include +#include +#include using namespace Cantera; diff --git a/tools/templates/cxx/demo.mak.in b/tools/templates/cxx/demo.mak.in index 6ffc44ebc..77f176f4a 100644 --- a/tools/templates/cxx/demo.mak.in +++ b/tools/templates/cxx/demo.mak.in @@ -21,7 +21,7 @@ OBJS = demo.o # additional flags to be passed to the linker. If your program # requires other external libraries, put them here -LINK_OPTIONS = +LINK_OPTIONS = @LCXX_FLAGS@ #--------------------------------------------------------------------------- # You probably don't need to edit anything below. @@ -36,13 +36,13 @@ CXX_FLAGS = @CXXFLAGS@ EXT_LIBS = @LOCAL_LIBS@ -lctcxx # the directory where the Cantera libraries are located -CANTERA_LIBDIR=@CANTERA_LIBDIR@ +CANTERA_LIBDIR=@ct_libdir@ # the directory where Cantera include files may be found. -CANTERA_INCDIR=@CANTERA_INCDIR@ +CANTERA_INCDIR=@ct_incroot@ # flags passed to the C++ compiler/linker for the linking step -LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ +LCXXFLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ # how to compile C++ source files to object files .@CXX_EXT@.@OBJ_EXT@: @@ -55,7 +55,7 @@ DEPENDS = $(OBJS:.o=.d) all: $(PROGRAM) $(PROGRAM): $(OBJS) - $(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) $(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ @FLIBS@ + $(CXX) -o $(PROGRAM) $(OBJS) $(LCXXFLAGS) $(CANTERA_LIBS) $(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ @FLIBS@ %.d: g++ -MM $*.cpp > $*.d diff --git a/tools/templates/f77/demo.f b/tools/templates/f77/demo.f index 25bdb81bc..dff42be30 100644 --- a/tools/templates/f77/demo.f +++ b/tools/templates/f77/demo.f @@ -10,12 +10,12 @@ c implicit double precision (a-h,o-z) parameter (MAXSP = 20, MAXRXNS = 100) double precision q(MAXRXNS), qf(MAXRXNS), qr(MAXRXNS) - double precision x(MAXSP), y(MAXSP), wdot(MAXSP) double precision diff(MAXSP) character*80 eq character*20 name c - write(*,*) '**** Fortran 77 Test Program ****' + write(*,*) + write(*,*) '******** Fortran 77 Test Program ********' call newIdealGasMix('h2o2.cti','ohmech','Mix') t = 1200.0 diff --git a/tools/templates/f77/demo.mak.in b/tools/templates/f77/demo.mak.in index 954a02b35..64cd4a1d1 100644 --- a/tools/templates/f77/demo.mak.in +++ b/tools/templates/f77/demo.mak.in @@ -4,7 +4,7 @@ # 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. +# 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.' @@ -25,7 +25,8 @@ 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 = +LINK_OPTIONS = @LCXX_FLAGS@ + #--------------------------------------------------------------------------- # You probably don't need to edit anything below. @@ -53,10 +54,10 @@ EXT_LIBS = @LOCAL_LIBS@ -lctcxx CANTERA_LIBDIR=@ct_libdir@ # the directory where Cantera include files may be found. -CANTERA_INCDIR=@ct_incdir@ +CANTERA_INCDIR=@ct_incroot@ # flags passed to the C++ compiler/linker for the linking step -LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ +LCXXFLAGS = -L$(CANTERA_LIBDIR) @LCXX_FLAGS@ # how to compile C++ source files to object files .@CXX_EXT@.@OBJ_EXT@: @@ -73,7 +74,7 @@ DEPENDS = $(OBJS:.o=.d) all: $(PROGRAM) $(PROGRAM): $(OBJS) - $(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) $(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ $(FORT_LIBS) + $(CXX) -o $(PROGRAM) $(OBJS) $(LCXXFLAGS) $(CANTERA_LIBS) $(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ $(FORT_LIBS) %.d: g++ -MM $*.cpp > $*.d diff --git a/tools/templates/f77/demo_ftnlib.cpp b/tools/templates/f77/demo_ftnlib.cpp index bba589432..a0ae4706a 100644 --- a/tools/templates/f77/demo_ftnlib.cpp +++ b/tools/templates/f77/demo_ftnlib.cpp @@ -19,10 +19,14 @@ processes. Similar libraries to access other capabilities of Cantera (surface chemistry, etc.) could be written in the same way. + This library is designed for Fortran compilers that expect external + procedure na,es to be lowercase with a trailing underscore. If this + is not the case, the procedure names must be edited before use. + */ // add any other Cantera header files you need here -#include "IdealGasMix.h" +#include // store a pointer to an IdealGasMix object @@ -36,12 +40,12 @@ IdealGasMix* _gasptr() { return _gas; } #define WITH_TRANSPORT #ifdef WITH_EQUIL -#include "equilibrium.h" +#include #endif #ifdef WITH_TRANSPORT -#include "transport.h" +#include // store a pointer to a transport manager static Transport* _trans = 0; @@ -59,7 +63,8 @@ void handleError() { extern "C" { - /// This is the Fortran main program + /// This is the Fortran main program. This works for g77; it may + /// need to be modified for other Fortran compilers extern int MAIN__(); /** @@ -112,7 +117,7 @@ extern "C" { //-------------- setting the state ---------------------------- - // subroutine setState_TPX(T, P, X) + /// subroutine setState_TPX(T, P, X) void setstate_tpx_(doublereal* T, doublereal* P, doublereal* X) { try { _gas->setState_TPX(*T, *P, X);