This repository was archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructured Python and created pydriver extension module
The pydriver extension module will (eventually) allow us to run the swiftest fortran driver from a module instead of via a subprocess call to the CLI program.
- Loading branch information
Showing
17 changed files
with
104 additions
and
68 deletions.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| module pydriver_module | ||
| use swiftest, only : swiftest_driver | ||
| implicit none | ||
|
|
||
| contains | ||
| 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 | ||
| 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") | ||
|
|
||
| call swiftest_driver(integrator, param_file_name, display_style) | ||
|
|
||
| return | ||
| end subroutine driver | ||
| end module pydriver_module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| module pydriver_interface | ||
| use iso_c_binding, only : c_char | ||
| use pydriver_module, only : driver | ||
| implicit none | ||
| contains | ||
| subroutine c_driver(integrator, param_file_name, display_style) bind(c) | ||
| character(kind=c_char) :: integrator(:), param_file_name(:), display_style(:) | ||
| end subroutine c_driver | ||
| end module pydriver_interface |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| """ | ||
| Copyright 2022 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh | ||
| This file is part of Swiftest. | ||
| Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License | ||
| as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
| Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY | ||
| without even the implied warranty | ||
| of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
| You should have received a copy of the GNU General Public License along with Swiftest. | ||
| If not, see: https://www.gnu.org/licenses. | ||
| """ | ||
|
|
||
| from setuptools import setup, find_packages, Extension | ||
| from Cython.Build import cythonize | ||
| import os | ||
|
|
||
| # Build the pydriver extension that allows us to run the Fortran driver as a Python module. | ||
| root_dir = 'pydriver' | ||
| include_dir = os.path.join(root_dir,'include') | ||
| lib_dir = os.path.join(root_dir,'lib') | ||
| pydriver_extension = [Extension('swiftest.pydriver', | ||
| [os.path.join(root_dir,'pydriver.pyx')], | ||
| extra_compile_args=['-fPIC', '-O3'], | ||
| library_dirs=[lib_dir], | ||
| libraries=['swiftest','netcdff','netcdf','hdf5_hl','hdf5','m','z'], | ||
| include_dirs=[include_dir], | ||
| )] | ||
|
|
||
| setup(name='swiftest', | ||
| version='2023.08.00', | ||
| author='David A. Minton', | ||
| author_email='daminton@purdue.edu', | ||
| url='https://github.itap.purdue.edu/MintonGroup/swiftest', | ||
| ext_modules = cythonize(pydriver_extension), | ||
| packages=find_packages()) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.