@@ -36,23 +36,23 @@ Basic example: Addition module
36
36
Let us build on the example (from the user guide, :ref: `f2py-examples `) of a
37
37
subroutine which takes in two arrays and returns its sum.
38
38
39
- .. literalinclude :: ./code/add.f
39
+ .. literalinclude :: ./../ code/add.f
40
40
:language: fortran
41
41
42
42
43
43
We will recast this into modern fortran:
44
44
45
- .. literalinclude :: ./code/advanced/boilerplating/src/adder_base.f90
45
+ .. literalinclude :: ./../ code/advanced/boilerplating/src/adder_base.f90
46
46
:language: fortran
47
47
48
48
We could go on as in the original example, adding intents by hand among other
49
49
things, however in production often there are other concerns. For one, we can
50
50
template via FYPP the construction of similar functions:
51
51
52
- .. literalinclude :: ./code/advanced/boilerplating/src/gen_adder.f90.fypp
52
+ .. literalinclude :: ./../ code/advanced/boilerplating/src/gen_adder.f90.fypp
53
53
:language: fortran
54
54
55
- This can be pre-processed by a build tool to generate the full fortran code:
55
+ This can be pre-processed to generate the full fortran code:
56
56
57
57
.. code :: sh
58
58
@@ -63,30 +63,30 @@ As to be expected, this can be wrapped by ``f2py`` subsequently.
63
63
Now we will consider maintaining the bindings in a separate file. Note the
64
64
following basic ``.pyf `` which can be generated for a single subroutine via ``f2py -m adder adder_base.f90 -h adder.pyf ``:
65
65
66
- .. literalinclude :: ./code/advanced/boilerplating/src/base_adder.pyf
66
+ .. literalinclude :: ./../ code/advanced/boilerplating/src/base_adder.pyf
67
67
:language: fortran
68
68
69
69
With the docstring:
70
70
71
- .. literalinclude :: ./code/advanced/boilerplating/res/base_docstring.dat
71
+ .. literalinclude :: ./../ code/advanced/boilerplating/res/base_docstring.dat
72
72
:language: python
73
73
74
74
Which is already pretty good. However, ``n `` should never be passed in the first
75
75
place so we will make some minor adjustments.
76
76
77
- .. literalinclude :: ./code/advanced/boilerplating/src/improved_base_adder.pyf
77
+ .. literalinclude :: ./../ code/advanced/boilerplating/src/improved_base_adder.pyf
78
78
:language: fortran
79
79
80
80
Which corresponds to:
81
81
82
- .. literalinclude :: ./code/advanced/boilerplating/res/improved_docstring.dat
82
+ .. literalinclude :: ./../ code/advanced/boilerplating/res/improved_docstring.dat
83
83
:language: python
84
84
85
85
Finally, we can template over this in a similar manner, to attain the original
86
86
goal of having bindings which make use of ``f2py `` directives and have minimal
87
87
spurious repitition.
88
88
89
- .. literalinclude :: ./code/advanced/boilerplating/src/adder.pyf.fypp
89
+ .. literalinclude :: ./../ code/advanced/boilerplating/src/adder.pyf.fypp
90
90
:language: fortran
91
91
92
92
Usage boils down to:
0 commit comments