initial import
This commit is contained in:
parent
cc5e3c0495
commit
bbccc4bd96
2 changed files with 126 additions and 0 deletions
45
tools/templates/cxx/demo.cpp
Normal file
45
tools/templates/cxx/demo.cpp
Normal file
|
|
@ -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
|
||||
}
|
||||
|
||||
81
tools/templates/cxx/demo.mak.in
Normal file
81
tools/templates/cxx/demo.mak.in
Normal file
|
|
@ -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 <this
|
||||
# file>' 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Reference in a new issue