Skip to content

Commit da57e42

Browse files
author
Fortran
committed
Deploying to gh-pages from @ d90d748 🚀
1 parent 8affd7c commit da57e42

File tree

12 files changed

+37
-39
lines changed

12 files changed

+37
-39
lines changed
-200 Bytes
Binary file not shown.
-4 Bytes
Binary file not shown.
-786 Bytes
Binary file not shown.
-192 Bytes
Binary file not shown.

pr/477/_sources/learn/oop_features_in_fortran/object_based_programming_techniques.md.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ this is that in code like
310310
slq = slp // slq
311311
```
312312

313-
\ -- with the overloaded concatenation operator meaning that the argument
313+
-- with the overloaded concatenation operator meaning that the argument
314314
lists are joined -- multiple deep copies need to be done (the
315315
implementation of the module procedure `join_lists` that supplies the
316316
necessary specific for `//` is not shown here; see the source

pr/477/_sources/learn/oop_features_in_fortran/object_oriented_programming_techniques.md.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ end type
6565
An object of this type
6666

6767
```f90
68-
TYPE(charged_body) :: a_proton
68+
type(charged_body) :: a_proton
6969
```
7070

7171
would then have the following type components:
@@ -344,7 +344,7 @@ end module
344344
extension is used on a larger scale, setting or modifying further
345345
components in the conventional way becomes rather irksome without a
346346
concept like that above, especially if
347-
[type-bound procedures](#sec:tbp)
347+
_type-bound procedures_
348348
with a simple _and_ uniform interface must be implemented;
349349
- The object `a_wtype` remains unchanged in case an unsuitable value is
350350
provided for `a_component`. One could add explicit error handling, but
@@ -385,7 +385,7 @@ call setup_wtype(my_wtype, c_nz)
385385
call setup_wtype(my_wtype, c_w)
386386
```
387387

388-
## Type-bound procedures (TBP) {#sec:tbp}
388+
## Type-bound procedures (TBP)
389389

390390
To resolve the class mismatch issues arising from the use of polymorphic
391391
objects, one needs a language mechanism for making a run-time decision
@@ -546,7 +546,7 @@ call my_polymorphic_body%update(dp)
546546

547547
The `sortable` type used for demonstrating the `sortable_list`
548548
functionality in the
549-
[object-based chapter's](#sec:oop_techniques)
549+
_object-based chapter's_
550550
example was set up as a fixed container-like type. It is desirable to be
551551
able to use the list machinery more flexibly i.e., for any type that
552552
supports the "less-than" comparison. This can be achieved by introducing
@@ -610,9 +610,9 @@ programming technique, which is also known as **dependency inversion**
610610
end type
611611
```
612612

613-
The advantage of this is that no change to the preexisting machinery
614-
will be needed whenever a programmer decides to add an extension type
615-
as outlined in 2. below.
613+
The advantage of this is that no change to the preexisting machinery
614+
will be needed whenever a programmer decides to add an extension type
615+
as outlined in 2. below.
616616

617617
2. For a concrete realization of a `sortable` object, the programmer
618618
needs to create a type extension, for example
@@ -625,10 +625,10 @@ as outlined in 2. below.
625625
end type
626626
```
627627

628-
including an _obligatory_ implementation `less_than_string` of an
629-
overriding TBP for the deferred binding. The constructor function
630-
(promised earlier, but not yet delivered) also needs to be updated to
631-
enable creation of objects of the extended type.
628+
including an _obligatory_ implementation `less_than_string` of an
629+
overriding TBP for the deferred binding. The constructor function
630+
(promised earlier, but not yet delivered) also needs to be updated to
631+
enable creation of objects of the extended type.
632632

633633
## Generic type-bound procedures and operator overloading
634634

@@ -664,7 +664,7 @@ will automatically select the overridden procedure.
664664
Named generic type-bound procedures that do not overload existing
665665
operations can also be defined; an example for this is given in the
666666
section
667-
"[Functions with parameters](#sec:functions_with_parameters)".
667+
_Functions with parameters_.
668668
The rules for generic resolution work similar as for nonpolymorphic
669669
generic procedure interfaces, with the additional restriction that
670670
polymorphic dummy arguments that are related by inheritance cannot be

pr/477/_sources/learn/oop_features_in_fortran/performance_and_ease_of_use.md.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Performance and ease of use
22

3-
## Functions with parameters {#sec:functions_with_parameters}
3+
## Functions with parameters
44

55
### A type definition for invocation of a general function
66

@@ -271,7 +271,7 @@ feature is recommended against.
271271
Returning to our earlier example type body, the next idea would be to
272272
simulate the dynamics of a large ensemble of bodies. A procedure
273273

274-
```f90
274+
```
275275
subroutine propagate(bodies, delta_t, force_field)
276276
type(body), intent(inout) :: bodies(:)
277277
real, intent(in) :: delta_t

pr/477/learn/oop_features_in_fortran/object_based_programming_techniques/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ <h2>Copying objects of container-like type<a class="headerlink" href="#copying-o
970970
<div class="highlight-f90 notranslate"><div class="highlight"><pre><span></span><span class="n">slq</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">slp</span><span class="w"> </span><span class="o">//</span><span class="w"> </span><span class="n">slq</span>
971971
</pre></div>
972972
</div>
973-
<p>\ – with the overloaded concatenation operator meaning that the argument
973+
<p>– with the overloaded concatenation operator meaning that the argument
974974
lists are joined – multiple deep copies need to be done (the
975975
implementation of the module procedure <code class="docutils literal notranslate"><span class="pre">join_lists</span></code> that supplies the
976976
necessary specific for <code class="docutils literal notranslate"><span class="pre">//</span></code> is not shown here; see the source

pr/477/learn/oop_features_in_fortran/object_oriented_programming_techniques/index.html

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ <h2>Extension types<a class="headerlink" href="#extension-types" title="Link to
760760
</pre></div>
761761
</div>
762762
<p>An object of this type</p>
763-
<div class="highlight-f90 notranslate"><div class="highlight"><pre><span></span><span class="k">TYPE</span><span class="p">(</span><span class="n">charged_body</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a_proton</span>
763+
<div class="highlight-f90 notranslate"><div class="highlight"><pre><span></span><span class="k">type</span><span class="p">(</span><span class="n">charged_body</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a_proton</span>
764764
</pre></div>
765765
</div>
766766
<p>would then have the following type components:</p>
@@ -1018,7 +1018,7 @@ <h3>Unlimited polymorphic objects<a class="headerlink" href="#unlimited-polymorp
10181018
extension is used on a larger scale, setting or modifying further
10191019
components in the conventional way becomes rather irksome without a
10201020
concept like that above, especially if
1021-
<a class="reference internal" href="#sec:tbp"><span class="xref myst">type-bound procedures</span></a>
1021+
<em>type-bound procedures</em>
10221022
with a simple <em>and</em> uniform interface must be implemented;</p></li>
10231023
<li><p>The object <code class="docutils literal notranslate"><span class="pre">a_wtype</span></code> remains unchanged in case an unsuitable value is
10241024
provided for <code class="docutils literal notranslate"><span class="pre">a_component</span></code>. One could add explicit error handling, but
@@ -1059,8 +1059,8 @@ <h3>Unlimited polymorphic objects<a class="headerlink" href="#unlimited-polymorp
10591059
</div>
10601060
</section>
10611061
</section>
1062-
<section id="type-bound-procedures-tbp-sec-tbp">
1063-
<h2>Type-bound procedures (TBP) {#sec:tbp}<a class="headerlink" href="#type-bound-procedures-tbp-sec-tbp" title="Link to this heading">#</a></h2>
1062+
<section id="type-bound-procedures-tbp">
1063+
<h2>Type-bound procedures (TBP)<a class="headerlink" href="#type-bound-procedures-tbp" title="Link to this heading">#</a></h2>
10641064
<p>To resolve the class mismatch issues arising from the use of polymorphic
10651065
objects, one needs a language mechanism for making a run-time decision
10661066
on a procedure invocation that depends on the dynamic type of a
@@ -1206,7 +1206,7 @@ <h2>Type-bound procedures (TBP) {#sec:tbp}<a class="headerlink" href="#type-boun
12061206
<h2>Abstract types and interfaces<a class="headerlink" href="#abstract-types-and-interfaces" title="Link to this heading">#</a></h2>
12071207
<p>The <code class="docutils literal notranslate"><span class="pre">sortable</span></code> type used for demonstrating the <code class="docutils literal notranslate"><span class="pre">sortable_list</span></code>
12081208
functionality in the
1209-
<a class="reference internal" href="#sec:oop_techniques"><span class="xref myst">object-based chapter’s</span></a>
1209+
<em>object-based chapter’s</em>
12101210
example was set up as a fixed container-like type. It is desirable to be
12111211
able to use the list machinery more flexibly i.e., for any type that
12121212
supports the “less-than” comparison. This can be achieved by introducing
@@ -1261,12 +1261,10 @@ <h2>Abstract types and interfaces<a class="headerlink" href="#abstract-types-and
12611261
<span class="k">end type</span>
12621262
</pre></div>
12631263
</div>
1264-
</li>
1265-
</ol>
12661264
<p>The advantage of this is that no change to the preexisting machinery
12671265
will be needed whenever a programmer decides to add an extension type
12681266
as outlined in 2. below.</p>
1269-
<ol class="arabic" start="2">
1267+
</li>
12701268
<li><p>For a concrete realization of a <code class="docutils literal notranslate"><span class="pre">sortable</span></code> object, the programmer
12711269
needs to create a type extension, for example</p>
12721270
<div class="highlight-f90 notranslate"><div class="highlight"><pre><span></span><span class="k">type</span><span class="p">,</span><span class="w"> </span><span class="k">public</span><span class="p">,</span><span class="w"> </span><span class="k">extends</span><span class="p">(</span><span class="n">sortable</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">sortable_string</span>
@@ -1276,12 +1274,12 @@ <h2>Abstract types and interfaces<a class="headerlink" href="#abstract-types-and
12761274
<span class="k">end type</span>
12771275
</pre></div>
12781276
</div>
1279-
</li>
1280-
</ol>
12811277
<p>including an <em>obligatory</em> implementation <code class="docutils literal notranslate"><span class="pre">less_than_string</span></code> of an
12821278
overriding TBP for the deferred binding. The constructor function
12831279
(promised earlier, but not yet delivered) also needs to be updated to
12841280
enable creation of objects of the extended type.</p>
1281+
</li>
1282+
</ol>
12851283
</section>
12861284
<section id="generic-type-bound-procedures-and-operator-overloading">
12871285
<h2>Generic type-bound procedures and operator overloading<a class="headerlink" href="#generic-type-bound-procedures-and-operator-overloading" title="Link to this heading">#</a></h2>
@@ -1312,7 +1310,7 @@ <h2>Generic type-bound procedures and operator overloading<a class="headerlink"
13121310
<p>Named generic type-bound procedures that do not overload existing
13131311
operations can also be defined; an example for this is given in the
13141312
section
1315-
<a class="reference internal" href="#sec:functions_with_parameters"><span class="xref myst">Functions with parameters</span></a>.
1313+
<em>Functions with parameters</em>.
13161314
The rules for generic resolution work similar as for nonpolymorphic
13171315
generic procedure interfaces, with the additional restriction that
13181316
polymorphic dummy arguments that are related by inheritance cannot be
@@ -1472,7 +1470,7 @@ <h3>Diagramming the dependencies between program units<a class="headerlink" href
14721470
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#unlimited-polymorphic-objects">Unlimited polymorphic objects</a></li>
14731471
</ul>
14741472
</li>
1475-
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#type-bound-procedures-tbp-sec-tbp">Type-bound procedures (TBP) {#sec:tbp}</a></li>
1473+
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#type-bound-procedures-tbp">Type-bound procedures (TBP)</a></li>
14761474
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#abstract-types-and-interfaces">Abstract types and interfaces</a></li>
14771475
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#generic-type-bound-procedures-and-operator-overloading">Generic type-bound procedures and operator overloading</a></li>
14781476
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#completing-the-dependency-inversion">Completing the dependency inversion</a><ul class="nav section-nav flex-column">

pr/477/learn/oop_features_in_fortran/performance_and_ease_of_use/index.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,8 @@ <h3>
705705
<article class="bd-article">
706706
<section class="tex2jax_ignore mathjax_ignore" id="performance-and-ease-of-use">
707707
<h1>Performance and ease of use<a class="headerlink" href="#performance-and-ease-of-use" title="Link to this heading">#</a></h1>
708-
<section id="functions-with-parameters-sec-functions-with-parameters">
709-
<h2>Functions with parameters {#sec:functions_with_parameters}<a class="headerlink" href="#functions-with-parameters-sec-functions-with-parameters" title="Link to this heading">#</a></h2>
708+
<section id="functions-with-parameters">
709+
<h2>Functions with parameters<a class="headerlink" href="#functions-with-parameters" title="Link to this heading">#</a></h2>
710710
<section id="a-type-definition-for-invocation-of-a-general-function">
711711
<h3>A type definition for invocation of a general function<a class="headerlink" href="#a-type-definition-for-invocation-of-a-general-function" title="Link to this heading">#</a></h3>
712712
<p>In scientific applications, a commonly occurring requirement is the need
@@ -954,12 +954,12 @@ <h3>Using the function type<a class="headerlink" href="#using-the-function-type"
954954
<h2>Arrays of structures versus structures of arrays<a class="headerlink" href="#arrays-of-structures-versus-structures-of-arrays" title="Link to this heading">#</a></h2>
955955
<p>Returning to our earlier example type body, the next idea would be to
956956
simulate the dynamics of a large ensemble of bodies. A procedure</p>
957-
<div class="highlight-f90 notranslate"><div class="highlight"><pre><span></span><span class="k">subroutine </span><span class="n">propagate</span><span class="p">(</span><span class="n">bodies</span><span class="p">,</span><span class="w"> </span><span class="n">delta_t</span><span class="p">,</span><span class="w"> </span><span class="n">force_field</span><span class="p">)</span>
958-
<span class="w"> </span><span class="k">type</span><span class="p">(</span><span class="n">body</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">bodies</span><span class="p">(:)</span>
959-
<span class="w"> </span><span class="kt">real</span><span class="p">,</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">delta_t</span>
960-
<span class="w"> </span><span class="k">type</span><span class="p">(</span><span class="n">field_type</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">force_field</span>
961-
<span class="w"> </span><span class="p">:</span>
962-
<span class="k">end subroutine</span>
957+
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">subroutine</span> <span class="n">propagate</span><span class="p">(</span><span class="n">bodies</span><span class="p">,</span> <span class="n">delta_t</span><span class="p">,</span> <span class="n">force_field</span><span class="p">)</span>
958+
<span class="nb">type</span><span class="p">(</span><span class="n">body</span><span class="p">),</span> <span class="n">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span> <span class="p">::</span> <span class="n">bodies</span><span class="p">(:)</span>
959+
<span class="n">real</span><span class="p">,</span> <span class="n">intent</span><span class="p">(</span><span class="ow">in</span><span class="p">)</span> <span class="p">::</span> <span class="n">delta_t</span>
960+
<span class="nb">type</span><span class="p">(</span><span class="n">field_type</span><span class="p">),</span> <span class="n">intent</span><span class="p">(</span><span class="ow">in</span><span class="p">)</span> <span class="p">::</span> <span class="n">force_field</span>
961+
<span class="p">:</span>
962+
<span class="n">end</span> <span class="n">subroutine</span>
963963
</pre></div>
964964
</div>
965965
<p>might be supplied that modifies the components of all ensemble members,
@@ -1044,7 +1044,7 @@ <h3>Variations on the passed object<a class="headerlink" href="#variations-on-th
10441044
</div>
10451045

10461046
<nav id="bd-toc-nav" class="page-toc"><ul class="nav section-nav flex-column">
1047-
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#functions-with-parameters-sec-functions-with-parameters">Functions with parameters {#sec:functions_with_parameters}</a><ul class="nav section-nav flex-column">
1047+
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#functions-with-parameters">Functions with parameters</a><ul class="nav section-nav flex-column">
10481048
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#a-type-definition-for-invocation-of-a-general-function">A type definition for invocation of a general function</a></li>
10491049
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#performance-issues-arising-from-object-oriented-programming">Performance issues arising from object-oriented programming</a></li>
10501050
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#completing-the-function-type-definition">Completing the function type definition</a></li>

0 commit comments

Comments
 (0)