Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Sundials 5.0.0 & and update submodule version #780

Merged
merged 2 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
url = https://github.com/google/googletest.git
[submodule "ext/sundials"]
path = ext/sundials
url = https://github.com/Cantera/sundials-mirror
url = https://github.com/LLNL/sundials
[submodule "ext/eigen"]
path = ext/eigen
url = https://github.com/eigenteam/eigen-git-mirror
Expand Down
6 changes: 3 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ if env['system_sundials'] == 'y':

# Ignore the minor version, e.g. 2.4.x -> 2.4
env['sundials_version'] = '.'.join(sundials_version.split('.')[:2])
if env['sundials_version'] not in ('2.4','2.5','2.6','2.7','3.0','3.1','3.2','4.0','4.1'):
if env['sundials_version'] not in ('2.4','2.5','2.6','2.7','3.0','3.1','3.2','4.0','4.1','5.0'):
print("""ERROR: Sundials version %r is not supported.""" % env['sundials_version'])
sys.exit(1)
print("""INFO: Using system installation of Sundials version %s.""" % sundials_version)
Expand All @@ -1128,8 +1128,8 @@ if env['system_sundials'] == 'y':
print('WARNING: External BLAS/LAPACK has been specified for Cantera '
'but Sundials was built without this support.')
else: # env['system_sundials'] == 'n'
print("""INFO: Using private installation of Sundials version 3.1.""")
env['sundials_version'] = '3.1'
print("""INFO: Using private installation of Sundials version 5.0.""")
env['sundials_version'] = '5.0'
env['has_sundials_lapack'] = int(env['use_lapack'])


Expand Down
11 changes: 6 additions & 5 deletions ext/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,19 @@ if env['system_sundials'] == 'n':
ConfigBuilder(sundials_configh)))

# Copy sundials header files into common include directory
for subdir in ('sundials', 'nvector', 'cvodes', 'ida', 'sunmatrix', 'sunlinsol'):
for subdir in ('sundials', 'nvector', 'cvodes', 'ida', 'sunmatrix',
'sunlinsol', 'sunnonlinsol'):
for header in mglob(env, 'sundials/include/'+subdir, 'h'):
build(copyenv.Command('#include/cantera/ext/%s/%s' % (subdir, header.name),
'#ext/sundials/include/%s/%s' % (subdir, header.name),
Copy('$TARGET', '$SOURCE')))

# Compile Sundials source files
subdirs = ['sundials', 'nvec_ser', 'cvodes', 'ida', 'sunmat_band',
'sunmat_dense', 'sunmat_sparse', 'sunlinsol_dense',
'sunlinsol_band','sunlinsol_spgmr']
subdirs = ['sundials', 'nvector/serial', 'cvodes', 'ida', 'sunmatrix/band',
'sunmatrix/dense', 'sunmatrix/sparse', 'sunlinsol/dense',
'sunlinsol/band','sunlinsol/spgmr', 'sunnonlinsol/newton']
if env['use_lapack']:
subdirs.extend(('sunlinsol_lapackdense', 'sunlinsol_lapackband'))
subdirs.extend(('sunlinsol/lapackdense', 'sunlinsol/lapackband'))

for subdir in subdirs:
libraryTargets.extend(localenv.SharedObject(
Expand Down
2 changes: 1 addition & 1 deletion ext/sundials
7 changes: 4 additions & 3 deletions ext/sundials_config.h.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* Minimal set of SUNDIALS configuration variables */
#define SUNDIALS_VERSION "3.1.0"
#define SUNDIALS_VERSION_MAJOR 3
#define SUNDIALS_VERSION_MINOR 1
#define SUNDIALS_VERSION "5.0.0"
#define SUNDIALS_VERSION_MAJOR 5
#define SUNDIALS_VERSION_MINOR 0
#define SUNDIALS_VERSION_PATCH 0
#define SUNDIALS_VERSION_LABEL ""
#define SUNDIALS_F77_FUNC(name,NAME) name ## _
#define SUNDIALS_DOUBLE_PRECISION 1
#define SUNDIALS_INT32_T 1
#define SUNDIALS_INDEX_TYPE int32_t
%(SUNDIALS_USE_GENERIC_MATH)s
%(SUNDIALS_BLAS_LAPACK)s
#define SUNDIALS_EXPORT