Advanced modern Fortran


The course provides an introduction to the rest of the capabilities of modern Fortran, including generic programming, object oriented programming, parameterised derived types, exception handling using IEEE facilities, C interoperability and parallel programming.

The course is suitable for people who have attended the Introduction to modern Fortran course, or have a basic grounding in Fortran or a good grounding in another programming language.

The course is also suitable for people wanting to convert from another language and already have a basic grounding in Fortran.

Topics covered

  • The Fortran organisational method, equivalent to classes in other languages
    • Basic module syntax
    • Modules for global data
    • Modules for precision specification and constant definition
    • Modules for globally sharing data
    • Modules for derived data types
    • Implicit and explicit interfaces
  • Data structuring in Fortran

    • Several examples illustrating the basic syntax

  • Operator overloading
  • Basic syntax
  • Generic programming
    • Basic syntax
    • Generic programming and other languages
    • Generic sorting with support for 4 integer and 3 real types
    • Generic statistics module with support for 3 precisions

  • Mathematical examples
    • Using linked lists for sparse matrix problems

    • Inner product of two sparse vectors

    • Solving 1st order Ordinary Differential Equations using Runge Kutta Merson
      • Automatic arrays
      • Subroutine as a dummy procedure argument
    • A subroutine to extract the diagonal elements of a matrix
    • The solution of a system of linear simultaneous equations using Gaussian Elimination
  • Parameterised derived types

    • Linked list parameterised by real kind type
    • Ragged array parameterisedby real kind type
  • Object Oriented Programming
  • Basic syntax in Fortran
  • Base class
  • Derived or inherited classes:
  • Derived types and structure constructors
  • Structure constructors and generic names
  • Derived classes and inheritance
  • Polymorphism and dynamic binding
    • Introduction to parallel programming
    • Basic technical background
    • Amdahl's Law
    • Gustafson's law
    • Fortran and parallel programming
    • Introduction to MPI (Message Passing Interface)
      • MPI Implementations
      • Compiler and implementation combination
      • Examples highlighting the basics of MPI programming
    • Introduction to OpenMP
      •  The OpenMP Model
      • Examples highlighting the basics of OpenMP programming
    • Introduction to Coarray Fortran
    • The coarray model
    • Examples highlighting the basics of Coarray Fortran
    • C Interop
    • Basic introduction
    • Examples illustrating:
      • Fortran calling C
      • Fortran calling C++
      • C calling Fortran
      • C++ calling Fortran
    • IEEE arithmetic
      • Basic history and background
      • Examples illustrating the use of Fortran's IEE support for numeric exception handling
    • Third part libraries

      • Benchmarking user written generic recursive Quicksort algorithm
      •  Benchmarking user written non recursive Quicksort 
      • The NAG library for SMP and Multicore 
      • Benchmarking one of the NAG parallel sorting routines
      • Comparison of the three sorting methods
      • Graphics libraries 
      • Examples using the Dislin graphics library

    • Converting from Fortran 77
    • Deleted language features
    • Obsolescent language features
    • Third party conversion tools

    Course material


    For more information please contact