Added a printTime option to writeStats() to turn off time printing

in output files.

Started moving blocks around in configure.in, and fixed an error
that corrupted FLIBS.
This commit is contained in:
Harry Moffat 2011-10-25 16:02:05 +00:00
parent 974fecdd5a
commit 2560431f07
13 changed files with 1518 additions and 4007 deletions

View file

@ -565,12 +565,13 @@ extern "C" {
catch (CanteraError) { return -1; }
}
int DLL_EXPORT sim1D_writeStats(int i) {
int DLL_EXPORT sim1D_writeStats(int i, int printTime) {
try {
_sim1D(i)->writeStats();
_sim1D(i)->writeStats(printTime);
return 0;
} catch (CanteraError) {
return -1;
}
catch (CanteraError) { return -1; }
}
int DLL_EXPORT sim1D_domainIndex(int i, char* name) {

View file

@ -84,7 +84,7 @@ extern "C" {
EEXXTT int DLL_CPREFIX sim1D_save(int i, char* fname, char* id,
char* desc);
EEXXTT int DLL_CPREFIX sim1D_restore(int i, char* fname, char* id);
EEXXTT int DLL_CPREFIX sim1D_writeStats(int i);
EEXXTT int DLL_CPREFIX sim1D_writeStats(int i, int printTime = 1);
EEXXTT int DLL_CPREFIX sim1D_domainIndex(int i, char* name);
EEXXTT double DLL_CPREFIX sim1D_value(int i, int idom, int icomp, int localPoint);
EEXXTT double DLL_CPREFIX sim1D_workValue(int i, int idom,

View file

@ -429,8 +429,8 @@ extern "C" {
return 0;
}
int DLL_EXPORT onedim_writeStats(int i) {
_onedim(i)->writeStats();
int DLL_EXPORT onedim_writeStats(int i, int printTime) {
_onedim(i)->writeStats(printTime);
return 0;
}

View file

@ -68,7 +68,7 @@ extern "C" {
int DLL_IMPORT onedim_settransientmode(int i, double dt, double* x);
int DLL_IMPORT onedim_setnewtonoptions(int i, int maxage);
int DLL_IMPORT onedim_resize(int i);
int DLL_IMPORT onedim_writeStats(int i);
int DLL_IMPORT onedim_writeStats(int i, int printTime = 1);
double DLL_IMPORT onedim_timestep(int i, int nsteps, double dt,
double* x, double* xnew, int loglevel);
int DLL_IMPORT onedim_save(int i, char* fname, char* id, char* desc, double* soln);

View file

@ -615,9 +615,14 @@ class Stack:
"""
return _cantera.sim1D_restore(self._hndl, file, id)
def showStats(self):
"""Show the statistics for the last solution."""
return _cantera.sim1D_writeStats(self._hndl)
def showStats(self, printTime = 1):
"""Show the statistics for the last solution.
If invoked with no arguments or with a non-zero argument, the
timing statistics will be printed. If invoked with a zero argument,
the timing will not be printed.
Default: print timing enabled.
"""
return _cantera.sim1D_writeStats(self._hndl, _onoff[printTime])
def domainIndex(self, name):
"""Integer index of the domain with name 'name'"""

View file

@ -1,31 +1,31 @@
[[ 6.04406471e-06 1.01738100e-06 3.25467803e-15 9.44878921e-07
3.20196626e-07 3.45252809e-15 3.12341397e-15 3.09815027e-15
2.93166212e-15]
3.20196626e-07 3.45252809e-15 3.12341397e-15 3.09815027e-15
2.93166212e-15]
[ 5.08690499e-15 1.00940773e-05 2.95033119e-15 8.72973220e-07
2.90021521e-07 3.22819878e-15 2.88500792e-15 2.86100892e-15
2.70458750e-15]
2.90021521e-07 3.22819878e-15 2.88500792e-15 2.86100892e-15
2.70458750e-15]
[ 3.25467803e-15 5.90066238e-07 2.40899947e-06 8.67150386e-07
2.75178768e-07 3.02514701e-15 2.87336197e-15 2.85661971e-15
2.73675664e-15]
2.75178768e-07 3.02514701e-15 2.87336197e-15 2.85661971e-15
2.73675664e-15]
[ 3.14959640e-15 5.81982147e-07 2.89050129e-15 2.56318977e-06
2.87270338e-07 3.25199672e-15 3.05588867e-15 3.04247847e-15
2.94726056e-15]
2.87270338e-07 3.25199672e-15 3.05588867e-15 3.04247847e-15
2.94726056e-15]
[ 3.20196626e-15 5.80043042e-07 2.75178768e-15 8.61811015e-07
2.62146728e-06 2.99922209e-15 2.85602138e-15 2.83971549e-15
2.72221044e-15]
2.62146728e-06 2.99922209e-15 2.85602138e-15 2.83971549e-15
2.72221044e-15]
[ 3.45252809e-15 6.45639757e-07 3.02514701e-15 9.75599015e-07
2.99922209e-07 2.08849997e-06 3.19672263e-15 3.17885565e-15
3.07926377e-15]
2.99922209e-07 2.08849997e-06 3.19672263e-15 3.17885565e-15
3.07926377e-15]
[ 3.12341397e-15 5.77001585e-07 2.87336197e-15 9.16766600e-07
2.85602138e-07 3.19672263e-15 1.62315735e-06 3.02939857e-15
2.93566827e-15]
2.85602138e-07 3.19672263e-15 1.62315735e-06 3.02939857e-15
2.93566827e-15]
[ 3.09815027e-15 5.72201784e-07 2.85661971e-15 9.12743541e-07
2.83971549e-07 3.17885565e-15 3.02939857e-15 1.60480867e-06
2.92422492e-15]
2.83971549e-07 3.17885565e-15 3.02939857e-15 1.60480867e-06
2.92422492e-15]
[ 2.93166212e-15 5.40917501e-07 2.73675664e-15 8.84178169e-07
2.72221044e-07 3.07926377e-15 2.93566827e-15 2.92422492e-15
1.51904485e-06]]
2.72221044e-07 3.07926377e-15 2.93566827e-15 2.92422492e-15
1.51904485e-06]]
[-0. -0. -0. -0. -0. -0. -0. -0. -0.]
[ -7.04749149e-14 -1.88567695e-05 -3.64733235e-14 -9.21405522e-06
-3.58390239e-06 -3.54030661e-14 -3.04704797e-14 -3.02364800e-14
-2.89579939e-14]
[ -6.90966189e-14 -1.84036152e-05 -3.65042941e-14 -9.29059107e-06
-3.58923841e-06 -3.54785016e-14 -3.07335477e-14 -3.05071031e-14
-2.92655613e-14]

View file

@ -11,10 +11,11 @@ libs = []
platform = sys.platform
flibs = []
if @build_with_f2c@ <> 1:
flibstr = '@FLIBS@'
f1 = flibstr.replace('-l', ' ')
flibs = f1.split()
# HKM -> not clear we need FLIBS here
#if @build_with_f2c@ == 1:
# flibstr = '@FLIBS@'
# f1 = flibstr.replace('-l', ' ')
# flibs = f1.split()
linkargs = '@LCXX_FLAGS@'

View file

@ -870,11 +870,14 @@ py_sim1D_writeStats(PyObject *self, PyObject *args)
{
int _val;
int i;
if (!PyArg_ParseTuple(args, "i:sim1D_writeStats", &i))
int printTime;
if (!PyArg_ParseTuple(args, "ii:sim1D_writeStats", &i, &printTime)) {
return NULL;
_val = sim1D_writeStats(i);
if (int(_val) == -1) return reportCanteraError();
}
_val = sim1D_writeStats(i, printTime);
if (int(_val) == -1) {
return reportCanteraError();
}
return Py_BuildValue("i",_val);
}

View file

@ -101,20 +101,26 @@ namespace Cantera {
MultiJac& OneDim::jacobian() { return *m_jac; }
MultiNewton& OneDim::newton() { return *m_newt; }
void OneDim::writeStats() {
//==============================================================================================================
void OneDim::writeStats(int printTime) {
saveStats();
char buf[100];
sprintf(buf,"\nStatistics:\n\n Grid Functions Time Jacobians Time \n");
writelog(buf);
int n = m_gridpts.size();
for (int i = 0; i < n; i++) {
sprintf(buf,"%5i %5i %9.4f %5i %9.4f \n",
m_gridpts[i], m_funcEvals[i], m_funcElapsed[i],
m_jacEvals[i], m_jacElapsed[i]);
writelog(buf);
if (printTime) {
sprintf(buf,"%5i %5i %9.4f %5i %9.4f \n",
m_gridpts[i], m_funcEvals[i], m_funcElapsed[i],
m_jacEvals[i], m_jacElapsed[i]);
} else {
sprintf(buf,"%5i %5i NA %5i NA \n",
m_gridpts[i], m_funcEvals[i], m_jacEvals[i]);
}
writelog(buf);
}
}
//==============================================================================================================
/**
* Save statistics on function and Jacobiab evaulation, and reset

View file

@ -137,7 +137,13 @@ namespace Cantera {
double timeStep(int nsteps, double dt, double* x,
double* r, int loglevel);
void writeStats();
//! Write statistics about the number of iterations and Jacobians at each grid level
/*!
* @param printTime Boolean that indicates whether time should be printed out
* The default is true. It's turned off for test problems where
* we don't want to print any times
*/
void writeStats(int printTime = 1);
void save(std::string fname, std::string id, std::string desc, doublereal* sol);

5264
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
AC_INIT(Cantera,1.7.0)
AC_CONFIG_HEADER(config.h)
# AC_CONFIG_AUX_DIR(.)
# AC_CONFIG_SRCDIR(./License.txt)
@ -79,6 +80,50 @@ fi
AC_SUBST(BITCOMPILE)
AC_SUBST(BITHARDWARE)
AC_SUBST(BITCHANGE)
#
#-----------------------------------------------------------------------
# C++ and C Compilation - INITIAL SECTION
#-----------------------------------------------------------------------
#
# CFLAGS: flags that get attached to the C compiler
# statement. AFLAGS are base flags that
# get added to compilers and loaders.
# FFLAGS: flags that get attached to the Fortran compiler
# statement. AFLAGS are base flags that
# get added to compilers and loaders.
#
# CXXFLAGS: Flags that get attached to the CXX compiler
# statement. AFLAGS are base flags that
# get added to compilers and loaders.
#
if test -z "$AFLAGS" ; then
AFLAGS=" "
fi
if test -z "$CXXFLAGS" ; then
CXXFLAGS="$AFLAGS"
else
CXXFLAGS="$CXXFLAGS"" ""$AFLAGS"
fi
if test -z "$CFLAGS" ; then
CFLAGS="$AFLAGS"
else
CFLAGS="$CFLAGS"" ""$AFLAGS"
fi
if test -z "$FFLAGS" ; then
FFLAGS="$AFLAGS"
else
FFLAGS="$FFLAGS"" ""$AFLAGS"
fi
export CXXFLAGS
export AFLAGS
export CFLAGS
export FFLAGS
#
# Note these should not be within if blocks
#
AC_PROG_CXX()
AC_PROG_CC()
SHARED_CTLIB=0
@ -306,14 +351,15 @@ AC_SUBST(CXX_DEPENDS)
#----------------------------------------
#########################################################
# User Code
#########################################################
USERDIR=""
INCL_USER_CODE=0
if test -n "$USER_SRC_DIR"; then USERDIR=$USER_SRC_DIR; INCL_USER_CODE=1; fi
if test -n "$USER_SRC_DIR"; then
USERDIR=$USER_SRC_DIR
INCL_USER_CODE=1
fi
AC_SUBST(USERDIR)
AC_SUBST(INCL_USER_CODE)
@ -325,11 +371,11 @@ CVODE_LIBS='-lcvode'
IDA_LIBS=''
if test "x$SUNDIALS_HOME" = "x"; then
SUNDIALS_LIB_DIR=/usr/local/lib
SUNDIALS_INC_DIR=/usr/local/include
SUNDIALS_LIB_DIR=/usr/local/lib
SUNDIALS_INC_DIR=/usr/local/include
else
SUNDIALS_LIB_DIR="$SUNDIALS_HOME/lib"
SUNDIALS_INC_DIR="$SUNDIALS_HOME/include"
SUNDIALS_LIB_DIR="$SUNDIALS_HOME/lib"
SUNDIALS_INC_DIR="$SUNDIALS_HOME/include"
fi
if test "$USE_SUNDIALS" = "default"; then
@ -338,8 +384,7 @@ if test "$USE_SUNDIALS" = "default"; then
# SUNDIALS_LIB_DIR had a space in it, despite use of double quotes everywhere
#ldsave="$LDFLAGS"
#LDFLAGS='-L'"$SUNDIALS_LIB_DIR"' '"$ldsave"
AC_CHECK_LIB(sundials_cvodes, CVodeCreate, [use_sundials=1], [use_sundials=0],\
[-lsundials_cvodes -lsundials_nvecserial -lm])
AC_CHECK_LIB(sundials_cvodes, CVodeCreate, [use_sundials=1], [use_sundials=0], [-lsundials_cvodes -lsundials_nvecserial -lm] )
if test ${use_sundials} = 0 ; then
tmpFile="$SUNDIALS_LIB_DIR/libsundials_cvodes.a"
@ -349,7 +394,7 @@ if test ${use_sundials} = 0 ; then
fi
if test ${use_sundials} = 1 ; then
echo SUNDIALS: succeeded in finding a sundials installation
echo "SUNDIALS: succeeded in finding a sundials installation"
else
echo SUNDIALS: failed at finding a sundials installation
fi
@ -357,8 +402,9 @@ fi
fi
if test "x$USE_SUNDIALS" = "xy"; then
use_sundials=1
use_sundials=1
fi
echo "Out of Block"
sundials_lib_dir=
sundials_lib=
sundials_lib_dep=
@ -844,6 +890,7 @@ fi
case $ac_sys_system in
Linux) NEED_F2C=1 ;;
esac
NEED_F2C=
#
# Create a variable build_f2c_lib that determines whether
@ -855,7 +902,7 @@ if test -n "$NEED_F2C" ; then
build_f2c_lib=1
else
case $ac_sys_system in
Linux) F2C_SYSTEMLIB="-lg2c"
Linux) F2C_SYSTEMLIB=""
esac
fi
AC_SUBST(build_f2c_lib)
@ -995,7 +1042,7 @@ then
RAW_LIBS_DEP=$RAW_LIBS_DEP' 'libctf2c.a
else
case $ac_sys_system in
Linux) LOCAL_LIBS=$LOCAL_LIBS' '-lg2c;;
Linux) LOCAL_LIBS=$LOCAL_LIBS;;
esac
fi
# Darwin*) LOCAL_LIBS=$LOCAL_LIBS' '-lg2c;;
@ -1382,55 +1429,8 @@ esac
# precompile_headers still relevant?
#
precompile_headers=no
#
# CFLAGS: flags that get attached to the C compiler
# statement. AFLAGS are base flags that
# get added to compilers and loaders.
# FFLAGS: flags that get attached to the Fortran compiler
# statement. AFLAGS are base flags that
# get added to compilers and loaders.
#
# CXXFLAGS: Flags that get attached to the CXX compiler
# statement. AFLAGS are base flags that
# get added to compilers and loaders.
#
if test -z "$AFLAGS" ; then
AFLAGS=" "
fi
if test -z "$CXXFLAGS" ; then
CXXFLAGS="$AFLAGS"
else
CXXFLAGS="$CXXFLAGS"" ""$AFLAGS"
fi
if test -z "$CFLAGS" ; then
CFLAGS="$AFLAGS"
else
CFLAGS="$CFLAGS"" ""$AFLAGS"
fi
if test -z "$FFLAGS" ; then
FFLAGS="$AFLAGS"
else
FFLAGS="$FFLAGS"" ""$AFLAGS"
fi
if test "x$OS_IS_WIN" = "x1"; then
#CXX=cl.exe
#CC=cl.exe
#export CXX
AC_PROG_CXX()
AC_PROG_CC()
else
#
# Determines the CXX compiler to use
#
export CXX
AC_PROG_CXX()
AC_PROG_CC()
if test "x$OS_IS_WIN" != "x1"; then
AC_MSG_CHECKING(for ability to precompile headers)
if test -n "$GCC"; then
msg=`rm -f *h.gch; $CXX testpch.h &> /dev/null`
if test -f testpch.h.gch; then
@ -1549,7 +1549,11 @@ AC_SUBST(HAVE_STRIPSYMBOLS)
# Fortran
#---------------------------------------------------------------------------
#if test x"$build_with_f2c" = "x0"; then
#
# This macro sets the substitution variable, @F77@ and @G77@
#
echo " this is $F77"
echo "this is a test"
AC_PROG_F77()
# if G77 is defined, then add a flag to turn off adding a second underscore
@ -1561,10 +1565,11 @@ else
FFLAGS=$FFLAGS' -fno-second-underscore'
fi
fi
dnl Checks for libraries.
F77LDRCLIBS=
AC_F77_LIBRARY_LDFLAGS()
echo " Macro returned with FLIBS defined as " $FLIBS
override_f77_libs=0;
#case $ac_sys_system in
@ -1691,7 +1696,6 @@ AC_OBJEXT
AC_EXEEXT
AC_SUBST(precompile_headers)
AC_SUBST(FLIBS)
AC_SUBST(OS_IS_DARWIN)
AC_SUBST(OS_IS_WIN)
AC_SUBST(OS_IS_CYGWIN)

View file

@ -43,7 +43,7 @@ export BUILD_MATLAB_TOOLBOX
INSTALL_BIN=config/install-sh
export INSTALL_BIN
MATLAB_CMD="/usr/local/matlab/7.9/bin/matlab"
MATLAB_CMD="/usr/local/matlab/7.13/bin/matlab"
export MATLAB_CMD
BUILD_F90_INTERFACE="y"
@ -85,20 +85,17 @@ export CC
F77='/sierra/Sntools/extras/compilers/gcc-4.4.4/bin/gfortran'
export F77
FFLAGS="-g -fno-second-underscore"
FFLAGS="-g "
export FFLAGS
CFLAGS="-g -Wall"
CFLAGS="-g "
export CFLAGS
#CXXFLAGS="-g -Wall -Woverloaded-virtual -DDEBUG_HKM -DDEBUG_HKM_EPEQUIL -DDEBUG_NUMJAC"
CXXFLAGS="-g -Wall -Woverloaded-virtual -DDEBUG_HKM -DDEBUG_HKM_EPEQUIL "
CXXFLAGS="-g -Wall -Woverloaded-virtual -DDEBUG_HKM -DDEBUG_HKM_EPEQUIL "
export CXXFLAGS
FFLAGS="-g -DDEBUG_HKM -fno-second-underscore"
export FFLAGS
LDFLAGS=' '
export LDFLAGS