diff options
| author | Namami Shanker <namami2011@gmail.com> | 2022-06-23 21:24:38 +0530 |
|---|---|---|
| committer | Namami Shanker <namami2011@gmail.com> | 2022-06-23 21:24:38 +0530 |
| commit | 79a1074b36dde92cce90bc5f894e72753f36c136 (patch) | |
| tree | 26d33e5dfebcfa51de9801c6ac8c45ee4bdbddfd /doc/source/f2py | |
| parent | ed7791f0fabf5ee62917e0d58b738b583a361b68 (diff) | |
| download | numpy-79a1074b36dde92cce90bc5f894e72753f36c136.tar.gz | |
DOC: Move f2cmap example documentation
Diffstat (limited to 'doc/source/f2py')
| -rw-r--r-- | doc/source/f2py/advanced.rst | 26 | ||||
| -rw-r--r-- | doc/source/f2py/usage.rst | 18 |
2 files changed, 26 insertions, 18 deletions
diff --git a/doc/source/f2py/advanced.rst b/doc/source/f2py/advanced.rst index 3ba913c83..314bb98ae 100644 --- a/doc/source/f2py/advanced.rst +++ b/doc/source/f2py/advanced.rst @@ -96,6 +96,32 @@ and the corresponding <C type>. The <C type> can be one of the following:: complex_long_double string +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 create your module as usual. F2PY check if a ``.f2py_f2cmap`` file is present +in the current directory and use it to map KIND specifiers to C data types. + +.. code-block:: sh + + f2py -c func1.f -m func1 + +Alternatively, you can save the mapping file with any other name, for example +``mapfile.txt``, and use the ``--f2cmap`` option to pass the file to F2PY. + +.. code-block:: sh + + f2py -c func1.f -m func1 --f2cmap mapfile.txt + For more information, see F2Py source code ``numpy/f2py/capi_maps.py``. .. _Character strings: diff --git a/doc/source/f2py/usage.rst b/doc/source/f2py/usage.rst index 47150c39b..bb7565e2a 100644 --- a/doc/source/f2py/usage.rst +++ b/doc/source/f2py/usage.rst @@ -222,24 +222,6 @@ Other options ``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`` |
