-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #218 from inoelloc/fix-long-subroutine-name
FIX: Long subroutine name
- Loading branch information
Showing
7 changed files
with
108 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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 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,38 @@ | ||
#======================================================================= | ||
# define the compiler names | ||
#======================================================================= | ||
|
||
CC = gcc | ||
F90 = gfortran | ||
PYTHON = python | ||
CFLAGS = -fPIC | ||
F90FLAGS = -fPIC | ||
PY_MOD = pywrapper | ||
F90_SRC = main.f90 | ||
OBJ = $(F90_SRC:.f90=.o) | ||
F90WRAP_SRC = $(addprefix f90wrap_,${F90_SRC}) | ||
WRAPFLAGS = -v --type-check | ||
F2PYFLAGS = --build-dir build | ||
F90WRAP = f90wrap | ||
F2PY = f2py-f90wrap | ||
.PHONY: all clean | ||
|
||
all: test | ||
|
||
clean: | ||
rm -rf *.mod *.smod *.o f90wrap*.f90 ${PY_MOD}.py _${PY_MOD}*.so __pycache__/ .f2py_f2cmap build ${PY_MOD}/ | ||
|
||
main.o: ${F90_SRC} | ||
${F90} ${F90FLAGS} -c $< -o $@ | ||
|
||
%.o: %.f90 | ||
${F90} ${F90FLAGS} -c $< -o $@ | ||
|
||
${F90WRAP_SRC}: ${OBJ} | ||
${F90WRAP} -m ${PY_MOD} ${WRAPFLAGS} ${F90_SRC} | ||
|
||
f2py: ${F90WRAP_SRC} | ||
CFLAGS="${CFLAGS}" ${F2PY} -c -m _${PY_MOD} ${F2PYFLAGS} f90wrap_*.f90 *.o | ||
|
||
test: f2py | ||
${PYTHON} test.py |
This file contains 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,6 @@ | ||
include ../make.meson.inc | ||
|
||
NAME := pywrapper | ||
|
||
test: build | ||
$(PYTHON) test.py |
This file contains 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,25 @@ | ||
module m_long_subroutine_name | ||
|
||
implicit none | ||
|
||
integer :: m_long_subroutine_name_integer | ||
|
||
type m_long_subroutine_name_type | ||
|
||
integer :: m_long_subroutine_name_type_integer | ||
integer, dimension(10) :: m_long_subroutine_name_type_integer_array | ||
|
||
end type m_long_subroutine_name_type | ||
|
||
type m_long_subroutine_name_type_2 | ||
|
||
type(m_long_subroutine_name_type), dimension(10) :: m_long_subroutine_name_type_2_type_array | ||
|
||
end type m_long_subroutine_name_type_2 | ||
|
||
contains | ||
|
||
subroutine m_long_subroutine_name_subroutine() | ||
end subroutine m_long_subroutine_name_subroutine | ||
|
||
end module m_long_subroutine_name |
This file contains 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,23 @@ | ||
import unittest | ||
|
||
from pywrapper import m_long_subroutine_name | ||
|
||
class TestLongSubroutineName(unittest.TestCase): | ||
|
||
def test_long_subroutine_name(self): | ||
|
||
m_long_subroutine_name.m_long_subroutine_name_integer = 42 | ||
|
||
typ = m_long_subroutine_name.m_long_subroutine_name_type() | ||
typ.m_long_subroutine_name_type_name_integer = 42 | ||
typ.m_long_subroutine_name_type_name_integer_array = 42 | ||
|
||
typ2 = m_long_subroutine_name.m_long_subroutine_name_type_2() | ||
typ2.m_long_subroutine_name_type_2_type_array[0].m_long_subroutine_name_type_integer = 42 | ||
typ2.m_long_subroutine_name_type_2_type_array[0].m_long_subroutine_name_type_integer_array = 42 | ||
|
||
m_long_subroutine_name.m_long_subroutine_name_subroutine() | ||
|
||
if __name__ == '__main__': | ||
|
||
unittest.main() |
This file contains 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 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