diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..c08f9add7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +_site \ No newline at end of file diff --git a/_data/learning.yml b/_data/learning.yml index 43c2a2f50..b9e5dc064 100644 --- a/_data/learning.yml +++ b/_data/learning.yml @@ -26,6 +26,7 @@ books: - link: /learn/quickstart/arrays_strings - link: /learn/quickstart/operators_control_flow - link: /learn/quickstart/organising_code + - link: /learn/quickstart/derived_types diff --git a/_site/news.xml b/_site/news.xml new file mode 100644 index 000000000..a29a6b081 --- /dev/null +++ b/_site/news.xml @@ -0,0 +1,465 @@ + + + + Fortran Newsletter + + + 2020-06-05T19:43:29+03:00 + /news + + + + + + + Fortran newsletter: June 2020 + + 2020-06-01T00:00:00+03:00 + /news/newsletter/2020/06/01/Fortran-Newsletter-June-2020 + <p>Welcome to the June 2020 edition of the monthly Fortran newsletter. +The newsletter comes out on the first calendar day of every month +and details Fortran news from the previous month.</p> + +<ul> + <li><a href="#fortran-lang.org">fortran-lang.org</a></li> + <li><a href="#fortran-discourse">Fortran Discourse</a></li> + <li><a href="#fortran-standard-library">Standard Library</a></li> + <li><a href="#package-manager">Package Manager</a></li> + <li><a href="#events">Events</a></li> + <li><a href="#contributors">Contributors</a></li> +</ul> + +<h2 id="fortran-langorg">fortran-lang.org</h2> + +<p>The Fortran website has been up since mid-April, and we’ve already got great +feedback from the community. +In the past month we’ve updated the <a href="/compilers">Compilers</a> page which is now +comprehensive and includes all major open source and commercial compilers. +The <a href="/learn">Learn</a> page has also seen significant updates—it’s been +reorganized for easier navigation and currently features a quickstart tutorial, +Fortran books, and other online resources.</p> + +<p>If you haven’t yet, please explore the website and <a href="https://github.com/fortran-lang/fortran-lang.org/issues">let us know</a> +if you have any suggestions for improvement. +Specifically, we’ll be focusing on the <a href="/learn">Learn</a> page and its mini-books +in the coming months. +Please help us make them better!</p> + +<p>Here are some specific items that we worked on:</p> + +<ul> + <li><a href="https://github.com/fortran-lang/fortran-lang.org/pull/90">#90</a> +WIP: Mini-book on building programs</li> + <li><a href="https://github.com/fortran-lang/fortran-lang.org/pull/83">#83</a> +Improving the structure and navigation of the <a href="/learn">Learn</a> pages</li> + <li><a href="https://github.com/fortran-lang/fortran-lang.org/pull/46">#46</a> +Build website previews from pull requests</li> +</ul> + +<h2 id="fortran-discourse">Fortran Discourse</h2> + +<p>On May 4 we launched the <a href="https://fortran-lang.discourse.group">Fortran Discourse</a>, an online discussion board +for anything and everything Fortran related. +You can use it discuss the Fortran language, ask for help, announce events and/or personal projects, or just lurk +around. +There are already quite a few interesting discussions going on. +Join us!</p> + +<h2 id="fortran-standard-library">Fortran Standard Library</h2> + +<p>Recently we launched a <a href="https://stdlib.fortran-lang.org">website</a> for the API documentation of the Fortran Standard Library. +The <a href="https://stdlib.fortran-lang.org">website</a> is automaticaly generated by <a href="https://github.com/Fortran-FOSS-Programmers/ford#readme">FORD</a>. +<a href="https://stdlib.fortran-lang.org/page/contributing/CodeOfConduct.html">Code of Conduct</a>, <a href="https://stdlib.fortran-lang.org/page/License.html">licence</a>, and <a href="https://stdlib.fortran-lang.org/page/contributing/Workflow.html">workflow</a> for contributing to the Fortran Standard Library can also be found on the <a href="https://stdlib.fortran-lang.org/">website</a>.</p> + +<p>Here’s what’s new in the Fortran Standard Library:</p> + +<ul> + <li><a href="https://github.com/fortran-lang/stdlib/pull/191">#191</a> +WIP: Function for computing Pearson correlations among elements of +an array in the <code class="highlighter-rouge">stdlib_experimental_stats</code> module</li> + <li><a href="https://github.com/fortran-lang/stdlib/pull/189">#189</a> +WIP: Procedures for sparse matrices operations. Ongoing discussion on the API can be found +<a href="https://github.com/fortran-lang/stdlib/wiki/Stdlib-Sparse-matrix-API">here</a>.</li> + <li><a href="https://github.com/fortran-lang/stdlib/pull/183">#183</a> +Automatic API-doc generation and deployment of this <a href="https://stdlib.fortran-lang.org">stdlib website</a></li> + <li><a href="https://github.com/fortran-lang/stdlib/pull/170">#170</a> +Addition of the new functions <code class="highlighter-rouge">diag</code>, <code class="highlighter-rouge">eye</code>, and <code class="highlighter-rouge">trace</code> functions to make working with +matrices easier. +Read the full specifications <a href="https://stdlib.fortran-lang.org/page/specs/stdlib_experimental_linalg.html">here</a>.</li> +</ul> + +<h2 id="package-manager">Package Manager</h2> + +<p>In this past month support for dependencies between packages has been added +to the <a href="https://github.com/fortran-lang/fpm">Fortran Package Manager (fpm)</a>. +You can specify either a path to another folder on your machine with an fpm package, +or a git repository (and optionally a specific branch, tag or commit) that +contains the package. fpm will then take care of fetching the dependency for you +(if necessary) and any packages it depends on, and compiling and linking it into +your project. Check out an example <a href="https://gitlab.com/everythingfunctional/hello_fpm">hello world package</a> +that uses this functionality.</p> + +<p>fpm is still in very early development, and we need as much help as we can get. +Here’s how you can help today:</p> + +<ul> + <li>Try to use it. Does it work? No? Let us know! Read the <a href="https://github.com/fortran-lang/fpm/blob/master/PACKAGING.md">fpm packaging guide</a> to learn how to build your package with fpm.</li> + <li>Browse the <a href="https://github.com/fortran-lang/fpm/issues">open issues</a> and see if you can help implement any fixes or features.</li> + <li>Adapt your Fortran package for fpm.</li> + <li>Improve the documentation.</li> +</ul> + +<p>The short term goal of fpm is to make development and installation of Fortran packages with dependencies easier. +Its long term goal is to build a rich and decentralized ecosystem of Fortran packages and create a healthy +environment in which new open source Fortran projects are created and published with ease.</p> + +<p>Specific items that are new this month:</p> + +<ul> + <li><a href="https://github.com/fortran-lang/fpm/pull/82">#82</a> +You can now add remote git repositories as Fortran dependencies to your project.</li> + <li><a href="https://github.com/fortran-lang/fpm/pull/73">#73</a> +Improved output messages for the user</li> +</ul> + +<h2 id="events">Events</h2> + +<ul> + <li>We hosted the very first Fortran Monthly call on May 14. +The turnout was astonishing–over 23 people joined. +You can read the notes from the call <a href="https://fortran-lang.discourse.group/t/fortran-monthly-call-may-2020">here</a>. +We’ll have another one this month. +Subscribe to the <a href="https://groups.io/g/fortran-lang">mailing list</a> and/or +join the <a href="https://fortran-lang.discourse.group">Discourse</a> to stay tuned.</li> + <li><a href="https://tcevents.chem.uzh.ch/event/12">FortranCon 2020</a> will take place on July 2-4 in Zurich, Switzerland. +Virtual participation is enabled for both attendees and speakers. +Registration is free and due by June 1, 2020. +There are quite a few submissions from the fortran-lang community: +A talk on <a href="https://github.com/fortran-lang/talks/tree/master/FortranCon2020-stdlib">stdlib</a> by Jeremie Vandenplas, +one about the <a href="https://github.com/fortran-lang/talks/tree/master/FortranCon2020-fpm">Fortran Package Manager (fpm)</a> by Brad Richardson, +a talk on <a href="https://gitlab.com/lfortran/talks/fortrancon-2020-talk">LFortran compiler</a> by Ondřej Čertík, +as well as one about <a href="https://github.com/fortran-lang/talks/tree/master/FortranCon2020-community">building the Fortran community</a> +by Milan Curcic.</li> + <li>J3/WG5 joint meeting, originally slated for October 12-16 in Las Vegas, Nevada, has been <a href="https://mailman.j3-fortran.org/pipermail/j3/2020-May/012034.html">cancelled</a>. +However, the work on proposals for the Fortran Standard doesn’t stop. +You can submit a proposal for the Standards committee <a href="https://github.com/j3-fortran/fortran_proposals">here</a>. +For reference, you can read the <a href="/newsletter/2020/02/28/J3-february-meeting">notes from the February meeting</a>.</li> +</ul> + +<h2 id="contributors">Contributors</h2> + +<p>We thank everybody who contributed to fortran-lang in the past month by +commenting in any of the four repositories +<a href="https://github.com/fortran-lang/stdlib">fortran-lang/stdlib</a>, +<a href="https://github.com/fortran-lang/fpm">fortran-lang/fpm</a>, +<a href="https://github.com/fortran-lang/fortran-lang.org">fortran-lang/fortran-lang.org</a>, +<a href="https://github.com/j3-fortran/fortran_proposals">j3-fortran/fortran_proposals</a>:</p> + +<p>Ondřej Čertík (<a href="https://github.com/certik">@certik</a>), Milan Curcic (<a href="https://github.com/milancurcic">@milancurcic</a>), Laurence Kedward (<a href="https://github.com/LKedward">@LKedward</a>), Jeremie Vandenplas (<a href="https://github.com/jvdp1">@jvdp1</a>), Brad Richardson (<a href="https://github.com/everythingfunctional">@everythingfunctional</a>), Izaak “Zaak” Beekman (<a href="https://github.com/zbeekman">@zbeekman</a>), Martin Diehl (<a href="https://github.com/MarDiehl">@MarDiehl</a>), <a href="https://github.com/arjenmarkus">@arjenmarkus</a>, Van Snyder (<a href="https://github.com/vansnyder">@vansnyder</a>), <a href="https://github.com/FortranFan">@FortranFan</a>, <a href="https://github.com/epagone">@epagone</a>, Ivan (<a href="https://github.com/ivan-pi">@ivan-pi</a>), Neil Carlson (<a href="https://github.com/nncarlson">@nncarlson</a>), Ashwin Vishnu (<a href="https://github.com/ashwinvis">@ashwinvis</a>), Williams A. Lima (<a href="https://github.com/ghwilliams">@ghwilliams</a>), Peter Klausler (<a href="https://github.com/klausler">@klausler</a>), Chris MacMackin (<a href="https://github.com/cmacmackin">@cmacmackin</a>), Pedro Costa (<a href="https://github.com/p-costa">@p-costa</a>), <a href="https://github.com/mobius-eng">@mobius-eng</a>, Salvatore Filippone (<a href="https://github.com/sfilippone">@sfilippone</a>), <a href="https://github.com/ShamanTcler">@ShamanTcler</a>, Amit Kumar (<a href="https://github.com/aktech">@aktech</a>), Bálint Aradi (<a href="https://github.com/aradi">@aradi</a>), Melissa Weber Mendonça (<a href="https://github.com/melissawm">@melissawm</a>), Jacob Williams (<a href="https://github.com/jacobwilliams">@jacobwilliams</a>), Rohit Goswami (<a href="https://github.com/HaoZeke">@HaoZeke</a>), Amir Shahmoradi (<a href="https://github.com/shahmoradi">@shahmoradi</a>), Bill Long (<a href="https://github.com/longb">@longb</a>).</p> + + + + + Fortran newsletter: May 2020 + + 2020-05-01T00:00:00+03:00 + /news/newsletter/2020/05/01/Fortran-Newsletter-May-2020 + <div class="language-fortran highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">print</span><span class="w"> </span><span class="o">*</span><span class="p">,</span><span class="w"> </span><span class="s1">'Hello, World!'</span><span class="w"> +</span></code></pre></div></div> + +<p>Welcome to the first monthly Fortran newsletter. +It will come out on the first calendar day of every month, +detailing Fortran news from the previous month.</p> + +<ul> + <li><a href="#this-website">This website</a></li> + <li><a href="#standard-library">Standard Library</a></li> + <li><a href="#package-manager">Package Manager</a></li> + <li><a href="#wg5-convenor-candidates">WG5 Convenor candidates</a></li> + <li><a href="#events">Events</a></li> + <li><a href="#whos-hiring">Who’s hiring?</a></li> +</ul> + +<h2 id="this-website">This website</h2> + +<p>If you came to this newsletter from elsewhere, welcome to the new Fortran website. +We built this site mid-April and hope for it to be <em>the</em> home of Fortran on the internet, +which traditionally there hasn’t been any to date. +Look around and <a href="https://github.com/fortran-lang/fortran-lang.github.io/issues">let us know</a> +if you have any suggestions for improvement. +Specifically, <a href="/learn">Learn</a> and <a href="/packages">Packages</a> are the pages that +we’ll be focusing on in the coming months. +Please help us make them better!</p> + +<h2 id="standard-library">Standard Library</h2> + +<p>Here’s what’s new in Fortran Standard Library:</p> + +<ul> + <li> + <p><a href="https://github.com/fortran-lang/stdlib/pull/172">#172</a> +New function <code class="highlighter-rouge">cov</code> in the <code class="highlighter-rouge">stdlib_experimental_stats</code> module to compute covariance of array elements. +Read the full specification <a href="https://github.com/fortran-lang/stdlib/blob/master/src/stdlib_experimental_stats.md#cov---covariance-of-array-elements">here</a>.</p> + </li> + <li> + <p><a href="https://github.com/fortran-lang/stdlib/pull/168">#168</a> +Specify recommended order of attributes for dummy arguments in the +<a href="https://github.com/fortran-lang/stdlib/blob/master/STYLE_GUIDE.md">Stdlib style guide</a>.</p> + </li> + <li> + <p><a href="https://github.com/fortran-lang/stdlib/pull/173">#173</a> +Minor bug fix.</p> + </li> + <li> + <p><a href="https://github.com/fortran-lang/stdlib/pull/170">#170</a> +WIP: Addition of <code class="highlighter-rouge">diag</code>, <code class="highlighter-rouge">eye</code>, and <code class="highlighter-rouge">trace</code> functions to make working with +matrices easier.</p> + </li> +</ul> + +<h2 id="package-manager">Package Manager</h2> + +<p>In the past month we’ve seen the first working implementation of the <a href="https://github.com/fortran-lang/fpm">Fortran Package Manager (FPM)</a>. +Specifically:</p> + +<ul> + <li>FPM supports three commands: + <ul> + <li><code class="highlighter-rouge">fpm build</code>–compiles and links your application and/or library.</li> + <li><code class="highlighter-rouge">fpm test</code>–runs tests if your package has any test programs.</li> + <li><code class="highlighter-rouge">fpm run</code>–runs the application if your package has an executable program.</li> + </ul> + </li> + <li>FPM can build an executable program, a library, or a combination of both.</li> + <li>Currently only gfortran is supported as the compiler backend. FPM will suport other compilers soon.</li> +</ul> + +<p>Read the <a href="https://github.com/fortran-lang/fpm/blob/master/PACKAGING.md">FPM packaging guide</a> +to learn how to build your package with FPM.</p> + +<p>FPM is still in very early development, and we need as much help as we can get. +Here’s how you can help today:</p> + +<ul> + <li>Try to use it. Does it work? No? Let us know!</li> + <li>Browse the <a href="https://github.com/fortran-lang/fpm/issues">open issues</a> and see if you can help implement any fixes or features.</li> + <li>Adapt your Fortran package for FPM.</li> + <li>Improve the documentation.</li> +</ul> + +<p>The short term goal of FPM is to make development and installation of Fortran packages with dependencies easier. +Its long term goal is to build a rich and decentralized ecosystem of Fortran packages and create a healthy +environment in which new open source Fortran projects are created and published with ease.</p> + +<h2 id="wg5-convenor-candidates">WG5 Convenor candidates</h2> + +<p>Last month was also the deadline for the <a href="https://wg5-fortran.org/">WG5</a> +convenor candidates to apply for the next 3-year term (2021-2024). +There are two candidates:</p> + +<ul> + <li> + <p><a href="https://stevelionel.com">Steve Lionel</a>, who is also the current WG5 convenor, +announced running for another term. +Read Steve’s <a href="https://stevelionel.com/drfortran/2020/04/25/doctor-fortran-in-forward">post</a> +about how he has guided the standardization process over the past three years and his direction for the future.</p> + </li> + <li> + <p><a href="https://ondrejcertik.com">Ondřej Čertík</a> has also announced announced to run +for the WG5 convenor. +Read Ondřej’s <a href="https://ondrejcertik.com/blog/2020/04/running-for-wg5-convenor-announcement/">announcement</a> +and <a href="https://github.com/certik/wg5_platform_2020">platform</a> +that detail current issues with Fortran language development and how to +overcome them going forward.</p> + </li> +</ul> + +<h2 id="events">Events</h2> + +<ul> + <li><a href="https://openteams.com">OpenTeams</a> and <a href="https://quansight.com">QuanSight</a> hosted Ondřej Čertík and Milan Curcic +in the Episode 40 of the Open Source Directions Webinar. +They talked about the current state and future of Fortran, as well as about building the Fortran community and developer tools. +Read more about it and watch the video <a href="/newsletter/2020/04/18/Fortran-Webinar/">here</a>.</li> + <li><a href="https://tcevents.chem.uzh.ch/event/12">FortranCon 2020</a> will take place on July 2-4 in Zurich, Switzerland. +Virtual participation is enabled for both attendees and speakers. +Registration is free and due by June 1, 2020.</li> + <li>J3/WG5 joint meeting will take place on October 12-16 in Las Vegas, Nevada. +You can submit a proposal for the Standards committee <a href="https://github.com/j3-fortran/fortran_proposals">here</a>. +For reference, you can read the <a href="/newsletter/2020/02/28/J3-february-meeting">notes from the February meeting</a>.</li> +</ul> + +<h2 id="whos-hiring">Who’s hiring?</h2> + +<ul> + <li><a href="https://g.co/kgs/aogdeh">Intel Corporation (Santa Clara, CA): Software Engineer, Fortran</a></li> + <li><a href="https://g.co/kgs/5X3d2Y">Intel Corporation (Hillsboro, OR): Software Engineer, Fortran</a></li> + <li><a href="https://g.co/kgs/yuaohU">Pozent (York, PA): Fortran Technical Lead</a></li> + <li><a href="https://g.co/kgs/VAWjWk">American Cybersystems, Inc. (Binghamton, NY): Software Engineer (Fortran, C/C++, Ada, C#, Java, Radar)</a></li> + <li><a href="https://g.co/kgs/eLsn63">BravoTech (Dallas, TX): C++ / Fortran Developer</a></li> + <li><a href="https://g.co/kgs/eYftiA">Siemens (Milford, OH): CAE Software Engineer (Fortran or C++) Design and Topology Optimization</a></li> +</ul> + + + + + Open Source Directions Fortran webinar + + 2020-04-18T00:00:00+03:00 + /news/newsletter/2020/04/18/Fortran-Webinar + <p>Ondřej Čertík (<a href="https://twitter.com/ondrejcertik">@ondrejcertik</a>) and +Milan Curcic (<a href="https://twitter.com/realmilancurcic">@realmilancurcic</a>) spoke +yesterday about the future of Fortran in Episode 40 of the Open Source +Directions Webinar. +We discussed the current state of the language, how it’s currently developed, +and what we can do today to build the Fortran community, ecosystem of packages, +and developer tools.</p> + +<p>Watch the episode now:</p> + +<iframe width="560" height="315" src="https://www.youtube.com/embed/2NiS2tdDO_4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe> + +<p>Special thanks to our hosts Melissa Mendonça +(<a href="https://twitter.com/melissawm">@melissawm</a>) and Madicken Munk +(<a href="https://twitter.com/munkium">@munkium</a>), as well as +<a href="https://openteams.com">OpenTeams</a> and <a href="https://www.quansight.com/">QuanSight</a> +for having us.</p> + +<p>You can find all previous episodes of the Open Source Directions webinar +<a href="https://www.quansight.com/open-source-directions">here</a>.</p> + + + + + Announcing FortranCon 2020 + + 2020-04-06T00:00:00+03:00 + /news/newsletter/2020/04/06/Announcing-FortranCon-2020 + <p>FortranCon 2020, the first international conference targeting the Fortran +programming language, will take place on July 2-4, 2020, in Zürich, Switzerland.</p> + +<blockquote class="twitter-tweet"><p lang="en" dir="ltr">We&#39;re happy to announce the (to our knowledge first) International <a href="https://twitter.com/hashtag/Fortran?src=hash&amp;ref_src=twsrc%5Etfw">#Fortran</a> <a href="https://twitter.com/hashtag/Conference?src=hash&amp;ref_src=twsrc%5Etfw">#Conference</a> July 2.-4. at the <a href="https://twitter.com/UZH_en?ref_src=twsrc%5Etfw">@UZH_en</a> in <a href="https://twitter.com/hashtag/Zurich?src=hash&amp;ref_src=twsrc%5Etfw">#Zurich</a>, <a href="https://twitter.com/hashtag/Switzerland?src=hash&amp;ref_src=twsrc%5Etfw">#Switzerland</a> with <a href="https://twitter.com/DoctorFortran?ref_src=twsrc%5Etfw">@DoctorFortran</a> joining as keynote speaker! Call for presentations is open: <a href="https://t.co/LnyOZxHrZI">https://t.co/LnyOZxHrZI</a> <a href="https://twitter.com/hashtag/HPC?src=hash&amp;ref_src=twsrc%5Etfw">#HPC</a></p>&mdash; tizianomueller (@tizianomueller) <a href="https://twitter.com/tizianomueller/status/1247121616326348800?ref_src=twsrc%5Etfw">April 6, 2020</a></blockquote> +<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> + +<p>FortranCon aims to bring together developers of Fortran libraries, +applications, and language itself to share their experience and ideas. +The conference is organized in two full days of speaker presentations +on July 2 and 3, and a half-day workshop with lectures and hands-on sessions +on July 4. +Click <a href="https://tcevents.chem.uzh.ch/event/12/abstracts/">here</a> to submit +an abstract.</p> + +<p>The keynote presentation will be delivered by Steve Lionel +(<a href="https://twitter.com/doctorfortran">@doctorfortran</a>), convener of the +US Fortran Standards Committee.</p> + +<p>The <a href="https://tcevents.chem.uzh.ch/event/12/registrations/">registration</a> +is <strong>free of charge</strong>, with June 1, 2020 as the deadline. +Virtual participation will be enabled for speakers and attendees unable to +travel.</p> + +<p>Read more about FortranCon 2020 <a href="https://tcevents.chem.uzh.ch/event/12/">here</a>.</p> + + + + + J3 February 2020 Meeting + + 2020-02-28T00:00:00+02:00 + /news/newsletter/2020/02/28/J3-february-meeting + <p>The J3 Fortran Committee meeting took place in Las Vegas, NV, on February 24-28, +2020.</p> + +<h2 id="attendance">Attendance</h2> + +<p>The following people / companies attended:</p> + +<p>Voting members:</p> + +<ol> + <li>Intel: Jon Steidel</li> + <li>HPE/Cray: Bill Long</li> + <li>NVIDIA: Peter Klausler, Gary Klimowicz</li> + <li>IBM: Daniel Chen</li> + <li>ARM: Srinath Vadlamani</li> + <li>NCAR: Dan Nagle, Magne Haveraaen</li> + <li>NASA: Tom Clune</li> + <li>JPL: Van Sneider</li> + <li>LANL: Zach Jibben, Ondřej Čertík</li> + <li>ORNL: Reuben Budiardja</li> + <li>LBNL: Brian Friesen</li> + <li>Sandia: Damian Rouson</li> + <li>Lionel: Steven Lionel, Malcolm Cohen, Vipul Parekh</li> + <li>Corbett: Bob Corbett</li> +</ol> + +<p>Others:</p> + +<ol> + <li>AMD: Richard Bleikamp</li> + <li>WG23: Stephen Michell (convenor), Erhard Ploedereder (member)</li> + <li>Structural Integrity: Brad Richardson</li> +</ol> + +<h2 id="proposals-discussed-at-plenary">Proposals Discussed at Plenary</h2> + +<h3 id="monday-224">Monday 2/24</h3> + +<h3 id="tuesday-225">Tuesday 2/25</h3> + +<ul> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/22">#22</a> : Default values of optional arguments (<a href="https://j3-fortran.org/doc/year/20/20-107.txt">https://j3-fortran.org/doc/year/20/20-107.txt</a>)</li> +</ul> + +<h3 id="wednesday-226">Wednesday 2/26</h3> + +<ul> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/157">#157</a> : Rank-agnostic array element and section denotation (<a href="https://j3-fortran.org/doc/year/20/20-113.txt">https://j3-fortran.org/doc/year/20/20-113.txt</a>, <a href="https://j3-fortran.org/doc/year/20/20-115.txt">https://j3-fortran.org/doc/year/20/20-115.txt</a>)</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/158">#158</a> : TYPEOF and CLASSOF (<a href="https://j3-fortran.org/doc/year/20/20-114.txt">https://j3-fortran.org/doc/year/20/20-114.txt</a>)</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/1">#1</a> : Namespace for modules (<a href="https://j3-fortran.org/doc/year/20/20-108.txt">https://j3-fortran.org/doc/year/20/20-108.txt</a>)</li> + <li>Interpretation: FORM TEAM and failed images (<a href="https://j3-fortran.org/doc/year/20/20-102r1.txt">https://j3-fortran.org/doc/year/20/20-102r1.txt</a>)</li> + <li>Interpretation: Collective subroutines and STAT= (<a href="https://j3-fortran.org/doc/year/20/20-104r1.txt">https://j3-fortran.org/doc/year/20/20-104r1.txt</a>)</li> +</ul> + +<h3 id="thursday-227">Thursday 2/27</h3> + +<ul> + <li>Interpretation: events that cause variables to become undefined (<a href="https://j3-fortran.org/doc/year/20/20-119.txt">https://j3-fortran.org/doc/year/20/20-119.txt</a>)</li> + <li>Edits for SIMPLE procedures (<a href="https://j3-fortran.org/doc/year/20/20-116.txt">https://j3-fortran.org/doc/year/20/20-116.txt</a>)</li> + <li>BFLOAT16 (<a href="https://j3-fortran.org/doc/year/20/20-118.txt">https://j3-fortran.org/doc/year/20/20-118.txt</a>)</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/146">#146</a> : Interpretation: allocatable component finalization (<a href="https://j3-fortran.org/doc/year/20/20-117.txt">https://j3-fortran.org/doc/year/20/20-117.txt</a>)</li> +</ul> + +<h3 id="friday-228">Friday 2/28</h3> + +<ul> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/157">#157</a> : Rank-agnostic syntax (<a href="https://j3-fortran.org/doc/year/20/20-120.txt">https://j3-fortran.org/doc/year/20/20-120.txt</a>). Passed unanimously with minor changes.</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/156">#156</a> : Protected components (<a href="https://j3-fortran.org/doc/year/20/20-121.txt">https://j3-fortran.org/doc/year/20/20-121.txt</a>). Withdrawn to address conflicting interests.</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/160">#160</a> : Edits for auto-allocate characters (<a href="https://j3-fortran.org/doc/year/20/20-122.txt">https://j3-fortran.org/doc/year/20/20-122.txt</a>). Passed unanimously with minor changes.</li> + <li>Edits for procedure pointer association (<a href="https://j3-fortran.org/doc/year/20/20-123.txt">https://j3-fortran.org/doc/year/20/20-123.txt</a>). Passed unanimously.</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/157">#157</a> : Edits for rank-agnostic bounds (<a href="https://j3-fortran.org/doc/year/20/20-124.txt">https://j3-fortran.org/doc/year/20/20-124.txt</a>). Withdrawn because some edits were missing and need to be added. There were concerns about fitting into the framework of generics later on.</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/157">#157</a> : Edits for rank-agnostic array element and section denotation (<a href="https://j3-fortran.org/doc/year/20/20-125.txt">https://j3-fortran.org/doc/year/20/20-125.txt</a>). Failed (5 v 7). Missing edits, and disagreement on types vs rank-1 integers, the options need to be explored more.</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/157">#157</a> : Edits for rank-agnostic allocation and pointer assignment (<a href="https://j3-fortran.org/doc/year/20/20-126.txt">https://j3-fortran.org/doc/year/20/20-126.txt</a>). Passed unanimously with minor changes.</li> + <li>Interpretation: Public namelist and private variable (<a href="https://j3-fortran.org/doc/year/20/20-127.txt">https://j3-fortran.org/doc/year/20/20-127.txt</a>). Straw vote (0 yes, 8 no, 9 undecided). Passed unanimously with “no” alternative.</li> + <li>Interpretation F18/015 (<a href="https://j3-fortran.org/doc/year/20/20-105.txt">https://j3-fortran.org/doc/year/20/20-105.txt</a>). Passed unanimously.</li> +</ul> + +<h2 id="skipped">Skipped</h2> + +<p>This was on the plan but we did not get to it:</p> + +<ul> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/5">#5</a> : US 27 POINTER dummy arguments, INTENT, and target modification (<a href="https://j3-fortran.org/doc/year/18/18-144r1.txt">https://j3-fortran.org/doc/year/18/18-144r1.txt</a>)</li> + <li><a href="https://github.com/j3-fortran/fortran_proposals/issues/19">#19</a> : Short-circuiting proposal</li> +</ul> + +<h2 id="more-details">More Details</h2> + +<p>More details available at +<a href="https://github.com/j3-fortran/fortran_proposals/issues/155">j3-fortran/fortran_proposals #155</a> and at the official <a href="https://j3-fortran.org/doc/year/20/minutes221.txt">minutes</a> from the meeting.</p> + + + + + + diff --git a/learn/quickstart/derived_types.md b/learn/quickstart/derived_types.md new file mode 100644 index 000000000..6c769858a --- /dev/null +++ b/learn/quickstart/derived_types.md @@ -0,0 +1,298 @@ +--- +layout: book +title: Derived types +permalink: /learn/quickstart/derived_types +--- + +As discussed previously in [Variables]({{site.baseurl}}/learn/quickstart/variables) there are five built-in data types in Fortran. _Derived types_ is a special form of a data type that can encapsulate other built-in types as well as other _derived types_. It could be considered as the equivalent of _struct_ in the C/C++ programming languages. + +## A quick take on derived types + +Example of a basic derived type: + +```fortran +type :: my_type + integer :: i + real :: x +end type +``` + +The syntax for creating a variable of type _my_type_ and accessing its members: +```fortran +! declare +type(my_type) :: foo +! initialize +foo%i = 1 +foo%x = 0.5 +``` + +{% include note.html content="In Fortran the percentage symbol `%` is used to access the members of a derived type." %} + +To initialize the members of _my_type_ one can use either individual initialization as demonstrated in the above example, or the assignment operator (=), or the default initialization. + + +Example using the assignement operator (=): +```fortran +foo = my_type(1, 0.5) +! or using F2003 stardard and on +foo = my_type(i=1, x=0.5) +``` + +Example with default initialization: +```fortran +type :: my_type + integer :: i = 1 + real :: x = 0.5 +end type +! then it is possible to use as +type(my_type) :: foo +foo = my_type(i=2) ! foo%i gets a new value, but foo%x retains the default one. +``` + +## Derived types in detail + +The full syntax of a derived type with all optional properties is presented below: + +```fortran +type [,attribute-list] :: name [(parameterized-decleration-list)] + [parameterized-definition-statements] + [private statement or sequence statement] + [member-variables] + contains + [type-bound-procedures] +end type +``` + +### Part 1: Options to declare a derived type + +`attribute-list` may refer to the following: + +- _access-type_ that is either `public` or `private` +- `bind(c)` offers interoperability with C programming language +- `extends(`_parent_`)` where _parent_ is the name of a previously declared derived type, from which, the current derived type will inherit all its members and functionality. +- `abstract` an object orianted feature that is covered in the advanced programming tutorial. + +{% include note.html content="If the `attribute: bind(c)` or the `statement: sequence` is used then a derived type cannot have the `attribute: extends` and visa-versa." %} + +The `sequence` attribute may be used only to declare that the following members should be accessed in the same order as they are defined within the derived type. + +Example with `sequence`: +```fortran +type :: foo +sequence +integer :: var1 +real :: var2 +end type +! init +type(foo) :: bar +bar = foo(1, 0.5) +``` +{% include note.html content="The use of statement `sequence` presupposes that the data types defined below are neither of `allocatable` nor of `pointer` type. Furthermore, it does not imply that these data types will be stored in memory in any particular form, there is no relation to `contigeous` attribute." %} + +The _access-type_ attributes `public` and `private` if used, declare that all [member-variables] declared below will be automatically assigned the attribute accordingly. + +The attribute `bind(c)` is used to achieve compatibility between Fortran's derived type and C's struct. + +Example with 'bind(c)`: +```fortran +module mymod +use iso_c_bindings +implicit none +type, bind(c) :: mytype + integer(c_int) :: i +end type +``` +matches the following C struct: +```c +struct{ + int i +}mytype; +``` +{% include note.html content="A fortran derived type with the attribute `bind(c)` cannot have the `sequence` and `extends` attributes. Furthermore it cannot contain any Fortran `pointer` or `allocatable` types." %} + +`parameterized-decleration-list`: is an optional feautre. If used, then the parameters must be listed in place of [parameterized-definition-statements] and must be either `len` or `kind` parameters or both. + +Example of a derived type with `parameterized-decleration-list` and with the `attribute: public`: + ```fortran +module mymod +implicit none +private + +type, public :: matrix(rows, cols, k) + integer, len :: rows, cols + integer, kind :: k = kind(0.0) + real(kind = k), dimension(rows, cols) :: values +end type matrix +end module + +program test +use mymod +implicit none +type(matrix(rows=5, cols=5)) :: m +end program + ``` +{% include note.html content="In this example the parameter **k** has already been assigned a default value of `kind(0.0)`, that is of floating point single precision, for that reason it can be ommited, as it is the case here in the declaration inside the main program." %} + +{% include important.html content="By default derived types and their members are public. However, in this example the attribute `private` is used at the beginning of the module, therefore, everything within the module will be by default `private` unless, explicitly, declared as `public`. If the type **matrix** was not given the attribute `public` in the above example, then the compiler would throw an error inside **program test**." %} + +The attribute `extends` was added in F2003 standard and introduces an important feature of the object oriented paradigm (OOP), namely the inheritance. It allows code reusability by letting children-derived-types like this: `type, extends(parent) :: child` to inherit all the members and functionality from a parent-derived-type: `type :: parent`. + +Example with the attribute `extends`: +```fortran +module mymod +implicit none +private +public t_date, t_address, t_person, t_employ ! note another way of using the public attribute by gathering all public data types in one place + +type :: t_date + integer :: year, month, day +end type + +type :: t_address + character(len=:), allocatable :: city, road_name + integer :: house_number +end type + +type, extends(t_address) :: t_person + character(len=:), allocatable :: first_name, last_name, e_mail +end type + +type, extends(t_person) :: t_employ + type(t_date) :: hired_date + character(len=:), allocatable :: position + real :: monthly_salary +end type +end module + +program test +use mymod +implicit none +type(t_employ) :: employ + +! initialization +employ%hired_date%year = 2020 ! t_employ has access to type(t_date) members not because of extends but because a type(t_date) was declared within t_employ +employ%hired_date%month = 1 +employ%hired_date%day = 20 +employ%first_name = 'Johny' !t_employ has acces to t_person, and inherits its members due to extends +employ%last_name = 'Doe' +employ%city = 'London' ! t_employ has access to t_address, because it inherits from t_person, that in return inherits from t_address +employ%road_name = 'BigBen' +employ%house_number = 1 +employ%position = 'Intern' +employ%monthly_salary = 0.0 +end program +``` + +### Part 2: Options to declare members of a derived type + +`[member-variables]` refers to the decleration of all the member data types. These data types can be of any built-in data type, and/or of other derived types, as already show-cased in the above examples. However, member-variables can have their own extensive syntax, in form of: +`type [,member-attributes] :: name[attr-dependent-spec][init]` + +`type`: any built-in type or other derived type + +`member-attributes` (optional): + +- `pointer` to specify a pointer +- `allocatable` with or without `dimension` to specify a dynamic array +- `public` or `private` access attributes +- `protected` access attribute +- `codimension` to specify a coarray +- `contigeous` + +{% include note.html content="`pointer` and `allocatable` cannot co-exist." %} + +{% include note.html content="`contigeous` requires an array with the `pointer` attribute." %} + +Examples for common cases: + +```fortran +type :: t_example + !1st case: simple built-in type with access attribute and [init] + integer, private :: i = 0 ! private hides it from use outside of the t_example's scope. The default initialization [=0] is the [init] part. + + !2nd case: dynamic 1d_array + real, allocatable, dimension(:) :: x + ! the same as + real, allocatable :: x(:) ! parenthesis implies dimension(:) and is one of the possible [attr-dependent-spec]. + + !3rd case: protected + integer, protected :: i ! In contrary to private, protected allows access to i assigned value outside of t_example but is not definable, i.e. a value may be assigned to i only within t_example. + + !4th case: pointer, with [init] + real, pointer :: x(:) => null() ! the [init] part is the [=>null()], pointers are discussed in the Advanced programming mini-book. + + !5th case: coarray + real, allocatable, codimension[:] :: z(:) ! a 1d_dynamic array shared in all threads. Coarrays will be discussed in the Advanced programming mini-book. + !or + real, allocatable :: z(:)[:] ! here the [:] is the [attr-dependent-spec] and implies the codimension[:]. + + !6th case: contigeous + real, contigeous, pointer :: x(:) +end type +``` + +{% include note.html content="In the above example the cases 4, 5 and 6 make use of Fortran `pointer` and `coarray` features that have not been addressed in this quickstart tutorial. However, they are presented here, in order for the readers to know that these feautures do exist and be able to recognise them. These features will be covered in detail in the upcoming `Advanced programing` mini-book." %} + +### Part 3: Type-bound procedures + +A derivd type is possible to contain procedures either `functions` or `subroutines` that are **bound** to this derived type. Type procedures must follow the `contains` statement that, in return, must be used within the derived type and after all [member-variables] have been declared. + +{% include note.html content="It is impossible to describe type-bound procedures in their full syntax without delving into OOP features of modern Fortran. For that reason only a simple example is provided in this final part, to demostrante a very besic use." %} + +Example of a derived type with basic bound-procedure: + +```fortran +module mymod +implicit none +private +public t_square + +type :: t_square + real :: side + contains + procedure :: area !procedure decleration +end type + +contains + ! procedure definition + real function area(self) result(res) + class(t_square), intent(in) :: self + res = self%side * self%side + end function +end module + +program main +use mymod +implicit none +! variables decleration +type(t_square) :: sq +real :: x, side + +! variables initialization +side = 0.5 +sq%side = side + +x = sq%area() ! self does not appear here, it has been passed implicitly +! do stuff with x... +end program +``` +What is new: + + - **self** is a random name that was chosen to represent the derived type t_square that is passed as an argument to the bound-function in order to have access to its data-members. By passing it like that it is ensured that later during its use the t_square will be passed automatically and not by the client. + - in order to have the above functionality the new keyword `class` replaced the `type` one. With `class` the OOP feature *polymorphism* is introduced. + - since the bound-procedure **area** was defined as a function it cannot be called by itself, it can only appear as **rhs** object, that is why it is used like `x = sq%area()`. The 'stand-alone' functionality is covered by a subroutine, and the above example should be modified like: + + ```fortran + ! change within module + contains + subroutine area(self, x) + class(t_square), intent(in) :: self + real, intent(in out) :: x + x = self%side * self%side + end subroutine + +! change within main program +call sq%area(x) +! do stuff with x... + ``` + In this case there are two arguments in definition, one similar as before the **self** of type `t_square` and the second one a real variable **x** that should be assigned the calculated area and returned back for further use. \ No newline at end of file