Merge bug fixes from the 2.0 maintenance branch

This commit is contained in:
Ray Speth 2012-08-15 15:36:34 +00:00
commit 021f66c755
12 changed files with 39 additions and 26 deletions

View file

@ -1022,7 +1022,7 @@ def install(*args, **kwargs):
env.SConsignFile()
env.Append(CPPPATH=[],
env.Prepend(CPPPATH=[],
LIBPATH=[Dir('build/lib')])
# preprocess input files (cti -> xml)

View file

@ -201,6 +201,9 @@ OS X
CC=clang CXX=clang++
* The Accelerate framework provides optimized versions of BLAS and LAPACK, so
the ``blas_lapack_libs`` option should generally be left unspecified.
Intel Compilers
---------------
* Before compiling Cantera, you may need to set up the appropriate environment

View file

@ -8,13 +8,13 @@ def prep_default(env):
def prep_fortran(env):
localenv = env.Clone()
localenv.Append(CPPPATH='#include/cantera/base') # for config.h
localenv.Prepend(CPPPATH='#include/cantera/base') # for config.h
return localenv
def prep_f2c(env):
localenv = env.Clone()
localenv.Append(CPPPATH=Dir('#ext/f2c_libs'))
localenv.Prepend(CPPPATH=Dir('#ext/f2c_libs'))
if not localenv['HAS_TIMES_H']:
localenv.Append(CPPDEFINES=['USE_CLOCK'])
if not localenv['HAS_UNISTD_H']:
@ -37,7 +37,7 @@ def prep_f2c(env):
def prep_sundials(env):
localenv = env.Clone()
localenv.Append(CPPPATH=Dir('#ext/cvode/include'))
localenv.Prepend(CPPPATH=Dir('#ext/cvode/include'))
# Suppress warnings from external code
if '-Wall' in localenv['CCFLAGS']:
@ -47,8 +47,8 @@ def prep_sundials(env):
def prep_gtest(env):
localenv = env.Clone()
localenv.Append(CPPPATH=[Dir('#ext/gtest'),
Dir('#ext/gtest/include')],
localenv.Prepend(CPPPATH=[Dir('#ext/gtest'),
Dir('#ext/gtest/include')],
CPPDEFINES={'GTEST_HAS_PTHREAD': 0})
return localenv
@ -132,8 +132,8 @@ for subdir, extensions, prepFunction in libs:
localenv = env.Clone()
localenv.Append(CPPPATH=[Dir('#ext/gtest'),
Dir('#ext/gtest/include')],
localenv.Prepend(CPPPATH=[Dir('#ext/gtest'),
Dir('#ext/gtest/include')],
CPPDEFINES={'GTEST_HAS_PTHREAD': 0})
build(localenv.Library(pjoin('../lib', 'gtest'),
source=['gtest/src/gtest-all.cc']))

View file

@ -422,7 +422,7 @@ public:
Ea2_.resize(maxRates_);
if (rdata.validate) {
validate();
validate(rdata);
}
}
@ -514,7 +514,7 @@ public:
//! temperatures at each interpolation pressure. This is potentially an
//! issue when one of the Arrhenius expressions at a particular pressure
//! has a negative pre-exponential factor.
void validate() {
void validate(const ReactionData& rdata) {
double T[] = {1.0, 10.0, 100.0, 1000.0, 10000.0};
for (pressureIter iter = pressures_.begin();
iter->first < 1000;
@ -528,9 +528,10 @@ public:
// message will correctly indicate that the problematic rate
// expression is at the higher of the adjacent pressures.
throw CanteraError("Plog::validate",
"Invalid rate coefficient at P = " +
fp2str(exp((++iter)->first)) +
", T = " + fp2str(T[i]));
"Invalid rate coefficient for reaction #" +
int2str(rdata.number) + ":\n" + rdata.equation + "\n" +
"at P = " + fp2str(exp((++iter)->first)) +
", T = " + fp2str(T[i]));
}
}
}

View file

@ -60,6 +60,7 @@ UNIT_OPTIONS = {'CAL/': 'cal/mol',
'MOLEC': 'molec',
'MOLECULES': 'molec'}
PROCESSED_UNITS = False
ENERGY_UNITS = 'cal/mol'
QUANTITY_UNITS = 'mol'
@ -1342,8 +1343,16 @@ def loadChemkinFile(path, speciesList=None):
except IndexError:
pass
ENERGY_UNITS = UNIT_OPTIONS[energyUnits]
QUANTITY_UNITS = UNIT_OPTIONS[moleculeUnits]
global PROCESSED_UNITS, ENERGY_UNITS, UNIT_OPTIONS
if not PROCESSED_UNITS:
PROCESSED_UNITS = True
ENERGY_UNITS = UNIT_OPTIONS[energyUnits]
QUANTITY_UNITS = UNIT_OPTIONS[moleculeUnits]
else:
if (ENERGY_UNITS != UNIT_OPTIONS[energyUnits] or
QUANTITY_UNITS != UNIT_OPTIONS[moleculeUnits]):
raise InputParseError("Multiple REACTIONS sections with "
"different units are not supported.")
kineticsList = []
commentsList = []

View file

@ -38,8 +38,8 @@ libs = [('base', ['cpp'], baseSetup),
for subdir, extensions, setup in libs:
localenv = env.Clone()
localenv.Append(CPPPATH=Dir('#include'))
localenv.Append(CPPPATH=Dir('#src')) # todo: remove when not needed
localenv.Prepend(CPPPATH=Dir('#include'))
localenv.Prepend(CPPPATH=Dir('#src')) # todo: remove when not needed
source = setup(localenv, subdir, extensions)
objects = localenv.SharedObject(source)
localenv.Depends(objects, localenv['config_h_target'])

View file

@ -2,7 +2,7 @@ from buildutils import *
Import('env', 'build', 'install')
localenv = env.Clone()
localenv.Append(CPPPATH=['#src', '#include', '#src/apps'])
localenv.Prepend(CPPPATH=['#src', '#include', '#src/apps'])
def buildProgram(name, src):
prog = build(localenv.Program(target=pjoin('#build/bin', name),

View file

@ -3,7 +3,7 @@ from buildutils import *
Import('env', 'build', 'install')
localenv = env.Clone()
localenv.Append(CPPPATH=['#include', '#src'])
localenv.Prepend(CPPPATH=['#include', '#src'])
f90_src = mglob(localenv, '.', 'f90', 'cpp')

View file

@ -53,8 +53,8 @@ elif os.name == 'posix':
linkflags.extend(['-Wl,--no-undefined',
'-Wl,--version-script,src/matlab/mexFunction.map'])
localenv.Append(CPPPATH=['#include', '#src', matlab_include],
CPPDEFINES=['MATLAB_MEX_FILE'],
localenv.Prepend(CPPPATH=['#include', '#src', matlab_include])
localenv.Append(CPPDEFINES=['MATLAB_MEX_FILE'],
LIBPATH=[matlab_libs],
LINKFLAGS=linkflags)

View file

@ -31,7 +31,7 @@ make_setup = localenv.SubstFile('#interfaces/python/setup.py',
extraArgs = ''
if localenv['python_package'] == 'full':
localenv.Append(CPPPATH=['#src', '#include'])
localenv.Prepend(CPPPATH=['#src', '#include'])
cantera_libname = 'cantera_shared' if os.name=='nt' else 'cantera'
#pylinklibs = [cantera_libname, 'cvode', 'ctmath', 'ctlapack', 'ctblas', 'ctf2c', 'execstream']

View file

@ -4,9 +4,9 @@ import subprocess
Import('env','build','install')
localenv = env.Clone()
localenv.Append(CPPPATH=['#ext/gtest/include', '#include'],
LIBPATH='#build/lib',
LIBS=['gtest'] + localenv['cantera_libs'])
localenv.Prepend(CPPPATH=['#ext/gtest/include', '#include'],
LIBPATH='#build/lib')
localenv.Append(LIBS=['gtest'] + localenv['cantera_libs'])
localenv['ENV']['PYTHONPATH'] = Dir('#interfaces/python').abspath
localenv['ENV']['CANTERA_DATA'] = Dir('#build/data').abspath

View file

@ -2,7 +2,7 @@ from buildutils import *
Import('env','build','install')
localenv = env.Clone()
localenv.Append(CPPPATH=['#include', '#src', 'shared'])
localenv.Prepend(CPPPATH=['#include', '#src', 'shared'])
os.environ['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'interfaces', 'python')
os.environ['CANTERA_DATA'] = pjoin(os.getcwd(), '..', 'build', 'data')