Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Experimenting with using f2py to build a direct Python module to the …
Browse files Browse the repository at this point in the history
…driver rather than using subprocess
  • Loading branch information
daminton committed Aug 4, 2023
1 parent 436eeb4 commit 06ad103
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ COPY --from=build_driver /usr/local/lib/libswiftest.a /

# This build target exports the module file to the host
FROM scratch as export_module
COPY --from=build_driver /usr/local/include/swiftest.mod /
COPY --from=build_driver /swiftest/include/ /swiftest/


# This build target creates a container with a conda environment with all dependencies needed to run the Python front end and
Expand All @@ -149,7 +149,7 @@ ENV LD_LIBRARY_PATH="/usr/local/lib"

COPY --from=build_driver /usr/local/bin/swiftest_driver /opt/conda/bin/swiftest_driver
COPY --from=build_driver /usr/local/lib/libswiftest.a /opt/conda/lib/libswiftest.a
COPY --from=build_driver /usr/local/include/swiftest.mod /opt/conda/include/swiftest.mod
COPY --from=build_driver /swiftest/include/ /opt/conda/include/swiftest/
COPY ./python/. /opt/conda/pkgs/
COPY environment.yml .

Expand Down
24 changes: 24 additions & 0 deletions python/swiftest/f2py/pydriver.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
subroutine driver(integrator, param_file_name, display_style)

!! author: David A. Minton
!!
!! Driver program for the Swiftest integrators. Unlike the earlier Swift and Swifter drivers, in Swiftest all integrators
!! are run from this single program.
!!
!! Adapted from Swifter by David E. Kaufmann's Swifter driver programs swifter_[bs,helio,ra15,rmvs,symba,tu4,whm].f90
!! Adapted from Hal Levison and Martin Duncan's Swift driver programs
use swiftest
implicit none

! Arguments
character(len=:), intent(in), allocatable :: integrator !! Symbolic code of the requested integrator
character(len=:), intent(in), allocatable :: param_file_name !! Name of the input parameters file
character(len=:), intent(in), allocatable :: display_style !! Style of the output display {"STANDARD", "COMPACT", "PROGRESS"}). Default is "STANDARD")
!f2py intent(in) integrator
!f2py intent(in) param_file_name
!f2py intent(in) display_style

call swiftest_driver(integrator, param_file_name, display_style)

return
end subroutine driver

0 comments on commit 06ad103

Please sign in to comment.