Skip to content

Commit de4a24c

Browse files
committed
Merge remote-tracking branch 'greengroup/repackage'
This moves files into new pydas package, and means that software using this library will need to be modified slightly: -from pydas import DASSL +from pydas.dassl import DASSL It also removes DASPK2 and adds DASPK3.1, which allows sensitivity analysis. See jwallen/PyDAS#11 jwallen/PyDAS#12
2 parents 4da00e2 + 35ef8c2 commit de4a24c

57 files changed

Lines changed: 226 additions & 33733 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ make.inc
3232
/.project
3333
/.pydevproject
3434
/.settings
35+
36+
# DASPK3.1 source files
37+
daspk31/*

Makefile

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,49 @@ CYTHON_FLAGS=--inplace
1010

1111
-include make.inc
1212

13-
.PHONY: DASSL DASPK DASPK31 DASKR cython clean
13+
.PHONY: DASSL DASPK31 DASKR cython clean
1414

15-
all: DASSL DASPK DASKR cython
15+
all: DASSL DASPK31 DASKR cython
1616

17-
daspk: DASPK31 cython-daspk
17+
dassl: DASSL cython
1818

19-
cython-daspk:
20-
python setup.py build_ext daspk $(CYTHON_FLAGS)
19+
daspk: DASPK31 cython
2120

22-
cython: DASSL DASPK DASKR pydas.pyx
21+
cython:
22+
ifeq (,$$(wildcard daspk31/solver/ddaspk.o))
23+
# DASPK3.1 was not compiled. Cythonize the wrapper for only DASSL.
2324
python setup.py build_ext $(CYTHON_FLAGS)
25+
else
26+
# Cythonize both DASSL and DASPK3.1 wrappers
27+
python setup.py build_ext daspk $(CYTHON_FLAGS)
28+
endif
29+
2430

25-
install: DASSL DASPK DASKR cython
31+
install: DASSL DASPK31 DASKR cython
32+
ifeq (,$$(wildcard pydas/daspk.so))
33+
# the file "pydas/daspk.so" does not exist, so don't install daspk
2634
python setup.py install
35+
@echo "NOTE: Installed without DASPK, because it had not been compiled."
36+
else
37+
# the file "pydas/daspk.so" does exist, so install daspk
38+
python setup.py daspk install
39+
endif
2740

2841
DASSL:
2942
$(MAKE) -C dassl F77=$(F77)
3043

31-
DASPK:
32-
$(MAKE) -C daspk F77=$(F77)
33-
3444
DASPK31:
3545
$(MAKE) -C daspk31 F77=$(F77)
3646

3747
DASKR:
3848
$(MAKE) -C daskr F77=$(F77)
3949

40-
clean: clean-DASSL clean-DASPK clean-DASPK31 clean-DASKR clean-cython
50+
clean: clean-DASSL clean-DASPK31 clean-DASKR clean-cython
4151
rm -rf build
4252

4353
clean-DASSL:
4454
$(MAKE) -C dassl clean
4555

46-
clean-DASPK:
47-
$(MAKE) -C daspk clean
48-
4956
clean-DASPK31:
5057
$(MAKE) -C daspk31 clean
5158

@@ -54,20 +61,16 @@ clean-DASKR:
5461

5562
clean-cython:
5663
python setup.py clean $(CLEAN_FLAGS)
57-
rm -f *.so *.pyc *.c
64+
rm -f pydas/*.so pydas/*.pyc pydas/*.c pydas/*.html
5865

5966
help:
6067
@echo ""
6168
@echo "This makefile can be used to build PyDAS and its dependencies."
6269
@echo ""
6370
@echo "Typing \`make\` with no arguments will compile all three DAE solvers (DASSL,"
64-
@echo "DASPK, and DASKR) to static libraries and compile the PyDAS Python modules"
65-
@echo "that provide the Python interface to these solvers."
66-
@echo ""
67-
@echo "Typing \`make daspk\` after typing \`make\` will then additionally compile
68-
@echo "the optional DASPK 3.1 solver as well as the cython module pydaspk associated with it."
69-
@echo "The DASPK 3.1 fortran source files must first be downloaded externally and placed"
70-
@echo "in the daspk31 folder."
71+
@echo "DASPK3.1, and DASKR) to static libraries and compile the PyDAS Python modules"
72+
@echo "that provide the Python interface to these solvers. Note that one must agree"
73+
@echo "to download the DASPK3.1 source code externally to compile the DASPK wrapper."
7174
@echo ""
7275
@echo "Typing \`make clean\` will delete all of the intermediate build files,"
7376
@echo "compiled libraries, and compiled Python modules for all three DAE solvers and"
@@ -77,10 +80,9 @@ help:
7780
@echo "<target> is one of:"
7881
@echo ""
7982
@echo " DASSL to compile the DASSL solver"
80-
@echo " DASPK to compile the DASPK solver"
8183
@echo " DASPK31 to compile the DASPK31 solver"
8284
@echo " DASKR to compile the DASKR solver"
8385
@echo " cython to compile the PyDAS Python wrapper module for DASSL"
84-
@echo " cython-daspk to compile the PyDAS Python wrapper module for both DASSL and DASPK3.1"
86+
@echo " and DASPK3.1 (if it was compiled)"
8587
@echo ""
8688

README.rst

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ Introduction
77

88
PyDAS provides a means for Python code to utilize several notable Fortran-based
99
differential algebraic system solvers from Python code. The solvers made
10-
available -- DASSL, DASPK, and DASKR -- are all publicly-available from
10+
available -- DASSL and DASKR -- are all publicly-available from
1111
`Netlib <http://www.netlib.org/ode/>`_, and are distributed with PyDAS. PyDAS
1212
provides a Python extension type for each solver, which in turn provides a
1313
Pythonic means of setting the solver options, providing residual and jacobian
1414
functions, and running the solver.
1515

16+
In addition, PyDAS also provides a wrapper to the DASPK3.1 solver, which
17+
has native sensitivity analysis. The source code for DASPK3.1 is subject to
18+
copyright restrictions but is available for research purposes. Due to these
19+
restrictions, it is up to the user to download these source files manually
20+
(or agree to download them during the prompt given when compiling the wrappers).
21+
Please see the README file inside the daspk31/ folder for more details.
22+
1623
The DASSL, DASPK, and DASKR solvers are all substantially more robust than
1724
VODE, the solver used within the ODE solver functionality provided by
1825
`SciPy <http://www.scipy.org/>`_.
@@ -71,41 +78,52 @@ Installation
7178

7279
.. note::
7380

74-
Currently only the DASSL solver has been wrapped. The installation
75-
scripts therefore only build and install the DASSL wrapper by default.
81+
Currently only the DASSL and DASPK3.1 solvers have been wrapped.
82+
The installation scripts build and install the DASSL wrapper and the
83+
DASPK wrapper (unless the DASPK3.1 fortran code was not compiled.)
7684

7785
Windows
7886
-------
7987

80-
The provided batch scripts will compile all of the solvers and the PyDAS
81-
wrapper code. These scripts presume that you have the 32-bit version of the
88+
The provided make.bat batch script will compile the DASSL solver and the PyDAS
89+
wrapper code. Use the make_daspk.bat script to compile the DASPK3.1 solver and the
90+
DASPK wrapper code. Make sure you have manually downloaded the DASPK3.1 source
91+
files into the daspk31 folder. See the daspk31/README file for more details.
92+
These scripts presume that you have the 32-bit version of the
8293
MinGW C and Fortran compilers installed. Once you have run the batch script,
8394
you can install PyDAS into your Python packages if you desire by running the
8495
following command from the base package directory:
8596

8697
> python setup.py install
8798

99+
Use the following command if you want to install both the DASSL and DASPK wrappers:
100+
101+
> python setup.py daspk install
102+
88103
Linux
89104
-----
90105

91-
A Makefile has been provided that can be used to compile all of the solvers
92-
and the PyDAS wrapper code. To use, invoke the following command from the
106+
A Makefile has been provided that can be used to compile the DASSL solver and
107+
DASSL wrapper code. To use, invoke the following command from the
93108
base package directory::
94109

95110
$ make
96111

97112
This command will build PyDAS in-place, rather than installing it to your
98-
Python package directory. If you wish to formall install PyDAS, run the
113+
Python package directory.
114+
115+
If you wish to formally install PyDAS, run the
99116
following command from the base package directory after the ``make`` command
100117
(you may need root privileges for this)::
101118

102-
$ python setup.py install
119+
$ make install
103120

104121
You may wish to write a file `make.inc` that sets certain variables used by
105122
the Makefiles (e.g. the Fortran compiler). An example of such a file,
106123
`make.inc.example`, has been provided.
107124

108125

126+
109127
Mac OS X
110128
--------
111129

@@ -115,15 +133,14 @@ Homebrew (http://brew.sh) is an easy way to get gfortran::
115133

116134
But your system may still not be able to find the correct `libgfortran.a` library file
117135
(see https://github.com/mxcl/homebrew/issues/8539 ). Also, there are some problems
118-
linking with `clang`, so you need to make it link with `gcc`. This one-liner should
136+
linking with `clang`, so you need to make it link with `gcc`. This should
119137
build and install, assuming you have NumPy, Cython, etc. all set up::
120138

121-
$ LIBRARY_PATH=/usr/local/lib/gcc LDSHARED='gcc -bundle -undefined dynamic_lookup -arch x86_64' make F77=gfortran install
122-
123-
Or perhaps, with a newer version of Homebrew / Python / gfortran / NumPy / Cython, it will be a simple::
124-
125-
$ LIBRARY_PATH=/usr/local/Cellar/gfortran/4.8.0/gfortran/lib make F77=gfortran
139+
$ export LIBRARY_PATH=$(dirname $(gfortran -print-libgcc-file-name))
140+
$ make
141+
$ make install
126142

143+
Although at one stage it also required ``LDSHARED='gcc -bundle -undefined dynamic_lookup -arch x86_64'``.
127144
It seems to keep on changing. If you have difficulty, check the
128145
`issue tracker <https://github.com/jwallen/PyDAS/issues/>`_, and if you solve
129146
your difficulty, please share your successful approach.

daspk/Makefile

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)