projects/guix·blob mpd-fix-groups · refs

1430 lines · 61.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017, 2018, 2019, 2020, 2021 Paul Garlick <[email protected]>
3;;; Copyright © 2021, 2022 Maxim Cournoyer <[email protected]>
4;;; Copyright © 2022 Eric Bavier <[email protected]>
5;;; Copyright © 2022 Liliana Marie Prikler <[email protected]>
6;;; Copyright © 2023 Reza Housseini <[email protected]>
7;;; Copyright © 2024 Ricardo Wurmus <[email protected]>
8;;; Copyright © 2024 Sharlatan Hellseher <[email protected]>
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages simulation)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages algebra)
28 #:use-module (gnu packages admin)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages bash)
31 #:use-module (gnu packages bison)
32 #:use-module (gnu packages boost)
33 #:use-module (gnu packages check)
34 #:use-module (gnu packages cmake)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages cpp)
37 #:use-module (gnu packages curl)
38 #:use-module (gnu packages engineering)
39 #:use-module (gnu packages flex)
40 #:use-module (gnu packages fontutils)
41 #:use-module (gnu packages gettext)
42 #:use-module (gnu packages gcc)
43 #:use-module (gnu packages geo)
44 #:use-module (gnu packages gl)
45 #:use-module (gnu packages graphics)
46 #:use-module (gnu packages gtk)
47 #:use-module (gnu packages image)
48 #:use-module (gnu packages iso-codes)
49 #:use-module (gnu packages image-processing)
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages m4)
52 #:use-module (gnu packages maths)
53 #:use-module (gnu packages mpi)
54 #:use-module (gnu packages multiprecision)
55 #:use-module (gnu packages ncurses)
56 #:use-module (gnu packages pdf)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages pretty-print)
59 #:use-module (gnu packages protobuf)
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages python-build)
62 #:use-module (gnu packages python-science)
63 #:use-module (gnu packages python-xyz)
64 #:use-module (gnu packages qt)
65 #:use-module (gnu packages readline)
66 #:use-module (gnu packages serialization)
67 #:use-module (gnu packages sqlite)
68 #:use-module (gnu packages ssh)
69 #:use-module (gnu packages textutils)
70 #:use-module (gnu packages tls)
71 #:use-module (gnu packages version-control)
72 #:use-module (gnu packages video)
73 #:use-module (gnu packages xiph)
74 #:use-module (gnu packages xml)
75 #:use-module (gnu packages xorg)
76 #:use-module (guix download)
77 #:use-module (guix gexp)
78 #:use-module (guix git-download)
79 #:use-module (guix svn-download)
80 #:use-module (guix build-system cmake)
81 #:use-module (guix build-system gnu)
82 #:use-module (guix build-system pyproject)
83 #:use-module (guix build-system python)
84 #:use-module ((guix licenses) #:prefix license:)
85 #:use-module (guix packages)
86 #:use-module (guix gexp)
87 #:use-module (guix utils)
88 #:use-module (ice-9 ftw)
89 #:use-module (ice-9 match)
90 #:use-module (ice-9 regex)
91 #:use-module (srfi srfi-1))
92
93(define-public openfoam-org
94 (package
95 (name "openfoam-org")
96 (version "10.20230119")
97 (source (origin
98 (method git-fetch)
99 (uri (git-reference
100 (url (string-append "https://github.com/OpenFOAM/OpenFOAM-"
101 (version-major version)))
102 (commit (second (string-split version #\.)))))
103 (sha256
104 (base32
105 "0icvwg7s6vnkgmdiczivia9pbrgx8nanw9a4j080fzfvdv9vxhzp"))
106 (file-name (git-file-name name version))
107 (modules '((guix build utils)))
108 (snippet `(begin
109 ;; patch shell paths
110 (substitute* (list "wmake/src/Makefile"
111 "wmake/makefiles/general")
112 (("/bin/sh")
113 "sh"))
114 (substitute* "etc/bashrc"
115 ;; only go back one folder level
116 (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
117 "$(dirname ${BASH_SOURCE:-$0})/..")
118 ;; do not use openfoam folder convention
119 (("^export WM_PROJECT_DIR=.*$")
120 (string-append
121 "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR\n"))
122 ;; do not source bash_completion (gives error)
123 (("^.*bash_completion.*$" all)
124 (string-append "#" all))
125 ;; set same version as guix package
126 (("^export WM_PROJECT_VERSION=.*$")
127 (string-append "export WM_PROJECT_VERSION="
128 ,version "\n")))
129 ;; add expand flag to RunFunctions
130 (substitute* "bin/tools/RunFunctions"
131 (("foamDictionary (.*)" all args)
132 (string-append "foamDictionary -expand " args)))
133 ;; disable failing test
134 (substitute* "test/postProcessing/channel/Allrun"
135 (("^.*getApplication.*$" all)
136 (string-append "#" all "\n")))))))
137 (build-system gnu-build-system)
138 (inputs (list boost
139 cgal
140 git
141 gmp
142 libxt
143 metis
144 mpfr
145 ncurses
146 openmpi
147 openssh
148 paraview
149 pt-scotch32
150 readline
151 zlib))
152 (native-inputs (list bison
153 flex
154 ;; paraview plugin dependencies
155 cli11
156 cmake-minimal
157 cgns
158 curl
159 double-conversion
160 eigen
161 expat
162 ffmpeg
163 fmt-11
164 freetype
165 gdal
166 gl2ps
167 gmsh
168 hdf5
169 jsoncpp
170 libjpeg-turbo
171 libogg
172 libpng
173 libharu
174 libtheora
175 libtiff
176 libx11
177 libxml2
178 lz4
179 netcdf
180 nlohmann-json
181 proj
182 protobuf
183 pugixml
184 python
185 python-mpi4py
186 qtbase-5
187 qtsvg-5
188 qttools-5
189 qtwebengine-5
190 qtxmlpatterns-5
191 utfcpp
192 vtk
193 xz))
194 (propagated-inputs (list gnuplot))
195 (outputs '("debug" ;~60MB
196 "out"))
197 (arguments
198 (list
199 ;; Executable files and shared libraries are located in the 'platforms'
200 ;; subdirectory.
201 #:strip-directories
202 #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
203 "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
204
205 #:modules
206 '((ice-9 ftw)
207 (ice-9 regex)
208 (ice-9 string-fun)
209 (srfi srfi-1)
210 (guix build gnu-build-system)
211 (guix build utils))
212
213 #:phases
214 #~(modify-phases %standard-phases
215 (add-before 'build 'patch-HOME-path
216 (lambda _
217 (setenv "HOME" "/tmp")))
218 (add-before 'build 'rename-self
219 (lambda _
220 ;; The script 'bin/foamEtcFile' derives the version name based
221 ;; on the current directory name (!), so make sure to follow the
222 ;; expected naming convention.
223 (let ((here (canonicalize-path "."))
224 (target #$(string-append
225 "OpenFOAM-"
226 (string-map (match-lambda
227 (#\. #\-)
228 (chr chr))
229 (package-version this-package)))))
230 (chdir "..")
231 (format #t "renaming '~a' to '~a'~%"
232 here target)
233 (rename-file here target)
234 (chdir target))))
235 (add-before 'build 'patch-scotch
236 (lambda _
237 (substitute* "etc/config.sh/scotch"
238 (("^export SCOTCH_VERSION=scotch_.*$")
239 (string-append "export SCOTCH_VERSION=scotch_"
240 #$(package-version pt-scotch32) "\n"))
241 (("^export SCOTCH_ARCH_PATH=.*$")
242 (string-append "export SCOTCH_ARCH_PATH="
243 (assoc-ref %build-inputs "pt-scotch32")
244 "\n"))) #t))
245 (add-before 'build 'patch-mpi
246 (lambda _
247 (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
248 (mpi-version #$(package-version openmpi)))
249 ;; specify openmpi type
250 (substitute* "etc/bashrc"
251 (("WM_MPLIB=SYSTEMOPENMPI")
252 "WM_MPLIB=OPENMPI"))
253 (substitute* "etc/config.sh/mpi"
254 (("export FOAM_MPI=openmpi-.*$")
255 (string-append "export FOAM_MPI=openmpi-"
256 mpi-version "\n"))
257 (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
258 (string-append "export MPI_ARCH_PATH=" mpi-path
259 "\n")))) #t))
260 (add-before 'build 'patch-paraview
261 (lambda _
262 (substitute* "etc/config.sh/paraview"
263 (("^export ParaView_VERSION=.*$")
264 (string-append "export ParaView_VERSION="
265 #$(package-version paraview) "\n"))
266 (("^export ParaView_DIR=.*$")
267 (string-append "export ParaView_DIR="
268 (assoc-ref %build-inputs "paraview")
269 "\n"))) #t))
270 (add-before 'build 'add-rpaths
271 (lambda _
272 (letrec* ((libraries '("boost" "cgal"
273 "gmp"
274 "metis"
275 "mpfr"
276 "pt-scotch32"
277 "openmpi"
278 "zlib"
279 "paraview"))
280 (rpaths
281 (fold-right (lambda (library rpaths)
282 (string-append rpaths
283 "-rpath="
284 (assoc-ref
285 %build-inputs library)
286 "/lib,")) "" libraries))
287 (openfoam-lib
288 (string-append #$output
289 "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
290 (ldflags
291 (string-append "-Wl,"
292 rpaths
293 "-rpath="
294 openfoam-lib
295 ","
296 "-rpath="
297 openfoam-lib
298 "/dummy,"
299 "-rpath="
300 openfoam-lib
301 "/paraview-"
302 #$(version-major+minor (package-version
303 paraview)))))
304 (substitute* "wmake/rules/linux64Gcc/c++"
305 (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
306 (string-append all " " ldflags)))) #t))
307 (add-before 'build 'add-vtk-include-path
308 (lambda _
309 (let* ((vtk-version #$(version-major+minor
310 (package-version vtk)))
311 (vtk-root (assoc-ref %build-inputs "vtk"))
312 (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
313 (vtk-inc-flag (string-append "-I" vtk-inc)))
314 (substitute* "wmake/rules/linux64Gcc/c++"
315 (("\\$\\(LIB_HEADER_DIRS\\)" all)
316 (string-append all " " vtk-inc-flag " "))))
317 #t))
318 (delete 'configure) ;no configure phase
319 (replace 'build
320 (lambda _
321 ;; compile OpenFOAM libraries and applications
322 (invoke "bash" "-c"
323 (format #f
324 "source ./etc/bashrc && ./Allwmake -j~a"
325 (parallel-job-count)))))
326 (add-after 'build 'cleanup
327 ;; Avoid unnecessary, voluminous object and dep files.
328 (lambda _
329 (when (file-exists? "platforms/linux64GccDPInt32Opt/src")
330 (delete-file-recursively
331 "platforms/linux64GccDPInt32Opt/src"))
332 (when (file-exists?
333 "platforms/linux64GccDPInt32OptOPENMPI")
334 (delete-file-recursively
335 "platforms/linux64GccDPInt32OptOPENMPI"))
336 (for-each delete-file
337 (find-files "." "\\.o$")) #t))
338 (replace 'check
339 (lambda* (#:key tests? #:allow-other-keys)
340 (when tests?
341 (when (file-exists? "test")
342 (with-directory-excursion "test"
343 (invoke "bash" "-c"
344 (format #f
345 "source ../etc/bashrc && ./Allrun -j~a"
346 (parallel-job-count)))))
347 ;; too many tutorials are failing
348 ;; (with-directory-excursion "tutorials"
349 ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
350 ) #t))
351 (replace 'install
352 (lambda _
353 (let ((install-dir (string-append #$output
354 "/share/OpenFOAM")))
355 (mkdir-p install-dir) ;create install directory
356 ;; move contents of build directory to install directory
357 (copy-recursively "." install-dir))))
358 (add-after 'install 'add-symbolic-link
359 (lambda _
360 (let* ((bin (string-append #$output "/bin"))
361 (lib (string-append #$output "/lib"))
362 (openfoam (string-append #$output
363 "/share/OpenFOAM"))
364 (build-bin (string-append openfoam
365 "/platforms/linux64GccDPInt32Opt/bin"))
366 (build-lib (string-append openfoam
367 "/platforms/linux64GccDPInt32Opt/lib"))
368 (foam-bin (string-append openfoam "/bin")))
369 ;; add symbolic links in standard 'bin' directory
370 (mkdir-p bin)
371 (for-each (lambda (file)
372 (unless (member file
373 '("." ".."))
374 (symlink (string-append build-bin "/"
375 file)
376 (string-append bin "/" file))))
377 (scandir build-bin))
378 (for-each (lambda (file)
379 (unless (member file
380 '("." ".."))
381 (symlink (string-append foam-bin "/"
382 file)
383 (string-append bin "/" file))))
384 (scandir foam-bin))
385 ;; add symbolic link for standard 'lib' directory
386 (symlink build-lib lib)) #t)))))
387 (native-search-paths
388 (list (search-path-specification
389 (variable "WM_PROJECT_DIR")
390 (separator #f)
391 (files '("share/OpenFOAM")))))
392 ;; Note:
393 ;; Tutorial files are installed read-only in /gnu/store.
394 ;; To allow write permissions on files copied from the store a
395 ;; 'chmod' step is needed before running the applications. For
396 ;; example, from a user's login:
397 ;; $ source $(dirname $(which blockMesh))/../../../etc/bashrc
398 ;; $ mkdir -p $FOAM_RUN
399 ;; $ cd $FOAM_RUN
400 ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
401 ;; $ cd pitzDaily
402 ;; $ chmod -R u+w .
403 ;; $ blockMesh
404 (synopsis "Framework for numerical simulation of fluid flow")
405 (description
406 "OpenFOAM provides a set of solvers and methods for tackling
407problems in the field of Computational Fluid Dynamics (CFD). It is written in
408C++. Governing equations such as the Navier-Stokes equations can be solved in
409integral form. Physical processes such as phase change, droplet transport and
410chemical reaction can be modelled. Numerical methods are included to deal with
411sharp gradients, such as those encountered in flows with shock waves and flows
412with gas/liquid interfaces. Large problems may be split into smaller, connected
413problems for efficient solution on parallel systems.")
414 (license license:gpl3+)
415 (home-page "https://openfoam.org")))
416
417(define-public openfoam-com
418 ;; This is a fork of 'openfoam-org', maintained separately.
419 (package
420 (inherit openfoam-org)
421 (name "openfoam-com")
422 (version "2212")
423 (source (origin
424 (method url-fetch)
425 (uri (string-append "https://develop.openfoam.com"
426 "/Development/openfoam/-/archive/OpenFOAM-v"
427 version
428 "/openfoam-OpenFOAM-v"
429 version
430 ".tar.gz"))
431 (sha256
432 (base32
433 "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2"))
434 (modules '((guix build utils)))
435 (snippet `(begin
436 (substitute* "etc/bashrc"
437 ;; set same version as guix package
438 (("^export WM_PROJECT_VERSION=.*$")
439 (string-append "export WM_PROJECT_VERSION="
440 ,version "\n")))
441 ;; patch shell paths
442 (substitute* (list "src/OSspecific/POSIX/POSIX.C"
443 "wmake/src/Makefile"
444 "wmake/makefiles/general"
445 "wmake/makefiles/info")
446 (("/bin/sh")
447 "sh"))))))
448 (synopsis "Framework for numerical simulation of fluid flow (from openfoam.com)")
449 (home-page "https://www.openfoam.com")))
450
451(define-public open-simulation-interface
452 (package
453 (name "open-simulation-interface")
454 (version "3.5.0")
455 (source (origin
456 (method git-fetch)
457 (uri (git-reference
458 (url (string-append "https://github.com/"
459 "OpenSimulationInterface/"
460 "open-simulation-interface"))
461 (commit (string-append "v" version))))
462 (file-name (git-file-name name version))
463 (sha256
464 (base32
465 "09vclrvsawx608kk0vnzywr71xn11qzwxzh2j508zjfn0kvhyx7q"))))
466 (build-system cmake-build-system)
467 (arguments (list #:tests? #f ; tests are for the python package
468 #:phases
469 #~(modify-phases %standard-phases
470 (add-after 'unpack 'fix-cmake
471 (lambda _
472 (substitute* "CMakeLists.txt"
473 (("-targets\\.cmake") "_targets.cmake")))))))
474 (native-inputs (list protobuf))
475 (home-page
476 "https://github.com/OpenSimulationInterface/open-simulation-interface")
477 (synopsis "Generic interface for environmental perception")
478 (description "The Open Simulation Interface is a generic interface based on
479Google's protocol buffers for the environmental perception of automated driving
480functions in virtual scenarios.")
481 (license license:mpl2.0)))
482
483(define-public python-open-simulation-interface
484 (package/inherit open-simulation-interface
485 (name "python-open-simulation-interface")
486 (build-system python-build-system)
487 (arguments '())
488 (propagated-inputs
489 (list python-pyyaml
490 python-protobuf))))
491
492(define-public esmini
493 (package
494 (name "esmini")
495 (version "2.37.11")
496 (source (origin
497 (method git-fetch)
498 (uri (git-reference
499 (url "https://github.com/esmini/esmini")
500 (commit (string-append "v" version))))
501 (file-name (git-file-name name version))
502 (patches (search-patches "esmini-use-pkgconfig.patch"))
503 (modules '((guix build utils) (ice-9 ftw)))
504 (snippet
505 #~(with-directory-excursion "externals"
506 (for-each
507 (lambda (dir) (unless (member dir '("." ".." "expr"))
508 (delete-file-recursively dir)))
509 (scandir "."))))
510 (sha256
511 (base32
512 "07pwa34nf0b4ihb9fn1pvfi0b39hd8r630nfa6v3a17dsy66a730"))))
513 (build-system cmake-build-system)
514 (arguments
515 (list
516 #:configure-flags
517 #~(list "-DDYN_PROTOBUF=TRUE"
518 ;; Missing implot package
519 "-DUSE_IMPLOT=FALSE")
520 #:phases
521 #~(modify-phases %standard-phases
522 (add-after 'unpack 'fix-cmake
523 (lambda* (#:key inputs outputs #:allow-other-keys)
524 (substitute* "support/cmake/common/locations.cmake"
525 (("\\$\\{CMAKE_SOURCE_DIR\\}/bin")
526 (string-append (assoc-ref outputs "out") "/bin")))))
527 (replace 'check
528 (lambda* (#:key tests? #:allow-other-keys)
529 (with-directory-excursion "EnvironmentSimulator/Unittest/"
530 (for-each invoke (find-files "_test$")))))
531 (add-after 'install 'move-libraries
532 (lambda* (#:key outputs #:allow-other-keys)
533 (let ((out (assoc-ref outputs "out")))
534 (mkdir-p (string-append out "/lib"))
535 (with-directory-excursion (string-append out "/bin")
536 (for-each
537 (lambda (f)
538 (rename-file f (string-append out "/lib/"
539 (basename f))))
540 (find-files "." "\\.(a|so)$")))))))))
541 (inputs (list mesa
542 openscenegraph `(,openscenegraph "pluginlib")
543 open-simulation-interface
544 protobuf pugixml sumo))
545 (native-inputs (list googletest pkg-config))
546 (home-page "https://github.com/esmini/esmini")
547 (synopsis "Basic OpenSCENARIO player")
548 (description "@command{esmini} is a tool to play OpenSCENARIO files.
549It is provided as both a standalone application and a shared library and has
550some support for generating and analysing traffic scenarios..")
551 (license license:mpl2.0)))
552
553(define-public python-fenics-dijitso
554 (package
555 (name "python-fenics-dijitso")
556 (version "2019.1.0")
557 (source
558 (origin
559 (method url-fetch)
560 (uri (pypi-uri "fenics-dijitso" version))
561 (sha256
562 (base32 "0lhqsq8ypdak0ahr2jnyvg07yrqp6wicjxi6k56zx24wp3qg60sc"))))
563 (build-system pyproject-build-system)
564 (arguments
565 (list
566 #:phases
567 #~(modify-phases %standard-phases
568 (add-after 'build 'mpi-setup
569 #$%openmpi-setup)
570 (replace 'check
571 (lambda* (#:key tests? #:allow-other-keys)
572 (when tests?
573 (setenv "HOME" "/tmp")
574 (with-directory-excursion "test"
575 ;; Disable parallel tests to avoid race condition. See
576 ;; https://github.com/pytest-dev/pytest-cov/issues/237.
577 (substitute* "runtests.sh"
578 (("for p in 1 4 8 16; do") "for p in 1; do"))
579 (invoke "./runtests.sh"))))))))
580 (native-inputs
581 (list python-pytest
582 python-pytest-cov
583 python-setuptools
584 python-wheel))
585 (inputs
586 (list openmpi python-numpy))
587 (propagated-inputs
588 (list python-mpi4py))
589 (home-page "https://bitbucket.org/fenics-project/dijitso/")
590 (synopsis "Distributed just-in-time building of shared libraries")
591 (description
592 "Dijitso provides a core component of the @code{FEniCS} framework,
593namely the just-in-time compilation of C++ code that is generated from
594Python modules. It is called from within a C++ library, using ctypes
595to import the dynamic shared library directly.
596
597As long as the compiled code can provide a simple factory function to
598a class implementing a predefined C++ interface, there is no limit to
599the complexity of that interface. Parallel support depends on the
600@code{mpi4py} interface.")
601 (license license:lgpl3+)))
602
603(define-public python-fenics-ufl
604 (package
605 (name "python-fenics-ufl")
606 (version "2019.1.0")
607 (source
608 (origin
609 (method url-fetch)
610 (uri (pypi-uri "fenics-ufl" version))
611 (sha256
612 (base32
613 "10dz8x3lm68x2w3kkqcjask38h0zkhhak26jdbkppr8g9y8wny7p"))))
614 (build-system python-build-system)
615 (inputs
616 (list python-numpy))
617 (native-inputs
618 (list python-pytest))
619 (arguments
620 '(#:phases
621 (modify-phases %standard-phases
622 (replace 'check
623 (lambda _
624 (invoke "py.test" "test"))))))
625 (home-page "https://bitbucket.org/fenics-project/ufl/")
626 (synopsis "Unified language for form-compilers")
627 (description "The Unified Form Language (UFL) is a domain specific
628language for declaration of finite element discretizations of
629variational forms. More precisely, it defines a flexible interface
630for choosing finite element spaces and defining expressions for weak
631forms in a notation close to mathematical notation.
632
633UFL is part of the FEniCS Project.")
634 (license license:lgpl3+)))
635
636
637;; XXX: This package is quite dated and upstream no longer maintains it: "This
638;; repository was archived by the owner on Feb 21, 2022. It is now read-only."
639;; <https://bitbucket.org/fenics-project/fiat> ->
640;; <https://github.com/FEniCS/fiat> while providing a new refactored fork
641;; <https://github.com/firedrakeproject/fiat>.
642(define-public python-fenics-fiat
643 (package
644 (name "python-fenics-fiat")
645 (version "2019.1.0")
646 (source
647 (origin
648 (method url-fetch)
649 (uri (pypi-uri "fenics-fiat" version))
650 (sha256
651 (base32 "13sc7lma3d2mh43an7i4kkdbbk4cmvxjk45wi43xnjd7qc38zg4b"))))
652 (build-system pyproject-build-system)
653 (arguments
654 (list
655 #:test-flags
656 #~(list
657 ;; FIXME: three FIAT test modules are known to fail with recent
658 ;; versions of pytest (>= 4). These are skipped for FIAT version
659 ;; 2019.1.0 pending an upstream pull request. For details see request
660 ;; #59 at https://bitbucket.org/fenics-project/fiat/.
661 "--ignore=test/regression/"
662 "--ignore=test/unit/test_quadrature.py"
663 "--ignore=test/unit/test_reference_element.py"
664 "-k" (string-join
665 (list "not test_nodality"
666 "test_basis_values")
667 " and not "))))
668 (native-inputs
669 (list python-pytest
670 python-setuptools
671 python-wheel))
672 (propagated-inputs
673 (list python-numpy
674 python-sympy))
675 (home-page "https://bitbucket.org/fenics-project/fiat/")
676 (synopsis "Tabulation of finite element function spaces")
677 (description
678 "The FInite element Automatic Tabulator (FIAT) supports generation of
679arbitrary order instances of the Lagrange elements on lines, triangles, and
680tetrahedra. It is also capable of generating arbitrary order instances of
681Jacobi-type quadrature rules on the same element shapes. Further, H(div) and
682H(curl) conforming finite element spaces such as the families of
683Raviart-Thomas, Brezzi-Douglas-Marini and Nedelec are supported on triangles
684and tetrahedra. Upcoming versions will also support Hermite and nonconforming
685elements.
686
687FIAT is part of the FEniCS Project.")
688 (license license:lgpl3+)))
689
690(define-public python-fenics-ffc
691 (package
692 (name "python-fenics-ffc")
693 (version "2019.1.0.post0")
694 (source
695 (origin
696 (method url-fetch)
697 (uri (pypi-uri "fenics-ffc" version))
698 (sha256
699 (base32
700 "1f2a44ha65fg3a1prrbrsz4dgvibsv0j5c3pi2m52zi93bhwwgg9"))))
701 (build-system python-build-system)
702 (native-inputs
703 (list python-pytest))
704 (propagated-inputs
705 (list python-fenics-dijitso python-fenics-fiat python-fenics-ufl))
706 (arguments
707 '(#:phases
708 (modify-phases %standard-phases
709 (replace 'check
710 (lambda _
711 (setenv "HOME" (getcwd))
712 (with-directory-excursion "test"
713 ;; FIXME: the tests in subdirectory
714 ;; 'unit/ufc/finite_element' require the ffc_factory
715 ;; extension module. This module, located in the 'libs'
716 ;; subdirectory, needs to be built and made accessible
717 ;; prior to running the tests.
718 (invoke "py.test" "unit/" "--ignore=unit/ufc/")
719 (with-directory-excursion "uflacs"
720 (invoke "py.test" "unit/")))
721 #t)))))
722 (home-page "https://bitbucket.org/fenics-project/ffc/")
723 (synopsis "Compiler for finite element variational forms")
724 (description "The FEniCS Form Compiler (FFC) is a compiler for
725finite element variational forms. From a high-level description of
726the form, it generates efficient low-level C++ code that can be used
727to assemble the corresponding discrete operator (tensor). In
728particular, a bilinear form may be assembled into a matrix and a
729linear form may be assembled into a vector. FFC may be used either
730from the command line (by invoking the @code{ffc} command) or as a
731Python module (@code{import ffc}).
732
733FFC is part of the FEniCS Project.")
734 ;; There are two files released with a public domain licence;
735 ;; ufc.h and ufc_geometry.h, in subdirectory 'ffc/backends/ufc'.
736 (license (list license:public-domain license:lgpl3+))))
737
738(define-public fenics-dolfin
739 (package
740 (name "fenics-dolfin")
741 (version "2019.1.0.post0")
742 (source
743 (origin
744 (method url-fetch)
745 (uri (string-append "https://bitbucket.org/fenics-project/dolfin/get/"
746 version ".tar.gz"))
747 (file-name (string-append name "-" version ".tar.gz"))
748 (sha256
749 (base32 "1m91hwcq5gfj4qqswp8l8kj58nia48f0n4kq13w0xqj4biq7rla0"))
750 (patches (search-patches "fenics-dolfin-algorithm.patch"
751 "fenics-dolfin-demo-init.patch"
752 "fenics-dolfin-boost.patch"
753 "fenics-dolfin-config-slepc.patch"
754 "fenics-dolfin-hdf5-version-check.patch"
755 "fenics-dolfin-integer-types.patch"))
756 (modules '((guix build utils)))
757 (snippet '(begin
758 ;; Make sure we don't use the bundled test framework.
759 (delete-file-recursively "test/unit/cpp/catch")
760 (substitute* "test/unit/cpp/main.cpp"
761 ;; Use standard search paths for 'catch' header file.
762 (("#include.*")
763 "#include <catch.hpp>\n"))
764 (substitute* "test/unit/cpp/CMakeLists.txt"
765 ;; Specify directory to find the header file.
766 (("(^set\\(CATCH_INCLUDE_DIR ).*(/catch\\))" _ front back)
767 (string-append front "$ENV{CATCH_DIR}/include" back "\n")))))))
768 (build-system cmake-build-system)
769 (inputs (list openblas
770 boost
771 eigen
772 hdf5-parallel-openmpi
773 libxml2
774 openmpi
775 python-3
776 pt-scotch32
777 suitesparse
778 zlib))
779 (native-inputs (list catch-framework pkg-config))
780 (propagated-inputs (list python-fenics-ffc petsc-openmpi slepc-openmpi))
781 (arguments
782 (list
783 #:configure-flags
784 #~`("-DDOLFIN_ENABLE_DOCS:BOOL=OFF" "-DDOLFIN_ENABLE_HDF5:BOOL=ON"
785 "-DDOLFIN_ENABLE_MPI:BOOL=ON"
786 "-DDOLFIN_ENABLE_PARMETIS:BOOL=OFF"
787 "-DDOLFIN_ENABLE_SCOTCH:BOOL=ON"
788 "-DDOLFIN_ENABLE_SUNDIALS:BOOL=OFF"
789 "-DDOLFIN_ENABLE_TRILINOS:BOOL=OFF")
790 #:phases
791 #~(modify-phases %standard-phases
792 (add-after 'patch-usr-bin-file 'mpi-setup
793 #$%openmpi-setup)
794 (add-after 'patch-source-shebangs 'set-paths
795 (lambda _
796 ;; Define paths to store locations.
797 (setenv "BLAS_DIR"
798 #$(this-package-input "openblas"))
799 (setenv "CATCH_DIR"
800 #$(this-package-input "catch"))
801 (setenv "LAPACK_DIR"
802 #$(this-package-input "openblas"))
803 (setenv "PETSC_DIR"
804 #$(this-package-input "petsc"))
805 (setenv "SLEPC_DIR"
806 #$(this-package-input "slepc"))
807 (setenv "SCOTCH_DIR"
808 #$(this-package-input "scotch"))
809 (setenv "UMFPACK_DIR"
810 #$(this-package-input "suitesparse"))))
811 (add-before 'check 'pre-check
812 (lambda _
813 ;; The Dolfin repository uses git-lfs, whereby web links are
814 ;; substituted for large files. Only the links are downloaded.
815 ;; The tests that require the absent meshes cannot run and are
816 ;; skipped.
817 ;;
818 ;; One serial test fails and is skipped.
819 ;; i) demo_multimesh-stokes_serial:
820 ;; Warning: Found no facets matching domain for boundary
821 ;; condition.
822 ;;
823 ;; One mpi test fails and is skipped.
824 ;; i) demo_stokes-iterative_mpi:
825 ;; The MPI_Comm_rank() function was called before MPI_INIT was
826 ;; invoked.
827 (call-with-output-file "CTestCustom.cmake"
828 (lambda (port)
829 (display (string-append "set(CTEST_CUSTOM_TESTS_IGNORE "
830 "demo_bcs_serial "
831 "demo_bcs_mpi "
832 "demo_eigenvalue_serial "
833 "demo_eigenvalue_mpi "
834 "demo_navier-stokes_serial "
835 "demo_navier-stokes_mpi "
836 "demo_stokes-taylor-hood_serial "
837 "demo_stokes-taylor-hood_mpi "
838 "demo_subdomains_serial "
839 "demo_advection-diffusion_serial "
840 "demo_advection-diffusion_mpi "
841 "demo_auto-adaptive-navier-stokes_serial "
842 "demo_contact-vi-snes_serial "
843 "demo_contact-vi-snes_mpi "
844 "demo_contact-vi-tao_serial "
845 "demo_contact-vi-tao_mpi "
846 "demo_curl-curl_serial "
847 "demo_curl-curl_mpi "
848 "demo_dg-advection-diffusion_serial "
849 "demo_dg-advection-diffusion_mpi "
850 "demo_elasticity_serial "
851 "demo_elasticity_mpi "
852 "demo_elastodynamics_serial "
853 "demo_elastodynamics_mpi "
854 "demo_lift-drag_serial "
855 "demo_lift-drag_mpi "
856 "demo_mesh-quality_serial "
857 "demo_mesh-quality_mpi "
858 "demo_multimesh-stokes_serial "
859 "demo_stokes-iterative_mpi"
860 ")\n") port)))))
861 (replace 'check
862 (lambda* (#:key tests? #:allow-other-keys)
863 (when tests?
864 (invoke "make" "unittests")
865 (invoke "make" "demos")
866 (invoke "ctest" "-R" "unittests")
867 (invoke "ctest" "-R" "demo" "-R" "serial")
868 (invoke "ctest" "-R" "demo" "-R" "mpi")))))))
869 (home-page "https://bitbucket.org/fenics-project/dolfin/")
870 (synopsis "Problem solving environment for differential equations")
871 (description
872 "DOLFIN is a computational framework for finding numerical
873solutions to problems described by differential equations. Numerical
874models in DOLFIN are constructed using general families of finite
875elements. Data structures are provided for discretizing the governing
876system on a computational mesh. A compact syntax, similar to
877mathematical notation, is made available for defining function spaces
878and expressing variational forms. Interfaces to specialized matrix
879solvers are provided for solving the resultant linear systems.
880
881@code{fenics-dolfin} is part of the FEniCS project. It is the C++
882user interface to the FEniCS core components and external libraries.")
883 ;; The source code for the DOLFIN C++ library is licensed under the
884 ;; GNU Lesser General Public License, version 3 or later, with the
885 ;; following exceptions:
886 ;;
887 ;; public-domain: dolfin/geometry/predicates.cpp
888 ;; dolfin/geometry/predicates.h
889 ;;
890 ;; zlib: dolfin/io/base64.cpp
891 ;; dolfin/io/base64.h
892 ;;
893 ;; expat: dolfin/io/pugiconfig.hpp
894 ;; dolfin/io/pugixml.cpp
895 ;; dolfin/io/pugixml.hpp
896 (license (list license:public-domain license:zlib license:expat
897 license:lgpl3+))))
898
899(define-public fenics
900 (package/inherit fenics-dolfin
901 (name "fenics")
902 (build-system python-build-system)
903 (inputs
904 (modify-inputs (package-inputs fenics-dolfin)
905 (delete "python")
906 (prepend pybind11 python-matplotlib)))
907 (native-inputs
908 (modify-inputs (package-native-inputs fenics-dolfin)
909 (prepend cmake-minimal python-ply python-pytest python-decorator)))
910 (propagated-inputs
911 (list fenics-dolfin
912 python-petsc4py
913 python-slepc4py
914 ;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at runtime.
915 python-pkgconfig))
916 (arguments
917 (list
918 #:phases
919 #~(modify-phases %standard-phases
920 (add-after 'unpack 'relax-requirements
921 (lambda _
922 (substitute* "python/setup.py"
923 (("pybind11==") "pybind11>="))))
924 (add-after 'unpack 'set-dolfin-pc-file-name
925 (lambda* (#:key inputs #:allow-other-keys)
926 ;; Instead of cluttering the user's PKG_CONFIG_PATH environment
927 ;; variable, hard-code the 'dolfin.pc' absolute file name.
928 (let ((pc-file (search-input-file inputs
929 "/lib/pkgconfig/dolfin.pc")))
930 (substitute* "python/dolfin/jit/jit.py"
931 (("pkgconfig\\.parse\\(\"dolfin\"\\)")
932 (string-append "pkgconfig.parse(\"" pc-file "\")"))))))
933 (add-after 'patch-source-shebangs 'set-paths
934 (lambda _
935 ;; Define paths to store locations.
936 (setenv "PYBIND11_DIR" #$(this-package-input "pybind11"))
937 ;; Move to python sub-directory.
938 (chdir "python")))
939 (add-after 'build 'mpi-setup
940 #$%openmpi-setup)
941 (add-before 'check 'pre-check
942 (lambda _
943 ;; Exclude three tests that generate 'NotImplementedError' in
944 ;; matplotlib v3.1.2. See
945 ;; <https://github.com/matplotlib/matplotlib/issues/15382>.
946 ;; Also exclude tests that require meshes supplied by git-lfs.
947 (substitute* "demo/test.py"
948 (("(.*stem !.*)" line)
949 (string-append line
950 "\n"
951 "excludeList = [\n"
952 "'built-in-meshes', \n"
953 "'hyperelasticity', \n"
954 "'elasticity', \n"
955 "'multimesh-quadrature', \n"
956 "'multimesh-marking', \n"
957 "'mixed-poisson-sphere', \n"
958 "'mesh-quality', \n"
959 "'lift-drag', \n"
960 "'elastodynamics', \n"
961 "'dg-advection-diffusion', \n"
962 "'curl-curl', \n"
963 "'contact-vi-tao', \n"
964 "'contact-vi-snes', \n"
965 "'collision-detection', \n"
966 "'buckling-tao', \n"
967 "'auto-adaptive-navier-stokes', \n"
968 "'advection-diffusion', \n"
969 "'subdomains', \n"
970 "'stokes-taylor-hood', \n"
971 "'stokes-mini', \n"
972 "'navier-stokes', \n"
973 "'eigenvalue']\n"
974 "demos = ["
975 "d for d in demos if d[0].stem not "
976 "in excludeList]\n")))
977 ;; Do not test for expired numpy aliases.
978 (substitute* "test/unit/la/test_vector.py"
979 ((" numpy.float\\(42.0\\),") "")
980 (("^.*numpy.int\\(42.0\\).*$") ""))
981 (substitute* "test/unit/la/test_la_basic.py"
982 ((" int,") " ")
983 (("\\[int,") "["))
984 (setenv "HOME" (getcwd))
985 ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP.
986 (setenv "OPENBLAS_NUM_THREADS" "1")))
987 (replace 'check
988 (lambda* (#:key tests? #:allow-other-keys)
989 (when tests?
990 (with-directory-excursion "test"
991 (invoke "pytest"
992 "unit"
993 ;; This test fails and is ignored.
994 "--deselect"
995 "unit/nls/test_PETScSNES_solver.py::test_snes_set_from_options"
996 ;; FIXME: Tests with binary encoded hdf5 files fail with a
997 ;; segfault. See fenics-project DOLFIN commit 6fbc9fb.
998 "--ignore"
999 "unit/io/test_XDMF.py")))))
1000 (add-after 'install 'install-demo-files
1001 (lambda* (#:key outputs #:allow-other-keys)
1002 (let* ((demos (string-append (assoc-ref outputs "out")
1003 "/share/python-dolfin/demo")))
1004 (mkdir-p demos)
1005 (with-directory-excursion "demo"
1006 (for-each (lambda (file)
1007 (let* ((dir (dirname file))
1008 (tgt-dir (string-append demos
1009 "/" dir)))
1010 (unless (equal? "." dir)
1011 (mkdir-p tgt-dir)
1012 (install-file file tgt-dir))))
1013 (find-files "." ".*\\.(py|gz|xdmf)$")))))))))
1014 (home-page "https://fenicsproject.org/")
1015 (synopsis "High-level environment for solving differential equations")
1016 (description
1017 "@code{fenics} is a computing platform for solving general classes of
1018problems that involve differential equations. @code{fenics} facilitates
1019access to efficient methods for dealing with ordinary differential
1020equations (ODEs) and partial differential equations (PDEs). Systems of
1021equations such as these are commonly encountered in areas of engineering,
1022mathematics and the physical sciences. It is particularly well-suited to
1023problems that can be solved using the Finite Element Method (FEM).
1024
1025@code{fenics} is the top level of the set of packages that are developed
1026within the FEniCS project. It provides the python user interface to the
1027FEniCS core components and external libraries.")
1028 (license license:lgpl3+)))
1029
1030(define-public fullswof-2d
1031 (let ((revision 505)
1032 (release "1.09.01"))
1033 (package
1034 (name "fullswof-2d")
1035 (version release)
1036 (source (origin
1037 (method svn-fetch)
1038 (uri (svn-reference
1039 (url (string-append "https://subversion.renater.fr/"
1040 "anonscm/svn/fullswof-2d/tags/"
1041 "release-" version))
1042 (revision revision)))
1043 (file-name (string-append "fullswof-2d-" version "-checkout"))
1044 (sha256
1045 (base32
1046 "16v08dx7h7n4wyddzbwimazwyj74ynis12mpjfkay4243npy44b8"))))
1047 (build-system gnu-build-system)
1048 (native-inputs
1049 (list inetutils)) ; for 'hostname', used in the check phase
1050 (arguments
1051 `(#:phases
1052 (modify-phases %standard-phases
1053 (delete 'configure) ; no configure script
1054 (add-after 'build 'build-tools
1055 (lambda _
1056 (with-directory-excursion "Tools/ConvertFormat"
1057 (invoke "make" "../../bin/asc2xyz")
1058 (invoke "make" "../../bin/xyz2asc"))
1059 (with-directory-excursion "Tools/ExtractWindow"
1060 (invoke "make" "../../bin/cropxyz"))
1061 #t))
1062 (replace 'check ; no check target
1063 (lambda _
1064 (invoke "make" "benchref")))
1065 (replace 'install ; no install target
1066 (lambda* (#:key outputs #:allow-other-keys)
1067 (let* ((out (assoc-ref outputs "out"))
1068 (bin (string-append out "/bin"))
1069 (doc (string-append
1070 out "/share/doc/" ,name "-" ,version))
1071 (examples (string-append doc "/Examples")))
1072 (with-directory-excursion "bin"
1073 (for-each (lambda (binary) (install-file binary bin))
1074 (list "asc2xyz" "xyz2asc" "cropxyz"
1075 "FullSWOF_2D")))
1076 (with-directory-excursion "doc"
1077 (for-each (lambda (pdf) (install-file pdf doc))
1078 (list "Documentation.pdf" "refman.pdf")))
1079 (with-directory-excursion "Tools"
1080 (for-each (lambda (dir)
1081 (copy-file
1082 (string-append dir "/README.txt")
1083 (string-append doc "/README_" dir ".txt")))
1084 (list "ConvertFormat" "ExtractWindow")))
1085 (copy-recursively "Examples" examples)
1086 #t))))))
1087 (home-page "https://www.idpoisson.fr/fullswof/")
1088 (synopsis "Two dimensional flow solver for flood modelling")
1089 (description "@code{FullSWOF_2d} is a numerical tool for solving
1090the shallow water equations on structured grids. The name FullSWOF
1091refers to the Full form of the Shallow Water equations for Overland
1092Flow. The discretized system of equations is solved using the finite
1093volume method. A choice of shock-capturing methods is available to
1094locate the transition boundaries between the wet areas and the dry
1095areas in the model. A semi-implicit method is used to advance the
1096solution in time. The tool is typically applied to the modelling of
1097river flooding.")
1098 (license license:cecill))))
1099
1100(define-public python-meshio
1101 (package
1102 (name "python-meshio")
1103 (version "5.3.4")
1104 (source
1105 (origin
1106 (method url-fetch)
1107 (uri (pypi-uri "meshio" version))
1108 (sha256
1109 (base32
1110 "1w39qcg0rw5kb04j7sa45fnqd6k20fsdgrf62cmw2ygjgwnnjh72"))
1111 (snippet
1112 '(let ((file (open-file "setup.py" "a")))
1113 (display "from setuptools import setup\nsetup()" file)
1114 (close-port file)))))
1115 (build-system python-build-system)
1116 (inputs
1117 (list python-h5py
1118 python-netcdf4))
1119 (native-inputs
1120 (list python-pytest))
1121 (propagated-inputs
1122 (list python-importlib-metadata
1123 python-numpy
1124 python-rich))
1125 (arguments
1126 '(#:phases
1127 (modify-phases %standard-phases
1128 (replace 'check
1129 (lambda* (#:key tests? #:allow-other-keys)
1130 (when tests?
1131 (invoke "python" "-m" "pytest" "-v" "tests")))))))
1132 (home-page "https://github.com/nschloe/meshio")
1133 (synopsis "I/O for mesh files")
1134 (description "There are various file formats available for
1135representing unstructured meshes and mesh data. The @code{meshio}
1136package is able to read and write mesh files in many formats and to
1137convert files from one format to another. Formats such as cgns, h5m,
1138gmsh, xdmf and vtk are supported. The package provides command-line
1139tools and a collection of Python modules for programmatic use.")
1140 (license license:expat)))
1141
1142(define-public python-pygmsh
1143 (package
1144 (name "python-pygmsh")
1145 (version "7.1.17")
1146 (source
1147 (origin
1148 (method git-fetch)
1149 (uri (git-reference
1150 (url "https://github.com/nschloe/pygmsh")
1151 (commit (string-append "v" version))))
1152 (file-name (git-file-name name version))
1153 (sha256
1154 (base32
1155 "11flp2c4ynk1fhanf4mqyzrpd0gjbnv6afrwwc7xi3mb6ms69lr0"))))
1156 (build-system pyproject-build-system)
1157 (arguments
1158 (list
1159 #:phases
1160 #~(modify-phases %standard-phases
1161 (add-after 'unpack 'workaround-gmsh-detection-failure
1162 (lambda _
1163 ;; Due to lack of metadata, the gmsh Python package is not
1164 ;; detected although importable.
1165 (substitute* "pyproject.toml"
1166 (("\"gmsh\",") "")))))))
1167 (native-inputs (list python-flit-core python-pytest))
1168 (propagated-inputs (list gmsh python-meshio python-numpy))
1169 (home-page "https://github.com/nschloe/pygmsh")
1170 (synopsis "Python frontend for Gmsh")
1171 (description "The goal of @code{pygmsh} is to combine the power of
1172Gmsh with the versatility of Python. The package generalises many of
1173the methods and functions that comprise the Gmsh Python API. In this
1174way the meshing of complex geometries using high-level abstractions is
1175made possible. The package provides a Python library together with a
1176command-line utility for mesh optimisation.")
1177 (license license:gpl3+)))
1178
1179(define-public python-dolfin-adjoint
1180 (package
1181 (name "python-dolfin-adjoint")
1182 (version "2019.1.0")
1183 (source
1184 (origin
1185 (method git-fetch)
1186 (uri (git-reference
1187 (url "https://github.com/dolfin-adjoint/pyadjoint")
1188 (commit version)))
1189 (file-name (git-file-name name version))
1190 (sha256
1191 (base32 "0xhy76a5f33hz94wc9g2mc5qmwkxfccbbc6yxl7psm130afp8lhn"))
1192 (modules '((guix build utils)))
1193 (snippet
1194 '(begin
1195 ;; One of the migration tests attempts to call openmpi
1196 ;; recursively and fails. See
1197 ;; https://bitbucket.org/mpi4py/mpi4py/issues/95. Run the
1198 ;; test sequentially instead.
1199 (with-directory-excursion "tests/migration/optimal_control_mms"
1200 (substitute* "test_optimal_control_mms.py"
1201 (("\\\"mpirun\\\", \\\"-n\\\", \\\"2\\\", ") "")))
1202 ;; Result files are regenerated in the check phase.
1203 (delete-file-recursively
1204 "tests/migration/viscoelasticity/test-results")))))
1205 (build-system pyproject-build-system)
1206 (arguments
1207 (list
1208 #:test-flags
1209 #~(list
1210 ;; Ignore tests which require missing packages and/or failed during
1211 ;; tests collection.
1212 "--import-mode=importlib"
1213 "--ignore=tests/firedrake_adjoint"
1214 "--ignore=tests/fenics_adjoint/test_dynamic_meshes.py"
1215 "-k" (string-append "not test_sin_weak_spatial and "
1216 "not test_shape_hessian and "
1217 "not test_read_checkpoint and "
1218 "not test_lu_solver and "
1219 "not test_lu_solver_function_ctrl and "
1220 "not test_dirichletbc_subspace"))
1221 #:phases
1222 #~(modify-phases %standard-phases
1223 (add-after 'build 'mpi-setup #$%openmpi-setup)
1224 (add-before 'check 'set-environment-variables
1225 (lambda _
1226 (setenv "HOME" (getcwd))))
1227 (add-after 'install 'install-doc
1228 (lambda _
1229 (let* ((doc (string-append #$output "/share/doc/" #$name "-" #$version))
1230 (examples (string-append doc "/examples")))
1231 (mkdir-p examples)
1232 (copy-recursively "examples" examples))))
1233 ;; Remove 'sanity-check, because it tries to import
1234 ;; firedrake_adjoint after importing fenics_adjoint.
1235 ;; Both load a module named 'backend' and firedrake_adjoint
1236 ;; fails with an ImportError if it sees that the backend module
1237 ;; has already been loaded.
1238 (delete 'sanity-check))))
1239 (inputs
1240 (list fenics openmpi pybind11))
1241 (native-inputs
1242 (list pkg-config
1243 python-coverage
1244 python-decorator
1245 python-flake8
1246 python-pkgconfig
1247 python-pytest
1248 python-setuptools
1249 python-wheel))
1250 (propagated-inputs
1251 (list python-scipy))
1252 (home-page "https://www.dolfin-adjoint.org")
1253 (synopsis "Automatic differentiation library")
1254 (description
1255 "@code{python-dolfin-adjoint} is a solver of differential equations
1256associated with a governing system and a functional of interest. Working from
1257the forward model the solver automatically derives the discrete adjoint and
1258tangent linear models. These additional models are key ingredients in many
1259algorithms such as data assimilation, optimal control, sensitivity analysis,
1260design optimisation and error estimation. The dolfin-adjoint project provides
1261the necessary tools and data structures for cases where the forward model is
1262implemented in @code{fenics} or
1263@url{https://firedrakeproject.org,firedrake}.")
1264 (license license:lgpl3)))
1265
1266(define %commonroad-dont-install-license-at-root
1267 #~(substitute* "setup.py"
1268 (("data_files=\\[\\('.', \\['LICENSE.txt'\\]\\)\\],")
1269 "")))
1270
1271(define-public python-commonroad-vehicle-models
1272 (package
1273 (name "python-commonroad-vehicle-models")
1274 (version "3.0.2")
1275 (source (origin
1276 (method url-fetch)
1277 (uri (pypi-uri "commonroad-vehicle-models" version))
1278 (sha256
1279 (base32
1280 "13jg0cys7y4n7rg548w6mxk9g10gd5qxmj4ynrlriczpffqy6kc7"))))
1281 (build-system python-build-system)
1282 (arguments
1283 (list #:phases
1284 #~(modify-phases %standard-phases
1285 (add-after 'unpack 'fix-setup.py
1286 (lambda _
1287 #$%commonroad-dont-install-license-at-root)))))
1288 (propagated-inputs (list python-numpy python-omegaconf))
1289 (home-page "https://commonroad.in.tum.de/")
1290 (synopsis "CommonRoad vehicle models")
1291 (description "This package provides vehicle models used in CommonRoad
1292benchmarks. Varying abstraction levels are used ranging from kinematic single
1293track models to multi-body models.")
1294 (license license:bsd-3)))
1295
1296(define-public python-commonroad-io
1297 (package
1298 (name "python-commonroad-io")
1299 (version "2022.3")
1300 (source (origin
1301 (method url-fetch)
1302 (uri (pypi-uri "commonroad-io" version))
1303 (sha256
1304 (base32
1305 "1cj9zj567mca8xb8sx9h3nnl2cccv6vh8h73imgpq61cimk9mvas"))))
1306 (build-system python-build-system)
1307 (arguments
1308 (list #:phases
1309 #~(modify-phases %standard-phases
1310 (add-after 'unpack 'fix-setup.py
1311 (lambda _
1312 (substitute* "setup.py"
1313 (("protobuf==3.20.1") "protobuf >= 3.20.1"))
1314 #$%commonroad-dont-install-license-at-root)))))
1315 (propagated-inputs (list python-commonroad-vehicle-models
1316 python-iso3166
1317 python-lxml
1318 python-matplotlib
1319 python-networkx
1320 python-numpy
1321 python-omegaconf
1322 python-pillow
1323 python-protobuf
1324 python-rtree
1325 python-scipy
1326 python-shapely
1327 python-tqdm))
1328 (native-inputs (list python-lxml python-pytest))
1329 (home-page "https://commonroad.in.tum.de/")
1330 (synopsis "Read, write, and visualize CommonRoad scenarios")
1331 (description "This package provides methods to read, write, and visualize
1332CommonRoad scenarios and planning problems. It can be used as a framework for
1333implementing motion planning algorithms to solve CommonRoad Benchmarks
1334and is the basis for other tools of the CommonRoad Framework.")
1335 (license license:bsd-3)))
1336
1337(define-public python-commonroad-route-planner
1338 (package
1339 (name "python-commonroad-route-planner")
1340 (version "2022.3")
1341 (source (origin
1342 (method git-fetch)
1343 (uri (git-reference
1344 (url "https://gitlab.lrz.de/tum-cps/commonroad-route-planner")
1345 (commit version)))
1346 (file-name (git-file-name name version))
1347 (sha256
1348 (base32
1349 "0xn0l7bzmj56d4mlqacvbl8mdvsffkg2fn2lzfmis5jl4vp99ipf"))))
1350 (arguments
1351 (list #:phases
1352 #~(modify-phases %standard-phases
1353 (add-after 'unpack 'fix-setup.py
1354 (lambda _
1355 #$%commonroad-dont-install-license-at-root)))))
1356 (build-system python-build-system)
1357 (propagated-inputs (list python-commonroad-io
1358 python-matplotlib
1359 python-networkx
1360 python-numpy
1361 python-setuptools
1362 python-shapely))
1363 (home-page "https://gitlab.lrz.de/tum-cps/commonroad-route-planner")
1364 (synopsis "Route planner for CommonRoad scenarios")
1365 (description "This package provides functions for route planning, that is
1366finding sequences that lead from a given start lanelet to some goal
1367lanelet(s).")
1368 (license license:bsd-3)))
1369
1370(define-public sumo
1371 (package
1372 (name "sumo")
1373 (version "1.14.1")
1374 (source (origin
1375 (method git-fetch)
1376 (uri (git-reference
1377 (url "https://github.com/eclipse/sumo")
1378 (commit (string-append "v"
1379 (string-replace-substring version
1380 "." "_")))))
1381 (file-name (git-file-name name version))
1382 (sha256
1383 (base32
1384 "1965vrsff0k14z3y3b1c460zdwp9nx6q6plrdyxn496vg6846k1y"))))
1385 (build-system cmake-build-system)
1386 (arguments
1387 (list
1388 #:phases
1389 #~(modify-phases %standard-phases
1390 (add-after 'unpack 'disable-problematic-tests
1391 (lambda _
1392 (substitute* "CMakeLists.txt"
1393 ;; docs/example appears to be missing
1394 (("add_test\\(exampletest .*") ""))
1395 (substitute* "src/traci_testclient/CMakeLists.txt"
1396 ;; requires network connection (at least to localhost)
1397 (("add_test\\(NAME libtracitest .*") "")))))))
1398 (inputs (list eigen
1399 freetype
1400 fontconfig
1401 ffmpeg
1402 fox
1403 gdal
1404 glu
1405 gperftools ; tcmalloc
1406 libjpeg-turbo
1407 libtiff
1408 libx11
1409 libxcursor
1410 libxft
1411 libxi
1412 libxrandr
1413 libxrender
1414 openscenegraph
1415 proj
1416 python
1417 xerces-c
1418 zlib))
1419 (native-inputs (list googletest python))
1420 (home-page "https://eclipse.org/sumo")
1421 (synopsis "Traffic simulator")
1422 (description "@acronym{SUMO, Simulation of Urban MObility} is a traffic
1423simulation package designed to handle large road networks and different modes
1424of transportation -- including road vehicles, public transport and pedestrians.
1425Included with SUMO is a wealth of supporting tools which automate core tasks
1426for the creation, the execution and evaluation of traffic simulations,
1427such as network import, route calculations, visualization and emission
1428calculation. SUMO can be enhanced with custom models and provides various
1429APIs to remotely control the simulation.")
1430 (license (list license:epl2.0 license:gpl2+))))