linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / science / math / fenics / default.nix
blobe80607ab9556557c42608436a145d16bc7ec1456
1 { lib, stdenv
2 , fetchurl
3 , fetchpatch
4 , boost
5 , cmake
6 , doxygen
7 , eigen
8 , mpi4py
9 , numpy
10 , pkg-config
11 , pybind11
12 , pytest
13 , pythonPackages
14 , six
15 , sympy
16 , gtest
17 , hdf5
18 , mpi
19 , ply
20 , python
21 , scotch
22 , setuptools
23 , sphinx
24 , suitesparse
25 , swig
26 , zlib
27 , blas
28 , lapack
30 let
31   version = "2019.1.0";
33   dijitso = pythonPackages.buildPythonPackage {
34     pname = "dijitso";
35     inherit version;
36     src = fetchurl {
37       url = "https://bitbucket.org/fenics-project/dijitso/downloads/dijitso-${version}.tar.gz";
38       sha256 = "1ncgbr0bn5cvv16f13g722a0ipw6p9y6p4iasxjziwsp8kn5x97a";
39     };
40     propagatedBuildInputs = [ numpy six ];
41     checkInputs = [ pytest ];
42     preCheck = ''
43       export HOME=$PWD
44     '';
45     checkPhase = ''
46       runHook preCheck
47       py.test test/
48       runHook postCheck
49     '';
50     meta = {
51       description = "Distributed just-in-time shared library building";
52       homepage = "https://fenicsproject.org/";
53       platforms = lib.platforms.all;
54       license = lib.licenses.lgpl3;
55     };
56   };
58   fiat = pythonPackages.buildPythonPackage {
59     pname = "fiat";
60     inherit version;
61     src = fetchurl {
62       url = "https://bitbucket.org/fenics-project/fiat/downloads/fiat-${version}.tar.gz";
63       sha256 = "1sbi0fbr7w9g9ajr565g3njxrc3qydqjy3334vmz5xg0rd3106il";
64     };
65     propagatedBuildInputs = [ numpy six sympy ];
66     checkInputs = [ pytest ];
68     preCheck = ''
69       # Workaround pytest 4.6.3 issue.
70       # See: https://bitbucket.org/fenics-project/fiat/pull-requests/59
71       rm test/unit/test_quadrature.py
72       rm test/unit/test_reference_element.py
73       rm test/unit/test_fiat.py
74     '';
75     checkPhase = ''
76       runHook preCheck
77       py.test test/unit/
78       runHook postCheck
79     '';
80     meta = {
81       description = "Automatic generation of finite element basis functions";
82       homepage = "https://fenicsproject.org/";
83       platforms = lib.platforms.all;
84       license = lib.licenses.lgpl3;
85     };
86   };
88   ufl = pythonPackages.buildPythonPackage {
89     pname = "ufl";
90     inherit version;
91     src = fetchurl {
92       url = "https://bitbucket.org/fenics-project/ufl/downloads/ufl-${version}.tar.gz";
93       sha256 = "04daxwg4y9c51sdgvwgmlc82nn0fjw7i2vzs15ckdc7dlazmcfi1";
94     };
95     propagatedBuildInputs = [ numpy six ];
96     checkInputs = [ pytest ];
97     checkPhase = ''
98       runHook preCheck
99       py.test test/
100       runHook postCheck
101     '';
102     meta = {
103       description = "A domain-specific language for finite element variational forms";
104       homepage = "https://fenicsproject.org/";
105       platforms = lib.platforms.all;
106       license = lib.licenses.lgpl3;
107     };
108   };
110   ffc = pythonPackages.buildPythonPackage {
111     pname = "ffc";
112     inherit version;
113     src = fetchurl {
114       url = "https://bitbucket.org/fenics-project/ffc/downloads/ffc-${version}.tar.gz";
115       sha256 = "1zdg6pziss4va74pd7jjl8sc3ya2gmhpypccmyd8p7c66ji23y2g";
116     };
117     nativeBuildInputs = [
118       pybind11
119     ];
120     propagatedBuildInputs = [
121       dijitso
122       fiat
123       numpy
124       six
125       sympy
126       ufl
127       setuptools
128     ];
129     checkInputs = [ pytest ];
130     preCheck = ''
131       export HOME=$PWD
132       rm test/unit/ufc/finite_element/test_evaluate.py
133     '';
134     checkPhase = ''
135       runHook preCheck
136       py.test test/unit/
137       runHook postCheck
138     '';
139     meta = {
140       description = "A compiler for finite element variational forms";
141       homepage = "https://fenicsproject.org/";
142       platforms = lib.platforms.all;
143       license = lib.licenses.lgpl3;
144     };
145   };
146   dolfin = stdenv.mkDerivation {
147     pname = "dolfin";
148     inherit version;
149     src = fetchurl {
150       url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz";
151       sha256 = "0kbyi4x5f6j4zpasch0swh0ch81w2h92rqm1nfp3ydi4a93vky33";
152     };
153     patches = [
154       (fetchpatch {
155         name = "fix-double-prefix.patch";
156         url = "https://bitbucket.org/josef_kemetmueller/dolfin/commits/328e94acd426ebaf2243c072b806be3379fd4340/raw";
157         sha256 = "1zj7k3y7vsx0hz3gwwlxhq6gdqamqpcw90d4ishwx5ps5ckcsb9r";
158       })
159     ];
160     propagatedBuildInputs = [
161       dijitso
162       fiat
163       numpy
164       six
165       ufl
166     ];
167     nativeBuildInputs = [
168       cmake
169       doxygen
170       pkg-config
171     ];
172     buildInputs = [
173       boost
174       dijitso
175       eigen
176       ffc
177       fiat
178       hdf5
179       mpi
180       numpy
181       blas
182       lapack
183       ply
184       python
185       scotch
186       six
187       sphinx
188       suitesparse
189       swig
190       sympy
191       ufl
192       zlib
193     ];
194     cmakeFlags = [
195       "-DDOLFIN_CXX_FLAGS=-std=c++11"
196       "-DDOLFIN_AUTO_DETECT_MPI=ON"
197       "-DDOLFIN_ENABLE_CHOLMOD=ON"
198       "-DDOLFIN_ENABLE_DOCS=ON"
199       "-DDOLFIN_ENABLE_HDF5=ON"
200       "-DDOLFIN_ENABLE_MPI=ON"
201       "-DDOLFIN_ENABLE_SCOTCH=ON"
202       "-DDOLFIN_ENABLE_UMFPACK=ON"
203       "-DDOLFIN_ENABLE_ZLIB=ON"
204       "-DDOLFIN_SKIP_BUILD_TESTS=ON" # Otherwise SCOTCH is not found
205       # TODO: Enable the following features
206       "-DDOLFIN_ENABLE_PARMETIS=OFF"
207       "-DDOLFIN_ENABLE_PETSC=OFF"
208       "-DDOLFIN_ENABLE_SLEPC=OFF"
209       "-DDOLFIN_ENABLE_TRILINOS=OFF"
210     ];
211     installCheckPhase = ''
212       source $out/share/dolfin/dolfin.conf
213       make runtests
214     '';
215     meta = {
216       description = "The FEniCS Problem Solving Environment in Python and C++";
217       homepage = "https://fenicsproject.org/";
218       license = lib.licenses.lgpl3;
219     };
220   };
221   python-dolfin = pythonPackages.buildPythonPackage rec {
222     pname = "dolfin";
223     inherit version;
224     disabled = pythonPackages.isPy27;
225     src = dolfin.src;
226     sourceRoot = "${pname}-${version}/python";
227     nativeBuildInputs = [
228       pybind11
229       cmake
230     ];
231     dontUseCmakeConfigure = true;
232     preConfigure = ''
233       export CMAKE_PREFIX_PATH=${pybind11}/share/cmake/pybind11:$CMAKE_PREFIX_PATH
234       substituteInPlace setup.py --replace "pybind11==2.2.4" "pybind11"
235       substituteInPlace dolfin/jit/jit.py \
236         --replace 'pkg-config.exists("dolfin")' 'pkg-config.exists("${dolfin}/lib/pkgconfig/dolfin.pc")' \
237         --replace 'pkg-config.parse("dolfin")' 'pkg-config.parse("${dolfin}/lib/pkgconfig/dolfin.pc")'
238     '';
239     buildInputs = [
240       dolfin
241       boost
242     ];
244     propagatedBuildInputs = [
245       dijitso
246       ffc
247       mpi4py
248       numpy
249       ufl
250       pythonPackages.pkgconfig
251       pythonPackages.pybind11
252     ];
253     doCheck = false; # Tries to orte_ess_init and call ssh to localhost
254     meta = {
255       description = "Python bindings for the DOLFIN FEM compiler";
256       homepage = "https://fenicsproject.org/";
257       platforms = lib.platforms.all;
258       license = lib.licenses.lgpl3;
259     };
260   };
261 in python-dolfin