Moved remaining C++ tests out of examples/cxx

This commit is contained in:
Ray Speth 2011-12-14 05:55:11 +00:00
parent 70c71b5448
commit ea63e3163a
16 changed files with 124 additions and 6589 deletions

View file

@ -1,12 +0,0 @@
#/bin/sh
all:
@echo 'building example programs....'
cd cxx; @MAKE@ all
clean:
cd cxx; @MAKE@ clean
depends:
cd cxx; @MAKE@ depends

View file

@ -1,30 +0,0 @@
Makefile
.depends
cxx_examples
eq1.csv
eq1.dat
kin1.csv
kin1.dat
kin2.csv
kin2.dat
kin3.csv
kin3.dat
rp1.dot
rp1.log
tr1.csv
tr1.dat
tr2.csv
tr2.dat
transport_log.xml
.cttmp.py
ct2ctml.log
.check.py
kin1_win.csv
kin2_win.csv
log
silane.xml
tr1win.csv
*.d
cxx_examples.exe
cxx_examples.ilk
cxx_examples.pdb

View file

@ -1,131 +0,0 @@
#!/bin/sh
############################################################################
#
# Makefile to compile and link a C++ application to
# Cantera.
#
#############################################################################
# the name of the executable program to be created
PROG_NAME = cxx_examples
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
OBJS = examples.o kinetics_example1.o kinetics_example2.o \
kinetics_example3.o equil_example1.o \
transport_example1.o transport_example2.o \
rxnpath_example1.o
# additional flags to be passed to the linker. If your program
# requires other external libraries, put them here
LINK_OPTIONS = @EXTRA_LINK@
#############################################################################
# the Fortran compiler
FORT = @F90@
PURIFY=@PURIFY@
# Fortran compile flags
FORT_FLAGS = @FFLAGS@
# Fortran libraries
ifeq (@build_with_f2c@, 0)
FORT_LIBS = @FLIBS@
else
FORT_LIBS =
endif
# the C++ compiler
CXX = @CXX@
# C++ compile flags
CXX_FLAGS = @CXXFLAGS@ @CXX_INCLUDES@
# external libraries
EXT_LIBS = @LOCAL_LIBS@ -lctcxx
# Ending C++ linking libraries
LCXX_END_LIBS = @LCXX_END_LIBS@
#------ you probably don't have to change anything below this line -----
# the directory where the Cantera libraries are located
CANTERA_LIBDIR=@buildlib@
# required Cantera libraries
CANTERA_LIBS = @LOCAL_LIBS@ -lctcxx
CANTERA_LIB_DEPS = $(CANTERA_LIBDIR)/libkinetics.a \
$(CANTERA_LIBDIR)/libtransport.a \
$(CANTERA_LIBDIR)/libthermo.a \
$(CANTERA_LIBDIR)/libctnumerics.a \
$(CANTERA_LIBDIR)/libctbase.a \
$(CANTERA_LIBDIR)/libctmath.a \
$(CANTERA_LIBDIR)/libtpx.a \
$(CANTERA_LIBDIR)/libconverters.a
ifeq (@build_lapack@, 1)
CANTERA_LAPACK_DEPS = $(CANTERA_LIBDIR)/libctblas.a \
$(CANTERA_LIBDIR)/libctlapack.a
endif
ifeq (@use_sundials@, 0)
CANTERA_CVODE_DEPS = $(CANTERA_LIBDIR)/libcvode.a
endif
LIB_DEPS = $(CANTERA_LIB_DEPS) $(CANTERA_LAPACK_DEPS) $(CANTERA_CVODE_DEPS)
# the directory where Cantera include files may be found.
CANTERA_INC=-I@ctroot@/build/include
# flags passed to the C++ compiler/linker for the linking step
LCXX_FLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@ @CXXFLAGS@
# how to compile C++ source files to object files
.@CXX_EXT@.@OBJ_EXT@:
$(PURIFY) $(CXX) -c $< $(CANTERA_INC) $(CXX_FLAGS)
# how to compile Fortran source files to object files
.@F77_EXT@.@OBJ_EXT@:
$(PURIFY) $(FORT) -c $< $(FORT_FLAGS)
PROGRAM = ./$(PROG_NAME)$(EXE_EXT)
all: .depends $(PROGRAM)
DEPENDS=$(OBJS:.o=.d)
%.d:
@CXX_DEPENDS@ $(CANTERA_INC) $(CXX_FLAGS) $*.cpp > $*.d
$(PROGRAM): $(OBJS) $(LIB_DEPS)
$(PURIFY) $(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) \
$(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ \
$(LCXX_END_LIBS)
clean:
$(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends *~
(if test -d SunWS_cache ; then \
$(RM) -rf SunWS_cache ; \
fi )
depends:
$(MAKE) .depends
.depends: $(DEPENDS)
cat *.d > .depends
TAGS:
etags *.h *.cpp
ifeq ($(wildcard .depends), .depends)
include .depends
endif

View file

@ -1,134 +0,0 @@
# Microsoft Developer Studio Project File - Name="examples" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=examples - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "examples.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "examples.mak" CFG="examples - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "examples - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "examples - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
F90=df.exe
RSC=rc.exe
!IF "$(CFG)" == "examples - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE F90 /compile_only /nologo /warn:nofileopt
# ADD F90 /assume:underscore /compile_only /iface:nomixed_str_len_arg /iface:cref /math_library:fast /names:lowercase /nologo /warn:nofileopt /module:""
# SUBTRACT F90 /threads
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /Ob2 /I "../../include" /I "d:/dgg/ctcyg/include/cantera" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 dfor.lib /nologo /subsystem:console /machine:I386 /include:"__matherr" /out:"../../bin/examples.exe" /libpath:"../../lib"
# SUBTRACT LINK32 /profile /nodefaultlib
!ELSEIF "$(CFG)" == "examples - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE F90 /check:bounds /compile_only /debug:full /nologo /traceback /warn:argument_checking /warn:nofileopt
# ADD F90 /assume:underscore /check:bounds /compile_only /dbglibs /debug:full /iface:nomixed_str_len_arg /iface:cref /names:lowercase /nologo /traceback /warn:argument_checking /warn:nofileopt /module:""
# SUBTRACT F90 /threads
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../include" /I "../../Cantera/src" /I "../../Cantera/cxx/src" /I "../.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib cantera_d.lib ckreader_d.lib ctmath_d.lib ctlapack_d.lib ctblas_d.lib cvode_d.lib recipes_d.lib dfor.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../../bin/examples.exe" /pdbtype:sept /libpath:"../../lib"
!ENDIF
# Begin Target
# Name "examples - Win32 Release"
# Name "examples - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp"
# Begin Source File
SOURCE=.\equil_example1.cpp
# End Source File
# Begin Source File
SOURCE=.\examples.cpp
# End Source File
# Begin Source File
SOURCE=.\kinetics_example1.cpp
# End Source File
# Begin Source File
SOURCE=.\kinetics_example2.cpp
# End Source File
# Begin Source File
SOURCE=.\rxnpath_example1.cpp
# End Source File
# Begin Source File
SOURCE=.\transport_example1.cpp
# End Source File
# Begin Source File
SOURCE=.\transport_example2.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View file

@ -1,60 +0,0 @@
#include "/Applications/Cantera/include/cantera/Cantera.h"
#include "cantera/IdealGasMix.h"
#include "cantera/transport.h"
int main() {
// create the gas object
IdealGasMix gas("gri30.cti");
doublereal temp = 500.0;
doublereal pres = 2.0*OneAtm;
gas.setState_TPX(temp, pres, "CH4:1.0, O2:2.0, N2:7.52");
// create a transport manager that implements
// mixture-averaged transport properties
Transport* tr = newTransportMgr("Mix", &gas);
//============= build each domain ========================
//-------- step 1: create the stagnation flow -------------
StFlow flow(&gas);
// create an initial grid
doublereal z[] = {0.0, 0.05, 0.1, 0.15, 0.2};
flow.setupGrid(5, z);
// specify the objects to use to compute kinetic rates and
// transport properties
flow.setKinetics(&gas);
flow.setTransport(&tr);
flow.setPressure(0.05*OneAtm);
//------- step 2: create the inlet -----------------------
Inlet1D inlet;
inlet.setMoleFractions("CH4:1, O2:2, N2:7.52");
inlet.setMdot(0.1);
//------- step 3: create the surface ---------------------
Surf1D surf;
//=================== create the container and insert the domains =====
vector<Domain1D*> domains;
domains.push_back(inlet);
domains.push_back(flow);
domains.push_back(surf);
OneDim flamesim(domains);
}

File diff suppressed because it is too large Load diff

View file

@ -1,16 +1,131 @@
#!/bin/sh
############################################################################
#
# $Revision: 1.7 $
# $Author: hkmoffa $
# $Date: 2006/04/30 18:06:56 $
# Makefile to compile and link a C++ application to
# Cantera.
#
#
all:
(cd ../../examples/cxx ; @MAKE@ )
test:
./runtest
#############################################################################
# the name of the executable program to be created
PROG_NAME = cxx_examples
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
OBJS = examples.o kinetics_example1.o kinetics_example2.o \
kinetics_example3.o equil_example1.o \
transport_example1.o transport_example2.o \
rxnpath_example1.o
# additional flags to be passed to the linker. If your program
# requires other external libraries, put them here
LINK_OPTIONS = @EXTRA_LINK@
#############################################################################
# the Fortran compiler
FORT = @F90@
PURIFY=@PURIFY@
# Fortran compile flags
FORT_FLAGS = @FFLAGS@
# Fortran libraries
ifeq (@build_with_f2c@, 0)
FORT_LIBS = @FLIBS@
else
FORT_LIBS =
endif
# the C++ compiler
CXX = @CXX@
# C++ compile flags
CXX_FLAGS = @CXXFLAGS@ @CXX_INCLUDES@
# external libraries
EXT_LIBS = @LOCAL_LIBS@ -lctcxx
# Ending C++ linking libraries
LCXX_END_LIBS = @LCXX_END_LIBS@
#------ you probably don't have to change anything below this line -----
# the directory where the Cantera libraries are located
CANTERA_LIBDIR=@buildlib@
# required Cantera libraries
CANTERA_LIBS = @LOCAL_LIBS@ -lctcxx
CANTERA_LIB_DEPS = $(CANTERA_LIBDIR)/libkinetics.a \
$(CANTERA_LIBDIR)/libtransport.a \
$(CANTERA_LIBDIR)/libthermo.a \
$(CANTERA_LIBDIR)/libctnumerics.a \
$(CANTERA_LIBDIR)/libctbase.a \
$(CANTERA_LIBDIR)/libctmath.a \
$(CANTERA_LIBDIR)/libtpx.a \
$(CANTERA_LIBDIR)/libconverters.a
ifeq (@build_lapack@, 1)
CANTERA_LAPACK_DEPS = $(CANTERA_LIBDIR)/libctblas.a \
$(CANTERA_LIBDIR)/libctlapack.a
endif
ifeq (@use_sundials@, 0)
CANTERA_CVODE_DEPS = $(CANTERA_LIBDIR)/libcvode.a
endif
LIB_DEPS = $(CANTERA_LIB_DEPS) $(CANTERA_LAPACK_DEPS) $(CANTERA_CVODE_DEPS)
# the directory where Cantera include files may be found.
CANTERA_INC=-I@ctroot@/build/include
# flags passed to the C++ compiler/linker for the linking step
LCXX_FLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@ @CXXFLAGS@
# how to compile C++ source files to object files
.@CXX_EXT@.@OBJ_EXT@:
$(PURIFY) $(CXX) -c $< $(CANTERA_INC) $(CXX_FLAGS)
# how to compile Fortran source files to object files
.@F77_EXT@.@OBJ_EXT@:
$(PURIFY) $(FORT) -c $< $(FORT_FLAGS)
PROGRAM = ./$(PROG_NAME)$(EXE_EXT)
all: .depends $(PROGRAM)
DEPENDS=$(OBJS:.o=.d)
%.d:
@CXX_DEPENDS@ $(CANTERA_INC) $(CXX_FLAGS) $*.cpp > $*.d
$(PROGRAM): $(OBJS) $(LIB_DEPS)
$(PURIFY) $(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) \
$(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ \
$(LCXX_END_LIBS)
clean:
(cd ../../examples/cxx ; @MAKE@ clean )
$(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends *~
(if test -d SunWS_cache ; then \
$(RM) -rf SunWS_cache ; \
fi )
depends:
$(MAKE) .depends
.depends: $(DEPENDS)
cat *.d > .depends
TAGS:
etags *.h *.cpp
ifeq ($(wildcard .depends), .depends)
include .depends
endif