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.
Created a new bindings module for fortran and python that allows a dr…
…iver program to be run directly from the Python side without using subprocess. Next step will be to fix the Simulation class so that it uses it
- Loading branch information
MintoDA1
authored and
MintoDA1
committed
Aug 7, 2023
1 parent
10b098c
commit 3957b4b
Showing
21 changed files
with
130 additions
and
121 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 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,10 @@ | ||
| FIND_PACKAGE(Python COMPONENTS Interpreter REQUIRED) | ||
| IF(NOT ${PYTHON}) | ||
| find_program(PYTHON "python") | ||
| ENDIF() | ||
|
|
||
| # Communicate version number and other CMake build variables to the source code | ||
| SET(SETUP_PY_IN "${PY}/setup.py.in") | ||
| SET(SETUP_PY_OUT "${PY}/setup.py") | ||
|
|
||
| CONFIGURE_FILE(${SETUP_PY_IN} ${SETUP_PY_OUT}) |
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 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
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.
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,44 @@ | ||
| module bindings_module | ||
| use iso_c_binding, only : c_char, c_null_char, c_int | ||
| use swiftest, only : swiftest_driver, swiftest_io_get_args, STRMAX | ||
| implicit none | ||
| contains | ||
|
|
||
| subroutine bindings_c2f_string(c_string, f_string) | ||
| implicit none | ||
| ! Arguments | ||
| character(len=1,kind=c_char), intent(in) :: c_string(*) | ||
| character(len=:), allocatable, intent(out) :: f_string | ||
| ! Internals | ||
| integer :: i | ||
| character(len=STRMAX) :: tmp_string | ||
|
|
||
| i=1 | ||
| tmp_string = '' | ||
| do while(c_string(i) /= c_null_char .and. i <= STRMAX) | ||
| tmp_string(i:i) = c_string(i) | ||
| i=i+1 | ||
| end do | ||
|
|
||
| if (i > 1) then | ||
| f_string = trim(tmp_string) | ||
| else | ||
| f_string = "" | ||
| end if | ||
|
|
||
| return | ||
| end subroutine bindings_c2f_string | ||
|
|
||
| subroutine bindings_c_driver(c_integrator, c_param_file_name, c_display_style) bind(c) | ||
| implicit none | ||
| character(kind=c_char), dimension(*), intent(in) :: c_integrator, c_param_file_name, c_display_style | ||
| character(len=:), allocatable :: integrator, param_file_name, display_style | ||
|
|
||
| call bindings_c2f_string(c_integrator, integrator) | ||
| call bindings_c2f_string(c_param_file_name, param_file_name) | ||
| call bindings_c2f_string(c_display_style, display_style) | ||
|
|
||
| call swiftest_io_get_args(integrator,param_file_name,display_style,from_cli=.false.) | ||
| call swiftest_driver(integrator,param_file_name,display_style) | ||
| end subroutine bindings_c_driver | ||
| end module bindings_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
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
Oops, something went wrong.