diff options
author | Namami Shanker <namami2011@gmail.com> | 2022-06-21 14:13:29 +0530 |
---|---|---|
committer | Namami Shanker <namami2011@gmail.com> | 2022-06-23 18:47:56 +0530 |
commit | 6d8281ca6ab73c822489a1e0c4cdc20cfb3a1061 (patch) | |
tree | d3a314e9b562a15840bea3a23c9a0111d82c105f | |
parent | df7ccc4034e04fd3fadaa33710c727589dc0d938 (diff) | |
download | numpy-6d8281ca6ab73c822489a1e0c4cdc20cfb3a1061.tar.gz |
DOC: Add f2cmap flag doc
-rw-r--r-- | doc/source/f2py/code/f2cmap_demo.f | 9 | ||||
-rw-r--r-- | doc/source/f2py/usage.rst | 20 |
2 files changed, 29 insertions, 0 deletions
diff --git a/doc/source/f2py/code/f2cmap_demo.f b/doc/source/f2py/code/f2cmap_demo.f new file mode 100644 index 000000000..3f0e12c76 --- /dev/null +++ b/doc/source/f2py/code/f2cmap_demo.f @@ -0,0 +1,9 @@ + subroutine func1(n, x, res) + use, intrinsic :: iso_fortran_env, only: int64, real64 + implicit none + integer(int64), intent(in) :: n + real(real64), intent(in) :: x(n) + real(real64), intent(out) :: res +Cf2py intent(hide) :: n + res = sum(x) + end diff --git a/doc/source/f2py/usage.rst b/doc/source/f2py/usage.rst index 3fae093f8..47150c39b 100644 --- a/doc/source/f2py/usage.rst +++ b/doc/source/f2py/usage.rst @@ -220,6 +220,26 @@ Other options ``--build-dir <dirname>`` All F2PY generated files are created in ``<dirname>``. Default is ``tempfile.mkdtemp()``. + ``--f2cmap <filename>`` + Load Fortran-to-Python KIND specification from the given file. + For example, if you have a fortran file ``func1.f`` with the following: + + .. literalinclude:: ./code/f2cmap_demo.f + :language: fortran + + In order to convert ``int64`` and ``real64`` to vaild C data types, + you can create a ``.f2py_f2cmap`` file in the current directory: + + .. code-block:: text + + dict(real=dict(real32='float', real64='double'), integer=dict(int64='long long')) + + and pass it to ``f2py`` using ``--f2cmap`` flag. + + .. code-block:: sh + + f2py -c func1.f -m func1 --f2cmap .f2py_f2cmap + ``--quiet`` Run quietly. ``--verbose`` |