From bbccc4bd968d7d806f0c1204b379093cf35c6824 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Tue, 6 May 2003 13:36:33 +0000 Subject: [PATCH] initial import --- tools/templates/cxx/demo.cpp | 45 ++++++++++++++++++ tools/templates/cxx/demo.mak.in | 81 +++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 tools/templates/cxx/demo.cpp create mode 100644 tools/templates/cxx/demo.mak.in diff --git a/tools/templates/cxx/demo.cpp b/tools/templates/cxx/demo.cpp new file mode 100644 index 000000000..808127bd7 --- /dev/null +++ b/tools/templates/cxx/demo.cpp @@ -0,0 +1,45 @@ +// +// Replace this sample main program with your program +// +// + +#include "Cantera.h" +#include "IdealGasMix.h" +using namespace Cantera; + +main() { + + IdealGasMix gas("h2o2.xml"); + gas.setState_TPX_String(1200.0, OneAtm, + "H2:2, O2:1, OH:0.01, H:0.01, O:0.01"); + equilibrate(gas,"HP"); + + printf("**** C++ Test Program ****\n\n"); + printf( + "Temperature: 14.5g K\n" + "Pressure: 14.5g Pa\n" + "Density: 14.5g kg/m3\n" + "Molar Enthalpy: 14.5g J/kmol\n" + "Molar Entropy: 14.5g J/kmol-K\n" + "Molar cp: 14.5g J/kmol-K\n", + gas.temperature(), gas.pressure(), gas.density(), + gas.enthalpy_mole(), gas.entropy_mole(), gas.cp_mole()); + + + +// c +// c Reaction information +// c +// irxns = nReactions() +// call getFwdRatesOfProgress(qf) +// call getRevRatesOfProgress(qr) +// call getNetRatesOfProgress(q) +// do i = 1,irxns +// call getReactionEqn(i,eq) +// write(*,20) eq,qf(i),qr(i),q(i) +// 20 format(a20,3g14.5,' kmol/m3/s') +// end do +// stop +// end +} + diff --git a/tools/templates/cxx/demo.mak.in b/tools/templates/cxx/demo.mak.in new file mode 100644 index 000000000..1b5225ea6 --- /dev/null +++ b/tools/templates/cxx/demo.mak.in @@ -0,0 +1,81 @@ +#!/bin/sh + +# This Makefile builds a C++ application that uses Cantera. By +# default, the main program file is 'demo.cpp,' which prints out some +# properties of a reacting gas mixture. + +# 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. + + +#------------------------ 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 + +# 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 C++ compiler +CXX = @CXX@ + +# C++ compile flags +CXX_FLAGS = @CXXFLAGS@ + +# external libraries +EXT_LIBS = @LOCAL_LIBS@ + +# the directory where the Cantera libraries are located +CANTERA_LIBDIR=@CANTERA_LIBDIR@ + +# the directory where Cantera include files may be found. +CANTERA_INCDIR=@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 $< -I$(CANTERA_INCDIR) $(CXX_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) @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 + + + + + +